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

Commit 7079f24d authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] feature flag to turn on new MATCH_UNINSTALLED_PACKAGES behavior

This change will cause getPackageInfo to return a non-null result when
it is called with MATCH_UNINSTALLED_PACKAGES on an app archived or
uninstalled with DELETE_KEEP_DATA. Notice that this behavior already
exists for single-user cases, but not for the multi users. This CL makes
it consistent regardless of the number of users on device.

BUG: 298681254
Test: atest
android.content.pm.cts.PackageManagerShellCommandMultiUserTest#testUninstallWithKeepDataMultiUserMatchUninstalled

Change-Id: Ib7ab6a14f182340d875c2dae889ff53bbb485b70
parent 7c140b16
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
            if (userState.isInstalled()) {
                return true;
            }
            if (userState.getCeDataInode() > 0) {
            if (userState.dataExists()) {
                return true;
            }
        }
+8 −0
Original line number Diff line number Diff line
@@ -6,3 +6,11 @@ flag {
    description: "Feature flag for Quarantined state"
    bug: "269127435"
}

flag {
    name: "new_match_uninstalled_enabled"
    namespace: "package_manager_service"
    description: "Feature flag for new MATCH_UNINSTALLED_PACKAGES behavior"
    bug: "298681254"
    is_fixed_read_only: true
}
+7 −0
Original line number Diff line number Diff line
@@ -242,4 +242,11 @@ public interface PackageUserState {
    @Nullable
    ArchiveState getArchiveState();

    /**
     * @return whether the data dir exists. True when the app is installed for the user, or when the
     * app is uninstalled for the user with {@link PackageManager#DELETE_KEEP_DATA}.
     *
     * @hide
     */
    boolean dataExists();
}
+5 −0
Original line number Diff line number Diff line
@@ -196,4 +196,9 @@ class PackageUserStateDefault implements PackageUserStateInternal {
    public ArchiveState getArchiveState() {
        return null;
    }

    @Override
    public boolean dataExists() {
        return true;
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -685,6 +685,10 @@ public class PackageUserStateImpl extends WatchableImpl implements PackageUserSt
        return false;
    }

    @Override
    public boolean dataExists() {
        return getCeDataInode() > 0;
    }



Loading