diff options
| author | 2024-11-01 07:23:52 +0000 | |
|---|---|---|
| committer | 2024-11-01 07:43:00 +0000 | |
| commit | 19c761e2a4f0a471e29c8b8ed1ce8d6d8c3a017c (patch) | |
| tree | 7bd3ccde1ded1a00bf2f1dc52ef0c2a9c2297b82 | |
| parent | 428aef405975f5e07e8e47afaf91823ea3c338a4 (diff) | |
Defer PB animation if previous window cannot show with snapshot.
Disables the `always_capture_activity_snapshot` flag to mitigate
performance regressions and conserve system resources.
With this strategy, the system always makes the previous activity
visible if no snapshot is available. This also defers the predictive
back transition because the system won't add a splash screen window,
which could make the user perceive a lack of immediate feedback during
the transition.
Bug: 362183912
Bug: 374621014
Flag: com.android.window.flags.defer_predictive_animation_if_no_snapshot
Test: simulate the case on b/360782826. Launch several activities with
doesn't opt-in predictive back feature but let the top activity opt-in.
Verify user won't see black screen while back animation start.
Change-Id: I069a5d4a28375554d8e15d43c9ca91c36b7b2a4e
3 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/window/flags/windowing_frontend.aconfig b/core/java/android/window/flags/windowing_frontend.aconfig index 3a035087be7f..cefc058d2216 100644 --- a/core/java/android/window/flags/windowing_frontend.aconfig +++ b/core/java/android/window/flags/windowing_frontend.aconfig @@ -350,6 +350,17 @@ flag {  }  flag { +  name: "defer_predictive_animation_if_no_snapshot" +  namespace: "windowing_frontend" +  description: "If no snapshot for previous window, start animation until the client has draw." +  bug: "374621014" +  is_fixed_read_only: true +  metadata { +      purpose: PURPOSE_BUGFIX +    } +} + +flag {    name: "disallow_app_progress_embedded_window"    namespace: "windowing_frontend"    description: "Pilfer pointers when app transfer input gesture to embedded window." diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java index 2fe023e55d31..86d91998b349 100644 --- a/services/core/java/com/android/server/wm/BackNavigationController.java +++ b/services/core/java/com/android/server/wm/BackNavigationController.java @@ -1550,6 +1550,9 @@ class BackNavigationController {              }              void createStartingSurface(@Nullable TaskSnapshot snapshot) { +                if (Flags.deferPredictiveAnimationIfNoSnapshot() && snapshot == null) { +                    return; +                }                  if (mAdaptors[0].mSwitchType == DIALOG_CLOSE) {                      return;                  } diff --git a/services/core/java/com/android/server/wm/SnapshotController.java b/services/core/java/com/android/server/wm/SnapshotController.java index 52994c70f183..3ee2e6048634 100644 --- a/services/core/java/com/android/server/wm/SnapshotController.java +++ b/services/core/java/com/android/server/wm/SnapshotController.java @@ -152,7 +152,10 @@ class SnapshotController {                  if (mOpenActivities.isEmpty()) {                      return false;                  } -                if (Flags.alwaysCaptureActivitySnapshot()) { +                // TODO (b/362183912) always capture activity snapshot will cause performance +                //  regression, remove flag after ramp up +                if (!Flags.deferPredictiveAnimationIfNoSnapshot() +                        && Flags.alwaysCaptureActivitySnapshot()) {                      return true;                  }                  for (int i = mOpenActivities.size() - 1; i >= 0; --i) {  |