Loading core/java/com/android/internal/jank/Cuj.java +13 −2 Original line number Diff line number Diff line Loading @@ -306,8 +306,15 @@ public class Cuj { /** Track work utility view animation shrinking when scrolling down app list. */ public static final int CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK = 127; /** * Track task transitions * * <p>Tracking starts and ends with the animation.</p> */ public static final int CUJ_DEFAULT_TASK_TO_TASK_ANIMATION = 128; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK; @VisibleForTesting static final int LAST_CUJ = CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; /** @hide */ @IntDef({ Loading Loading @@ -426,7 +433,8 @@ public class Cuj { CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON, CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND, CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -556,6 +564,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_EXPAND; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_SHRINK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DEFAULT_TASK_TO_TASK_ANIMATION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DEFAULT_TASK_TO_TASK_ANIMATION; } private Cuj() { Loading Loading @@ -806,6 +815,8 @@ public class Cuj { return "LAUNCHER_WORK_UTILITY_VIEW_EXPAND"; case CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK: return "LAUNCHER_WORK_UTILITY_VIEW_SHRINK"; case CUJ_DEFAULT_TASK_TO_TASK_ANIMATION: return "CUJ_DEFAULT_TASK_TO_TASK_ANIMATION"; } return "UNKNOWN"; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +47 −0 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL; import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL; import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS; Loading @@ -55,6 +58,7 @@ import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; import static android.window.TransitionInfo.FLAG_TRANSLUCENT; import static com.android.internal.jank.Cuj.CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; import static com.android.internal.policy.TransitionAnimation.DEFAULT_APP_TRANSITION_DURATION; import static com.android.internal.policy.TransitionAnimation.WALLPAPER_TRANSITION_CHANGE; import static com.android.internal.policy.TransitionAnimation.WALLPAPER_TRANSITION_CLOSE; Loading Loading @@ -101,6 +105,7 @@ import android.window.WindowContainerTransaction; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.policy.TransitionAnimation; import com.android.internal.protolog.ProtoLog; Loading Loading @@ -144,6 +149,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { private Drawable mEnterpriseThumbnailDrawable; static final InteractionJankMonitor sInteractionJankMonitor = InteractionJankMonitor.getInstance(); private BroadcastReceiver mEnterpriseResourceUpdatedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -321,8 +329,17 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { final ArrayList<Animator> animations = new ArrayList<>(); mAnimations.put(transition, animations); final boolean isTaskTransition = isTaskTransition(info); if (isTaskTransition) { sInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext, mMainHandler, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } final Runnable onAnimFinish = () -> { if (!animations.isEmpty()) return; if (isTaskTransition) { sInteractionJankMonitor.end(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } mAnimations.remove(transition); finishCallback.onTransitionFinished(null /* wct */); }; Loading Loading @@ -677,6 +694,30 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return false; } /** * A task transition is defined as a transition where there is exaclty one open/to_front task * and one close/to_back task. Nothing else is allowed to be included in the transition */ public static boolean isTaskTransition(@NonNull TransitionInfo info) { if (info.getChanges().size() != 2) { return false; } boolean hasOpeningTask = false; boolean hasClosingTask = false; for (int i = info.getChanges().size() - 1; i >= 0; --i) { final TransitionInfo.Change change = info.getChanges().get(i); if (change.getTaskInfo() == null) { // A non-task is in the transition return false; } int mode = change.getMode(); hasOpeningTask |= mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT; hasClosingTask |= mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK; } return hasOpeningTask && hasClosingTask; } /** * Does `info` only contain translucent visibility changes (CHANGEs are ignored). We select * different animations and z-orders for these Loading Loading @@ -986,4 +1027,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { || animType == ANIM_CLIP_REVEAL || animType == ANIM_OPEN_CROSS_PROFILE_APPS || animType == ANIM_FROM_STYLE; } @Override public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, @Nullable SurfaceControl.Transaction finishTransaction) { sInteractionJankMonitor.cancel(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } } Loading
core/java/com/android/internal/jank/Cuj.java +13 −2 Original line number Diff line number Diff line Loading @@ -306,8 +306,15 @@ public class Cuj { /** Track work utility view animation shrinking when scrolling down app list. */ public static final int CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK = 127; /** * Track task transitions * * <p>Tracking starts and ends with the animation.</p> */ public static final int CUJ_DEFAULT_TASK_TO_TASK_ANIMATION = 128; // When adding a CUJ, update this and make sure to also update CUJ_TO_STATSD_INTERACTION_TYPE. @VisibleForTesting static final int LAST_CUJ = CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK; @VisibleForTesting static final int LAST_CUJ = CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; /** @hide */ @IntDef({ Loading Loading @@ -426,7 +433,8 @@ public class Cuj { CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON, CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH, CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND, CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION }) @Retention(RetentionPolicy.SOURCE) public @interface CujType {} Loading Loading @@ -556,6 +564,7 @@ public class Cuj { CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DESKTOP_MODE_KEYBOARD_QUICK_SWITCH_APP_LAUNCH; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_EXPAND] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_EXPAND; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_WORK_UTILITY_VIEW_SHRINK; CUJ_TO_STATSD_INTERACTION_TYPE[CUJ_DEFAULT_TASK_TO_TASK_ANIMATION] = FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__DEFAULT_TASK_TO_TASK_ANIMATION; } private Cuj() { Loading Loading @@ -806,6 +815,8 @@ public class Cuj { return "LAUNCHER_WORK_UTILITY_VIEW_EXPAND"; case CUJ_LAUNCHER_WORK_UTILITY_VIEW_SHRINK: return "LAUNCHER_WORK_UTILITY_VIEW_SHRINK"; case CUJ_DEFAULT_TASK_TO_TASK_ANIMATION: return "CUJ_DEFAULT_TASK_TO_TASK_ANIMATION"; } return "UNKNOWN"; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +47 −0 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL; import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL; import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS; Loading @@ -55,6 +58,7 @@ import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; import static android.window.TransitionInfo.FLAG_TRANSLUCENT; import static com.android.internal.jank.Cuj.CUJ_DEFAULT_TASK_TO_TASK_ANIMATION; import static com.android.internal.policy.TransitionAnimation.DEFAULT_APP_TRANSITION_DURATION; import static com.android.internal.policy.TransitionAnimation.WALLPAPER_TRANSITION_CHANGE; import static com.android.internal.policy.TransitionAnimation.WALLPAPER_TRANSITION_CLOSE; Loading Loading @@ -101,6 +105,7 @@ import android.window.WindowContainerTransaction; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.policy.TransitionAnimation; import com.android.internal.protolog.ProtoLog; Loading Loading @@ -144,6 +149,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { private Drawable mEnterpriseThumbnailDrawable; static final InteractionJankMonitor sInteractionJankMonitor = InteractionJankMonitor.getInstance(); private BroadcastReceiver mEnterpriseResourceUpdatedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -321,8 +329,17 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { final ArrayList<Animator> animations = new ArrayList<>(); mAnimations.put(transition, animations); final boolean isTaskTransition = isTaskTransition(info); if (isTaskTransition) { sInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext, mMainHandler, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } final Runnable onAnimFinish = () -> { if (!animations.isEmpty()) return; if (isTaskTransition) { sInteractionJankMonitor.end(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } mAnimations.remove(transition); finishCallback.onTransitionFinished(null /* wct */); }; Loading Loading @@ -677,6 +694,30 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return false; } /** * A task transition is defined as a transition where there is exaclty one open/to_front task * and one close/to_back task. Nothing else is allowed to be included in the transition */ public static boolean isTaskTransition(@NonNull TransitionInfo info) { if (info.getChanges().size() != 2) { return false; } boolean hasOpeningTask = false; boolean hasClosingTask = false; for (int i = info.getChanges().size() - 1; i >= 0; --i) { final TransitionInfo.Change change = info.getChanges().get(i); if (change.getTaskInfo() == null) { // A non-task is in the transition return false; } int mode = change.getMode(); hasOpeningTask |= mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT; hasClosingTask |= mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK; } return hasOpeningTask && hasClosingTask; } /** * Does `info` only contain translucent visibility changes (CHANGEs are ignored). We select * different animations and z-orders for these Loading Loading @@ -986,4 +1027,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { || animType == ANIM_CLIP_REVEAL || animType == ANIM_OPEN_CROSS_PROFILE_APPS || animType == ANIM_FROM_STYLE; } @Override public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, @Nullable SurfaceControl.Transaction finishTransaction) { sInteractionJankMonitor.cancel(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); } }