Skip to content

Commit 7ad4438

Browse files
author
Dianne Hackborn
committed
Fix issue #7353900: Brief flash of home screen while dream starts on lock screen.
Not very clean, this has a special hack in the window manager to redo layout when a dream window is shown. After MR1 we should clean this up (and the various other special dream hacks). Change-Id: Ic1a5a2b10a0a07b4a5dccdbf0736b614ec06dd4a
1 parent 7e1664d commit 7ad4438

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ public void onInputEvent(InputEvent event) {
413413
boolean mForceStatusBarFromKeyguard;
414414
boolean mHideLockScreen;
415415
boolean mDismissKeyguard;
416-
boolean mNoDreamEnterAnim;
416+
boolean mShowingLockscreen;
417+
boolean mShowingDream;
418+
boolean mDreamingLockscreen;
417419
boolean mHomePressed;
418420
boolean mHomeLongPressed;
419421
Intent mHomeIntent;
@@ -1726,7 +1728,7 @@ public int selectAnimationLw(WindowState win, int transit) {
17261728
if (PRINT_ANIM) Log.i(TAG, "**** STARTING EXIT");
17271729
return com.android.internal.R.anim.app_starting_exit;
17281730
}
1729-
} else if (win.getAttrs().type == TYPE_DREAM && mNoDreamEnterAnim
1731+
} else if (win.getAttrs().type == TYPE_DREAM && mDreamingLockscreen
17301732
&& transit == TRANSIT_ENTER) {
17311733
// Special case: we are animating in a dream, while the keyguard
17321734
// is shown. We don't want an animation on the dream, because
@@ -2927,7 +2929,8 @@ public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight) {
29272929
mHideLockScreen = false;
29282930
mAllowLockscreenWhenOn = false;
29292931
mDismissKeyguard = false;
2930-
mNoDreamEnterAnim = false;
2932+
mShowingLockscreen = false;
2933+
mShowingDream = false;
29312934
}
29322935

29332936
/** {@inheritDoc} */
@@ -2945,18 +2948,24 @@ public void applyPostLayoutPolicyLw(WindowState win,
29452948
}
29462949
}
29472950
if (attrs.type == TYPE_KEYGUARD) {
2948-
mNoDreamEnterAnim = true;
2951+
mShowingLockscreen = true;
29492952
}
2950-
if (((attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW)
2951-
|| (attrs.type == TYPE_DREAM && win.isVisibleLw()))
2953+
boolean applyWindow = attrs.type >= FIRST_APPLICATION_WINDOW
2954+
&& attrs.type <= LAST_APPLICATION_WINDOW;
2955+
if (attrs.type == TYPE_DREAM) {
2956+
mShowingDream = true;
2957+
if (!mDreamingLockscreen) {
2958+
applyWindow = true;
2959+
} else if (win.isVisibleLw() && win.hasDrawnLw()) {
2960+
applyWindow = true;
2961+
}
2962+
}
2963+
if (applyWindow
29522964
&& attrs.x == 0 && attrs.y == 0
29532965
&& attrs.width == WindowManager.LayoutParams.MATCH_PARENT
29542966
&& attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
29552967
if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win);
29562968
mTopFullscreenOpaqueWindowState = win;
2957-
if (attrs.type == TYPE_DREAM) {
2958-
mForceStatusBarFromKeyguard = true;
2959-
}
29602969
if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
29612970
if (DEBUG_LAYOUT) Log.v(TAG, "Setting mHideLockScreen to true by win " + win);
29622971
mHideLockScreen = true;
@@ -2983,6 +2992,12 @@ public int finishPostLayoutPolicyLw() {
29832992
? mTopFullscreenOpaqueWindowState.getAttrs()
29842993
: null;
29852994

2995+
// If we are not currently showing a dream, then update the lockscreen
2996+
// state that will apply if a dream is shown next time.
2997+
if (!mShowingDream) {
2998+
mDreamingLockscreen = mShowingLockscreen;
2999+
}
3000+
29863001
if (mStatusBar != null) {
29873002
if (DEBUG_LAYOUT) Log.i(TAG, "force=" + mForceStatusBar
29883003
+ " forcefkg=" + mForceStatusBarFromKeyguard
@@ -4523,9 +4538,12 @@ public void dump(String prefix, PrintWriter pw, String[] args) {
45234538
pw.print(","); pw.print(mDockBottom); pw.println(")");
45244539
pw.print(prefix); pw.print("mDockLayer="); pw.print(mDockLayer);
45254540
pw.print(" mStatusBarLayer="); pw.println(mStatusBarLayer);
4541+
pw.print(prefix); pw.print("mShowingLockscreen="); pw.print(mShowingLockscreen);
4542+
pw.print(" mShowingDream="); pw.print(mShowingDream);
4543+
pw.print(" mDreamingLockscreen="); pw.println(mDreamingLockscreen);
45264544
pw.print(prefix); pw.print("mTopFullscreenOpaqueWindowState=");
45274545
pw.println(mTopFullscreenOpaqueWindowState);
4528-
pw.print(prefix); pw.print("mTopIsFullscreen="); pw.print(mTopIsFullscreen);
4546+
pw.print(prefix); pw.print("mTopIsFullscreen="); pw.print(mTopIsFullscreen);
45294547
pw.print(" mHideLockScreen="); pw.println(mHideLockScreen);
45304548
pw.print(prefix); pw.print("mForceStatusBar="); pw.print(mForceStatusBar);
45314549
pw.print(" mForceStatusBarFromKeyguard=");

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,14 @@ public int addWindow(Session session, IWindow client, int seq,
22442244
adjustWallpaperWindowsLocked();
22452245
} else if ((attrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
22462246
adjustWallpaperWindowsLocked();
2247+
} else if (mWallpaperTarget != null
2248+
&& mWallpaperTarget.mLayer >= win.mBaseLayer) {
2249+
// If there is currently a wallpaper being shown, and
2250+
// the base layer of the new window is below the current
2251+
// layer of the target window, then adjust the wallpaper.
2252+
// This is to avoid a new window being placed between the
2253+
// wallpaper and its target.
2254+
adjustWallpaperWindowsLocked();
22472255
}
22482256
}
22492257

@@ -8201,11 +8209,13 @@ private final void assignLayersLocked(WindowList windows) {
82018209
}
82028210

82038211
private final void performLayoutAndPlaceSurfacesLocked() {
8212+
int loopCount = 6;
82048213
do {
82058214
mTraversalScheduled = false;
82068215
performLayoutAndPlaceSurfacesLockedLoop();
82078216
mH.removeMessages(H.DO_TRAVERSAL);
8208-
} while (mTraversalScheduled);
8217+
loopCount--;
8218+
} while (mTraversalScheduled && loopCount > 0);
82098219
}
82108220

82118221
private boolean mInLayout = false;
@@ -9165,6 +9175,19 @@ private final void performLayoutAndPlaceSurfacesLockedInner(boolean recoveringMe
91659175
final boolean committed =
91669176
winAnimator.commitFinishDrawingLocked(currentTime);
91679177
if (isDefaultDisplay && committed) {
9178+
if (w.mAttrs.type == TYPE_DREAM) {
9179+
// HACK: When a dream is shown, it may at that
9180+
// point hide the lock screen. So we need to
9181+
// redo the layout to let the phone window manager
9182+
// make this happen.
9183+
displayContent.pendingLayoutChanges |=
9184+
WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
9185+
if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
9186+
debugLayoutRepeats(
9187+
"dream and commitFinishDrawingLocked true",
9188+
displayContent.pendingLayoutChanges);
9189+
}
9190+
}
91689191
if ((w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0) {
91699192
if (DEBUG_WALLPAPER) Slog.v(TAG,
91709193
"First draw done in potential wallpaper target " + w);

0 commit comments

Comments
 (0)