Merge branch 'android14-release' into 14-dev

This commit is contained in:
MrSluffy committed 2023-12-13 18:47:55 +08:00
1 parent 5931c9afec
commit 32700b0100
994 files changed
+36404 -15826

No files matched your search

@@ -18,6 +18,7 @@ package com.android.launcher3;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
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;
@@ -57,6 +58,7 @@ import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VAL
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.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
@@ -119,6 +121,7 @@ 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;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.ActivityOptionsWrapper;
@@ -141,6 +144,7 @@ import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransaction;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.TaskRestartedDuringLaunchListener;
import com.android.quickstep.util.WorkspaceRevealAnim;
import com.android.quickstep.views.FloatingWidgetView;
import com.android.quickstep.views.RecentsView;
@@ -151,7 +155,6 @@ 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.systemui.shared.testing.ResourceUtils;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import java.util.ArrayList;
@@ -230,6 +233,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
// Strong refs to runners which are cleared when the launcher activity is
// destroyed
private RemoteAnimationFactory mWallpaperOpenRunner;
private RemoteAnimationFactory mAppLaunchRunner;
private RemoteAnimationFactory mKeyguardGoingAwayRunner;
private RemoteAnimationFactory mWallpaperOpenTransitionRunner;
@@ -261,7 +265,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mDragLayer = mLauncher.getDragLayer();
mHandler = new Handler(Looper.getMainLooper());
mDeviceProfile = mLauncher.getDeviceProfile();
mBackAnimationController = LawnchairApp.isAtleastT() ? new LauncherBackAnimationController(mLauncher, this) : null;
mBackAnimationController = LawnchairApp.isAtleastT() ? new LauncherBackAnimationController(mLauncher, this)
: null;
Resources res = mLauncher.getResources();
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
@@ -300,17 +305,23 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
boolean fromRecents = isLaunchingFromRecents(v, null /* targets */);
RunnableList onEndCallback = new RunnableList();
RemoteAnimationFactory delegateRunner = new AppLaunchAnimationRunner(v, onEndCallback);
// 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);
if (containerAnimationRunner != null) {
delegateRunner = containerAnimationRunner;
mAppLaunchRunner = containerAnimationRunner;
}
}
RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(
mHandler, delegateRunner, true /* startAtFrontOfQueue */);
mHandler, mAppLaunchRunner, true /* startAtFrontOfQueue */);
// Note that this duration is a guess as we do not know if the animation will be
// a
@@ -324,7 +335,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
ActivityOptions options = ActivityOptions.makeRemoteAnimation(
new RemoteAnimationAdapter(runner, duration, statusBarTransitionDelay),
new RemoteTransition(runner.toRemoteTransition(),
mLauncher.getIApplicationThread()));
mLauncher.getIApplicationThread(), "QuickstepLaunch"));
return new ActivityOptionsWrapper(options, onEndCallback);
}
@@ -1061,7 +1072,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW
&& BlurUtils.supportsBlursOnWindows();
MyDepthController depthController = new MyDepthController(mLauncher);
LaunchDepthController depthController = new LaunchDepthController(mLauncher);
ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth,
MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher))
.setDuration(APP_LAUNCH_DURATION);
@@ -1091,6 +1102,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
AnimatorListeners.forEndCallback(() -> new SurfaceControl.Transaction().remove(dimLayer).apply()));
}
backgroundRadiusAnim.addListener(
AnimatorListeners.forEndCallback(depthController::dispose));
return backgroundRadiusAnim;
}
@@ -1113,7 +1127,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
* overridden to add
* additional animations.
*/
protected void addRemoteAnimations(RemoteAnimationDefinition definition) {
private void addRemoteAnimations(RemoteAnimationDefinition definition) {
mWallpaperOpenRunner = createWallpaperOpenRunner(false /* fromUnlock */);
definition.addRemoteAnimation(WindowManager.TRANSIT_OLD_WALLPAPER_OPEN,
WindowConfiguration.ACTIVITY_TYPE_STANDARD,
@@ -1138,6 +1152,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
* Registers remote animations used when closing apps to home screen.
*/
public void registerRemoteTransitions() {
if (ENABLE_SHELL_TRANSITIONS) {
SystemUiProxy.INSTANCE.get(mLauncher).shareTransactionQueue();
}
if (SEPARATE_RECENTS_ACTIVITY.get()) {
return;
}
@@ -1148,7 +1165,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
mLauncherOpenTransition = new RemoteTransition(
new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner,
false /* startAtFrontOfQueue */).toRemoteTransition(),
mLauncher.getIApplicationThread());
mLauncher.getIApplicationThread(), "QuickstepLaunchHome");
TransitionFilter homeCheck = new TransitionFilter();
// No need to handle the transition that also dismisses keyguard.
@@ -1176,7 +1193,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
}
protected void unregisterRemoteAnimations() {
private void unregisterRemoteAnimations() {
if (SEPARATE_RECENTS_ACTIVITY.get()) {
return;
}
@@ -1187,11 +1204,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
// animation
// definition so we don't have to wait for the system gc
mWallpaperOpenRunner = null;
mAppLaunchRunner = null;
mKeyguardGoingAwayRunner = null;
}
}
private void unregisterRemoteTransitions() {
protected void unregisterRemoteTransitions() {
if (ENABLE_SHELL_TRANSITIONS) {
SystemUiProxy.INSTANCE.get(mLauncher).unshareTransactionQueue();
}
if (SEPARATE_RECENTS_ACTIVITY.get()) {
return;
}
@@ -1222,14 +1243,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
return false;
}
private boolean hasMultipleTargetsWithMode(RemoteAnimationTarget[] targets, int mode) {
private boolean shouldPlayFallbackClosingAnimation(RemoteAnimationTarget[] targets) {
int numTargets = 0;
for (RemoteAnimationTarget target : targets) {
if (target.mode == mode) {
if (target.mode == MODE_CLOSING) {
numTargets++;
}
if (numTargets > 1) {
return true;
if (numTargets > 1 || target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW) {
return true;
}
}
}
return false;
@@ -1501,13 +1522,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
RemoteAnimationTarget target = appTargets[i];
SurfaceProperties builder = transaction.forSurface(target.leash);
if (target.localBounds != null) {
tmpPos.set(target.localBounds.left, target.localBounds.top);
if (target.screenSpaceBounds != null) {
tmpPos.set(target.screenSpaceBounds.left, target.screenSpaceBounds.top);
} else {
tmpPos.set(target.position.x, target.position.y);
}
final Rect crop = new Rect(target.screenSpaceBounds);
final Rect crop = new Rect(target.localBounds);
crop.offsetTo(0, 0);
if (target.mode == MODE_CLOSING) {
tmpRect.set(target.screenSpaceBounds);
@@ -1623,7 +1644,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
boolean playFallBackAnimation = (launcherView == null
&& launcherIsForceInvisibleOrOpening)
|| mLauncher.getWorkspace().isOverlayShown()
|| hasMultipleTargetsWithMode(appTargets, MODE_CLOSING);
|| shouldPlayFallbackClosingAnimation(appTargets);
boolean playWorkspaceReveal = true;
boolean skipAllAppsScale = false;
@@ -1733,6 +1754,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
QuickStepContract.getWindowCornerRadius(mLauncher),
false /* fromPredictiveBack */);
TaskViewUtils.createSplitAuxiliarySurfacesAnimator(nonAppTargets, false, null);
mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL);
result.setAnimation(pair.second, mLauncher);
}
@@ -1817,7 +1839,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
viewToUse = v;
}
// TODO(b/265134143): create a CUJ type for interaction jank monitoring.
// 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 */);
@@ -1875,8 +1899,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
}
@Override
public void onAnimationCancelled(boolean isKeyguardOccluded) {
mDelegate.onAnimationCancelled(isKeyguardOccluded);
public void onAnimationCancelled() {
mDelegate.onAnimationCancelled();
}
}
@@ -2067,20 +2091,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
}
}
private static class MyDepthController extends DepthController {
MyDepthController(Launcher l) {
super(l);
if(LawnchairApp.isAtleastT()){
private static class LaunchDepthController extends DepthController {
LaunchDepthController(QuickstepLauncher launcher) {
super(launcher);
if (LawnchairApp.isAtleastT()) {
setCrossWindowBlursEnabled(
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
}
}
@Override
public void setSurface(SurfaceControl surface) {
if(LawnchairApp.isAtleastT()){
super.setSurface(surface);
}
// Make sure that the starting value matches the current depth set by the main
// controller.
stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());
}
}
}