@@ -41,14 +41,15 @@ public class AndroidEntryPointUtils {
41
41
private SootClass osClassContentProvider ;
42
42
private SootClass osClassGCMBaseIntentService ;
43
43
private SootClass osClassGCMListenerService ;
44
+ private SootClass osClassHostApduService ;
44
45
private SootClass osInterfaceServiceConnection ;
45
46
46
47
/**
47
48
* Array containing all types of components supported in Android lifecycles
48
49
*/
49
50
public enum ComponentType {
50
51
Application , Activity , Service , Fragment , BroadcastReceiver , ContentProvider , GCMBaseIntentService ,
51
- GCMListenerService , ServiceConnection , Plain
52
+ GCMListenerService , HostApduService , ServiceConnection , Plain
52
53
}
53
54
54
55
/**
@@ -68,6 +69,7 @@ public AndroidEntryPointUtils() {
68
69
osClassGCMBaseIntentService = Scene .v ()
69
70
.getSootClassUnsafe (AndroidEntryPointConstants .GCMBASEINTENTSERVICECLASS );
70
71
osClassGCMListenerService = Scene .v ().getSootClassUnsafe (AndroidEntryPointConstants .GCMLISTENERSERVICECLASS );
72
+ osClassHostApduService = Scene .v ().getSootClassUnsafe (AndroidEntryPointConstants .HOSTAPDUSERVICECLASS );
71
73
osInterfaceServiceConnection = Scene .v ()
72
74
.getSootClassUnsafe (AndroidEntryPointConstants .SERVICECONNECTIONINTERFACE );
73
75
osClassMapActivity = Scene .v ().getSootClassUnsafe (AndroidEntryPointConstants .MAPACTIVITYCLASS );
@@ -88,17 +90,10 @@ public ComponentType getComponentType(SootClass currentClass) {
88
90
FastHierarchy fh = Scene .v ().getOrMakeFastHierarchy ();
89
91
90
92
if (fh != null ) {
91
- // (1) android.app.Application
92
- if (osClassApplication != null && fh .canStoreType (currentClass .getType (), osClassApplication .getType ()))
93
- ctype = ComponentType .Application ;
94
- // (2) android.app.Activity
95
- else if (osClassActivity != null && fh .canStoreType (currentClass .getType (), osClassActivity .getType ()))
96
- ctype = ComponentType .Activity ;
97
- // (3) android.app.Service
98
- else if (osClassService != null && fh .canStoreType (currentClass .getType (), osClassService .getType ()))
99
- ctype = ComponentType .Service ;
100
- // (4) android.app.BroadcastReceiver
101
- else if (osClassFragment != null && Scene .v ().getOrMakeFastHierarchy ().canStoreType (currentClass .getType (),
93
+ // We first look for the specialized types
94
+
95
+ // (a1) android.app.Fragment
96
+ if (osClassFragment != null && Scene .v ().getOrMakeFastHierarchy ().canStoreType (currentClass .getType (),
102
97
osClassFragment .getType ()))
103
98
ctype = ComponentType .Fragment ;
104
99
else if (osClassSupportFragment != null
@@ -107,30 +102,47 @@ else if (osClassSupportFragment != null
107
102
else if (osClassAndroidXFragment != null
108
103
&& fh .canStoreType (currentClass .getType (), osClassAndroidXFragment .getType ()))
109
104
ctype = ComponentType .Fragment ;
110
- // (5) android.app.BroadcastReceiver
111
- else if (osClassBroadcastReceiver != null
112
- && fh .canStoreType (currentClass .getType (), osClassBroadcastReceiver .getType ()))
113
- ctype = ComponentType .BroadcastReceiver ;
114
- // (6) android.app.ContentProvider
115
- else if (osClassContentProvider != null
116
- && fh .canStoreType (currentClass .getType (), osClassContentProvider .getType ()))
117
- ctype = ComponentType .ContentProvider ;
118
- // (7) com.google.android.gcm.GCMBaseIntentService
105
+ // (a2) com.google.android.gcm.GCMBaseIntentService
119
106
else if (osClassGCMBaseIntentService != null
120
107
&& fh .canStoreType (currentClass .getType (), osClassGCMBaseIntentService .getType ()))
121
108
ctype = ComponentType .GCMBaseIntentService ;
122
- // (8 ) com.google.android.gms.gcm.GcmListenerService
109
+ // (a3 ) com.google.android.gms.gcm.GcmListenerService
123
110
else if (osClassGCMListenerService != null
124
111
&& fh .canStoreType (currentClass .getType (), osClassGCMListenerService .getType ()))
125
112
ctype = ComponentType .GCMListenerService ;
126
- // (9) android.content.ServiceConnection
113
+ // (a4) android.nfc.cardemulation.HostApduService
114
+ else if (osClassHostApduService != null
115
+ && fh .canStoreType (currentClass .getType (), osClassHostApduService .getType ()))
116
+ ctype = ComponentType .HostApduService ;
117
+ // (a5) android.content.ServiceConnection
127
118
else if (osInterfaceServiceConnection != null
128
119
&& fh .canStoreType (currentClass .getType (), osInterfaceServiceConnection .getType ()))
129
120
ctype = ComponentType .ServiceConnection ;
130
- // (10 ) com.google.android.maps.MapActivity
121
+ // (a6 ) com.google.android.maps.MapActivity
131
122
else if (osClassMapActivity != null
132
123
&& fh .canStoreType (currentClass .getType (), osClassMapActivity .getType ()))
133
124
ctype = ComponentType .Activity ;
125
+
126
+ // If the given class is not a specific type of component, we look upwards in
127
+ // the hierarchy to see if we have something more generic
128
+ // (b1) android.app.Application
129
+ else if (osClassApplication != null
130
+ && fh .canStoreType (currentClass .getType (), osClassApplication .getType ()))
131
+ ctype = ComponentType .Application ;
132
+ // (b2) android.app.Service
133
+ else if (osClassService != null && fh .canStoreType (currentClass .getType (), osClassService .getType ()))
134
+ ctype = ComponentType .Service ;
135
+ // (b3) android.app.Activity
136
+ else if (osClassActivity != null && fh .canStoreType (currentClass .getType (), osClassActivity .getType ()))
137
+ ctype = ComponentType .Activity ;
138
+ // (b4) android.app.BroadcastReceiver
139
+ else if (osClassBroadcastReceiver != null
140
+ && fh .canStoreType (currentClass .getType (), osClassBroadcastReceiver .getType ()))
141
+ ctype = ComponentType .BroadcastReceiver ;
142
+ // (b5) android.app.ContentProvider
143
+ else if (osClassContentProvider != null
144
+ && fh .canStoreType (currentClass .getType (), osClassContentProvider .getType ()))
145
+ ctype = ComponentType .ContentProvider ;
134
146
} else
135
147
logger .warn (String .format ("No FastHierarchy, assuming %s is a plain class" , currentClass .getName ()));
136
148
0 commit comments