Merge "Always inset the IME by the extra nav bar frame height" into sc-v2-dev

This commit is contained in:
Winson Chung
2021-09-03 23:46:16 +00:00
committed by Android (Google) Code Review
5 changed files with 34 additions and 11 deletions

View File

@@ -3530,6 +3530,14 @@ public interface WindowManager extends ViewManager {
*/ */
public Insets providedInternalInsets = Insets.NONE; public Insets providedInternalInsets = Insets.NONE;
/**
* If specified, the insets provided by this window for the IME will be our window frame
* minus the insets specified by providedInternalImeInsets.
*
* @hide
*/
public Insets providedInternalImeInsets = Insets.NONE;
/** /**
* {@link LayoutParams} to be applied to the window when layout with a assigned rotation. * {@link LayoutParams} to be applied to the window when layout with a assigned rotation.
* This will make layout during rotation change smoothly. * This will make layout during rotation change smoothly.
@@ -3904,6 +3912,7 @@ public interface WindowManager extends ViewManager {
out.writeInt(0); out.writeInt(0);
} }
providedInternalInsets.writeToParcel(out, 0 /* parcelableFlags */); providedInternalInsets.writeToParcel(out, 0 /* parcelableFlags */);
providedInternalImeInsets.writeToParcel(out, 0 /* parcelableFlags */);
if (paramsForRotation != null) { if (paramsForRotation != null) {
checkNonRecursiveParams(); checkNonRecursiveParams();
out.writeInt(paramsForRotation.length); out.writeInt(paramsForRotation.length);
@@ -3983,6 +3992,7 @@ public interface WindowManager extends ViewManager {
in.readIntArray(providesInsetsTypes); in.readIntArray(providesInsetsTypes);
} }
providedInternalInsets = Insets.CREATOR.createFromParcel(in); providedInternalInsets = Insets.CREATOR.createFromParcel(in);
providedInternalImeInsets = Insets.CREATOR.createFromParcel(in);
int paramsForRotationLength = in.readInt(); int paramsForRotationLength = in.readInt();
if (paramsForRotationLength > 0) { if (paramsForRotationLength > 0) {
paramsForRotation = new LayoutParams[paramsForRotationLength]; paramsForRotation = new LayoutParams[paramsForRotationLength];
@@ -4289,6 +4299,11 @@ public interface WindowManager extends ViewManager {
changes |= LAYOUT_CHANGED; changes |= LAYOUT_CHANGED;
} }
if (!providedInternalImeInsets.equals(o.providedInternalImeInsets)) {
providedInternalImeInsets = o.providedInternalImeInsets;
changes |= LAYOUT_CHANGED;
}
if (!Arrays.equals(paramsForRotation, o.paramsForRotation)) { if (!Arrays.equals(paramsForRotation, o.paramsForRotation)) {
paramsForRotation = o.paramsForRotation; paramsForRotation = o.paramsForRotation;
checkNonRecursiveParams(); checkNonRecursiveParams();
@@ -4494,6 +4509,10 @@ public interface WindowManager extends ViewManager {
sb.append(" providedInternalInsets="); sb.append(" providedInternalInsets=");
sb.append(providedInternalInsets); sb.append(providedInternalInsets);
} }
if (!providedInternalImeInsets.equals(Insets.NONE)) {
sb.append(" providedInternalImeInsets=");
sb.append(providedInternalImeInsets);
}
if (paramsForRotation != null && paramsForRotation.length != 0) { if (paramsForRotation != null && paramsForRotation.length != 0) {
sb.append(System.lineSeparator()); sb.append(System.lineSeparator());
sb.append(prefix).append(" paramsForRotation="); sb.append(prefix).append(" paramsForRotation=");

View File

@@ -55,6 +55,8 @@
<dimen name="navigation_bar_height_landscape">48dp</dimen> <dimen name="navigation_bar_height_landscape">48dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen --> <!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">48dp</dimen> <dimen name="navigation_bar_width">48dp</dimen>
<!-- Height of the bottom taskbar not including decorations like rounded corners. -->
<dimen name="taskbar_frame_height">60dp</dimen>
<!-- How much we expand the touchable region of the status bar below the notch to catch touches <!-- How much we expand the touchable region of the status bar below the notch to catch touches
that just start below the notch. --> that just start below the notch. -->
<dimen name="display_cutout_touchable_region_size">12dp</dimen> <dimen name="display_cutout_touchable_region_size">12dp</dimen>

View File

@@ -1741,6 +1741,7 @@
<java-symbol type="dimen" name="navigation_bar_height_car_mode" /> <java-symbol type="dimen" name="navigation_bar_height_car_mode" />
<java-symbol type="dimen" name="navigation_bar_height_landscape_car_mode" /> <java-symbol type="dimen" name="navigation_bar_height_landscape_car_mode" />
<java-symbol type="dimen" name="navigation_bar_width_car_mode" /> <java-symbol type="dimen" name="navigation_bar_width_car_mode" />
<java-symbol type="dimen" name="taskbar_frame_height" />
<java-symbol type="dimen" name="status_bar_height" /> <java-symbol type="dimen" name="status_bar_height" />
<java-symbol type="dimen" name="display_cutout_touchable_region_size" /> <java-symbol type="dimen" name="display_cutout_touchable_region_size" />
<java-symbol type="dimen" name="quick_qs_offset_height" /> <java-symbol type="dimen" name="quick_qs_offset_height" />

View File

@@ -58,16 +58,8 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
// TODO(b/191269755): use the value defined in InsetsController. // TODO(b/191269755): use the value defined in InsetsController.
private static final int ANIMATION_DURATION_RESIZE = 300; private static final int ANIMATION_DURATION_RESIZE = 300;
/**
* The task bar height defined in launcher. Used to determine whether to insets divider bounds
* or not.
*/
private static final int EXPANDED_TASK_BAR_HEIGHT_IN_DP = 60;
/** The task bar expanded height. Used to determine whether to insets divider bounds or not. */ /** The task bar expanded height. Used to determine whether to insets divider bounds or not. */
private final float mExpandedTaskBarHeight = TypedValue.applyDimension( private float mExpandedTaskBarHeight;
TypedValue.COMPLEX_UNIT_DIP, EXPANDED_TASK_BAR_HEIGHT_IN_DP,
getResources().getDisplayMetrics());
private final int mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); private final int mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
@@ -167,6 +159,8 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
mDividerBar = findViewById(R.id.divider_bar); mDividerBar = findViewById(R.id.divider_bar);
mHandle = findViewById(R.id.docked_divider_handle); mHandle = findViewById(R.id.docked_divider_handle);
mBackground = findViewById(R.id.docked_divider_background); mBackground = findViewById(R.id.docked_divider_background);
mExpandedTaskBarHeight = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.taskbar_frame_height);
mTouchElevation = getResources().getDimensionPixelSize( mTouchElevation = getResources().getDimensionPixelSize(
R.dimen.docked_stack_divider_lift_elevation); R.dimen.docked_stack_divider_lift_elevation);
mDoubleTapDetector = new GestureDetector(getContext(), new DoubleTapListener()); mDoubleTapDetector = new GestureDetector(getContext(), new DoubleTapListener());

View File

@@ -1190,6 +1190,12 @@ public class DisplayPolicy {
default: default:
if (attrs.providesInsetsTypes != null) { if (attrs.providesInsetsTypes != null) {
for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) { for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) {
final TriConsumer<DisplayFrames, WindowState, Rect> imeFrameProvider =
!attrs.providedInternalImeInsets.equals(Insets.NONE)
? (displayFrames, windowState, inOutFrame) ->
inOutFrame.inset(windowState.getLayoutingAttrs(
displayFrames.mRotation).providedInternalImeInsets)
: null;
switch (insetsType) { switch (insetsType) {
case ITYPE_STATUS_BAR: case ITYPE_STATUS_BAR:
mStatusBarAlt = win; mStatusBarAlt = win;
@@ -1209,12 +1215,13 @@ public class DisplayPolicy {
break; break;
} }
if (!INSETS_LAYOUT_GENERALIZATION) { if (!INSETS_LAYOUT_GENERALIZATION) {
mDisplayContent.setInsetProvider(insetsType, win, null); mDisplayContent.setInsetProvider(insetsType, win, null,
imeFrameProvider);
} else { } else {
mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, mDisplayContent.setInsetProvider(insetsType, win, (displayFrames,
windowState, inOutFrame) -> inOutFrame.inset( windowState, inOutFrame) -> inOutFrame.inset(
windowState.getLayoutingAttrs(displayFrames.mRotation) windowState.getLayoutingAttrs(displayFrames.mRotation)
.providedInternalInsets)); .providedInternalInsets), imeFrameProvider);
} }
} }
} }