Loading core/java/android/window/BackNavigationInfo.java +2 −34 Original line number Diff line number Diff line Loading @@ -89,8 +89,6 @@ public final class BackNavigationInfo implements Parcelable { @Nullable private final IOnBackInvokedCallback mOnBackInvokedCallback; private final boolean mPrepareRemoteAnimation; @Nullable private WindowContainerToken mDepartingWindowContainerToken; /** * Create a new {@link BackNavigationInfo} instance. Loading @@ -100,20 +98,15 @@ public final class BackNavigationInfo implements Parcelable { * back preview. * @param onBackInvokedCallback The back callback registered by the current top level window. * @param departingWindowContainerToken The {@link WindowContainerToken} of departing window. * @param isPrepareRemoteAnimation Return whether the core is preparing a back gesture * animation, if true, the caller of startBackNavigation should * be expected to receive an animation start callback. */ private BackNavigationInfo(@BackTargetType int type, @Nullable RemoteCallback onBackNavigationDone, @Nullable IOnBackInvokedCallback onBackInvokedCallback, boolean isPrepareRemoteAnimation, @Nullable WindowContainerToken departingWindowContainerToken) { boolean isPrepareRemoteAnimation) { mType = type; mOnBackNavigationDone = onBackNavigationDone; mOnBackInvokedCallback = onBackInvokedCallback; mPrepareRemoteAnimation = isPrepareRemoteAnimation; mDepartingWindowContainerToken = departingWindowContainerToken; } private BackNavigationInfo(@NonNull Parcel in) { Loading @@ -121,7 +114,6 @@ public final class BackNavigationInfo implements Parcelable { mOnBackNavigationDone = in.readTypedObject(RemoteCallback.CREATOR); mOnBackInvokedCallback = IOnBackInvokedCallback.Stub.asInterface(in.readStrongBinder()); mPrepareRemoteAnimation = in.readBoolean(); mDepartingWindowContainerToken = in.readTypedObject(WindowContainerToken.CREATOR); } @Override Loading @@ -130,7 +122,6 @@ public final class BackNavigationInfo implements Parcelable { dest.writeTypedObject(mOnBackNavigationDone, flags); dest.writeStrongInterface(mOnBackInvokedCallback); dest.writeBoolean(mPrepareRemoteAnimation); dest.writeTypedObject(mDepartingWindowContainerToken, flags); } /** Loading Loading @@ -163,18 +154,6 @@ public final class BackNavigationInfo implements Parcelable { return mPrepareRemoteAnimation; } /** * Returns the {@link WindowContainerToken} of the highest container in the hierarchy being * removed. * <p> * For example, if an Activity is the last one of its Task, the Task's token will be given. * Otherwise, it will be the Activity's token. */ @Nullable public WindowContainerToken getDepartingWindowContainerToken() { return mDepartingWindowContainerToken; } /** * Callback to be called when the back preview is finished in order to notify the server that * it can clean up the resources created for the animation. Loading Loading @@ -212,7 +191,6 @@ public final class BackNavigationInfo implements Parcelable { + "mType=" + typeToString(mType) + " (" + mType + ")" + ", mOnBackNavigationDone=" + mOnBackNavigationDone + ", mOnBackInvokedCallback=" + mOnBackInvokedCallback + ", mWindowContainerToken=" + mDepartingWindowContainerToken + '}'; } Loading Loading @@ -248,8 +226,6 @@ public final class BackNavigationInfo implements Parcelable { @Nullable private IOnBackInvokedCallback mOnBackInvokedCallback = null; private boolean mPrepareRemoteAnimation; @Nullable private WindowContainerToken mDepartingWindowContainerToken = null; /** * @see BackNavigationInfo#getType() Loading Loading @@ -284,21 +260,13 @@ public final class BackNavigationInfo implements Parcelable { return this; } /** * @see BackNavigationInfo#getDepartingWindowContainerToken() */ public void setDepartingWCT(@NonNull WindowContainerToken windowContainerToken) { mDepartingWindowContainerToken = windowContainerToken; } /** * Builds and returns an instance of {@link BackNavigationInfo} */ public BackNavigationInfo build() { return new BackNavigationInfo(mType, mOnBackNavigationDone, mOnBackInvokedCallback, mPrepareRemoteAnimation, mDepartingWindowContainerToken); mPrepareRemoteAnimation); } } } core/java/android/window/TransitionInfo.java +8 −1 Original line number Diff line number Diff line Loading @@ -138,8 +138,11 @@ public final class TransitionInfo implements Parcelable { /** The container is a system window, excluding wallpaper and input-method. */ public static final int FLAG_IS_SYSTEM_WINDOW = 1 << 16; /** The window was animated by back gesture. */ public static final int FLAG_BACK_GESTURE_ANIMATED = 1 << 17; /** The first unused bit. This can be used by remotes to attach custom flags to this change. */ public static final int FLAG_FIRST_CUSTOM = 1 << 17; public static final int FLAG_FIRST_CUSTOM = 1 << 18; /** The change belongs to a window that won't contain activities. */ public static final int FLAGS_IS_NON_APP_WINDOW = Loading @@ -165,6 +168,7 @@ public final class TransitionInfo implements Parcelable { FLAG_IS_BEHIND_STARTING_WINDOW, FLAG_IS_OCCLUDED, FLAG_IS_SYSTEM_WINDOW, FLAG_BACK_GESTURE_ANIMATED, FLAG_FIRST_CUSTOM }) public @interface ChangeFlags {} Loading Loading @@ -380,6 +384,9 @@ public final class TransitionInfo implements Parcelable { if ((flags & FLAG_IS_SYSTEM_WINDOW) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FLAG_IS_SYSTEM_WINDOW"); } if ((flags & FLAG_BACK_GESTURE_ANIMATED) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FLAG_BACK_GESTURE_ANIMATED"); } if ((flags & FLAG_FIRST_CUSTOM) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM"); } Loading data/etc/services.core.protolog.json +0 −12 Original line number Diff line number Diff line Loading @@ -2179,12 +2179,6 @@ "group": "WM_DEBUG_ANIM", "at": "com\/android\/server\/wm\/WindowContainer.java" }, "-23020844": { "message": "Back: Reset surfaces", "level": "DEBUG", "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/BackNavigationController.java" }, "-21399771": { "message": "activity %s already destroying, skipping request with reason:%s", "level": "VERBOSE", Loading Loading @@ -3823,12 +3817,6 @@ "group": "WM_DEBUG_APP_TRANSITIONS", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1544805551": { "message": "Skipping app transition animation. task=%s", "level": "DEBUG", "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/Task.java" }, "1557732761": { "message": "For Intent %s bringing to top: %s", "level": "DEBUG", Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +4 −44 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.sysui.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.transition.Transitions; import java.util.concurrent.atomic.AtomicBoolean; Loading @@ -82,8 +81,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont SETTING_VALUE_OFF) == SETTING_VALUE_ON; /** Predictive back animation developer option */ private final AtomicBoolean mEnableAnimations = new AtomicBoolean(false); // TODO (b/241808055) Find a appropriate time to remove during refactor private static final boolean ENABLE_SHELL_TRANSITIONS = Transitions.ENABLE_SHELL_TRANSITIONS; /** * Max duration to wait for a transition to finish before accepting another gesture start * request. Loading Loading @@ -121,8 +118,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private final TouchTracker mTouchTracker = new TouchTracker(); private final SparseArray<BackAnimationRunner> mAnimationDefinition = new SparseArray<>(); private final Transitions mTransitions; private BackTransitionHandler mBackTransitionHandler; @VisibleForTesting final IWindowFocusObserver mFocusObserver = new IWindowFocusObserver.Stub() { Loading @@ -148,11 +143,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull ShellController shellController, @NonNull @ShellMainThread ShellExecutor shellExecutor, @NonNull @ShellBackgroundThread Handler backgroundHandler, Context context, Transitions transitions) { Context context) { this(shellInit, shellController, shellExecutor, backgroundHandler, ActivityTaskManager.getService(), context, context.getContentResolver(), transitions); ActivityTaskManager.getService(), context, context.getContentResolver()); } @VisibleForTesting Loading @@ -162,8 +155,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull @ShellMainThread ShellExecutor shellExecutor, @NonNull @ShellBackgroundThread Handler bgHandler, @NonNull IActivityTaskManager activityTaskManager, Context context, ContentResolver contentResolver, Transitions transitions) { Context context, ContentResolver contentResolver) { mShellController = shellController; mShellExecutor = shellExecutor; mActivityTaskManager = activityTaskManager; Loading @@ -171,7 +163,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mContentResolver = contentResolver; mBgHandler = bgHandler; shellInit.addInitCallback(this::onInit, this); mTransitions = transitions; } @VisibleForTesting Loading @@ -182,10 +173,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private void onInit() { setupAnimationDeveloperSettingsObserver(mContentResolver, mBgHandler); createAdapter(); if (ENABLE_SHELL_TRANSITIONS) { mBackTransitionHandler = new BackTransitionHandler(this); mTransitions.addHandler(mBackTransitionHandler); } mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, this::createExternalInterface, this); Loading Loading @@ -335,18 +322,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont } } // In legacy transition, it would use `Task.mBackGestureStarted` in core to handle the // following transition when back callback is invoked. // If the back callback is not invoked, we should reset the token and finish the whole back // navigation without waiting the transition. if (!ENABLE_SHELL_TRANSITIONS) { finishBackNavigation(); } else if (!mTriggerBack) { // reset the token to prevent it consume next transition. mBackTransitionHandler.setDepartingWindowContainerToken(null); finishBackNavigation(); } } /** * Called when a new motion event needs to be transferred to this Loading Loading @@ -614,10 +591,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont return; } mTransitionInProgress = true; if (ENABLE_SHELL_TRANSITIONS) { mBackTransitionHandler.setDepartingWindowContainerToken( mBackNavigationInfo.getDepartingWindowContainerToken()); } mShellExecutor.executeDelayed(mResetTransitionRunnable, MAX_TRANSITION_DURATION); } Loading @@ -626,19 +599,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mTransitionInProgress = false; } /** * This should be called from {@link BackTransitionHandler#startAnimation} when the following * transition is triggered by the real back callback in {@link #onBackAnimationFinished}. * Will consume the default transition and finish current back navigation. */ void finishTransition(Transitions.TransitionFinishCallback finishCallback) { ProtoLog.d(WM_SHELL_BACK_PREVIEW, "BackAnimationController: finishTransition()"); mShellExecutor.execute(() -> { finishBackNavigation(); finishCallback.onTransitionFinished(null, null); }); } private void createAdapter() { IBackAnimationRunner runner = new IBackAnimationRunner.Stub() { @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackTransitionHandler.javadeleted 100644 → 0 +0 −78 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.back; import android.os.IBinder; import android.view.SurfaceControl; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.wm.shell.transition.Transitions; class BackTransitionHandler implements Transitions.TransitionHandler { private BackAnimationController mBackAnimationController; private WindowContainerToken mDepartingWindowContainerToken; BackTransitionHandler(@NonNull BackAnimationController backAnimationController) { mBackAnimationController = backAnimationController; } @Override public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { if (mDepartingWindowContainerToken != null) { final TransitionInfo.Change change = info.getChange(mDepartingWindowContainerToken); if (change == null) { return false; } startTransaction.hide(change.getLeash()); startTransaction.apply(); mDepartingWindowContainerToken = null; mBackAnimationController.finishTransition(finishCallback); return true; } return false; } @Nullable @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition, @NonNull TransitionRequestInfo request) { return null; } @Override public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, @NonNull Transitions.TransitionFinishCallback finishCallback) { } void setDepartingWindowContainerToken( @Nullable WindowContainerToken departingWindowContainerToken) { mDepartingWindowContainerToken = departingWindowContainerToken; } } Loading
core/java/android/window/BackNavigationInfo.java +2 −34 Original line number Diff line number Diff line Loading @@ -89,8 +89,6 @@ public final class BackNavigationInfo implements Parcelable { @Nullable private final IOnBackInvokedCallback mOnBackInvokedCallback; private final boolean mPrepareRemoteAnimation; @Nullable private WindowContainerToken mDepartingWindowContainerToken; /** * Create a new {@link BackNavigationInfo} instance. Loading @@ -100,20 +98,15 @@ public final class BackNavigationInfo implements Parcelable { * back preview. * @param onBackInvokedCallback The back callback registered by the current top level window. * @param departingWindowContainerToken The {@link WindowContainerToken} of departing window. * @param isPrepareRemoteAnimation Return whether the core is preparing a back gesture * animation, if true, the caller of startBackNavigation should * be expected to receive an animation start callback. */ private BackNavigationInfo(@BackTargetType int type, @Nullable RemoteCallback onBackNavigationDone, @Nullable IOnBackInvokedCallback onBackInvokedCallback, boolean isPrepareRemoteAnimation, @Nullable WindowContainerToken departingWindowContainerToken) { boolean isPrepareRemoteAnimation) { mType = type; mOnBackNavigationDone = onBackNavigationDone; mOnBackInvokedCallback = onBackInvokedCallback; mPrepareRemoteAnimation = isPrepareRemoteAnimation; mDepartingWindowContainerToken = departingWindowContainerToken; } private BackNavigationInfo(@NonNull Parcel in) { Loading @@ -121,7 +114,6 @@ public final class BackNavigationInfo implements Parcelable { mOnBackNavigationDone = in.readTypedObject(RemoteCallback.CREATOR); mOnBackInvokedCallback = IOnBackInvokedCallback.Stub.asInterface(in.readStrongBinder()); mPrepareRemoteAnimation = in.readBoolean(); mDepartingWindowContainerToken = in.readTypedObject(WindowContainerToken.CREATOR); } @Override Loading @@ -130,7 +122,6 @@ public final class BackNavigationInfo implements Parcelable { dest.writeTypedObject(mOnBackNavigationDone, flags); dest.writeStrongInterface(mOnBackInvokedCallback); dest.writeBoolean(mPrepareRemoteAnimation); dest.writeTypedObject(mDepartingWindowContainerToken, flags); } /** Loading Loading @@ -163,18 +154,6 @@ public final class BackNavigationInfo implements Parcelable { return mPrepareRemoteAnimation; } /** * Returns the {@link WindowContainerToken} of the highest container in the hierarchy being * removed. * <p> * For example, if an Activity is the last one of its Task, the Task's token will be given. * Otherwise, it will be the Activity's token. */ @Nullable public WindowContainerToken getDepartingWindowContainerToken() { return mDepartingWindowContainerToken; } /** * Callback to be called when the back preview is finished in order to notify the server that * it can clean up the resources created for the animation. Loading Loading @@ -212,7 +191,6 @@ public final class BackNavigationInfo implements Parcelable { + "mType=" + typeToString(mType) + " (" + mType + ")" + ", mOnBackNavigationDone=" + mOnBackNavigationDone + ", mOnBackInvokedCallback=" + mOnBackInvokedCallback + ", mWindowContainerToken=" + mDepartingWindowContainerToken + '}'; } Loading Loading @@ -248,8 +226,6 @@ public final class BackNavigationInfo implements Parcelable { @Nullable private IOnBackInvokedCallback mOnBackInvokedCallback = null; private boolean mPrepareRemoteAnimation; @Nullable private WindowContainerToken mDepartingWindowContainerToken = null; /** * @see BackNavigationInfo#getType() Loading Loading @@ -284,21 +260,13 @@ public final class BackNavigationInfo implements Parcelable { return this; } /** * @see BackNavigationInfo#getDepartingWindowContainerToken() */ public void setDepartingWCT(@NonNull WindowContainerToken windowContainerToken) { mDepartingWindowContainerToken = windowContainerToken; } /** * Builds and returns an instance of {@link BackNavigationInfo} */ public BackNavigationInfo build() { return new BackNavigationInfo(mType, mOnBackNavigationDone, mOnBackInvokedCallback, mPrepareRemoteAnimation, mDepartingWindowContainerToken); mPrepareRemoteAnimation); } } }
core/java/android/window/TransitionInfo.java +8 −1 Original line number Diff line number Diff line Loading @@ -138,8 +138,11 @@ public final class TransitionInfo implements Parcelable { /** The container is a system window, excluding wallpaper and input-method. */ public static final int FLAG_IS_SYSTEM_WINDOW = 1 << 16; /** The window was animated by back gesture. */ public static final int FLAG_BACK_GESTURE_ANIMATED = 1 << 17; /** The first unused bit. This can be used by remotes to attach custom flags to this change. */ public static final int FLAG_FIRST_CUSTOM = 1 << 17; public static final int FLAG_FIRST_CUSTOM = 1 << 18; /** The change belongs to a window that won't contain activities. */ public static final int FLAGS_IS_NON_APP_WINDOW = Loading @@ -165,6 +168,7 @@ public final class TransitionInfo implements Parcelable { FLAG_IS_BEHIND_STARTING_WINDOW, FLAG_IS_OCCLUDED, FLAG_IS_SYSTEM_WINDOW, FLAG_BACK_GESTURE_ANIMATED, FLAG_FIRST_CUSTOM }) public @interface ChangeFlags {} Loading Loading @@ -380,6 +384,9 @@ public final class TransitionInfo implements Parcelable { if ((flags & FLAG_IS_SYSTEM_WINDOW) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FLAG_IS_SYSTEM_WINDOW"); } if ((flags & FLAG_BACK_GESTURE_ANIMATED) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FLAG_BACK_GESTURE_ANIMATED"); } if ((flags & FLAG_FIRST_CUSTOM) != 0) { sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM"); } Loading
data/etc/services.core.protolog.json +0 −12 Original line number Diff line number Diff line Loading @@ -2179,12 +2179,6 @@ "group": "WM_DEBUG_ANIM", "at": "com\/android\/server\/wm\/WindowContainer.java" }, "-23020844": { "message": "Back: Reset surfaces", "level": "DEBUG", "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/BackNavigationController.java" }, "-21399771": { "message": "activity %s already destroying, skipping request with reason:%s", "level": "VERBOSE", Loading Loading @@ -3823,12 +3817,6 @@ "group": "WM_DEBUG_APP_TRANSITIONS", "at": "com\/android\/server\/wm\/ActivityRecord.java" }, "1544805551": { "message": "Skipping app transition animation. task=%s", "level": "DEBUG", "group": "WM_DEBUG_BACK_PREVIEW", "at": "com\/android\/server\/wm\/Task.java" }, "1557732761": { "message": "For Intent %s bringing to top: %s", "level": "DEBUG", Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +4 −44 Original line number Diff line number Diff line Loading @@ -62,7 +62,6 @@ import com.android.wm.shell.common.annotations.ShellBackgroundThread; import com.android.wm.shell.common.annotations.ShellMainThread; import com.android.wm.shell.sysui.ShellController; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.transition.Transitions; import java.util.concurrent.atomic.AtomicBoolean; Loading @@ -82,8 +81,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont SETTING_VALUE_OFF) == SETTING_VALUE_ON; /** Predictive back animation developer option */ private final AtomicBoolean mEnableAnimations = new AtomicBoolean(false); // TODO (b/241808055) Find a appropriate time to remove during refactor private static final boolean ENABLE_SHELL_TRANSITIONS = Transitions.ENABLE_SHELL_TRANSITIONS; /** * Max duration to wait for a transition to finish before accepting another gesture start * request. Loading Loading @@ -121,8 +118,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private final TouchTracker mTouchTracker = new TouchTracker(); private final SparseArray<BackAnimationRunner> mAnimationDefinition = new SparseArray<>(); private final Transitions mTransitions; private BackTransitionHandler mBackTransitionHandler; @VisibleForTesting final IWindowFocusObserver mFocusObserver = new IWindowFocusObserver.Stub() { Loading @@ -148,11 +143,9 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull ShellController shellController, @NonNull @ShellMainThread ShellExecutor shellExecutor, @NonNull @ShellBackgroundThread Handler backgroundHandler, Context context, Transitions transitions) { Context context) { this(shellInit, shellController, shellExecutor, backgroundHandler, ActivityTaskManager.getService(), context, context.getContentResolver(), transitions); ActivityTaskManager.getService(), context, context.getContentResolver()); } @VisibleForTesting Loading @@ -162,8 +155,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @NonNull @ShellMainThread ShellExecutor shellExecutor, @NonNull @ShellBackgroundThread Handler bgHandler, @NonNull IActivityTaskManager activityTaskManager, Context context, ContentResolver contentResolver, Transitions transitions) { Context context, ContentResolver contentResolver) { mShellController = shellController; mShellExecutor = shellExecutor; mActivityTaskManager = activityTaskManager; Loading @@ -171,7 +163,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mContentResolver = contentResolver; mBgHandler = bgHandler; shellInit.addInitCallback(this::onInit, this); mTransitions = transitions; } @VisibleForTesting Loading @@ -182,10 +173,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont private void onInit() { setupAnimationDeveloperSettingsObserver(mContentResolver, mBgHandler); createAdapter(); if (ENABLE_SHELL_TRANSITIONS) { mBackTransitionHandler = new BackTransitionHandler(this); mTransitions.addHandler(mBackTransitionHandler); } mShellController.addExternalInterface(KEY_EXTRA_SHELL_BACK_ANIMATION, this::createExternalInterface, this); Loading Loading @@ -335,18 +322,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont } } // In legacy transition, it would use `Task.mBackGestureStarted` in core to handle the // following transition when back callback is invoked. // If the back callback is not invoked, we should reset the token and finish the whole back // navigation without waiting the transition. if (!ENABLE_SHELL_TRANSITIONS) { finishBackNavigation(); } else if (!mTriggerBack) { // reset the token to prevent it consume next transition. mBackTransitionHandler.setDepartingWindowContainerToken(null); finishBackNavigation(); } } /** * Called when a new motion event needs to be transferred to this Loading Loading @@ -614,10 +591,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont return; } mTransitionInProgress = true; if (ENABLE_SHELL_TRANSITIONS) { mBackTransitionHandler.setDepartingWindowContainerToken( mBackNavigationInfo.getDepartingWindowContainerToken()); } mShellExecutor.executeDelayed(mResetTransitionRunnable, MAX_TRANSITION_DURATION); } Loading @@ -626,19 +599,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mTransitionInProgress = false; } /** * This should be called from {@link BackTransitionHandler#startAnimation} when the following * transition is triggered by the real back callback in {@link #onBackAnimationFinished}. * Will consume the default transition and finish current back navigation. */ void finishTransition(Transitions.TransitionFinishCallback finishCallback) { ProtoLog.d(WM_SHELL_BACK_PREVIEW, "BackAnimationController: finishTransition()"); mShellExecutor.execute(() -> { finishBackNavigation(); finishCallback.onTransitionFinished(null, null); }); } private void createAdapter() { IBackAnimationRunner runner = new IBackAnimationRunner.Stub() { @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackTransitionHandler.javadeleted 100644 → 0 +0 −78 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.back; import android.os.IBinder; import android.view.SurfaceControl; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.wm.shell.transition.Transitions; class BackTransitionHandler implements Transitions.TransitionHandler { private BackAnimationController mBackAnimationController; private WindowContainerToken mDepartingWindowContainerToken; BackTransitionHandler(@NonNull BackAnimationController backAnimationController) { mBackAnimationController = backAnimationController; } @Override public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { if (mDepartingWindowContainerToken != null) { final TransitionInfo.Change change = info.getChange(mDepartingWindowContainerToken); if (change == null) { return false; } startTransaction.hide(change.getLeash()); startTransaction.apply(); mDepartingWindowContainerToken = null; mBackAnimationController.finishTransition(finishCallback); return true; } return false; } @Nullable @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition, @NonNull TransitionRequestInfo request) { return null; } @Override public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, @NonNull Transitions.TransitionFinishCallback finishCallback) { } void setDepartingWindowContainerToken( @Nullable WindowContainerToken departingWindowContainerToken) { mDepartingWindowContainerToken = departingWindowContainerToken; } }