A Prototype of Comparison Tool for Android Applications

  • Slides: 44
Download presentation
A Prototype of Comparison Tool for Android Applications Based on Difference of API Calling

A Prototype of Comparison Tool for Android Applications Based on Difference of API Calling Sequences Tetsuya Kanda, Yuki Manabe, Takashi Ishio, Makoto Matsushita, Katsuro Inoue Graduate School of Information Science and Technology, Osaka University, Japan Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Many Applications in the World • Many applications are available – from Android Market

Many Applications in the World • Many applications are available – from Android Market – from Apple App Store. . . • We focused on Android applications. • Some applications have similar features – About 3, 000 “calculator” applications in Android Market (May 2011) 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Similar Applications • Screenshots of Android applications labeled “Map” in Google Code 3 Software

Similar Applications • Screenshots of Android applications labeled “Map” in Google Code 3 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Similar Applications • Screenshots of Android applications labeled “Map” in Google Code What is

Similar Applications • Screenshots of Android applications labeled “Map” in Google Code What is the difference of these applications? 4 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Differences of the Applications • Make comparison chart to clarify differences Alert Dialog ID

Differences of the Applications • Make comparison chart to clarify differences Alert Dialog ID App A App B App C App D ✓ ✓ ✓ ✓ ✓ Get Latitude and Longitude Show Toast (pop-up message) Set Latitude and Longitude ✓ ✓ 5 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

How to Compare Applications • Trial use of applications – Can’t test ALL features

How to Compare Applications • Trial use of applications – Can’t test ALL features in applications • Users can’t test the feature they don’t know. – Takes a lot of time • Reading documents – Some documents are too long to understand. – Some documents have too little information. – Some applications have no documents. • Comparing source code 6 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Comparing source code • Source code explains almost all behavior of the applications. •

Comparing source code • Source code explains almost all behavior of the applications. • Can’t compare directly – Almost all of source code will be extracted as differences. Comparing two twitter client applications + if (col. Index > -1) { + in. Reply. To = m. Cursor. get. String(col. Index); + if (in. Reply. To != null && "null". equals(in. Reply. To) == false) { + in. Reply. To = String. format(Locale. get. Default(), get. Text(R. string. tweet_source_in_reply_to). to. String(), in. Reply. To); } terp_handler = new Handler() { public void handle. Message(Message m) { switch (m. arg 1) { case -1: 7 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Android • A platform for mobile devices • Android smartphones have many characteristic devices.

Android • A platform for mobile devices • Android smartphones have many characteristic devices. – Wi-Fi adaptor – GPS – Touch panels – Gravity sensors – Cameras – etc… 8 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Features and Devices • Features correspond to devices. Application Display a map of current

Features and Devices • Features correspond to devices. Application Display a map of current location Devices GPS Features Get current location Touch panel Scroll Map 9 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Features, APIs and Devices • Application controls devices by calling APIs. Application Display a

Features, APIs and Devices • Application controls devices by calling APIs. Application Display a map of current location Features Get current location Scroll Map SDK APIs for controlling a GPS device APIs for controlling a touch panel Devices GPS Touch panel 10 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Idea • A feature calls APIs to control devices. • An API calling sequence

Idea • A feature calls APIs to control devices. • An API calling sequence corresponds to a feature. – an API calling sequence: a sequence of method calls of API classes in a single method • Compare APIs to compare features of applications – The difference of API calls represents the difference of features. 11 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application X 1 Knowledge -base Application X 2 Phase 2: Comparing applications Proposal method   X 1 -Feature X 2 -Feature   Common  Feature 12 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application X 1 Knowledge -base Application X 2 Phase 2: Comparing applications Proposal method   X 1 -Feature X 2 -Feature   Common  Feature 13 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Knowledge-base • Mappings of API calling sequence and its feature name • Example: Feature

Knowledge-base • Mappings of API calling sequence and its feature name • Example: Feature name API calling sequences Show Toast (pop-up message) android. widget. Toast. make. Text android. widget. Toast. show Get Latitude and Longitude android. location. Location. get. Latitude android. location. Location. get. Longitude 14 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with similar feature 2. Extract API calls appeared in two or more applications (COMMON) 3. Filter COMMON manually and assign a feature name COMMON A. m 1() B. m 2() C. m 1() Filtering (Removed) A. m 1() B. m 2() Assign a feature name Filtering Feature 2 B. m 2() C. m 1() Knowledgebase 15 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with similar feature 2. Extract API calls appeared in two or more applications (COMMON) 3. Filter COMMON manually and assign a feature name COMMON A. m 1() B. m 2() C. m 1() Filtering (Removed) A. m 1() B. m 2() Assign a feature name Filtering Feature 2 B. m 2() C. m 1() Knowledgebase 16 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Extract API Calls • Each method is translated into an API calling. • Extract

Extract API Calls • Each method is translated into an API calling. • Extract only Android API calls • We define Android API as: – Whose fully qualified names start with “android” or “com. google. android” • Ignore control statement 17 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Example of extracting API Calls Source Code public void on. Click(View v) { 1

Example of extracting API Calls Source Code public void on. Click(View v) { 1 String s = str. substring(2); Intent intent=new Intent(this, com. example. edit. class); start. Activity(intent); } 2 API Calling android. content. Intent Sequence android. app. Activity. start. Activity 1 2 18 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with

Making a Knowledge-base Applications with similar feature Extract API calls 1. Collect applications with similar feature 2. Extract API calls commonly appeared (COMMON) 3. Filter COMMON manually and assign a feature name COMMON A. m 1() B. m 2() C. m 1() Filtering (Removed) A. m 1() B. m 2() Assign a feature name Filtering Feature 2 B. m 2() C. m 1() Knowledgebase 19 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Filtering(1/2) • Manually remove API calling sequences that are not explaining a specific feature

Filtering(1/2) • Manually remove API calling sequences that are not explaining a specific feature • Criteria: – Control or get information using devices – Showing notification (dialog) – Using Intent (call for another application) Feature name API calling sequences ? ? ? android. widget. Text. View. set. Text android. view. View. set. Visibility ? ? ? android. location. Location. get. Latitude android. location. Location. get. Longitude 20 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Filtering(2/2) • Manually remove API calling sequences that are not explaining a specific feature

Filtering(2/2) • Manually remove API calling sequences that are not explaining a specific feature • Criteria: – Control or get information using devices – Showing notification (dialog) – Using Intent (call for another application) Feature name ? ? ? Get Latitude and Longitude API calling sequences android. widget. Text. View. set. Text android. view. View. set. Visibility android. location. Location. get. Latitude android. location. Location. get. Longitude 21 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application

Proposal Method Applications Application with similar ss feature Phase 1: Making a knowledgebase Application X 1 Knowledge -base Application X 2 Phase 2: Comparing applications Proposal method   X 1 -Feature X 2 -Feature   Common  Feature 22 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Comparing Applications Application X 1 Extract API calls Application X 2 Extract API calls

Comparing Applications Application X 1 Extract API calls Application X 2 Extract API calls A. m 1() B. m 2() API Calling. B. m 2() B. m 3() Sequences. D. m 2() C. m 1() B. m 3() D. m 4() Compare DIFF-X 1 COMMON Check Knowledge -base     X 1 -Feature   Common  Feature   DIFF-X 2 Check   X 2 -Feature     23 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Comparing Applications Application X 1 Extract API calls Application X 2 Extract API calls

Comparing Applications Application X 1 Extract API calls Application X 2 Extract API calls A. m 1() B. m 2() API Calling. B. m 2() B. m 3() Sequences. D. m 2() C. m 1() B. m 3() D. m 4() Compare DIFF-X 1 COMMON Check Knowledge -base     X 1 -Feature   Common  Feature   DIFF-X 2 Check   X 2 -Feature     24 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Compare API Calling Sequences (1/3) API calling sequence from Application X 1 A. m

Compare API Calling Sequences (1/3) API calling sequence from Application X 1 A. m 1() B. m 2() B. m 3() C. m 1() D. m 4() B. m 3() A. m 1() B. m 2() D. m 2() B. m 3() API calling sequence from Application X 2 25 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Compare API Calling Sequences (2/3) API calling sequence from Application X 1 A. m

Compare API Calling Sequences (2/3) API calling sequence from Application X 1 A. m 1() B. m 2() B. m 3() C. m 1() D. m 4() B. m 3() A. m 1() B. m 2() D. m 2() B. m 3() API calling sequence from Application X 2 Compare COMMON A. m 1() B. m 2() 26 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Compare API Calling Sequences (3/3) API calling sequence from Application X 1 A. m

Compare API Calling Sequences (3/3) API calling sequence from Application X 1 A. m 1() B. m 2() B. m 3() C. m 1() D. m 4() B. m 3() A. m 1() B. m 2() D. m 2() B. m 3() API calling sequence from Application X 2 Compare DIFF-X 1 COMMON DIFF-X 2 B. m 3() C. m 1() D. m 4() A. m 1() B. m 2() B. m 3() D. m 2() B. m 3() 27 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Compare Two Applications Application X 1 Extract API calls Application X 2 Extract API

Compare Two Applications Application X 1 Extract API calls Application X 2 Extract API calls A. m 1() B. m 2() API Calling. B. m 2() B. m 3() Sequences. D. m 2() C. m 1() B. m 3() D. m 4() Compare DIFF-X 1 COMMON Check Knowledge -base     X 1 -Feature   Common  Feature   DIFF-X 2 Check   X 2 -Feature     28 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Check with a Knowledge-base COMMON A. m 1() B. m 2() B. m 3()

Check with a Knowledge-base COMMON A. m 1() B. m 2() B. m 3() C. m 1() D. m 4() DIFF-X 1 Knowledgebase Feature 1 Match A. m 1() B. m 2() Not Match A. m 1() B. m 3() B. m 2() DIFF-X 2 Feature 2 B. m 2() B. m 3() C. m 1() D. m 2() B. m 3() Feature 3 D. m 2() B. m 3() Match 29 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Prototype Tool : Startup Window Select target applications 30 Software Engineering Laboratory, Department of

Prototype Tool : Startup Window Select target applications 30 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Prototype Tool : Showing Result Extracted X 1 -feature Extracted Common-feature Extracted X 2

Prototype Tool : Showing Result Extracted X 1 -feature Extracted Common-feature Extracted X 2 -feature Select one Feature name and API calling sequence Information about each API calling sequence 31 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Case Study • Goal : To answer the following questions – RQ 1 Does

Case Study • Goal : To answer the following questions – RQ 1 Does an API calling sequence correspond to a feature of an application? – RQ 2 Is our prototype tool able to clarify differences of two applications? • Target : – 11 applications labeled “MAP” in Google code 32 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with the knowledge-base 3. Compare two applications using our prototype tool For making a knowledge-base 33 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with the knowledge-base 3. Compare two applications using our prototype tool Check with the knowledge-base 34 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with

Process 1. Make a knowledge-base with 6 applications 2. Check rest 5 applications with the knowledge-base 3. Compare two applications using our prototype tool Compare using our prototype tool 35 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Knowledge-base Feature name API calling sequences Alert Dialog android. app. Alert. Dialog. Builder. <Comstructor>

Knowledge-base Feature name API calling sequences Alert Dialog android. app. Alert. Dialog. Builder. <Comstructor> android. app. Alert. Dialog. Builder. set. Title Get Latitude and Longitude android. location. Location. get. Latitude android. location. Location. get. Longitude Show Toast (pop-up message) android. widget. Toast. make. Text android. widget. Toast. show Set Latitude and Longitude android. location. Location. set. Latitude android. location. Location. set. Longitude Submenu android. view. Menu. add. Sub. Menu android. view. Sub. Menu. set. Icon 23 API Calling sequences are stored into a knowledge-base. 36 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Result (1/4) ID App 1 App 2 App 3 App 4 App 5 Alert

Result (1/4) ID App 1 App 2 App 3 App 4 App 5 Alert Dialog ✓ ✓ ✓ Get Latitude and Longitude ✓ ✓ Show Toast (pop-up message) ✓ ✓ ✓ Set Latitude and Longitude ✓ Submenu ✓ ✓ ✓ 37 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Result (2/4) ID App 1 App 2 App 3 App 4 App 5 Alert

Result (2/4) ID App 1 App 2 App 3 App 4 App 5 Alert Dialog ✓ ✓ ✓ Get Latitude and Longitude ✓ ✓ Show Toast (pop-up message) ✓ ✓ ✓ Set Latitude and Longitude ✓ ✓ Submenu ✓ ✓ All five applications have “Alert Dialog” Feature 38 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Result (3/4) ID App 1 App 2 App 3 App 4 App 5 Alert

Result (3/4) ID App 1 App 2 App 3 App 4 App 5 Alert Dialog ✓ ✓ ✓ Get Latitude and Longitude ✓ ✓ Show Toast (pop-up message) ✓ ✓ ✓ Set Latitude and Longitude ✓ ✓ Submenu ✓ ✓ Application 2 doesn’t have “Get Latitude and Longitude” feature 39 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Result (4/4) ID App 1 App 2 App 3 App 4 App 5 Alert

Result (4/4) ID App 1 App 2 App 3 App 4 App 5 Alert Dialog ✓ ✓ ✓ Get Latitude and Longitude ✓ ✓ Show Toast (pop-up message) ✓ ✓ ✓ Set Latitude and Longitude ✓ Submenu ✓ ✓ ✓ API calling sequence shows the features of applications 40 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Output of the Tool (1/3) App 2 App 4 41 Software Engineering Laboratory, Department

Output of the Tool (1/3) App 2 App 4 41 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Output of the Tool (2/3) App 2 App 4 Both applications have “Alert Dialog”

Output of the Tool (2/3) App 2 App 4 Both applications have “Alert Dialog” Feature 42 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Output of the Tool (3/3) App 2 App 4 Information about each API calling

Output of the Tool (3/3) App 2 App 4 Information about each API calling sequence Geo. Activity. java Class: Geo. Activity Method: on. Create Line: 56 43 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

Conclusion and Future Work • Conclusion: – A prototype tool to compare two Android

Conclusion and Future Work • Conclusion: – A prototype tool to compare two Android applications using API calling sequences – Performed a case study – API calling sequences are usable for comparing applications • Future work: – Support to give an appropriate name to a sequence of API calls Portions of this presentation are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3. 0 Attribution License. 44 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University