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
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index 4dc2851..e7ec7b6 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 @@
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 @@
} finally {
Binder.restoreCallingIdentity(origId);
}
- SafeActivityOptions.abort(options);
}
boolean checkAppSwitchAllowedLocked(int sourcePid, int sourceUid,