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

@@ -311,11 +311,10 @@ public class AccountPreferenceController extends AbstractPreferenceController
// 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 @@ public class AccountPreferenceController extends AbstractPreferenceController
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;