Merge "Migrate the "Use this SIM" preference" into main
diff --git a/res/xml/user_aspect_ratio_details.xml b/res/xml/user_aspect_ratio_details.xml
index 44a7589..24c3271 100644
--- a/res/xml/user_aspect_ratio_details.xml
+++ b/res/xml/user_aspect_ratio_details.xml
@@ -28,7 +28,8 @@
settings:searchable="false"/>
<com.android.settingslib.widget.ActionButtonsPreference
- android:key="header_view" />
+ android:key="header_view"
+ android:order="-999"/>
<com.android.settings.applications.appcompat.RadioWithImagePreference
android:key="app_default_pref"
diff --git a/src/com/android/settings/SettingsInitialize.java b/src/com/android/settings/SettingsInitialize.java
index c0c0777..297bad7 100644
--- a/src/com/android/settings/SettingsInitialize.java
+++ b/src/com/android/settings/SettingsInitialize.java
@@ -118,7 +118,8 @@
}
private void privateProfileSetup(Context context, PackageManager pm, UserInfo userInfo) {
- if (Flags.allowPrivateProfile()) {
+ if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
if (userInfo == null || !userInfo.isPrivateProfile()) {
return;
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 108e331..6e36ee3 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1228,6 +1228,7 @@
UserProperties userProperties = userManager.getUserProperties(userHandle);
if (userProperties.getShowInSettings() == UserProperties.SHOW_IN_SETTINGS_SEPARATE) {
if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userProperties.getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN) {
if (!userManager.isQuietModeEnabled(userHandle)) {
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index 2d862d6..4f03303 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -311,11 +311,10 @@
// should be shown or not.
if (((profile.isManagedProfile()
&& (mType & ProfileSelectFragment.ProfileType.WORK) != 0)
- || (Flags.allowPrivateProfile()
- && profile.isPrivateProfile()
+ || (isPrivateProfile(profile)
&& (mType & ProfileSelectFragment.ProfileType.PRIVATE) != 0)
|| (!profile.isManagedProfile()
- && !(Flags.allowPrivateProfile() && profile.isPrivateProfile())
+ && !isPrivateProfile(profile)
&& (mType & ProfileSelectFragment.ProfileType.PERSONAL) != 0))
&& !(mUm.getUserProperties(profile.getUserHandle())
.getShowInQuietMode() == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN
@@ -338,6 +337,12 @@
mFragment.forceUpdatePreferences();
}
+ private static boolean isPrivateProfile(UserInfo profile) {
+ return Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && profile.isPrivateProfile();
+ }
+
private void updateProfileUi(final UserInfo userInfo) {
if (mFragment.getPreferenceManager() == null) {
return;
diff --git a/src/com/android/settings/applications/appcompat/UserAspectRatioDetails.java b/src/com/android/settings/applications/appcompat/UserAspectRatioDetails.java
index ef054df..cbc5a7b 100644
--- a/src/com/android/settings/applications/appcompat/UserAspectRatioDetails.java
+++ b/src/com/android/settings/applications/appcompat/UserAspectRatioDetails.java
@@ -66,7 +66,8 @@
private static final String TAG = UserAspectRatioDetails.class.getSimpleName();
private static final String KEY_HEADER_SUMMARY = "app_aspect_ratio_summary";
- private static final String KEY_HEADER_BUTTONS = "header_view";
+ @VisibleForTesting
+ static final String KEY_HEADER_BUTTONS = "header_view";
private static final String KEY_PREF_HALF_SCREEN = "half_screen_pref";
private static final String KEY_PREF_DISPLAY_SIZE = "display_size_pref";
@@ -237,6 +238,7 @@
return;
}
pref.setTitle(mUserAspectRatioManager.getAccessibleEntry(aspectRatio, mPackageName));
+ pref.setOrder(getAspectRatioManager().getUserMinAspectRatioOrder(aspectRatio));
pref.setOnClickListener(this);
mKeyToAspectRatioMap.put(key, aspectRatio);
mAspectRatioPreferences.add(pref);
diff --git a/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java b/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
index 3bf6109..0550a9a 100644
--- a/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
+++ b/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
@@ -44,6 +44,7 @@
import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.util.ArrayMap;
+import android.util.SparseIntArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -76,6 +77,7 @@
/** Apps that have launcher entry defined in manifest */
private final Map<Integer, String> mUserAspectRatioMap;
private final Map<Integer, CharSequence> mUserAspectRatioA11yMap;
+ private final SparseIntArray mUserAspectRatioOrder;
public UserAspectRatioManager(@NonNull Context context) {
this(context, AppGlobals.getPackageManager());
@@ -86,6 +88,7 @@
mContext = context;
mIPm = pm;
mUserAspectRatioA11yMap = new ArrayMap<>();
+ mUserAspectRatioOrder = new SparseIntArray();
mUserAspectRatioMap = getUserMinAspectRatioMapping();
}
@@ -153,6 +156,14 @@
}
/**
+ * @return the order of the aspect ratio option corresponding to
+ * config_userAspectRatioOverrideValues
+ */
+ int getUserMinAspectRatioOrder(@PackageManager.UserMinAspectRatio int option) {
+ return mUserAspectRatioOrder.get(option);
+ }
+
+ /**
* Whether user aspect ratio option is specified in
* {@link R.array.config_userAspectRatioOverrideValues}
* and is enabled by device config
@@ -224,7 +235,6 @@
&& isFullscreenCompatChangeEnabled(pkgName, userId);
}
- @VisibleForTesting
boolean isFullscreenCompatChangeEnabled(String pkgName, int userId) {
return CompatChanges.isChangeEnabled(
OVERRIDE_ANY_ORIENTATION_TO_USER, pkgName, UserHandle.of(userId));
@@ -281,6 +291,7 @@
mUserAspectRatioA11yMap.put(aspectRatioVal, accessibleSequence);
}
userMinAspectRatioMap.put(aspectRatioVal, aspectRatioString);
+ mUserAspectRatioOrder.put(aspectRatioVal, i);
}
}
if (!userMinAspectRatioMap.containsKey(USER_MIN_ASPECT_RATIO_UNSET)) {
@@ -290,6 +301,8 @@
if (mIsUserMinAspectRatioAppDefaultFlagEnabled) {
userMinAspectRatioMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
userMinAspectRatioMap.get(USER_MIN_ASPECT_RATIO_UNSET));
+ mUserAspectRatioOrder.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
+ mUserAspectRatioOrder.get(USER_MIN_ASPECT_RATIO_UNSET));
if (mUserAspectRatioA11yMap.containsKey(USER_MIN_ASPECT_RATIO_UNSET)) {
mUserAspectRatioA11yMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
mUserAspectRatioA11yMap.get(USER_MIN_ASPECT_RATIO_UNSET));
diff --git a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminListPreferenceController.java b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminListPreferenceController.java
index 640f21d..86c11c2 100644
--- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminListPreferenceController.java
+++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminListPreferenceController.java
@@ -167,8 +167,9 @@
}
private boolean shouldSkipProfile(UserHandle profile) {
- return android.os.Flags.allowPrivateProfile()
+ return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mUm.isQuietModeEnabled(profile)
&& mUm.getUserProperties(profile).getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
index 53a5554..e8f407b 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
@@ -239,7 +239,9 @@
return WORK_TAB;
}
UserInfo userInfo = UserManager.get(activity).getUserInfo(userId);
- if (Flags.allowPrivateProfile() && userInfo != null && userInfo.isPrivateProfile()) {
+ if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && userInfo != null && userInfo.isPrivateProfile()) {
return PRIVATE_TAB;
}
}
@@ -249,7 +251,9 @@
return WORK_TAB;
}
UserInfo userInfo = UserManager.get(activity).getUserInfo(intentUser);
- if (Flags.allowPrivateProfile() && userInfo != null && userInfo.isPrivateProfile()) {
+ if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && userInfo != null && userInfo.isPrivateProfile()) {
return PRIVATE_TAB;
}
@@ -260,7 +264,7 @@
final DevicePolicyManager devicePolicyManager =
getContext().getSystemService(DevicePolicyManager.class);
- if (Flags.allowPrivateProfile()) {
+ if (Flags.allowPrivateProfile() && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
int tabForPosition =
((ViewPagerAdapter) mViewPager.getAdapter()).getTabForPosition(position);
@@ -331,7 +335,9 @@
ProfileType.WORK,
bundle != null ? bundle.deepCopy() : new Bundle(),
workFragmentConstructor));
- } else if (Flags.allowPrivateProfile() && userInfo.isPrivateProfile()) {
+ } else if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && userInfo.isPrivateProfile()) {
if (!privateSpaceInfoProvider.isPrivateSpaceLocked(context)) {
fragments.add(createAndGetFragment(
ProfileType.PRIVATE,
diff --git a/src/com/android/settings/dashboard/profileselector/UserAdapter.java b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
index c9e49f1..40d1a93 100644
--- a/src/com/android/settings/dashboard/profileselector/UserAdapter.java
+++ b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
@@ -87,6 +87,7 @@
return resources.getString(WORK_CATEGORY_HEADER,
() -> context.getString(com.android.settingslib.R.string.category_work));
} else if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mUserManager.getUserInfo(userId).isPrivateProfile()) {
return resources.getString(PRIVATE_CATEGORY_HEADER,
() -> context.getString(com.android.settingslib.R.string.category_private));
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
index 887fc32..ef542a3 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
@@ -257,6 +257,7 @@
private boolean shouldSkipProfile(UserInfo userInfo) {
return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userInfo.isQuietModeEnabled()
&& mUm.getUserProperties(userInfo.getUserHandle()).getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 631c735..a645300 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -416,6 +416,7 @@
public String getHint(Context context, boolean isAlpha, int type, ProfileType profile) {
if (isAlpha) {
if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& profile.equals(ProfileType.Private)) {
return context.getString(alphaHintForPrivateProfile);
} else if (type == TYPE_FINGERPRINT) {
@@ -433,6 +434,7 @@
}
} else {
if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& profile.equals(ProfileType.Private)) {
return context.getString(numericHintForPrivateProfile);
} else if (type == TYPE_FINGERPRINT) {
@@ -1147,7 +1149,9 @@
/*flags=*/0).getSystemService(UserManager.class);
if (userManager.isManagedProfile()) {
return ProfileType.Managed;
- } else if (android.os.Flags.allowPrivateProfile() && userManager.isPrivateProfile()) {
+ } else if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && userManager.isPrivateProfile()) {
return ProfileType.Private;
} else if (userManager.isProfile()) {
return ProfileType.Other;
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 8d0aebe..c331991 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -478,7 +478,9 @@
.getString(SET_WORK_PROFILE_PATTERN_HEADER,
() -> getString(
R.string.lockpassword_choose_your_profile_pattern_header));
- } else if (android.os.Flags.allowPrivateProfile() && isPrivateProfile()) {
+ } else if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && isPrivateProfile()) {
msg = getString(R.string.private_space_choose_your_pattern_header);
} else {
msg = getString(R.string.lockpassword_choose_your_pattern_header);
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index f2ebd1f..cf80513 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -300,6 +300,7 @@
launchedCDC = true;
}
} else if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userProperties != null
&& userProperties.isAuthAlwaysRequiredToDisableQuietMode()
&& isInternalActivity()) {
@@ -413,7 +414,8 @@
private boolean doesUserStateEnforceStrongAuth(int userId) {
if (android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()) {
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
// Check if CE storage for user is locked since biometrics can't unlock fbe/keystore of
// the profile user using verifyTiedProfileChallenge. Biometrics can still be used if
// the user is stopped with delayed locking (i.e., with storage unlocked), so the user
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
index 32e7489..e3182a4 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
@@ -105,7 +105,8 @@
private static boolean isBiometricUnlockEnabledForPrivateSpace() {
return android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace();
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures();
}
/**
diff --git a/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java b/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
index 1f0f7bb..7f0118c 100644
--- a/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
+++ b/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
@@ -104,7 +104,8 @@
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(savedInstanceState);
}
}
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceController.java b/src/com/android/settings/privatespace/HidePrivateSpaceController.java
index a53055c..903defa 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceController.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceController.java
@@ -38,7 +38,10 @@
@Override
@AvailabilityStatus
public int getAvailabilityStatus() {
- return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsController.java b/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsController.java
index 1a89d37..6cb54a1 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsController.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsController.java
@@ -52,6 +52,7 @@
public int getAvailabilityStatus() {
if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePsSensitiveNotificationsToggle()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()
|| !mPrivateSpaceMaintainer.doesPrivateSpaceExist()) {
return UNSUPPORTED_ON_DEVICE;
}
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java b/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
index 124978a..c41267f 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
@@ -27,7 +27,8 @@
@Override
public void onCreate(Bundle icicle) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle);
}
}
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java b/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
index 42627af..a366b70 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
@@ -36,7 +36,10 @@
@Override
public int getAvailabilityStatus() {
- return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
index 12a7440..f2a50dc 100644
--- a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
+++ b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
@@ -59,7 +59,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return;
}
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
diff --git a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
index 63b1dc9..53d6b22 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
@@ -77,7 +77,8 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (Flags.allowPrivateProfile()) {
+ if (Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
ThemeHelper.trySetDynamicColor(this);
mPrivateSpaceMaintainer =
new Injector().injectPrivateSpaceMaintainer(getApplicationContext());
diff --git a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
index 726567e..32db8b6 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
@@ -32,7 +32,8 @@
@Override
public void onCreate(Bundle icicle) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle);
if (icicle == null
&& getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) {
diff --git a/src/com/android/settings/privatespace/PrivateSpaceEducation.java b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
index 4c99873..cf22895 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceEducation.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
@@ -43,7 +43,8 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null;
}
GlifLayout rootView =
diff --git a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
index 2d38ae2..3fb9b15 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
@@ -78,7 +78,8 @@
*/
@VisibleForTesting
public final synchronized boolean createPrivateSpace() {
- if (!Flags.allowPrivateProfile()) {
+ if (!Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false;
}
// Check if Private space already exists
@@ -146,7 +147,8 @@
/** Returns true if the Private space exists. */
public synchronized boolean doesPrivateSpaceExist() {
- if (!Flags.allowPrivateProfile()) {
+ if (!Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false;
}
if (mUserHandle != null) {
@@ -322,6 +324,7 @@
private boolean isPrivateSpaceAutoLockSupported() {
return android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.supportAutolockForPrivateSpace();
+ && android.multiuser.Flags.supportAutolockForPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures();
}
}
diff --git a/src/com/android/settings/privatespace/PrivateSpaceSafetySource.java b/src/com/android/settings/privatespace/PrivateSpaceSafetySource.java
index 6729830..4e1741a 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceSafetySource.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceSafetySource.java
@@ -51,7 +51,8 @@
return;
}
- if (!Flags.allowPrivateProfile()) {
+ if (!Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
// Setting null safetySourceData so that an old entry gets cleared out and this way
// provide a response since SC always expects one on rescan.
SafetyCenterManagerWrapper.get().setSafetySourceData(
diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
index 4a1e29b..399c2c8 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
@@ -51,7 +51,8 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null;
}
GlifLayout rootView =
diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
index 78c96dc..ec7132a 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
@@ -42,7 +42,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return;
}
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
diff --git a/src/com/android/settings/privatespace/SetupSuccessFragment.java b/src/com/android/settings/privatespace/SetupSuccessFragment.java
index 13de1fc..cf63b22 100644
--- a/src/com/android/settings/privatespace/SetupSuccessFragment.java
+++ b/src/com/android/settings/privatespace/SetupSuccessFragment.java
@@ -47,7 +47,8 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null;
}
GlifLayout rootView =
diff --git a/src/com/android/settings/privatespace/autolock/AutoLockPreferenceController.java b/src/com/android/settings/privatespace/autolock/AutoLockPreferenceController.java
index a7a12a4..3416e14 100644
--- a/src/com/android/settings/privatespace/autolock/AutoLockPreferenceController.java
+++ b/src/com/android/settings/privatespace/autolock/AutoLockPreferenceController.java
@@ -40,7 +40,8 @@
@Override
public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.supportAutolockForPrivateSpace()
+ && android.multiuser.Flags.supportAutolockForPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
diff --git a/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragment.java b/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragment.java
index 4380c53..cb332d1 100644
--- a/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragment.java
+++ b/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragment.java
@@ -47,7 +47,8 @@
@Override
public void onCreate(@NonNull Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.supportAutolockForPrivateSpace()) {
+ && android.multiuser.Flags.supportAutolockForPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle);
}
}
diff --git a/src/com/android/settings/privatespace/delete/DeletePrivateSpaceController.java b/src/com/android/settings/privatespace/delete/DeletePrivateSpaceController.java
index af4535e..a2fc6f8 100644
--- a/src/com/android/settings/privatespace/delete/DeletePrivateSpaceController.java
+++ b/src/com/android/settings/privatespace/delete/DeletePrivateSpaceController.java
@@ -34,7 +34,10 @@
@Override
public int getAvailabilityStatus() {
- return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteActivity.java b/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteActivity.java
index a4109b8..b483aa3 100644
--- a/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteActivity.java
+++ b/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteActivity.java
@@ -35,7 +35,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
- if (!android.os.Flags.allowPrivateProfile()) {
+ if (!android.os.Flags.allowPrivateProfile()
+ || !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return;
}
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
diff --git a/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragment.java b/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragment.java
index 7dd3a5b..bcc220f 100644
--- a/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragment.java
+++ b/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragment.java
@@ -56,7 +56,8 @@
@Override
public void onCreate(@Nullable Bundle icicle) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle);
}
}
diff --git a/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragment.java b/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragment.java
index 3a16641..33f0a3e 100644
--- a/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragment.java
+++ b/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragment.java
@@ -62,7 +62,8 @@
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(savedInstanceState);
}
}
diff --git a/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java b/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
index 2e3f284..04f4894 100644
--- a/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
+++ b/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
@@ -42,6 +42,7 @@
protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mProfileUserId != UserHandle.USER_NULL;
}
diff --git a/src/com/android/settings/privatespace/onelock/PrivateSpaceBiometricSettings.java b/src/com/android/settings/privatespace/onelock/PrivateSpaceBiometricSettings.java
index dc00885..827f0b7 100644
--- a/src/com/android/settings/privatespace/onelock/PrivateSpaceBiometricSettings.java
+++ b/src/com/android/settings/privatespace/onelock/PrivateSpaceBiometricSettings.java
@@ -34,7 +34,8 @@
@Override
public void onAttach(Context context) {
if (android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()) {
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onAttach(context);
UserHandle privateProfileHandle =
PrivateSpaceMaintainer.getInstance(context).getPrivateProfileHandle();
diff --git a/src/com/android/settings/privatespace/onelock/PrivateSpaceFacePreferenceController.java b/src/com/android/settings/privatespace/onelock/PrivateSpaceFacePreferenceController.java
index b841d9a..583a093 100644
--- a/src/com/android/settings/privatespace/onelock/PrivateSpaceFacePreferenceController.java
+++ b/src/com/android/settings/privatespace/onelock/PrivateSpaceFacePreferenceController.java
@@ -45,6 +45,7 @@
protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& getUserId() != UserHandle.USER_NULL;
}
@@ -63,7 +64,8 @@
@Override
public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
diff --git a/src/com/android/settings/privatespace/onelock/PrivateSpaceFingerprintPreferenceController.java b/src/com/android/settings/privatespace/onelock/PrivateSpaceFingerprintPreferenceController.java
index d484904..f88c9fa 100644
--- a/src/com/android/settings/privatespace/onelock/PrivateSpaceFingerprintPreferenceController.java
+++ b/src/com/android/settings/privatespace/onelock/PrivateSpaceFingerprintPreferenceController.java
@@ -47,6 +47,7 @@
protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
&& getUserId() != UserHandle.USER_NULL;
}
@@ -65,7 +66,8 @@
@Override
public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile()
- && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
diff --git a/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java b/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
index efbe9f9..e0f376e 100644
--- a/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
+++ b/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
@@ -74,7 +74,8 @@
@Override
public boolean isAvailable() {
- return android.os.Flags.allowPrivateProfile();
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures();
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockController.java b/src/com/android/settings/privatespace/onelock/UseOneLockController.java
index 31634b9..1af36b3 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockController.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockController.java
@@ -45,7 +45,10 @@
}
@Override
public int getAvailabilityStatus() {
- return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java b/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
index fd7d02b..680f5c7 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
@@ -95,7 +95,8 @@
@Override
public boolean isAvailable() {
- return android.os.Flags.allowPrivateProfile();
+ return android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures();
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java b/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
index 413e02a..ce017e3 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
@@ -39,7 +39,8 @@
@Override
public void onCreate(Bundle icicle) {
- if (android.os.Flags.allowPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle);
}
}
diff --git a/src/com/android/settings/safetycenter/BiometricsSafetySource.java b/src/com/android/settings/safetycenter/BiometricsSafetySource.java
index 8e1c786..c93ced1 100644
--- a/src/com/android/settings/safetycenter/BiometricsSafetySource.java
+++ b/src/com/android/settings/safetycenter/BiometricsSafetySource.java
@@ -62,7 +62,9 @@
}
final Context profileParentContext =
context.createContextAsUser(profileParentUserHandle, 0);
- if (android.os.Flags.allowPrivateProfile() && userManager.isPrivateProfile()) {
+ if (android.os.Flags.allowPrivateProfile()
+ && android.multiuser.Flags.enablePrivateSpaceFeatures()
+ && userManager.isPrivateProfile()) {
// SC always expects a response from the source if the broadcast has been sent for this
// source, therefore, we need to send a null SafetySourceData.
SafetyCenterManagerWrapper.get().setSafetySourceData(
diff --git a/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProvider.kt b/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProvider.kt
index 15cd1ba..3241d71 100644
--- a/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProvider.kt
+++ b/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProvider.kt
@@ -62,6 +62,7 @@
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
import com.android.settingslib.spaprivileged.template.app.AppListPage
import com.google.common.annotations.VisibleForTesting
+import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
@@ -130,8 +131,10 @@
val canDisplay: Boolean,
) : AppRecord
-class UserAspectRatioAppListModel(private val context: Context)
- : AppListModel<UserAspectRatioAppListItemModel> {
+class UserAspectRatioAppListModel(
+ private val context: Context,
+ private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
+) : AppListModel<UserAspectRatioAppListItemModel> {
private val packageManager = context.packageManager
private val userAspectRatioManager = UserAspectRatioManager(context)
@@ -203,7 +206,7 @@
flow {
emit(userAspectRatioManager.getUserMinAspectRatioEntry(record.userOverride,
record.app.packageName, record.app.userId))
- }.flowOn(Dispatchers.IO)
+ }.flowOn(ioDispatcher)
}.collectAsStateWithLifecycle(initialValue = stringResource(R.string.summary_placeholder))
return { summary }
}
diff --git a/tests/robotests/src/com/android/settings/applications/appcompat/UserAspectRatioDetailsTest.java b/tests/robotests/src/com/android/settings/applications/appcompat/UserAspectRatioDetailsTest.java
index f3b105b..ce03a6d 100644
--- a/tests/robotests/src/com/android/settings/applications/appcompat/UserAspectRatioDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appcompat/UserAspectRatioDetailsTest.java
@@ -16,16 +16,19 @@
package com.android.settings.applications.appcompat;
+import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_3_2;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_APP_DEFAULT;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_FULLSCREEN;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_UNSET;
import static com.android.settings.applications.AppInfoBase.ARG_PACKAGE_NAME;
+import static com.android.settings.applications.appcompat.UserAspectRatioDetails.KEY_HEADER_BUTTONS;
import static com.android.settings.applications.appcompat.UserAspectRatioDetails.KEY_PREF_3_2;
import static com.android.settings.applications.appcompat.UserAspectRatioDetails.KEY_PREF_DEFAULT;
import static com.android.settings.applications.appcompat.UserAspectRatioDetails.KEY_PREF_FULLSCREEN;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
@@ -99,6 +102,31 @@
}
@Test
+ public void testOrderOfOptionsFollowsConfig() {
+ doReturn(true).when(mUserAspectRatioManager)
+ .hasAspectRatioOption(anyInt(), anyString());
+ doReturn(0).when(mUserAspectRatioManager)
+ .getUserMinAspectRatioOrder(USER_MIN_ASPECT_RATIO_3_2);
+ doReturn(1).when(mUserAspectRatioManager)
+ .getUserMinAspectRatioOrder(USER_MIN_ASPECT_RATIO_FULLSCREEN);
+ doReturn(2).when(mUserAspectRatioManager)
+ .getUserMinAspectRatioOrder(USER_MIN_ASPECT_RATIO_UNSET);
+ rule.getScenario().onActivity(a -> doReturn(a).when(mFragment).getActivity());
+ final Bundle args = new Bundle();
+ args.putString(ARG_PACKAGE_NAME, anyString());
+ mFragment.setArguments(args);
+ mFragment.onCreate(Bundle.EMPTY);
+
+ final int topOfList = mFragment.findPreference(KEY_HEADER_BUTTONS).getOrder();
+
+ assertTrue(topOfList < mFragment.findPreference(KEY_PREF_3_2).getOrder());
+ assertTrue(mFragment.findPreference(KEY_PREF_3_2).getOrder()
+ < mFragment.findPreference(KEY_PREF_FULLSCREEN).getOrder());
+ assertTrue(mFragment.findPreference(KEY_PREF_FULLSCREEN).getOrder()
+ < mFragment.findPreference(KEY_PREF_DEFAULT).getOrder());
+ }
+
+ @Test
public void onRadioButtonClicked_prefChange_shouldStopActivity() throws RemoteException {
doReturn(USER_MIN_ASPECT_RATIO_UNSET).when(mFragment)
.getSelectedUserMinAspectRatio(anyString());
diff --git a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectFragmentTest.java
index b6af0f9..46e4ea5 100644
--- a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectFragmentTest.java
@@ -174,7 +174,8 @@
@Test
public void getTabId_setPrivateId_getCorrectTab() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
final Bundle bundle = new Bundle();
bundle.putInt(EXTRA_USER_ID, 11);
mUserManager.setPrivateProfile(11, "private", 0);
@@ -204,7 +205,8 @@
@Test
public void testGetFragments_whenOnlyPersonal_returnsOneFragment() {
- mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUserManager.addProfile(
new UserInfo(0, PRIMARY_USER_NAME, null, 0, USER_TYPE_FULL_SYSTEM));
Fragment[] fragments = ProfileSelectFragment.getFragments(
@@ -239,7 +241,8 @@
@Test
public void testGetFragments_whenPrivateEnabled_returnsTwoFragments() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUserManager.addProfile(
new UserInfo(0, PRIMARY_USER_NAME, null, 0, USER_TYPE_FULL_SYSTEM));
mUserManager.addProfile(
@@ -261,7 +264,8 @@
@Test
public void testGetFragments_whenManagedProfile_returnsTwoFragments() {
- mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUserManager.addProfile(
new UserInfo(0, PRIMARY_USER_NAME, null, 0, USER_TYPE_FULL_SYSTEM));
mUserManager.addProfile(
@@ -283,7 +287,8 @@
@Test
public void testGetFragments_whenAllProfiles_returnsThreeFragments() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUserManager.addProfile(
new UserInfo(0, PRIMARY_USER_NAME, null, 0, USER_TYPE_FULL_SYSTEM));
mUserManager.addProfile(
@@ -307,7 +312,8 @@
@Test
public void testGetFragments_whenAvailableBundle_returnsFragmentsWithCorrectBundles() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUserManager.addProfile(
new UserInfo(0, PRIMARY_USER_NAME, null, 0, USER_TYPE_FULL_SYSTEM));
mUserManager.addProfile(
diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
index dfacca8..b859df4 100644
--- a/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
+++ b/tests/spa_unit/src/com/android/settings/spa/app/appcompat/UserAspectRatioAppsPageProviderTest.kt
@@ -32,7 +32,11 @@
import com.android.settingslib.spa.testutils.firstWithTimeoutOrNull
import com.android.settingslib.spaprivileged.template.app.AppListItemModel
import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
+import kotlinx.coroutines.test.StandardTestDispatcher
+import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
@@ -45,6 +49,8 @@
class UserAspectRatioAppsPageProviderTest {
@get:Rule
val composeTestRule = createComposeRule()
+ private val testDispatcher = StandardTestDispatcher()
+ private val testScope = TestScope(testDispatcher)
private val context: Context = ApplicationProvider.getApplicationContext()
private val fakeNavControllerWrapper = FakeNavControllerWrapper()
@@ -137,33 +143,37 @@
}
}
+ @OptIn(ExperimentalCoroutinesApi::class)
@Test
- fun aspectRatioAppListModel_getSummaryDefault() {
- val summary = getSummary(USER_MIN_ASPECT_RATIO_UNSET)
+ fun aspectRatioAppListModel_getSummaryDefault() = testScope.runTest {
+ val summary = setSummary(USER_MIN_ASPECT_RATIO_UNSET)
+ advanceUntilIdle()
- assertThat(summary).isEqualTo(context.getString(R.string.user_aspect_ratio_app_default))
+ assertThat(summary()).isEqualTo(context.getString(R.string.user_aspect_ratio_app_default))
}
+ @OptIn(ExperimentalCoroutinesApi::class)
@Test
- fun aspectRatioAppListModel_getSummaryWhenSplitScreen() {
- val summary = getSummary(USER_MIN_ASPECT_RATIO_SPLIT_SCREEN)
+ fun aspectRatioAppListModel_getSummaryWhenSplitScreen() = testScope.runTest {
+ val summary = setSummary(USER_MIN_ASPECT_RATIO_SPLIT_SCREEN)
+ advanceUntilIdle()
- assertThat(summary).isEqualTo(context.getString(R.string.user_aspect_ratio_half_screen))
+ assertThat(summary()).isEqualTo(context.getString(R.string.user_aspect_ratio_half_screen))
}
- private fun getSummary(userOverride: Int): String {
- val listModel = UserAspectRatioAppListModel(context)
+ private fun setSummary(userOverride: Int): () -> String {
+ val listModel = UserAspectRatioAppListModel(context, testDispatcher)
+ val record = UserAspectRatioAppListItemModel(
+ app = APP,
+ userOverride = userOverride,
+ suggested = false,
+ canDisplay = true,
+ )
lateinit var summary: () -> String
composeTestRule.setContent {
- summary = listModel.getSummary(option = 0,
- record = UserAspectRatioAppListItemModel(
- app = APP,
- userOverride = userOverride,
- suggested = false,
- canDisplay = true,
- ))
+ summary = listModel.getSummary(option = 0, record = record)
}
- return summary()
+ return summary
}
diff --git a/tests/uitests/src/com/android/settings/ui/SecuritySettingsTest.kt b/tests/uitests/src/com/android/settings/ui/SecuritySettingsTest.kt
index b5a4fe9..b792959 100644
--- a/tests/uitests/src/com/android/settings/ui/SecuritySettingsTest.kt
+++ b/tests/uitests/src/com/android/settings/ui/SecuritySettingsTest.kt
@@ -49,7 +49,8 @@
}
@Test
- @RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
+ @RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES)
fun privateSpace_ifFlagON() {
device.assertHasTexts(listOf("Private Space"))
}
diff --git a/tests/uitests/src/com/android/settings/ui/privatespace/PrivateSpaceAuthenticationActivityTest.kt b/tests/uitests/src/com/android/settings/ui/privatespace/PrivateSpaceAuthenticationActivityTest.kt
index 8eadd9d..14feb49 100644
--- a/tests/uitests/src/com/android/settings/ui/privatespace/PrivateSpaceAuthenticationActivityTest.kt
+++ b/tests/uitests/src/com/android/settings/ui/privatespace/PrivateSpaceAuthenticationActivityTest.kt
@@ -38,7 +38,8 @@
@RunWith(AndroidJUnit4::class)
-@RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
+@RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES)
class PrivateSpaceAuthenticationActivityTest {
private val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
diff --git a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
index a671a45..3a330f2 100644
--- a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
@@ -310,7 +310,8 @@
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
mSetFlagsRule.enableFlags(
android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mCombinedBiometricStatusUtils.getPrivateProfileSettingsClassName())
.isEqualTo(Settings.PrivateSpaceBiometricSettingsActivity.class.getName());
diff --git a/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java b/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java
index f1da363..857135f 100644
--- a/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java
@@ -75,7 +75,8 @@
public void getAvailabilityStatus_whenFlagsEnabled_returnsAvailable() {
mSetFlagsRule.enableFlags(
android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mFaceFingerprintUnlockController.isAvailable()).isEqualTo(true);
}
@@ -83,18 +84,33 @@
/** Tests that the controller is not available when Biometrics flag is not enabled. */
@Test
public void getAvailabilityStatus_whenBiometricFlagDisabled_returnsFalse() {
- mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mSetFlagsRule.disableFlags(
android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
assertThat(mFaceFingerprintUnlockController.isAvailable()).isEqualTo(false);
}
- /** Tests that the controller is not available when private feature flag is not enabled. */
+ /**
+ * Tests that the controller is not available when the main private space flag is not
+ * enabled.
+ */
@Test
- public void getAvailabilityStatus_whenPrivateFlagDisabled_returnsFalse() {
+ public void getAvailabilityStatus_whenPsMainFlagDisabled_returnsFalse() {
mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
mSetFlagsRule.enableFlags(
+ android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
+
+ assertThat(mFaceFingerprintUnlockController.isAvailable()).isEqualTo(false);
+ }
+
+ /** Tests that the controller is not available when private features flag is not enabled. */
+ @Test
+ public void getAvailabilityStatus_whenPsFeaturesFlagDisabled_returnsFalse() {
+ mSetFlagsRule.disableFlags(android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
+ mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
assertThat(mFaceFingerprintUnlockController.isAvailable()).isEqualTo(false);
@@ -106,7 +122,8 @@
doReturn(false).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
mSetFlagsRule.enableFlags(
android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFaceFingerprintUnlockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isFalse();
@@ -119,7 +136,8 @@
doReturn(true).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
mSetFlagsRule.enableFlags(
android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_ENABLE_BIOMETRICS_TO_UNLOCK_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFaceFingerprintUnlockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isTrue();
diff --git a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceControllerTest.java b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceControllerTest.java
index 0abe314..b71547b 100644
--- a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceControllerTest.java
@@ -40,7 +40,8 @@
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
-@RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
+@RequiresFlagsEnabled({Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES})
public class HidePrivateSpaceControllerTest {
@Rule
public final CheckFlagsRule mCheckFlagsRule =
diff --git a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsControllerTest.java b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsControllerTest.java
index 1430dfd..88503a5 100644
--- a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSensitiveNotificationsControllerTest.java
@@ -67,7 +67,8 @@
mSetFlagsRule.enableFlags(
android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
- mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateProfileId = PrivateSpaceMaintainer.getInstance(
mContext).getPrivateProfileHandle().getIdentifier();
@@ -143,7 +144,8 @@
public void getAvailabilityStatus_flagDisabled() {
mSetFlagsRule.disableFlags(
android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
- mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1);
Settings.Secure.putInt(mContext.getContentResolver(),
diff --git a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSummaryControllerTest.java b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSummaryControllerTest.java
index 39f7b9c..ed072d3 100644
--- a/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSummaryControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/HidePrivateSpaceSummaryControllerTest.java
@@ -40,7 +40,8 @@
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
-@RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
+@RequiresFlagsEnabled({Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES})
public class HidePrivateSpaceSummaryControllerTest {
@Rule
public final CheckFlagsRule mCheckFlagsRule =
diff --git a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivityTest.java b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivityTest.java
index 4c6feea..8a7bd70 100644
--- a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivityTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivityTest.java
@@ -88,7 +88,8 @@
/** Tests that when Private does not exist setup flow is started. */
//TODO(b/307729746) Plan to add more tests for complete setup flow
@Test
- @RequiresFlagsEnabled(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
+ @RequiresFlagsEnabled({Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES})
public void whenPrivateProfileDoesNotExist_triggersSetupFlow() {
when(mPrivateSpaceMaintainer.doesPrivateSpaceExist()).thenReturn(false);
diff --git a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceLockControllerTest.java b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceLockControllerTest.java
index 0d9db7e..c203a3c 100644
--- a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceLockControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceLockControllerTest.java
@@ -80,7 +80,8 @@
/** Tests that the controller is always available. */
@Test
public void getAvailabilityStatus_returnsAvailable() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mPrivateSpaceLockController.isAvailable()).isEqualTo(true);
}
@@ -89,7 +90,8 @@
@Test
public void getSummary_whenScreenLock() {
doReturn(false).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceLockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isFalse();
@@ -103,7 +105,8 @@
.when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PATTERN)
.when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceLockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isTrue();
@@ -115,7 +118,8 @@
public void getSummary_whenProfileLockPin() {
doReturn(true).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PIN).when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceLockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isTrue();
@@ -129,7 +133,8 @@
.when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PASSWORD)
.when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceLockController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isTrue();
diff --git a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceMaintainerTest.java b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceMaintainerTest.java
index 8510b11..50f67d3 100644
--- a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceMaintainerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceMaintainerTest.java
@@ -148,7 +148,8 @@
public void createPrivateSpace_psDoesNotExist_setsDefaultPsSensitiveNotificationsValue() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE);
+ android.multiuser.Flags.FLAG_ENABLE_PS_SENSITIVE_NOTIFICATIONS_TOGGLE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
PrivateSpaceMaintainer privateSpaceMaintainer =
PrivateSpaceMaintainer.getInstance(mContext);
privateSpaceMaintainer.deletePrivateSpace();
@@ -259,7 +260,8 @@
public void createPrivateSpace_psDoesNotExist_resetsPSAutoLockSettings() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
final int autoLockOption = 2;
PrivateSpaceMaintainer privateSpaceMaintainer =
PrivateSpaceMaintainer.getInstance(mContext);
@@ -282,7 +284,8 @@
public void createPrivateSpace_psExists_doesNotResetPSAutoLockSettings() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
final int privateSpaceAutLockValue = 1;
PrivateSpaceMaintainer privateSpaceMaintainer =
PrivateSpaceMaintainer.getInstance(mContext);
diff --git a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceSafetySourceTest.java b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceSafetySourceTest.java
index cf9ea05..940f70d 100644
--- a/tests/unit/src/com/android/settings/privatespace/PrivateSpaceSafetySourceTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/PrivateSpaceSafetySourceTest.java
@@ -86,7 +86,8 @@
@Test
public void onDeviceRebootedEvent_whenSafetyCenterEnabled_setsData() {
when(mSafetyCenterManagerWrapper.isEnabled(mContext)).thenReturn(true);
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
PrivateSpaceSafetySource.setSafetySourceData(mContext, EVENT_TYPE_DEVICE_REBOOTED);
@@ -98,7 +99,8 @@
@Test
public void setSafetySourceData_whenFeatureDisabled_setsNullData() {
when(mSafetyCenterManagerWrapper.isEnabled(mContext)).thenReturn(true);
- mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
PrivateSpaceSafetySource.setSafetySourceData(mContext, EVENT_TYPE_DEVICE_REBOOTED);
@@ -113,7 +115,8 @@
@Test
public void setSafetySourceData_setsEnabled() {
when(mSafetyCenterManagerWrapper.isEnabled(mContext)).thenReturn(true);
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
PrivateSpaceSafetySource.setSafetySourceData(mContext, EVENT_TYPE_DEVICE_REBOOTED);
@@ -129,7 +132,8 @@
@Test
public void setSafetySourceData_setsPsAuthenticatorIntent() {
when(mSafetyCenterManagerWrapper.isEnabled(mContext)).thenReturn(true);
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
PrivateSpaceSafetySource.setSafetySourceData(mContext, EVENT_TYPE_DEVICE_REBOOTED);
diff --git a/tests/unit/src/com/android/settings/privatespace/UseOneLockControllerTest.java b/tests/unit/src/com/android/settings/privatespace/UseOneLockControllerTest.java
index 744a8ec..5c2a15c 100644
--- a/tests/unit/src/com/android/settings/privatespace/UseOneLockControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/UseOneLockControllerTest.java
@@ -74,7 +74,8 @@
/** Tests that the controller is always available. */
@Test
public void getAvailabilityStatus_returnsAvailable() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mUseOneLockController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@@ -87,7 +88,8 @@
.when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PATTERN)
.when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUseOneLockController.updateState(mPreference);
assertThat(mUseOneLockController.getSummary().toString()).isEqualTo("Pattern");
@@ -99,7 +101,8 @@
doReturn(true)
.when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PIN).when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUseOneLockController.updateState(mPreference);
assertThat(mUseOneLockController.getSummary().toString()).isEqualTo("PIN");
@@ -112,7 +115,8 @@
.when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());
doReturn(CREDENTIAL_TYPE_PASSWORD)
.when(mLockPatternUtils).getCredentialTypeForUser(anyInt());
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mUseOneLockController.updateState(mPreference);
assertThat(mUseOneLockController.getSummary().toString()).isEqualTo("Password");
diff --git a/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockPreferenceControllerTest.java b/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockPreferenceControllerTest.java
index 01381d8..45c2c75 100644
--- a/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockPreferenceControllerTest.java
@@ -75,7 +75,8 @@
public void getAvailabilityStatus_withAutoLockFlagEnabled_returnsAvailable() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mAutoLockPreferenceController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@@ -83,7 +84,8 @@
/** Tests that the controller is not available when auto lock flag is off. */
@Test
public void getAvailabilityStatus_withAutoLockFlagDisabled_returnsNull() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mSetFlagsRule.disableFlags(android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
assertThat(mAutoLockPreferenceController.getAvailabilityStatus())
@@ -98,7 +100,8 @@
public void getSummary_whenOptionEveryTimeDeviceLocks_returnsEveryTimeDeviceLocks() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
Settings.Secure.putInt(
mContentResolver,
@@ -116,7 +119,8 @@
public void getSummary_whenOptionAfter5MinutesOfInactivity_returnsAfter5MinutesOfInactivity() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
Settings.Secure.putInt(
mContentResolver,
@@ -131,7 +135,8 @@
public void getSummary_whenOptionNever_returnsNever() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
Settings.Secure.putInt(
mContentResolver,
diff --git a/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragmentTest.java b/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragmentTest.java
index 971ca40..1c620c0 100644
--- a/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragmentTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/autolock/AutoLockSettingsFragmentTest.java
@@ -94,7 +94,8 @@
public void verifyMetricsConstant() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mFragment.getMetricsCategory()).isEqualTo(SettingsEnums.PRIVATE_SPACE_SETTINGS);
}
@@ -103,7 +104,8 @@
public void getCandidates_returnsCandidateInfoListWithAllKeys() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFragment.onAttach(mContext);
final List<? extends CandidateInfo> candidates = mFragment.getCandidates();
@@ -120,7 +122,8 @@
public void getDefaultKey_returnsStoredAutoLockOptionsValue() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFragment.onAttach(mContext);
@@ -144,7 +147,8 @@
public void setDefaultKey_storesCorrectAutoLockOptionValue() {
mSetFlagsRule.enableFlags(
Flags.FLAG_ALLOW_PRIVATE_PROFILE,
- android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE);
+ android.multiuser.Flags.FLAG_SUPPORT_AUTOLOCK_FOR_PRIVATE_SPACE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFragment.onAttach(mContext);
mFragment.setDefaultKey("2");
diff --git a/tests/unit/src/com/android/settings/privatespace/delete/DeletePrivateSpaceControllerTest.java b/tests/unit/src/com/android/settings/privatespace/delete/DeletePrivateSpaceControllerTest.java
index 371ca24..ed8decd 100644
--- a/tests/unit/src/com/android/settings/privatespace/delete/DeletePrivateSpaceControllerTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/delete/DeletePrivateSpaceControllerTest.java
@@ -58,7 +58,8 @@
/** Tests that the controller is available when private space flag is enabled. */
@Test
public void getAvailabilityStatus_whenPrivateFlagEnabled_returnsAvailable() {
- mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mDeletePrivateSpaceController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@@ -66,7 +67,8 @@
/** Tests that the controller is not available when private space flag is disabled. */
@Test
public void getAvailabilityStatus_whenPrivateFlagDisabled_returnsUnsupportedOnDevice() {
- mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mDeletePrivateSpaceController.getAvailabilityStatus())
.isEqualTo(UNSUPPORTED_ON_DEVICE);
diff --git a/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragmentTest.java b/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragmentTest.java
index 16ccbc4..5c48375 100644
--- a/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragmentTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeleteFragmentTest.java
@@ -39,7 +39,8 @@
@Test
@UiThreadTest
public void verifyMetricsConstant() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mFragment = spy(new PrivateSpaceDeleteFragment());
assertThat(mFragment.getMetricsCategory()).isEqualTo(SettingsEnums.PRIVATE_SPACE_SETTINGS);
}
diff --git a/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragmentTest.java b/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragmentTest.java
index 5c2ef23..ffc1edf 100644
--- a/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragmentTest.java
+++ b/tests/unit/src/com/android/settings/privatespace/delete/PrivateSpaceDeletionProgressFragmentTest.java
@@ -77,7 +77,8 @@
@Test
@UiThreadTest
public void verifyMetricsConstant() {
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
assertThat(mFragment.getMetricsCategory()).isEqualTo(SettingsEnums.PRIVATE_SPACE_SETTINGS);
}
@@ -87,7 +88,8 @@
public void deletePrivateSpace_deletesPS() {
PrivateSpaceDeletionProgressFragment spyFragment = spy(mFragment);
doNothing().when(spyFragment).showSuccessfulDeletionToast();
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceMaintainer.createPrivateSpace();
spyFragment.deletePrivateSpace();
@@ -100,7 +102,8 @@
public void deletePrivateSpace_onDeletion_showsDeletedToast() {
PrivateSpaceDeletionProgressFragment spyFragment = spy(mFragment);
doNothing().when(spyFragment).showSuccessfulDeletionToast();
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
mPrivateSpaceMaintainer.createPrivateSpace();
spyFragment.deletePrivateSpace();
@@ -123,7 +126,8 @@
spyFragment.setPrivateSpaceMaintainer(injector);
doReturn(DELETE_PS_ERROR_INTERNAL).when(mPrivateSpaceMaintainerMock).deletePrivateSpace();
doNothing().when(spyFragment).showDeletionInternalErrorToast();
- mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
spyFragment.deletePrivateSpace();
diff --git a/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java b/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
index 85bd0e2..cd4c3c6 100644
--- a/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
+++ b/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
@@ -247,7 +247,8 @@
@Test
public void onReceive_onRefresh_withPrivateSpaceFeatureDisabled_setsNullData() {
when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
- mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
+ mSetFlagsRule.disableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
+ android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
Intent intent =
new Intent()