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

Commit 92dbd38d authored by Julius D'souza's avatar Julius D'souza
Browse files

Add SYNCHRONOUS to EnabledFlags for PackageManager



SYNCHRONOUS is a flag for setComponentEnabledSetting()
which will serialise the given user's package restrictions
state (including enabled + disabled packages) after the
specified component state has been updated.

Test: manual
Bug: 130044763
Change-Id: I615e5af6361718b5f3c355ca4424d1f8c4fb078f
Signed-off-by: default avatarJulius D'souza <jdsouza@google.com>
parent a198f02a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11908,6 +11908,7 @@ package android.content.pm {
    field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd
    field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe
    field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc
    field public static final int SYNCHRONOUS = 2; // 0x2
    field public static final int VERIFICATION_ALLOW = 1; // 0x1
    field public static final int VERIFICATION_REJECT = -1; // 0xffffffff
    field public static final int VERSION_CODE_HIGHEST = -1; // 0xffffffff
+11 −2
Original line number Diff line number Diff line
@@ -917,8 +917,9 @@ public abstract class PackageManager {
    public static final int INSTALL_DRY_RUN = 0x00800000;

    /** @hide */
    @IntDef(flag = true, prefix = { "DONT_KILL_APP" }, value = {
            DONT_KILL_APP
    @IntDef(flag = true, value = {
            DONT_KILL_APP,
            SYNCHRONOUS
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface EnabledFlags {}
@@ -931,6 +932,14 @@ public abstract class PackageManager {
     */
    public static final int DONT_KILL_APP = 0x00000001;

    /**
     * Flag parameter for
     * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
     * that the given user's package restrictions state will be serialised to disk after the
     * component state has been updated.
     */
    public static final int SYNCHRONOUS = 0x00000002;

    /** @hide */
    @IntDef(prefix = { "INSTALL_REASON_" }, value = {
            INSTALL_REASON_UNKNOWN,
+15 −6
Original line number Diff line number Diff line
@@ -19980,7 +19980,11 @@ public class PackageManagerService extends IPackageManager.Stub
            }
        }
        synchronized (mLock) {
            if ((flags & PackageManager.SYNCHRONOUS) != 0) {
                flushPackageRestrictionsAsUserInternalLocked(userId);
            } else {
                scheduleWritePackageRestrictionsLocked(userId);
            }
            updateSequenceNumberLP(pkgSetting, new int[] { userId });
            final long callingId = Binder.clearCallingIdentity();
            try {
@@ -20041,13 +20045,18 @@ public class PackageManagerService extends IPackageManager.Stub
        mPermissionManager.enforceCrossUserPermission(Binder.getCallingUid(), userId, false /* requireFullPermission*/,
                false /* checkShell */, "flushPackageRestrictions");
        synchronized (mLock) {
            flushPackageRestrictionsAsUserInternalLocked(userId);
        }
    }
    @GuardedBy("mLock")
    private void flushPackageRestrictionsAsUserInternalLocked(int userId) {
        mSettings.writePackageRestrictionsLPr(userId);
        mDirtyUsers.remove(userId);
        if (mDirtyUsers.isEmpty()) {
            mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
        }
    }
    }
    private void sendPackageChangedBroadcast(String packageName,
            boolean killFlag, ArrayList<String> componentNames, int packageUid) {