diff options
| author | 2018-09-25 18:11:54 -0700 | |
|---|---|---|
| committer | 2018-09-26 11:43:31 -0700 | |
| commit | d024368b7eefa0d48643e43a7be18c4cde6f9cc7 (patch) | |
| tree | 64e0057fa938a7757b18d0891c13d7d45fbc8c83 | |
| parent | c3c71728cee2d4054a165e2e664302e6d99bab5e (diff) | |
Only abort activity options when failing to bring a task to front
- If the activity options has a start callback, abort will prematurely
call the callback prior to the app actually being good to go (and starting
the app transition)
- Also exposing custom activity options call with callback to Launcher
Bug: 111896388
Test: Make change with launcher to defer hiding the task view until the
transition-start callback, check that swiping down does not flicker
Change-Id: Ie19a38ed81b62057957b3ebfc119d5348468818b
| -rw-r--r-- | packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java | 15 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityTaskManagerService.java | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java index 36fb3a7b4307..7154f5396fbd 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java @@ -21,6 +21,8 @@ import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LE import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import android.app.ActivityOptions; +import android.content.Context; +import android.os.Handler; /** * Wrapper around internal ActivityOptions creation. @@ -43,4 +45,17 @@ public abstract class ActivityOptionsCompat { RemoteAnimationAdapterCompat remoteAnimationAdapter) { return ActivityOptions.makeRemoteAnimation(remoteAnimationAdapter.getWrapped()); } + + public static ActivityOptions makeCustomAnimation(Context context, int enterResId, + int exitResId, final Runnable callback, final Handler callbackHandler) { + return ActivityOptions.makeCustomAnimation(context, enterResId, exitResId, callbackHandler, + new ActivityOptions.OnAnimationStartedListener() { + @Override + public void onAnimationStarted() { + if (callback != null) { + callbackHandler.post(callback); + } + } + }); + } } diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java index 4dc28510c5ec..e7ec7b6c05eb 100644 --- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java @@ -1956,10 +1956,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId); if (task == null) { Slog.d(TAG, "Could not find task for id: "+ taskId); + SafeActivityOptions.abort(options); return; } if (getLockTaskController().isLockTaskModeViolation(task)) { Slog.e(TAG, "moveTaskToFront: Attempt to violate Lock Task Mode"); + SafeActivityOptions.abort(options); return; } ActivityOptions realOptions = options != null @@ -1979,7 +1981,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } finally { Binder.restoreCallingIdentity(origId); } - SafeActivityOptions.abort(options); } boolean checkAppSwitchAllowedLocked(int sourcePid, int sourceUid, |