Merge "Save interactive/screen-on state in KeyguardServiceDelegate" into mnc-dr-dev

This commit is contained in:
Jorim Jaggi
2015-08-20 02:18:36 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 4 deletions

View File

@@ -6085,6 +6085,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
startedWakingUp();
screenTurningOn(null);
screenTurnedOn();
}
ProgressDialog mBootMsgDialog = null;

View File

@@ -32,6 +32,14 @@ public class KeyguardServiceDelegate {
private static final String TAG = "KeyguardServiceDelegate";
private static final boolean DEBUG = true;
private static final int SCREEN_STATE_OFF = 0;
private static final int SCREEN_STATE_TURNING_ON = 1;
private static final int SCREEN_STATE_ON = 2;
private static final int INTERACTIVE_STATE_SLEEP = 0;
private static final int INTERACTIVE_STATE_AWAKE = 1;
private static final int INTERACTIVE_STATE_GOING_TO_SLEEP = 2;
protected KeyguardServiceWrapper mKeyguardService;
private final Context mContext;
private final View mScrim; // shown if keyguard crashes
@@ -61,6 +69,8 @@ public class KeyguardServiceDelegate {
public int offReason;
public int currentUser;
public boolean bootCompleted;
public int screenState;
public int interactiveState;
};
public interface DrawnListener {
@@ -144,10 +154,17 @@ public class KeyguardServiceDelegate {
// If the system is ready, it means keyguard crashed and restarted.
mKeyguardService.onSystemReady();
// This is used to hide the scrim once keyguard displays.
mKeyguardService.onStartedWakingUp();
mKeyguardService.onScreenTurningOn(
new KeyguardShowDelegate(mDrawnListenerWhenConnect));
mKeyguardService.onScreenTurnedOn();
if (mKeyguardState.interactiveState == INTERACTIVE_STATE_AWAKE) {
mKeyguardService.onStartedWakingUp();
}
if (mKeyguardState.screenState == SCREEN_STATE_ON
|| mKeyguardState.screenState == SCREEN_STATE_TURNING_ON) {
mKeyguardService.onScreenTurningOn(
new KeyguardShowDelegate(mDrawnListenerWhenConnect));
}
if (mKeyguardState.screenState == SCREEN_STATE_ON) {
mKeyguardService.onScreenTurnedOn();
}
mDrawnListenerWhenConnect = null;
}
if (mKeyguardState.bootCompleted) {
@@ -231,6 +248,7 @@ public class KeyguardServiceDelegate {
if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
mKeyguardService.onStartedWakingUp();
}
mKeyguardState.interactiveState = INTERACTIVE_STATE_AWAKE;
}
public void onScreenTurnedOff() {
@@ -238,6 +256,7 @@ public class KeyguardServiceDelegate {
if (DEBUG) Log.v(TAG, "onScreenTurnedOff()");
mKeyguardService.onScreenTurnedOff();
}
mKeyguardState.screenState = SCREEN_STATE_OFF;
}
public void onScreenTurningOn(final DrawnListener drawnListener) {
@@ -252,6 +271,7 @@ public class KeyguardServiceDelegate {
mDrawnListenerWhenConnect = drawnListener;
showScrim();
}
mKeyguardState.screenState = SCREEN_STATE_TURNING_ON;
}
public void onScreenTurnedOn() {
@@ -259,6 +279,7 @@ public class KeyguardServiceDelegate {
if (DEBUG) Log.v(TAG, "onScreenTurnedOn()");
mKeyguardService.onScreenTurnedOn();
}
mKeyguardState.screenState = SCREEN_STATE_ON;
}
public void onStartedGoingToSleep(int why) {
@@ -266,12 +287,14 @@ public class KeyguardServiceDelegate {
mKeyguardService.onStartedGoingToSleep(why);
}
mKeyguardState.offReason = why;
mKeyguardState.interactiveState = INTERACTIVE_STATE_GOING_TO_SLEEP;
}
public void onFinishedGoingToSleep(int why) {
if (mKeyguardService != null) {
mKeyguardService.onFinishedGoingToSleep(why);
}
mKeyguardState.interactiveState = INTERACTIVE_STATE_SLEEP;
}
public void setKeyguardEnabled(boolean enabled) {