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
71d4f394
authored
Jan 10, 2019
by
eguven
Committed by
Oliver Woodman
Jan 14, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Call Listener methods on the thread started RequirementsWatcher
PiperOrigin-RevId: 228701917
parent
92bec21c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
library/core/src/main/java/com/google/android/exoplayer2/scheduler/RequirementsWatcher.java
library/core/src/main/java/com/google/android/exoplayer2/scheduler/RequirementsWatcher.java
View file @
71d4f394
...
...
@@ -68,6 +68,7 @@ public final class RequirementsWatcher {
private
int
notMetRequirements
;
private
CapabilityValidatedCallback
networkCallback
;
private
Handler
handler
;
/**
* @param context Any context.
...
...
@@ -87,6 +88,7 @@ public final class RequirementsWatcher {
*/
public
void
start
()
{
Assertions
.
checkNotNull
(
Looper
.
myLooper
());
handler
=
new
Handler
();
notMetRequirements
=
requirements
.
getNotMetRequirements
(
context
);
...
...
@@ -111,7 +113,7 @@ public final class RequirementsWatcher {
}
}
receiver
=
new
DeviceStatusChangeReceiver
();
context
.
registerReceiver
(
receiver
,
filter
,
null
,
new
Handler
()
);
context
.
registerReceiver
(
receiver
,
filter
,
null
,
handler
);
logd
(
this
+
" started"
);
}
...
...
@@ -195,16 +197,22 @@ public final class RequirementsWatcher {
private
final
class
CapabilityValidatedCallback
extends
ConnectivityManager
.
NetworkCallback
{
@Override
public
void
onAvailable
(
Network
network
)
{
super
.
onAvailable
(
network
);
logd
(
RequirementsWatcher
.
this
+
" NetworkCallback.onAvailable"
);
checkRequirements
();
onNetworkCallback
();
}
@Override
public
void
onLost
(
Network
network
)
{
super
.
onLost
(
network
);
logd
(
RequirementsWatcher
.
this
+
" NetworkCallback.onLost"
);
checkRequirements
();
onNetworkCallback
();
}
private
void
onNetworkCallback
()
{
handler
.
post
(
()
->
{
if
(
networkCallback
!=
null
)
{
logd
(
RequirementsWatcher
.
this
+
" NetworkCallback"
);
checkRequirements
();
}
});
}
}
}
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