summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2016-03-09 13:36:52 -0800
committerAmith Yamasani <yamasani@google.com>2016-03-09 16:04:05 -0800
commit2a55949c2d630c4a96b83c3fb4b8d65bb762c7dd (patch)
tree94bcbd31f6b8de64c3394364c66f26ff0933f365
parenta4f67b71be81bcb77809f2e4194f11cf2189b961 (diff)
downloadandroid_packages_apps_PackageInstaller-2a55949c2d630c4a96b83c3fb4b8d65bb762c7dd.tar.gz
android_packages_apps_PackageInstaller-2a55949c2d630c4a96b83c3fb4b8d65bb762c7dd.tar.bz2
android_packages_apps_PackageInstaller-2a55949c2d630c4a96b83c3fb4b8d65bb762c7dd.zip
Tweak strings when uninstalling updates
Inform about data deletion and also about other users. Bug: 26694521 Change-Id: Ib1ab8ca58e111cfbad6895f296e567e289ce34d8
-rw-r--r--res/values/strings.xml3
-rwxr-xr-xsrc/com/android/packageinstaller/UninstallerActivity.java20
2 files changed, 19 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d8dadf75..367f466b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -111,7 +111,8 @@
<string name="uninstall_application_text_all_users">Do you want to uninstall this app for <b>all</b>
users? The application and its data will be removed from <b>all</b> users on the device.</string>
<string name="uninstall_application_text_user">Do you want to uninstall this app for the user <xliff:g id="username">%1$s</xliff:g>?</string>
- <string name="uninstall_update_text">Do you want to replace this app with the factory version?</string>
+ <string name="uninstall_update_text">Replace this app with the factory version? All data will be removed.</string>
+ <string name="uninstall_update_text_multiuser">Replace this app with the factory version? All data will be removed. This affects all users of this device, including those with work profiles.</string>
<string name="uninstalling">Uninstalling\u2026</string>
<string name="uninstall_done">Uninstall finished.</string>
<string name="uninstall_failed">Uninstall unsuccessful.</string>
diff --git a/src/com/android/packageinstaller/UninstallerActivity.java b/src/com/android/packageinstaller/UninstallerActivity.java
index f1afe424..ae1659f4 100755
--- a/src/com/android/packageinstaller/UninstallerActivity.java
+++ b/src/com/android/packageinstaller/UninstallerActivity.java
@@ -74,11 +74,15 @@ public class UninstallerActivity extends Activity {
final boolean isUpdate =
((dialogInfo.appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
+ UserManager userManager = UserManager.get(getActivity());
if (isUpdate) {
- messageBuilder.append(getString(R.string.uninstall_update_text));
+ if (isSingleUser(userManager)) {
+ messageBuilder.append(getString(R.string.uninstall_update_text));
+ } else {
+ messageBuilder.append(getString(R.string.uninstall_update_text_multiuser));
+ }
} else {
- UserManager userManager = UserManager.get(getActivity());
- if (dialogInfo.allUsers && userManager.getUserCount() >= 2) {
+ if (dialogInfo.allUsers && !isSingleUser(userManager)) {
messageBuilder.append(getString(R.string.uninstall_application_text_all_users));
} else if (!dialogInfo.user.equals(android.os.Process.myUserHandle())) {
UserInfo userInfo = userManager.getUserInfo(dialogInfo.user.getIdentifier());
@@ -113,6 +117,16 @@ public class UninstallerActivity extends Activity {
getActivity().finish();
}
}
+
+ /**
+ * Returns whether there is only one user on this device, not including
+ * the system-only user.
+ */
+ private boolean isSingleUser(UserManager userManager) {
+ final int userCount = userManager.getUserCount();
+ return userCount == 1
+ || (UserManager.isSplitSystemUser() && userCount == 2);
+ }
}
public static class AppNotFoundDialogFragment extends DialogFragment {