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

Commit 4f8d315a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Update PIC Ravenwood dependencies"" into main

parents cbdb6b81 18af107e
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
@@ -1220,15 +1220,22 @@ public class PropertyInvalidatedCache<Query, Result> {
    private static final ConcurrentHashMap<CacheKey, NonceHandler> sHandlers =
            new ConcurrentHashMap<>();

    // True if nonces are visible to processes outside this one.
    // True if shared memory is flag-enabled, false otherwise.  Read the flags exactly once.
    private static final boolean sSharedMemoryAvailable = isSharedMemoryAvailable();

    @android.ravenwood.annotation.RavenwoodReplace
    private static boolean isMultiProcess() {
    private static boolean isSharedMemoryAvailable() {
        return true;
    }

    // Ravenwood processes are always stand-alone.
    private static boolean isMultiProcess$ravenwood() {
        return false;
    private static boolean isSharedMemoryAvailable$ravenwood() {
        return false; // Always disable shared memory on Ravenwood. (for now)
    }

    // Return true if this cache can use shared memory for its nonce.  Shared memory may be used
    // if the module is the system.
    private static boolean sharedMemoryOkay(@NonNull CacheKey id) {
        return sSharedMemoryAvailable && sNamespaceSystem.equals(id.namespace);
    }

    /**
@@ -1242,9 +1249,7 @@ public class PropertyInvalidatedCache<Query, Result> {
            synchronized (sGlobalLock) {
                h = sHandlers.get(id);
                if (h == null) {
                    if (!isMultiProcess()) {
                        h = new NonceLocal(id);
                    } else if (sNamespaceSystem.equals(id.namespace)) {
                    if (sharedMemoryOkay(id)) {
                        h = new NonceSharedMem(id);
                    } else if (sNamespaceTest.equals(id.namespace)) {
                        h = new NonceLocal(id);
@@ -2093,10 +2098,9 @@ public class PropertyInvalidatedCache<Query, Result> {
        // See if brief output is requested.
        final boolean brief = briefRequested(args);

        NonceStore store = NonceStore.maybeGetInstance();
        if (store != null) {
        if (sSharedMemoryAvailable) {
            pw.println("  SharedMemory: enabled");
            store.dump(pw, "    ", detail);
            NonceStore.getInstance().dump(pw, "    ", detail);
        } else {
            pw.println("  SharedMemory: disabled");
         }
@@ -2239,14 +2243,6 @@ public class PropertyInvalidatedCache<Query, Result> {
            }
        }

        // Return the instance but only if it has been created already.  This is used for dump and
        // debug.
        static NonceStore maybeGetInstance() {
            synchronized (sLock) {
                return sInstance;
            }
        }

        // The index value of an unmapped name.
        public static final int INVALID_NONCE_INDEX = -1;