Introduce ShadowBuild.UPSIDE_DOWN_CAKE and use it consistently instead of CUR_DEVELOPMENT.
The intent here is to make it flexible to adjust to UPSIDE_DOWN_CAKE once it has been finalized.
PiperOrigin-RevId: 525176114
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/AssociationInfoBuilder.java b/shadows/framework/src/main/java/org/robolectric/shadows/AssociationInfoBuilder.java
index 1c8e88f..adf61e3 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/AssociationInfoBuilder.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/AssociationInfoBuilder.java
@@ -1,6 +1,6 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
+import static android.os.Build.VERSION_CODES.TIRAMISU;
import android.companion.AssociationInfo;
import android.net.MacAddress;
@@ -78,7 +78,7 @@
}
public AssociationInfo build() {
- if (RuntimeEnvironment.getApiLevel() < CUR_DEVELOPMENT) {
+ if (RuntimeEnvironment.getApiLevel() <= TIRAMISU) {
return new AssociationInfo(
id,
userId,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ResourceModeShadowPicker.java b/shadows/framework/src/main/java/org/robolectric/shadows/ResourceModeShadowPicker.java
index 1ead677..4af12cd 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ResourceModeShadowPicker.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ResourceModeShadowPicker.java
@@ -41,7 +41,7 @@
if (ShadowAssetManager.useLegacy()) {
return legacyShadowClass;
} else {
- if (RuntimeEnvironment.getApiLevel() >= VERSION_CODES.CUR_DEVELOPMENT) {
+ if (RuntimeEnvironment.getApiLevel() > VERSION_CODES.TIRAMISU) {
return binary14ShadowClass;
} else if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
return binary10ShadowClass;
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager14.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager14.java
index 3729c15..8771d6a 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager14.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowArscAssetManager14.java
@@ -1,10 +1,8 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import android.annotation.Nullable;
import android.content.res.AssetManager;
-import android.os.Build.VERSION_CODES;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
// TODO: update path to released version.
@@ -13,7 +11,7 @@
@Implements(
value = AssetManager.class,
- minSdk = VERSION_CODES.CUR_DEVELOPMENT,
+ minSdk = ShadowBuild.UPSIDE_DOWN_CAKE,
shadowPicker = ShadowAssetManager.Picker.class)
@SuppressWarnings("NewApi")
public class ShadowArscAssetManager14 extends ShadowArscAssetManager10 {
@@ -27,7 +25,7 @@
// jint smallest_screen_width_dp, jint screen_width_dp,
// jint screen_height_dp, jint screen_layout, jint ui_mode,
// jint color_mode, jint major_version) {
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected static void nativeSetConfiguration(
long ptr,
int mcc,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowAudioTrack.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowAudioTrack.java
index 39a7ddd..8311abe 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowAudioTrack.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowAudioTrack.java
@@ -4,7 +4,6 @@
import static android.media.AudioTrack.ERROR_DEAD_OBJECT;
import static android.media.AudioTrack.WRITE_BLOCKING;
import static android.media.AudioTrack.WRITE_NON_BLOCKING;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
import static android.os.Build.VERSION_CODES.M;
import static android.os.Build.VERSION_CODES.N;
@@ -200,7 +199,7 @@
return AudioTrack.SUCCESS;
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected int native_setup(
Object /*WeakReference<AudioTrack>*/ audioTrack,
Object /*AudioAttributes*/ attributes,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBuild.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBuild.java
index b0cc137..5ae30a5 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBuild.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBuild.java
@@ -23,6 +23,12 @@
private static String serialOverride = Build.UNKNOWN;
/**
+ * Temporary constant for VERSION_CODES.UPSIDE_DOWN_CAKE. Will be removed and replaced once the
+ * constant is available upstream.
+ */
+ public static final int UPSIDE_DOWN_CAKE = 10000;
+
+ /**
* Sets the value of the {@link Build#DEVICE} field.
*
* <p>It will be reset for the next test.
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCameraManager.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCameraManager.java
index f5cb90d..19be93a 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCameraManager.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCameraManager.java
@@ -77,7 +77,7 @@
cameraTorches.put(cameraId, enabled);
}
- @Implementation(minSdk = Build.VERSION_CODES.CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected CameraDevice openCameraDeviceUserAsync(
String cameraId,
CameraDevice.StateCallback callback,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayEventReceiver.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayEventReceiver.java
index b34d0c9..3981407 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayEventReceiver.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayEventReceiver.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.KITKAT;
@@ -96,7 +95,7 @@
return nativeInit(receiver, msgQueue);
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected static long nativeInit(
WeakReference<DisplayEventReceiver> receiver,
WeakReference<Object> vsyncEventData,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java
index 91a3c55..dbcfd11 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplayManagerGlobal.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.O_MR1;
import static android.os.Build.VERSION_CODES.P;
@@ -85,7 +84,7 @@
displayManagerGlobal.setDm(displayManager);
displayManagerGlobal.setLock(new Object());
List<Handler> displayListeners =
- RuntimeEnvironment.getApiLevel() < CUR_DEVELOPMENT
+ RuntimeEnvironment.getApiLevel() < ShadowBuild.UPSIDE_DOWN_CAKE
? new ArrayList<>()
: new CopyOnWriteArrayList<>();
displayManagerGlobal.setDisplayListeners(displayListeners);
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowImageReader.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowImageReader.java
index 0654fbc..b8564ca 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowImageReader.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowImageReader.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.KITKAT;
import static android.os.Build.VERSION_CODES.S_V2;
import static android.os.Build.VERSION_CODES.TIRAMISU;
@@ -70,7 +69,7 @@
return nativeImageSetup(image);
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected int nativeImageSetup(Object /* Image */ image) {
return nativeImageSetup((Image) image);
}
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaCodec.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaCodec.java
index 103907b..9bef2d1 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaCodec.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaCodec.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
import static android.os.Build.VERSION_CODES.N_MR1;
@@ -409,7 +408,7 @@
@Implementation(minSdk = LOLLIPOP, maxSdk = TIRAMISU)
protected void invalidateByteBuffer(@Nullable ByteBuffer[] buffers, int index) {}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void invalidateByteBufferLocked(
@Nullable ByteBuffer[] buffers, int index, boolean input) {}
@@ -417,14 +416,14 @@
@Implementation(minSdk = LOLLIPOP, maxSdk = TIRAMISU)
protected void validateInputByteBuffer(@Nullable ByteBuffer[] buffers, int index) {}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void validateInputByteBufferLocked(@Nullable ByteBuffer[] buffers, int index) {}
/** Prevents calling Android-only methods on basic ByteBuffer objects. */
@Implementation(minSdk = LOLLIPOP, maxSdk = TIRAMISU)
protected void revalidateByteBuffer(@Nullable ByteBuffer[] buffers, int index) {}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void revalidateByteBuffer(@Nullable ByteBuffer[] buffers, int index, boolean input) {}
/**
@@ -442,7 +441,7 @@
}
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void validateOutputByteBufferLocked(
@Nullable ByteBuffer[] buffers, int index, @NonNull BufferInfo info) {
validateOutputByteBuffer(buffers, index, info);
@@ -452,14 +451,14 @@
@Implementation(minSdk = LOLLIPOP, maxSdk = TIRAMISU)
protected void invalidateByteBuffers(@Nullable ByteBuffer[] buffers) {}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void invalidateByteBuffersLocked(@Nullable ByteBuffer[] buffers) {}
/** Prevents attempting to free non-direct ByteBuffer objects. */
@Implementation(minSdk = LOLLIPOP, maxSdk = TIRAMISU)
protected void freeByteBuffer(@Nullable ByteBuffer buffer) {}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected void freeByteBufferLocked(@Nullable ByteBuffer buffer) {}
/** Shadows CodecBuffer to prevent attempting to free non-direct ByteBuffer objects. */
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeFontsFontFamily.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeFontsFontFamily.java
index 9191510..b2da827 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeFontsFontFamily.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeFontsFontFamily.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.Q;
import static android.os.Build.VERSION_CODES.S;
import static android.os.Build.VERSION_CODES.TIRAMISU;
@@ -64,7 +63,7 @@
return FontFamilyBuilderNatives.nBuild(builderPtr, langTags, variant, isCustomFallback);
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected static long nBuild(
long builderPtr,
String langTags,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativePaint.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativePaint.java
index 94fadb5..32d4280 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativePaint.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativePaint.java
@@ -813,7 +813,7 @@
paintPtr, text, start, count, ctxStart, ctxCount, isRtl, outMetrics);
}
- @Implementation(minSdk = 10000)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected static float nGetRunCharacterAdvance(
long paintPtr,
char[] text,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNfcAdapter.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNfcAdapter.java
index 0f9e44d..4cdfb45 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNfcAdapter.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNfcAdapter.java
@@ -221,7 +221,7 @@
}
if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
nfcAdapterReflector.setHasNfcFeature(false);
- if (RuntimeEnvironment.getApiLevel() < VERSION_CODES.CUR_DEVELOPMENT) {
+ if (RuntimeEnvironment.getApiLevel() <= VERSION_CODES.TIRAMISU) {
nfcAdapterReflector.setHasBeamFeature(false);
}
}
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSoundPool.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSoundPool.java
index a1895ff..c40d24e 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSoundPool.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSoundPool.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.LOLLIPOP_MR1;
import static android.os.Build.VERSION_CODES.M;
import static android.os.Build.VERSION_CODES.N;
@@ -63,7 +62,7 @@
return 1;
}
- @Implementation(minSdk = CUR_DEVELOPMENT)
+ @Implementation(minSdk = ShadowBuild.UPSIDE_DOWN_CAKE)
protected int _play(
int soundID,
float leftVolume,
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSurfaceControl.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSurfaceControl.java
index b55d03a..49a93bc 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSurfaceControl.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowSurfaceControl.java
@@ -1,6 +1,5 @@
package org.robolectric.shadows;
-import static android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
import static android.os.Build.VERSION_CODES.N_MR1;
import static android.os.Build.VERSION_CODES.O;
@@ -84,7 +83,7 @@
void initializeNativeObject() {
surfaceControlReflector.setNativeObject(nativeObject.incrementAndGet());
- if (RuntimeEnvironment.getApiLevel() >= CUR_DEVELOPMENT) {
+ if (RuntimeEnvironment.getApiLevel() >= ShadowBuild.UPSIDE_DOWN_CAKE) {
surfaceControlReflector.setFreeNativeResources(() -> {});
}
}