If FonBot was moved to /system and then updated, it will have apks in
both /system/app and /data/app and ApplicationInfo.sourceDir will point
to the second one.
final String remountCommand="mount -o remount,rw /system";
final String copyToSystemCommand="cp "+info.sourceDir+" /system/app/FonBot.apk";
final String chmodSystemCommand="chmod 644 /system/app/FonBot.apk";
final String remountCommand="mount -o remount,rw /system";
final String copyToSystemCommand="cp "+info.sourceDir+" /system/app/FonBot.apk";
final String chmodSystemCommand="chmod 644 /system/app/FonBot.apk";
+ final String rmSystemCommand="rm /system/app/FonBot.apk";
final String copyToUserCommand="cp "+info.sourceDir+" /data/app/FonBot.apk";
final String chmodUserCommand="chmod 644 /data/app/FonBot.apk";
final String copyToUserCommand="cp "+info.sourceDir+" /data/app/FonBot.apk";
final String chmodUserCommand="chmod 644 /data/app/FonBot.apk";
- final String rmCommand="rm "+info.sourceDir;
+ final String rmUserCommand="rm "+info.sourceDir;
if(isChecked){
Runtime.getRuntime().exec(new String[]{
"su", "-c",
if(isChecked){
Runtime.getRuntime().exec(new String[]{
"su", "-c",
- remountCommand+';'+copyToSystemCommand+';'+chmodSystemCommand+';'+rmCommand
+ remountCommand+';'+copyToSystemCommand+';'+chmodSystemCommand+';'+rmUserCommand
}).waitFor();
Toast.makeText(FonBotPreferenceActivity.this,
}).waitFor();
Toast.makeText(FonBotPreferenceActivity.this,
} else {
Runtime.getRuntime().exec(new String[]{
"su", "-c",
} else {
Runtime.getRuntime().exec(new String[]{
"su", "-c",
- remountCommand+';'+copyToUserCommand+';'+chmodUserCommand+';'+rmCommand
+ remountCommand+';'+copyToUserCommand+';'+chmodUserCommand+';'+rmSystemCommand
Toast.makeText(FonBotPreferenceActivity.this,
"Reboot to make FonBot a non-system application", Toast.LENGTH_LONG).show();
}
Toast.makeText(FonBotPreferenceActivity.this,
"Reboot to make FonBot a non-system application", Toast.LENGTH_LONG).show();
}