diff options
| author | 2022-02-13 12:20:58 +0000 | |
|---|---|---|
| committer | 2022-02-13 12:20:58 +0000 | |
| commit | 4bc114811fdb5e31f3aac27b6a1a18c4149f53ee (patch) | |
| tree | 03dcc42e37b40048bf6091298711217074ec1856 | |
| parent | a30e852c4093bf8f3a6a1825d4a45ff2e9fc541f (diff) | |
| parent | d0df97d939c6ef81bff7d841cea4a38cf259a369 (diff) | |
Merge "[10/n] Letterbox Education: don't show if taskbar education is showing."
| -rw-r--r-- | core/java/android/provider/Settings.java | 13 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java | 17 |
2 files changed, 27 insertions, 3 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 464567b85270..ea20ed42ee14 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -10709,6 +10709,19 @@ public final class Settings { "hdmi_cec_set_menu_language_denylist"; /** + * Whether the Taskbar Education is about to be shown or is currently showing. + * + * <p>1 if true, 0 or unset otherwise. + * + * <p>This setting is used to inform other components that the Taskbar Education is + * currently showing, which can prevent them from showing something else to the user. + * + * @hide + */ + public static final String LAUNCHER_TASKBAR_EDUCATION_SHOWING = + "launcher_taskbar_education_showing"; + + /** * These entries are considered common between the personal and the managed profile, * since the managed profile doesn't get to change them. */ diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java index c461ebcb55ea..074610bfce49 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java @@ -16,11 +16,14 @@ package com.android.wm.shell.compatui.letterboxedu; +import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING; + import android.annotation.Nullable; import android.app.TaskInfo; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Rect; +import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; @@ -93,9 +96,12 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { @Override protected boolean eligibleToShowLayout() { - // If the layout isn't null then it was previously showing, and we shouldn't check if the - // user has seen the letterbox education before. - return mEligibleForLetterboxEducation && (mLayout != null + // - If taskbar education is showing, the letterbox education shouldn't be shown for the + // given task until the taskbar education is dismissed and the compat info changes (then + // the controller will create a new instance of this class since this one isn't eligible). + // - If the layout isn't null then it was previously showing, and we shouldn't check if the + // user has seen the letterbox education before. + return mEligibleForLetterboxEducation && !isTaskbarEduShowing() && (mLayout != null || !getHasSeenLetterboxEducation()); } @@ -173,4 +179,9 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { private String getPrefKey() { return String.valueOf(mContext.getUserId()); } + + private boolean isTaskbarEduShowing() { + return Settings.Secure.getInt(mContext.getContentResolver(), + LAUNCHER_TASKBAR_EDUCATION_SHOWING, /* def= */ 0) == 1; + } } |