mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Check connectivity after entering or leaving doze mode.
This commit is contained in:
@@ -114,8 +114,7 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
String action = i.getAction();
|
String action = i.getAction();
|
||||||
if (LOG.isLoggable(INFO)) LOG.info("Received broadcast " + action);
|
if (LOG.isLoggable(INFO)) LOG.info("Received broadcast " + action);
|
||||||
updateConnectionStatus();
|
updateConnectionStatus();
|
||||||
// TODO: Also schedule update after idle mode changes
|
if (isSleepOrDozeEvent(i)) {
|
||||||
if (isSleepEvent(i)) {
|
|
||||||
scheduleConnectionStatusUpdate(1, MINUTES);
|
scheduleConnectionStatusUpdate(1, MINUTES);
|
||||||
} else if (isApEnabledEvent(i)) {
|
} else if (isApEnabledEvent(i)) {
|
||||||
// The state change may be broadcast before the AP address is
|
// The state change may be broadcast before the AP address is
|
||||||
@@ -125,9 +124,13 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSleepEvent(Intent i) {
|
private boolean isSleepOrDozeEvent(Intent i) {
|
||||||
return ACTION_SCREEN_ON.equals(i.getAction()) ||
|
String action = i.getAction();
|
||||||
ACTION_SCREEN_OFF.equals(i.getAction());
|
boolean isSleep = ACTION_SCREEN_ON.equals(action) ||
|
||||||
|
ACTION_SCREEN_OFF.equals(action);
|
||||||
|
boolean isDoze = SDK_INT >= 23 &&
|
||||||
|
ACTION_DEVICE_IDLE_MODE_CHANGED.equals(action);
|
||||||
|
return isSleep || isDoze;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isApEnabledEvent(Intent i) {
|
private boolean isApEnabledEvent(Intent i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user