modify away when locked behaviour to locked || screen off
this new behaviour still takes care of not going online when quickly checking for the time but it also includes systems that don’t have a lock screen or incorrectly report being unlocked.
This commit is contained in:
parent
7c53dcc4f4
commit
bf25b24967
|
@ -999,7 +999,10 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
public boolean isScreenLocked() {
|
public boolean isScreenLocked() {
|
||||||
final KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
final KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
return keyguardManager != null && keyguardManager.inKeyguardRestrictedInputMode();
|
final PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||||
|
final boolean locked = keyguardManager != null && keyguardManager.isKeyguardLocked();
|
||||||
|
final boolean interactive = powerManager != null && powerManager.isInteractive();
|
||||||
|
return locked || !interactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPhoneSilenced() {
|
private boolean isPhoneSilenced() {
|
||||||
|
@ -4346,7 +4349,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPresence(final Account account, final boolean includeIdleTimestamp) {
|
private void sendPresence(final Account account, final boolean includeIdleTimestamp) {
|
||||||
Presence.Status status;
|
final Presence.Status status;
|
||||||
if (manuallyChangePresence()) {
|
if (manuallyChangePresence()) {
|
||||||
status = account.getPresenceStatus();
|
status = account.getPresenceStatus();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue