Avoid Rect instantiation in NavigationBarController.Impl

This is a preparation to fix Bug 226566506.

There should be no behavior change in this CL.

Bug: 226566506
Test: presubmit
Change-Id: Ib4b8b1ce66bb64c0a710750af4ca95b5b2c9e9e8
This commit is contained in:
Yohei Yukawa
2022-04-06 11:25:47 -07:00
parent f86c86cd8f
commit 7bf91fbc25

View File

@@ -151,6 +151,8 @@ final class NavigationBarController {
private boolean mDrawLegacyNavigationBarBackground;
private final Rect mTempRect = new Rect();
Impl(@NonNull InputMethodService inputMethodService) {
mService = inputMethodService;
}
@@ -281,13 +283,12 @@ final class NavigationBarController {
touchableRegion.set(originalInsets.touchableRegion);
break;
}
final Rect navBarRect = new Rect(decor.getLeft(),
decor.getBottom() - systemInsets.bottom,
mTempRect.set(decor.getLeft(), decor.getBottom() - systemInsets.bottom,
decor.getRight(), decor.getBottom());
if (touchableRegion == null) {
touchableRegion = new Region(navBarRect);
touchableRegion = new Region(mTempRect);
} else {
touchableRegion.union(navBarRect);
touchableRegion.union(mTempRect);
}
dest.touchableRegion.set(touchableRegion);