Catch SecurityException from enabling backup activity
am: 368b5a6b2c
Change-Id: I47613de2c00db93d906414f1e51baea9cbc7606a
This commit is contained in:
@@ -58,9 +58,17 @@ public class BackupSettingsActivity extends Activity implements Indexable {
|
||||
"No manufacturer settings found, launching the backup settings directly");
|
||||
}
|
||||
Intent intent = backupHelper.getIntentForBackupSettings();
|
||||
// enable the activity before launching it
|
||||
getPackageManager().setComponentEnabledSetting(intent.getComponent(),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
try {
|
||||
// enable the activity before launching it
|
||||
getPackageManager().setComponentEnabledSetting(
|
||||
intent.getComponent(),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
} catch (SecurityException e) {
|
||||
Log.w(TAG, "Trying to enable activity " + intent.getComponent() + " but couldn't: "
|
||||
+ e.getMessage());
|
||||
// the activity may already be enabled
|
||||
}
|
||||
|
||||
// use startActivityForResult to let the activity check the caller signature
|
||||
startActivityForResult(intent, 1);
|
||||
|
Reference in New Issue
Block a user