Merge "Fix issue #4999758: Disabling a system app should require..."

This commit is contained in:
Dianne Hackborn
2011-07-18 18:11:46 -07:00
committed by Android (Google) Code Review
2 changed files with 29 additions and 3 deletions

View File

@@ -2340,6 +2340,11 @@ found in the list of installed applications.</string>
<string name="app_install_location_title">Preferred install location</string> <string name="app_install_location_title">Preferred install location</string>
<!-- Manage applications. application installation location summary --> <!-- Manage applications. application installation location summary -->
<string name="app_install_location_summary">Change the preferred installation location for new applications.</string> <string name="app_install_location_summary">Change the preferred installation location for new applications.</string>
<!-- [CHAR LIMIT=30] Manage applications, title for dialog when disabling apps -->
<string name="app_disable_dlg_title">Disable built-in app</string>
<!-- [CHAR LIMIT=200] Manage applications, text for dialog when disabling apps -->
<string name="app_disable_dlg_text">Disabling a built-in application may cause other applications
to misbehave. Are you sure?</string>
<!-- [CHAR LIMIT=25] Services settings screen, setting option name for the user to go to the screen to view app storage use --> <!-- [CHAR LIMIT=25] Services settings screen, setting option name for the user to go to the screen to view app storage use -->
<string name="storageuse_settings_title">Storage use</string> <string name="storageuse_settings_title">Storage use</string>

View File

@@ -147,6 +147,7 @@ public class InstalledAppDetails extends Fragment
private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 4; private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 4;
private static final int DLG_FORCE_STOP = DLG_BASE + 5; private static final int DLG_FORCE_STOP = DLG_BASE + 5;
private static final int DLG_MOVE_FAILED = DLG_BASE + 6; private static final int DLG_MOVE_FAILED = DLG_BASE + 6;
private static final int DLG_DISABLE = DLG_BASE + 7;
private Handler mHandler = new Handler() { private Handler mHandler = new Handler() {
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
@@ -754,6 +755,22 @@ public class InstalledAppDetails extends Fragment
.setMessage(msg) .setMessage(msg)
.setNeutralButton(R.string.dlg_ok, null) .setNeutralButton(R.string.dlg_ok, null)
.create(); .create();
case DLG_DISABLE:
return new AlertDialog.Builder(getActivity())
.setTitle(getActivity().getText(R.string.app_disable_dlg_title))
.setIcon(android.R.drawable.ic_dialog_alert)
.setMessage(getActivity().getText(R.string.app_disable_dlg_text))
.setPositiveButton(R.string.dlg_ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Disable the app
new DisableChanger(getOwner(), getOwner().mAppEntry.info,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER)
.execute((Object)null);
}
})
.setNegativeButton(R.string.dlg_cancel, null)
.create();
} }
throw new IllegalArgumentException("unknown id " + id); throw new IllegalArgumentException("unknown id " + id);
} }
@@ -837,9 +854,13 @@ public class InstalledAppDetails extends Fragment
showDialogInner(DLG_FACTORY_RESET, 0); showDialogInner(DLG_FACTORY_RESET, 0);
} else { } else {
if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
new DisableChanger(this, mAppEntry.info, mAppEntry.info.enabled ? if (mAppEntry.info.enabled) {
PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER showDialogInner(DLG_DISABLE, 0);
: PackageManager.COMPONENT_ENABLED_STATE_DEFAULT).execute((Object)null); } else {
new DisableChanger(this, mAppEntry.info,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
.execute((Object)null);
}
} else { } else {
uninstallPkg(packageName); uninstallPkg(packageName);
} }