Reduce load on CPU when animating rotation.

This change keeps requestTraversalLocked from being called on virtually
every call to animate while rotating.

Change-Id: I6d2db37db3bb82f4f9ecc84b17dbf121819a6c1b
This commit is contained in:
Craig Mautner
2012-04-10 12:56:27 -07:00
parent 1ade5ae9c8
commit 73850cb699
2 changed files with 16 additions and 10 deletions

View File

@ -471,9 +471,7 @@ public class WindowAnimator {
Surface.closeTransaction();
}
if (mBulkUpdateParams != 0) {
mService.bulkSetParameters(mBulkUpdateParams);
}
mService.bulkSetParameters(mBulkUpdateParams);
}
WindowState mCurrentFocus;

View File

@ -6871,22 +6871,33 @@ public class WindowManagerService extends IWindowManager.Stub
case BULK_UPDATE_PARAMETERS: {
// Used to send multiple changes from the animation side to the layout side.
synchronized (mWindowMap) {
boolean doRequest = false;
// TODO(cmautner): As the number of bits grows, use masks of bit groups to
// eliminate unnecessary tests.
if ((msg.arg1 & LayoutFields.SET_UPDATE_ROTATION) != 0) {
mInnerFields.mUpdateRotation = true;
doRequest = true;
}
if ((msg.arg1 & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) {
mInnerFields.mWallpaperMayChange = true;
doRequest = true;
}
if ((msg.arg1 & LayoutFields.SET_FORCE_HIDING_CHANGED) != 0) {
mInnerFields.mWallpaperForceHidingChanged = true;
doRequest = true;
}
if ((msg.arg1 & LayoutFields.CLEAR_ORIENTATION_CHANGE_COMPLETE) != 0) {
mInnerFields.mOrientationChangeComplete = false;
} else {
mInnerFields.mOrientationChangeComplete = true;
if (mWindowsFreezingScreen) {
doRequest = true;
}
}
requestTraversalLocked();
if (doRequest) {
requestTraversalLocked();
}
}
break;
}
@ -8461,11 +8472,13 @@ public class WindowManagerService extends IWindowManager.Stub
!mInnerFields.mUpdateRotation) {
checkDrawnWindowsLocked();
}
mInnerFields.mOrientationChangeComplete = true;
// Check to see if we are now in a state where the screen should
// be enabled, because the window obscured flags have changed.
enableScreenIfNeededLocked();
// Slog.e(TAG, "performLayoutAndPlaceSurfacesLockedInner exit: mPendingLayoutChanges="
// + Integer.toHexString(mPendingLayoutChanges) + " mLayoutNeeded=" + mLayoutNeeded
// + " animating=" + mAnimator.mAnimating);
}
void checkDrawnWindowsLocked() {
@ -9501,11 +9514,6 @@ public class WindowManagerService extends IWindowManager.Stub
public void onHardKeyboardStatusChange(boolean available, boolean enabled);
}
void notifyAnimationChangedLayout(final int pendingLayoutChanges) {
mPendingLayoutChanges |= pendingLayoutChanges;
requestTraversalLocked();
}
void debugLayoutRepeats(final String msg, int pendingLayoutChanges) {
if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) {
Slog.v(TAG, "Layouts looping: " + msg + ", mPendingLayoutChanges = 0x" +