Merge "Use insetsRoundedCornerFrame to identify taskbar insets source" into udc-dev

This commit is contained in:
Tiger Huang
2023-02-23 04:36:58 +00:00
committed by Android (Google) Code Review
14 changed files with 113 additions and 120 deletions

View File

@@ -133,7 +133,7 @@ public class InsetsSource implements Parcelable {
return mVisibleFrame == null || !mVisibleFrame.isEmpty();
}
public boolean getInsetsRoundedCornerFrame() {
public boolean insetsRoundedCornerFrame() {
return mInsetsRoundedCornerFrame;
}

View File

@@ -275,7 +275,7 @@ public class InsetsState implements Parcelable {
final Rect roundedCornerFrame = new Rect(mRoundedCornerFrame);
for (int i = mSources.size() - 1; i >= 0; i--) {
final InsetsSource source = mSources.valueAt(i);
if (source.getInsetsRoundedCornerFrame()) {
if (source.insetsRoundedCornerFrame()) {
final Insets insets = source.calculateInsets(roundedCornerFrame, false);
roundedCornerFrame.inset(insets);
}

View File

@@ -18,9 +18,6 @@ package android.view;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.ArraySet;
import java.util.Set;
/**
* Holds information about how to execute task transition animations.
@@ -36,32 +33,12 @@ public class TaskTransitionSpec implements Parcelable {
*/
public final int backgroundColor;
/**
* TEMPORARY FIELD (b/202383002)
* TODO: Remove once we use surfaceflinger rounded corners on tasks rather than taskbar overlays
* or when shell transitions are fully enabled
*
* A set of {@InsetsState.InternalInsetsType}s we want to use as the source to set the bounds
* of the task during the animation. Used to make sure that task animate above the taskbar.
* Will also be used to crop to the frame size of the inset source to the inset size to prevent
* the taskbar rounded corners overlay from being invisible during task transition animation.
*/
public final Set<Integer> animationBoundInsets;
public TaskTransitionSpec(
int backgroundColor, Set<Integer> animationBoundInsets) {
public TaskTransitionSpec(int backgroundColor) {
this.backgroundColor = backgroundColor;
this.animationBoundInsets = animationBoundInsets;
}
public TaskTransitionSpec(Parcel in) {
this.backgroundColor = in.readInt();
int animationBoundInsetsSize = in.readInt();
this.animationBoundInsets = new ArraySet<>(animationBoundInsetsSize);
for (int i = 0; i < animationBoundInsetsSize; i++) {
this.animationBoundInsets.add(in.readInt());
}
}
@Override
@@ -72,11 +49,6 @@ public class TaskTransitionSpec implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(backgroundColor);
dest.writeInt(animationBoundInsets.size());
for (int insetType : animationBoundInsets) {
dest.writeInt(insetType);
}
}
public static final @android.annotation.NonNull Parcelable.Creator<TaskTransitionSpec>

View File

@@ -59,9 +59,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
public static final long TOUCH_ANIMATION_DURATION = 150;
public static final long TOUCH_RELEASE_ANIMATION_DURATION = 200;
/** The task bar expanded height. Used to determine whether to insets divider bounds or not. */
private float mExpandedTaskBarHeight;
private final int mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
private SplitLayout mSplitLayout;
@@ -216,17 +213,19 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
void onInsetsChanged(InsetsState insetsState, boolean animate) {
mSplitLayout.getDividerBounds(mTempRect);
final InsetsSource taskBarInsetsSource =
insetsState.peekSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
// Only insets the divider bar with task bar when it's expanded so that the rounded corners
// will be drawn against task bar.
// But there is no need to do it when IME showing because there are no rounded corners at
// the bottom. This also avoids the problem of task bar height not changing when IME
// floating.
if (!insetsState.isSourceOrDefaultVisible(InsetsSource.ID_IME, WindowInsets.Type.ime())
&& taskBarInsetsSource != null
&& taskBarInsetsSource.getFrame().height() >= mExpandedTaskBarHeight) {
mTempRect.inset(taskBarInsetsSource.calculateVisibleInsets(mTempRect));
if (!insetsState.isSourceOrDefaultVisible(InsetsSource.ID_IME, WindowInsets.Type.ime())) {
for (int i = insetsState.sourceSize() - 1; i >= 0; i--) {
final InsetsSource source = insetsState.sourceAt(i);
if (source.getType() == WindowInsets.Type.navigationBars()
&& source.insetsRoundedCornerFrame()) {
mTempRect.inset(source.calculateVisibleInsets(mTempRect));
}
}
}
if (!mTempRect.equals(mDividerBounds)) {
@@ -251,8 +250,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
mDividerBar = findViewById(R.id.divider_bar);
mHandle = findViewById(R.id.docked_divider_handle);
mBackground = findViewById(R.id.docked_divider_background);
mExpandedTaskBarHeight = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.taskbar_frame_height);
mTouchElevation = getResources().getDimensionPixelSize(
R.dimen.docked_stack_divider_lift_elevation);
mDoubleTapDetector = new GestureDetector(getContext(), new DoubleTapListener());

View File

@@ -36,6 +36,7 @@ import android.os.IBinder;
import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.WindowInsets;
import android.window.ITaskOrganizerController;
import android.window.TaskAppearedInfo;
import android.window.WindowContainerToken;
@@ -57,7 +58,6 @@ import com.android.wm.shell.unfold.UnfoldAnimationController;
import java.io.PrintWriter;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -130,14 +130,34 @@ public class KidsModeTaskOrganizer extends ShellTaskOrganizer {
new DisplayInsetsController.OnInsetsChangedListener() {
@Override
public void insetsChanged(InsetsState insetsState) {
// Update bounds only when the insets of navigation bar or task bar is changed.
if (Objects.equals(insetsState.peekSource(InsetsState.ITYPE_NAVIGATION_BAR),
mInsetsState.peekSource(InsetsState.ITYPE_NAVIGATION_BAR))
&& Objects.equals(insetsState.peekSource(
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR),
mInsetsState.peekSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR))) {
final boolean[] navigationBarChanged = {false};
InsetsState.traverse(insetsState, mInsetsState, new InsetsState.OnTraverseCallbacks() {
@Override
public void onIdMatch(InsetsSource source1, InsetsSource source2) {
if (source1.getType() == WindowInsets.Type.navigationBars()
&& !source1.equals(source2)) {
navigationBarChanged[0] = true;
}
}
@Override
public void onIdNotFoundInState1(int index2, InsetsSource source2) {
if (source2.getType() == WindowInsets.Type.navigationBars()) {
navigationBarChanged[0] = true;
}
}
@Override
public void onIdNotFoundInState2(int index1, InsetsSource source1) {
if (source1.getType() == WindowInsets.Type.navigationBars()) {
navigationBarChanged[0] = true;
}
}
});
if (!navigationBarChanged[0]) {
return;
}
// Update bounds only when the insets of navigation bar or task bar is changed.
mInsetsState.set(insetsState);
updateBounds();
}
@@ -344,16 +364,8 @@ public class KidsModeTaskOrganizer extends ShellTaskOrganizer {
private Rect calculateBounds() {
final Rect bounds = new Rect(0, 0, mDisplayWidth, mDisplayHeight);
final InsetsSource navBarSource = mInsetsState.peekSource(InsetsState.ITYPE_NAVIGATION_BAR);
final InsetsSource taskBarSource = mInsetsState.peekSource(
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
if (navBarSource != null && !navBarSource.getFrame().isEmpty()) {
bounds.inset(navBarSource.calculateInsets(bounds, false /* ignoreVisibility */));
} else if (taskBarSource != null && !taskBarSource.getFrame().isEmpty()) {
bounds.inset(taskBarSource.calculateInsets(bounds, false /* ignoreVisibility */));
} else {
bounds.setEmpty();
}
bounds.inset(mInsetsState.calculateInsets(
bounds, WindowInsets.Type.navigationBars(), false /* ignoreVisibility */));
return bounds;
}

View File

@@ -35,6 +35,7 @@ import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.WindowInsets;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.wm.shell.common.DisplayInsetsController;
@@ -66,13 +67,12 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
private static final float START_SCALE = END_SCALE - VERTICAL_START_MARGIN * 2;
private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>();
private final int mExpandedTaskBarHeight;
private final DisplayInsetsController mDisplayInsetsController;
private final UnfoldBackgroundController mBackgroundController;
private final Context mContext;
private final ShellController mShellController;
private InsetsSource mTaskbarInsetsSource;
private InsetsSource mExpandedTaskbarInsetsSource;
private float mWindowCornerRadiusPx;
public FullscreenUnfoldTaskAnimator(Context context,
@@ -82,8 +82,6 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
mDisplayInsetsController = displayInsetsController;
mBackgroundController = backgroundController;
mShellController = shellController;
mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.taskbar_frame_height);
mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(context);
}
@@ -101,21 +99,32 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
@Override
public void insetsChanged(InsetsState insetsState) {
mTaskbarInsetsSource = insetsState.peekSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
mExpandedTaskbarInsetsSource = getExpandedTaskbarSource(insetsState);
for (int i = mAnimationContextByTaskId.size() - 1; i >= 0; i--) {
AnimationContext context = mAnimationContextByTaskId.valueAt(i);
context.update(mTaskbarInsetsSource, context.mTaskInfo);
context.update(mExpandedTaskbarInsetsSource, context.mTaskInfo);
}
}
private static InsetsSource getExpandedTaskbarSource(InsetsState state) {
for (int i = state.sourceSize() - 1; i >= 0; i--) {
final InsetsSource source = state.sourceAt(i);
if (source.getType() == WindowInsets.Type.navigationBars()
&& source.insetsRoundedCornerFrame()) {
return source;
}
}
return null;
}
public boolean hasActiveTasks() {
return mAnimationContextByTaskId.size() > 0;
}
@Override
public void onTaskAppeared(TaskInfo taskInfo, SurfaceControl leash) {
AnimationContext animationContext = new AnimationContext(leash, mTaskbarInsetsSource,
taskInfo);
AnimationContext animationContext = new AnimationContext(
leash, mExpandedTaskbarInsetsSource, taskInfo);
mAnimationContextByTaskId.put(taskInfo.taskId, animationContext);
}
@@ -123,7 +132,7 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
public void onTaskChanged(TaskInfo taskInfo) {
AnimationContext animationContext = mAnimationContextByTaskId.get(taskInfo.taskId);
if (animationContext != null) {
animationContext.update(mTaskbarInsetsSource, taskInfo);
animationContext.update(mExpandedTaskbarInsetsSource, taskInfo);
}
}
@@ -222,11 +231,7 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
mStartCropRect.set(mTaskInfo.getConfiguration().windowConfiguration.getBounds());
if (taskBarInsetsSource != null) {
// Only insets the cropping window with task bar when it's expanded
if (taskBarInsetsSource.getFrame().height() >= mExpandedTaskBarHeight) {
mStartCropRect.inset(taskBarInsetsSource
.calculateVisibleInsets(mStartCropRect));
}
mStartCropRect.inset(taskBarInsetsSource.calculateVisibleInsets(mStartCropRect));
}
mEndCropRect.set(mStartCropRect);

View File

@@ -37,6 +37,7 @@ import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.WindowInsets;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.wm.shell.common.DisplayInsetsController;
@@ -76,7 +77,6 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
private final Executor mExecutor;
private final DisplayInsetsController mDisplayInsetsController;
private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>();
private final int mExpandedTaskBarHeight;
private final ShellController mShellController;
private final Lazy<Optional<SplitScreenController>> mSplitScreenController;
private final UnfoldBackgroundController mUnfoldBackgroundController;
@@ -86,7 +86,7 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
private final Rect mRootStageBounds = new Rect();
private float mWindowCornerRadiusPx;
private InsetsSource mTaskbarInsetsSource;
private InsetsSource mExpandedTaskbarInsetsSource;
@SplitPosition
private int mMainStagePosition = SPLIT_POSITION_UNDEFINED;
@@ -103,8 +103,6 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
mShellController = shellController;
mUnfoldBackgroundController = unfoldBackgroundController;
mSplitScreenController = splitScreenController;
mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.taskbar_frame_height);
mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(context);
}
@@ -143,10 +141,21 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
@Override
public void insetsChanged(InsetsState insetsState) {
mTaskbarInsetsSource = insetsState.peekSource(InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
mExpandedTaskbarInsetsSource = getExpandedTaskbarSource(insetsState);
updateContexts();
}
private static InsetsSource getExpandedTaskbarSource(InsetsState state) {
for (int i = state.sourceSize() - 1; i >= 0; i--) {
final InsetsSource source = state.sourceAt(i);
if (source.getType() == WindowInsets.Type.navigationBars()
&& source.insetsRoundedCornerFrame()) {
return source;
}
}
return null;
}
@Override
public void onTaskStageChanged(int taskId, int stage, boolean visible) {
final AnimationContext context = mAnimationContextByTaskId.get(taskId);
@@ -307,7 +316,8 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
boolean taskbarExpanded = isTaskbarExpanded();
if (taskbarExpanded) {
// Only insets the cropping window with taskbar when taskbar is expanded
mStartCropRect.inset(mTaskbarInsetsSource.calculateVisibleInsets(mStartCropRect));
mStartCropRect.inset(mExpandedTaskbarInsetsSource.calculateVisibleInsets(
mStartCropRect));
}
// Offset to surface coordinates as layout bounds are in screen coordinates
@@ -360,8 +370,7 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
}
private boolean isTaskbarExpanded() {
return mTaskbarInsetsSource != null
&& mTaskbarInsetsSource.getFrame().height() >= mExpandedTaskBarHeight;
return mExpandedTaskbarInsetsSource != null;
}
}
}

View File

@@ -19,7 +19,6 @@ package com.android.server.wm;
import static android.accessibilityservice.AccessibilityTrace.FLAGS_MAGNIFICATION_CALLBACK;
import static android.accessibilityservice.AccessibilityTrace.FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK;
import static android.os.Build.IS_USER;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
@@ -85,7 +84,6 @@ import android.util.SparseBooleanArray;
import android.util.TypedValue;
import android.util.proto.ProtoOutputStream;
import android.view.Display;
import android.view.InsetsSource;
import android.view.MagnificationSpec;
import android.view.Surface;
import android.view.Surface.OutOfResourcesException;

View File

@@ -931,7 +931,7 @@ public class DisplayPolicy {
}
final InsetsSourceProvider provider = win.getControllableInsetProvider();
if (provider != null && provider.getSource().getInsetsRoundedCornerFrame()
if (provider != null && provider.getSource().insetsRoundedCornerFrame()
!= attrs.insetsRoundedCornerFrame) {
provider.getSource().setInsetsRoundedCornerFrame(attrs.insetsRoundedCornerFrame);
}

View File

@@ -97,6 +97,7 @@ import android.view.InsetsState;
import android.view.RoundedCorner;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.WindowInsets;
import android.view.WindowManager;
import com.android.internal.R;
@@ -131,12 +132,6 @@ final class LetterboxUiController {
private final ActivityRecord mActivityRecord;
/**
* Taskbar expanded height. Used to determine when to crop an app window to display the
* rounded corners above the expanded taskbar.
*/
private final float mExpandedTaskBarHeight;
// TODO(b/265576778): Cache other overrides as well.
// Corresponds to OVERRIDE_ANY_ORIENTATION
@@ -253,9 +248,6 @@ final class LetterboxUiController {
/* checkDeviceConfig */ true),
PROPERTY_CAMERA_COMPAT_ENABLE_REFRESH_VIA_PAUSE);
mExpandedTaskBarHeight =
getResources().getDimensionPixelSize(R.dimen.taskbar_frame_height);
mBooleanPropertyAllowOrientationOverride =
readComponentProperty(packageManager, mActivityRecord.packageName,
/* gatingCondition */ null,
@@ -1138,11 +1130,13 @@ final class LetterboxUiController {
@VisibleForTesting
@Nullable
InsetsSource getExpandedTaskbarOrNull(final WindowState mainWindow) {
final InsetsSource taskbar = mainWindow.getInsetsState().peekSource(
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
if (taskbar != null && taskbar.isVisible()
&& taskbar.getFrame().height() >= mExpandedTaskBarHeight) {
return taskbar;
final InsetsState state = mainWindow.getInsetsState();
for (int i = state.sourceSize() - 1; i >= 0; i--) {
final InsetsSource source = state.sourceAt(i);
if (source.getType() == WindowInsets.Type.navigationBars()
&& source.insetsRoundedCornerFrame() && source.isVisible()) {
return source;
}
}
return null;
}

View File

@@ -2825,19 +2825,23 @@ class Task extends TaskFragment {
* Account for specified insets to crop the animation bounds by to avoid the animation
* occurring over "out of bounds" regions
*
* For example this is used to make sure the tasks are cropped to be fully above the
* For example this is used to make sure the tasks are cropped to be fully above the expanded
* taskbar when animating.
*
* @param animationBounds The animations bounds to adjust to account for the custom spec insets.
* TEMPORARY FIELD (b/202383002)
* TODO: Remove once we use surfaceflinger rounded corners on tasks rather than taskbar overlays
* or when shell transitions are fully enabled
*
* @param animationBounds The animation bounds to adjust to account for the custom spec insets.
*/
void adjustAnimationBoundsForTransition(Rect animationBounds) {
TaskTransitionSpec spec = mWmService.mTaskTransitionSpec;
if (spec != null) {
final InsetsState state =
getDisplayContent().getInsetsStateController().getRawInsetsState();
for (int id : spec.animationBoundInsets) {
final InsetsSource source = state.peekSource(id);
if (source != null) {
for (int i = state.sourceSize() - 1; i >= 0; i--) {
final InsetsSource source = state.sourceAt(i);
if (source.insetsRoundedCornerFrame()) {
animationBounds.inset(source.calculateVisibleInsets(animationBounds));
}
}

View File

@@ -123,7 +123,6 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;
import java.util.function.Consumer;
@@ -3193,8 +3192,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
animationRunnerBuilder.setTaskBackgroundColor(getTaskAnimationBackgroundColor());
// TODO: Remove when we migrate to shell (b/202383002)
if (mWmService.mTaskTransitionSpec != null) {
animationRunnerBuilder.hideInsetSourceViewOverflows(
mWmService.mTaskTransitionSpec.animationBoundInsets);
animationRunnerBuilder.hideInsetSourceViewOverflows();
}
}
@@ -4115,11 +4113,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
}
private void hideInsetSourceViewOverflows(Set<Integer> sourceIds) {
final InsetsStateController controller = getDisplayContent().getInsetsStateController();
for (int id : sourceIds) {
final InsetsSourceProvider insetProvider = controller.peekSourceProvider(id);
if (insetProvider == null) {
private void hideInsetSourceViewOverflows() {
final SparseArray<WindowContainerInsetsSourceProvider> providers =
getDisplayContent().getInsetsStateController().getSourceProviders();
for (int i = providers.size(); i >= 0; i--) {
final InsetsSourceProvider insetProvider = providers.valueAt(i);
if (!insetProvider.getSource().insetsRoundedCornerFrame()) {
return;
}

View File

@@ -68,6 +68,7 @@ import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.RoundedCorner;
import android.view.RoundedCorners;
import android.view.WindowInsets;
import android.view.WindowManager;
import androidx.test.filters.SmallTest;
@@ -353,7 +354,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
@Test
public void testGetCropBoundsIfNeeded_noCrop() {
final InsetsSource taskbar = new InsetsSource(/*id=*/ 0,
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
WindowInsets.Type.navigationBars());
final WindowState mainWindow = mockForGetCropBoundsAndRoundedCorners(taskbar);
// Do not apply crop if taskbar is collapsed
@@ -374,7 +375,8 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
@Test
public void testGetCropBoundsIfNeeded_appliesCrop() {
final InsetsSource taskbar = new InsetsSource(/*id=*/ 0,
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
WindowInsets.Type.navigationBars());
taskbar.setInsetsRoundedCornerFrame(true);
final WindowState mainWindow = mockForGetCropBoundsAndRoundedCorners(taskbar);
// Apply crop if taskbar is expanded
@@ -396,7 +398,8 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
@Test
public void testGetCropBoundsIfNeeded_appliesCropWithSizeCompatScaling() {
final InsetsSource taskbar = new InsetsSource(/*id=*/ 0,
InsetsState.ITYPE_EXTRA_NAVIGATION_BAR);
WindowInsets.Type.navigationBars());
taskbar.setInsetsRoundedCornerFrame(true);
final WindowState mainWindow = mockForGetCropBoundsAndRoundedCorners(taskbar);
final float scaling = 2.0f;
@@ -440,7 +443,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
configurationRadius * 2 /*2 is to test selection of the min radius*/,
/*centerX=*/ 1, /*centerY=*/ 1)
);
doReturn(roundedCorners).when(insets).getRoundedCorners();
insets.setRoundedCorners(roundedCorners);
mLetterboxConfiguration.setLetterboxActivityCornersRadius(-1);
assertEquals(expectedRadius, mController.getRoundedCornersRadius(mainWindow));
@@ -479,7 +482,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
private WindowState mockForGetCropBoundsAndRoundedCorners(@Nullable InsetsSource taskbar) {
final WindowState mainWindow = mock(WindowState.class);
final InsetsState insets = mock(InsetsState.class);
final InsetsState insets = new InsetsState();
final Resources resources = mWm.mContext.getResources();
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams();
@@ -489,7 +492,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase {
if (taskbar != null) {
taskbar.setVisible(true);
doReturn(taskbar).when(insets).peekSource(taskbar.getType());
insets.addSource(taskbar);
}
doReturn(mLetterboxedPortraitTaskBounds).when(mActivity).getBounds();
doReturn(true).when(mActivity).isVisible();

View File

@@ -28,7 +28,6 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static android.provider.DeviceConfig.NAMESPACE_CONSTRAIN_DISPLAY_APIS;
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_STATUS_BAR;
import static android.view.InsetsState.ITYPE_TOP_MANDATORY_GESTURES;
import static android.view.InsetsState.ITYPE_TOP_TAPPABLE_ELEMENT;
@@ -2993,8 +2992,9 @@ public class SizeCompatTests extends WindowTestsBase {
organizer.mPrimary.setBounds(0, screenHeight / 2, screenWidth, screenHeight);
organizer.putTaskToPrimary(mTask, true);
final InsetsSource navSource =
new InsetsSource(ITYPE_EXTRA_NAVIGATION_BAR, navigationBars());
final InsetsSource navSource = new InsetsSource(
InsetsSource.createId(null, 0, navigationBars()), navigationBars());
navSource.setInsetsRoundedCornerFrame(true);
navSource.setFrame(new Rect(0, screenHeight - taskbarHeight, screenWidth, screenHeight));
mActivity.mWmService.mLetterboxConfiguration.setLetterboxActivityCornersRadius(15);