Class ShadowApplicationSharedMemory

java.lang.Object
org.robolectric.shadows.ShadowApplicationSharedMemory

@Implements(value=com.android.internal.os.ApplicationSharedMemory.class, isInAndroidSdk=false, minSdk=36) public class ShadowApplicationSharedMemory extends Object
Shadow for ApplicationSharedMemory. This gets initialized in
invalid reference
AndroidTestEnvironment
.
  • Constructor Details

    • ShadowApplicationSharedMemory

      public ShadowApplicationSharedMemory()
  • Method Details

    • create

      @Implementation protected static com.android.internal.os.ApplicationSharedMemory create()
      The real create() calls FileDescriptor.setInt$, which Robolectric routes through jdk.internal.access.SharedSecrets and fails with IllegalAccessException on JDK 9+ without an add-opens. Since there is no real shared memory here (nativeMap(int, boolean) is stubbed), build the inert instance directly instead, mirroring the real result so isMapped() stays true.
    • nativeMap

      @Implementation protected static long nativeMap(int fd, boolean isMutable)
    • reset

      @Resetter public static void reset()