Loading core/java/android/app/PropertyInvalidatedCache.java +12 −3 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import java.util.concurrent.atomic.AtomicLong; * @hide */ @TestApi @android.ravenwood.annotation.RavenwoodKeepWholeClass public class PropertyInvalidatedCache<Query, Result> { /** * This is a configuration class that customizes a cache instance. Loading Loading @@ -798,9 +799,17 @@ public class PropertyInvalidatedCache<Query, Result> { = new ConcurrentHashMap<>(); // True if shared memory is flag-enabled, false otherwise. Read the flags exactly once. private static final boolean sSharedMemoryAvailable = com.android.internal.os.Flags.applicationSharedMemoryEnabled() private static final boolean sSharedMemoryAvailable = isSharedMemoryAvailable(); @android.ravenwood.annotation.RavenwoodReplace private static boolean isSharedMemoryAvailable() { return com.android.internal.os.Flags.applicationSharedMemoryEnabled() && android.app.Flags.picUsesSharedMemory(); } 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. Loading core/java/android/os/IpcDataCache.java +1 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,7 @@ import java.util.concurrent.atomic.AtomicLong; */ @TestApi @SystemApi(client=SystemApi.Client.MODULE_LIBRARIES) @android.ravenwood.annotation.RavenwoodKeepWholeClass public class IpcDataCache<Query, Result> extends PropertyInvalidatedCache<Query, Result> { /** * {@inheritDoc} Loading core/tests/coretests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,7 @@ android_ravenwood_test { "src/android/content/ContextTest.java", "src/android/content/pm/PackageManagerTest.java", "src/android/content/pm/UserInfoTest.java", "src/android/app/PropertyInvalidatedCacheTests.java", "src/android/database/CursorWindowTest.java", "src/android/os/**/*.java", "src/android/content/res/*.java", Loading core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java +13 −6 Original line number Diff line number Diff line Loading @@ -52,11 +52,7 @@ import org.junit.Test; * atest FrameworksCoreTests:PropertyInvalidatedCacheTests */ @SmallTest @IgnoreUnderRavenwood(blockedBy = PropertyInvalidatedCache.class) public class PropertyInvalidatedCacheTests { @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule(); public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); Loading Loading @@ -389,9 +385,11 @@ public class PropertyInvalidatedCacheTests { assertEquals(n1, "cache_key.bluetooth.get_state"); } // Verify that test mode works properly. // Verify that invalidating the cache from an app process would fail due to lack of permissions. @Test public void testTestMode() { @android.platform.test.annotations.DisabledOnRavenwood( reason = "SystemProperties doesn't have permission check") public void testPermissionFailure() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(PropertyInvalidatedCache.MODULE_SYSTEM, "mode1"); try { Loading @@ -403,6 +401,13 @@ public class PropertyInvalidatedCacheTests { // The expected exception is a bare RuntimeException. The test does not attempt to // validate the text of the exception message. } } // Verify that test mode works properly. @Test public void testTestMode() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(PropertyInvalidatedCache.MODULE_SYSTEM, "mode1"); sysCache.testPropertyName(); // Invalidate the cache. This must succeed because the property has been marked for Loading Loading @@ -441,6 +446,8 @@ public class PropertyInvalidatedCacheTests { // storing nonces in shared memory. @RequiresFlagsEnabled(FLAG_APPLICATION_SHARED_MEMORY_ENABLED) @Test @android.platform.test.annotations.DisabledOnRavenwood( reason = "PIC doesn't use SharedMemory on Ravenwood") public void testSharedMemoryStorage() { // Fetch a shared memory instance for testing. ApplicationSharedMemory shmem = ApplicationSharedMemory.create(); Loading core/tests/coretests/src/android/os/IpcDataCacheTest.java +11 −5 Original line number Diff line number Diff line Loading @@ -41,10 +41,7 @@ import org.junit.Test; * atest FrameworksCoreTests:IpcDataCacheTest */ @SmallTest @IgnoreUnderRavenwood(blockedBy = IpcDataCache.class) public class IpcDataCacheTest { @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule(); // Configuration for creating caches private static final String MODULE = IpcDataCache.MODULE_TEST; Loading Loading @@ -452,9 +449,11 @@ public class IpcDataCacheTest { assertEquals(ec.isDisabled(), true); } // Verify that test mode works properly. // Verify that invalidating the cache from an app process would fail due to lack of permissions. @Test public void testTestMode() { @android.platform.test.annotations.DisabledOnRavenwood( reason = "SystemProperties doesn't have permission check") public void testPermissionFailure() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(IpcDataCache.MODULE_SYSTEM, "mode1"); try { Loading @@ -466,6 +465,13 @@ public class IpcDataCacheTest { // The expected exception is a bare RuntimeException. The test does not attempt to // validate the text of the exception message. } } // Verify that test mode works properly. @Test public void testTestMode() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(IpcDataCache.MODULE_SYSTEM, "mode1"); sysCache.testPropertyName(); // Invalidate the cache. This must succeed because the property has been marked for Loading Loading
core/java/android/app/PropertyInvalidatedCache.java +12 −3 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import java.util.concurrent.atomic.AtomicLong; * @hide */ @TestApi @android.ravenwood.annotation.RavenwoodKeepWholeClass public class PropertyInvalidatedCache<Query, Result> { /** * This is a configuration class that customizes a cache instance. Loading Loading @@ -798,9 +799,17 @@ public class PropertyInvalidatedCache<Query, Result> { = new ConcurrentHashMap<>(); // True if shared memory is flag-enabled, false otherwise. Read the flags exactly once. private static final boolean sSharedMemoryAvailable = com.android.internal.os.Flags.applicationSharedMemoryEnabled() private static final boolean sSharedMemoryAvailable = isSharedMemoryAvailable(); @android.ravenwood.annotation.RavenwoodReplace private static boolean isSharedMemoryAvailable() { return com.android.internal.os.Flags.applicationSharedMemoryEnabled() && android.app.Flags.picUsesSharedMemory(); } 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. Loading
core/java/android/os/IpcDataCache.java +1 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,7 @@ import java.util.concurrent.atomic.AtomicLong; */ @TestApi @SystemApi(client=SystemApi.Client.MODULE_LIBRARIES) @android.ravenwood.annotation.RavenwoodKeepWholeClass public class IpcDataCache<Query, Result> extends PropertyInvalidatedCache<Query, Result> { /** * {@inheritDoc} Loading
core/tests/coretests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,7 @@ android_ravenwood_test { "src/android/content/ContextTest.java", "src/android/content/pm/PackageManagerTest.java", "src/android/content/pm/UserInfoTest.java", "src/android/app/PropertyInvalidatedCacheTests.java", "src/android/database/CursorWindowTest.java", "src/android/os/**/*.java", "src/android/content/res/*.java", Loading
core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java +13 −6 Original line number Diff line number Diff line Loading @@ -52,11 +52,7 @@ import org.junit.Test; * atest FrameworksCoreTests:PropertyInvalidatedCacheTests */ @SmallTest @IgnoreUnderRavenwood(blockedBy = PropertyInvalidatedCache.class) public class PropertyInvalidatedCacheTests { @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule(); public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); Loading Loading @@ -389,9 +385,11 @@ public class PropertyInvalidatedCacheTests { assertEquals(n1, "cache_key.bluetooth.get_state"); } // Verify that test mode works properly. // Verify that invalidating the cache from an app process would fail due to lack of permissions. @Test public void testTestMode() { @android.platform.test.annotations.DisabledOnRavenwood( reason = "SystemProperties doesn't have permission check") public void testPermissionFailure() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(PropertyInvalidatedCache.MODULE_SYSTEM, "mode1"); try { Loading @@ -403,6 +401,13 @@ public class PropertyInvalidatedCacheTests { // The expected exception is a bare RuntimeException. The test does not attempt to // validate the text of the exception message. } } // Verify that test mode works properly. @Test public void testTestMode() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(PropertyInvalidatedCache.MODULE_SYSTEM, "mode1"); sysCache.testPropertyName(); // Invalidate the cache. This must succeed because the property has been marked for Loading Loading @@ -441,6 +446,8 @@ public class PropertyInvalidatedCacheTests { // storing nonces in shared memory. @RequiresFlagsEnabled(FLAG_APPLICATION_SHARED_MEMORY_ENABLED) @Test @android.platform.test.annotations.DisabledOnRavenwood( reason = "PIC doesn't use SharedMemory on Ravenwood") public void testSharedMemoryStorage() { // Fetch a shared memory instance for testing. ApplicationSharedMemory shmem = ApplicationSharedMemory.create(); Loading
core/tests/coretests/src/android/os/IpcDataCacheTest.java +11 −5 Original line number Diff line number Diff line Loading @@ -41,10 +41,7 @@ import org.junit.Test; * atest FrameworksCoreTests:IpcDataCacheTest */ @SmallTest @IgnoreUnderRavenwood(blockedBy = IpcDataCache.class) public class IpcDataCacheTest { @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule(); // Configuration for creating caches private static final String MODULE = IpcDataCache.MODULE_TEST; Loading Loading @@ -452,9 +449,11 @@ public class IpcDataCacheTest { assertEquals(ec.isDisabled(), true); } // Verify that test mode works properly. // Verify that invalidating the cache from an app process would fail due to lack of permissions. @Test public void testTestMode() { @android.platform.test.annotations.DisabledOnRavenwood( reason = "SystemProperties doesn't have permission check") public void testPermissionFailure() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(IpcDataCache.MODULE_SYSTEM, "mode1"); try { Loading @@ -466,6 +465,13 @@ public class IpcDataCacheTest { // The expected exception is a bare RuntimeException. The test does not attempt to // validate the text of the exception message. } } // Verify that test mode works properly. @Test public void testTestMode() { // Create a cache that will write a system nonce. TestCache sysCache = new TestCache(IpcDataCache.MODULE_SYSTEM, "mode1"); sysCache.testPropertyName(); // Invalidate the cache. This must succeed because the property has been marked for Loading