Move transition utility functions into shell.util
Things in shell.util can be used by systemui code (eg. the legacy transition adapters). Bug: 261418859 Test: no-logic changes, so just existing tests. Change-Id: I3acf4f3b6d7dfd91d8a70b63fc2b6a043f4a9f16
This commit is contained in:
@@ -32,6 +32,7 @@ import android.window.TransitionRequestInfo;
|
||||
import android.window.WindowContainerTransaction;
|
||||
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -115,7 +116,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
|
||||
boolean latest) {
|
||||
for (int i = mPending.size() - 1; i >= 0; --i) {
|
||||
if (mPending.get(i).mTaskView != taskView) continue;
|
||||
if (Transitions.isClosingType(mPending.get(i).mType) == closing) {
|
||||
if (TransitionUtil.isClosingType(mPending.get(i).mType) == closing) {
|
||||
return mPending.get(i);
|
||||
}
|
||||
if (latest) {
|
||||
@@ -148,7 +149,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
|
||||
final TaskViewTaskController taskView = findTaskView(triggerTask);
|
||||
if (taskView == null) return null;
|
||||
// Opening types should all be initiated by shell
|
||||
if (!Transitions.isClosingType(request.getType())) return null;
|
||||
if (!TransitionUtil.isClosingType(request.getType())) return null;
|
||||
PendingTransition pending = findPending(taskView, true /* closing */, false /* latest */);
|
||||
if (pending == null) {
|
||||
pending = new PendingTransition(request.getType(), null, taskView, null /* cookie */);
|
||||
@@ -238,7 +239,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
|
||||
for (int i = 0; i < info.getChanges().size(); ++i) {
|
||||
final TransitionInfo.Change chg = info.getChanges().get(i);
|
||||
if (chg.getTaskInfo() == null) continue;
|
||||
if (Transitions.isClosingType(chg.getMode())) {
|
||||
if (TransitionUtil.isClosingType(chg.getMode())) {
|
||||
final boolean isHide = chg.getMode() == TRANSIT_TO_BACK;
|
||||
TaskViewTaskController tv = findTaskView(chg.getTaskInfo());
|
||||
if (tv == null) {
|
||||
@@ -255,7 +256,7 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
|
||||
tv.prepareCloseAnimation();
|
||||
}
|
||||
changesHandled++;
|
||||
} else if (Transitions.isOpeningType(chg.getMode())) {
|
||||
} else if (TransitionUtil.isOpeningType(chg.getMode())) {
|
||||
final boolean taskIsNew = chg.getMode() == TRANSIT_OPEN;
|
||||
final TaskViewTaskController tv;
|
||||
if (taskIsNew) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import android.window.TransitionInfo;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
/**
|
||||
* Wrapper to handle the ActivityEmbedding animation update in one
|
||||
@@ -90,7 +90,7 @@ class ActivityEmbeddingAnimationAdapter {
|
||||
mChange = change;
|
||||
mLeash = leash;
|
||||
mWholeAnimationBounds.set(wholeAnimationBounds);
|
||||
if (Transitions.isClosingType(change.getMode())) {
|
||||
if (TransitionUtil.isClosingType(change.getMode())) {
|
||||
// When it is closing, we want to show the content at the start position in case the
|
||||
// window is resizing as well. For example, when the activities is changing from split
|
||||
// to stack, the bottom TaskFragment will be resized to fullscreen when hiding.
|
||||
|
||||
@@ -43,7 +43,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.wm.shell.common.ScreenshotUtils;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -184,7 +184,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
if (isChangeTransition) {
|
||||
return createChangeAnimationAdapters(info, startTransaction);
|
||||
}
|
||||
if (Transitions.isClosingType(info.getType())) {
|
||||
if (TransitionUtil.isClosingType(info.getType())) {
|
||||
return createCloseAnimationAdapters(info);
|
||||
}
|
||||
return createOpenAnimationAdapters(info);
|
||||
@@ -219,7 +219,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
final Rect openingWholeScreenBounds = new Rect();
|
||||
final Rect closingWholeScreenBounds = new Rect();
|
||||
for (TransitionInfo.Change change : info.getChanges()) {
|
||||
if (Transitions.isOpeningType(change.getMode())) {
|
||||
if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||
openingChanges.add(change);
|
||||
openingWholeScreenBounds.union(change.getEndAbsBounds());
|
||||
} else {
|
||||
@@ -271,7 +271,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
continue;
|
||||
}
|
||||
final TransitionInfo.Change change = adapter.mChange;
|
||||
if (Transitions.isOpeningType(adapter.mChange.getMode())) {
|
||||
if (TransitionUtil.isOpeningType(adapter.mChange.getMode())) {
|
||||
// Need to screenshot after startTransaction is applied otherwise activity
|
||||
// may not be visible or ready yet.
|
||||
postStartTransactionCallbacks.add(
|
||||
@@ -343,7 +343,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
// When the parent window is also included in the transition as an opening window,
|
||||
// we would like to animate the parent window instead.
|
||||
final TransitionInfo.Change parentChange = info.getChange(parentToken);
|
||||
if (parentChange != null && Transitions.isOpeningType(parentChange.getMode())) {
|
||||
if (parentChange != null && TransitionUtil.isOpeningType(parentChange.getMode())) {
|
||||
// We won't create a separate animation for the parent, but to animate the
|
||||
// parent for the child resizing.
|
||||
handledChanges.add(parentChange);
|
||||
@@ -404,7 +404,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
// No-op if it will be covered by the changing parent window, or it is a changing
|
||||
// window without bounds change.
|
||||
animation = ActivityEmbeddingAnimationSpec.createNoopAnimation(change);
|
||||
} else if (Transitions.isClosingType(change.getMode())) {
|
||||
} else if (TransitionUtil.isClosingType(change.getMode())) {
|
||||
animation = mAnimationSpec.createChangeBoundsCloseAnimation(change, parentBounds);
|
||||
shouldShouldBackgroundColor = false;
|
||||
} else {
|
||||
@@ -469,7 +469,7 @@ class ActivityEmbeddingAnimationRunner {
|
||||
// When the parent window is also included in the transition as an opening window,
|
||||
// we would like to animate the parent window instead.
|
||||
final TransitionInfo.Change parentChange = info.getChange(parentToken);
|
||||
if (parentChange != null && Transitions.isOpeningType(parentChange.getMode())) {
|
||||
if (parentChange != null && TransitionUtil.isOpeningType(parentChange.getMode())) {
|
||||
changingChanges.add(parentChange);
|
||||
}
|
||||
}
|
||||
@@ -491,8 +491,8 @@ class ActivityEmbeddingAnimationRunner {
|
||||
// No-op if it will be covered by the changing parent window.
|
||||
continue;
|
||||
}
|
||||
hasOpeningWindow |= Transitions.isOpeningType(change.getMode());
|
||||
hasClosingWindow |= Transitions.isClosingType(change.getMode());
|
||||
hasOpeningWindow |= TransitionUtil.isOpeningType(change.getMode());
|
||||
hasClosingWindow |= TransitionUtil.isClosingType(change.getMode());
|
||||
}
|
||||
return hasOpeningWindow && hasClosingWindow;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import android.window.TransitionInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.internal.policy.TransitionAnimation;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
/** Animation spec for ActivityEmbedding transition. */
|
||||
// TODO(b/206557124): provide an easier way to customize animation
|
||||
@@ -73,7 +73,7 @@ class ActivityEmbeddingAnimationSpec {
|
||||
@NonNull
|
||||
static Animation createNoopAnimation(@NonNull TransitionInfo.Change change) {
|
||||
// Noop but just keep the window showing/hiding.
|
||||
final float alpha = Transitions.isClosingType(change.getMode()) ? 0f : 1f;
|
||||
final float alpha = TransitionUtil.isClosingType(change.getMode()) ? 0f : 1f;
|
||||
return new AlphaAnimation(alpha, alpha);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class ActivityEmbeddingAnimationSpec {
|
||||
@NonNull
|
||||
Animation loadOpenAnimation(@NonNull TransitionInfo info,
|
||||
@NonNull TransitionInfo.Change change, @NonNull Rect wholeAnimationBounds) {
|
||||
final boolean isEnter = Transitions.isOpeningType(change.getMode());
|
||||
final boolean isEnter = TransitionUtil.isOpeningType(change.getMode());
|
||||
final Animation animation;
|
||||
if (shouldShowBackdrop(info, change)) {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
@@ -222,7 +222,7 @@ class ActivityEmbeddingAnimationSpec {
|
||||
@NonNull
|
||||
Animation loadCloseAnimation(@NonNull TransitionInfo info,
|
||||
@NonNull TransitionInfo.Change change, @NonNull Rect wholeAnimationBounds) {
|
||||
final boolean isEnter = Transitions.isOpeningType(change.getMode());
|
||||
final boolean isEnter = TransitionUtil.isOpeningType(change.getMode());
|
||||
final Animation animation;
|
||||
if (shouldShowBackdrop(info, change)) {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
|
||||
@@ -40,7 +40,6 @@ import static com.android.wm.shell.pip.PipTransitionState.ENTERED_PIP;
|
||||
import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP;
|
||||
import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP_TO_SPLIT;
|
||||
import static com.android.wm.shell.transition.Transitions.TRANSIT_REMOVE_PIP;
|
||||
import static com.android.wm.shell.transition.Transitions.isOpeningType;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.app.ActivityManager;
|
||||
@@ -72,6 +71,7 @@ import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
import com.android.wm.shell.transition.CounterRotatorHelper;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -702,7 +702,7 @@ public class PipTransition extends PipTransitionController {
|
||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change == enterPip) continue;
|
||||
if (isOpeningType(change.getMode())) {
|
||||
if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||
final SurfaceControl leash = change.getLeash();
|
||||
startTransaction.show(leash).setAlpha(leash, 1.f);
|
||||
}
|
||||
@@ -873,7 +873,7 @@ public class PipTransition extends PipTransitionController {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isOpeningType(mode) && change.getParent() == null) {
|
||||
if (TransitionUtil.isOpeningType(mode) && change.getParent() == null) {
|
||||
final SurfaceControl leash = change.getLeash();
|
||||
final Rect endBounds = change.getEndAbsBounds();
|
||||
startTransaction
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.android.wm.shell.common.split.SplitDecorManager;
|
||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.transition.OneShotRemoteHandler;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -531,7 +532,7 @@ class SplitScreenTransitions {
|
||||
}
|
||||
|
||||
private boolean isOpeningTransition(TransitionInfo info) {
|
||||
return Transitions.isOpeningType(info.getType())
|
||||
return TransitionUtil.isOpeningType(info.getType())
|
||||
|| info.getType() == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE
|
||||
|| info.getType() == TRANSIT_SPLIT_SCREEN_PAIR_OPEN;
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ import static com.android.wm.shell.splitscreen.SplitScreenController.exitReasonT
|
||||
import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS;
|
||||
import static com.android.wm.shell.transition.Transitions.TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE;
|
||||
import static com.android.wm.shell.transition.Transitions.TRANSIT_SPLIT_SCREEN_PAIR_OPEN;
|
||||
import static com.android.wm.shell.transition.Transitions.isClosingType;
|
||||
import static com.android.wm.shell.transition.Transitions.isOpeningType;
|
||||
import static com.android.wm.shell.util.TransitionUtil.isClosingType;
|
||||
import static com.android.wm.shell.util.TransitionUtil.isOpeningType;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -135,6 +135,7 @@ import com.android.wm.shell.transition.DefaultMixedHandler;
|
||||
import com.android.wm.shell.transition.LegacyTransitions;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.SplitBounds;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -2271,7 +2272,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
|
||||
// Use normal animations.
|
||||
return false;
|
||||
} else if (mMixedHandler != null && Transitions.hasDisplayChange(info)) {
|
||||
} else if (mMixedHandler != null && TransitionUtil.hasDisplayChange(info)) {
|
||||
// A display-change has been un-expectedly inserted into the transition. Redirect
|
||||
// handling to the mixed-handler to deal with splitting it up.
|
||||
if (mMixedHandler.animatePendingSplitWithDisplayChange(transition, info,
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.window.WindowContainerToken;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.wm.shell.util.CounterRotator;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class CounterRotatorHelper {
|
||||
for (int i = numChanges - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = changes.get(i);
|
||||
final WindowContainerToken parent = change.getParent();
|
||||
if (!Transitions.isClosingType(change.getMode())
|
||||
if (!TransitionUtil.isClosingType(change.getMode())
|
||||
|| !TransitionInfo.isIndependent(change, info) || parent == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.splitscreen.SplitScreenController;
|
||||
import com.android.wm.shell.splitscreen.StageCoordinator;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
@@ -149,7 +150,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler {
|
||||
mSplitHandler.addEnterOrExitIfNeeded(request, out);
|
||||
return out;
|
||||
} else if (request.getRemoteTransition() != null
|
||||
&& Transitions.isOpeningType(request.getType())
|
||||
&& TransitionUtil.isOpeningType(request.getType())
|
||||
&& (request.getTriggerTask() == null
|
||||
|| (request.getTriggerTask().topActivityType != ACTIVITY_TYPE_HOME
|
||||
&& request.getTriggerTask().topActivityType != ACTIVITY_TYPE_RECENTS))) {
|
||||
|
||||
@@ -112,6 +112,7 @@ import com.android.wm.shell.common.ShellExecutor;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.sysui.ShellInit;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -445,7 +446,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
backgroundColorForTransition);
|
||||
|
||||
if (!isTask && a.hasExtension()) {
|
||||
if (!Transitions.isOpeningType(change.getMode())) {
|
||||
if (!TransitionUtil.isOpeningType(change.getMode())) {
|
||||
// Can screenshot now (before startTransaction is applied)
|
||||
edgeExtendWindow(change, a, startTransaction, finishTransaction);
|
||||
} else {
|
||||
@@ -456,7 +457,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
final Rect clipRect = Transitions.isClosingType(change.getMode())
|
||||
final Rect clipRect = TransitionUtil.isClosingType(change.getMode())
|
||||
? new Rect(mRotator.getEndBoundsInStartRotation(change))
|
||||
: new Rect(change.getEndAbsBounds());
|
||||
clipRect.offsetTo(0, 0);
|
||||
@@ -562,12 +563,12 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
final int flags = info.getFlags();
|
||||
final int changeMode = change.getMode();
|
||||
final int changeFlags = change.getFlags();
|
||||
final boolean isOpeningType = Transitions.isOpeningType(type);
|
||||
final boolean enter = Transitions.isOpeningType(changeMode);
|
||||
final boolean isOpeningType = TransitionUtil.isOpeningType(type);
|
||||
final boolean enter = TransitionUtil.isOpeningType(changeMode);
|
||||
final boolean isTask = change.getTaskInfo() != null;
|
||||
final TransitionInfo.AnimationOptions options = info.getAnimationOptions();
|
||||
final int overrideType = options != null ? options.getType() : ANIM_NONE;
|
||||
final Rect endBounds = Transitions.isClosingType(changeMode)
|
||||
final Rect endBounds = TransitionUtil.isClosingType(changeMode)
|
||||
? mRotator.getEndBoundsInStartRotation(change)
|
||||
: change.getEndAbsBounds();
|
||||
|
||||
@@ -689,8 +690,8 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
private void attachThumbnail(@NonNull ArrayList<Animator> animations,
|
||||
@NonNull Runnable finishCallback, TransitionInfo.Change change,
|
||||
TransitionInfo.AnimationOptions options, float cornerRadius) {
|
||||
final boolean isOpen = Transitions.isOpeningType(change.getMode());
|
||||
final boolean isClose = Transitions.isClosingType(change.getMode());
|
||||
final boolean isOpen = TransitionUtil.isOpeningType(change.getMode());
|
||||
final boolean isClose = TransitionUtil.isClosingType(change.getMode());
|
||||
if (isOpen) {
|
||||
if (options.getType() == ANIM_OPEN_CROSS_PROFILE_APPS) {
|
||||
attachCrossProfileThumbnailAnimation(animations, finishCallback, change,
|
||||
@@ -772,16 +773,16 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if ((change.getFlags() & FLAG_SHOW_WALLPAPER) != 0) {
|
||||
if (Transitions.isOpeningType(change.getMode())) {
|
||||
if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||
hasOpenWallpaper = true;
|
||||
} else if (Transitions.isClosingType(change.getMode())) {
|
||||
} else if (TransitionUtil.isClosingType(change.getMode())) {
|
||||
hasCloseWallpaper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasOpenWallpaper && hasCloseWallpaper) {
|
||||
return Transitions.isOpeningType(info.getType())
|
||||
return TransitionUtil.isOpeningType(info.getType())
|
||||
? WALLPAPER_TRANSITION_INTRA_OPEN : WALLPAPER_TRANSITION_INTRA_CLOSE;
|
||||
} else if (hasOpenWallpaper) {
|
||||
return WALLPAPER_TRANSITION_OPEN;
|
||||
|
||||
@@ -39,6 +39,7 @@ import androidx.annotation.BinderThread;
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
import com.android.wm.shell.common.ShellExecutor;
|
||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -93,7 +94,7 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
|
||||
@NonNull SurfaceControl.Transaction startTransaction,
|
||||
@NonNull SurfaceControl.Transaction finishTransaction,
|
||||
@NonNull Transitions.TransitionFinishCallback finishCallback) {
|
||||
if (!Transitions.SHELL_TRANSITIONS_ROTATION && Transitions.hasDisplayChange(info)) {
|
||||
if (!Transitions.SHELL_TRANSITIONS_ROTATION && TransitionUtil.hasDisplayChange(info)) {
|
||||
// Note that if the remote doesn't have permission ACCESS_SURFACE_FLINGER, some
|
||||
// operations of the start transaction may be ignored.
|
||||
return false;
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.android.internal.R;
|
||||
import com.android.internal.policy.TransitionAnimation;
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
import com.android.wm.shell.protolog.ShellProtoLogGroup;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
/** The helper class that provides methods for adding styles to transition animations. */
|
||||
public class TransitionAnimationHelper {
|
||||
@@ -66,7 +67,7 @@ public class TransitionAnimationHelper {
|
||||
final int type = info.getType();
|
||||
final int changeMode = change.getMode();
|
||||
final int changeFlags = change.getFlags();
|
||||
final boolean enter = Transitions.isOpeningType(changeMode);
|
||||
final boolean enter = TransitionUtil.isOpeningType(changeMode);
|
||||
final boolean isTask = change.getTaskInfo() != null;
|
||||
final TransitionInfo.AnimationOptions options = info.getAnimationOptions();
|
||||
final int overrideType = options != null ? options.getType() : ANIM_NONE;
|
||||
|
||||
@@ -19,13 +19,11 @@ package com.android.wm.shell.transition;
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.view.WindowManager.fixScale;
|
||||
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
|
||||
import static android.window.TransitionInfo.FLAG_IS_OCCLUDED;
|
||||
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
|
||||
import static android.window.TransitionInfo.FLAG_NO_ANIMATION;
|
||||
@@ -33,6 +31,8 @@ import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPI
|
||||
|
||||
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
|
||||
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_SHELL_TRANSITIONS;
|
||||
import static com.android.wm.shell.util.TransitionUtil.isClosingType;
|
||||
import static com.android.wm.shell.util.TransitionUtil.isOpeningType;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -319,29 +319,6 @@ public class Transitions implements RemoteCallable<Transitions> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @return true if the transition was triggered by opening something vs closing something */
|
||||
public static boolean isOpeningType(@WindowManager.TransitionType int type) {
|
||||
return type == TRANSIT_OPEN
|
||||
|| type == TRANSIT_TO_FRONT
|
||||
|| type == TRANSIT_KEYGUARD_GOING_AWAY;
|
||||
}
|
||||
|
||||
/** @return true if the transition was triggered by closing something vs opening something */
|
||||
public static boolean isClosingType(@WindowManager.TransitionType int type) {
|
||||
return type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if the transition has a display change. */
|
||||
public static boolean hasDisplayChange(@NonNull TransitionInfo info) {
|
||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change.getMode() == TRANSIT_CHANGE && change.hasFlags(FLAG_IS_DISPLAY)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up visibility/alpha/transforms to resemble the starting state of an animation.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.wm.shell.util;
|
||||
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.view.WindowManager;
|
||||
import android.window.TransitionInfo;
|
||||
|
||||
/** Various utility functions for transitions. */
|
||||
public class TransitionUtil {
|
||||
|
||||
/** @return true if the transition was triggered by opening something vs closing something */
|
||||
public static boolean isOpeningType(@WindowManager.TransitionType int type) {
|
||||
return type == TRANSIT_OPEN
|
||||
|| type == TRANSIT_TO_FRONT
|
||||
|| type == TRANSIT_KEYGUARD_GOING_AWAY;
|
||||
}
|
||||
|
||||
/** @return true if the transition was triggered by closing something vs opening something */
|
||||
public static boolean isClosingType(@WindowManager.TransitionType int type) {
|
||||
return type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if the transition has a display change. */
|
||||
public static boolean hasDisplayChange(@NonNull TransitionInfo info) {
|
||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change.getMode() == TRANSIT_CHANGE && change.hasFlags(FLAG_IS_DISPLAY)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,10 +22,7 @@ import static android.view.RemoteAnimationTarget.MODE_CLOSING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_OPENING;
|
||||
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
|
||||
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
|
||||
import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT;
|
||||
@@ -46,6 +43,8 @@ import android.view.WindowManager;
|
||||
import android.window.TransitionInfo;
|
||||
import android.window.TransitionInfo.Change;
|
||||
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -75,7 +74,7 @@ public class RemoteAnimationTargetCompat {
|
||||
private static void setupLeash(@NonNull SurfaceControl leash,
|
||||
@NonNull TransitionInfo.Change change, int layer,
|
||||
@NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t) {
|
||||
boolean isOpening = info.getType() == TRANSIT_OPEN || info.getType() == TRANSIT_TO_FRONT;
|
||||
final boolean isOpening = TransitionUtil.isOpeningType(info.getType());
|
||||
// Put animating stuff above this line and put static stuff below it.
|
||||
int zSplitLine = info.getChanges().size();
|
||||
// changes should be ordered top-to-bottom in z
|
||||
@@ -88,7 +87,7 @@ public class RemoteAnimationTargetCompat {
|
||||
absBounds.top - info.getRootOffset().y);
|
||||
|
||||
// Put all the OPEN/SHOW on top
|
||||
if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
|
||||
if (TransitionUtil.isOpeningType(mode)) {
|
||||
if (isOpening) {
|
||||
t.setLayer(leash, zSplitLine + info.getChanges().size() - layer);
|
||||
if ((change.getFlags() & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) == 0) {
|
||||
@@ -99,7 +98,7 @@ public class RemoteAnimationTargetCompat {
|
||||
// put on bottom and leave it visible
|
||||
t.setLayer(leash, zSplitLine - layer);
|
||||
}
|
||||
} else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) {
|
||||
} else if (TransitionUtil.isClosingType(mode)) {
|
||||
if (isOpening) {
|
||||
// put on bottom and leave visible
|
||||
t.setLayer(leash, zSplitLine - layer);
|
||||
|
||||
@@ -19,11 +19,7 @@ package com.android.systemui.shared.system;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.newTarget;
|
||||
|
||||
@@ -50,6 +46,7 @@ import android.window.WindowContainerTransaction;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -183,7 +180,7 @@ public class RemoteTransitionCompat {
|
||||
final RemoteAnimationTarget target = newTarget(change,
|
||||
info.getChanges().size() - i, info, t, mLeashMap);
|
||||
apps.add(target);
|
||||
if (change.getMode() == TRANSIT_CLOSE || change.getMode() == TRANSIT_TO_BACK) {
|
||||
if (TransitionUtil.isClosingType(change.getMode())) {
|
||||
// raise closing (pausing) task to "above" layer so it isn't covered
|
||||
t.setLayer(target.leash, info.getChanges().size() * 3 - i);
|
||||
mPausingTasks.add(new TaskState(change, target.leash));
|
||||
@@ -200,8 +197,7 @@ public class RemoteTransitionCompat {
|
||||
} else if (taskInfo != null && taskInfo.topActivityType == ACTIVITY_TYPE_HOME) {
|
||||
mRecentsTask = taskInfo.token;
|
||||
mRecentsTaskId = taskInfo.taskId;
|
||||
} else if (change.getMode() == TRANSIT_OPEN
|
||||
|| change.getMode() == TRANSIT_TO_FRONT) {
|
||||
} else if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||
mOpeningTasks.add(new TaskState(change, target.leash));
|
||||
}
|
||||
}
|
||||
@@ -227,7 +223,7 @@ public class RemoteTransitionCompat {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
|
||||
final boolean isLeafTask = leafTaskFilter.test(change);
|
||||
if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) {
|
||||
if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||
if (mRecentsTask.equals(change.getContainer())) {
|
||||
recentsOpening = change;
|
||||
} else if (isLeafTask) {
|
||||
@@ -240,8 +236,7 @@ public class RemoteTransitionCompat {
|
||||
}
|
||||
openingTasks.add(change);
|
||||
}
|
||||
} else if (change.getMode() == TRANSIT_CLOSE
|
||||
|| change.getMode() == TRANSIT_TO_BACK) {
|
||||
} else if (TransitionUtil.isClosingType(change.getMode())) {
|
||||
if (mRecentsTask.equals(change.getContainer())) {
|
||||
foundRecentsClosing = true;
|
||||
} else if (isLeafTask) {
|
||||
|
||||
Reference in New Issue
Block a user