Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6a11f7c authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

Merge "[pm] fix boot time regression from copying mQueriesViaComponent" into main

parents f49f75b9 13a3c285
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
+11 −0
Original line number Diff line number Diff line
@@ -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.