Loading core/java/android/view/WindowManager.java +35 −10 Original line number Diff line number Diff line Loading @@ -343,23 +343,48 @@ public interface WindowManager extends ViewManager { /** @hide */ int TRANSIT_NONE = 0; /** @hide */ /** * A window that didn't exist before has been created and made visible. * @hide */ int TRANSIT_OPEN = 1; /** @hide */ /** * A window that was visible no-longer exists (was finished or destroyed). * @hide */ int TRANSIT_CLOSE = 2; /** @hide */ /** * A window that already existed but was not visible is made visible. * @hide */ int TRANSIT_TO_FRONT = 3; /** @hide */ /** * A window that was visible is made invisible but still exists. * @hide */ int TRANSIT_TO_BACK = 4; /** @hide */ int TRANSIT_RELAUNCH = 5; /** @hide */ int TRANSIT_CHANGE_WINDOWING_MODE = 6; /** @hide */ /** * A window is visible before and after but changes in some way (eg. it resizes or changes * windowing-mode). * @hide */ int TRANSIT_CHANGE = 6; /** * The keyguard was visible and has been dismissed. * @hide */ int TRANSIT_KEYGUARD_GOING_AWAY = 7; /** @hide */ /** * A window is appearing above a locked keyguard. * @hide */ int TRANSIT_KEYGUARD_OCCLUDE = 8; /** @hide */ /** * A window is made invisible revealing a locked keyguard. * @hide */ int TRANSIT_KEYGUARD_UNOCCLUDE = 9; /** Loading @@ -372,7 +397,7 @@ public interface WindowManager extends ViewManager { TRANSIT_TO_FRONT, TRANSIT_TO_BACK, TRANSIT_RELAUNCH, TRANSIT_CHANGE_WINDOWING_MODE, TRANSIT_CHANGE, TRANSIT_KEYGUARD_GOING_AWAY, TRANSIT_KEYGUARD_OCCLUDE, TRANSIT_KEYGUARD_UNOCCLUDE, Loading core/java/android/window/TransitionInfo.java +17 −24 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ package android.window; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -35,31 +42,17 @@ import java.util.List; */ public final class TransitionInfo implements Parcelable { /** No transition mode. This is a placeholder, don't use this as an actual mode. */ public static final int TRANSIT_NONE = 0; /** The container didn't exist before but will exist and be visible after. */ public static final int TRANSIT_OPEN = 1; /** The container existed and was visible before but won't exist after. */ public static final int TRANSIT_CLOSE = 2; /** The container existed before but was invisible and will be visible after. */ public static final int TRANSIT_SHOW = 3; /** The container is going from visible to invisible but it will still exist after. */ public static final int TRANSIT_HIDE = 4; /** The container exists and is visible before and after but it changes. */ public static final int TRANSIT_CHANGE = 5; /** @hide */ /** * Modes are only a sub-set of all the transit-types since they are per-container * @hide */ @IntDef(prefix = { "TRANSIT_" }, value = { TRANSIT_NONE, TRANSIT_OPEN, TRANSIT_CLOSE, TRANSIT_SHOW, TRANSIT_HIDE, // Note: to_front/to_back really mean show/hide respectively at the container level. TRANSIT_TO_FRONT, TRANSIT_TO_BACK, TRANSIT_CHANGE }) public @interface TransitionMode {} Loading Loading @@ -198,8 +191,8 @@ public final class TransitionInfo implements Parcelable { case TRANSIT_NONE: return "NONE"; case TRANSIT_OPEN: return "OPEN"; case TRANSIT_CLOSE: return "CLOSE"; case TRANSIT_SHOW: return "SHOW"; case TRANSIT_HIDE: return "HIDE"; case TRANSIT_TO_FRONT: return "SHOW"; case TRANSIT_TO_BACK: return "HIDE"; case TRANSIT_CHANGE: return "CHANGE"; default: return "<unknown:" + mode + ">"; } Loading @@ -210,7 +203,7 @@ public final class TransitionInfo implements Parcelable { private final WindowContainerToken mContainer; private WindowContainerToken mParent; private final SurfaceControl mLeash; private int mMode = TRANSIT_NONE; private @TransitionMode int mMode = TRANSIT_NONE; private final Rect mStartAbsBounds = new Rect(); private final Rect mEndAbsBounds = new Rect(); private final Point mEndRelOffset = new Point(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/ShellInit.java +8 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class ShellInit { private final Optional<AppPairs> mAppPairsOptional; private final LetterboxTaskListener mLetterboxTaskListener; private final FullscreenTaskListener mFullscreenTaskListener; private final Transitions mTransitions; public ShellInit(DisplayImeController displayImeController, DragAndDropController dragAndDropController, Loading @@ -47,7 +48,8 @@ public class ShellInit { Optional<SplitScreen> splitScreenOptional, Optional<AppPairs> appPairsOptional, LetterboxTaskListener letterboxTaskListener, FullscreenTaskListener fullscreenTaskListener) { FullscreenTaskListener fullscreenTaskListener, Transitions transitions) { mDisplayImeController = displayImeController; mDragAndDropController = dragAndDropController; mShellTaskOrganizer = shellTaskOrganizer; Loading @@ -55,6 +57,7 @@ public class ShellInit { mAppPairsOptional = appPairsOptional; mLetterboxTaskListener = letterboxTaskListener; mFullscreenTaskListener = fullscreenTaskListener; mTransitions = transitions; } @ExternalThread Loading @@ -72,5 +75,9 @@ public class ShellInit { mAppPairsOptional.ifPresent(AppPairs::onOrganizerRegistered); // Bind the splitscreen impl to the drag drop controller mDragAndDropController.setSplitScreenController(mSplitScreenOptional); if (Transitions.ENABLE_SHELL_TRANSITIONS) { mTransitions.register(mShellTaskOrganizer); } } } libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +4 −13 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.protolog.common.ProtoLog; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.startingsurface.StartingSurfaceDrawer; import java.io.PrintWriter; Loading Loading @@ -102,24 +100,17 @@ public class ShellTaskOrganizer extends TaskOrganizer { /** @see #setPendingLaunchCookieListener */ private final ArrayMap<IBinder, TaskListener> mLaunchCookieToListener = new ArrayMap<>(); // TODO(shell-transitions): move to a more "global" Shell location as this isn't only for Tasks private final Transitions mTransitions; private final Object mLock = new Object(); private final StartingSurfaceDrawer mStartingSurfaceDrawer; public ShellTaskOrganizer(SyncTransactionQueue syncQueue, TransactionPool transactionPool, ShellExecutor mainExecutor, ShellExecutor animExecutor, Context context) { this(null, syncQueue, transactionPool, mainExecutor, animExecutor, context); public ShellTaskOrganizer(ShellExecutor mainExecutor, Context context) { this(null, mainExecutor, context); } @VisibleForTesting ShellTaskOrganizer(ITaskOrganizerController taskOrganizerController, SyncTransactionQueue syncQueue, TransactionPool transactionPool, ShellExecutor mainExecutor, ShellExecutor animExecutor, Context context) { ShellTaskOrganizer(ITaskOrganizerController taskOrganizerController, ShellExecutor mainExecutor, Context context) { super(taskOrganizerController, mainExecutor); mTransitions = new Transitions(this, transactionPool, mainExecutor, animExecutor); if (Transitions.ENABLE_SHELL_TRANSITIONS) mTransitions.register(this); // TODO(b/131727939) temporarily live here, the starting surface drawer should be controlled // by a controller, that class should be create while porting // ActivityRecord#addStartingWindow to WMShell. Loading libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java +10 −11 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ package com.android.wm.shell; import static android.window.TransitionInfo.TRANSIT_CLOSE; import static android.window.TransitionInfo.TRANSIT_HIDE; import static android.window.TransitionInfo.TRANSIT_OPEN; import static android.window.TransitionInfo.TRANSIT_SHOW; 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 android.animation.Animator; import android.animation.ValueAnimator; Loading @@ -40,7 +40,6 @@ import androidx.annotation.BinderThread; import com.android.internal.protolog.common.ProtoLog; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.protolog.ShellProtoLogGroup; import java.util.ArrayList; Loading @@ -62,7 +61,7 @@ public class Transitions { /** Keeps track of currently tracked transitions and all the animations associated with each */ private final ArrayMap<IBinder, ArrayList<Animator>> mActiveTransitions = new ArrayMap<>(); Transitions(@NonNull WindowOrganizer organizer, @NonNull TransactionPool pool, public Transitions(@NonNull WindowOrganizer organizer, @NonNull TransactionPool pool, @NonNull ShellExecutor mainExecutor, @NonNull ShellExecutor animExecutor) { mOrganizer = organizer; mTransactionPool = pool; Loading Loading @@ -119,8 +118,8 @@ public class Transitions { } private static boolean isOpeningType(@WindowManager.TransitionType int type) { return type == WindowManager.TRANSIT_OPEN || type == WindowManager.TRANSIT_TO_FRONT return type == TRANSIT_OPEN || type == TRANSIT_TO_FRONT || type == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; } Loading Loading @@ -150,7 +149,7 @@ public class Transitions { // Don't animate anything with an animating parent if (change.getParent() != null) { if (mode == TRANSIT_OPEN || mode == TRANSIT_SHOW) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { t.show(leash); t.setMatrix(leash, 1, 0, 0, 1); } Loading @@ -161,7 +160,7 @@ public class Transitions { t.setPosition(leash, change.getEndAbsBounds().left - info.getRootOffset().x, change.getEndAbsBounds().top - info.getRootOffset().y); // Put all the OPEN/SHOW on top if (mode == TRANSIT_OPEN || mode == TRANSIT_SHOW) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { t.show(leash); t.setMatrix(leash, 1, 0, 0, 1); if (isOpening) { Loading @@ -174,7 +173,7 @@ public class Transitions { t.setLayer(leash, -i); t.setAlpha(leash, 1.f); } } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_HIDE) { } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) { if (isOpening) { // put on bottom and leave visible without fade t.setLayer(leash, -i); Loading Loading
core/java/android/view/WindowManager.java +35 −10 Original line number Diff line number Diff line Loading @@ -343,23 +343,48 @@ public interface WindowManager extends ViewManager { /** @hide */ int TRANSIT_NONE = 0; /** @hide */ /** * A window that didn't exist before has been created and made visible. * @hide */ int TRANSIT_OPEN = 1; /** @hide */ /** * A window that was visible no-longer exists (was finished or destroyed). * @hide */ int TRANSIT_CLOSE = 2; /** @hide */ /** * A window that already existed but was not visible is made visible. * @hide */ int TRANSIT_TO_FRONT = 3; /** @hide */ /** * A window that was visible is made invisible but still exists. * @hide */ int TRANSIT_TO_BACK = 4; /** @hide */ int TRANSIT_RELAUNCH = 5; /** @hide */ int TRANSIT_CHANGE_WINDOWING_MODE = 6; /** @hide */ /** * A window is visible before and after but changes in some way (eg. it resizes or changes * windowing-mode). * @hide */ int TRANSIT_CHANGE = 6; /** * The keyguard was visible and has been dismissed. * @hide */ int TRANSIT_KEYGUARD_GOING_AWAY = 7; /** @hide */ /** * A window is appearing above a locked keyguard. * @hide */ int TRANSIT_KEYGUARD_OCCLUDE = 8; /** @hide */ /** * A window is made invisible revealing a locked keyguard. * @hide */ int TRANSIT_KEYGUARD_UNOCCLUDE = 9; /** Loading @@ -372,7 +397,7 @@ public interface WindowManager extends ViewManager { TRANSIT_TO_FRONT, TRANSIT_TO_BACK, TRANSIT_RELAUNCH, TRANSIT_CHANGE_WINDOWING_MODE, TRANSIT_CHANGE, TRANSIT_KEYGUARD_GOING_AWAY, TRANSIT_KEYGUARD_OCCLUDE, TRANSIT_KEYGUARD_UNOCCLUDE, Loading
core/java/android/window/TransitionInfo.java +17 −24 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ package android.window; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -35,31 +42,17 @@ import java.util.List; */ public final class TransitionInfo implements Parcelable { /** No transition mode. This is a placeholder, don't use this as an actual mode. */ public static final int TRANSIT_NONE = 0; /** The container didn't exist before but will exist and be visible after. */ public static final int TRANSIT_OPEN = 1; /** The container existed and was visible before but won't exist after. */ public static final int TRANSIT_CLOSE = 2; /** The container existed before but was invisible and will be visible after. */ public static final int TRANSIT_SHOW = 3; /** The container is going from visible to invisible but it will still exist after. */ public static final int TRANSIT_HIDE = 4; /** The container exists and is visible before and after but it changes. */ public static final int TRANSIT_CHANGE = 5; /** @hide */ /** * Modes are only a sub-set of all the transit-types since they are per-container * @hide */ @IntDef(prefix = { "TRANSIT_" }, value = { TRANSIT_NONE, TRANSIT_OPEN, TRANSIT_CLOSE, TRANSIT_SHOW, TRANSIT_HIDE, // Note: to_front/to_back really mean show/hide respectively at the container level. TRANSIT_TO_FRONT, TRANSIT_TO_BACK, TRANSIT_CHANGE }) public @interface TransitionMode {} Loading Loading @@ -198,8 +191,8 @@ public final class TransitionInfo implements Parcelable { case TRANSIT_NONE: return "NONE"; case TRANSIT_OPEN: return "OPEN"; case TRANSIT_CLOSE: return "CLOSE"; case TRANSIT_SHOW: return "SHOW"; case TRANSIT_HIDE: return "HIDE"; case TRANSIT_TO_FRONT: return "SHOW"; case TRANSIT_TO_BACK: return "HIDE"; case TRANSIT_CHANGE: return "CHANGE"; default: return "<unknown:" + mode + ">"; } Loading @@ -210,7 +203,7 @@ public final class TransitionInfo implements Parcelable { private final WindowContainerToken mContainer; private WindowContainerToken mParent; private final SurfaceControl mLeash; private int mMode = TRANSIT_NONE; private @TransitionMode int mMode = TRANSIT_NONE; private final Rect mStartAbsBounds = new Rect(); private final Rect mEndAbsBounds = new Rect(); private final Point mEndRelOffset = new Point(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/ShellInit.java +8 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class ShellInit { private final Optional<AppPairs> mAppPairsOptional; private final LetterboxTaskListener mLetterboxTaskListener; private final FullscreenTaskListener mFullscreenTaskListener; private final Transitions mTransitions; public ShellInit(DisplayImeController displayImeController, DragAndDropController dragAndDropController, Loading @@ -47,7 +48,8 @@ public class ShellInit { Optional<SplitScreen> splitScreenOptional, Optional<AppPairs> appPairsOptional, LetterboxTaskListener letterboxTaskListener, FullscreenTaskListener fullscreenTaskListener) { FullscreenTaskListener fullscreenTaskListener, Transitions transitions) { mDisplayImeController = displayImeController; mDragAndDropController = dragAndDropController; mShellTaskOrganizer = shellTaskOrganizer; Loading @@ -55,6 +57,7 @@ public class ShellInit { mAppPairsOptional = appPairsOptional; mLetterboxTaskListener = letterboxTaskListener; mFullscreenTaskListener = fullscreenTaskListener; mTransitions = transitions; } @ExternalThread Loading @@ -72,5 +75,9 @@ public class ShellInit { mAppPairsOptional.ifPresent(AppPairs::onOrganizerRegistered); // Bind the splitscreen impl to the drag drop controller mDragAndDropController.setSplitScreenController(mSplitScreenOptional); if (Transitions.ENABLE_SHELL_TRANSITIONS) { mTransitions.register(mShellTaskOrganizer); } } }
libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +4 −13 Original line number Diff line number Diff line Loading @@ -43,8 +43,6 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.protolog.common.ProtoLog; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.startingsurface.StartingSurfaceDrawer; import java.io.PrintWriter; Loading Loading @@ -102,24 +100,17 @@ public class ShellTaskOrganizer extends TaskOrganizer { /** @see #setPendingLaunchCookieListener */ private final ArrayMap<IBinder, TaskListener> mLaunchCookieToListener = new ArrayMap<>(); // TODO(shell-transitions): move to a more "global" Shell location as this isn't only for Tasks private final Transitions mTransitions; private final Object mLock = new Object(); private final StartingSurfaceDrawer mStartingSurfaceDrawer; public ShellTaskOrganizer(SyncTransactionQueue syncQueue, TransactionPool transactionPool, ShellExecutor mainExecutor, ShellExecutor animExecutor, Context context) { this(null, syncQueue, transactionPool, mainExecutor, animExecutor, context); public ShellTaskOrganizer(ShellExecutor mainExecutor, Context context) { this(null, mainExecutor, context); } @VisibleForTesting ShellTaskOrganizer(ITaskOrganizerController taskOrganizerController, SyncTransactionQueue syncQueue, TransactionPool transactionPool, ShellExecutor mainExecutor, ShellExecutor animExecutor, Context context) { ShellTaskOrganizer(ITaskOrganizerController taskOrganizerController, ShellExecutor mainExecutor, Context context) { super(taskOrganizerController, mainExecutor); mTransitions = new Transitions(this, transactionPool, mainExecutor, animExecutor); if (Transitions.ENABLE_SHELL_TRANSITIONS) mTransitions.register(this); // TODO(b/131727939) temporarily live here, the starting surface drawer should be controlled // by a controller, that class should be create while porting // ActivityRecord#addStartingWindow to WMShell. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java +10 −11 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ package com.android.wm.shell; import static android.window.TransitionInfo.TRANSIT_CLOSE; import static android.window.TransitionInfo.TRANSIT_HIDE; import static android.window.TransitionInfo.TRANSIT_OPEN; import static android.window.TransitionInfo.TRANSIT_SHOW; 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 android.animation.Animator; import android.animation.ValueAnimator; Loading @@ -40,7 +40,6 @@ import androidx.annotation.BinderThread; import com.android.internal.protolog.common.ProtoLog; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.protolog.ShellProtoLogGroup; import java.util.ArrayList; Loading @@ -62,7 +61,7 @@ public class Transitions { /** Keeps track of currently tracked transitions and all the animations associated with each */ private final ArrayMap<IBinder, ArrayList<Animator>> mActiveTransitions = new ArrayMap<>(); Transitions(@NonNull WindowOrganizer organizer, @NonNull TransactionPool pool, public Transitions(@NonNull WindowOrganizer organizer, @NonNull TransactionPool pool, @NonNull ShellExecutor mainExecutor, @NonNull ShellExecutor animExecutor) { mOrganizer = organizer; mTransactionPool = pool; Loading Loading @@ -119,8 +118,8 @@ public class Transitions { } private static boolean isOpeningType(@WindowManager.TransitionType int type) { return type == WindowManager.TRANSIT_OPEN || type == WindowManager.TRANSIT_TO_FRONT return type == TRANSIT_OPEN || type == TRANSIT_TO_FRONT || type == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; } Loading Loading @@ -150,7 +149,7 @@ public class Transitions { // Don't animate anything with an animating parent if (change.getParent() != null) { if (mode == TRANSIT_OPEN || mode == TRANSIT_SHOW) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { t.show(leash); t.setMatrix(leash, 1, 0, 0, 1); } Loading @@ -161,7 +160,7 @@ public class Transitions { t.setPosition(leash, change.getEndAbsBounds().left - info.getRootOffset().x, change.getEndAbsBounds().top - info.getRootOffset().y); // Put all the OPEN/SHOW on top if (mode == TRANSIT_OPEN || mode == TRANSIT_SHOW) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { t.show(leash); t.setMatrix(leash, 1, 0, 0, 1); if (isOpening) { Loading @@ -174,7 +173,7 @@ public class Transitions { t.setLayer(leash, -i); t.setAlpha(leash, 1.f); } } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_HIDE) { } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) { if (isOpening) { // put on bottom and leave visible without fade t.setLayer(leash, -i); Loading