Merge "[10/n] Letterbox Education: don't show if taskbar education is showing."

This commit is contained in:
Tom Natan
2022-02-13 12:20:58 +00:00
committed by Android (Google) Code Review
2 changed files with 27 additions and 3 deletions

View File

@@ -10708,6 +10708,19 @@ public final class Settings {
public static final String HDMI_CEC_SET_MENU_LANGUAGE_DENYLIST =
"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.

View File

@@ -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;
}
}