Merge "Save interactive/screen-on state in KeyguardServiceDelegate" into mnc-dr-dev
This commit is contained in:
@@ -6085,6 +6085,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
startedWakingUp();
|
startedWakingUp();
|
||||||
screenTurningOn(null);
|
screenTurningOn(null);
|
||||||
|
screenTurnedOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressDialog mBootMsgDialog = null;
|
ProgressDialog mBootMsgDialog = null;
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ public class KeyguardServiceDelegate {
|
|||||||
private static final String TAG = "KeyguardServiceDelegate";
|
private static final String TAG = "KeyguardServiceDelegate";
|
||||||
private static final boolean DEBUG = true;
|
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;
|
protected KeyguardServiceWrapper mKeyguardService;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final View mScrim; // shown if keyguard crashes
|
private final View mScrim; // shown if keyguard crashes
|
||||||
@@ -61,6 +69,8 @@ public class KeyguardServiceDelegate {
|
|||||||
public int offReason;
|
public int offReason;
|
||||||
public int currentUser;
|
public int currentUser;
|
||||||
public boolean bootCompleted;
|
public boolean bootCompleted;
|
||||||
|
public int screenState;
|
||||||
|
public int interactiveState;
|
||||||
};
|
};
|
||||||
|
|
||||||
public interface DrawnListener {
|
public interface DrawnListener {
|
||||||
@@ -144,10 +154,17 @@ public class KeyguardServiceDelegate {
|
|||||||
// If the system is ready, it means keyguard crashed and restarted.
|
// If the system is ready, it means keyguard crashed and restarted.
|
||||||
mKeyguardService.onSystemReady();
|
mKeyguardService.onSystemReady();
|
||||||
// This is used to hide the scrim once keyguard displays.
|
// This is used to hide the scrim once keyguard displays.
|
||||||
|
if (mKeyguardState.interactiveState == INTERACTIVE_STATE_AWAKE) {
|
||||||
mKeyguardService.onStartedWakingUp();
|
mKeyguardService.onStartedWakingUp();
|
||||||
|
}
|
||||||
|
if (mKeyguardState.screenState == SCREEN_STATE_ON
|
||||||
|
|| mKeyguardState.screenState == SCREEN_STATE_TURNING_ON) {
|
||||||
mKeyguardService.onScreenTurningOn(
|
mKeyguardService.onScreenTurningOn(
|
||||||
new KeyguardShowDelegate(mDrawnListenerWhenConnect));
|
new KeyguardShowDelegate(mDrawnListenerWhenConnect));
|
||||||
|
}
|
||||||
|
if (mKeyguardState.screenState == SCREEN_STATE_ON) {
|
||||||
mKeyguardService.onScreenTurnedOn();
|
mKeyguardService.onScreenTurnedOn();
|
||||||
|
}
|
||||||
mDrawnListenerWhenConnect = null;
|
mDrawnListenerWhenConnect = null;
|
||||||
}
|
}
|
||||||
if (mKeyguardState.bootCompleted) {
|
if (mKeyguardState.bootCompleted) {
|
||||||
@@ -231,6 +248,7 @@ public class KeyguardServiceDelegate {
|
|||||||
if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
|
if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
|
||||||
mKeyguardService.onStartedWakingUp();
|
mKeyguardService.onStartedWakingUp();
|
||||||
}
|
}
|
||||||
|
mKeyguardState.interactiveState = INTERACTIVE_STATE_AWAKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onScreenTurnedOff() {
|
public void onScreenTurnedOff() {
|
||||||
@@ -238,6 +256,7 @@ public class KeyguardServiceDelegate {
|
|||||||
if (DEBUG) Log.v(TAG, "onScreenTurnedOff()");
|
if (DEBUG) Log.v(TAG, "onScreenTurnedOff()");
|
||||||
mKeyguardService.onScreenTurnedOff();
|
mKeyguardService.onScreenTurnedOff();
|
||||||
}
|
}
|
||||||
|
mKeyguardState.screenState = SCREEN_STATE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onScreenTurningOn(final DrawnListener drawnListener) {
|
public void onScreenTurningOn(final DrawnListener drawnListener) {
|
||||||
@@ -252,6 +271,7 @@ public class KeyguardServiceDelegate {
|
|||||||
mDrawnListenerWhenConnect = drawnListener;
|
mDrawnListenerWhenConnect = drawnListener;
|
||||||
showScrim();
|
showScrim();
|
||||||
}
|
}
|
||||||
|
mKeyguardState.screenState = SCREEN_STATE_TURNING_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onScreenTurnedOn() {
|
public void onScreenTurnedOn() {
|
||||||
@@ -259,6 +279,7 @@ public class KeyguardServiceDelegate {
|
|||||||
if (DEBUG) Log.v(TAG, "onScreenTurnedOn()");
|
if (DEBUG) Log.v(TAG, "onScreenTurnedOn()");
|
||||||
mKeyguardService.onScreenTurnedOn();
|
mKeyguardService.onScreenTurnedOn();
|
||||||
}
|
}
|
||||||
|
mKeyguardState.screenState = SCREEN_STATE_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartedGoingToSleep(int why) {
|
public void onStartedGoingToSleep(int why) {
|
||||||
@@ -266,12 +287,14 @@ public class KeyguardServiceDelegate {
|
|||||||
mKeyguardService.onStartedGoingToSleep(why);
|
mKeyguardService.onStartedGoingToSleep(why);
|
||||||
}
|
}
|
||||||
mKeyguardState.offReason = why;
|
mKeyguardState.offReason = why;
|
||||||
|
mKeyguardState.interactiveState = INTERACTIVE_STATE_GOING_TO_SLEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinishedGoingToSleep(int why) {
|
public void onFinishedGoingToSleep(int why) {
|
||||||
if (mKeyguardService != null) {
|
if (mKeyguardService != null) {
|
||||||
mKeyguardService.onFinishedGoingToSleep(why);
|
mKeyguardService.onFinishedGoingToSleep(why);
|
||||||
}
|
}
|
||||||
|
mKeyguardState.interactiveState = INTERACTIVE_STATE_SLEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyguardEnabled(boolean enabled) {
|
public void setKeyguardEnabled(boolean enabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user