Loading services/core/java/com/android/server/pm/AppsFilterBase.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -197,6 +197,7 @@ public abstract class AppsFilterBase implements AppsFilterSnapshot { protected volatile boolean mCacheReady = false; protected volatile boolean mCacheReady = false; protected volatile boolean mCacheEnabled = true; protected volatile boolean mCacheEnabled = true; protected volatile boolean mNeedToUpdateCacheForImplicitAccess = false; protected static final boolean CACHE_VALID = true; protected static final boolean CACHE_VALID = true; protected static final boolean CACHE_INVALID = false; protected static final boolean CACHE_INVALID = false; Loading services/core/java/com/android/server/pm/AppsFilterImpl.java +29 −3 Original line number Original line Diff line number Diff line Loading @@ -465,6 +465,9 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, changed = retainOnUpdate changed = retainOnUpdate ? mRetainedImplicitlyQueryable.add(recipientUid, visibleUid) ? mRetainedImplicitlyQueryable.add(recipientUid, visibleUid) : mImplicitlyQueryable.add(recipientUid, visibleUid); : mImplicitlyQueryable.add(recipientUid, visibleUid); if (!mCacheReady && changed) { mNeedToUpdateCacheForImplicitAccess = true; } } } if (changed && DEBUG_LOGGING) { if (changed && DEBUG_LOGGING) { Slog.i(TAG, (retainOnUpdate ? "retained " : "") + "implicit access granted: " Slog.i(TAG, (retainOnUpdate ? "retained " : "") + "implicit access granted: " Loading @@ -476,8 +479,6 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, // Update the cache in a one-off manner since we've got all the information we need. // Update the cache in a one-off manner since we've got all the information we need. mShouldFilterCache.put(recipientUid, visibleUid, false); mShouldFilterCache.put(recipientUid, visibleUid, false); } } } else if (changed) { invalidateCache("grantImplicitAccess: " + recipientUid + " -> " + visibleUid); } } if (changed) { if (changed) { onChanged(); onChanged(); Loading Loading @@ -833,7 +834,12 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, } } updateEntireShouldFilterCacheInner(snapshot, settings, usersRef[0], USER_ALL); updateEntireShouldFilterCacheInner(snapshot, settings, usersRef[0], USER_ALL); onChanged(); synchronized (mImplicitlyQueryableLock) { if (mNeedToUpdateCacheForImplicitAccess) { updateShouldFilterCacheForImplicitAccess(); mNeedToUpdateCacheForImplicitAccess = false; } } logCacheRebuilt(reason, SystemClock.currentTimeMicro() - currentTimeUs, logCacheRebuilt(reason, SystemClock.currentTimeMicro() - currentTimeUs, users.length, settings.size()); users.length, settings.size()); Loading @@ -845,6 +851,7 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, } } mCacheReady = true; mCacheReady = true; onChanged(); }, delayMs); }, delayMs); } } Loading Loading @@ -875,6 +882,25 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, snapshot.getPackageStates().size()); snapshot.getPackageStates().size()); } } @GuardedBy("mImplicitlyQueryableLock") private void updateShouldFilterCacheForImplicitAccess() { updateShouldFilterCacheForImplicitAccess(mRetainedImplicitlyQueryable); updateShouldFilterCacheForImplicitAccess(mImplicitlyQueryable); } private void updateShouldFilterCacheForImplicitAccess( WatchedSparseSetArray<Integer> queriesMap) { synchronized (mCacheLock) { for (int i = 0; i < queriesMap.size(); i++) { Integer callingUid = queriesMap.keyAt(i); ArraySet<Integer> targetUids = queriesMap.get(callingUid); for (Integer targetUid : targetUids) { mShouldFilterCache.put(callingUid, targetUid, false); } } } } private void updateShouldFilterCacheForPackage(Computer snapshot, private void updateShouldFilterCacheForPackage(Computer snapshot, String packageName) { String packageName) { if (!mCacheReady) { if (!mCacheReady) { Loading Loading
services/core/java/com/android/server/pm/AppsFilterBase.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -197,6 +197,7 @@ public abstract class AppsFilterBase implements AppsFilterSnapshot { protected volatile boolean mCacheReady = false; protected volatile boolean mCacheReady = false; protected volatile boolean mCacheEnabled = true; protected volatile boolean mCacheEnabled = true; protected volatile boolean mNeedToUpdateCacheForImplicitAccess = false; protected static final boolean CACHE_VALID = true; protected static final boolean CACHE_VALID = true; protected static final boolean CACHE_INVALID = false; protected static final boolean CACHE_INVALID = false; Loading
services/core/java/com/android/server/pm/AppsFilterImpl.java +29 −3 Original line number Original line Diff line number Diff line Loading @@ -465,6 +465,9 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, changed = retainOnUpdate changed = retainOnUpdate ? mRetainedImplicitlyQueryable.add(recipientUid, visibleUid) ? mRetainedImplicitlyQueryable.add(recipientUid, visibleUid) : mImplicitlyQueryable.add(recipientUid, visibleUid); : mImplicitlyQueryable.add(recipientUid, visibleUid); if (!mCacheReady && changed) { mNeedToUpdateCacheForImplicitAccess = true; } } } if (changed && DEBUG_LOGGING) { if (changed && DEBUG_LOGGING) { Slog.i(TAG, (retainOnUpdate ? "retained " : "") + "implicit access granted: " Slog.i(TAG, (retainOnUpdate ? "retained " : "") + "implicit access granted: " Loading @@ -476,8 +479,6 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, // Update the cache in a one-off manner since we've got all the information we need. // Update the cache in a one-off manner since we've got all the information we need. mShouldFilterCache.put(recipientUid, visibleUid, false); mShouldFilterCache.put(recipientUid, visibleUid, false); } } } else if (changed) { invalidateCache("grantImplicitAccess: " + recipientUid + " -> " + visibleUid); } } if (changed) { if (changed) { onChanged(); onChanged(); Loading Loading @@ -833,7 +834,12 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, } } updateEntireShouldFilterCacheInner(snapshot, settings, usersRef[0], USER_ALL); updateEntireShouldFilterCacheInner(snapshot, settings, usersRef[0], USER_ALL); onChanged(); synchronized (mImplicitlyQueryableLock) { if (mNeedToUpdateCacheForImplicitAccess) { updateShouldFilterCacheForImplicitAccess(); mNeedToUpdateCacheForImplicitAccess = false; } } logCacheRebuilt(reason, SystemClock.currentTimeMicro() - currentTimeUs, logCacheRebuilt(reason, SystemClock.currentTimeMicro() - currentTimeUs, users.length, settings.size()); users.length, settings.size()); Loading @@ -845,6 +851,7 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, } } mCacheReady = true; mCacheReady = true; onChanged(); }, delayMs); }, delayMs); } } Loading Loading @@ -875,6 +882,25 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, snapshot.getPackageStates().size()); snapshot.getPackageStates().size()); } } @GuardedBy("mImplicitlyQueryableLock") private void updateShouldFilterCacheForImplicitAccess() { updateShouldFilterCacheForImplicitAccess(mRetainedImplicitlyQueryable); updateShouldFilterCacheForImplicitAccess(mImplicitlyQueryable); } private void updateShouldFilterCacheForImplicitAccess( WatchedSparseSetArray<Integer> queriesMap) { synchronized (mCacheLock) { for (int i = 0; i < queriesMap.size(); i++) { Integer callingUid = queriesMap.keyAt(i); ArraySet<Integer> targetUids = queriesMap.get(callingUid); for (Integer targetUid : targetUids) { mShouldFilterCache.put(callingUid, targetUid, false); } } } } private void updateShouldFilterCacheForPackage(Computer snapshot, private void updateShouldFilterCacheForPackage(Computer snapshot, String packageName) { String packageName) { if (!mCacheReady) { if (!mCacheReady) { Loading