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

Commit 4c4aaf56 authored by Patrick Baumann's avatar Patrick Baumann Committed by Automerger Merge Worker
Browse files

Merge "Fixes incorrect array type comparison" into sc-dev am: 4fd129b5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15109669

Change-Id: I456967db427440fe13313cd44ee5ac1a6c1dad44
parents d0ade7ff 4fd129b5
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.pm;

import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
import static android.os.UserHandle.USER_ALL;
import static android.os.UserHandle.USER_NULL;
import static android.provider.DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE;
@@ -838,8 +839,14 @@ public class AppsFilter implements Watchable, Snappable {

    private void updateEntireShouldFilterCache(int subjectUserId) {
        mStateProvider.runWithState((settings, users) -> {
            int userId = subjectUserId;
            if (!ArrayUtils.contains(users, subjectUserId)) {
            int userId = USER_NULL;
            for (int u = 0; u < users.length; u++) {
                if (subjectUserId == users[u].id) {
                    userId = subjectUserId;
                    break;
                }
            }
            if (userId == USER_NULL) {
                Slog.e(TAG, "We encountered a new user that isn't a member of known users, "
                        + "updating the whole cache");
                userId = USER_ALL;
@@ -861,7 +868,7 @@ public class AppsFilter implements Watchable, Snappable {
                            if (UserHandle.getUserId(uid2) == userId) {
                                continue;
                            }
                            cache.setValueAt(uid1, uid2, mShouldFilterCache.valueAt(uid1, uid2));
                            cache.put(uid1, uid2, mShouldFilterCache.get(uid1, uid2));
                        }
                    }
                }