Skip to content

Commit c6592d2

Browse files
Dianne HackbornAndroid Git Automerger
authored andcommitted
am 67a1b7d: Merge "Fix issue #5508024: Rotation jank seen in live wallpapers" into ics-mr0
* commit '67a1b7d6e5857d0ecdd1aa9d50d10189e5776c11': Fix issue #5508024: Rotation jank seen in live wallpapers
2 parents 7acd70f + 67a1b7d commit c6592d2

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

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

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3969,6 +3969,7 @@ void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
39693969
if (w.mAppFreezing) {
39703970
w.mAppFreezing = false;
39713971
if (w.mSurface != null && !w.mOrientationChanging) {
3972+
if (DEBUG_ORIENTATION) Slog.v(TAG, "set mOrientationChanging of " + w);
39723973
w.mOrientationChanging = true;
39733974
}
39743975
unfrozeWindows = true;
@@ -5102,7 +5103,7 @@ public Bitmap screenshotApplications(IBinder appToken, int width, int height) {
51025103
}
51035104

51045105
if (rawss == null) {
5105-
Log.w(TAG, "Failure taking screenshot for (" + dw + "x" + dh
5106+
Slog.w(TAG, "Failure taking screenshot for (" + dw + "x" + dh
51065107
+ ") to layer " + maxLayer);
51075108
return null;
51085109
}
@@ -5308,6 +5309,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
53085309
for (int i=mWindows.size()-1; i>=0; i--) {
53095310
WindowState w = mWindows.get(i);
53105311
if (w.mSurface != null) {
5312+
if (DEBUG_ORIENTATION) Slog.v(TAG, "Set mOrientationChanging of " + w);
53115313
w.mOrientationChanging = true;
53125314
}
53135315
}
@@ -7124,7 +7126,7 @@ private final void assignLayersLocked() {
71247126
if (DEBUG_LAYERS) {
71257127
RuntimeException here = new RuntimeException("here");
71267128
here.fillInStackTrace();
7127-
Log.v(TAG, "Assigning layers", here);
7129+
Slog.v(TAG, "Assigning layers", here);
71287130
}
71297131

71307132
for (i=0; i<N; i++) {
@@ -7363,6 +7365,25 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
73637365
return mPolicy.finishLayoutLw();
73647366
}
73657367

7368+
void makeWindowFreezingScreenIfNeededLocked(WindowState w) {
7369+
// If the screen is currently frozen or off, then keep
7370+
// it frozen/off until this window draws at its new
7371+
// orientation.
7372+
if (mDisplayFrozen || !mPolicy.isScreenOnFully()) {
7373+
if (DEBUG_ORIENTATION) Slog.v(TAG,
7374+
"Changing surface while display frozen: " + w);
7375+
w.mOrientationChanging = true;
7376+
if (!mWindowsFreezingScreen) {
7377+
mWindowsFreezingScreen = true;
7378+
// XXX should probably keep timeout from
7379+
// when we first froze the display.
7380+
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
7381+
mH.sendMessageDelayed(mH.obtainMessage(
7382+
H.WINDOW_FREEZE_TIMEOUT), 2000);
7383+
}
7384+
}
7385+
}
7386+
73667387
// "Something has changed! Let's make it correct now."
73677388
private final void performLayoutAndPlaceSurfacesLockedInner(
73687389
boolean recoveringMemory) {
@@ -7714,6 +7735,10 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
77147735
+ " drawn=" + wtoken.numDrawnWindows);
77157736
wtoken.showAllWindowsLocked();
77167737
unsetAppFreezingScreenLocked(wtoken, false, true);
7738+
if (DEBUG_ORIENTATION) Slog.i(TAG,
7739+
"Setting orientationChangeComplete=true because wtoken "
7740+
+ wtoken + " numInteresting=" + numInteresting
7741+
+ " numDrawn=" + wtoken.numDrawnWindows);
77177742
orientationChangeComplete = true;
77187743
}
77197744
} else if (!wtoken.allDrawn) {
@@ -8221,22 +8246,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
82218246

82228247
w.mLastContentInsets.set(w.mContentInsets);
82238248
w.mLastVisibleInsets.set(w.mVisibleInsets);
8224-
// If the screen is currently frozen or off, then keep
8225-
// it frozen/off until this window draws at its new
8226-
// orientation.
8227-
if (mDisplayFrozen || !mPolicy.isScreenOnFully()) {
8228-
if (DEBUG_ORIENTATION) Slog.v(TAG,
8229-
"Resizing while display frozen: " + w);
8230-
w.mOrientationChanging = true;
8231-
if (!mWindowsFreezingScreen) {
8232-
mWindowsFreezingScreen = true;
8233-
// XXX should probably keep timeout from
8234-
// when we first froze the display.
8235-
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
8236-
mH.sendMessageDelayed(mH.obtainMessage(
8237-
H.WINDOW_FREEZE_TIMEOUT), 2000);
8238-
}
8239-
}
8249+
makeWindowFreezingScreenIfNeededLocked(w);
82408250
// If the orientation is changing, then we need to
82418251
// hold off on unfreezing the display until this
82428252
// window has been redrawn; to do that, we need
@@ -8559,6 +8569,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
85598569
+ Integer.toHexString(diff));
85608570
}
85618571
win.mConfiguration = mCurConfiguration;
8572+
if (DEBUG_ORIENTATION && win.mDrawPending) Slog.i(
8573+
TAG, "Resizing " + win + " WITH DRAW PENDING");
85628574
win.mClient.resized((int)win.mSurfaceW, (int)win.mSurfaceH,
85638575
win.mLastContentInsets, win.mLastVisibleInsets, win.mDrawPending,
85648576
configChanged ? win.mConfiguration : null);
@@ -9083,6 +9095,7 @@ private void stopFreezingDisplayLocked() {
90839095

90849096
if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
90859097
&& mScreenRotationAnimation.hasScreenshot()) {
9098+
if (DEBUG_ORIENTATION) Slog.i(TAG, "**** Dismissing screen rotation animation");
90869099
if (mScreenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
90879100
mTransitionAnimationScale, mCurDisplayWidth, mCurDisplayHeight)) {
90889101
requestAnimationLocked(0);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,16 @@ Surface createSurfaceLocked() {
612612
if (mSurface == null) {
613613
mReportDestroySurface = false;
614614
mSurfacePendingDestroy = false;
615+
Slog.i(WindowManagerService.TAG, "createSurface " + this + ": DRAW NOW PENDING");
615616
mDrawPending = true;
616617
mCommitDrawPending = false;
617618
mReadyToShow = false;
618619
if (mAppToken != null) {
619620
mAppToken.allDrawn = false;
620621
}
621622

623+
mService.makeWindowFreezingScreenIfNeededLocked(this);
624+
622625
int flags = 0;
623626

624627
if ((mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
@@ -783,7 +786,7 @@ void destroySurfaceLocked() {
783786
boolean finishDrawingLocked() {
784787
if (mDrawPending) {
785788
if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION) Slog.v(
786-
WindowManagerService.TAG, "finishDrawingLocked: " + mSurface);
789+
WindowManagerService.TAG, "finishDrawingLocked: " + this + " in " + mSurface);
787790
mCommitDrawPending = true;
788791
mDrawPending = false;
789792
return true;

0 commit comments

Comments
 (0)