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

Commit 81781a14 authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Remove a test-only PIC exception" into main

parents 77842fdf fa1a8d69
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -953,7 +953,12 @@ public class PropertyInvalidatedCache<Query, Result> {
    public static void setTestMode(boolean mode) {
        synchronized (sGlobalLock) {
            if (sTestMode == mode) {
                throw new IllegalStateException("cannot set test mode redundantly: mode=" + mode);
                final String msg = "cannot set test mode redundantly: mode=" + mode;
                if (Flags.enforcePicTestmodeProtocol()) {
                    throw new IllegalStateException(msg);
                } else {
                    Log.e(TAG, msg);
                }
            }
            sTestMode = mode;
            if (mode) {
+9 −0
Original line number Diff line number Diff line
@@ -9,3 +9,12 @@ flag {
     description: "PropertyInvalidatedCache uses shared memory for nonces."
     bug: "366552454"
}

flag {
     namespace: "system_performance"
     name: "enforce_pic_testmode_protocol"
     is_exported: true
     is_fixed_read_only: true
     description: "Enforce PropertyInvalidatedCache.setTestMode() protocol"
     bug: "366552454"
}
+3 −1
Original line number Diff line number Diff line
@@ -425,7 +425,9 @@ public class PropertyInvalidatedCacheTests {
        PropertyInvalidatedCache.setTestMode(false);
        try {
            PropertyInvalidatedCache.setTestMode(false);
            if (Flags.enforcePicTestmodeProtocol()) {
                fail("expected an IllegalStateException");
            }
        } catch (IllegalStateException e) {
            // The expected exception.
        }
+3 −1
Original line number Diff line number Diff line
@@ -489,7 +489,9 @@ public class IpcDataCacheTest {
        IpcDataCache.setTestMode(false);
        try {
            IpcDataCache.setTestMode(false);
            if (android.app.Flags.enforcePicTestmodeProtocol()) {
                fail("expected an IllegalStateException");
            }
        } catch (IllegalStateException e) {
            // The expected exception.
        }