SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Sta$c	
  Reference	
  Analysis	
  for	
  GUI	
  Objects	
  in	
  
Android	
  So9ware	
  	
  

Atanas	
  Rountev,	
  Dacong	
  (Tony)	
  Yan	
  
	
  
Ohio	
  State	
  University	
  

	
  

PRESTO:	
  Program	
  Analyses	
  and	
  So5ware	
  Tools	
  Research	
  Group,	
  Ohio	
  State	
  University	
  
MoFvaFon	
  and	
  Background
	
  
•  Android	
  so5ware	
  is	
  used	
  by	
  millions	
  of	
  users	
  

•  Requires	
  foundaFonal	
  program	
  analyses	
  for	
  improved	
  
performance	
  and	
  quality	
  

•  StaFc	
  reference	
  analysis	
  for	
  Java	
  
• 
• 
• 
• 

What	
  is	
  the	
  set	
  of	
  run-­‐Fme	
  objects?	
  
Which	
  variables	
  contain	
  references	
  to	
  which	
  objects?	
  
CriFcal	
  component	
  of	
  data-­‐	
  and	
  control-­‐flow	
  analysis	
  
Prerequisite	
  for	
  many	
  other	
  techniques	
  

•  ExisFng	
  work	
  cannot	
  be	
  applied	
  directly	
  to	
  Android	
  
•  Goal:	
  develop	
  a	
  precise	
  and	
  efficient	
  staFc	
  
reference	
  analysis	
  for	
  Android-­‐specific	
  features	
  
	
  	
  
2	
  
StaFc	
  Reference	
  Analysis	
  for	
  Android	
  Features
	
  
•  Android	
  applicaFon	
  

•  Driven	
  by	
  a	
  graphical	
  user	
  interface	
  (GUI)	
  
•  Ac#vity:	
  on-­‐screen	
  window	
  with	
  GUI	
  elements	
  (views)	
  
•  Event	
  handlers:	
  defined	
  in	
  listeners	
  and	
  associated	
  with	
  
views	
  to	
  respond	
  to	
  user	
  acFons	
  	
  

•  Need	
  to	
  model	
  staFcally	
  
• 
• 
• 
• 

	
  	
  
3	
  

Views	
  and	
  their	
  hierarchical	
  structure	
  
AssociaFon	
  of	
  views	
  with	
  acFviFes	
  
AssociaFon	
  of	
  views	
  with	
  listeners	
  
Variables	
  that	
  refer	
  to	
  views,	
  acFviFes,	
  and	
  listeners	
  
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
4	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
5	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
6	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
7	
  

RelativeLayout!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />! child
</RelativeLayout>!

Button: my_btn!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
8	
  

RelativeLayout!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />! child
</RelativeLayout>!

Button: my_btn!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
9	
  

RelativeLayout!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />! child
</RelativeLayout>!

Button: my_btn!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
10	
  

RelativeLayout!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />! child
</RelativeLayout>!

Button: my_btn!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
11	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
12	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
13	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
14	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Example
	
  
MyActivity.java:!
1
2

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

!
ButtonListener.java:!
8
9

class ButtonListener implements OnClickListener {!
void onClick(View d) { ... }

}!

!
main.xml:!
10
11
12
15	
  

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!

}!
Modeled	
  Android	
  OperaFons
	
  
•  Inflate	
  	
  

•  Create	
  GUI	
  structure	
  from	
  XML	
  and	
  aach	
  to	
  acFvity/view	
  

•  CreateView	
  

•  ProgrammaFcally	
  create	
  a	
  view	
  through	
  new	
  V	
  

•  FindView	
  

•  Lookup	
  a	
  view	
  from	
  acFvity	
  or	
  ancestor	
  view	
  (e.g.,	
  by	
  ID)	
  

•  SetListener	
  

•  Associate	
  view	
  and	
  listener	
  

•  AddView	
  

•  Establish	
  parent-­‐child	
  relaFonship	
  between	
  two	
  views	
  

•  SetId	
  
16	
  

•  ProgrammaFcally	
  set	
  the	
  ID	
  of	
  a	
  view	
  
Our	
  Proposal
	
  
•  Define	
  formal	
  seman#cs	
  of	
  GUI-­‐related	
  Android	
  
constructs	
  
•  Encode	
  semanFcs	
  of	
  an	
  Android	
  applicaFon	
  in	
  a	
  
constraint	
  graph	
  
•  Perform	
  constraint-­‐based	
  staFc	
  reference	
  analysis	
  

17	
  
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!

// SetListener

"...!

void onClick(View d) { ... }

}!

!
!
!

18	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

// FindView!

}

}!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!

// SetListener

"...!

void onClick(View d) { ... }

}!

!
MyActivity!
!
!

19	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

// FindView!

}

}!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!

// SetListener

"...!

void onClick(View d) { ... }

}!

!
MyActivity!
!
!

20	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

// FindView!

}

}!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!

// SetListener

"...!

void onClick(View d) { ... }

}!

!
MyActivity!
!

this2!

!

21	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

// FindView!

}

}!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
MyActivity!
!

c

this2!

!
b

a
22	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
MyActivity!

Inflate!

c

this2!

id:main!

!
!

b

a
23	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

MyActivity!

this2!

id:main!

Inflate!

b

id:my_btn!

!

FindView!

a

!

24	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

MyActivity!

this2!

id:main!

Inflate!

b

id:my_btn!

!

FindView!

a

!

25	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

MyActivity!

this2!

id:main!

Inflate!

b

id:my_btn!

!

FindView!

a

!

26	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

ButtonListener!

MyActivity!

this2!

id:main!

Inflate!

b

id:my_btn!

!

FindView!

a

!

27	
  

d

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

ButtonListener!

MyActivity!

this2!

id:main!

Inflate!

b

SetListener!

id:my_btn!

!

FindView!

a

d

!

28	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

9

"...

// Inflate!
// FindView!

// SetListener

}

}!

"...!

void onClick(View d) { ... }

}!

!
c

ButtonListener!

MyActivity!

this2!

id:main!

Inflate!

b

SetListener!

id:my_btn!

!

FindView!

a

d

!

29	
  

Propaga$on	
  edges	
  and	
  relevant	
  nodes	
  

this9!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

10
11
12

"...

// Inflate!

// SetListener

"...!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!
RelativeLayout!
child
id:my_btn!

30	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

// FindView!

}

}!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

10
11
12

"...

// Inflate!

// SetListener

// FindView!

}

}!

"...!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!
inflater
RelativeLayout!
child
id:my_btn!

31	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

10
11
12

"...

// Inflate!

// SetListener

// FindView!

}

}!

"...!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
this
</RelativeLayout>!2!
inflater
MyActivity!

RelativeLayout!
child

id:my_btn!
32	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);
"...

10
11
12

"...

// Inflate!

// SetListener

}

}!

"...!

<RelativeLayout ...>!
<Button android:id=“@+id/my_btn” ... />!
</RelativeLayout>!
MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
33	
  

// FindView!

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

"!

MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
34	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

"!

MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
35	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

"!

lookup	
  performed	
  by	
  FindView	
  
MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
36	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

"!

MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
37	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c =!

7

b.setOnClickListener(c);

// FindView!

ButtonListener!
// SetListener

}

}!

"!

MyActivity!

root

inflater
RelativeLayout!
child

id:my_btn!
38	
  

view id

Button!

Property	
  edges	
  and	
  relevant	
  nodes	
  

Inflate!
1
2

Example
	
  

class MyActivity extends Activity {!
void onCreate() {!

3

this.setContentView(R.layout.main);

// Inflate!

4

View a = this.findViewById(R.id.my_btn);

5

Button b = (Button) a;!

6

ButtonListener c = new ButtonListener();!

7

b.setOnClickListener(c);

// SetListener

// FindView!

}

}!

"!

MyActivity!

root

inflater
RelativeLayout!

Inflate!

child
id:my_btn!
39	
  

view id

Button!

listener

ButtonListener!

Property	
  edges	
  and	
  relevant	
  nodes	
  
ImplementaFon
	
  
•  Input	
  

•  Java	
  bytecode	
  of	
  the	
  applicaFon	
  
•  Relevant	
  XML	
  files	
  

•  Output	
  
• 
• 
• 
• 

Parent-­‐child	
  relaFonships	
  between	
  views	
  
AssociaFon	
  of	
  acFviFes	
  with	
  root	
  views	
  
AssociaFon	
  of	
  views	
  with	
  listeners	
  
Variables	
  and	
  fields	
  referring	
  to	
  views,	
  acFviFes,	
  listeners	
  

•  Analysis	
  algorithm	
  

40	
  

1.  Create	
  iniFal	
  constraint	
  graph	
  from	
  app	
  code	
  
2.  Solve	
  propagaFon	
  constraints	
  for	
  IDs,	
  acFviFes,	
  listeners	
  
3.  Fixed-­‐point	
  computaFon	
  for	
  flow	
  of	
  views	
  between	
  
operaFon	
  nodes	
  
EvaluaFon
	
  
•  Experiments	
  on	
  20	
  open-­‐source	
  Android	
  apps	
  
•  Experiment	
  I	
  –	
  applicaFon	
  characterizaFon	
  

•  Constraint	
  graph:	
  number	
  of	
  various	
  types	
  of	
  nodes	
  
•  Result:	
  Android-­‐specific	
  features	
  are	
  widely	
  used	
  	
  

•  Experiment	
  II	
  –	
  analysis	
  performance	
  and	
  precision	
  

41	
  

•  Running	
  Fme	
  to	
  perform	
  the	
  constraint	
  analysis	
  
•  Less	
  than	
  5	
  seconds	
  for	
  each	
  app	
  
•  Average	
  number	
  of	
  objects	
  for	
  variables	
  at	
  relevant	
  
operaFons	
  –	
  e.g.	
  
•  v1.addChild(v2)	
  –	
  receiver	
  v1,	
  parameter	
  v2	
  
•  v	
  =	
  x.findViewById(…)	
  –	
  result	
  v	
  
•  v.setListener(m)	
  –	
  receiver	
  v,	
  listener	
  m	
  
Precision	
  Measurements
	
  

42	
  

Average	
  number	
  of	
  objects	
  for	
  variables	
  at	
  relevant	
  opera$ons	
  	
  
Precision	
  Measurements
	
  
Imprecision?	
  

43	
  

Average	
  number	
  of	
  objects	
  for	
  variables	
  at	
  relevant	
  opera$ons	
  	
  
Conclusions
	
  
•  First	
  staFc	
  analysis	
  to	
  focus	
  on	
  GUI-­‐related	
  Android	
  
constructs	
  
•  Proposed	
  constraint-­‐based	
  algorithm	
  exhibits	
  high	
  
precision	
  and	
  low	
  cost	
  
•  CriFcal	
  building	
  block	
  for	
  other	
  analyses	
  and	
  tools	
  
for	
  Android	
  
●  So5ware	
  release	
  
● 
● 

	
  

44	
  

GATOR:	
  Program	
  Analysis	
  Toolkit	
  For	
  Android	
  
hp://www.cse.ohio-­‐state.edu/presto/so5ware/	
  
Thank	
  	
  you	
  

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  

45	
  

Weitere ähnliche Inhalte

Was ist angesagt?

2018 UI5con Drag-and-Drop Concept
2018 UI5con Drag-and-Drop Concept2018 UI5con Drag-and-Drop Concept
2018 UI5con Drag-and-Drop Conceptaborjinik
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experienceBeth Soderberg
 
描画とビジネスをクリーンに分ける(公開用)
描画とビジネスをクリーンに分ける(公開用)描画とビジネスをクリーンに分ける(公開用)
描画とビジネスをクリーンに分ける(公開用)Kenji Tanaka
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAgus Haryanto
 
More than a side salad: behaviour driven testing and test driven design in Dj...
More than a side salad: behaviour driven testing and test driven design in Dj...More than a side salad: behaviour driven testing and test driven design in Dj...
More than a side salad: behaviour driven testing and test driven design in Dj...Danielle Madeley
 
Advance UIAutomator : Documentaion
Advance UIAutomator : DocumentaionAdvance UIAutomator : Documentaion
Advance UIAutomator : DocumentaionRaman Gowda Hullur
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidAlberto Ruibal
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With DjangoEric Satterwhite
 
Yii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerYii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerMayflower GmbH
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing toolsDror Helper
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Screen Robots: UI Tests in Espresso
Screen Robots: UI Tests in EspressoScreen Robots: UI Tests in Espresso
Screen Robots: UI Tests in EspressoAnnyce Davis
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribTzu-ping Chung
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirHirday Lamba
 

Was ist angesagt? (20)

2018 UI5con Drag-and-Drop Concept
2018 UI5con Drag-and-Drop Concept2018 UI5con Drag-and-Drop Concept
2018 UI5con Drag-and-Drop Concept
 
Tutorial basicapp
Tutorial basicappTutorial basicapp
Tutorial basicapp
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experience
 
描画とビジネスをクリーンに分ける(公開用)
描画とビジネスをクリーンに分ける(公開用)描画とビジネスをクリーンに分ける(公開用)
描画とビジネスをクリーンに分ける(公開用)
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation Drawer
 
Android in practice
Android in practiceAndroid in practice
Android in practice
 
More than a side salad: behaviour driven testing and test driven design in Dj...
More than a side salad: behaviour driven testing and test driven design in Dj...More than a side salad: behaviour driven testing and test driven design in Dj...
More than a side salad: behaviour driven testing and test driven design in Dj...
 
Advance UIAutomator : Documentaion
Advance UIAutomator : DocumentaionAdvance UIAutomator : Documentaion
Advance UIAutomator : Documentaion
 
Curso Básico Android
Curso Básico AndroidCurso Básico Android
Curso Básico Android
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With Django
 
Day seven
Day sevenDay seven
Day seven
 
Yii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian FackerYii - Next level PHP Framework von Florian Facker
Yii - Next level PHP Framework von Florian Facker
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing tools
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Facebook api
Facebook apiFacebook api
Facebook api
 
Screen Robots: UI Tests in Espresso
Screen Robots: UI Tests in EspressoScreen Robots: UI Tests in Espresso
Screen Robots: UI Tests in Espresso
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
 
Demystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using WatirDemystifying Keyword Driven Using Watir
Demystifying Keyword Driven Using Watir
 

Ähnlich wie Static Reference Analysis for GUI Objects in Android Software

Android training day 2
Android training day 2Android training day 2
Android training day 2Vivek Bhusal
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & IntentsLope Emano
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Mario Jorge Pereira
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdfImranS18
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basicsAnton Narusberg
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android projectVitali Pekelis
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espressoÉdipo Souza
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBTAnton Yalyshev
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Filippo Matteo Riggio
 
Zyncro zyncro apps & ui customization feb 2013
Zyncro zyncro apps & ui customization feb 2013Zyncro zyncro apps & ui customization feb 2013
Zyncro zyncro apps & ui customization feb 2013Zyncro
 
Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile wayAshwin Raghav
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 

Ähnlich wie Static Reference Analysis for GUI Objects in Android Software (20)

Android training day 2
Android training day 2Android training day 2
Android training day 2
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
Mini curso Android
Mini curso AndroidMini curso Android
Mini curso Android
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Hierarchy viewer
Hierarchy viewerHierarchy viewer
Hierarchy viewer
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android project
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
 
Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2
 
Zyncro zyncro apps & ui customization feb 2013
Zyncro zyncro apps & ui customization feb 2013Zyncro zyncro apps & ui customization feb 2013
Zyncro zyncro apps & ui customization feb 2013
 
Android the Agile way
Android the Agile wayAndroid the Agile way
Android the Agile way
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 

Mehr von Dacong (Tony) Yan

LeakChecker: Practical Static Memory Leak Detection for Managed Languages
LeakChecker: Practical Static Memory Leak Detection for Managed LanguagesLeakChecker: Practical Static Memory Leak Detection for Managed Languages
LeakChecker: Practical Static Memory Leak Detection for Managed LanguagesDacong (Tony) Yan
 
Systematic Testing for Resource Leaks in Android Applications
Systematic Testing for Resource Leaks in Android ApplicationsSystematic Testing for Resource Leaks in Android Applications
Systematic Testing for Resource Leaks in Android ApplicationsDacong (Tony) Yan
 
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
SherLog: Error Diagnosis by Connecting Clues from Run-time LogsSherLog: Error Diagnosis by Connecting Clues from Run-time Logs
SherLog: Error Diagnosis by Connecting Clues from Run-time LogsDacong (Tony) Yan
 
Efficient Diversity-Aware Search
Efficient Diversity-Aware SearchEfficient Diversity-Aware Search
Efficient Diversity-Aware SearchDacong (Tony) Yan
 
Demand-Driven Context-Sensitive Alias Analysis for Java
Demand-Driven Context-Sensitive Alias Analysis for JavaDemand-Driven Context-Sensitive Alias Analysis for Java
Demand-Driven Context-Sensitive Alias Analysis for JavaDacong (Tony) Yan
 
Rethinking Soot for Summary-Based Whole-Program Analysis
Rethinking Soot for Summary-Based Whole-Program AnalysisRethinking Soot for Summary-Based Whole-Program Analysis
Rethinking Soot for Summary-Based Whole-Program AnalysisDacong (Tony) Yan
 
Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Dacong (Tony) Yan
 
A Toy Virtual Machine Project
A Toy Virtual Machine ProjectA Toy Virtual Machine Project
A Toy Virtual Machine ProjectDacong (Tony) Yan
 

Mehr von Dacong (Tony) Yan (10)

LeakChecker: Practical Static Memory Leak Detection for Managed Languages
LeakChecker: Practical Static Memory Leak Detection for Managed LanguagesLeakChecker: Practical Static Memory Leak Detection for Managed Languages
LeakChecker: Practical Static Memory Leak Detection for Managed Languages
 
Systematic Testing for Resource Leaks in Android Applications
Systematic Testing for Resource Leaks in Android ApplicationsSystematic Testing for Resource Leaks in Android Applications
Systematic Testing for Resource Leaks in Android Applications
 
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
SherLog: Error Diagnosis by Connecting Clues from Run-time LogsSherLog: Error Diagnosis by Connecting Clues from Run-time Logs
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
 
Efficient Diversity-Aware Search
Efficient Diversity-Aware SearchEfficient Diversity-Aware Search
Efficient Diversity-Aware Search
 
AVIO class present
AVIO class presentAVIO class present
AVIO class present
 
Demand-Driven Context-Sensitive Alias Analysis for Java
Demand-Driven Context-Sensitive Alias Analysis for JavaDemand-Driven Context-Sensitive Alias Analysis for Java
Demand-Driven Context-Sensitive Alias Analysis for Java
 
Rethinking Soot for Summary-Based Whole-Program Analysis
Rethinking Soot for Summary-Based Whole-Program AnalysisRethinking Soot for Summary-Based Whole-Program Analysis
Rethinking Soot for Summary-Based Whole-Program Analysis
 
Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...Uncovering Performance Problems in Java Applications with Reference Propagati...
Uncovering Performance Problems in Java Applications with Reference Propagati...
 
A Toy Virtual Machine Project
A Toy Virtual Machine ProjectA Toy Virtual Machine Project
A Toy Virtual Machine Project
 
Scope vs YSmart
Scope vs YSmartScope vs YSmart
Scope vs YSmart
 

Kürzlich hochgeladen

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Kürzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Static Reference Analysis for GUI Objects in Android Software

  • 1. Sta$c  Reference  Analysis  for  GUI  Objects  in   Android  So9ware     Atanas  Rountev,  Dacong  (Tony)  Yan     Ohio  State  University     PRESTO:  Program  Analyses  and  So5ware  Tools  Research  Group,  Ohio  State  University  
  • 2. MoFvaFon  and  Background   •  Android  so5ware  is  used  by  millions  of  users   •  Requires  foundaFonal  program  analyses  for  improved   performance  and  quality   •  StaFc  reference  analysis  for  Java   •  •  •  •  What  is  the  set  of  run-­‐Fme  objects?   Which  variables  contain  references  to  which  objects?   CriFcal  component  of  data-­‐  and  control-­‐flow  analysis   Prerequisite  for  many  other  techniques   •  ExisFng  work  cannot  be  applied  directly  to  Android   •  Goal:  develop  a  precise  and  efficient  staFc   reference  analysis  for  Android-­‐specific  features       2  
  • 3. StaFc  Reference  Analysis  for  Android  Features   •  Android  applicaFon   •  Driven  by  a  graphical  user  interface  (GUI)   •  Ac#vity:  on-­‐screen  window  with  GUI  elements  (views)   •  Event  handlers:  defined  in  listeners  and  associated  with   views  to  respond  to  user  acFons     •  Need  to  model  staFcally   •  •  •  •      3   Views  and  their  hierarchical  structure   AssociaFon  of  views  with  acFviFes   AssociaFon  of  views  with  listeners   Variables  that  refer  to  views,  acFviFes,  and  listeners  
  • 4. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 4   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 5. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 5   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 6. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 6   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 7. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 7   RelativeLayout! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! child </RelativeLayout>! Button: my_btn!
  • 8. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 8   RelativeLayout! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! child </RelativeLayout>! Button: my_btn!
  • 9. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 9   RelativeLayout! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! child </RelativeLayout>! Button: my_btn!
  • 10. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 10   RelativeLayout! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! child </RelativeLayout>! Button: my_btn!
  • 11. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 11   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 12. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 12   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 13. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 13   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 14. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 14   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 15. Example   MyActivity.java:! 1 2 class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } ! ButtonListener.java:! 8 9 class ButtonListener implements OnClickListener {! void onClick(View d) { ... } }! ! main.xml:! 10 11 12 15   <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! }!
  • 16. Modeled  Android  OperaFons   •  Inflate     •  Create  GUI  structure  from  XML  and  aach  to  acFvity/view   •  CreateView   •  ProgrammaFcally  create  a  view  through  new  V   •  FindView   •  Lookup  a  view  from  acFvity  or  ancestor  view  (e.g.,  by  ID)   •  SetListener   •  Associate  view  and  listener   •  AddView   •  Establish  parent-­‐child  relaFonship  between  two  views   •  SetId   16   •  ProgrammaFcally  set  the  ID  of  a  view  
  • 17. Our  Proposal   •  Define  formal  seman#cs  of  GUI-­‐related  Android   constructs   •  Encode  semanFcs  of  an  Android  applicaFon  in  a   constraint  graph   •  Perform  constraint-­‐based  staFc  reference  analysis   17  
  • 18. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // SetListener "...! void onClick(View d) { ... } }! ! ! ! 18   Propaga$on  edges  and  relevant  nodes   // FindView! } }!
  • 19. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // SetListener "...! void onClick(View d) { ... } }! ! MyActivity! ! ! 19   Propaga$on  edges  and  relevant  nodes   // FindView! } }!
  • 20. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // SetListener "...! void onClick(View d) { ... } }! ! MyActivity! ! ! 20   Propaga$on  edges  and  relevant  nodes   // FindView! } }!
  • 21. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // SetListener "...! void onClick(View d) { ... } }! ! MyActivity! ! this2! ! 21   Propaga$on  edges  and  relevant  nodes   // FindView! } }!
  • 22. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! MyActivity! ! c this2! ! b a 22   d Propaga$on  edges  and  relevant  nodes   this9!
  • 23. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! MyActivity! Inflate! c this2! id:main! ! ! b a 23   d Propaga$on  edges  and  relevant  nodes   this9!
  • 24. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c MyActivity! this2! id:main! Inflate! b id:my_btn! ! FindView! a ! 24   d Propaga$on  edges  and  relevant  nodes   this9!
  • 25. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c MyActivity! this2! id:main! Inflate! b id:my_btn! ! FindView! a ! 25   d Propaga$on  edges  and  relevant  nodes   this9!
  • 26. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c MyActivity! this2! id:main! Inflate! b id:my_btn! ! FindView! a ! 26   d Propaga$on  edges  and  relevant  nodes   this9!
  • 27. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c ButtonListener! MyActivity! this2! id:main! Inflate! b id:my_btn! ! FindView! a ! 27   d Propaga$on  edges  and  relevant  nodes   this9!
  • 28. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c ButtonListener! MyActivity! this2! id:main! Inflate! b SetListener! id:my_btn! ! FindView! a d ! 28   Propaga$on  edges  and  relevant  nodes   this9!
  • 29. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 9 "... // Inflate! // FindView! // SetListener } }! "...! void onClick(View d) { ... } }! ! c ButtonListener! MyActivity! this2! id:main! Inflate! b SetListener! id:my_btn! ! FindView! a d ! 29   Propaga$on  edges  and  relevant  nodes   this9!
  • 30. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 10 11 12 "... // Inflate! // SetListener "...! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! RelativeLayout! child id:my_btn! 30   view id Button! Property  edges  and  relevant  nodes   // FindView! } }!
  • 31. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 10 11 12 "... // Inflate! // SetListener // FindView! } }! "...! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! inflater RelativeLayout! child id:my_btn! 31   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 32. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 10 11 12 "... // Inflate! // SetListener // FindView! } }! "...! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! this </RelativeLayout>!2! inflater MyActivity! RelativeLayout! child id:my_btn! 32   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 33. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); "... 10 11 12 "... // Inflate! // SetListener } }! "...! <RelativeLayout ...>! <Button android:id=“@+id/my_btn” ... />! </RelativeLayout>! MyActivity! root inflater RelativeLayout! child id:my_btn! 33   // FindView! view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 34. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! "! MyActivity! root inflater RelativeLayout! child id:my_btn! 34   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 35. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! "! MyActivity! root inflater RelativeLayout! child id:my_btn! 35   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 36. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! "! lookup  performed  by  FindView   MyActivity! root inflater RelativeLayout! child id:my_btn! 36   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 37. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! "! MyActivity! root inflater RelativeLayout! child id:my_btn! 37   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 38. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c =! 7 b.setOnClickListener(c); // FindView! ButtonListener! // SetListener } }! "! MyActivity! root inflater RelativeLayout! child id:my_btn! 38   view id Button! Property  edges  and  relevant  nodes   Inflate!
  • 39. 1 2 Example   class MyActivity extends Activity {! void onCreate() {! 3 this.setContentView(R.layout.main); // Inflate! 4 View a = this.findViewById(R.id.my_btn); 5 Button b = (Button) a;! 6 ButtonListener c = new ButtonListener();! 7 b.setOnClickListener(c); // SetListener // FindView! } }! "! MyActivity! root inflater RelativeLayout! Inflate! child id:my_btn! 39   view id Button! listener ButtonListener! Property  edges  and  relevant  nodes  
  • 40. ImplementaFon   •  Input   •  Java  bytecode  of  the  applicaFon   •  Relevant  XML  files   •  Output   •  •  •  •  Parent-­‐child  relaFonships  between  views   AssociaFon  of  acFviFes  with  root  views   AssociaFon  of  views  with  listeners   Variables  and  fields  referring  to  views,  acFviFes,  listeners   •  Analysis  algorithm   40   1.  Create  iniFal  constraint  graph  from  app  code   2.  Solve  propagaFon  constraints  for  IDs,  acFviFes,  listeners   3.  Fixed-­‐point  computaFon  for  flow  of  views  between   operaFon  nodes  
  • 41. EvaluaFon   •  Experiments  on  20  open-­‐source  Android  apps   •  Experiment  I  –  applicaFon  characterizaFon   •  Constraint  graph:  number  of  various  types  of  nodes   •  Result:  Android-­‐specific  features  are  widely  used     •  Experiment  II  –  analysis  performance  and  precision   41   •  Running  Fme  to  perform  the  constraint  analysis   •  Less  than  5  seconds  for  each  app   •  Average  number  of  objects  for  variables  at  relevant   operaFons  –  e.g.   •  v1.addChild(v2)  –  receiver  v1,  parameter  v2   •  v  =  x.findViewById(…)  –  result  v   •  v.setListener(m)  –  receiver  v,  listener  m  
  • 42. Precision  Measurements   42   Average  number  of  objects  for  variables  at  relevant  opera$ons    
  • 43. Precision  Measurements   Imprecision?   43   Average  number  of  objects  for  variables  at  relevant  opera$ons    
  • 44. Conclusions   •  First  staFc  analysis  to  focus  on  GUI-­‐related  Android   constructs   •  Proposed  constraint-­‐based  algorithm  exhibits  high   precision  and  low  cost   •  CriFcal  building  block  for  other  analyses  and  tools   for  Android   ●  So5ware  release   ●  ●    44   GATOR:  Program  Analysis  Toolkit  For  Android   hp://www.cse.ohio-­‐state.edu/presto/so5ware/  
  • 45. Thank    you                                     45