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

Commit cc3c93b4 authored by Lee Shombert's avatar Lee Shombert
Browse files

Make compat cache non-isolating

The following cache is no longer uid-isolating:
 * is_compat_change_enabled

The cache constructor has been reflowed slightly to match the latest
non-deprecated apis.

Flag: EXEMPT bug-fix
Bug: 379098894
Test: presubmit
Change-Id: Ifae71807b4599e0ec7f787077c38e6a16f07f2d9
parent bfb0a089
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.app.compat;

import static android.app.PropertyInvalidatedCache.createSystemCacheKey;

import android.annotation.NonNull;
import android.app.PropertyInvalidatedCache;
import android.content.Context;
@@ -34,7 +32,10 @@ import com.android.internal.compat.IPlatformCompat;
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class ChangeIdStateCache
        extends PropertyInvalidatedCache<ChangeIdStateQuery, Boolean> {
    private static final String CACHE_KEY = createSystemCacheKey("is_compat_change_enabled");

    private static final String CACHE_MODULE = PropertyInvalidatedCache.MODULE_SYSTEM;
    private static final String CACHE_API = "is_compat_change_enabled";

    private static final int MAX_ENTRIES = 2048;
    private static boolean sDisabled = getDefaultDisabled();
    private volatile IPlatformCompat mPlatformCompat;
@@ -51,7 +52,12 @@ public final class ChangeIdStateCache

    /** @hide */
    public ChangeIdStateCache() {
        super(MAX_ENTRIES, CACHE_KEY);
        super(new PropertyInvalidatedCache.Args(CACHE_MODULE)
                .maxEntries(MAX_ENTRIES)
                .isolateUids(false)
                .cacheNulls(false)
                .api(CACHE_API),
                CACHE_API, null);
    }

    /**
@@ -72,7 +78,7 @@ public final class ChangeIdStateCache
     */
    public static void invalidate() {
        if (!sDisabled) {
            PropertyInvalidatedCache.invalidateCache(CACHE_KEY);
            PropertyInvalidatedCache.invalidateCache(CACHE_MODULE, CACHE_API);
        }
    }