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

Commit 13a3c285 authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] fix boot time regression from copying mQueriesViaComponent

BUG: 315494540
Test: manual

Change-Id: I8375cef599f53221eccba92bb7ed3e403e119b9d
parent a13d4326
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.