Remove incorrect optimization in visibility cache

During review when introducing the visibility cache, a suggested
optimization when iterating over users turned out to prevent populating
of the cache for certain multi-user cases.

This change ensures that we pass over all users in both directions,
making for a complete cache.

Test: atest AppEnumerationTests AppsFilterTest
Fixes: 159193336
Change-Id: Ic9ae27f1e1402b42a60a333c3ae99373f4829101
This commit is contained in:
Patrick Baumann
2020-06-17 10:21:55 -07:00
parent 606981a876
commit 8132b22315

View File

@@ -655,7 +655,7 @@ public class AppsFilter {
final int appxUidCount = userCount * allSettings.size();
for (int su = 0; su < userCount; su++) {
int subjectUser = allUsers[su].id;
for (int ou = su; ou < userCount; ou++) {
for (int ou = 0; ou < userCount; ou++) {
int otherUser = allUsers[ou].id;
int subjectUid = UserHandle.getUid(subjectUser, subjectSetting.appId);
if (!mShouldFilterCache.contains(subjectUid)) {