Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 302279ae authored by Craig Mautner's avatar Craig Mautner Committed by The Android Automerger
Browse files

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
parent f6184747
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -471,10 +471,8 @@ public class WindowAnimator {
            Surface.closeTransaction();
        }

        if (mBulkUpdateParams != 0) {
        mService.bulkSetParameters(mBulkUpdateParams);
    }
    }

    WindowState mCurrentFocus;
    void setCurrentFocus(final WindowState currentFocus) {
+15 −7
Original line number Diff line number Diff line
@@ -6882,23 +6882,34 @@ 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;
                            }
                        }

                        if (doRequest) {
                            requestTraversalLocked();
                        }
                    }
                    break;
                }

@@ -8472,11 +8483,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() {
@@ -9512,11 +9525,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" +