Finish PlayerActivity if cleartext not permitted

This is inline with other show-toast-on-error cases in this method, and avoids
leaving the user on a completely black screen.

Note that the maybeRequestReadExternalStoragePermission is an exception because
it's not actually an error case.

#minor-release

PiperOrigin-RevId: 343264869
This commit is contained in:
olly 2020-11-19 12:27:53 +00:00 committed by Oliver Woodman
parent 2714fb0241
commit 622a44dce0

View File

@ -325,6 +325,7 @@ public class PlayerActivity extends AppCompatActivity
if (!Util.checkCleartextTrafficPermitted(mediaItem)) { if (!Util.checkCleartextTrafficPermitted(mediaItem)) {
showToast(R.string.error_cleartext_not_permitted); showToast(R.string.error_cleartext_not_permitted);
finish();
return Collections.emptyList(); return Collections.emptyList();
} }
if (Util.maybeRequestReadExternalStoragePermission(/* activity= */ this, mediaItem)) { if (Util.maybeRequestReadExternalStoragePermission(/* activity= */ this, mediaItem)) {