Get the navigation bar insets frame from the window
Instead of querying the navigation bar insets source frame from the
InsetsState with the internal insets type, this CL gets the frame from
the navigation bar window directly. So it won't need to search for the
insets source in the InsetsState, and this is a step to remove ITYPEs.
bug: 234093736
Test: Enable magnification in a11y and see if nav bar is excluded.
Change-Id: I1f7b9682a2823084fc093ea95d46c1740d6b775c
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index 65127e4..cd3e258 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -960,7 +960,7 @@
// navigation bar insets into nonMagnifiedBounds. It happens when
// navigation mode is gestural.
if (isUntouchableNavigationBar(windowState, mTempRegion3)) {
- final Rect navBarInsets = getNavBarInsets(mDisplayContent);
+ final Rect navBarInsets = getSystemBarInsetsFrame(windowState);
nonMagnifiedBounds.op(navBarInsets, Region.Op.UNION);
availableBounds.op(navBarInsets, Region.Op.DIFFERENCE);
}
@@ -1425,10 +1425,12 @@
return touchableRegion.isEmpty();
}
- static Rect getNavBarInsets(DisplayContent displayContent) {
- final InsetsSource source = displayContent.getInsetsStateController().getRawInsetsState()
- .peekSource(ITYPE_NAVIGATION_BAR);
- return source != null ? source.getFrame() : EMPTY_RECT;
+ static Rect getSystemBarInsetsFrame(WindowState win) {
+ if (win == null) {
+ return EMPTY_RECT;
+ }
+ final InsetsSourceProvider provider = win.getControllableInsetProvider();
+ return provider != null ? provider.getSource().getFrame() : EMPTY_RECT;
}
/**
@@ -1581,7 +1583,10 @@
// region of navigation bar inset because all touch events from this region
// would be received by launcher, i.e. this region is a un-touchable one
// for the application.
- unaccountedSpace.op(getNavBarInsets(dc), unaccountedSpace,
+ unaccountedSpace.op(
+ getSystemBarInsetsFrame(
+ mService.mWindowMap.get(a11yWindow.getWindowInfo().token)),
+ unaccountedSpace,
Region.Op.REVERSE_DIFFERENCE);
}