diff options
author | Jason Monk <jmonk@google.com> | 2015-03-19 18:00:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-19 18:00:54 +0000 |
commit | ad99996ffb93a699cde3c27f13c3dea3028a4046 (patch) | |
tree | d000f319110e38f7ca1e89d8f180cecc359cd851 | |
parent | fc0d674e7a0031609bff502fd99350bcf696b877 (diff) | |
parent | dff06ccbf30b76bf12396a3afda9f9531cdca7a5 (diff) | |
download | packages_apps_Settings-ad99996ffb93a699cde3c27f13c3dea3028a4046.tar.gz packages_apps_Settings-ad99996ffb93a699cde3c27f13c3dea3028a4046.tar.bz2 packages_apps_Settings-ad99996ffb93a699cde3c27f13c3dea3028a4046.zip |
Merge "Only show 2 buttons in app info screen"
-rw-r--r-- | res/layout/installed_app_details.xml | 5 | ||||
-rw-r--r-- | src/com/android/settings/applications/HeaderPreference.java | 1 | ||||
-rwxr-xr-x | src/com/android/settings/applications/InstalledAppDetails.java | 74 |
3 files changed, 29 insertions, 51 deletions
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml index cebec28e7..b703ec02c 100644 --- a/res/layout/installed_app_details.xml +++ b/res/layout/installed_app_details.xml @@ -49,11 +49,6 @@ layout="@layout/two_buttons_panel" android:id="@+id/control_buttons_panel"/> - <!-- Force stop and uninstall buttons --> - <include - layout="@layout/two_buttons_panel" - android:id="@+id/more_control_buttons_panel"/> - </LinearLayout> </LinearLayout> diff --git a/src/com/android/settings/applications/HeaderPreference.java b/src/com/android/settings/applications/HeaderPreference.java index a3d4bde12..3af42a204 100644 --- a/src/com/android/settings/applications/HeaderPreference.java +++ b/src/com/android/settings/applications/HeaderPreference.java @@ -47,6 +47,7 @@ public class HeaderPreference extends Preference { final ViewGroup allDetails = (ViewGroup) view.findViewById(R.id.all_details); Utils.forceCustomPadding(allDetails, true /* additive padding */); mRootView = view; + setShouldDisableView(false); } @Override diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 7f20b3254..0ab66ae5a 100755 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -85,6 +85,7 @@ public class InstalledAppDetails extends AppInfoBase // Menu identifiers public static final int UNINSTALL_ALL_USERS_MENU = 1; + public static final int UNINSTALL_UPDATES = 2; // Result code identifiers public static final int REQUEST_UNINSTALL = 0; @@ -110,8 +111,6 @@ public class InstalledAppDetails extends AppInfoBase private boolean mShowUninstalled; private HeaderPreference mHeader; private Button mUninstallButton; - private View mMoreControlButtons; - private Button mSpecialDisableButton; private boolean mUpdatedSysApp = false; private TextView mAppVersion; private Button mForceStopButton; @@ -149,34 +148,18 @@ public class InstalledAppDetails extends AppInfoBase } private void initUninstallButtons() { - mUpdatedSysApp = (mAppEntry.info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; final boolean isBundled = (mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0; boolean enabled = true; - if (mUpdatedSysApp) { - mUninstallButton.setText(R.string.app_factory_reset); - boolean showSpecialDisable = false; - if (isBundled) { - showSpecialDisable = handleDisableable(mSpecialDisableButton); - mSpecialDisableButton.setOnClickListener(this); - } - if (mAppControlRestricted) { - showSpecialDisable = false; - } - mMoreControlButtons.setVisibility(showSpecialDisable ? View.VISIBLE : View.GONE); + if (isBundled) { + enabled = handleDisableable(mUninstallButton); } else { - mMoreControlButtons.setVisibility(View.GONE); - if (isBundled) { - enabled = handleDisableable(mUninstallButton); - } else if ((mPackageInfo.applicationInfo.flags - & ApplicationInfo.FLAG_INSTALLED) == 0 + if ((mPackageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) == 0 && mUserManager.getUsers().size() >= 2) { // When we have multiple users, there is a separate menu // to uninstall for all users. - mUninstallButton.setText(R.string.uninstall_text); enabled = false; - } else { - mUninstallButton.setText(R.string.uninstall_text); } + mUninstallButton.setText(R.string.uninstall_text); } // If this is a device admin, it can't be uninstalled or disabled. // We do this here so the text of the button is still set correctly. @@ -284,16 +267,12 @@ public class InstalledAppDetails extends AppInfoBase mForceStopButton.setText(R.string.force_stop); mUninstallButton = (Button) btnPanel.findViewById(R.id.left_button); mForceStopButton.setEnabled(false); - - // Get More Control button panel - mMoreControlButtons = mHeader.findViewById(R.id.more_control_buttons_panel); - mMoreControlButtons.findViewById(R.id.right_button).setVisibility(View.INVISIBLE); - mSpecialDisableButton = (Button) mMoreControlButtons.findViewById(R.id.left_button); - mMoreControlButtons.setVisibility(View.GONE); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + menu.add(0, UNINSTALL_UPDATES, 0, R.string.app_factory_reset) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, UNINSTALL_ALL_USERS_MENU, 1, R.string.uninstall_all_users_text) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } @@ -315,14 +294,19 @@ public class InstalledAppDetails extends AppInfoBase showIt = false; } menu.findItem(UNINSTALL_ALL_USERS_MENU).setVisible(showIt); + mUpdatedSysApp = (mAppEntry.info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; + menu.findItem(UNINSTALL_UPDATES).setVisible(mUpdatedSysApp && !mAppControlRestricted); } @Override public boolean onOptionsItemSelected(MenuItem item) { - int menuId = item.getItemId(); - if (menuId == UNINSTALL_ALL_USERS_MENU) { - uninstallPkg(mAppEntry.info.packageName, true, false); - return true; + switch (item.getItemId()) { + case UNINSTALL_ALL_USERS_MENU: + uninstallPkg(mAppEntry.info.packageName, true, false); + return true; + case UNINSTALL_UPDATES: + showDialogInner(DLG_FACTORY_RESET, 0); + return true; } return false; } @@ -604,25 +588,23 @@ public class InstalledAppDetails extends AppInfoBase public void onClick(View v) { String packageName = mAppEntry.info.packageName; if(v == mUninstallButton) { - if (mUpdatedSysApp) { - showDialogInner(DLG_FACTORY_RESET, 0); - } else { - if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { - if (mAppEntry.info.enabled) { - showDialogInner(DLG_DISABLE, 0); + if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + if (mAppEntry.info.enabled) { + if (mUpdatedSysApp) { + showDialogInner(DLG_SPECIAL_DISABLE, 0); } else { - new DisableChanger(this, mAppEntry.info, - PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) - .execute((Object)null); + showDialogInner(DLG_DISABLE, 0); } - } else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) { - uninstallPkg(packageName, true, false); } else { - uninstallPkg(packageName, false, false); + new DisableChanger(this, mAppEntry.info, + PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) + .execute((Object) null); } + } else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) { + uninstallPkg(packageName, true, false); + } else { + uninstallPkg(packageName, false, false); } - } else if(v == mSpecialDisableButton) { - showDialogInner(DLG_SPECIAL_DISABLE, 0); } else if (v == mForceStopButton) { showDialogInner(DLG_FORCE_STOP, 0); //forceStopPackage(mAppInfo.packageName); |