Fix flicker while booting
There was a short period of time where KeyguardScrim already went away but status bar wasn't drawn yet, so we didn't consider it as a wallpaper target so the wallpaper was invisible for a couple of frames. Now only remove the scrim after the status bar has fully drawn. Change-Id: Ibf23b9e1277b6ce06e4ce70c9b7a5db9cbefce00 Fixes: 29643498
This commit is contained in:
@@ -6397,6 +6397,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
|
||||
mWindowManagerDrawComplete = true;
|
||||
if (mKeyguardDelegate != null) {
|
||||
mKeyguardDelegate.onDrawCompleteLw();
|
||||
}
|
||||
}
|
||||
|
||||
finishScreenTurningOn();
|
||||
@@ -6866,7 +6869,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void systemReady() {
|
||||
mKeyguardDelegate = new KeyguardServiceDelegate(mContext);
|
||||
mKeyguardDelegate = new KeyguardServiceDelegate(mContext,
|
||||
mWindowManagerFuncs.getWindowManagerLock());
|
||||
mKeyguardDelegate.onSystemReady();
|
||||
|
||||
readCameraLensCoverState();
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerPolicy.OnKeyguardExitResult;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||
import com.android.internal.policy.IKeyguardExitCallback;
|
||||
import com.android.internal.policy.IKeyguardService;
|
||||
@@ -43,6 +44,7 @@ public class KeyguardServiceDelegate {
|
||||
private static final int INTERACTIVE_STATE_AWAKE = 1;
|
||||
private static final int INTERACTIVE_STATE_GOING_TO_SLEEP = 2;
|
||||
|
||||
private final Object mWindowManagerLock;
|
||||
protected KeyguardServiceWrapper mKeyguardService;
|
||||
private final Context mContext;
|
||||
private final View mScrim; // shown if keyguard crashes
|
||||
@@ -50,6 +52,9 @@ public class KeyguardServiceDelegate {
|
||||
private final KeyguardState mKeyguardState = new KeyguardState();
|
||||
private DrawnListener mDrawnListenerWhenConnect;
|
||||
|
||||
@GuardedBy("mWindowManagerLock")
|
||||
private boolean mHideScrimPending;
|
||||
|
||||
private static final class KeyguardState {
|
||||
KeyguardState() {
|
||||
// Assume keyguard is showing and secure until we know for sure. This is here in
|
||||
@@ -92,10 +97,12 @@ public class KeyguardServiceDelegate {
|
||||
@Override
|
||||
public void onDrawn() throws RemoteException {
|
||||
if (DEBUG) Log.v(TAG, "**** SHOWN CALLED ****");
|
||||
synchronized (mWindowManagerLock) {
|
||||
mHideScrimPending = true;
|
||||
}
|
||||
if (mDrawnListener != null) {
|
||||
mDrawnListener.onDrawn();
|
||||
}
|
||||
hideScrim();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -116,7 +123,8 @@ public class KeyguardServiceDelegate {
|
||||
}
|
||||
};
|
||||
|
||||
public KeyguardServiceDelegate(Context context) {
|
||||
public KeyguardServiceDelegate(Context context, Object windowManagerLock) {
|
||||
mWindowManagerLock = windowManagerLock;
|
||||
mContext = context;
|
||||
mScrimHandler = UiThread.getHandler();
|
||||
mScrim = createScrim(context, mScrimHandler);
|
||||
@@ -355,6 +363,16 @@ public class KeyguardServiceDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when all windows were fully drawn.
|
||||
*/
|
||||
public void onDrawCompleteLw() {
|
||||
if (mHideScrimPending) {
|
||||
hideScrim();
|
||||
mHideScrimPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static View createScrim(Context context, Handler handler) {
|
||||
final View view = new View(context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user