diff options
author | Todd Kennedy <toddke@google.com> | 2018-05-03 09:44:55 +0100 |
---|---|---|
committer | Ryan Longair <rlongair@google.com> | 2018-06-12 11:26:16 -0700 |
commit | 25b0cdb093e02d82cc23d5264daf9521f44023e0 (patch) | |
tree | 4a6d05d51cd643e94c951eb290afdca4503d460f | |
parent | c137a218083821ff38ce4f953938099e761a1ed9 (diff) | |
download | android_packages_apps_PackageInstaller-25b0cdb093e02d82cc23d5264daf9521f44023e0.tar.gz android_packages_apps_PackageInstaller-25b0cdb093e02d82cc23d5264daf9521f44023e0.tar.bz2 android_packages_apps_PackageInstaller-25b0cdb093e02d82cc23d5264daf9521f44023e0.zip |
RESTRICT AUTOMERGE: Always use safe labels
For display purposes, we should always be using safe labels. This
prevents excessively long labels from preventing app uninstallation.
Bug: 62537081
Test: Manual. Install APK from bug and see that it can be uninstalled
Change-Id: Ic0e0d47f5ff76e4a73b30988d0a024fb3ee651ae
(cherry picked from commit eaa4e6ec82f32d66c053ccc4cb67df1e52d1711b)
3 files changed, 5 insertions, 6 deletions
diff --git a/src/com/android/packageinstaller/UninstallerActivity.java b/src/com/android/packageinstaller/UninstallerActivity.java index dbd7ac3d..142e95e6 100755 --- a/src/com/android/packageinstaller/UninstallerActivity.java +++ b/src/com/android/packageinstaller/UninstallerActivity.java @@ -229,7 +229,7 @@ public class UninstallerActivity extends Activity { public void startUninstallProgress() { boolean returnResult = getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false); - CharSequence label = mDialogInfo.appInfo.loadLabel(getPackageManager()); + CharSequence label = mDialogInfo.appInfo.loadSafeLabel(getPackageManager()); if (isTv()) { Intent newIntent = new Intent(Intent.ACTION_VIEW); diff --git a/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java b/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java index 417b75a2..b50960e4 100644 --- a/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java +++ b/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java @@ -37,15 +37,14 @@ public class UninstallAlertDialogFragment extends DialogFragment implements final PackageManager pm = getActivity().getPackageManager(); final UninstallerActivity.DialogInfo dialogInfo = ((UninstallerActivity) getActivity()).getDialogInfo(); - final CharSequence appLabel = dialogInfo.appInfo.loadLabel(pm); - + final CharSequence appLabel = dialogInfo.appInfo.loadSafeLabel(pm); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); StringBuilder messageBuilder = new StringBuilder(); // If the Activity label differs from the App label, then make sure the user // knows the Activity belongs to the App being uninstalled. if (dialogInfo.activityInfo != null) { - final CharSequence activityLabel = dialogInfo.activityInfo.loadLabel(pm); + final CharSequence activityLabel = dialogInfo.activityInfo.loadSafeLabel(pm); if (!activityLabel.equals(appLabel)) { messageBuilder.append( getString(R.string.uninstall_activity_text, activityLabel)); diff --git a/src/com/android/packageinstaller/television/UninstallAlertFragment.java b/src/com/android/packageinstaller/television/UninstallAlertFragment.java index c1281749..138a5c36 100644 --- a/src/com/android/packageinstaller/television/UninstallAlertFragment.java +++ b/src/com/android/packageinstaller/television/UninstallAlertFragment.java @@ -42,14 +42,14 @@ public class UninstallAlertFragment extends GuidedStepFragment { final PackageManager pm = getActivity().getPackageManager(); final UninstallerActivity.DialogInfo dialogInfo = ((UninstallerActivity) getActivity()).getDialogInfo(); - final CharSequence appLabel = dialogInfo.appInfo.loadLabel(pm); + final CharSequence appLabel = dialogInfo.appInfo.loadSafeLabel(pm); StringBuilder messageBuilder = new StringBuilder(); // If the Activity label differs from the App label, then make sure the user // knows the Activity belongs to the App being uninstalled. if (dialogInfo.activityInfo != null) { - final CharSequence activityLabel = dialogInfo.activityInfo.loadLabel(pm); + final CharSequence activityLabel = dialogInfo.activityInfo.loadSafeLabel(pm); if (!activityLabel.equals(appLabel)) { messageBuilder.append( getString(R.string.uninstall_activity_text, activityLabel)); |