From 906dab2eb0f221407c306719717fb890e6936798 Mon Sep 17 00:00:00 2001 From: Roy Chou Date: Wed, 22 Nov 2023 07:35:15 +0000 Subject: fix(magnification): fullscreen magnification offset changes when settings panel shows When AccessibilityController#onWindowTransition is triggered, the original behavior is checking if the transition window bounds is intersected with the magnifiedRegionBounds and call onRectangleOnScreenRequest callback if they're not intersect. When FullScreenMagnificationController#onRectangleOnScreenRequest is triggered, it will move the magnification to ensure the given rectangle would appear on the screen. It's to prevent the window transition result does not showing on the screen. However in this bug, the settings panel is on the non-magnifiable window. So, no matter the magnifiedRegionBounds is, the settings panel will always show on the screen. Therefore, we would like to check that, if the transition window is non-magnifiable, we don't need to check and calling onRectangleOnScreenRequest if not intersected. We also add a flag to run the rollout process, in case that this adjust would cause some side effect. Bug: 312624253 Flag: com.android.window.flags.do_not_check_intersection_when_non_magnifiable_window_transitions Test: manually with adb to flip the flag Change-Id: I3688df9fad996cede3f2290bbe84622c787b2da1 --- core/java/android/window/flags/accessibility.aconfig | 8 ++++++++ .../core/java/com/android/server/wm/AccessibilityController.java | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 core/java/android/window/flags/accessibility.aconfig diff --git a/core/java/android/window/flags/accessibility.aconfig b/core/java/android/window/flags/accessibility.aconfig new file mode 100644 index 000000000000..d467be6e5311 --- /dev/null +++ b/core/java/android/window/flags/accessibility.aconfig @@ -0,0 +1,8 @@ +package: "com.android.window.flags" + +flag { + name: "do_not_check_intersection_when_non_magnifiable_window_transitions" + namespace: "accessibility" + description: "The flag controls whether the intersection check for non-magnifiable windows is needed when onWindowTransition," + bug: "312624253" +} \ No newline at end of file diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index b1abe2a567e8..1577cef9de00 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -107,6 +107,7 @@ import com.android.server.wm.AccessibilityWindowsPopulator.AccessibilityWindow; import com.android.server.wm.WindowManagerInternal.AccessibilityControllerInternal; import com.android.server.wm.WindowManagerInternal.MagnificationCallbacks; import com.android.server.wm.WindowManagerInternal.WindowsForAccessibilityCallback; +import com.android.window.flags.Flags; import java.io.File; import java.io.IOException; @@ -758,6 +759,11 @@ final class AccessibilityController { if (!isMagnifierActivated) { break; } + if (Flags.doNotCheckIntersectionWhenNonMagnifiableWindowTransitions()) { + if (!windowState.shouldMagnify()) { + break; + } + } switch (type) { case WindowManager.LayoutParams.TYPE_APPLICATION: case WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION: -- cgit v1.2.3-59-g8ed1b