Workaround ConnectivityManager SecurityException on Android 11
#exofixit #minor-release Issue: #9002 PiperOrigin-RevId: 395221648
This commit is contained in:
parent
5183eaaf1e
commit
2e21208f63
@ -287,6 +287,11 @@
|
||||
([#9183](https://github.com/google/ExoPlayer/issues/9183)).
|
||||
* Allow the timeout to be customised via
|
||||
`RtspMediaSource.Factory.setTimeoutMs`.
|
||||
* Downloads and caching:
|
||||
* Workaround platform issue that can cause a `SecurityException` to be
|
||||
thrown from `Requirements.isInternetConnectivityValidated` on devices
|
||||
running Android 11
|
||||
([#9002](https://github.com/google/ExoPlayer/issues/9002)).
|
||||
|
||||
### 2.14.1 (2021-06-11)
|
||||
|
||||
|
@ -210,11 +210,17 @@ public final class Requirements implements Parcelable {
|
||||
if (activeNetwork == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
@Nullable
|
||||
NetworkCapabilities networkCapabilities =
|
||||
connectivityManager.getNetworkCapabilities(activeNetwork);
|
||||
return networkCapabilities != null
|
||||
&& networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
|
||||
} catch (SecurityException e) {
|
||||
// Workaround for https://issuetracker.google.com/issues/175055271.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user