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

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

Change-Id: I38cd2e61dddc957a4f425662d699a6379805590d
This commit is contained in:
Patrick Baumann
2021-06-28 14:51:27 +00:00
committed by Automerger Merge Worker

View File

@@ -18,6 +18,7 @@ package com.android.server.pm;
import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER; import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
import static android.os.UserHandle.USER_ALL; 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 android.provider.DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE;
import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE;
@@ -838,8 +839,14 @@ public class AppsFilter implements Watchable, Snappable {
private void updateEntireShouldFilterCache(int subjectUserId) { private void updateEntireShouldFilterCache(int subjectUserId) {
mStateProvider.runWithState((settings, users) -> { mStateProvider.runWithState((settings, users) -> {
int userId = subjectUserId; int userId = USER_NULL;
if (!ArrayUtils.contains(users, subjectUserId)) { 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, " Slog.e(TAG, "We encountered a new user that isn't a member of known users, "
+ "updating the whole cache"); + "updating the whole cache");
userId = USER_ALL; userId = USER_ALL;
@@ -861,7 +868,7 @@ public class AppsFilter implements Watchable, Snappable {
if (UserHandle.getUserId(uid2) == userId) { if (UserHandle.getUserId(uid2) == userId) {
continue; continue;
} }
cache.setValueAt(uid1, uid2, mShouldFilterCache.valueAt(uid1, uid2)); cache.put(uid1, uid2, mShouldFilterCache.get(uid1, uid2));
} }
} }
} }