Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
226583f0
authored
Jun 05, 2020
by
olly
Committed by
Oliver Woodman
Jun 05, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Reintroduce isConnected check for download requirements
PiperOrigin-RevId: 314925639
parent
ee0c6224
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
library/core/src/main/java/com/google/android/exoplayer2/scheduler/Requirements.java
library/core/src/main/java/com/google/android/exoplayer2/scheduler/Requirements.java
View file @
226583f0
...
@@ -156,7 +156,10 @@ public final class Requirements implements Parcelable {
...
@@ -156,7 +156,10 @@ public final class Requirements implements Parcelable {
ConnectivityManager
connectivityManager
=
ConnectivityManager
connectivityManager
=
(
ConnectivityManager
)
(
ConnectivityManager
)
Assertions
.
checkNotNull
(
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
));
Assertions
.
checkNotNull
(
context
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
));
if
(!
isInternetConnectivityValidated
(
connectivityManager
))
{
@Nullable
NetworkInfo
networkInfo
=
connectivityManager
.
getActiveNetworkInfo
();
if
(
networkInfo
==
null
||
!
networkInfo
.
isConnected
()
||
!
isInternetConnectivityValidated
(
connectivityManager
))
{
return
requirements
&
(
NETWORK
|
NETWORK_UNMETERED
);
return
requirements
&
(
NETWORK
|
NETWORK_UNMETERED
);
}
}
...
@@ -197,11 +200,10 @@ public final class Requirements implements Parcelable {
...
@@ -197,11 +200,10 @@ public final class Requirements implements Parcelable {
private
static
boolean
isInternetConnectivityValidated
(
ConnectivityManager
connectivityManager
)
{
private
static
boolean
isInternetConnectivityValidated
(
ConnectivityManager
connectivityManager
)
{
// It's possible to check NetworkCapabilities.NET_CAPABILITY_VALIDATED from API level 23, but
// It's possible to check NetworkCapabilities.NET_CAPABILITY_VALIDATED from API level 23, but
// RequirementsWatcher only fires an event to re-check the requirements when NetworkCapabilities
// RequirementsWatcher only fires an event to re-check the requirements when NetworkCapabilities
// change from API level 24. We use the legacy path for API level 23 here to keep in sync.
// change from API level 24. We assume that network capability is validated for API level 23 to
// keep in sync.
if
(
Util
.
SDK_INT
<
24
)
{
if
(
Util
.
SDK_INT
<
24
)
{
// Legacy path.
return
true
;
@Nullable
NetworkInfo
networkInfo
=
connectivityManager
.
getActiveNetworkInfo
();
return
networkInfo
!=
null
&&
networkInfo
.
isConnected
();
}
}
@Nullable
Network
activeNetwork
=
connectivityManager
.
getActiveNetwork
();
@Nullable
Network
activeNetwork
=
connectivityManager
.
getActiveNetwork
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment