From 89becc4c2bf5153d5cefb5e3dc11a39a35a15312 Mon Sep 17 00:00:00 2001 From: tomnatan Date: Mon, 7 Feb 2022 16:36:45 +0000 Subject: [PATCH] [8/n] Letterbox Education: display education only after starting window is removed. If we ignore the starting window, the letterbox education can be displayed and them immediately removed during splash screen. Bug: 215513996 Test: N/A Change-Id: I2e837facca4a9744effa94e44838973d9c8f180d --- .../com/android/server/wm/ActivityRecord.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index bb33e6ff71111..fd5893623021c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2504,10 +2504,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void removeStartingWindow() { + boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation(); + if (transferSplashScreenIfNeeded()) { return; } removeStartingWindowAnimation(true /* prepareAnimation */); + + // TODO(b/215316431): Add tests + final Task task = getTask(); + if (prevEligibleForLetterboxEducation != isEligibleForLetterboxEducation() + && task != null) { + // Trigger TaskInfoChanged to update the letterbox education. + task.dispatchTaskInfoChangedIfNeeded(true /* force */); + } } void removeStartingWindowAnimation(boolean prepareAnimation) { @@ -7701,6 +7711,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A *
  • The activity is eligible for fixed orientation letterbox. *
  • The activity is in fullscreen. *
  • The activity is portrait-only. + *
  • The activity doesn't have a starting window (education should only be displayed + * once the starting window is removed in {@link #removeStartingWindow}). * */ // TODO(b/215316431): Add tests @@ -7708,7 +7720,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mWmService.mLetterboxConfiguration.getIsEducationEnabled() && mIsEligibleForFixedOrientationLetterbox && getWindowingMode() == WINDOWING_MODE_FULLSCREEN - && getRequestedConfigurationOrientation() == ORIENTATION_PORTRAIT; + && getRequestedConfigurationOrientation() == ORIENTATION_PORTRAIT + && mStartingWindow == null; } /**