Merge "Show Reachability only once per user on device lifetime" into tm-qpr-dev am: fa30f6e5d7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22237105 Change-Id: Iafe5664dc8da2823ead29dc4dfad5cec7a1a4333 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -156,15 +156,13 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi
|
|||||||
|
|
||||||
void setDontShowReachabilityEducationAgain(TaskInfo taskInfo) {
|
void setDontShowReachabilityEducationAgain(TaskInfo taskInfo) {
|
||||||
mCompatUISharedPreferences.edit().putBoolean(
|
mCompatUISharedPreferences.edit().putBoolean(
|
||||||
getDontShowAgainReachabilityEduKey(taskInfo.userId,
|
getDontShowAgainReachabilityEduKey(taskInfo.userId), true).apply();
|
||||||
taskInfo.topActivity.getPackageName()), true).apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean shouldShowReachabilityEducation(@NonNull TaskInfo taskInfo) {
|
boolean shouldShowReachabilityEducation(@NonNull TaskInfo taskInfo) {
|
||||||
return getHasSeenLetterboxEducation(taskInfo.userId)
|
return getHasSeenLetterboxEducation(taskInfo.userId)
|
||||||
&& !mCompatUISharedPreferences.getBoolean(
|
&& !mCompatUISharedPreferences.getBoolean(
|
||||||
getDontShowAgainReachabilityEduKey(taskInfo.userId,
|
getDontShowAgainReachabilityEduKey(taskInfo.userId), /* default= */false);
|
||||||
taskInfo.topActivity.getPackageName()), /* default= */false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean getHasSeenLetterboxEducation(int userId) {
|
boolean getHasSeenLetterboxEducation(int userId) {
|
||||||
@@ -206,8 +204,8 @@ public class CompatUIConfiguration implements DeviceConfig.OnPropertiesChangedLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getDontShowAgainReachabilityEduKey(int userId, String packageName) {
|
private static String getDontShowAgainReachabilityEduKey(int userId) {
|
||||||
return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "_" + packageName + "@" + userId;
|
return HAS_SEEN_REACHABILITY_EDUCATION_KEY_PREFIX + "@" + userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getDontShowLetterboxEduKey(int userId) {
|
private static String getDontShowLetterboxEduKey(int userId) {
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ import org.mockito.Captor;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,6 +120,18 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase {
|
|||||||
mExecutor = new TestShellExecutor();
|
mExecutor = new TestShellExecutor();
|
||||||
mCompatUIConfiguration = new CompatUIConfiguration(mContext, mExecutor) {
|
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
|
@Override
|
||||||
protected String getCompatUISharedPreferenceName() {
|
protected String getCompatUISharedPreferenceName() {
|
||||||
return TEST_COMPAT_UI_SHARED_PREFERENCES;
|
return TEST_COMPAT_UI_SHARED_PREFERENCES;
|
||||||
|
|||||||
Reference in New Issue
Block a user