summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-09-20 11:20:31 -0700
committerDave Burke <daveburke@google.com>2011-09-28 19:46:39 -0700
commit1fd6c33620171893b2e92c38b731fd89e5a8dd66 (patch)
treee9a703f8aef10c6162bd2c5fb00468852edcf291 /services
parent6ea4da95d9093dbfabe79321087b81cd7fbf5e84 (diff)
downloadframeworks_base-1fd6c33620171893b2e92c38b731fd89e5a8dd66.zip
frameworks_base-1fd6c33620171893b2e92c38b731fd89e5a8dd66.tar.gz
frameworks_base-1fd6c33620171893b2e92c38b731fd89e5a8dd66.tar.bz2
Fix issue #5312624: Lock screen very flickery
The key thing was to fix isVisibleOrBehindKeyguardLw() so that it wouldn't count a window as not visible if it was just currently in the process of drawing due to an orientation change. Also improve logic in deciding when to turn screen on to better ensure the screen is in a stable state, in particular treating screen off as a frozen screen and not allowing it to turn on until the update of the screen due to any config change is done. Change-Id: If82199f3773270b2d07f9c7de9da2dad8c7b28d7
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wm/AppWindowToken.java2
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java33
-rw-r--r--services/java/com/android/server/wm/WindowState.java21
3 files changed, 34 insertions, 22 deletions
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index bfa2b39..61c96bb 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -194,7 +194,7 @@ class AppWindowToken extends WindowToken {
// This must be called while inside a transaction.
boolean stepAnimationLocked(long currentTime, int dw, int dh) {
- if (!service.mDisplayFrozen && service.mPolicy.isScreenOn()) {
+ if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
// We will run animations as long as the display isn't frozen.
if (animation == WindowManagerService.sDummyAnimation) {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 755a8b8..30029be 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -2199,7 +2199,8 @@ public class WindowManagerService extends IWindowManager.Stub
// to hold off on removing the window until the animation is done.
// If the display is frozen, just remove immediately, since the
// animation wouldn't be seen.
- if (win.mSurface != null && !mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOn()) {
+ if (win.mSurface != null && !mDisplayFrozen && mDisplayEnabled
+ && mPolicy.isScreenOnFully()) {
// If we are not currently running the exit animation, we
// need to see about starting one.
if (wasVisible=win.isWinVisibleLw()) {
@@ -2577,7 +2578,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (displayed) {
if (win.mSurface != null && !win.mDrawPending
&& !win.mCommitDrawPending && !mDisplayFrozen
- && mDisplayEnabled && mPolicy.isScreenOn()) {
+ && mDisplayEnabled && mPolicy.isScreenOnFully()) {
applyEnterAnimationLocked(win);
}
if ((win.mAttrs.flags
@@ -2870,7 +2871,7 @@ public class WindowManagerService extends IWindowManager.Stub
// frozen, there is no reason to animate and it can cause strange
// artifacts when we unfreeze the display if some different animation
// is running.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOn()) {
+ if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
int anim = mPolicy.selectAnimationLw(win, transit);
int attr = -1;
Animation a = null;
@@ -2956,7 +2957,7 @@ public class WindowManagerService extends IWindowManager.Stub
// frozen, there is no reason to animate and it can cause strange
// artifacts when we unfreeze the display if some different animation
// is running.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOn()) {
+ if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
Animation a;
if (mNextAppTransitionPackage != null) {
a = loadAnimation(mNextAppTransitionPackage, enter ?
@@ -3522,7 +3523,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Prepare app transition: transit=" + transit
+ " mNextAppTransition=" + mNextAppTransition);
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOn()) {
+ if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition = transit;
@@ -3606,7 +3607,7 @@ public class WindowManagerService extends IWindowManager.Stub
// If the display is frozen, we won't do anything until the
// actual window is displayed so there is no reason to put in
// the starting window.
- if (mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOn()) {
+ if (mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully()) {
return;
}
@@ -3888,7 +3889,7 @@ public class WindowManagerService extends IWindowManager.Stub
// If we are preparing an app transition, then delay changing
// the visibility of this token until we execute that transition.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOn()
+ if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()
&& mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// Already in requested state, don't do anything more.
if (wtoken.hiddenRequested != visible) {
@@ -4016,7 +4017,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
synchronized(mWindowMap) {
- if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOn()) {
+ if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOnFully()) {
if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping set freeze of " + token);
return;
}
@@ -8137,10 +8138,10 @@ public class WindowManagerService extends IWindowManager.Stub
w.mLastContentInsets.set(w.mContentInsets);
w.mLastVisibleInsets.set(w.mVisibleInsets);
- // If the screen is currently frozen, then keep
- // it frozen until this window draws at its new
+ // If the screen is currently frozen or off, then keep
+ // it frozen/off until this window draws at its new
// orientation.
- if (mDisplayFrozen) {
+ if (mDisplayFrozen || !mPolicy.isScreenOnFully()) {
if (DEBUG_ORIENTATION) Slog.v(TAG,
"Resizing while display frozen: " + w);
w.mOrientationChanging = true;
@@ -8408,7 +8409,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (mDimAnimator != null && mDimAnimator.mDimShown) {
animating |= mDimAnimator.updateSurface(dimming, currentTime,
- mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOn());
+ mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully());
}
if (!blurring && mBlurShown) {
@@ -8604,10 +8605,14 @@ public class WindowManagerService extends IWindowManager.Stub
WindowManagerPolicy.USE_LAST_ROTATION, 0, false);
if (changed) {
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
+ } else {
+ updateRotation = false;
}
}
- checkDrawnWindowsLocked();
+ if (orientationChangeComplete && !needRelayout && !updateRotation) {
+ checkDrawnWindowsLocked();
+ }
// Check to see if we are now in a state where the screen should
// be enabled, because the window obscured flags have changed.
@@ -8925,7 +8930,7 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
- if (mDisplay == null || !mPolicy.isScreenOn()) {
+ if (mDisplay == null || !mPolicy.isScreenOnFully()) {
// No need to freeze the screen before the system is ready or if
// the screen is off.
return;
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 93722e0..a8d1d79 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -870,7 +870,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
// This must be called while inside a transaction. Returns true if
// there is more animation to run.
boolean stepAnimationLocked(long currentTime, int dw, int dh) {
- if (!mService.mDisplayFrozen && mService.mPolicy.isScreenOn()) {
+ if (!mService.mDisplayFrozen && mService.mPolicy.isScreenOnFully()) {
// We will run animations as long as the display isn't frozen.
if (!mDrawPending && !mCommitDrawPending && mAnimation != null) {
@@ -1204,11 +1204,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
* mPolicyVisibility. Ungh.
*/
public boolean isVisibleOrBehindKeyguardLw() {
+ if (mRootToken.waitingToShow &&
+ mService.mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
+ return false;
+ }
final AppWindowToken atoken = mAppToken;
- return mSurface != null && !mAttachedHidden
+ final boolean animating = atoken != null
+ ? (atoken.animation != null) : false;
+ return mSurface != null && !mDestroying && !mExiting
&& (atoken == null ? mPolicyVisibility : !atoken.hiddenRequested)
- && !mDrawPending && !mCommitDrawPending
- && !mExiting && !mDestroying;
+ && ((!mAttachedHidden && mViewVisibility == View.VISIBLE
+ && !mRootToken.hidden)
+ || mAnimation != null || animating);
}
/**
@@ -1351,7 +1358,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
&& (mFrame.top != mLastFrame.top
|| mFrame.left != mLastFrame.left)
&& (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove())
- && mService.mPolicy.isScreenOn();
+ && mService.mPolicy.isScreenOnFully();
}
boolean isFullscreen(int screenWidth, int screenHeight) {
@@ -1436,7 +1443,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
if (doAnimation) {
if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "doAnimation: mPolicyVisibility="
+ mPolicyVisibility + " mAnimation=" + mAnimation);
- if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOn()) {
+ if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOnFully()) {
doAnimation = false;
} else if (mPolicyVisibility && mAnimation == null) {
// Check for the case where we are currently visible and
@@ -1462,7 +1469,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
boolean hideLw(boolean doAnimation, boolean requestAnim) {
if (doAnimation) {
- if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOn()) {
+ if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOnFully()) {
doAnimation = false;
}
}