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

Commit c76e11c3 authored by Ady Abraham's avatar Ady Abraham Committed by Android (Google) Code Review
Browse files

Merge "Notify WindowSession about insets animation" into main

parents 6adb25a1 de70c9ef
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -372,4 +372,14 @@ interface IWindowSession {
     */
    oneway void notifyImeWindowVisibilityChangedFromClient(IWindow window, boolean visible,
            in ImeTracker.Token statsToken);

    /**
     * Notifies WindowState whether inset animations are currently running within the Window.
     * This value is used by the server to vote for refresh rate.
     * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning).
     *
     * @param window The window that is insets animaiton is running.
     * @param running Indicates the insets animation state.
     */
    oneway void notifyInsetsAnimationRunningStateChanged(IWindow window, boolean running);
}
+5 −1
Original line number Diff line number Diff line
@@ -2514,12 +2514,16 @@ public final class ViewRootImpl implements ViewParent,
    @VisibleForTesting
    public void notifyInsetsAnimationRunningStateChanged(boolean running) {
        if (sToolkitSetFrameRateReadOnlyFlagValue) {
            mInsetsAnimationRunning = running;
            if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
                Trace.instant(Trace.TRACE_TAG_VIEW,
                        TextUtils.formatSimple("notifyInsetsAnimationRunningStateChanged(%s)",
                        Boolean.toString(running)));
            }
            mInsetsAnimationRunning = running;
            try {
                mWindowSession.notifyInsetsAnimationRunningStateChanged(mWindow, running);
            } catch (RemoteException e) {
            }
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -679,6 +679,11 @@ public class WindowlessWindowManager implements IWindowSession {
            @NonNull ImeTracker.Token statsToken) {
    }

    @Override
    public void notifyInsetsAnimationRunningStateChanged(IWindow window, boolean running) {
        // NO-OP
    }

    void setParentInterface(@Nullable ISurfaceControlViewHostParent parentInterface) {
        IBinder oldInterface = mParentInterface == null ? null : mParentInterface.asBinder();
        IBinder newInterface = parentInterface == null ? null : parentInterface.asBinder();
+8 −2
Original line number Diff line number Diff line
@@ -234,6 +234,12 @@ class RefreshRatePolicy {
            return w.mFrameRateVote.reset();
        }

        // If insets animation is running, do not convey the preferred app refresh rate to let VRI
        // to control the refresh rate.
        if (w.isInsetsAnimationRunning()) {
            return w.mFrameRateVote.reset();
        }

        // If the app set a preferredDisplayModeId, the preferred refresh rate is the refresh rate
        // of that mode id.
        if (refreshRateSwitchingType != SWITCHING_TYPE_RENDER_FRAME_RATE_ONLY) {
@@ -272,7 +278,7 @@ class RefreshRatePolicy {
    float getPreferredMinRefreshRate(WindowState w) {
        // If app is animating, it's not able to control refresh rate because we want the animation
        // to run in default refresh rate.
        if (w.isAnimationRunningSelfOrParent()) {
        if (w.isAnimationRunningSelfOrParent() || w.isInsetsAnimationRunning()) {
            return 0;
        }

@@ -295,7 +301,7 @@ class RefreshRatePolicy {
    float getPreferredMaxRefreshRate(WindowState w) {
        // If app is animating, it's not able to control refresh rate because we want the animation
        // to run in default refresh rate.
        if (w.isAnimationRunningSelfOrParent()) {
        if (w.isAnimationRunningSelfOrParent() || w.isInsetsAnimationRunning()) {
            return 0;
        }

+11 −0
Original line number Diff line number Diff line
@@ -1012,4 +1012,15 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
            }
        }
    }

    @Override
    public void notifyInsetsAnimationRunningStateChanged(IWindow window, boolean running) {
        synchronized (mService.mGlobalLock) {
            final WindowState win = mService.windowForClientLocked(this, window,
                    false /* throwOnError */);
            if (win != null) {
                win.notifyInsetsAnimationRunningStateChanged(running);
            }
        }
    }
}
Loading