Merge "Temporary decouple snapshot controller from transition." into udc-dev

This commit is contained in:
Wei Sheng Shih
2023-03-23 12:24:50 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 2 deletions

View File

@@ -191,6 +191,9 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
* Prepare to handle on transition start. Clear all temporary fields.
*/
void preTransitionStart() {
if (shouldDisableSnapshots()) {
return;
}
resetTmpFields();
}
@@ -283,6 +286,9 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
* Called when the visibility of an app changes outside the regular app transition flow.
*/
void notifyAppVisibilityChanged(ActivityRecord appWindowToken, boolean visible) {
if (shouldDisableSnapshots()) {
return;
}
if (!visible) {
resetTmpFields();
addBelowTopActivityIfExist(appWindowToken.getTask(), mPendingRemoveActivity,

View File

@@ -213,8 +213,12 @@ class SnapshotController {
void notifyAppVisibilityChanged(ActivityRecord appWindowToken, boolean visible) {
if (!visible && hasTransitionStateConsumer(TASK_CLOSE)) {
final Task task = appWindowToken.getTask();
if (task == null || task.isVisibleRequested()) {
return;
}
// close task transition
addTransitionRecord(TASK_CLOSE, false /*open*/, appWindowToken.getTask());
addTransitionRecord(TASK_CLOSE, false /*open*/, task);
mActivitySnapshotController.preTransitionStart();
notifyTransition(TASK_CLOSE);
mActivitySnapshotController.postTransitionStart();

View File

@@ -1227,7 +1227,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// transferred. If transition is transient, IME won't be moved during the transition and
// the tasks are still live, so we take the snapshot at the end of the transition instead.
if (mTransientLaunches == null) {
mController.mSnapshotController.onTransitionReady(mType, mParticipants);
for (int i = mParticipants.size() - 1; i >= 0; --i) {
final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
if (ar == null || ar.getTask() == null
|| ar.getTask().isVisibleRequested()) continue;
mController.mSnapshotController.mTaskSnapshotController.recordSnapshot(
ar.getTask(), false /* allowSnapshotHome */);
}
}
// This is non-null only if display has changes. It handles the visible windows that don't