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

Commit 00295091 authored by Kyrylo Mikos's avatar Kyrylo Mikos Committed by Danny Baumann
Browse files

PhoneWindowManager: Delay setting updates during window animation.

Change-Id: I90ee5d8f83176a38a32b5ff38c4b191f1b78532e
parent c1cef55a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1192,4 +1192,14 @@ public interface WindowManagerPolicy {
     * entering animation resource id is stored in anim[1].
     */
    public void selectDisplayMetricsUpdateAnimationLw(int anim[]);

    /**
     * A window animation has been scheduled
     */
    public void windowAnimationStarted();

    /**
     * Animating windows has finished
     */
    public void windowAnimationFinished();
}
+25 −2
Original line number Diff line number Diff line
@@ -337,6 +337,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    // Behavior of volbtn music controls
    boolean mVolBtnMusicControls;
    boolean mIsLongPress;
    private boolean mAnimatingWindows;
    private boolean mNeedUpdateSettings;

    private static final class PointerLocationInputEventReceiver extends InputEventReceiver {
        private final PointerLocationView mView;
@@ -661,10 +663,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }

        @Override public void onChange(boolean selfChange) {
            // A settings update potentially means triggering a configuration change,
            // which we don't want to do during a window animation
            if (mAnimatingWindows) {
                mNeedUpdateSettings = true;
            } else {
                updateSettings();
                updateRotation(false);
            }
        }
    }
    
    class MyOrientationListener extends WindowOrientationListener {
        MyOrientationListener(Context context, Handler handler) {
@@ -5566,6 +5574,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return true;
    }

    @Override
    public void windowAnimationStarted() {
        mAnimatingWindows = true;
    }

    @Override
    public void windowAnimationFinished() {
        mAnimatingWindows = false;
        if (mNeedUpdateSettings) {
            updateSettings();
            updateRotation(false);
            mNeedUpdateSettings = false;
        }
    }

    @Override
    public void dump(String prefix, PrintWriter pw, String[] args) {
        pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode);
+1 −0
Original line number Diff line number Diff line
@@ -650,6 +650,7 @@ public class WindowAnimator {
        if (mAnimating) {
            mService.scheduleAnimationLocked();
        } else if (wasAnimating) {
            mPolicy.windowAnimationFinished();
            mService.requestTraversalLocked();
        }
        if (WindowManagerService.DEBUG_WINDOW_TRACE) {
+1 −0
Original line number Diff line number Diff line
@@ -9323,6 +9323,7 @@ public class WindowManagerService extends IWindowManager.Stub
    void scheduleAnimationLocked() {
        if (!mAnimationScheduled) {
            mAnimationScheduled = true;
            mPolicy.windowAnimationStarted();
            mChoreographer.postCallback(
                    Choreographer.CALLBACK_ANIMATION, mAnimator.mAnimationRunnable, null);
        }