diff options
author | 2024-12-30 10:43:00 -0800 | |
---|---|---|
committer | 2024-12-30 10:43:00 -0800 | |
commit | 6b4d2a3c309cb0781f80efb9b5d202f900192d83 (patch) | |
tree | 6e34d99c5f0fe8c33dd7af7f2183274c4d79e9ce | |
parent | 37a8fa1a59686a196e078d9ce559795b33702bae (diff) | |
parent | c9c35784d1907f464f1fb4b082c5a10792ac0560 (diff) |
Merge "Reduce over notification of topFocusedWindowChange" into main
-rw-r--r-- | services/core/java/com/android/server/wm/DisplayContent.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 5fe1cebccd2e..145c7b37fcdc 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -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) { |