diff options
author | Michael Hoisie <hoisie@google.com> | 2024-04-29 22:31:52 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-29 22:32:41 -0700 |
commit | 2e55d3898ad5f5ad9da68349b849699851a81df2 (patch) | |
tree | 993f2f7a9873e6b1461b9baa87858d59717ee78d | |
parent | 4f32042afe54beb3c8a02a330ba479e16febf49d (diff) | |
download | robolectric-2e55d3898ad5f5ad9da68349b849699851a81df2.tar.gz |
Update ShadowNativeSurface.nativeCreateFromSurfaceTexture for Android V
Previously, ShadowNativeSurface.nativeCreateFromSurfaceTexture invoke the JNI
binding in U and below, but it would return zero in native code, due to
SurfaceTexture not being available on host. This meant that doing the JNI
callback was moot.
In Android V, the native code of Surface.nativeCreateFromSurfaceTexture is not
compiled for host platforms, so '0' has to be returned from the shadow method.
To make these consistent, update
ShadowNativeSurface.nativeCreateFromSurfaceTexture to return zero for all SDK
levels.
PiperOrigin-RevId: 629295331
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeSurface.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeSurface.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeSurface.java index 3ccae4a45..f7cd7161a 100644 --- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeSurface.java +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeSurface.java @@ -28,11 +28,11 @@ import org.robolectric.versioning.AndroidVersions.U; isInAndroidSdk = false, callNativeMethodsByDefault = true) public class ShadowNativeSurface { - @Implementation(maxSdk = U.SDK_INT) + @Implementation protected static long nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture) throws OutOfResourcesException { - DefaultNativeRuntimeLoader.injectAndLoad(); - return SurfaceNatives.nativeCreateFromSurfaceTexture(surfaceTexture); + // SurfaceTexture is not available for host. + return 0; } @Implementation(maxSdk = U.SDK_INT) |