Merge "Revert "Revert "Attempt to fix keyguard missing bug""" into lmp-mr1-dev
This commit is contained in:
@@ -2165,7 +2165,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
mStatusBar = win;
|
mStatusBar = win;
|
||||||
mStatusBarController.setWindow(win);
|
mStatusBarController.setWindow(win);
|
||||||
mKeyguardDelegate.hideScrim();
|
|
||||||
break;
|
break;
|
||||||
case TYPE_NAVIGATION_BAR:
|
case TYPE_NAVIGATION_BAR:
|
||||||
mContext.enforceCallingOrSelfPermission(
|
mContext.enforceCallingOrSelfPermission(
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class KeyguardServiceDelegate {
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final View mScrim; // shown if keyguard crashes
|
private final View mScrim; // shown if keyguard crashes
|
||||||
private final KeyguardState mKeyguardState = new KeyguardState();
|
private final KeyguardState mKeyguardState = new KeyguardState();
|
||||||
|
private ShowListener mShowListenerWhenConnect;
|
||||||
|
|
||||||
/* package */ static final class KeyguardState {
|
/* package */ static final class KeyguardState {
|
||||||
KeyguardState() {
|
KeyguardState() {
|
||||||
@@ -46,6 +47,7 @@ public class KeyguardServiceDelegate {
|
|||||||
showing = true;
|
showing = true;
|
||||||
showingAndNotOccluded = true;
|
showingAndNotOccluded = true;
|
||||||
secure = true;
|
secure = true;
|
||||||
|
deviceHasKeyguard = true;
|
||||||
}
|
}
|
||||||
boolean showing;
|
boolean showing;
|
||||||
boolean showingAndNotOccluded;
|
boolean showingAndNotOccluded;
|
||||||
@@ -54,6 +56,7 @@ public class KeyguardServiceDelegate {
|
|||||||
boolean secure;
|
boolean secure;
|
||||||
boolean dreaming;
|
boolean dreaming;
|
||||||
boolean systemIsReady;
|
boolean systemIsReady;
|
||||||
|
boolean deviceHasKeyguard;
|
||||||
public boolean enabled;
|
public boolean enabled;
|
||||||
public boolean dismissable;
|
public boolean dismissable;
|
||||||
public int offReason;
|
public int offReason;
|
||||||
@@ -111,10 +114,12 @@ public class KeyguardServiceDelegate {
|
|||||||
intent.setClassName(KEYGUARD_PACKAGE, KEYGUARD_CLASS);
|
intent.setClassName(KEYGUARD_PACKAGE, KEYGUARD_CLASS);
|
||||||
if (!context.bindServiceAsUser(intent, mKeyguardConnection,
|
if (!context.bindServiceAsUser(intent, mKeyguardConnection,
|
||||||
Context.BIND_AUTO_CREATE, UserHandle.OWNER)) {
|
Context.BIND_AUTO_CREATE, UserHandle.OWNER)) {
|
||||||
if (DEBUG) Log.v(TAG, "*** Keyguard: can't bind to " + KEYGUARD_CLASS);
|
Log.v(TAG, "*** Keyguard: can't bind to " + KEYGUARD_CLASS);
|
||||||
mKeyguardState.showing = false;
|
mKeyguardState.showing = false;
|
||||||
mKeyguardState.showingAndNotOccluded = false;
|
mKeyguardState.showingAndNotOccluded = false;
|
||||||
mKeyguardState.secure = false;
|
mKeyguardState.secure = false;
|
||||||
|
mKeyguardState.deviceHasKeyguard = false;
|
||||||
|
hideScrim();
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.v(TAG, "*** Keyguard started");
|
if (DEBUG) Log.v(TAG, "*** Keyguard started");
|
||||||
}
|
}
|
||||||
@@ -130,7 +135,9 @@ 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.
|
||||||
mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(null));
|
mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(
|
||||||
|
mShowListenerWhenConnect));
|
||||||
|
mShowListenerWhenConnect = null;
|
||||||
}
|
}
|
||||||
if (mKeyguardState.bootCompleted) {
|
if (mKeyguardState.bootCompleted) {
|
||||||
mKeyguardService.onBootCompleted();
|
mKeyguardService.onBootCompleted();
|
||||||
@@ -212,9 +219,10 @@ public class KeyguardServiceDelegate {
|
|||||||
} else {
|
} else {
|
||||||
// try again when we establish a connection
|
// try again when we establish a connection
|
||||||
Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
|
Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
|
||||||
// This shouldn't happen, but if it does, invoke the listener immediately
|
// This shouldn't happen, but if it does, show the scrim immediately and
|
||||||
// to avoid a dark screen...
|
// invoke the listener's callback after the service actually connects.
|
||||||
showListener.onShown(null);
|
mShowListenerWhenConnect = showListener;
|
||||||
|
showScrim();
|
||||||
}
|
}
|
||||||
mKeyguardState.screenIsOn = true;
|
mKeyguardState.screenIsOn = true;
|
||||||
}
|
}
|
||||||
@@ -280,7 +288,6 @@ public class KeyguardServiceDelegate {
|
|||||||
lp.setTitle("KeyguardScrim");
|
lp.setTitle("KeyguardScrim");
|
||||||
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
wm.addView(view, lp);
|
wm.addView(view, lp);
|
||||||
view.setVisibility(View.GONE);
|
|
||||||
// Disable pretty much everything in statusbar until keyguard comes back and we know
|
// Disable pretty much everything in statusbar until keyguard comes back and we know
|
||||||
// the state of the world.
|
// the state of the world.
|
||||||
view.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME
|
view.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME
|
||||||
@@ -292,6 +299,7 @@ public class KeyguardServiceDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showScrim() {
|
public void showScrim() {
|
||||||
|
if (!mKeyguardState.deviceHasKeyguard) return;
|
||||||
mScrim.post(new Runnable() {
|
mScrim.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user