Merge "Update nav bar insets when in extractView" into udc-dev am: 8a192565d0 am: 585a84622b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23371157 Change-Id: I4153d307842dba45c0f1c15f1d394fb3196807ab Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -246,8 +246,7 @@ final class NavigationBarController {
|
|||||||
@Override
|
@Override
|
||||||
public void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets,
|
public void updateTouchableInsets(@NonNull InputMethodService.Insets originalInsets,
|
||||||
@NonNull ViewTreeObserver.InternalInsetsInfo dest) {
|
@NonNull ViewTreeObserver.InternalInsetsInfo dest) {
|
||||||
if (!mImeDrawsImeNavBar || mNavigationBarFrame == null
|
if (!mImeDrawsImeNavBar || mNavigationBarFrame == null) {
|
||||||
|| mService.isExtractViewShown()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,53 +254,58 @@ final class NavigationBarController {
|
|||||||
if (systemInsets != null) {
|
if (systemInsets != null) {
|
||||||
final Window window = mService.mWindow.getWindow();
|
final Window window = mService.mWindow.getWindow();
|
||||||
final View decor = window.getDecorView();
|
final View decor = window.getDecorView();
|
||||||
Region touchableRegion = null;
|
|
||||||
final View inputFrame = mService.mInputFrame;
|
|
||||||
switch (originalInsets.touchableInsets) {
|
|
||||||
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME:
|
|
||||||
if (inputFrame.getVisibility() == View.VISIBLE) {
|
|
||||||
inputFrame.getLocationInWindow(mTempPos);
|
|
||||||
mTempRect.set(mTempPos[0], mTempPos[1],
|
|
||||||
mTempPos[0] + inputFrame.getWidth(),
|
|
||||||
mTempPos[1] + inputFrame.getHeight());
|
|
||||||
touchableRegion = new Region(mTempRect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT:
|
|
||||||
if (inputFrame.getVisibility() == View.VISIBLE) {
|
|
||||||
inputFrame.getLocationInWindow(mTempPos);
|
|
||||||
mTempRect.set(mTempPos[0], originalInsets.contentTopInsets,
|
|
||||||
mTempPos[0] + inputFrame.getWidth() ,
|
|
||||||
mTempPos[1] + inputFrame.getHeight());
|
|
||||||
touchableRegion = new Region(mTempRect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE:
|
|
||||||
if (inputFrame.getVisibility() == View.VISIBLE) {
|
|
||||||
inputFrame.getLocationInWindow(mTempPos);
|
|
||||||
mTempRect.set(mTempPos[0], originalInsets.visibleTopInsets,
|
|
||||||
mTempPos[0] + inputFrame.getWidth(),
|
|
||||||
mTempPos[1] + inputFrame.getHeight());
|
|
||||||
touchableRegion = new Region(mTempRect);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION:
|
|
||||||
touchableRegion = new Region();
|
|
||||||
touchableRegion.set(originalInsets.touchableRegion);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Hereafter "mTempRect" means a navigation bar rect.
|
|
||||||
mTempRect.set(decor.getLeft(), decor.getBottom() - systemInsets.bottom,
|
|
||||||
decor.getRight(), decor.getBottom());
|
|
||||||
if (touchableRegion == null) {
|
|
||||||
touchableRegion = new Region(mTempRect);
|
|
||||||
} else {
|
|
||||||
touchableRegion.union(mTempRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
dest.touchableRegion.set(touchableRegion);
|
// If the extract view is shown, everything is touchable, so no need to update
|
||||||
dest.setTouchableInsets(
|
// touchable insets, but we still update normal insets below.
|
||||||
ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
if (!mService.isExtractViewShown()) {
|
||||||
|
Region touchableRegion = null;
|
||||||
|
final View inputFrame = mService.mInputFrame;
|
||||||
|
switch (originalInsets.touchableInsets) {
|
||||||
|
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME:
|
||||||
|
if (inputFrame.getVisibility() == View.VISIBLE) {
|
||||||
|
inputFrame.getLocationInWindow(mTempPos);
|
||||||
|
mTempRect.set(mTempPos[0], mTempPos[1],
|
||||||
|
mTempPos[0] + inputFrame.getWidth(),
|
||||||
|
mTempPos[1] + inputFrame.getHeight());
|
||||||
|
touchableRegion = new Region(mTempRect);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT:
|
||||||
|
if (inputFrame.getVisibility() == View.VISIBLE) {
|
||||||
|
inputFrame.getLocationInWindow(mTempPos);
|
||||||
|
mTempRect.set(mTempPos[0], originalInsets.contentTopInsets,
|
||||||
|
mTempPos[0] + inputFrame.getWidth(),
|
||||||
|
mTempPos[1] + inputFrame.getHeight());
|
||||||
|
touchableRegion = new Region(mTempRect);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE:
|
||||||
|
if (inputFrame.getVisibility() == View.VISIBLE) {
|
||||||
|
inputFrame.getLocationInWindow(mTempPos);
|
||||||
|
mTempRect.set(mTempPos[0], originalInsets.visibleTopInsets,
|
||||||
|
mTempPos[0] + inputFrame.getWidth(),
|
||||||
|
mTempPos[1] + inputFrame.getHeight());
|
||||||
|
touchableRegion = new Region(mTempRect);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION:
|
||||||
|
touchableRegion = new Region();
|
||||||
|
touchableRegion.set(originalInsets.touchableRegion);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Hereafter "mTempRect" means a navigation bar rect.
|
||||||
|
mTempRect.set(decor.getLeft(), decor.getBottom() - systemInsets.bottom,
|
||||||
|
decor.getRight(), decor.getBottom());
|
||||||
|
if (touchableRegion == null) {
|
||||||
|
touchableRegion = new Region(mTempRect);
|
||||||
|
} else {
|
||||||
|
touchableRegion.union(mTempRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.touchableRegion.set(touchableRegion);
|
||||||
|
dest.setTouchableInsets(
|
||||||
|
ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/215443343): See if we can use View#OnLayoutChangeListener().
|
// TODO(b/215443343): See if we can use View#OnLayoutChangeListener().
|
||||||
// TODO(b/215443343): See if we can replace DecorView#mNavigationColorViewState.view
|
// TODO(b/215443343): See if we can replace DecorView#mNavigationColorViewState.view
|
||||||
|
|||||||
Reference in New Issue
Block a user