chore: Cleanup, and hidden feature logged
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
5180c3d4c4
commit
11f7abcb66
1818 files changed
+104945
-147848
No files matched your search
@@ -40,7 +40,6 @@ import static com.android.app.animation.Interpolators.DECELERATE_1_5;
|
||||
import static com.android.app.animation.Interpolators.DECELERATE_1_7;
|
||||
import static com.android.app.animation.Interpolators.EXAGGERATED_EASE;
|
||||
import static com.android.app.animation.Interpolators.LINEAR;
|
||||
import static com.android.internal.util.LatencyTracker.ACTION_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE;
|
||||
import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
|
||||
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
|
||||
@@ -80,6 +79,7 @@ import android.app.ActivityOptions;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
@@ -98,6 +98,7 @@ import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Size;
|
||||
import android.view.CrossWindowBlurListeners;
|
||||
import android.view.IRemoteAnimationFinishedCallback;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.RemoteAnimationDefinition;
|
||||
@@ -120,9 +121,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.app.animation.Animations;
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.internal.jank.Cuj;
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
@@ -132,6 +131,7 @@ import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
|
||||
import com.android.launcher3.testing.shared.ResourceUtils;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
@@ -235,7 +235,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private static final int MAX_NUM_TASKS = 5;
|
||||
|
||||
// Cross-fade duration between App Widget and App when launching from widget.
|
||||
// Cross-fade duration between App Widget and App
|
||||
private static final int WIDGET_CROSSFADE_DURATION_MILLIS = 125;
|
||||
|
||||
protected final QuickstepLauncher mLauncher;
|
||||
@@ -266,7 +266,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
private RemoteTransition mLauncherOpenTransition;
|
||||
|
||||
private final RemoteAnimationCoordinateTransfer mCoordinateTransfer;
|
||||
private final LatencyTracker mLatencyTracker;
|
||||
|
||||
private LauncherBackAnimationController mBackAnimationController;
|
||||
private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() {
|
||||
@@ -290,8 +289,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
|
||||
public QuickstepTransitionManager(QuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
public QuickstepTransitionManager(Context context) {
|
||||
mLauncher = Launcher.cast(Launcher.getLauncher(context));
|
||||
mDragLayer = mLauncher.getDragLayer();
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mDeviceProfile = mLauncher.getDeviceProfile();
|
||||
@@ -317,12 +316,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mSystemUiProxy.setStartingWindowListener(mStartingWindowListener);
|
||||
}
|
||||
|
||||
mOpeningXInterpolator = AnimationUtils.loadInterpolator(
|
||||
launcher, R.interpolator.app_open_x);
|
||||
mOpeningInterpolator = AnimationUtils.loadInterpolator(
|
||||
launcher, R.interpolator.emphasized_interpolator);
|
||||
mOpeningXInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.app_open_x);
|
||||
mOpeningInterpolator = AnimationUtils.loadInterpolator(context,
|
||||
R.interpolator.emphasized_interpolator);
|
||||
mCoordinateTransfer = new RemoteAnimationCoordinateTransfer(mLauncher);
|
||||
mLatencyTracker = LatencyTracker.getInstance(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -377,7 +374,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
LauncherTaskbarUIController taskbarController = mLauncher.getTaskbarUIController();
|
||||
if (syncAppLaunchWithTaskbarStash()
|
||||
&& enableScalingRevealHomeAnimation()
|
||||
&& mLauncher.getStateManager().getState() == NORMAL
|
||||
&& taskbarController != null) {
|
||||
taskbarController.setIgnoreInAppFlagForSync(true);
|
||||
mLauncher.addEventCallback(EVENT_DESTROYED, onEndCallback::executeAllAndDestroy);
|
||||
@@ -517,9 +513,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
target = t;
|
||||
break;
|
||||
}
|
||||
final int widthPx = mDeviceProfile.getDeviceProperties().getWidthPx();
|
||||
final int heightPx = mDeviceProfile.getDeviceProperties().getHeightPx();
|
||||
if (target == null) return new Rect(0, 0, widthPx, heightPx);
|
||||
if (target == null) return new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx);
|
||||
final Rect bounds = new Rect(target.screenSpaceBounds);
|
||||
if (target.localBounds != null) {
|
||||
bounds.set(target.localBounds);
|
||||
@@ -529,10 +523,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
if (rotationChange != 0) {
|
||||
if ((rotationChange % 2) == 1) {
|
||||
// undoing rotation, so our "original" parent size is actually flipped
|
||||
Utilities.rotateBounds(bounds, heightPx, widthPx,
|
||||
Utilities.rotateBounds(bounds, mDeviceProfile.heightPx, mDeviceProfile.widthPx,
|
||||
4 - rotationChange);
|
||||
} else {
|
||||
Utilities.rotateBounds(bounds, widthPx, heightPx,
|
||||
Utilities.rotateBounds(bounds, mDeviceProfile.widthPx, mDeviceProfile.heightPx,
|
||||
4 - rotationChange);
|
||||
}
|
||||
}
|
||||
@@ -571,8 +565,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final View appsView = mLauncher.getAppsView();
|
||||
final float startAlpha = appsView.getAlpha();
|
||||
final float startScale = SCALE_PROPERTY.get(appsView);
|
||||
if (mDeviceProfile.getDeviceProperties().isTablet()) {
|
||||
|
||||
if (mDeviceProfile.isTablet) {
|
||||
// AllApps should not fade at all in tablets.
|
||||
alphas = new float[]{1, 1};
|
||||
}
|
||||
@@ -609,7 +602,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
endListener = composeViewContentAnimator(launcherAnimator, alphas, scales);
|
||||
} else {
|
||||
List<View> viewsToAnimate = new ArrayList<>();
|
||||
viewsToAnimate.add(mLauncher.getWorkspace());
|
||||
Workspace<?> workspace = mLauncher.getWorkspace();
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
viewsToAnimate.add(workspace);
|
||||
} else {
|
||||
workspace.forEachVisiblePage(
|
||||
view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));
|
||||
}
|
||||
|
||||
Hotseat hotseat = mLauncher.getHotseat();
|
||||
// Do not scale hotseat as a whole when taskbar is present, and scale QSB only if it's
|
||||
@@ -625,19 +624,22 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
viewsToAnimate.forEach(view -> {
|
||||
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
|
||||
// Start the animation from the current value, instead of assuming the views are
|
||||
// in their resting state, so interrupted animations merge seamlessly.
|
||||
// TODO(b/367591368): ideally these animations would be refactored to be
|
||||
// controlled centrally so each instances doesn't need to care about this
|
||||
// coordination.
|
||||
float[] scale = new float[]{view.getScaleX(), scales[1]};
|
||||
float[] scale = scales;
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
// Start the animation from the current value, instead of assuming the views are
|
||||
// in their resting state, so interrupted animations merge seamlessly.
|
||||
// TODO(b/367591368): ideally these animations would be refactored to be
|
||||
// controlled centrally so each instances doesn't need to care about this
|
||||
// coordination.
|
||||
scale = new float[]{view.getScaleX(), scales[1]};
|
||||
|
||||
// Cancel any ongoing animations. This is necessary to avoid a conflict between
|
||||
// e.g. the unfinished animation triggered when closing an app back to Home and
|
||||
// this animation caused by a launch.
|
||||
Animations.Companion.cancelOngoingAnimation(view);
|
||||
// Make sure to cache the current animation, so it can be properly interrupted.
|
||||
Animations.Companion.setOngoingAnimation(view, launcherAnimator);
|
||||
// Cancel any ongoing animations. This is necessary to avoid a conflict between
|
||||
// e.g. the unfinished animation triggered when closing an app back to Home and
|
||||
// this animation caused by a launch.
|
||||
Animations.Companion.cancelOngoingAnimation(view);
|
||||
// Make sure to cache the current animation, so it can be properly interrupted.
|
||||
Animations.Companion.setOngoingAnimation(view, launcherAnimator);
|
||||
}
|
||||
|
||||
ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(view, SCALE_PROPERTY, scale)
|
||||
.setDuration(CONTENT_SCALE_DURATION);
|
||||
@@ -650,8 +652,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
SCALE_PROPERTY.set(view, 1f);
|
||||
view.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
|
||||
// Reset the cached animation.
|
||||
Animations.Companion.setOngoingAnimation(view, null /* animation */);
|
||||
if (Flags.coordinateWorkspaceScale()) {
|
||||
// Reset the cached animation.
|
||||
Animations.Companion.setOngoingAnimation(view, null /* animation */);
|
||||
}
|
||||
});
|
||||
mLauncher.resumeExpensiveViewUpdates();
|
||||
};
|
||||
@@ -694,7 +698,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
private boolean shouldCropToInset(RemoteAnimationTarget target) {
|
||||
return enableDynamicInsetsForAppLaunch()
|
||||
&& mDeviceProfile.isTaskbarPresent
|
||||
&& mDeviceProfile.isTaskbarPresentInApps
|
||||
&& target != null && !target.willShowImeOnTarget
|
||||
&& !isTransientTaskbar(mLauncher);
|
||||
@@ -801,7 +804,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final float initialWindowRadius = supportsRoundedCornersOnWindows(mLauncher.getResources())
|
||||
? Math.max(crop.width(), crop.height()) / 2f
|
||||
: 0f;
|
||||
final float finalWindowRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
final float finalWindowRadius = mDeviceProfile.isMultiWindowMode
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
final float finalShadowRadius = appTargetsAreTranslucent ? 0 : mMaxShadowRadius;
|
||||
|
||||
@@ -884,8 +887,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
final int windowCropWidth = crop.width();
|
||||
final int windowCropHeight = crop.height();
|
||||
if (rotationChange != 0) {
|
||||
Utilities.rotateBounds(crop, mDeviceProfile.getDeviceProperties().getWidthPx(),
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx(), rotationChange);
|
||||
Utilities.rotateBounds(crop, mDeviceProfile.widthPx,
|
||||
mDeviceProfile.heightPx, rotationChange);
|
||||
}
|
||||
|
||||
// Scale the size of the icon to match the size of the window crop.
|
||||
@@ -932,14 +935,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
matrix.setScale(scale, scale);
|
||||
if (rotationChange == 1) {
|
||||
matrix.postTranslate(windowTransY0,
|
||||
mDeviceProfile.getDeviceProperties().getWidthPx() - (windowTransX0 + scaledCropWidth));
|
||||
mDeviceProfile.widthPx - (windowTransX0 + scaledCropWidth));
|
||||
} else if (rotationChange == 2) {
|
||||
matrix.postTranslate(
|
||||
mDeviceProfile.getDeviceProperties().getWidthPx() - (windowTransX0 + scaledCropWidth),
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx() - (windowTransY0 + scaledCropHeight));
|
||||
mDeviceProfile.widthPx - (windowTransX0 + scaledCropWidth),
|
||||
mDeviceProfile.heightPx - (windowTransY0 + scaledCropHeight));
|
||||
} else if (rotationChange == 3) {
|
||||
matrix.postTranslate(
|
||||
mDeviceProfile.getDeviceProperties().getHeightPx() - (windowTransY0 + scaledCropHeight),
|
||||
mDeviceProfile.heightPx - (windowTransY0 + scaledCropHeight),
|
||||
windowTransX0);
|
||||
} else {
|
||||
matrix.postTranslate(windowTransX0, windowTransY0);
|
||||
@@ -1031,7 +1034,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
FloatingWidgetView.getDefaultBackgroundColor(mLauncher, openingTarget);
|
||||
}
|
||||
|
||||
final float finalWindowRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
final float finalWindowRadius = mDeviceProfile.isMultiWindowMode
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
final FloatingWidgetView floatingView = FloatingWidgetView.getFloatingWidgetView(mLauncher,
|
||||
v, widgetBackgroundBounds,
|
||||
@@ -1146,24 +1149,19 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
/** Returns animator that controls depth/blur of the background during app/widget opening. */
|
||||
private Animator getBackgroundAnimator() {
|
||||
if (Flags.allAppsBlur()) {
|
||||
// Don't animate/blur the background for this launch, regardless of the launcher state.
|
||||
// We have too many performance issues with the blur.
|
||||
return new AnimatorSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns animator that controls depth/blur of the background.
|
||||
*/
|
||||
private ObjectAnimator getBackgroundAnimator() {
|
||||
// When launching an app from overview that doesn't map to a task, we still want to just
|
||||
// blur the wallpaper instead of the launcher surface as well
|
||||
LauncherState launcherState = mLauncher.getStateManager().getState();
|
||||
boolean allowBlurringLauncher =
|
||||
launcherState != OVERVIEW && BlurUtils.supportsBlursOnWindows();
|
||||
boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW
|
||||
&& BlurUtils.supportsBlursOnWindows();
|
||||
|
||||
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(
|
||||
mLauncher.getDepthController().stateDepth, MULTI_PROPERTY_VALUE,
|
||||
BACKGROUND_APP.getDepth(mLauncher))
|
||||
.setDuration(APP_LAUNCH_DURATION);
|
||||
LaunchDepthController depthController = new LaunchDepthController(mLauncher);
|
||||
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth,
|
||||
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
|
||||
@@ -1184,14 +1182,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
.setEffectLayer()
|
||||
.build();
|
||||
|
||||
backgroundRadiusAnim.addListener(AnimatorListeners.forEndCallback(() -> {
|
||||
// Use try-with-resources to ensure the transaction gets closed.
|
||||
try (SurfaceControl.Transaction transaction = new SurfaceControl.Transaction()) {
|
||||
transaction.remove(dimLayer).apply();
|
||||
}
|
||||
}));
|
||||
backgroundRadiusAnim.addListener(AnimatorListeners.forEndCallback(() ->
|
||||
new SurfaceControl.Transaction().remove(dimLayer).apply()));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1429,9 +1431,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
DeviceProfile dp = mLauncher.getDeviceProfile();
|
||||
final int halfIconSize = dp.iconSizePx / 2;
|
||||
float primaryDimension = orientationHandler
|
||||
.getPrimaryValue(dp.getDeviceProperties().getAvailableWidthPx(), dp.getDeviceProperties().getAvailableHeightPx());
|
||||
.getPrimaryValue(dp.availableWidthPx, dp.availableHeightPx);
|
||||
float secondaryDimension = orientationHandler
|
||||
.getSecondaryValue(dp.getDeviceProperties().getAvailableWidthPx(), dp.getDeviceProperties().getAvailableHeightPx());
|
||||
.getSecondaryValue(dp.availableWidthPx, dp.availableHeightPx);
|
||||
final float targetX = primaryDimension / 2f;
|
||||
final float targetY = secondaryDimension - dp.hotseatBarSizePx;
|
||||
return new RectF(targetX - halfIconSize, targetY - halfIconSize,
|
||||
@@ -1461,13 +1463,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
// Get floating view and target rect.
|
||||
boolean isInHotseat = false;
|
||||
if (launcherView instanceof LauncherAppWidgetHostView) {
|
||||
Size windowSize = new Size(mDeviceProfile.getDeviceProperties().getAvailableWidthPx(),
|
||||
mDeviceProfile.getDeviceProperties().getAvailableHeightPx());
|
||||
Size windowSize = new Size(mDeviceProfile.availableWidthPx,
|
||||
mDeviceProfile.availableHeightPx);
|
||||
int fallbackBackgroundColor =
|
||||
FloatingWidgetView.getDefaultBackgroundColor(mLauncher, runningTaskTarget);
|
||||
floatingWidget = FloatingWidgetView.getFloatingWidgetView(mLauncher,
|
||||
(LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
|
||||
mDeviceProfile.getDeviceProperties().isMultiWindowMode() ? 0 : getWindowCornerRadius(mLauncher),
|
||||
mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
|
||||
isTransluscent, fallbackBackgroundColor);
|
||||
} else if (launcherView != null && !RemoveAnimationSettingsTracker.INSTANCE.get(
|
||||
mLauncher).isRemoveAnimationEnabled()) {
|
||||
@@ -1498,7 +1500,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
Rect closingWindowStartRect = new Rect();
|
||||
closingWindowStartRectF.round(closingWindowStartRect);
|
||||
Rect closingWindowOriginalRect =
|
||||
new Rect(0, 0, mDeviceProfile.getDeviceProperties().getWidthPx(), mDeviceProfile.getDeviceProperties().getHeightPx());
|
||||
new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx);
|
||||
if (floatingIconView != null) {
|
||||
anim.addAnimatorListener(floatingIconView);
|
||||
floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged);
|
||||
@@ -1506,20 +1508,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
FloatingIconView finalFloatingIconView = floatingIconView;
|
||||
|
||||
// We want the window alpha to be 0 once this threshold is met, so that the
|
||||
// FloatingIconView can be seen morphing into the icon shape.
|
||||
// FolderIconView can be seen morphing into the icon shape.
|
||||
final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
|
||||
|
||||
RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect,
|
||||
closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) {
|
||||
@Override
|
||||
public void onUpdate(RectF currentRectF, float progress) {
|
||||
// We want the icon alpha to be 1 once this threshold is met, so that it can be
|
||||
// seen morphing into the icon shape. But before the threshold, we want to limit
|
||||
// the alpha to reduce the blur effect behind the window.
|
||||
float iconAlpha =
|
||||
Interpolators.clampToProgress(progress, 0f, windowAlphaThreshold);
|
||||
finalFloatingIconView.update(iconAlpha, currentRectF, progress,
|
||||
windowAlphaThreshold, getCornerRadius(progress), false);
|
||||
finalFloatingIconView.update(1f, currentRectF, progress, windowAlphaThreshold,
|
||||
getCornerRadius(progress), false);
|
||||
|
||||
super.onUpdate(currentRectF, progress);
|
||||
}
|
||||
@@ -1576,7 +1573,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
Rect tmpRect = new Rect();
|
||||
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
int duration = CLOSING_TRANSITION_DURATION_MS;
|
||||
float windowCornerRadius = mDeviceProfile.getDeviceProperties().isMultiWindowMode()
|
||||
float windowCornerRadius = mDeviceProfile.isMultiWindowMode
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
float startShadowRadius = areAllTargetsTranslucent(appTargets) ? 0 : mMaxShadowRadius;
|
||||
closingAnimator.setDuration(duration);
|
||||
@@ -1646,20 +1643,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj) {
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj, /* cujPreStartCallback= */null));
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj, Runnable cujPreStartCallback) {
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj, cujPreStartCallback));
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj));
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(RectFSpringAnim anim, int cuj) {
|
||||
anim.addAnimatorListener(
|
||||
getCujAnimationSuccessListener(cuj, /* cujPreStartCallback= */null));
|
||||
anim.addAnimatorListener(getCujAnimationSuccessListener(cuj));
|
||||
}
|
||||
|
||||
private AnimationSuccessListener getCujAnimationSuccessListener(
|
||||
int cuj, Runnable cujPreStartCallback) {
|
||||
private AnimationSuccessListener getCujAnimationSuccessListener(int cuj) {
|
||||
return new AnimationSuccessListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -1673,9 +1664,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return;
|
||||
}
|
||||
mHandled = true;
|
||||
if (cujPreStartCallback != null) {
|
||||
cujPreStartCallback.run();
|
||||
}
|
||||
|
||||
InteractionJankMonitorWrapper.begin(mDragLayer, cuj);
|
||||
|
||||
mDragLayer.post(() ->
|
||||
@@ -1783,6 +1772,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
true /* animateOverviewScrim */, launcherView).getAnimators());
|
||||
}
|
||||
|
||||
if (!areAllTargetsTranslucent(appTargets)) {
|
||||
anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
|
||||
MULTI_PROPERTY_VALUE,
|
||||
BACKGROUND_APP.getDepth(mLauncher), NORMAL.getDepth(mLauncher)));
|
||||
}
|
||||
|
||||
// We play StaggeredWorkspaceAnim as a part of the closing window animation.
|
||||
playWorkspaceReveal = false;
|
||||
}
|
||||
@@ -1821,13 +1816,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
addCujInstrumentation(rectFSpringAnim, Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME);
|
||||
} else {
|
||||
if (isFreeformAnimation(appTargets)) {
|
||||
addCujInstrumentation(
|
||||
anim,
|
||||
Cuj.CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE,
|
||||
/* cujPreStartCallback= */ () -> {
|
||||
mLatencyTracker.onActionEnd(
|
||||
ACTION_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE);
|
||||
});
|
||||
addCujInstrumentation(anim,
|
||||
Cuj.CUJ_DESKTOP_MODE_EXIT_MODE_ON_LAST_WINDOW_CLOSE);
|
||||
}
|
||||
addCujInstrumentation(anim, playFallBackAnimation
|
||||
? Cuj.CUJ_LAUNCHER_APP_CLOSE_TO_HOME_FALLBACK
|
||||
@@ -1864,7 +1854,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
}
|
||||
});
|
||||
} else if (playWorkspaceReveal) {
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
anim.play(new WorkspaceRevealAnim(mLauncher, false).getAnimators());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2266,20 +2256,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
boolean toLauncher, RectF resultRect) {
|
||||
final int taskRotation = target.windowConfiguration.getRotation();
|
||||
final DeviceProfile profile = mLauncher.getDeviceProfile();
|
||||
final int rotation = profile.getDeviceProperties().getRotationHint();
|
||||
final int widthPx = profile.getDeviceProperties().getWidthPx();
|
||||
final int heightPx = profile.getDeviceProperties().getWidthPx();
|
||||
|
||||
final int rotationDelta = toLauncher
|
||||
? android.util.RotationUtils.deltaRotation(taskRotation, rotation)
|
||||
: android.util.RotationUtils.deltaRotation(rotation, taskRotation);
|
||||
? 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 && (rotation == ROTATION_0
|
||||
|| rotation == ROTATION_180)) {
|
||||
mDisplayRect.set(0, 0, heightPx, widthPx);
|
||||
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, widthPx, heightPx);
|
||||
mDisplayRect.set(0, 0, profile.widthPx, profile.heightPx);
|
||||
}
|
||||
currentRect.round(mTmpResult);
|
||||
android.util.RotationUtils.rotateBounds(mTmpResult, mDisplayRect, rotationDelta);
|
||||
@@ -2418,4 +2405,19 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return Utilities.mapToRange(progress, start, end, 1, 0, ACCELERATE_1_5);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LaunchDepthController extends DepthController {
|
||||
public LaunchDepthController(QuickstepLauncher launcher) {
|
||||
super(launcher);
|
||||
try {
|
||||
setCrossWindowBlursEnabled(
|
||||
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
|
||||
} catch (Throwable t) {
|
||||
// LC-Ignored
|
||||
}
|
||||
// Make sure that the starting value matches the current depth set by the main
|
||||
// controller.
|
||||
stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user