Merge "Fixes incorrect array type comparison" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4fd129b588
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user