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

Commit 17f11bd4 authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

Merge "[pm] reset ArchiveState on package update/re-install" into main

parents 17e5a52a 19a53776
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -690,6 +690,9 @@ final class InstallPackageHelper {
                    pkgSetting.setInstallReason(installReason, userId);
                    pkgSetting.setUninstallReason(PackageManager.UNINSTALL_REASON_UNKNOWN, userId);
                    pkgSetting.setFirstInstallTime(System.currentTimeMillis(), userId);
                    // Clear any existing archive state.
                    pkgSetting.setArchiveTimeMillis(0, userId);
                    pkgSetting.setArchiveState(null, userId);
                    mPm.mSettings.writePackageRestrictionsLPr(userId);
                    mPm.mSettings.writeKernelMappingLPr(pkgSetting);
                    installed = true;
@@ -2263,6 +2266,9 @@ final class InstallPackageHelper {
                        ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId,
                                installerPackageName);
                    }
                    // Clear any existing archive state.
                    ps.setArchiveState(null, userId);
                    ps.setArchiveTimeMillis(0, userId);
                } else if (allUsers != null) {
                    // The caller explicitly specified INSTALL_ALL_USERS flag.
                    // Thus, updating the settings to install the app for all users.
@@ -2285,6 +2291,9 @@ final class InstallPackageHelper {
                                ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, currentUserId,
                                        installerPackageName);
                            }
                            // Clear any existing archive state.
                            ps.setArchiveState(null, currentUserId);
                            ps.setArchiveTimeMillis(0, currentUserId);
                        } else {
                            ps.setInstalled(false, currentUserId);
                        }
+5 −0
Original line number Diff line number Diff line
@@ -770,6 +770,11 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
        onChanged();
    }

    void setArchiveState(ArchiveState archiveState, int userId) {
        modifyUserState(userId).setArchiveState(archiveState);
        onChanged();
    }

    void setArchiveTimeMillis(long value, int userId) {
        modifyUserState(userId).setArchiveTimeMillis(value);
        onChanged();