Skip to content

Commit

Permalink
Fix demo app UnsafeOptInUsageError lint errors
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 5dbbff4)
  • Loading branch information
icbaker committed May 15, 2023
1 parent be1dadb commit d57f5b4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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;
Expand Down Expand Up @@ -271,7 +272,7 @@ private void onSampleDownloadButtonClicked(PlaylistHolder playlistHolder) {
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);
Expand Down

0 comments on commit d57f5b4

Please sign in to comment.