Refactor back navigation animtion (2/2)
Use IBackAnimationRunner to receive the animation leashes. Use IRemoteAnimationFinishedCallback to callback when animation finished. Bug: 241808055 Test: atest BackNavigationControllerTests BackAnimationControllerTest Change-Id: I315df5079b30159fc0f6da2b568af334d14b32a0
This commit is contained in:
1 parent
a81200b8ee
commit
401b9b6614
2 files changed
+47
-27
No files matched your search
@@ -39,6 +39,7 @@ import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.IRemoteAnimationRunner;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
@@ -113,6 +114,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
private final ArrayList<RemoteTransitionCompat> mRemoteTransitions = new ArrayList<>();
|
||||
private IBinder mOriginalTransactionToken = null;
|
||||
private IOnBackInvokedCallback mBackToLauncherCallback;
|
||||
private IRemoteAnimationRunner mBackToLauncherRunner;
|
||||
|
||||
// Used to dedupe calls to SystemUI
|
||||
private int mLastShelfHeight;
|
||||
@@ -207,7 +209,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
registerRecentTasksListener(mRecentTasksListener);
|
||||
}
|
||||
if (mBackAnimation != null && mBackToLauncherCallback != null) {
|
||||
setBackToLauncherCallback(mBackToLauncherCallback);
|
||||
setBackToLauncherCallback(mBackToLauncherCallback, mBackToLauncherRunner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,13 +874,15 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
//
|
||||
|
||||
/** Sets the launcher {@link android.window.IOnBackInvokedCallback} to shell */
|
||||
public void setBackToLauncherCallback(IOnBackInvokedCallback callback) {
|
||||
public void setBackToLauncherCallback(IOnBackInvokedCallback callback,
|
||||
IRemoteAnimationRunner runner) {
|
||||
mBackToLauncherCallback = callback;
|
||||
mBackToLauncherRunner = runner;
|
||||
if (mBackAnimation == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mBackAnimation.setBackToLauncherCallback(callback);
|
||||
mBackAnimation.setBackToLauncherCallback(callback, runner);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed call setBackToLauncherCallback", e);
|
||||
}
|
||||
@@ -893,6 +897,7 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
return;
|
||||
}
|
||||
mBackToLauncherCallback = null;
|
||||
mBackToLauncherRunner = null;
|
||||
if (mBackAnimation == null) {
|
||||
return;
|
||||
}
|
||||
@@ -903,20 +908,6 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies shell that all back to launcher animations have finished (including the transition
|
||||
* that plays after the gesture is committed and before the app is closed.
|
||||
*/
|
||||
public void onBackToLauncherAnimationFinished() {
|
||||
if (mBackAnimation != null) {
|
||||
try {
|
||||
mBackAnimation.onBackToLauncherAnimationFinished();
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call onBackAnimationFinished", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<GroupedRecentTaskInfo> getRecentTasks(int numTasks, int userId) {
|
||||
if (mRecentTasks != null) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user