Merge branch 'android15-release' into merge-aosp15
This commit is contained in:
commit
eeb7416bfe
1401 files changed
+86072
-39248
No files matched your search
@@ -22,6 +22,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||
import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_OPENING;
|
||||
import static android.view.Surface.ROTATION_0;
|
||||
import static android.view.Surface.ROTATION_180;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
@@ -41,6 +43,7 @@ import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_PENDING_FLAGS;
|
||||
import static com.android.launcher3.BaseActivity.PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION;
|
||||
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
@@ -53,15 +56,18 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAU
|
||||
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
|
||||
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
|
||||
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE;
|
||||
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR;
|
||||
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
|
||||
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
|
||||
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
|
||||
import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch;
|
||||
import static com.android.systemui.shared.system.InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME;
|
||||
import static com.android.systemui.shared.system.InteractionJankMonitorWrapper.CUJ_APP_CLOSE_TO_HOME_FALLBACK;
|
||||
import static com.android.quickstep.util.AnimUtils.clampToDuration;
|
||||
import static com.android.quickstep.util.AnimUtils.completeRunnableListCallback;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
|
||||
|
||||
@@ -74,8 +80,8 @@ import android.app.ActivityOptions;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
@@ -86,10 +92,12 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Global;
|
||||
import android.util.Pair;
|
||||
import android.util.Size;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
@@ -112,10 +120,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
@@ -140,6 +150,7 @@ import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.RectFSpringAnim.DefaultSpringConfig;
|
||||
import com.android.quickstep.util.RectFSpringAnim.TaskbarHotseatSpringConfig;
|
||||
import com.android.quickstep.util.ScalingWorkspaceRevealAnim;
|
||||
import com.android.quickstep.util.StaggeredWorkspaceAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
@@ -148,17 +159,18 @@ import com.android.quickstep.util.TaskRestartedDuringLaunchListener;
|
||||
import com.android.quickstep.util.WorkspaceRevealAnim;
|
||||
import com.android.quickstep.views.FloatingWidgetView;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.animation.ActivityLaunchAnimator;
|
||||
import com.android.systemui.animation.DelegateLaunchAnimatorController;
|
||||
import com.android.systemui.animation.ActivityTransitionAnimator;
|
||||
import com.android.systemui.animation.DelegateTransitionAnimatorController;
|
||||
import com.android.systemui.animation.LaunchableView;
|
||||
import com.android.systemui.animation.RemoteAnimationDelegate;
|
||||
import com.android.systemui.animation.RemoteAnimationRunnerCompat;
|
||||
import com.android.systemui.shared.system.BlurUtils;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
|
||||
import com.android.wm.shell.startingsurface.IStartingWindowListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -211,7 +223,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// TODO(b/236145847): Tune TASKBAR_TO_HOME_DURATION to 383 after conflict with
|
||||
// unlock animation
|
||||
// is solved.
|
||||
public static final int TASKBAR_TO_HOME_DURATION = 300;
|
||||
private static final int TASKBAR_TO_HOME_DURATION_FAST = 300;
|
||||
private static final int TASKBAR_TO_HOME_DURATION_SLOW = 1000;
|
||||
protected static final int CONTENT_SCALE_DURATION = 350;
|
||||
protected static final int CONTENT_SCRIM_DURATION = 350;
|
||||
|
||||
@@ -228,7 +241,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private final float mClosingWindowTransY;
|
||||
private final float mMaxShadowRadius;
|
||||
|
||||
private final StartingWindowListener mStartingWindowListener = new StartingWindowListener();
|
||||
private final StartingWindowListener mStartingWindowListener = new StartingWindowListener(this);
|
||||
private ContentObserver mAnimationRemovalObserver=new ContentObserver(ORDERED_BG_EXECUTOR.getHandler()){@Override public void onChange(boolean selfChange){mAreAnimationsEnabled=Global.getFloat(mLauncher.getContentResolver(),Global.ANIMATOR_DURATION_SCALE,1f)>0||Global.getFloat(mLauncher.getContentResolver(),Global.TRANSITION_ANIMATION_SCALE,1f)>0;}};
|
||||
|
||||
private DeviceProfile mDeviceProfile;
|
||||
|
||||
@@ -241,23 +255,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private RemoteAnimationFactory mWallpaperOpenTransitionRunner;
|
||||
private RemoteTransition mLauncherOpenTransition;
|
||||
|
||||
private LauncherBackAnimationController mBackAnimationController;
|
||||
private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mLauncher.addForceInvisibleFlag(INVISIBLE_BY_APP_TRANSITIONS);
|
||||
}
|
||||
private final RemoteAnimationCoordinateTransfer mCoordinateTransfer;
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mLauncher.clearForceInvisibleFlag(INVISIBLE_BY_APP_TRANSITIONS);
|
||||
}
|
||||
};
|
||||
private LauncherBackAnimationController mBackAnimationController;
|
||||
private final AnimatorListenerAdapter mForceInvisibleListener=new AnimatorListenerAdapter(){@Override public void onAnimationStart(Animator animation){mLauncher.addForceInvisibleFlag(INVISIBLE_BY_APP_TRANSITIONS);}
|
||||
|
||||
@Override public void onAnimationEnd(Animator animation){mLauncher.clearForceInvisibleFlag(INVISIBLE_BY_APP_TRANSITIONS);}};
|
||||
|
||||
// Pairs of window starting type and starting window background color for
|
||||
// starting tasks
|
||||
// Will never be larger than MAX_NUM_TASKS
|
||||
private LinkedHashMap<Integer, Pair<Integer, Integer>> mTaskStartParams;
|
||||
private boolean mAreAnimationsEnabled = true;
|
||||
|
||||
private final Interpolator mOpeningXInterpolator;
|
||||
private final Interpolator mOpeningInterpolator;
|
||||
@@ -269,14 +278,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mDeviceProfile = mLauncher.getDeviceProfile();
|
||||
mBackAnimationController = LawnchairApp.isAtleastT() ? new LauncherBackAnimationController(mLauncher, this)
|
||||
: null;
|
||||
checkAndMonitorIfAnimationsAreEnabled();
|
||||
|
||||
Resources res = mLauncher.getResources();
|
||||
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
|
||||
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
|
||||
|
||||
mLauncher.addOnDeviceProfileChangeListener(this);
|
||||
|
||||
if (supportsSSplashScreen()) {
|
||||
mTaskStartParams = new LinkedHashMap<Integer, Pair<Integer, Integer>>(MAX_NUM_TASKS) {
|
||||
if (ENABLE_SHELL_STARTING_SURFACE) {
|
||||
mTaskStartParams = new LinkedHashMap<>(MAX_NUM_TASKS) {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Entry<Integer, Pair<Integer, Integer>> entry) {
|
||||
return size() > MAX_NUM_TASKS;
|
||||
@@ -293,6 +304,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mOpeningXInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.app_open_x);
|
||||
mOpeningInterpolator = AnimationUtils.loadInterpolator(context,
|
||||
R.interpolator.emphasized_interpolator);
|
||||
mCoordinateTransfer = new RemoteAnimationCoordinateTransfer(mLauncher);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -309,17 +321,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
boolean fromRecents = isLaunchingFromRecents(v, null /* targets */);
|
||||
RunnableList onEndCallback = new RunnableList();
|
||||
|
||||
// Handle the case where an already visible task is launched which results in no transition
|
||||
TaskRestartedDuringLaunchListener restartedListener =
|
||||
new TaskRestartedDuringLaunchListener();
|
||||
// Handle the case where an already visible task is launched which results in no
|
||||
// transition
|
||||
TaskRestartedDuringLaunchListener restartedListener = new TaskRestartedDuringLaunchListener();
|
||||
restartedListener.register(onEndCallback::executeAllAndDestroy);
|
||||
onEndCallback.add(restartedListener::unregister);
|
||||
|
||||
mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback);
|
||||
ItemInfo tag = (ItemInfo) v.getTag();
|
||||
if (tag != null && tag.shouldUseBackgroundAnimation()) {
|
||||
ContainerAnimationRunner containerAnimationRunner = ContainerAnimationRunner.from(v,
|
||||
mStartingWindowListener, onEndCallback);
|
||||
ContainerAnimationRunner containerAnimationRunner = ContainerAnimationRunner.from(
|
||||
v, mLauncher, mStartingWindowListener, onEndCallback);
|
||||
if (containerAnimationRunner != null) {
|
||||
mAppLaunchRunner = containerAnimationRunner;
|
||||
}
|
||||
@@ -361,7 +373,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
*/
|
||||
protected boolean isLaunchingFromRecents(@NonNull View v,
|
||||
@Nullable RemoteAnimationTarget[] targets) {
|
||||
return mLauncher.getStateManager().getState().overviewUi
|
||||
return mLauncher.getStateManager().getState().isRecentsViewVisible
|
||||
&& findTaskViewToLaunch(mLauncher.getOverviewPanel(), v, targets) != null;
|
||||
}
|
||||
|
||||
@@ -687,7 +699,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mDragLayer.getLocationOnScreen(dragLayerBounds);
|
||||
|
||||
final boolean hasSplashScreen;
|
||||
if (supportsSSplashScreen()) {
|
||||
if (ENABLE_SHELL_STARTING_SURFACE) {
|
||||
int taskId = openingTargets.getFirstAppTargetTaskId();
|
||||
Pair<Integer, Integer> defaultParams = Pair.create(STARTING_WINDOW_TYPE_NONE, 0);
|
||||
Pair<Integer, Integer> taskParams = mTaskStartParams.getOrDefault(taskId, defaultParams);
|
||||
@@ -751,34 +763,35 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final float finalShadowRadius = appTargetsAreTranslucent ? 0 : mMaxShadowRadius;
|
||||
|
||||
MultiValueUpdateListener listener = new MultiValueUpdateListener() {
|
||||
FloatProp mDx = new FloatProp(0, prop.dX, 0, APP_LAUNCH_DURATION,
|
||||
mOpeningXInterpolator);
|
||||
FloatProp mDy = new FloatProp(0, prop.dY, 0, APP_LAUNCH_DURATION,
|
||||
mOpeningInterpolator);
|
||||
FloatProp mDx = new FloatProp(0, prop.dX, mOpeningXInterpolator);
|
||||
FloatProp mDy = new FloatProp(0, prop.dY, mOpeningInterpolator);
|
||||
|
||||
FloatProp mIconScaleToFitScreen = new FloatProp(prop.initialAppIconScale,
|
||||
prop.finalAppIconScale, 0, APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
prop.finalAppIconScale, mOpeningInterpolator);
|
||||
FloatProp mIconAlpha = new FloatProp(prop.iconAlphaStart, 0f,
|
||||
APP_LAUNCH_ALPHA_START_DELAY, APP_LAUNCH_ALPHA_DURATION, LINEAR);
|
||||
clampToDuration(LINEAR, APP_LAUNCH_ALPHA_START_DELAY, APP_LAUNCH_ALPHA_DURATION,
|
||||
APP_LAUNCH_DURATION));
|
||||
|
||||
FloatProp mWindowRadius = new FloatProp(initialWindowRadius, finalWindowRadius, 0,
|
||||
APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
FloatProp mShadowRadius = new FloatProp(0, finalShadowRadius, 0,
|
||||
APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
FloatProp mWindowRadius = new FloatProp(initialWindowRadius, finalWindowRadius,
|
||||
mOpeningInterpolator);
|
||||
FloatProp mShadowRadius = new FloatProp(0, finalShadowRadius,
|
||||
mOpeningInterpolator);
|
||||
|
||||
FloatProp mCropRectCenterX = new FloatProp(prop.cropCenterXStart, prop.cropCenterXEnd,
|
||||
0, APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
mOpeningInterpolator);
|
||||
FloatProp mCropRectCenterY = new FloatProp(prop.cropCenterYStart, prop.cropCenterYEnd,
|
||||
0, APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
FloatProp mCropRectWidth = new FloatProp(prop.cropWidthStart, prop.cropWidthEnd, 0,
|
||||
APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
FloatProp mCropRectHeight = new FloatProp(prop.cropHeightStart, prop.cropHeightEnd, 0,
|
||||
APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
mOpeningInterpolator);
|
||||
FloatProp mCropRectWidth = new FloatProp(prop.cropWidthStart, prop.cropWidthEnd,
|
||||
mOpeningInterpolator);
|
||||
FloatProp mCropRectHeight = new FloatProp(prop.cropHeightStart, prop.cropHeightEnd,
|
||||
mOpeningInterpolator);
|
||||
|
||||
FloatProp mNavFadeOut = new FloatProp(1f, 0f, 0, ANIMATION_NAV_FADE_OUT_DURATION,
|
||||
NAV_FADE_OUT_INTERPOLATOR);
|
||||
FloatProp mNavFadeIn = new FloatProp(0f, 1f, ANIMATION_DELAY_NAV_FADE_IN,
|
||||
ANIMATION_NAV_FADE_IN_DURATION, NAV_FADE_IN_INTERPOLATOR);
|
||||
FloatProp mNavFadeOut = new FloatProp(1f, 0f, clampToDuration(
|
||||
NAV_FADE_OUT_INTERPOLATOR, 0, ANIMATION_NAV_FADE_OUT_DURATION,
|
||||
APP_LAUNCH_DURATION));
|
||||
FloatProp mNavFadeIn = new FloatProp(0f, 1f, clampToDuration(
|
||||
NAV_FADE_IN_INTERPOLATOR, ANIMATION_DELAY_NAV_FADE_IN,
|
||||
ANIMATION_NAV_FADE_IN_DURATION, APP_LAUNCH_DURATION));
|
||||
|
||||
@Override
|
||||
public void onUpdate(float percent, boolean initOnly) {
|
||||
@@ -869,7 +882,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
} else {
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
}
|
||||
final Rect crop = new Rect(Utilities.ATLEAST_R ? target.screenSpaceBounds : target.sourceContainerBounds);
|
||||
final Rect crop = new Rect(
|
||||
Utilities.ATLEAST_R ? target.screenSpaceBounds : target.sourceContainerBounds);
|
||||
crop.offsetTo(0, 0);
|
||||
|
||||
if ((rotationChange % 2) == 1) {
|
||||
@@ -933,7 +947,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
RemoteAnimationTarget openingTarget = openingTargets.getFirstAppTarget();
|
||||
int fallbackBackgroundColor = 0;
|
||||
if (openingTarget != null && supportsSSplashScreen()) {
|
||||
if (openingTarget != null && ENABLE_SHELL_STARTING_SURFACE) {
|
||||
fallbackBackgroundColor = mTaskStartParams.containsKey(openingTarget.taskId)
|
||||
? mTaskStartParams.get(openingTarget.taskId).second
|
||||
: 0;
|
||||
@@ -974,37 +988,36 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
|
||||
float mAppWindowScale = 1;
|
||||
final FloatProp mWidgetForegroundAlpha = new FloatProp(1 /* start */,
|
||||
0 /* end */, 0 /* delay */,
|
||||
WIDGET_CROSSFADE_DURATION_MILLIS / 2 /* duration */, LINEAR);
|
||||
final FloatProp mWidgetFallbackBackgroundAlpha = new FloatProp(0 /* start */,
|
||||
1 /* end */, 0 /* delay */, 75 /* duration */, LINEAR);
|
||||
final FloatProp mPreviewAlpha = new FloatProp(0 /* start */, 1 /* end */,
|
||||
final FloatProp mWidgetForegroundAlpha = new FloatProp(1, 0, clampToDuration(
|
||||
LINEAR, 0, WIDGET_CROSSFADE_DURATION_MILLIS / 2, APP_LAUNCH_DURATION));
|
||||
|
||||
final FloatProp mWidgetFallbackBackgroundAlpha = new FloatProp(0, 1,
|
||||
clampToDuration(LINEAR, 0, 75, APP_LAUNCH_DURATION));
|
||||
final FloatProp mPreviewAlpha = new FloatProp(0, 1, clampToDuration(
|
||||
LINEAR,
|
||||
WIDGET_CROSSFADE_DURATION_MILLIS / 2 /* delay */,
|
||||
WIDGET_CROSSFADE_DURATION_MILLIS / 2 /* duration */, LINEAR);
|
||||
WIDGET_CROSSFADE_DURATION_MILLIS / 2 /* duration */,
|
||||
APP_LAUNCH_DURATION));
|
||||
final FloatProp mWindowRadius = new FloatProp(initialWindowRadius, finalWindowRadius,
|
||||
0 /* start */, APP_LAUNCH_DURATION, mOpeningInterpolator);
|
||||
final FloatProp mCornerRadiusProgress = new FloatProp(0, 1, 0, APP_LAUNCH_DURATION,
|
||||
mOpeningInterpolator);
|
||||
final FloatProp mCornerRadiusProgress = new FloatProp(0, 1, mOpeningInterpolator);
|
||||
|
||||
// Window & widget background positioning bounds
|
||||
final FloatProp mDx = new FloatProp(widgetBackgroundBounds.centerX(),
|
||||
windowTargetBounds.centerX(), 0 /* delay */, APP_LAUNCH_DURATION,
|
||||
mOpeningXInterpolator);
|
||||
windowTargetBounds.centerX(), mOpeningXInterpolator);
|
||||
final FloatProp mDy = new FloatProp(widgetBackgroundBounds.centerY(),
|
||||
windowTargetBounds.centerY(), 0 /* delay */, APP_LAUNCH_DURATION,
|
||||
mOpeningInterpolator);
|
||||
windowTargetBounds.centerY(), mOpeningInterpolator);
|
||||
final FloatProp mWidth = new FloatProp(widgetBackgroundBounds.width(),
|
||||
windowTargetBounds.width(), 0 /* delay */, APP_LAUNCH_DURATION,
|
||||
mOpeningInterpolator);
|
||||
windowTargetBounds.width(), mOpeningInterpolator);
|
||||
final FloatProp mHeight = new FloatProp(widgetBackgroundBounds.height(),
|
||||
windowTargetBounds.height(), 0 /* delay */, APP_LAUNCH_DURATION,
|
||||
mOpeningInterpolator);
|
||||
windowTargetBounds.height(), mOpeningInterpolator);
|
||||
|
||||
final FloatProp mNavFadeOut = new FloatProp(1f, 0f, 0, ANIMATION_NAV_FADE_OUT_DURATION,
|
||||
NAV_FADE_OUT_INTERPOLATOR);
|
||||
final FloatProp mNavFadeIn = new FloatProp(0f, 1f, ANIMATION_DELAY_NAV_FADE_IN,
|
||||
ANIMATION_NAV_FADE_IN_DURATION, NAV_FADE_IN_INTERPOLATOR);
|
||||
final FloatProp mNavFadeOut = new FloatProp(1f, 0f, clampToDuration(
|
||||
NAV_FADE_OUT_INTERPOLATOR, 0, ANIMATION_NAV_FADE_OUT_DURATION,
|
||||
APP_LAUNCH_DURATION));
|
||||
final FloatProp mNavFadeIn = new FloatProp(0f, 1f, clampToDuration(
|
||||
NAV_FADE_IN_INTERPOLATOR, ANIMATION_DELAY_NAV_FADE_IN,
|
||||
ANIMATION_NAV_FADE_IN_DURATION, APP_LAUNCH_DURATION));
|
||||
|
||||
@Override
|
||||
public void onUpdate(float percent, boolean initOnly) {
|
||||
@@ -1077,42 +1090,44 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher))
|
||||
.setDuration(APP_LAUNCH_DURATION);
|
||||
|
||||
if (allowBlurringLauncher) {
|
||||
// Create a temporary effect layer, that lives on top of launcher, so we can
|
||||
// apply
|
||||
// the blur to it. The EffectLayer will be fullscreen, which will help with
|
||||
// caching
|
||||
// optimizations on the SurfaceFlinger side:
|
||||
// - Results would be able to be cached as a texture
|
||||
// - There won't be texture allocation overhead, because EffectLayers don't have
|
||||
// buffers
|
||||
ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
|
||||
SurfaceControl parent = viewRootImpl != null
|
||||
? viewRootImpl.getSurfaceControl()
|
||||
: null;
|
||||
SurfaceControl dimLayer = new SurfaceControl.Builder()
|
||||
.setName("Blur layer")
|
||||
.setParent(parent)
|
||||
.setOpaque(false)
|
||||
.setHidden(false)
|
||||
.setEffectLayer()
|
||||
.build();
|
||||
|
||||
backgroundRadiusAnim.addListener(
|
||||
AnimatorListeners.forEndCallback(() -> new SurfaceControl.Transaction().remove(dimLayer).apply()));
|
||||
}
|
||||
// caching
|
||||
// optimizations on the SurfaceFlinger side:
|
||||
// - There won't be texture allocation overhead, because EffectLayers don't have
|
||||
// buffers
|
||||
ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
|
||||
SurfaceControl parent = viewRootImpl != null
|
||||
? viewRootImpl.getSurfaceControl()
|
||||
: null;
|
||||
SurfaceControl dimLayer = new SurfaceControl.Builder()
|
||||
.setName("Blur layer")
|
||||
.setParent(parent)
|
||||
.setOpaque(false)
|
||||
.setHidden(false)
|
||||
.setEffectLayer()
|
||||
.build();
|
||||
|
||||
backgroundRadiusAnim.addListener(
|
||||
AnimatorListeners.forEndCallback(depthController::dispose));
|
||||
AnimatorListeners.forEndCallback(() -> new SurfaceControl.Transaction().remove(dimLayer).apply()));
|
||||
}
|
||||
|
||||
return backgroundRadiusAnim;
|
||||
backgroundRadiusAnim.addListener(AnimatorListeners.forEndCallback(()->
|
||||
|
||||
{
|
||||
// reset the depth to match the main depth controller's depth
|
||||
depthController.stateDepth
|
||||
.setValue(mLauncher.getDepthController().stateDepth.getValue());
|
||||
depthController.dispose();
|
||||
}));
|
||||
|
||||
return backgroundRadiusAnim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers remote animations used when closing apps to home screen.
|
||||
*/
|
||||
public void registerRemoteAnimations() {
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get() || !Utilities.ATLEAST_S) return;
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get() || !Utilities.ATLEAST_S)
|
||||
return;
|
||||
if (hasControlRemoteAppTransitionPermission()) {
|
||||
RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
|
||||
addRemoteAnimations(definition);
|
||||
@@ -1150,7 +1165,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
* Registers remote animations used when closing apps to home screen.
|
||||
*/
|
||||
public void registerRemoteTransitions() {
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get() || !Utilities.ATLEAST_T) return;
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get() || !Utilities.ATLEAST_T)
|
||||
return;
|
||||
|
||||
if (ENABLE_SHELL_TRANSITIONS && LawnchairQuickstepCompat.ATLEAST_U)
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).shareTransactionQueue();
|
||||
@@ -1176,6 +1192,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
.registerRemoteTransition(mLauncherOpenTransition, homeCheck);
|
||||
}
|
||||
if (mBackAnimationController != null) {
|
||||
mBackAnimationController.registerComponentCallbacks();
|
||||
mBackAnimationController.registerBackCallbacks(mHandler);
|
||||
}
|
||||
}
|
||||
@@ -1184,8 +1201,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
unregisterRemoteAnimations();
|
||||
unregisterRemoteTransitions();
|
||||
if (Utilities.ATLEAST_T) {
|
||||
mStartingWindowListener.setTransitionManager(null);
|
||||
mLauncher.removeOnDeviceProfileChangeListener(this);
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
|
||||
ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver()
|
||||
.unregisterContentObserver(mAnimationRemovalObserver));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1213,19 +1232,30 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
if (SEPARATE_RECENTS_ACTIVITY.get()) {
|
||||
return;
|
||||
}
|
||||
if (hasControlRemoteAppTransitionPermission()) {
|
||||
if (mLauncherOpenTransition == null) return;
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).unregisterRemoteTransition(
|
||||
mLauncherOpenTransition);
|
||||
mLauncherOpenTransition = null;
|
||||
mWallpaperOpenTransitionRunner = null;
|
||||
}
|
||||
if (mLauncherOpenTransition == null)
|
||||
return;
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).unregisterRemoteTransition(
|
||||
mLauncherOpenTransition);
|
||||
mLauncherOpenTransition = null;
|
||||
mWallpaperOpenTransitionRunner = null;
|
||||
if (mBackAnimationController != null) {
|
||||
mBackAnimationController.unregisterBackCallbacks();
|
||||
mBackAnimationController.unregisterComponentCallbacks();
|
||||
mBackAnimationController = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndMonitorIfAnimationsAreEnabled() {
|
||||
ORDERED_BG_EXECUTOR.execute(() -> {
|
||||
mAnimationRemovalObserver.onChange(true);
|
||||
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
|
||||
Global.ANIMATOR_DURATION_SCALE), false, mAnimationRemovalObserver);
|
||||
mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
|
||||
Global.TRANSITION_ANIMATION_SCALE), false, mAnimationRemovalObserver);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private boolean launcherIsATargetWithMode(RemoteAnimationTarget[] targets, int mode) {
|
||||
for (RemoteAnimationTarget target : targets) {
|
||||
if (!Utilities.ATLEAST_S) {
|
||||
@@ -1247,8 +1277,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
for (RemoteAnimationTarget target : targets) {
|
||||
if (target.mode == MODE_CLOSING) {
|
||||
numTargets++;
|
||||
if (numTargets > 1 || target.windowConfiguration.getWindowingMode()
|
||||
== WINDOWING_MODE_MULTI_WINDOW) {
|
||||
if (numTargets > 1 || target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1282,7 +1311,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
RemoteAnimationTarget target = appTargets[i];
|
||||
transaction.forSurface(target.leash)
|
||||
.setAlpha(1f)
|
||||
.setWindowCrop(Utilities.ATLEAST_R ? target.screenSpaceBounds : target.sourceContainerBounds)
|
||||
.setWindowCrop(
|
||||
Utilities.ATLEAST_R ? target.screenSpaceBounds : target.sourceContainerBounds)
|
||||
.setCornerRadius(cornerRadius);
|
||||
}
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
@@ -1309,7 +1339,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
* app targets
|
||||
*/
|
||||
private @Nullable View findLauncherView(RemoteAnimationTarget[] appTargets) {
|
||||
if (!Utilities.ATLEAST_S) return null;
|
||||
if (!Utilities.ATLEAST_S)
|
||||
return null;
|
||||
for (RemoteAnimationTarget appTarget : appTargets) {
|
||||
if (appTarget.mode == MODE_CLOSING) {
|
||||
View launcherView = findLauncherView(appTarget);
|
||||
@@ -1388,7 +1419,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
*/
|
||||
protected RectFSpringAnim getClosingWindowAnimators(AnimatorSet animation,
|
||||
RemoteAnimationTarget[] targets, View launcherView, PointF velocityPxPerS,
|
||||
RectF closingWindowStartRect, float startWindowCornerRadius) {
|
||||
RectF closingWindowStartRectF, float startWindowCornerRadius) {
|
||||
FloatingIconView floatingIconView = null;
|
||||
FloatingWidgetView floatingWidget = null;
|
||||
RectF targetRect = new RectF();
|
||||
@@ -1413,7 +1444,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
(LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
|
||||
mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
|
||||
isTransluscent, fallbackBackgroundColor);
|
||||
} else if (launcherView != null) {
|
||||
} else if (launcherView != null && mAreAnimationsEnabled) {
|
||||
floatingIconView = getFloatingIconView(mLauncher, launcherView, null,
|
||||
mLauncher.getTaskbarUIController() == null
|
||||
? null
|
||||
@@ -1427,13 +1458,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
boolean useTaskbarHotseatParams = mDeviceProfile.isTaskbarPresent && isInHotseat;
|
||||
RectFSpringAnim anim = new RectFSpringAnim(useTaskbarHotseatParams
|
||||
? new TaskbarHotseatSpringConfig(mLauncher, closingWindowStartRect, targetRect)
|
||||
: new DefaultSpringConfig(mLauncher, mDeviceProfile, closingWindowStartRect,
|
||||
? new TaskbarHotseatSpringConfig(mLauncher, closingWindowStartRectF, targetRect)
|
||||
: new DefaultSpringConfig(mLauncher, mDeviceProfile, closingWindowStartRectF,
|
||||
targetRect));
|
||||
|
||||
// Hook up floating views to the closing window animators.
|
||||
final int rotationChange = getRotationChange(targets);
|
||||
Rect windowTargetBounds = getWindowTargetBounds(targets, rotationChange);
|
||||
// note the coordinate of closingWindowStartRect is based on launcher
|
||||
Rect closingWindowStartRect = new Rect();
|
||||
closingWindowStartRectF.round(closingWindowStartRect);
|
||||
Rect closingWindowOriginalRect =
|
||||
new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx);
|
||||
if (floatingIconView != null) {
|
||||
anim.addAnimatorListener(floatingIconView);
|
||||
floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged);
|
||||
@@ -1445,7 +1479,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
|
||||
|
||||
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
|
||||
windowTargetBounds, startWindowCornerRadius) {
|
||||
closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) {
|
||||
@Override
|
||||
public void onUpdate(RectF currentRectF, float progress) {
|
||||
finalFloatingIconView.update(1f, currentRectF, progress, windowAlphaThreshold,
|
||||
@@ -1463,8 +1497,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final float floatingWidgetAlpha = isTransluscent ? 0 : 1;
|
||||
FloatingWidgetView finalFloatingWidget = floatingWidget;
|
||||
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
|
||||
windowTargetBounds, startWindowCornerRadius) {
|
||||
@Override
|
||||
closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) {
|
||||
|
||||
@Override
|
||||
public void onUpdate(RectF currentRectF, float progress) {
|
||||
final float fallbackBackgroundAlpha = 1
|
||||
- mapBoundToRange(progress, 0.8f, 1, 0, 1, EXAGGERATED_EASE);
|
||||
@@ -1480,7 +1515,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// If no floating icon or widget is present, animate the to the default window
|
||||
// target rect.
|
||||
anim.addOnUpdateListener(new SpringAnimRunner(
|
||||
targets, targetRect, windowTargetBounds, startWindowCornerRadius));
|
||||
targets, targetRect, closingWindowStartRect, closingWindowOriginalRect,
|
||||
startWindowCornerRadius));
|
||||
}
|
||||
|
||||
// Use a fixed velocity to start the animation.
|
||||
@@ -1510,11 +1546,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
float startShadowRadius = areAllTargetsTranslucent(appTargets) ? 0 : mMaxShadowRadius;
|
||||
closingAnimator.setDuration(duration);
|
||||
closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
|
||||
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, 0, duration, DECELERATE_1_7);
|
||||
FloatProp mScale = new FloatProp(1f, 1f, 0, duration, DECELERATE_1_7);
|
||||
FloatProp mAlpha = new FloatProp(1f, 0f, 25, 125, LINEAR);
|
||||
FloatProp mShadowRadius = new FloatProp(startShadowRadius, 0, 0, duration,
|
||||
DECELERATE_1_7);
|
||||
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, DECELERATE_1_7);
|
||||
FloatProp mScale = new FloatProp(1f, 1f, DECELERATE_1_7);
|
||||
FloatProp mAlpha = new FloatProp(1f, 0f, clampToDuration(LINEAR, 25, 125, duration));
|
||||
FloatProp mShadowRadius = new FloatProp(startShadowRadius, 0, DECELERATE_1_7);
|
||||
|
||||
@Override
|
||||
public void onUpdate(float percent, boolean initOnly) {
|
||||
@@ -1633,22 +1668,27 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final boolean launcherIsForceInvisibleOrOpening = mLauncher.isForceInvisible()
|
||||
|| launcherIsATargetWithMode(appTargets, MODE_OPENING);
|
||||
|
||||
View launcherView = findLauncherView(appTargets);
|
||||
boolean playFallBackAnimation = (launcherView == null
|
||||
&& launcherIsForceInvisibleOrOpening)
|
||||
|| mLauncher.getWorkspace().isOverlayShown()
|
||||
|| shouldPlayFallbackClosingAnimation(appTargets);
|
||||
View launcherView = findLauncherView(appTargets);
|
||||
boolean playFallBackAnimation = (launcherView == null
|
||||
&& launcherIsForceInvisibleOrOpening)
|
||||
|| mLauncher.getWorkspace().isOverlayShown()
|
||||
|| shouldPlayFallbackClosingAnimation(appTargets);
|
||||
|
||||
boolean playWorkspaceReveal = true;
|
||||
boolean playWorkspaceReveal = !fromPredictiveBack;
|
||||
boolean skipAllAppsScale = false;
|
||||
if (fromUnlock) {
|
||||
anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
|
||||
} else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get()
|
||||
&& !playFallBackAnimation) {
|
||||
// Use a fixed velocity to start the animation.
|
||||
float velocityPxPerS = DynamicResource.provider(mLauncher)
|
||||
.getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
|
||||
PointF velocity = new PointF(0, -velocityPxPerS);
|
||||
PointF velocity;
|
||||
if (enableScalingRevealHomeAnimation()) {
|
||||
velocity = new PointF();
|
||||
} else {
|
||||
// Use a fixed velocity to start the animation.
|
||||
float velocityPxPerS = DynamicResource.provider(mLauncher)
|
||||
.getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
|
||||
velocity = new PointF(0, -velocityPxPerS);
|
||||
}
|
||||
rectFSpringAnim = getClosingWindowAnimators(
|
||||
anim, appTargets, launcherView, velocity, startRect,
|
||||
startWindowCornerRadius);
|
||||
@@ -1657,8 +1697,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// layout bounds.
|
||||
skipAllAppsScale = true;
|
||||
} else if (!fromPredictiveBack) {
|
||||
anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
|
||||
true /* animateOverviewScrim */, launcherView).getAnimators());
|
||||
if (enableScalingRevealHomeAnimation()) {
|
||||
anim.play(
|
||||
new ScalingWorkspaceRevealAnim(
|
||||
mLauncher, rectFSpringAnim,
|
||||
rectFSpringAnim.getTargetRect()).getAnimators());
|
||||
} else {
|
||||
anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
|
||||
true /* animateOverviewScrim */, launcherView).getAnimators());
|
||||
}
|
||||
|
||||
if (!areAllTargetsTranslucent(appTargets)) {
|
||||
anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
|
||||
@@ -1681,14 +1728,30 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// targets list because it is already visible). In that case, we force
|
||||
// invisibility on touch down, and only reset it after the animation to home
|
||||
// is initialized.
|
||||
if (launcherIsForceInvisibleOrOpening) {
|
||||
if (launcherIsForceInvisibleOrOpening || fromPredictiveBack) {
|
||||
addCujInstrumentation(anim, playFallBackAnimation
|
||||
? CUJ_APP_CLOSE_TO_HOME_FALLBACK
|
||||
: CUJ_APP_CLOSE_TO_HOME);
|
||||
? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
|
||||
: Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
|
||||
|
||||
AnimatorListenerAdapter endListener = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
AccessibilityManagerCompat.sendTestProtocolEventToTest(
|
||||
mLauncher, WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE);
|
||||
}
|
||||
};
|
||||
|
||||
if (fromPredictiveBack && rectFSpringAnim != null) {
|
||||
rectFSpringAnim.addAnimatorListener(endListener);
|
||||
} else {
|
||||
anim.addListener(endListener);
|
||||
}
|
||||
|
||||
// Only register the content animation for cancellation when state changes
|
||||
mLauncher.getStateManager().setCurrentAnimation(anim);
|
||||
|
||||
if (mLauncher.isInState(LauncherState.ALL_APPS)) {
|
||||
if (mLauncher.isInState(LauncherState.ALL_APPS) && !fromPredictiveBack) {
|
||||
Pair<AnimatorSet, Runnable> contentAnimator = getLauncherContentAnimator(false,
|
||||
LAUNCHER_RESUME_START_DELAY,
|
||||
skipAllAppsScale);
|
||||
@@ -1699,16 +1762,22 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
contentAnimator.second.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (playWorkspaceReveal) {
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
}
|
||||
} else if (playWorkspaceReveal) {
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
}
|
||||
}
|
||||
|
||||
return new Pair(rectFSpringAnim, anim);
|
||||
}
|
||||
|
||||
public static int getTaskbarToHomeDuration() {
|
||||
if (enableScalingRevealHomeAnimation()) {
|
||||
return TASKBAR_TO_HOME_DURATION_SLOW;
|
||||
} else {
|
||||
return TASKBAR_TO_HOME_DURATION_FAST;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remote animation runner for animation from the app to Launcher, including
|
||||
* recents.
|
||||
@@ -1740,8 +1809,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
RectF windowTargetBounds = new RectF(getWindowTargetBounds(appTargets, getRotationChange(appTargets)));
|
||||
|
||||
final RectF resolveRectF = new RectF(windowTargetBounds);
|
||||
for (RemoteAnimationTarget t : appTargets) {
|
||||
if (t.mode == MODE_CLOSING) {
|
||||
transferRectToTargetCoordinate(
|
||||
t, windowTargetBounds, true, resolveRectF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Pair<RectFSpringAnim, AnimatorSet> pair = createWallpaperOpenAnimations(
|
||||
appTargets, wallpaperTargets, mFromUnlock, windowTargetBounds,
|
||||
appTargets, wallpaperTargets, mFromUnlock, resolveRectF,
|
||||
QuickStepContract.getWindowCornerRadius(mLauncher),
|
||||
false /* fromPredictiveBack */);
|
||||
|
||||
@@ -1779,19 +1858,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
if (launchingFromWidget) {
|
||||
composeWidgetLaunchAnimator(anim, (LauncherAppWidgetHostView) mV, appTargets,
|
||||
wallpaperTargets, nonAppTargets, launcherClosing);
|
||||
addCujInstrumentation(
|
||||
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_WIDGET);
|
||||
addCujInstrumentation(anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_WIDGET);
|
||||
skipFirstFrame = true;
|
||||
} else if (launchingFromRecents) {
|
||||
composeRecentsLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
|
||||
launcherClosing);
|
||||
addCujInstrumentation(
|
||||
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_RECENTS);
|
||||
anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_RECENTS);
|
||||
skipFirstFrame = true;
|
||||
} else {
|
||||
composeIconLaunchAnimator(anim, mV, appTargets, wallpaperTargets, nonAppTargets,
|
||||
launcherClosing);
|
||||
addCujInstrumentation(anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_ICON);
|
||||
addCujInstrumentation(anim, Cuj.CUJ_LAUNCHER_APP_LAUNCH_FROM_ICON);
|
||||
skipFirstFrame = false;
|
||||
}
|
||||
|
||||
@@ -1823,18 +1901,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ContainerAnimationRunner from(
|
||||
View v, StartingWindowListener startingWindowListener, RunnableList onEndCallback) {
|
||||
private static ContainerAnimationRunner from(View v, Launcher launcher,
|
||||
StartingWindowListener startingWindowListener, RunnableList onEndCallback) {
|
||||
View viewToUse = findLaunchableViewWithBackground(v);
|
||||
if (viewToUse == null) {
|
||||
viewToUse = v;
|
||||
return null;
|
||||
}
|
||||
|
||||
// The CUJ is logged by the click handler, so we don't log it inside the
|
||||
// animation
|
||||
// library.
|
||||
ActivityLaunchAnimator.Controller controllerDelegate = ActivityLaunchAnimator.Controller.fromView(viewToUse,
|
||||
null /* cujType */);
|
||||
ActivityTransitionAnimator.Controller controllerDelegate = ActivityTransitionAnimator.Controller
|
||||
.fromView(viewToUse, null /* cujType */);
|
||||
|
||||
if (controllerDelegate == null) {
|
||||
return null;
|
||||
@@ -1843,25 +1921,31 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// This wrapper allows us to override the default value, telling the controller
|
||||
// that the
|
||||
// current window is below the animating window.
|
||||
ActivityLaunchAnimator.Controller controller = new DelegateLaunchAnimatorController(controllerDelegate) {
|
||||
ActivityTransitionAnimator.Controller controller = new DelegateTransitionAnimatorController(
|
||||
controllerDelegate) {
|
||||
@Override
|
||||
public boolean isBelowAnimatingWindow() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
ActivityLaunchAnimator.Callback callback = task -> ColorUtils.setAlphaComponent(
|
||||
startingWindowListener.getBackgroundColor(), 255);
|
||||
ActivityTransitionAnimator.Callback callback = task -> {
|
||||
final int backgroundColor = startingWindowListener.mBackgroundColor == Color.TRANSPARENT
|
||||
? launcher.getScrimView().getBackgroundColor()
|
||||
: startingWindowListener.mBackgroundColor;
|
||||
return ColorUtils.setAlphaComponent(backgroundColor, 255);
|
||||
};
|
||||
|
||||
ActivityLaunchAnimator.Listener listener = new ActivityLaunchAnimator.Listener() {
|
||||
ActivityTransitionAnimator.Listener listener = new ActivityTransitionAnimator.Listener() {
|
||||
@Override
|
||||
public void onLaunchAnimationEnd() {
|
||||
public void onTransitionAnimationEnd() {
|
||||
onEndCallback.executeAllAndDestroy();
|
||||
}
|
||||
};
|
||||
|
||||
return new ContainerAnimationRunner(
|
||||
new ActivityLaunchAnimator.AnimationDelegate(controller, callback, listener));
|
||||
new ActivityTransitionAnimator.AnimationDelegate(
|
||||
MAIN_EXECUTOR, controller, callback, listener));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1968,24 +2052,70 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
}
|
||||
|
||||
private class StartingWindowListener extends IStartingWindowListener.Stub {
|
||||
private QuickstepTransitionManager mTransitionManager;
|
||||
private static class StartingWindowListener extends IStartingWindowListener.Stub {
|
||||
private final WeakReference<QuickstepTransitionManager> mTransitionManagerRef;
|
||||
private int mBackgroundColor;
|
||||
|
||||
public void setTransitionManager(QuickstepTransitionManager transitionManager) {
|
||||
mTransitionManager = transitionManager;
|
||||
private StartingWindowListener(QuickstepTransitionManager transitionManager) {
|
||||
mTransitionManagerRef = new WeakReference<>(transitionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskLaunching(int taskId, int supportedType, int color) {
|
||||
mTransitionManager.mTaskStartParams.put(taskId, Pair.create(supportedType, color));
|
||||
QuickstepTransitionManager transitionManager = mTransitionManagerRef.get();
|
||||
if (transitionManager != null) {
|
||||
transitionManager.mTaskStartParams.put(taskId, Pair.create(supportedType, color));
|
||||
}
|
||||
mBackgroundColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return mBackgroundColor == Color.TRANSPARENT
|
||||
? mLauncher.getScrimView().getBackgroundColor()
|
||||
: mBackgroundColor;
|
||||
/**
|
||||
* Transfer the rectangle to another coordinate if needed.
|
||||
*
|
||||
* @param toLauncher which one is the anchor of this transfer, if true then
|
||||
* transfer from
|
||||
* animation target to launcher, false transfer from launcher
|
||||
* to animation
|
||||
* target.
|
||||
*/
|
||||
public void transferRectToTargetCoordinate(RemoteAnimationTarget target, RectF currentRect,
|
||||
boolean toLauncher, RectF resultRect) {
|
||||
mCoordinateTransfer.transferRectToTargetCoordinate(
|
||||
target, currentRect, toLauncher, resultRect);
|
||||
}
|
||||
|
||||
private static class RemoteAnimationCoordinateTransfer {
|
||||
private final QuickstepLauncher mLauncher;
|
||||
private final Rect mDisplayRect = new Rect();
|
||||
private final Rect mTmpResult = new Rect();
|
||||
|
||||
RemoteAnimationCoordinateTransfer(QuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
}
|
||||
|
||||
void transferRectToTargetCoordinate(RemoteAnimationTarget target, RectF currentRect,
|
||||
boolean toLauncher, RectF resultRect) {
|
||||
final int taskRotation = target.windowConfiguration.getRotation();
|
||||
final DeviceProfile profile = mLauncher.getDeviceProfile();
|
||||
|
||||
final int rotationDelta = toLauncher
|
||||
? android.util.RotationUtils.deltaRotation(taskRotation, profile.rotationHint)
|
||||
: android.util.RotationUtils.deltaRotation(profile.rotationHint, taskRotation);
|
||||
if (rotationDelta != ROTATION_0) {
|
||||
// Get original display size when task is on top but with different rotation
|
||||
if (rotationDelta % 2 != 0 && toLauncher && (profile.rotationHint == ROTATION_0
|
||||
|| profile.rotationHint == ROTATION_180)) {
|
||||
mDisplayRect.set(0, 0, profile.heightPx, profile.widthPx);
|
||||
} else {
|
||||
mDisplayRect.set(0, 0, profile.widthPx, profile.heightPx);
|
||||
}
|
||||
currentRect.round(mTmpResult);
|
||||
android.util.RotationUtils.rotateBounds(mTmpResult, mDisplayRect, rotationDelta);
|
||||
resultRect.set(mTmpResult);
|
||||
} else {
|
||||
resultRect.set(currentRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1996,21 +2126,58 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private final RemoteAnimationTarget[] mAppTargets;
|
||||
private final Matrix mMatrix = new Matrix();
|
||||
private final Point mTmpPos = new Point();
|
||||
private final Rect mCurrentRect = new Rect();
|
||||
private final RectF mCurrentRectF = new RectF();
|
||||
private final float mStartRadius;
|
||||
private final float mEndRadius;
|
||||
private final SurfaceTransactionApplier mSurfaceApplier;
|
||||
private final Rect mWindowTargetBounds = new Rect();
|
||||
private final Rect mWindowStartBounds = new Rect();
|
||||
private final Rect mWindowOriginalBounds = new Rect();
|
||||
|
||||
private final Rect mTmpRect = new Rect();
|
||||
|
||||
/**
|
||||
* Constructor for SpringAnimRunner
|
||||
*
|
||||
* @param appTargets the list of opening/closing apps
|
||||
* @param targetRect target rectangle
|
||||
* @param closingWindowStartRect start position of the window when the spring
|
||||
* animation
|
||||
* is started. In the predictive back to home
|
||||
* case this
|
||||
* will be smaller than
|
||||
* closingWindowOriginalRect because
|
||||
* the window is already scaled by the user
|
||||
* gesture
|
||||
* @param closingWindowOriginalRect Original unscaled window rect
|
||||
* @param startWindowCornerRadius corner radius of window at the start
|
||||
* position
|
||||
*/
|
||||
SpringAnimRunner(RemoteAnimationTarget[] appTargets, RectF targetRect,
|
||||
Rect windowTargetBounds, float startWindowCornerRadius) {
|
||||
Rect closingWindowStartRect, Rect closingWindowOriginalRect,
|
||||
float startWindowCornerRadius) {
|
||||
mAppTargets = appTargets;
|
||||
mStartRadius = startWindowCornerRadius;
|
||||
mEndRadius = Math.max(1, targetRect.width()) / 2f;
|
||||
mSurfaceApplier = new SurfaceTransactionApplier(mDragLayer);
|
||||
mWindowTargetBounds.set(windowTargetBounds);
|
||||
mWindowStartBounds.set(closingWindowStartRect);
|
||||
mWindowOriginalBounds.set(closingWindowOriginalRect);
|
||||
|
||||
// transfer the coordinate based on animation target.
|
||||
if (mAppTargets != null) {
|
||||
for (RemoteAnimationTarget t : mAppTargets) {
|
||||
if (t.mode == MODE_CLOSING) {
|
||||
final RectF transferRect = new RectF(mWindowStartBounds);
|
||||
final RectF result = new RectF();
|
||||
transferRectToTargetCoordinate(t, transferRect, false, result);
|
||||
result.round(mWindowStartBounds);
|
||||
|
||||
transferRect.set(closingWindowOriginalRect);
|
||||
transferRectToTargetCoordinate(t, transferRect, false, result);
|
||||
result.round(mWindowOriginalBounds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getCornerRadius(float progress) {
|
||||
@@ -2031,31 +2198,32 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
if (target.mode == MODE_CLOSING) {
|
||||
currentRectF.round(mCurrentRect);
|
||||
transferRectToTargetCoordinate(target, currentRectF, false, mCurrentRectF);
|
||||
|
||||
// Scale the target window to match the currentRectF.
|
||||
final float scale;
|
||||
|
||||
// We need to infer the crop (we crop the window to match the currentRectF).
|
||||
if (mWindowTargetBounds.height() > mWindowTargetBounds.width()) {
|
||||
scale = Math.min(1f, currentRectF.width() / mWindowTargetBounds.width());
|
||||
if (mWindowStartBounds.height() > mWindowStartBounds.width()) {
|
||||
scale = Math.min(1f, mCurrentRectF.width() / mWindowOriginalBounds.width());
|
||||
|
||||
int unscaledHeight = (int) (mCurrentRect.height() * (1f / scale));
|
||||
int croppedHeight = mWindowTargetBounds.height() - unscaledHeight;
|
||||
mTmpRect.set(0, 0, mWindowTargetBounds.width(),
|
||||
mWindowTargetBounds.height() - croppedHeight);
|
||||
int unscaledHeight = (int) (mCurrentRectF.height() * (1f / scale));
|
||||
int croppedHeight = mWindowStartBounds.height() - unscaledHeight;
|
||||
mTmpRect.set(0, 0, mWindowOriginalBounds.width(),
|
||||
mWindowStartBounds.height() - croppedHeight);
|
||||
} else {
|
||||
scale = Math.min(1f, currentRectF.height() / mWindowTargetBounds.height());
|
||||
scale = Math.min(1f, mCurrentRectF.height()
|
||||
/ mWindowOriginalBounds.height());
|
||||
|
||||
int unscaledWidth = (int) (mCurrentRect.width() * (1f / scale));
|
||||
int croppedWidth = mWindowTargetBounds.width() - unscaledWidth;
|
||||
mTmpRect.set(0, 0, mWindowTargetBounds.width() - croppedWidth,
|
||||
mWindowTargetBounds.height());
|
||||
int unscaledWidth = (int) (mCurrentRectF.width() * (1f / scale));
|
||||
int croppedWidth = mWindowStartBounds.width() - unscaledWidth;
|
||||
mTmpRect.set(0, 0, mWindowStartBounds.width() - croppedWidth,
|
||||
mWindowOriginalBounds.height());
|
||||
}
|
||||
|
||||
// Match size and position of currentRect.
|
||||
mMatrix.setScale(scale, scale);
|
||||
mMatrix.postTranslate(mCurrentRect.left, mCurrentRect.top);
|
||||
mMatrix.postTranslate(mCurrentRectF.left, mCurrentRectF.top);
|
||||
|
||||
builder.setMatrix(mMatrix)
|
||||
.setWindowCrop(mTmpRect)
|
||||
|
||||
Reference in new issue
Block a user