Skip to content

Commit

Permalink
Return Number from ShadowSurfaceControl#nativeCreate to support sdk 1…
Browse files Browse the repository at this point in the history
…8/19
  • Loading branch information
JuliaSullivanGoogle committed Feb 9, 2022
1 parent 2c07e2a commit 4aa58d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.robolectric.shadows;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
import static android.os.Build.VERSION_CODES.KITKAT_WATCH;
import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.P;
import static android.os.Build.VERSION_CODES.Q;
Expand Down Expand Up @@ -39,7 +38,7 @@ public void newSurfaceControl_doesNotResultInCloseGuardError() {
}

@Test
@Config(minSdk = KITKAT_WATCH, maxSdk = O)
@Config(maxSdk = O)
public void newSurfaceControl_isNotNull() {
SurfaceControl surfaceControl =
ReflectionHelpers.callConstructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.robolectric.shadows;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
import static android.os.Build.VERSION_CODES.KITKAT_WATCH;
import static android.os.Build.VERSION_CODES.N_MR1;
import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.P;
Expand Down Expand Up @@ -44,10 +43,8 @@ protected void finalize() throws Throwable {
reflector(SurfaceControlReflector.class, realSurfaceControl).finalize();
}

// TODO(paulsowden): SDKs 18/19 use the same argument signature but a return type of int, to
// implement this properly will need a different shadow targetted to 18/19.
@Implementation(minSdk = KITKAT_WATCH, maxSdk = N_MR1)
protected static long nativeCreate(
@Implementation(maxSdk = N_MR1)
protected static Number nativeCreate(
SurfaceSession session, String name, int w, int h, int format, int flags) {
// Return a non-zero value otherwise constructing a SurfaceControl fails with
// OutOfResourcesException.
Expand Down

0 comments on commit 4aa58d6

Please sign in to comment.