Merge "Update corner radius in app/split screen unfold animation" into tm-qpr-dev

This commit is contained in:
Nick Chameyev
2023-02-20 14:15:46 +00:00
committed by Android (Google) Code Review
3 changed files with 43 additions and 8 deletions

View File

@@ -558,16 +558,18 @@ public abstract class WMShellModule {
static FullscreenUnfoldTaskAnimator provideFullscreenUnfoldTaskAnimator( static FullscreenUnfoldTaskAnimator provideFullscreenUnfoldTaskAnimator(
Context context, Context context,
UnfoldBackgroundController unfoldBackgroundController, UnfoldBackgroundController unfoldBackgroundController,
ShellController shellController,
DisplayInsetsController displayInsetsController DisplayInsetsController displayInsetsController
) { ) {
return new FullscreenUnfoldTaskAnimator(context, unfoldBackgroundController, return new FullscreenUnfoldTaskAnimator(context, unfoldBackgroundController,
displayInsetsController); shellController, displayInsetsController);
} }
@Provides @Provides
static SplitTaskUnfoldAnimator provideSplitTaskUnfoldAnimatorBase( static SplitTaskUnfoldAnimator provideSplitTaskUnfoldAnimatorBase(
Context context, Context context,
UnfoldBackgroundController backgroundController, UnfoldBackgroundController backgroundController,
ShellController shellController,
@ShellMainThread ShellExecutor executor, @ShellMainThread ShellExecutor executor,
Lazy<Optional<SplitScreenController>> splitScreenOptional, Lazy<Optional<SplitScreenController>> splitScreenOptional,
DisplayInsetsController displayInsetsController DisplayInsetsController displayInsetsController
@@ -577,7 +579,7 @@ public abstract class WMShellModule {
// controller directly once we refactor ShellTaskOrganizer to not depend on the unfold // controller directly once we refactor ShellTaskOrganizer to not depend on the unfold
// animation controller directly. // animation controller directly.
return new SplitTaskUnfoldAnimator(context, executor, splitScreenOptional, return new SplitTaskUnfoldAnimator(context, executor, splitScreenOptional,
backgroundController, displayInsetsController); shellController, backgroundController, displayInsetsController);
} }
@WMSingleton @WMSingleton

View File

@@ -26,8 +26,10 @@ import android.animation.TypeEvaluator;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.app.TaskInfo; import android.app.TaskInfo;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Trace;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.InsetsSource; import android.view.InsetsSource;
import android.view.InsetsState; import android.view.InsetsState;
@@ -36,6 +38,8 @@ import android.view.SurfaceControl.Transaction;
import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.wm.shell.common.DisplayInsetsController; import com.android.wm.shell.common.DisplayInsetsController;
import com.android.wm.shell.sysui.ConfigurationChangeListener;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.unfold.UnfoldAnimationController; import com.android.wm.shell.unfold.UnfoldAnimationController;
import com.android.wm.shell.unfold.UnfoldBackgroundController; import com.android.wm.shell.unfold.UnfoldBackgroundController;
@@ -51,7 +55,7 @@ import com.android.wm.shell.unfold.UnfoldBackgroundController;
* instances of FullscreenUnfoldTaskAnimator. * instances of FullscreenUnfoldTaskAnimator.
*/ */
public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator, public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
DisplayInsetsController.OnInsetsChangedListener { DisplayInsetsController.OnInsetsChangedListener, ConfigurationChangeListener {
private static final float[] FLOAT_9 = new float[9]; private static final float[] FLOAT_9 = new float[9];
private static final TypeEvaluator<Rect> RECT_EVALUATOR = new RectEvaluator(new Rect()); private static final TypeEvaluator<Rect> RECT_EVALUATOR = new RectEvaluator(new Rect());
@@ -63,17 +67,21 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>(); private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>();
private final int mExpandedTaskBarHeight; private final int mExpandedTaskBarHeight;
private final float mWindowCornerRadiusPx;
private final DisplayInsetsController mDisplayInsetsController; private final DisplayInsetsController mDisplayInsetsController;
private final UnfoldBackgroundController mBackgroundController; private final UnfoldBackgroundController mBackgroundController;
private final Context mContext;
private final ShellController mShellController;
private InsetsSource mTaskbarInsetsSource; private InsetsSource mTaskbarInsetsSource;
private float mWindowCornerRadiusPx;
public FullscreenUnfoldTaskAnimator(Context context, public FullscreenUnfoldTaskAnimator(Context context,
@NonNull UnfoldBackgroundController backgroundController, @NonNull UnfoldBackgroundController backgroundController,
DisplayInsetsController displayInsetsController) { ShellController shellController, DisplayInsetsController displayInsetsController) {
mContext = context;
mDisplayInsetsController = displayInsetsController; mDisplayInsetsController = displayInsetsController;
mBackgroundController = backgroundController; mBackgroundController = backgroundController;
mShellController = shellController;
mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize( mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.taskbar_frame_height); com.android.internal.R.dimen.taskbar_frame_height);
mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(context); mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(context);
@@ -81,6 +89,14 @@ public class FullscreenUnfoldTaskAnimator implements UnfoldTaskAnimator,
public void init() { public void init() {
mDisplayInsetsController.addInsetsChangedListener(DEFAULT_DISPLAY, this); mDisplayInsetsController.addInsetsChangedListener(DEFAULT_DISPLAY, this);
mShellController.addConfigurationChangeListener(this);
}
@Override
public void onConfigurationChanged(Configuration newConfiguration) {
Trace.beginSection("FullscreenUnfoldTaskAnimator#onConfigurationChanged");
mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(mContext);
Trace.endSection();
} }
@Override @Override

View File

@@ -28,8 +28,10 @@ import android.animation.RectEvaluator;
import android.animation.TypeEvaluator; import android.animation.TypeEvaluator;
import android.app.TaskInfo; import android.app.TaskInfo;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Insets; import android.graphics.Insets;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Trace;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.InsetsSource; import android.view.InsetsSource;
import android.view.InsetsState; import android.view.InsetsState;
@@ -42,6 +44,8 @@ import com.android.wm.shell.common.split.SplitScreenConstants.SplitPosition;
import com.android.wm.shell.splitscreen.SplitScreen; import com.android.wm.shell.splitscreen.SplitScreen;
import com.android.wm.shell.splitscreen.SplitScreen.SplitScreenListener; import com.android.wm.shell.splitscreen.SplitScreen.SplitScreenListener;
import com.android.wm.shell.splitscreen.SplitScreenController; import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.sysui.ConfigurationChangeListener;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.unfold.UnfoldAnimationController; import com.android.wm.shell.unfold.UnfoldAnimationController;
import com.android.wm.shell.unfold.UnfoldBackgroundController; import com.android.wm.shell.unfold.UnfoldBackgroundController;
@@ -62,16 +66,18 @@ import dagger.Lazy;
* They use independent instances of SplitTaskUnfoldAnimator. * They use independent instances of SplitTaskUnfoldAnimator.
*/ */
public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator, public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
DisplayInsetsController.OnInsetsChangedListener, SplitScreenListener { DisplayInsetsController.OnInsetsChangedListener, SplitScreenListener,
ConfigurationChangeListener {
private static final TypeEvaluator<Rect> RECT_EVALUATOR = new RectEvaluator(new Rect()); private static final TypeEvaluator<Rect> RECT_EVALUATOR = new RectEvaluator(new Rect());
private static final float CROPPING_START_MARGIN_FRACTION = 0.05f; private static final float CROPPING_START_MARGIN_FRACTION = 0.05f;
private final Context mContext;
private final Executor mExecutor; private final Executor mExecutor;
private final DisplayInsetsController mDisplayInsetsController; private final DisplayInsetsController mDisplayInsetsController;
private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>(); private final SparseArray<AnimationContext> mAnimationContextByTaskId = new SparseArray<>();
private final int mExpandedTaskBarHeight; private final int mExpandedTaskBarHeight;
private final float mWindowCornerRadiusPx; private final ShellController mShellController;
private final Lazy<Optional<SplitScreenController>> mSplitScreenController; private final Lazy<Optional<SplitScreenController>> mSplitScreenController;
private final UnfoldBackgroundController mUnfoldBackgroundController; private final UnfoldBackgroundController mUnfoldBackgroundController;
@@ -79,6 +85,7 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
private final Rect mSideStageBounds = new Rect(); private final Rect mSideStageBounds = new Rect();
private final Rect mRootStageBounds = new Rect(); private final Rect mRootStageBounds = new Rect();
private float mWindowCornerRadiusPx;
private InsetsSource mTaskbarInsetsSource; private InsetsSource mTaskbarInsetsSource;
@SplitPosition @SplitPosition
@@ -88,10 +95,12 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
public SplitTaskUnfoldAnimator(Context context, Executor executor, public SplitTaskUnfoldAnimator(Context context, Executor executor,
Lazy<Optional<SplitScreenController>> splitScreenController, Lazy<Optional<SplitScreenController>> splitScreenController,
UnfoldBackgroundController unfoldBackgroundController, ShellController shellController, UnfoldBackgroundController unfoldBackgroundController,
DisplayInsetsController displayInsetsController) { DisplayInsetsController displayInsetsController) {
mDisplayInsetsController = displayInsetsController; mDisplayInsetsController = displayInsetsController;
mExecutor = executor; mExecutor = executor;
mContext = context;
mShellController = shellController;
mUnfoldBackgroundController = unfoldBackgroundController; mUnfoldBackgroundController = unfoldBackgroundController;
mSplitScreenController = splitScreenController; mSplitScreenController = splitScreenController;
mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize( mExpandedTaskBarHeight = context.getResources().getDimensionPixelSize(
@@ -103,6 +112,14 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator,
@Override @Override
public void init() { public void init() {
mDisplayInsetsController.addInsetsChangedListener(DEFAULT_DISPLAY, this); mDisplayInsetsController.addInsetsChangedListener(DEFAULT_DISPLAY, this);
mShellController.addConfigurationChangeListener(this);
}
@Override
public void onConfigurationChanged(Configuration newConfiguration) {
Trace.beginSection("SplitTaskUnfoldAnimator#onConfigurationChanged");
mWindowCornerRadiusPx = ScreenDecorationsUtils.getWindowCornerRadius(mContext);
Trace.endSection();
} }
/** /**