am 68569321: Do not apply keyguard\'s short timeout when the keyguard is hidden by another window.

Merge commit '68569321db63908a8531ff1b8ae7f9a3610d3337' into eclair-mr2

* commit '68569321db63908a8531ff1b8ae7f9a3610d3337':
  Do not apply keyguard's short timeout when the keyguard is hidden by another window.
This commit is contained in:
Mike Lockwood
2009-11-09 12:04:02 -08:00
committed by Android Git Automerger
2 changed files with 22 additions and 6 deletions

View File

@@ -184,6 +184,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
// answer whether the input should be restricted)
private boolean mShowing = false;
// true if the keyguard is hidden by another window
private boolean mHidden = false;
/**
* Helps remember whether the screen has turned on since the last time
* it turned off due to timeout. see {@link #onScreenTurnedOff(int)}
@@ -417,6 +420,16 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
return mShowing;
}
/**
* Notify us when the keyguard is hidden by another window
*/
public void setHidden(boolean isHidden) {
synchronized (KeyguardViewMediator.this) {
mHidden = isHidden;
adjustUserActivityLocked();
}
}
/**
* Given the state of the keyguard, is the input restricted?
* Input is restricted when the keyguard is showing, or when the keyguard
@@ -860,12 +873,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
if (DEBUG) Log.d(TAG, "handleShow");
if (!mSystemReady) return;
// while we're showing, we control the wake state, so ask the power
// manager not to honor request for userActivity.
mRealPowerManager.enableUserActivity(false);
mKeyguardViewManager.show();
mShowing = true;
adjustUserActivityLocked();
try {
ActivityManagerNative.getDefault().closeSystemDialogs("lock");
} catch (RemoteException e) {
@@ -885,14 +895,18 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
Log.w(TAG, "attempt to hide the keyguard while waking, ignored");
return;
}
// When we go away, tell the poewr manager to honor requests from userActivity.
mRealPowerManager.enableUserActivity(true);
mKeyguardViewManager.hide();
mShowing = false;
adjustUserActivityLocked();
}
}
private void adjustUserActivityLocked() {
// disable user activity if we are shown and not hidden
mRealPowerManager.enableUserActivity(!mShowing || mHidden);
}
/**
* Handle message sent by {@link #wakeWhenReadyLocked(int)}
* @param keyCode The key that woke the device.

View File

@@ -1446,12 +1446,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
} else if (mHideLockScreen) {
if (mKeyguard.hideLw(false)) {
mKeyguardMediator.setHidden(true);
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
| FINISH_LAYOUT_REDO_WALLPAPER;
}
} else {
if (mKeyguard.showLw(false)) {
mKeyguardMediator.setHidden(false);
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
| FINISH_LAYOUT_REDO_WALLPAPER;