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

Commit 6b4d2a3c authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Reduce over notification of topFocusedWindowChange" into main

parents 37a8fa1a c9c35784
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -7084,9 +7084,22 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    class RemoteInsetsControlTarget implements InsetsControlTarget {
        private final IDisplayWindowInsetsController mRemoteInsetsController;
        private @InsetsType int mRequestedVisibleTypes = WindowInsets.Type.defaultVisible();
        private final boolean mCanShowTransient;

        /** The actual requested visible inset types for this display */
        private @InsetsType int mRequestedVisibleTypes = WindowInsets.Type.defaultVisible();

        /** The component name of the top focused window on this display */
        private ComponentName mTopFocusedComponentName = null;

        /**
         * The inset types that the top focused window is currently requesting to be visible.
         * This may be different than the actual visible types above depending on the remote
         * insets controller implementation.
         */
        private @InsetsType int mTopFocusedRequestedVisibleTypes =
                WindowInsets.Type.defaultVisible();

        RemoteInsetsControlTarget(IDisplayWindowInsetsController controller) {
            mRemoteInsetsController = controller;
            mCanShowTransient = mWmService.mContext.getResources().getBoolean(
@@ -7096,11 +7109,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        /**
         * Notifies the remote insets controller that the top focused window has changed.
         *
         * @param component The application component that is open in the top focussed window.
         * @param component The application component that is open in the top focused window.
         * @param requestedVisibleTypes The insets types requested visible by the focused window.
         */
        void topFocusedWindowChanged(ComponentName component,
                @InsetsType int requestedVisibleTypes) {
            if (mTopFocusedComponentName != null && mTopFocusedComponentName.equals(component)
                    && mTopFocusedRequestedVisibleTypes == requestedVisibleTypes) {
                return;
            }
            mTopFocusedComponentName = component;
            mTopFocusedRequestedVisibleTypes = requestedVisibleTypes;
            try {
                mRemoteInsetsController.topFocusedWindowChanged(component, requestedVisibleTypes);
            } catch (RemoteException e) {