Skip to content

Commit 3255a28

Browse files
author
Craig Mautner
committed
Clear orientation variable until rotation is done.
In the old code orientationChangeComplete was set to true on each pass through perfomLayout. If any window was rotating the variable was set to false on the way through the performLayout. Since we can now make passes through performLayout before any animation step occurs we were seeing mOrientationChangeComplete true prior to rotation completing. This change sets mOrientationChangeComplete false at the start of a rotation and sets it to true if we ever get through an animation step without encountering any rotating windows. Change-Id: I37690cf20868dfbaac94a81640bc4d9cb9fb8f00
1 parent a0e9d0f commit 3255a28

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class ScreenRotationAnimation {
121121
private boolean mMoreStartEnter;
122122
private boolean mMoreStartExit;
123123
private boolean mMoreStartFrame;
124+
long mHalfwayPoint;
124125

125126
public void printTo(String prefix, PrintWriter pw) {
126127
pw.print(prefix); pw.print("mSurface="); pw.print(mSurface);
@@ -655,6 +656,9 @@ private boolean hasAnimations() {
655656
}
656657

657658
private boolean stepAnimation(long now) {
659+
if (now > mHalfwayPoint) {
660+
mHalfwayPoint = Long.MAX_VALUE;
661+
}
658662
if (mFinishAnimReady && mFinishAnimStartTime < 0) {
659663
if (DEBUG_STATE) Slog.v(TAG, "Step: finish anim now ready");
660664
mFinishAnimStartTime = now;
@@ -915,6 +919,7 @@ public boolean stepAnimationLocked(long now) {
915919
mRotateExitAnimation.setStartTime(now);
916920
}
917921
mAnimRunning = true;
922+
mHalfwayPoint = now + mRotateEnterAnimation.getDuration() / 2;
918923
}
919924

920925
return stepAnimation(now);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4180,6 +4180,7 @@ void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
41804180
if (w.mHasSurface && !w.mOrientationChanging) {
41814181
if (DEBUG_ORIENTATION) Slog.v(TAG, "set mOrientationChanging of " + w);
41824182
w.mOrientationChanging = true;
4183+
mInnerFields.mOrientationChangeComplete = false;
41834184
}
41844185
unfrozeWindows = true;
41854186
}
@@ -5485,6 +5486,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
54855486
if (w.mHasSurface) {
54865487
if (DEBUG_ORIENTATION) Slog.v(TAG, "Set mOrientationChanging of " + w);
54875488
w.mOrientationChanging = true;
5489+
mInnerFields.mOrientationChangeComplete = false;
54885490
}
54895491
}
54905492
for (int i=mRotationWatchers.size()-1; i>=0; i--) {
@@ -7589,6 +7591,7 @@ void makeWindowFreezingScreenIfNeededLocked(WindowState w) {
75897591
if (DEBUG_ORIENTATION) Slog.v(TAG,
75907592
"Changing surface while display frozen: " + w);
75917593
w.mOrientationChanging = true;
7594+
mInnerFields.mOrientationChangeComplete = false;
75927595
if (!mWindowsFreezingScreen) {
75937596
mWindowsFreezingScreen = true;
75947597
// XXX should probably keep timeout from
@@ -8059,7 +8062,8 @@ private void handleNotObscuredLocked(final WindowState w, final long currentTime
80598062
private final void performLayoutAndPlaceSurfacesLockedInner(
80608063
boolean recoveringMemory) {
80618064
if (DEBUG_WINDOW_TRACE) {
8062-
Slog.v(TAG, "performLayoutAndPlaceSurfacesLockedInner: entry");
8065+
Slog.v(TAG, "performLayoutAndPlaceSurfacesLockedInner: entry. Called by "
8066+
+ getCallers(3));
80638067
}
80648068
if (mDisplay == null) {
80658069
Slog.i(TAG, "skipping performLayoutAndPlaceSurfacesLockedInner with no mDisplay");

0 commit comments

Comments
 (0)