Merge "Avoid Rect instantiation in NavigationBarController.Impl" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-07 04:49:39 +00:00
committed by Android (Google) Code Review

View File

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