Fix demo app UnsafeOptInUsageError lint errors
This change: * Adds missing `@OptIn` annotation to demo app's `ErrorMessageProvider` * Switches from `Util.SDK_INT` to `Build.VERSION.SDK_INT` in `SampleChooserActivity` (`PlayerActivity` is already using this). This code hasn't changed recently, and it doesn't fail on the `release` branch, but it failed when I checked the `main` branch just now - so I assume lint has updated to detect more cases where unstable APIs are being used without opt-in. I suspect the difference is due to different Android Gradle Plugin versions between the branches. #minor-release PiperOrigin-RevId: 529111669
This commit is contained in:
parent
93e3fe418e
commit
ebcdd983e2
@ -514,6 +514,7 @@ public class PlayerActivity extends AppCompatActivity
|
||||
|
||||
private class PlayerErrorMessageProvider implements ErrorMessageProvider<PlaybackException> {
|
||||
|
||||
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||
@Override
|
||||
public Pair<Integer, String> getErrorMessage(PlaybackException e) {
|
||||
String errorString = getString(R.string.error_generic);
|
||||
|
@ -27,6 +27,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.JsonReader;
|
||||
@ -273,7 +274,7 @@ public class SampleChooserActivity extends AppCompatActivity
|
||||
Toast.makeText(getApplicationContext(), downloadUnsupportedStringId, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
} else if (!notificationPermissionToastShown
|
||||
&& Util.SDK_INT >= 33
|
||||
&& Build.VERSION.SDK_INT >= 33
|
||||
&& checkSelfPermission(Api33.getPostNotificationPermissionString())
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
downloadMediaItemWaitingForNotificationPermission = playlistHolder.mediaItems.get(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user