Loading core/java/android/view/InsetsSource.java +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class InsetsSource implements Parcelable { return mVisibleFrame == null || !mVisibleFrame.isEmpty(); } public boolean getInsetsRoundedCornerFrame() { public boolean insetsRoundedCornerFrame() { return mInsetsRoundedCornerFrame; } Loading core/java/android/view/InsetsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading core/java/android/view/TaskTransitionSpec.java +1 −29 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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 Loading @@ -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> Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +8 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)) { Loading @@ -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()); Loading libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java +29 −17 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; /** Loading Loading @@ -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(); } Loading Loading @@ -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; } Loading Loading
core/java/android/view/InsetsSource.java +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class InsetsSource implements Parcelable { return mVisibleFrame == null || !mVisibleFrame.isEmpty(); } public boolean getInsetsRoundedCornerFrame() { public boolean insetsRoundedCornerFrame() { return mInsetsRoundedCornerFrame; } Loading
core/java/android/view/InsetsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading
core/java/android/view/TaskTransitionSpec.java +1 −29 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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 Loading @@ -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> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +8 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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)) { Loading @@ -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()); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/kidsmode/KidsModeTaskOrganizer.java +29 −17 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; /** Loading Loading @@ -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(); } Loading Loading @@ -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; } Loading