Remove more unnecessary SDK checks now the min is 19

PiperOrigin-RevId: 621600592
This commit is contained in:
ibaker 2024-04-03 12:12:17 -07:00 committed by Copybara-Service
parent 896d147444
commit 032cad8d09
3 changed files with 3 additions and 19 deletions

View File

@ -32,7 +32,6 @@ import androidx.media3.common.util.EGLSurfaceTexture.SecureMode;
import androidx.media3.common.util.GlUtil; import androidx.media3.common.util.GlUtil;
import androidx.media3.common.util.Log; import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.InlineMe; import com.google.errorprone.annotations.InlineMe;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@ -80,8 +79,6 @@ public final class PlaceholderSurface extends Surface {
* Returns a newly created placeholder surface. The surface must be released by calling {@link * Returns a newly created placeholder surface. The surface must be released by calling {@link
* #release} when it's no longer required. * #release} when it's no longer required.
* *
* <p>Must only be called if {@link Util#SDK_INT} is 17 or higher.
*
* @param context Any {@link Context}. * @param context Any {@link Context}.
* @param secure Whether a secure surface is required. Must only be requested if {@link * @param secure Whether a secure surface is required. Must only be requested if {@link
* #isSecureSupported(Context)} returns {@code true}. * #isSecureSupported(Context)} returns {@code true}.

View File

@ -18,7 +18,6 @@ package androidx.media3.test.utils;
import static androidx.media3.common.util.Assertions.checkArgument; import static androidx.media3.common.util.Assertions.checkArgument;
import static androidx.media3.common.util.Assertions.checkNotNull; import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.common.util.Assertions.checkState; import static androidx.media3.common.util.Assertions.checkState;
import static androidx.media3.common.util.Util.SDK_INT;
import static androidx.media3.common.util.Util.isRunningOnEmulator; import static androidx.media3.common.util.Util.isRunningOnEmulator;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@ -49,7 +48,6 @@ import java.io.OutputStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Arrays; import java.util.Arrays;
import org.junit.AssumptionViolatedException;
/** Utilities for pixel tests. */ /** Utilities for pixel tests. */
// TODO(b/263395272): After the bug is fixed and dependent tests are moved back to media3.effect, // TODO(b/263395272): After the bug is fixed and dependent tests are moved back to media3.effect,
@ -539,14 +537,8 @@ public class BitmapPixelTestUtil {
public static Bitmap flipBitmapVertically(Bitmap bitmap) { public static Bitmap flipBitmapVertically(Bitmap bitmap) {
boolean wasPremultiplied = bitmap.isPremultiplied(); boolean wasPremultiplied = bitmap.isPremultiplied();
if (!wasPremultiplied) { if (!wasPremultiplied) {
if (SDK_INT >= 19) { // Bitmap.createBitmap must be called on a premultiplied bitmap.
// Bitmap.createBitmap must be called on a premultiplied bitmap. bitmap.setPremultiplied(true);
bitmap.setPremultiplied(true);
} else {
throw new AssumptionViolatedException(
"bitmap is not premultiplied and Bitmap.setPremultiplied is not supported under API 19."
+ " unpremultiplied bitmaps cannot be flipped");
}
} }
Matrix flip = new Matrix(); Matrix flip = new Matrix();
@ -561,9 +553,7 @@ public class BitmapPixelTestUtil {
bitmap.getHeight(), bitmap.getHeight(),
flip, flip,
/* filter= */ true); /* filter= */ true);
if (SDK_INT >= 19) { flippedBitmap.setPremultiplied(wasPremultiplied);
flippedBitmap.setPremultiplied(wasPremultiplied);
}
return flippedBitmap; return flippedBitmap;
} }

View File

@ -119,8 +119,6 @@ public class EffectPlaybackTest {
@Test @Test
public void exoplayerEffectsPreviewTest_ensuresFirstFrameRendered() throws Exception { public void exoplayerEffectsPreviewTest_ensuresFirstFrameRendered() throws Exception {
assumeTrue(Util.SDK_INT >= 18);
String testId = String testId =
Util.formatInvariant( Util.formatInvariant(
"exoplayerEffectsPreviewTest_withPlayWhenReady[%b]_ensuresFirstFrameRendered", "exoplayerEffectsPreviewTest_withPlayWhenReady[%b]_ensuresFirstFrameRendered",
@ -202,7 +200,6 @@ public class EffectPlaybackTest {
"This test should run on real devices because OpenGL to ImageReader rendering is not" "This test should run on real devices because OpenGL to ImageReader rendering is not"
+ " always reliable on emulators.", + " always reliable on emulators.",
!Util.isRunningOnEmulator()); !Util.isRunningOnEmulator());
assumeTrue(Util.SDK_INT >= 18);
ArrayList<BitmapPixelTestUtil.ImageBuffer> readImageBuffers = new ArrayList<>(); ArrayList<BitmapPixelTestUtil.ImageBuffer> readImageBuffers = new ArrayList<>();
AtomicInteger renderedFramesCount = new AtomicInteger(); AtomicInteger renderedFramesCount = new AtomicInteger();