Loading services/core/java/com/android/server/pm/AppsFilterImpl.java +3 −1 Original line number Diff line number Diff line Loading @@ -1042,7 +1042,9 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, existingSettings, forceQueryable, protectedBroadcasts); SparseSetArray<Integer> queriesViaComponent = computer.execute(); synchronized (mQueriesViaComponentLock) { mQueriesViaComponent.copyFrom(queriesViaComponent); mQueriesViaComponent = new WatchedSparseSetArray<>(queriesViaComponent); mQueriesViaComponentSnapshot = new SnapshotCache.Auto<>( mQueriesViaComponent, mQueriesViaComponent, "AppsFilter.mQueriesViaComponent"); } mQueriesViaComponentRequireRecompute.set(false); Loading services/core/java/com/android/server/utils/WatchedSparseSetArray.java +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,17 @@ public class WatchedSparseSetArray<T> extends WatchableImpl implements Snappable mStorage = new SparseSetArray(watchedSparseSetArray.untrackedStorage()); } /** * Create a new WatchedSparseSetArray from an existing SparseSetArray without copying. * <p> * Use with caution: Callers must ensure that no reference to {@code sparseSetArray} exists * anywhere else in the system. If such a reference does exist, then changes to the storage via * that reference will not be noticed by the new WatchedSpareSetArray. */ public WatchedSparseSetArray(@NonNull SparseSetArray<T> sparseSetArray) { mStorage = sparseSetArray; } /** * Return the underlying storage. This breaks the wrapper but is necessary when * passing the array to distant methods. Loading Loading
services/core/java/com/android/server/pm/AppsFilterImpl.java +3 −1 Original line number Diff line number Diff line Loading @@ -1042,7 +1042,9 @@ public final class AppsFilterImpl extends AppsFilterLocked implements Watchable, existingSettings, forceQueryable, protectedBroadcasts); SparseSetArray<Integer> queriesViaComponent = computer.execute(); synchronized (mQueriesViaComponentLock) { mQueriesViaComponent.copyFrom(queriesViaComponent); mQueriesViaComponent = new WatchedSparseSetArray<>(queriesViaComponent); mQueriesViaComponentSnapshot = new SnapshotCache.Auto<>( mQueriesViaComponent, mQueriesViaComponent, "AppsFilter.mQueriesViaComponent"); } mQueriesViaComponentRequireRecompute.set(false); Loading
services/core/java/com/android/server/utils/WatchedSparseSetArray.java +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,17 @@ public class WatchedSparseSetArray<T> extends WatchableImpl implements Snappable mStorage = new SparseSetArray(watchedSparseSetArray.untrackedStorage()); } /** * Create a new WatchedSparseSetArray from an existing SparseSetArray without copying. * <p> * Use with caution: Callers must ensure that no reference to {@code sparseSetArray} exists * anywhere else in the system. If such a reference does exist, then changes to the storage via * that reference will not be noticed by the new WatchedSpareSetArray. */ public WatchedSparseSetArray(@NonNull SparseSetArray<T> sparseSetArray) { mStorage = sparseSetArray; } /** * Return the underlying storage. This breaks the wrapper but is necessary when * passing the array to distant methods. Loading