Add an additional flag guard for Private Space implementation

This a layer of flag guarding only for the implementation of Private Space features excluding the APIs. The MVP flag allow_private_profile still guards all the features including the APIs.

Bug: 326060689
Test: Manual - a few verifications that some feeatures are unavailable when this flag is disabled
Test: Run presubmits and verify that nothing breaks
Change-Id: I05f7e2f20c6132b33484bb133ce03a933ece485f
This commit is contained in:
Olivier Nshimiye
2024-02-26 11:23:08 +00:00
parent 71c6c3e557
commit 0f3799cbad
40 changed files with 109 additions and 42 deletions

View File

@@ -118,7 +118,8 @@ public class SettingsInitialize extends BroadcastReceiver {
} }
private void privateProfileSetup(Context context, PackageManager pm, UserInfo userInfo) { private void privateProfileSetup(Context context, PackageManager pm, UserInfo userInfo) {
if (Flags.allowPrivateProfile()) { if (Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
if (userInfo == null || !userInfo.isPrivateProfile()) { if (userInfo == null || !userInfo.isPrivateProfile()) {
return; return;
} }

View File

@@ -1228,6 +1228,7 @@ public final class Utils extends com.android.settingslib.Utils {
UserProperties userProperties = userManager.getUserProperties(userHandle); UserProperties userProperties = userManager.getUserProperties(userHandle);
if (userProperties.getShowInSettings() == UserProperties.SHOW_IN_SETTINGS_SEPARATE) { if (userProperties.getShowInSettings() == UserProperties.SHOW_IN_SETTINGS_SEPARATE) {
if (Flags.allowPrivateProfile() if (Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userProperties.getShowInQuietMode() && userProperties.getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN) { == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN) {
if (!userManager.isQuietModeEnabled(userHandle)) { if (!userManager.isQuietModeEnabled(userHandle)) {

View File

@@ -311,11 +311,10 @@ public class AccountPreferenceController extends AbstractPreferenceController
// should be shown or not. // should be shown or not.
if (((profile.isManagedProfile() if (((profile.isManagedProfile()
&& (mType & ProfileSelectFragment.ProfileType.WORK) != 0) && (mType & ProfileSelectFragment.ProfileType.WORK) != 0)
|| (Flags.allowPrivateProfile() || (isPrivateProfile(profile)
&& profile.isPrivateProfile()
&& (mType & ProfileSelectFragment.ProfileType.PRIVATE) != 0) && (mType & ProfileSelectFragment.ProfileType.PRIVATE) != 0)
|| (!profile.isManagedProfile() || (!profile.isManagedProfile()
&& !(Flags.allowPrivateProfile() && profile.isPrivateProfile()) && !isPrivateProfile(profile)
&& (mType & ProfileSelectFragment.ProfileType.PERSONAL) != 0)) && (mType & ProfileSelectFragment.ProfileType.PERSONAL) != 0))
&& !(mUm.getUserProperties(profile.getUserHandle()) && !(mUm.getUserProperties(profile.getUserHandle())
.getShowInQuietMode() == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN .getShowInQuietMode() == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN
@@ -338,6 +337,12 @@ public class AccountPreferenceController extends AbstractPreferenceController
mFragment.forceUpdatePreferences(); mFragment.forceUpdatePreferences();
} }
private static boolean isPrivateProfile(UserInfo profile) {
return Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& profile.isPrivateProfile();
}
private void updateProfileUi(final UserInfo userInfo) { private void updateProfileUi(final UserInfo userInfo) {
if (mFragment.getPreferenceManager() == null) { if (mFragment.getPreferenceManager() == null) {
return; return;

View File

@@ -169,6 +169,7 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
private boolean shouldSkipProfile(UserHandle profile) { private boolean shouldSkipProfile(UserHandle profile) {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace() && android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mUm.isQuietModeEnabled(profile) && mUm.isQuietModeEnabled(profile)
&& mUm.getUserProperties(profile).getShowInQuietMode() && mUm.getUserProperties(profile).getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN; == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;

View File

@@ -238,7 +238,9 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
return WORK_TAB; return WORK_TAB;
} }
UserInfo userInfo = UserManager.get(activity).getUserInfo(userId); 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; return PRIVATE_TAB;
} }
} }
@@ -248,7 +250,9 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
return WORK_TAB; return WORK_TAB;
} }
UserInfo userInfo = UserManager.get(activity).getUserInfo(intentUser); 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; return PRIVATE_TAB;
} }
@@ -259,7 +263,7 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
final DevicePolicyManager devicePolicyManager = final DevicePolicyManager devicePolicyManager =
getContext().getSystemService(DevicePolicyManager.class); getContext().getSystemService(DevicePolicyManager.class);
if (Flags.allowPrivateProfile()) { if (Flags.allowPrivateProfile() && android.multiuser.Flags.enablePrivateSpaceFeatures()) {
int tabForPosition = int tabForPosition =
((ViewPagerAdapter) mViewPager.getAdapter()).getTabForPosition(position); ((ViewPagerAdapter) mViewPager.getAdapter()).getTabForPosition(position);
@@ -330,7 +334,9 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
ProfileType.WORK, ProfileType.WORK,
bundle != null ? bundle.deepCopy() : new Bundle(), bundle != null ? bundle.deepCopy() : new Bundle(),
workFragmentConstructor)); workFragmentConstructor));
} else if (Flags.allowPrivateProfile() && userInfo.isPrivateProfile()) { } else if (Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userInfo.isPrivateProfile()) {
if (!privateSpaceInfoProvider.isPrivateSpaceLocked(context)) { if (!privateSpaceInfoProvider.isPrivateSpaceLocked(context)) {
fragments.add(createAndGetFragment( fragments.add(createAndGetFragment(
ProfileType.PRIVATE, ProfileType.PRIVATE,

View File

@@ -87,6 +87,7 @@ public class UserAdapter extends BaseAdapter {
return resources.getString(WORK_CATEGORY_HEADER, return resources.getString(WORK_CATEGORY_HEADER,
() -> context.getString(com.android.settingslib.R.string.category_work)); () -> context.getString(com.android.settingslib.R.string.category_work));
} else if (android.os.Flags.allowPrivateProfile() } else if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mUserManager.getUserInfo(userId).isPrivateProfile()) { && mUserManager.getUserInfo(userId).isPrivateProfile()) {
return resources.getString(PRIVATE_CATEGORY_HEADER, return resources.getString(PRIVATE_CATEGORY_HEADER,
() -> context.getString(com.android.settingslib.R.string.category_private)); () -> context.getString(com.android.settingslib.R.string.category_private));

View File

@@ -257,6 +257,7 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
private boolean shouldSkipProfile(UserInfo userInfo) { private boolean shouldSkipProfile(UserInfo userInfo) {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace() && android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userInfo.isQuietModeEnabled() && userInfo.isQuietModeEnabled()
&& mUm.getUserProperties(userInfo.getUserHandle()).getShowInQuietMode() && mUm.getUserProperties(userInfo.getUserHandle()).getShowInQuietMode()
== UserProperties.SHOW_IN_QUIET_MODE_HIDDEN; == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN;

View File

@@ -416,6 +416,7 @@ public class ChooseLockPassword extends SettingsActivity {
public String getHint(Context context, boolean isAlpha, int type, ProfileType profile) { public String getHint(Context context, boolean isAlpha, int type, ProfileType profile) {
if (isAlpha) { if (isAlpha) {
if (android.os.Flags.allowPrivateProfile() if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& profile.equals(ProfileType.Private)) { && profile.equals(ProfileType.Private)) {
return context.getString(alphaHintForPrivateProfile); return context.getString(alphaHintForPrivateProfile);
} else if (type == TYPE_FINGERPRINT) { } else if (type == TYPE_FINGERPRINT) {
@@ -433,6 +434,7 @@ public class ChooseLockPassword extends SettingsActivity {
} }
} else { } else {
if (android.os.Flags.allowPrivateProfile() if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& profile.equals(ProfileType.Private)) { && profile.equals(ProfileType.Private)) {
return context.getString(numericHintForPrivateProfile); return context.getString(numericHintForPrivateProfile);
} else if (type == TYPE_FINGERPRINT) { } else if (type == TYPE_FINGERPRINT) {
@@ -1147,7 +1149,9 @@ public class ChooseLockPassword extends SettingsActivity {
/*flags=*/0).getSystemService(UserManager.class); /*flags=*/0).getSystemService(UserManager.class);
if (userManager.isManagedProfile()) { if (userManager.isManagedProfile()) {
return ProfileType.Managed; 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; return ProfileType.Private;
} else if (userManager.isProfile()) { } else if (userManager.isProfile()) {
return ProfileType.Other; return ProfileType.Other;

View File

@@ -478,7 +478,9 @@ public class ChooseLockPattern extends SettingsActivity {
.getString(SET_WORK_PROFILE_PATTERN_HEADER, .getString(SET_WORK_PROFILE_PATTERN_HEADER,
() -> getString( () -> getString(
R.string.lockpassword_choose_your_profile_pattern_header)); 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); msg = getString(R.string.private_space_choose_your_pattern_header);
} else { } else {
msg = getString(R.string.lockpassword_choose_your_pattern_header); msg = getString(R.string.lockpassword_choose_your_pattern_header);

View File

@@ -300,6 +300,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
launchedCDC = true; launchedCDC = true;
} }
} else if (android.os.Flags.allowPrivateProfile() } else if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& userProperties != null && userProperties != null
&& userProperties.isAuthAlwaysRequiredToDisableQuietMode() && userProperties.isAuthAlwaysRequiredToDisableQuietMode()
&& isInternalActivity()) { && isInternalActivity()) {
@@ -413,7 +414,8 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
private boolean doesUserStateEnforceStrongAuth(int userId) { private boolean doesUserStateEnforceStrongAuth(int userId) {
if (android.os.Flags.allowPrivateProfile() 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 // 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 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 // the user is stopped with delayed locking (i.e., with storage unlocked), so the user

View File

@@ -105,7 +105,8 @@ public class ConfirmDeviceCredentialUtils {
private static boolean isBiometricUnlockEnabledForPrivateSpace() { private static boolean isBiometricUnlockEnabledForPrivateSpace() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace(); && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
} }
/** /**

View File

@@ -104,7 +104,8 @@ public class AutoAdvanceSetupFragment extends InstrumentedFragment {
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
} }

View File

@@ -38,7 +38,10 @@ public class HidePrivateSpaceController extends TogglePreferenceController {
@Override @Override
@AvailabilityStatus @AvailabilityStatus
public int getAvailabilityStatus() { 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 @Override

View File

@@ -52,6 +52,7 @@ public class HidePrivateSpaceSensitiveNotificationsController extends TogglePref
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
if (!android.os.Flags.allowPrivateProfile() if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePsSensitiveNotificationsToggle() || !android.multiuser.Flags.enablePsSensitiveNotificationsToggle()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()
|| !mPrivateSpaceMaintainer.doesPrivateSpaceExist()) { || !mPrivateSpaceMaintainer.doesPrivateSpaceExist()) {
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }

View File

@@ -27,7 +27,8 @@ public class HidePrivateSpaceSettings extends DashboardFragment{
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle); super.onCreate(icicle);
} }
} }

View File

@@ -36,7 +36,10 @@ public final class HidePrivateSpaceSummaryController extends BasePreferenceContr
@Override @Override
public int getAvailabilityStatus() { 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 @Override

View File

@@ -59,7 +59,8 @@ public class PrivateProfileContextHelperActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return; return;
} }
setTheme(SetupWizardUtils.getTheme(this, getIntent())); setTheme(SetupWizardUtils.getTheme(this, getIntent()));

View File

@@ -77,7 +77,8 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (Flags.allowPrivateProfile()) { if (Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
ThemeHelper.trySetDynamicColor(this); ThemeHelper.trySetDynamicColor(this);
mPrivateSpaceMaintainer = mPrivateSpaceMaintainer =
new Injector().injectPrivateSpaceMaintainer(getApplicationContext()); new Injector().injectPrivateSpaceMaintainer(getApplicationContext());

View File

@@ -32,7 +32,8 @@ public class PrivateSpaceDashboardFragment extends DashboardFragment {
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle); super.onCreate(icicle);
if (icicle == null if (icicle == null
&& getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) { && getIntent().getBooleanExtra(EXTRA_SHOW_PRIVATE_SPACE_UNLOCKED, false)) {

View File

@@ -43,7 +43,8 @@ public class PrivateSpaceEducation extends InstrumentedFragment {
LayoutInflater inflater, LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null; return null;
} }
GlifLayout rootView = GlifLayout rootView =

View File

@@ -78,7 +78,8 @@ public class PrivateSpaceMaintainer {
*/ */
@VisibleForTesting @VisibleForTesting
public final synchronized boolean createPrivateSpace() { public final synchronized boolean createPrivateSpace() {
if (!Flags.allowPrivateProfile()) { if (!Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false; return false;
} }
// Check if Private space already exists // Check if Private space already exists
@@ -146,7 +147,8 @@ public class PrivateSpaceMaintainer {
/** Returns true if the Private space exists. */ /** Returns true if the Private space exists. */
public synchronized boolean doesPrivateSpaceExist() { public synchronized boolean doesPrivateSpaceExist() {
if (!Flags.allowPrivateProfile()) { if (!Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return false; return false;
} }
if (mUserHandle != null) { if (mUserHandle != null) {
@@ -322,6 +324,7 @@ public class PrivateSpaceMaintainer {
private boolean isPrivateSpaceAutoLockSupported() { private boolean isPrivateSpaceAutoLockSupported() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.supportAutolockForPrivateSpace(); && android.multiuser.Flags.supportAutolockForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
} }
} }

View File

@@ -51,7 +51,8 @@ public final class PrivateSpaceSafetySource {
return; 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 // Setting null safetySourceData so that an old entry gets cleared out and this way
// provide a response since SC always expects one on rescan. // provide a response since SC always expects one on rescan.
SafetyCenterManagerWrapper.get().setSafetySourceData( SafetyCenterManagerWrapper.get().setSafetySourceData(

View File

@@ -51,7 +51,8 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment {
LayoutInflater inflater, LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null; return null;
} }
GlifLayout rootView = GlifLayout rootView =

View File

@@ -42,7 +42,8 @@ public class PrivateSpaceSetupActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return; return;
} }
setTheme(SetupWizardUtils.getTheme(this, getIntent())); setTheme(SetupWizardUtils.getTheme(this, getIntent()));

View File

@@ -47,7 +47,8 @@ public class SetupSuccessFragment extends InstrumentedFragment {
LayoutInflater inflater, LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return null; return null;
} }
GlifLayout rootView = GlifLayout rootView =

View File

@@ -41,6 +41,7 @@ public class AutoLockPreferenceController extends BasePreferenceController {
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.supportAutolockForPrivateSpace() && android.multiuser.Flags.supportAutolockForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE ? AVAILABLE
: UNSUPPORTED_ON_DEVICE; : UNSUPPORTED_ON_DEVICE;
} }

View File

@@ -45,7 +45,8 @@ public class AutoLockSettingsFragment extends RadioButtonPickerFragment {
@Override @Override
public void onCreate(@NonNull Bundle icicle) { public void onCreate(@NonNull Bundle icicle) {
if (android.os.Flags.allowPrivateProfile() if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.supportAutolockForPrivateSpace()) { && android.multiuser.Flags.supportAutolockForPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle); super.onCreate(icicle);
} }
} }

View File

@@ -34,7 +34,10 @@ public class DeletePrivateSpaceController extends BasePreferenceController {
@Override @Override
public int getAvailabilityStatus() { 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 @Override

View File

@@ -35,7 +35,8 @@ public class PrivateSpaceDeleteActivity extends InstrumentedActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (!android.os.Flags.allowPrivateProfile()) { if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
return; return;
} }
setTheme(SetupWizardUtils.getTheme(this, getIntent())); setTheme(SetupWizardUtils.getTheme(this, getIntent()));

View File

@@ -56,7 +56,8 @@ public class PrivateSpaceDeleteFragment extends InstrumentedFragment {
@Override @Override
public void onCreate(@Nullable Bundle icicle) { public void onCreate(@Nullable Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle); super.onCreate(icicle);
} }
} }

View File

@@ -62,7 +62,8 @@ public class PrivateSpaceDeletionProgressFragment extends InstrumentedFragment {
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
} }

View File

@@ -42,6 +42,7 @@ public class FaceFingerprintUnlockController extends CombinedBiometricStatusPref
protected boolean isUserSupported() { protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& mProfileUserId != UserHandle.USER_NULL; && mProfileUserId != UserHandle.USER_NULL;
} }

View File

@@ -34,7 +34,8 @@ public class PrivateSpaceBiometricSettings extends BiometricsSettingsBase {
@Override @Override
public void onAttach(Context context) { public void onAttach(Context context) {
if (android.os.Flags.allowPrivateProfile() if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()) { && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onAttach(context); super.onAttach(context);
UserHandle privateProfileHandle = UserHandle privateProfileHandle =
PrivateSpaceMaintainer.getInstance(context).getPrivateProfileHandle(); PrivateSpaceMaintainer.getInstance(context).getPrivateProfileHandle();

View File

@@ -45,6 +45,7 @@ public class PrivateSpaceFacePreferenceController extends BiometricFaceStatusPre
protected boolean isUserSupported() { protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& getUserId() != UserHandle.USER_NULL; && getUserId() != UserHandle.USER_NULL;
} }
@@ -64,6 +65,7 @@ public class PrivateSpaceFacePreferenceController extends BiometricFaceStatusPre
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE ? AVAILABLE
: UNSUPPORTED_ON_DEVICE; : UNSUPPORTED_ON_DEVICE;
} }

View File

@@ -47,6 +47,7 @@ public class PrivateSpaceFingerprintPreferenceController
protected boolean isUserSupported() { protected boolean isUserSupported() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
&& getUserId() != UserHandle.USER_NULL; && getUserId() != UserHandle.USER_NULL;
} }
@@ -66,6 +67,7 @@ public class PrivateSpaceFingerprintPreferenceController
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
return android.os.Flags.allowPrivateProfile() return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace() && android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()
? AVAILABLE ? AVAILABLE
: UNSUPPORTED_ON_DEVICE; : UNSUPPORTED_ON_DEVICE;
} }

View File

@@ -74,7 +74,8 @@ public class PrivateSpaceLockController extends AbstractPreferenceController {
@Override @Override
public boolean isAvailable() { public boolean isAvailable() {
return android.os.Flags.allowPrivateProfile(); return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
} }
@Override @Override

View File

@@ -45,7 +45,10 @@ public class UseOneLockController extends BasePreferenceController {
} }
@Override @Override
public int getAvailabilityStatus() { 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 @Override

View File

@@ -95,7 +95,8 @@ public class UseOneLockControllerSwitch extends AbstractPreferenceController
@Override @Override
public boolean isAvailable() { public boolean isAvailable() {
return android.os.Flags.allowPrivateProfile(); return android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
} }
@Override @Override

View File

@@ -39,7 +39,8 @@ public class UseOneLockSettingsFragment extends DashboardFragment {
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
if (android.os.Flags.allowPrivateProfile()) { if (android.os.Flags.allowPrivateProfile()
&& android.multiuser.Flags.enablePrivateSpaceFeatures()) {
super.onCreate(icicle); super.onCreate(icicle);
} }
} }

View File

@@ -62,7 +62,9 @@ public final class BiometricsSafetySource {
} }
final Context profileParentContext = final Context profileParentContext =
context.createContextAsUser(profileParentUserHandle, 0); 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 // 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. // source, therefore, we need to send a null SafetySourceData.
SafetyCenterManagerWrapper.get().setSafetySourceData( SafetyCenterManagerWrapper.get().setSafetySourceData(