Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae1a50d3 authored by Mark Kim's avatar Mark Kim
Browse files

Update title, message, positive button strings in uninstall confirmation

dialog when archiving an app

Additionally do not ask if the user wants to keep the app's data in case
it is an archiving operation because it is being kept anyway.

Strings doc: http://shortn/_LVkW3MVUCZ

Test: n/a

Bug: 290777135
Change-Id: I45e32e9e013a1033caea7f8e84493158e05cb779
parent d31ed40a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@

    <!-- [CHAR LIMIT=15] -->
    <string name="ok">OK</string>
    <!-- Confirmation text label for button to archive an application. Archiving means uninstalling the app without deleting user's personal data and replacing the app with a stub app with minimum size. So, the user can unarchive the app later and not lose any personal data. -->
    <string name="archive">Archive</string>
    <!-- [CHAR LIMIT=30] -->
    <string name="update_anyway">Update anyway</string>
    <!-- [CHAR LIMIT=15] -->
@@ -115,6 +117,16 @@
    <!--  [CHAR LIMIT=none] -->
    <string name="uninstall_application_text">Do you want to uninstall this app?</string>
    <!--  [CHAR LIMIT=none] -->
    <string name="archive_application_text">Your personal data will be saved</string>
    <!--  [CHAR LIMIT=none] -->
    <string name="archive_application_text_all_users">Archive this app for all users? Your personal data will be saved</string>
    <!--  [CHAR LIMIT=none] -->
    <string name="archive_application_text_current_user_work_profile">Archive this app on your work profile? Your personal data will be saved</string>
    <!--  [CHAR LIMIT=none] -->
    <string name="archive_application_text_user">Archive this app for <xliff:g id="username">%1$s</xliff:g>? Your personal data will be saved</string>
    <!--  [CHAR LIMIT=none] -->
    <string name="archive_application_text_current_user_private_profile">Do you want to archive this app from your private space? Your personal data will be saved</string>
    <!--  [CHAR LIMIT=none] -->
    <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>
    <!--  [CHAR LIMIT=none] -->
@@ -239,6 +251,8 @@

    <!-- Label for cloned app in uninstall dialogue [CHAR LIMIT=40] -->
    <string name="cloned_app_label"><xliff:g id="package_label">%1$s</xliff:g> Clone</string>
    <!-- Label for archiving an app in uninstall dialogue -->
    <string name="archiving_app_label">Archive <xliff:g id="package_label">%1$s</xliff:g>?</string>

    <!-- Label for button to continue install of an app whose source cannot be identified [CHAR LIMIT=40] -->
    <string name="anonymous_source_continue">Continue</string>
+30 −15
Original line number Diff line number Diff line
@@ -130,6 +130,9 @@ public class UninstallAlertDialogFragment extends DialogFragment implements

        final boolean isUpdate =
                ((dialogInfo.appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
        final boolean isArchive =
                android.content.pm.Flags.archiving() && (
                        (dialogInfo.deleteFlags & PackageManager.DELETE_ARCHIVE) != 0);
        final UserHandle myUserHandle = Process.myUserHandle();
        UserManager userManager = getContext().getSystemService(UserManager.class);
        if (isUpdate) {
@@ -140,7 +143,9 @@ public class UninstallAlertDialogFragment extends DialogFragment implements
            }
        } else {
            if (dialogInfo.allUsers && !isSingleUser(userManager)) {
                messageBuilder.append(getString(R.string.uninstall_application_text_all_users));
                messageBuilder.append(
                        isArchive ? getString(R.string.archive_application_text_all_users)
                                : getString(R.string.uninstall_application_text_all_users));
            } else if (!dialogInfo.user.equals(myUserHandle)) {
                int userId = dialogInfo.user.getIdentifier();
                UserManager customUserManager = getContext()
@@ -150,8 +155,10 @@ public class UninstallAlertDialogFragment extends DialogFragment implements

                if (customUserManager.isUserOfType(USER_TYPE_PROFILE_MANAGED)
                        && customUserManager.isSameProfileGroup(dialogInfo.user, myUserHandle)) {
                    messageBuilder.append(
                            getString(R.string.uninstall_application_text_current_user_work_profile,
                    messageBuilder.append(isArchive
                            ? getString(R.string.archive_application_text_current_user_work_profile,
                                    userName) : getString(
                            R.string.uninstall_application_text_current_user_work_profile,
                            userName));
                } else if (customUserManager.isUserOfType(USER_TYPE_PROFILE_CLONE)
                        && customUserManager.isSameProfileGroup(dialogInfo.user, myUserHandle)) {
@@ -161,9 +168,14 @@ public class UninstallAlertDialogFragment extends DialogFragment implements
                } else if (Flags.allowPrivateProfile()
                        && customUserManager.isPrivateProfile()
                        && customUserManager.isSameProfileGroup(dialogInfo.user, myUserHandle)) {
                    messageBuilder.append(getString(
                    messageBuilder.append(isArchive ? getString(
                            R.string.archive_application_text_current_user_private_profile,
                            userName) : getString(
                            R.string.uninstall_application_text_current_user_private_profile,
                            userName));
                } else if (isArchive) {
                    messageBuilder.append(
                            getString(R.string.archive_application_text_user, userName));
                } else {
                    messageBuilder.append(
                            getString(R.string.uninstall_application_text_user, userName));
@@ -172,24 +184,27 @@ public class UninstallAlertDialogFragment extends DialogFragment implements
                mIsClonedApp = true;
                messageBuilder.append(getString(
                        R.string.uninstall_application_text_current_user_clone_profile));
            } else {
                if (Process.myUserHandle().equals(UserHandle.SYSTEM)
            } else if (Process.myUserHandle().equals(UserHandle.SYSTEM)
                    && hasClonedInstance(dialogInfo.appInfo.packageName)) {
                messageBuilder.append(getString(
                        R.string.uninstall_application_text_with_clone_instance,
                        appLabel));
            } else if (isArchive) {
                messageBuilder.append(getString(R.string.archive_application_text));
            } else {
                messageBuilder.append(getString(R.string.uninstall_application_text));
            }
        }
        }

        if (mIsClonedApp) {
            dialogBuilder.setTitle(getString(R.string.cloned_app_label, appLabel));
        } else if (isArchive) {
            dialogBuilder.setTitle(getString(R.string.archiving_app_label, appLabel));
        } else {
            dialogBuilder.setTitle(appLabel);
        }
        dialogBuilder.setPositiveButton(android.R.string.ok, this);
        dialogBuilder.setPositiveButton(isArchive ? R.string.archive : android.R.string.ok,
                this);
        dialogBuilder.setNegativeButton(android.R.string.cancel, this);

        String pkg = dialogInfo.appInfo.packageName;
@@ -199,7 +214,7 @@ public class UninstallAlertDialogFragment extends DialogFragment implements
            PackageInfo pkgInfo = pm.getPackageInfo(pkg,
                    PackageManager.PackageInfoFlags.of(PackageManager.MATCH_ARCHIVED_PACKAGES));

            suggestToKeepAppData = pkgInfo.applicationInfo.hasFragileUserData();
            suggestToKeepAppData = pkgInfo.applicationInfo.hasFragileUserData() && !isArchive;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(LOG_TAG, "Cannot check hasFragileUserData for " + pkg, e);
            suggestToKeepAppData = false;