summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-07-01 10:09:15 +0200
committerDanny Baumann <dannybaumann@web.de>2013-07-01 11:57:05 +0200
commitb061fe53a9a0d1e27542b95ccb6fa1d4b0968610 (patch)
treee1e5b98e06d937fd5aa1af92f616be2db0701c9e /policy
parent9e3fa9cb673f69aa69de0294bebba61d10befddc (diff)
downloadframeworks_base-b061fe53a9a0d1e27542b95ccb6fa1d4b0968610.zip
frameworks_base-b061fe53a9a0d1e27542b95ccb6fa1d4b0968610.tar.gz
frameworks_base-b061fe53a9a0d1e27542b95ccb6fa1d4b0968610.tar.bz2
Send out USER_PRESENT broadcast on screen on if lockscreen is disabled.
This makes sure to turn off the notification LED on screen on when the lockscreen is disabled by profile or e.g. by lockscreen toggle tile. Change-Id: I0f6a5f9a021abd2799c22c744ab1180cee027409
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java57
1 files changed, 23 insertions, 34 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index 2cf4c8c..92cf7ee 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -696,15 +696,30 @@ public class KeyguardViewMediator {
}
private void maybeSendUserPresentBroadcast() {
- if (mSystemReady && mLockPatternUtils.isLockScreenDisabled()
- && mUserManager.getUsers(true).size() == 1) {
- // Lock screen is disabled because the user has set the preference to "None".
- // In this case, send out ACTION_USER_PRESENT here instead of in
- // handleKeyguardDone()
+ if (mSystemReady && isKeyguardDisabled()) {
sendUserPresentBroadcast();
}
}
+ private boolean isKeyguardDisabled() {
+ if (!mExternallyEnabled) {
+ if (DEBUG) Log.d(TAG, "isKeyguardDisabled: keyguard is disabled externally");
+ return true;
+ }
+ if (mLockPatternUtils.isLockScreenDisabled() && mUserManager.getUsers(true).size() == 1) {
+ if (DEBUG) Log.d(TAG, "isKeyguardDisabled: keyguard is disabled by setting");
+ return true;
+ }
+ Profile profile = mProfileManager.getActiveProfile();
+ if (profile != null) {
+ if (profile.getScreenLockModeWithDPM(mContext) == Profile.LockMode.DISABLE) {
+ if (DEBUG) Log.d(TAG, "isKeyguardDisabled: keyguard is disabled by profile");
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* A dream started. We should lock after the usual screen-off lock timeout but only
* if there is a secure lock pattern.
@@ -898,38 +913,12 @@ public class KeyguardViewMediator {
return;
}
- // if another app is disabling us, don't show
- if (!mExternallyEnabled && !lockedOrMissing) {
- if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled");
-
- // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes
- // for an occasional ugly flicker in this situation:
- // 1) receive a call with the screen on (no keyguard) or make a call
- // 2) screen times out
- // 3) user hits key to turn screen back on
- // instead, we reenable the keyguard when we know the screen is off and the call
- // ends (see the broadcast receiver below)
- // TODO: clean this up when we have better support at the window manager level
- // for apps that wish to be on top of the keyguard
+ // if we're disabled by an app or profile, don't show
+ if (!lockedOrMissing && isKeyguardDisabled()) {
+ if (DEBUG) Log.d(TAG, "doKeyguard: not showing because keyguard is disabled");
return;
}
- if (mUserManager.getUsers(true).size() < 2
- && mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
- if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
- return;
- }
-
- // if the current profile has disabled us, don't show
- Profile profile = mProfileManager.getActiveProfile();
- if (profile != null) {
- if (!lockedOrMissing
- && profile.getScreenLockModeWithDPM(mContext) == Profile.LockMode.DISABLE) {
- if (DEBUG) Log.d(TAG, "doKeyguard: not showing because of profile override");
- return;
- }
- }
-
if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
showLocked(options);
}