Replace Util.SDK_INT with Build.VERSION.SDK_INT in the demo app

Util.SDK_INT will not be part of the stable API. This change only
touches those parts of the main demo app that will not be opted-in to
the unstable API for other reasons (e.g. download use-cases).

PiperOrigin-RevId: 437777687
This commit is contained in:
ibaker 2022-03-28 17:26:03 +01:00 committed by Ian Baker
parent 2a2873840d
commit e4556d76a9

View File

@ -17,6 +17,7 @@ package androidx.media3.demo.main;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Pair;
import android.view.KeyEvent;
@ -142,7 +143,7 @@ public class PlayerActivity extends AppCompatActivity
@Override
public void onStart() {
super.onStart();
if (Util.SDK_INT > 23) {
if (Build.VERSION.SDK_INT > 23) {
initializePlayer();
if (playerView != null) {
playerView.onResume();
@ -153,7 +154,7 @@ public class PlayerActivity extends AppCompatActivity
@Override
public void onResume() {
super.onResume();
if (Util.SDK_INT <= 23 || player == null) {
if (Build.VERSION.SDK_INT <= 23 || player == null) {
initializePlayer();
if (playerView != null) {
playerView.onResume();
@ -164,7 +165,7 @@ public class PlayerActivity extends AppCompatActivity
@Override
public void onPause() {
super.onPause();
if (Util.SDK_INT <= 23) {
if (Build.VERSION.SDK_INT <= 23) {
if (playerView != null) {
playerView.onPause();
}
@ -175,7 +176,7 @@ public class PlayerActivity extends AppCompatActivity
@Override
public void onStop() {
super.onStop();
if (Util.SDK_INT > 23) {
if (Build.VERSION.SDK_INT > 23) {
if (playerView != null) {
playerView.onPause();
}
@ -342,7 +343,7 @@ public class PlayerActivity extends AppCompatActivity
MediaItem.DrmConfiguration drmConfiguration = mediaItem.localConfiguration.drmConfiguration;
if (drmConfiguration != null) {
if (Util.SDK_INT < 18) {
if (Build.VERSION.SDK_INT < 18) {
showToast(R.string.error_drm_unsupported_before_api_18);
finish();
return Collections.emptyList();