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

Commit 9c546074 authored by Christopher Tate's avatar Christopher Tate Committed by android-build-merger
Browse files

Merge "Fix #37305009 : Beam crash in secondary users" into oc-dev

am: 68bfea8a

Change-Id: Ib449f03ac48eb534c75d539ce38f295444098cb4
parents 045d23a6 68bfea8a
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -832,9 +832,9 @@ public class ActivityManagerService extends IActivityManager.Stub
    ProcessRecord mHeavyWeightProcess = null;
    /**
     * Non-persistent app uid whitelist for background restrictions
     * Non-persistent appId whitelist for background restrictions
     */
    int[] mBackgroundUidWhitelist = new int[] {
    int[] mBackgroundAppIdWhitelist = new int[] {
            BLUETOOTH_UID
    };
@@ -12102,9 +12102,11 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    private boolean uidOnBackgroundWhitelist(final int uid) {
        final int N = mBackgroundUidWhitelist.length;
        final int appId = UserHandle.getAppId(uid);
        final int[] whitelist = mBackgroundAppIdWhitelist;
        final int N = whitelist.length;
        for (int i = 0; i < N; i++) {
            if (uid == mBackgroundUidWhitelist[i]) {
            if (appId == whitelist[i]) {
                return true;
            }
        }
@@ -12121,11 +12123,11 @@ public class ActivityManagerService extends IActivityManager.Stub
            Slog.i(TAG, "Adding uid " + uid + " to bg uid whitelist");
        }
        synchronized (this) {
            final int N = mBackgroundUidWhitelist.length;
            final int N = mBackgroundAppIdWhitelist.length;
            int[] newList = new int[N+1];
            System.arraycopy(mBackgroundUidWhitelist, 0, newList, 0, N);
            newList[N] = uid;
            mBackgroundUidWhitelist = newList;
            System.arraycopy(mBackgroundAppIdWhitelist, 0, newList, 0, N);
            newList[N] = UserHandle.getAppId(uid);
            mBackgroundAppIdWhitelist = newList;
        }
    }