Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIConfiguration.java +4 −6 Original line number Diff line number Diff line Loading @@ -156,15 +156,13 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi void setDontShowReachabilityEducationAgain(TaskInfo taskInfo) { mCompatUISharedPreferences.edit().putBoolean( getDontShowAgainReachabilityEduKey(taskInfo.userId, taskInfo.topActivity.getPackageName()), true).apply(); getDontShowAgainReachabilityEduKey(taskInfo.userId), true).apply(); } boolean shouldShowReachabilityEducation(@NonNull TaskInfo taskInfo) { return getHasSeenLetterboxEducation(taskInfo.userId) && !mCompatUISharedPreferences.getBoolean( getDontShowAgainReachabilityEduKey(taskInfo.userId, taskInfo.topActivity.getPackageName()), /* default= */false); getDontShowAgainReachabilityEduKey(taskInfo.userId), /* default= */false); } boolean getHasSeenLetterboxEducation(int userId) { Loading Loading @@ -206,8 +204,8 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi } } private static String getDontShowAgainReachabilityEduKey(int userId, String packageName) { return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "_" + packageName + "@" + userId; private static String getDontShowAgainReachabilityEduKey(int userId) { return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "@" + userId; } private static String getDontShowLetterboxEduKey(int userId) { Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/LetterboxEduWindowManagerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; /** Loading Loading @@ -118,6 +120,18 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase { mExecutor = new TestShellExecutor(); mCompatUIConfiguration = new CompatUIConfiguration(mContext, mExecutor) { final Set<Integer> mHasSeenSet = new HashSet<>(); @Override boolean getHasSeenLetterboxEducation(int userId) { return mHasSeenSet.contains(userId); } @Override void setSeenLetterboxEducation(int userId) { mHasSeenSet.add(userId); } @Override protected String getCompatUISharedPreferenceName() { return TEST_COMPAT_UI_SHARED_PREFERENCES; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIConfiguration.java +4 −6 Original line number Diff line number Diff line Loading @@ -156,15 +156,13 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi void setDontShowReachabilityEducationAgain(TaskInfo taskInfo) { mCompatUISharedPreferences.edit().putBoolean( getDontShowAgainReachabilityEduKey(taskInfo.userId, taskInfo.topActivity.getPackageName()), true).apply(); getDontShowAgainReachabilityEduKey(taskInfo.userId), true).apply(); } boolean shouldShowReachabilityEducation(@NonNull TaskInfo taskInfo) { return getHasSeenLetterboxEducation(taskInfo.userId) && !mCompatUISharedPreferences.getBoolean( getDontShowAgainReachabilityEduKey(taskInfo.userId, taskInfo.topActivity.getPackageName()), /* default= */false); getDontShowAgainReachabilityEduKey(taskInfo.userId), /* default= */false); } boolean getHasSeenLetterboxEducation(int userId) { Loading Loading @@ -206,8 +204,8 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi } } private static String getDontShowAgainReachabilityEduKey(int userId, String packageName) { return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "_" + packageName + "@" + userId; private static String getDontShowAgainReachabilityEduKey(int userId) { return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "@" + userId; } private static String getDontShowLetterboxEduKey(int userId) { Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/LetterboxEduWindowManagerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; /** Loading Loading @@ -118,6 +120,18 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase { mExecutor = new TestShellExecutor(); mCompatUIConfiguration = new CompatUIConfiguration(mContext, mExecutor) { final Set<Integer> mHasSeenSet = new HashSet<>(); @Override boolean getHasSeenLetterboxEducation(int userId) { return mHasSeenSet.contains(userId); } @Override void setSeenLetterboxEducation(int userId) { mHasSeenSet.add(userId); } @Override protected String getCompatUISharedPreferenceName() { return TEST_COMPAT_UI_SHARED_PREFERENCES; Loading