-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hi,
I'm using IC3 to perform an inter-component analysis on some real-world Android apps. However, it seems that IC3 is not able to find a subset of IPC communications between components. For example, one of my apps has a service that registers a broadcast receiver to monitor changes in the state of device's battery. Upon a change in the state of battery/charging, the app sends an intent in order to start a new activity.
public class BatteryService extends Service{
public final static String EXTRA_MESSAGE = "edu.uci.seal.testapp.MESSAGE";
private final BroadcastReceiver batteryStatus = new BroadcastReceiver() {
@SuppressLint("InlinedApi")
@Override
public void onReceive(Context context, Intent intent) {
Intent intent1 = new Intent(getApplicationContext(), DisplayMessageActivity.class);
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
int chargePlug = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
if(status == BatteryManager.BATTERY_STATUS_CHARGING){
if(chargePlug == BatteryManager.BATTERY_PLUGGED_USB)
intent1.putExtra(EXTRA_MESSAGE, "Battery is charging thorugh usb");
if(chargePlug == BatteryManager.BATTERY_PLUGGED_AC)
intent1.putExtra(EXTRA_MESSAGE, "Battery is charging thorugh AC");
if(chargePlug == BatteryManager.BATTERY_PLUGGED_WIRELESS)
intent1.putExtra(EXTRA_MESSAGE, "Battery is charging wireless");
}
if(status == BatteryManager.BATTERY_STATUS_DISCHARGING || status == BatteryManager.BATTERY_STATUS_NOT_CHARGING)
intent1.putExtra(EXTRA_MESSAGE, "Battery is discharging");
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent1);
}
};
}
I generated IC3 analysis result using instructions in the website. Then I used the following code in order to get the components:
File ipcResults = new File(mApp.getIpcProtoBuf());
if (ipcResults.exists()) {
InputStream stream = null;
try {
stream = new FileInputStream(mApp.getIpcProtoBuf());
final Ic3Data.Application application = Ic3Data.Application.parseFrom(stream);
mIpcComponents.addAll(application.getComponentsList());
} catch (IOException e) {
e.printStackTrace();
}
}
Then for each component, I iterate over the components to get the exit-points of each, in order to perform an inter-component analysis. For this example, the exit-point list is empty.
I appreciate your help on fixing this issue.