summaryrefslogtreecommitdiffstats
path: root/policy/src/com/android
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-03-26 18:31:48 +0100
committerJorim Jaggi <jjaggi@google.com>2014-03-31 20:58:31 +0200
commit5cf17879a31b7b78c09ec50b727f921840dcf783 (patch)
tree0e3d1a52b1c275676c80c6f90dd516a4d8e292cb /policy/src/com/android
parent085226c40f21a4467f047b901c7640e2215828d8 (diff)
downloadframeworks_base-5cf17879a31b7b78c09ec50b727f921840dcf783.zip
frameworks_base-5cf17879a31b7b78c09ec50b727f921840dcf783.tar.gz
frameworks_base-5cf17879a31b7b78c09ec50b727f921840dcf783.tar.bz2
Reuse KeyguardViewMediator for new Keyguard implementation.
This change reuses KeyguardViewMediator for the new Keyguard implementation in status bar. KeyguardViewManager is replaced by StatusBarKeyguardManager which handles adding the view, setting the state etc. StatusBarWindowManager is introduced to managed the window of the status bar, which has the logic of both the old Keyguard window and the old status bar window. In the current implementation, Keyguard gets displayed like it would be in the bouncer state, but that's likely to change in the future. Also, setHidden in IKeyguardService is also renamed to setOccluded, as the word hidden interferes with the terminology when dismissing the Keyguard. Bug: 13635952 Change-Id: I1c5d5a49d810d8532089f464cb2efe35e577f517
Diffstat (limited to 'policy/src/com/android')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java112
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java20
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java10
3 files changed, 73 insertions, 69 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index fe032f9..928fd9b 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -2460,7 +2460,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
* given the situation with the keyguard.
*/
void launchHomeFromHotKey() {
- if (mKeyguardDelegate != null && mKeyguardDelegate.isShowingAndNotHidden()) {
+ if (mKeyguardDelegate != null && mKeyguardDelegate.isShowingAndNotOccluded()) {
// don't launch home if keyguard showing
} else if (!mHideLockScreen && mKeyguardDelegate.isInputRestricted()) {
// when in keyguard restricted mode, must first verify unlock
@@ -3529,54 +3529,56 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Hide the key guard if a visible window explicitly specifies that it wants to be
// displayed when the screen is locked.
- if (localLOGV) Slog.v(TAG, "finishPostLayoutPolicyLw: mHideKeyguard="
- + mHideLockScreen);
- if (mDismissKeyguard != DISMISS_KEYGUARD_NONE && !isKeyguardSecure()) {
- mKeyguardHidden = true;
- if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setHidden(true))) {
- changes |= FINISH_LAYOUT_REDO_LAYOUT
- | FINISH_LAYOUT_REDO_CONFIG
- | FINISH_LAYOUT_REDO_WALLPAPER;
- }
- if (mKeyguardDelegate.isShowing()) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mKeyguardDelegate.keyguardDone(false, false);
+ if (mKeyguardDelegate != null && mStatusBar != null) {
+ if (localLOGV) Slog.v(TAG, "finishPostLayoutPolicyLw: mHideKeyguard="
+ + mHideLockScreen);
+ if (mDismissKeyguard != DISMISS_KEYGUARD_NONE && !isKeyguardSecure()) {
+ mKeyguardHidden = true;
+ if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setOccluded(true))) {
+ changes |= FINISH_LAYOUT_REDO_LAYOUT
+ | FINISH_LAYOUT_REDO_CONFIG
+ | FINISH_LAYOUT_REDO_WALLPAPER;
+ }
+ if (mKeyguardDelegate.isShowing()) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mKeyguardDelegate.keyguardDone(false, false);
+ }
+ });
+ }
+ } else if (mHideLockScreen) {
+ mKeyguardHidden = true;
+ if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setOccluded(true))) {
+ changes |= FINISH_LAYOUT_REDO_LAYOUT
+ | FINISH_LAYOUT_REDO_CONFIG
+ | FINISH_LAYOUT_REDO_WALLPAPER;
+ }
+ } else if (mDismissKeyguard != DISMISS_KEYGUARD_NONE) {
+ // This is the case of keyguard isSecure() and not mHideLockScreen.
+ if (mDismissKeyguard == DISMISS_KEYGUARD_START) {
+ // Only launch the next keyguard unlock window once per window.
+ mKeyguardHidden = false;
+ if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setOccluded(false))) {
+ changes |= FINISH_LAYOUT_REDO_LAYOUT
+ | FINISH_LAYOUT_REDO_CONFIG
+ | FINISH_LAYOUT_REDO_WALLPAPER;
}
- });
- }
- } else if (mHideLockScreen) {
- mKeyguardHidden = true;
- if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setHidden(true))) {
- changes |= FINISH_LAYOUT_REDO_LAYOUT
- | FINISH_LAYOUT_REDO_CONFIG
- | FINISH_LAYOUT_REDO_WALLPAPER;
- }
- } else if (mDismissKeyguard != DISMISS_KEYGUARD_NONE) {
- // This is the case of keyguard isSecure() and not mHideLockScreen.
- if (mDismissKeyguard == DISMISS_KEYGUARD_START) {
- // Only launch the next keyguard unlock window once per window.
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mKeyguardDelegate.dismiss();
+ }
+ });
+ }
+ } else {
+ mWinDismissingKeyguard = null;
mKeyguardHidden = false;
- if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setHidden(false))) {
+ if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setOccluded(false))) {
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
| FINISH_LAYOUT_REDO_WALLPAPER;
}
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mKeyguardDelegate.dismiss();
- }
- });
- }
- } else {
- mWinDismissingKeyguard = null;
- mKeyguardHidden = false;
- if (processKeyguardSetHiddenResultLw(mKeyguardDelegate.setHidden(false))) {
- changes |= FINISH_LAYOUT_REDO_LAYOUT
- | FINISH_LAYOUT_REDO_CONFIG
- | FINISH_LAYOUT_REDO_WALLPAPER;
}
}
@@ -3592,22 +3594,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
/**
- * Processes the result code of {@link IKeyguardService#setHidden}. This is needed because we
+ * Processes the result code of {@link IKeyguardService#setOccluded}. This is needed because we
* immediately need to put the wallpaper directly behind the Keyguard when a window with flag
* {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} gets dismissed. If we
* would wait for Keyguard to change the flags, that would be running asynchronously and thus be
* too late so the user might see the window behind.
*
- * @param setHiddenResult The result code from {@link IKeyguardService#setHidden}.
+ * @param setHiddenResult The result code from {@link IKeyguardService#setOccluded}.
* @return Whether the flags have changed and we have to redo the layout.
*/
private boolean processKeyguardSetHiddenResultLw(int setHiddenResult) {
- if (setHiddenResult == IKeyguardServiceConstants.KEYGUARD_SERVICE_HIDE_RESULT_SET_FLAGS) {
+ if (setHiddenResult
+ == IKeyguardServiceConstants.KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_SET_FLAGS) {
mStatusBar.getAttrs().privateFlags |= PRIVATE_FLAG_KEYGUARD;
mStatusBar.getAttrs().flags |= FLAG_SHOW_WALLPAPER;
return true;
} else if (setHiddenResult
- == IKeyguardServiceConstants.KEYGUARD_SERVICE_HIDE_RESULT_UNSET_FLAGS) {
+ == IKeyguardServiceConstants.KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_UNSET_FLAGS) {
mStatusBar.getAttrs().privateFlags &= ~PRIVATE_FLAG_KEYGUARD;
mStatusBar.getAttrs().flags &= ~FLAG_SHOW_WALLPAPER;
return true;
@@ -3843,7 +3846,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// when the keyguard is hidden by another activity.
final boolean keyguardActive = (mKeyguardDelegate == null ? false :
(isScreenOn ?
- mKeyguardDelegate.isShowingAndNotHidden() :
+ mKeyguardDelegate.isShowingAndNotOccluded() :
mKeyguardDelegate.isShowing()));
if (keyCode == KeyEvent.KEYCODE_POWER
@@ -4435,7 +4438,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private boolean keyguardIsShowingTq() {
if (mKeyguardDelegate == null) return false;
- return mKeyguardDelegate.isShowingAndNotHidden();
+ return mKeyguardDelegate.isShowingAndNotOccluded();
}
@@ -5079,7 +5082,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
final boolean hapticsDisabled = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) == 0;
- if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotHidden())) {
+ if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotOccluded())) {
return false;
}
long[] pattern = null;
@@ -5130,7 +5133,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public void keepScreenOnStoppedLw() {
- if (mKeyguardDelegate != null && !mKeyguardDelegate.isShowingAndNotHidden()) {
+ if (mKeyguardDelegate != null && !mKeyguardDelegate.isShowingAndNotOccluded()) {
mPowerManager.userActivity(SystemClock.uptimeMillis(), false);
}
}
@@ -5200,9 +5203,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | View.STATUS_BAR_TRANSLUCENT
- | View.NAVIGATION_BAR_TRANSLUCENT;
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+ if (!isStatusBarKeyguard() || mHideLockScreen) {
+ flags |= View.STATUS_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSLUCENT;
+ }
vis = (vis & ~flags) | (oldVis & flags);
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
index d0281d1..966924b 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
@@ -44,13 +44,13 @@ public class KeyguardServiceDelegate {
// the event something checks before the service is actually started.
// KeyguardService itself should default to this state until the real state is known.
showing = true;
- showingAndNotHidden = true;
+ showingAndNotOccluded = true;
secure = true;
}
boolean showing;
- boolean showingAndNotHidden;
+ boolean showingAndNotOccluded;
boolean inputRestricted;
- boolean hidden;
+ boolean occluded;
boolean secure;
boolean dreaming;
boolean systemIsReady;
@@ -109,7 +109,7 @@ public class KeyguardServiceDelegate {
Context.BIND_AUTO_CREATE, UserHandle.OWNER)) {
if (DEBUG) Log.v(TAG, "*** Keyguard: can't bind to " + KEYGUARD_CLASS);
mKeyguardState.showing = false;
- mKeyguardState.showingAndNotHidden = false;
+ mKeyguardState.showingAndNotOccluded = false;
mKeyguardState.secure = false;
} else {
if (DEBUG) Log.v(TAG, "*** Keyguard started");
@@ -148,11 +148,11 @@ public class KeyguardServiceDelegate {
return mKeyguardState.showing;
}
- public boolean isShowingAndNotHidden() {
+ public boolean isShowingAndNotOccluded() {
if (mKeyguardService != null) {
- mKeyguardState.showingAndNotHidden = mKeyguardService.isShowingAndNotHidden();
+ mKeyguardState.showingAndNotOccluded = mKeyguardService.isShowingAndNotOccluded();
}
- return mKeyguardState.showingAndNotHidden;
+ return mKeyguardState.showingAndNotOccluded;
}
public boolean isInputRestricted() {
@@ -174,12 +174,12 @@ public class KeyguardServiceDelegate {
}
}
- public int setHidden(boolean isHidden) {
+ public int setOccluded(boolean isOccluded) {
int result = 0;
if (mKeyguardService != null) {
- result = mKeyguardService.setHidden(isHidden);
+ result = mKeyguardService.setOccluded(isOccluded);
}
- mKeyguardState.hidden = isHidden;
+ mKeyguardState.occluded = isOccluded;
return result;
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java
index 6d5f2b6..7cb48fa 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java
@@ -58,9 +58,9 @@ public class KeyguardServiceWrapper implements IKeyguardService {
return false; // TODO cache state
}
- public boolean isShowingAndNotHidden() {
+ public boolean isShowingAndNotOccluded() {
try {
- return mService.isShowingAndNotHidden();
+ return mService.isShowingAndNotOccluded();
} catch (RemoteException e) {
Slog.w(TAG , "Remote Exception", e);
}
@@ -101,12 +101,12 @@ public class KeyguardServiceWrapper implements IKeyguardService {
}
}
- public int setHidden(boolean isHidden) {
+ public int setOccluded(boolean isOccluded) {
try {
- return mService.setHidden(isHidden);
+ return mService.setOccluded(isOccluded);
} catch (RemoteException e) {
Slog.w(TAG , "Remote Exception", e);
- return IKeyguardServiceConstants.KEYGUARD_SERVICE_HIDE_RESULT_NONE;
+ return IKeyguardServiceConstants.KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_NONE;
}
}