Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bc11481 authored by Tom Natan's avatar Tom Natan Committed by Android (Google) Code Review
Browse files

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

parents a30e852c d0df97d9
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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.
+14 −3
Original line number Diff line number Diff line
@@ -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
        // - 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 && (mLayout != null
        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;
    }
}