Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b816437d authored by Olivier Nshimiye's avatar Olivier Nshimiye Committed by Android (Google) Code Review
Browse files

Merge changes from topic "add-ps-features-flag" into main

* changes:
  Add Private Space features flag check to Settings tests
  Add an additional flag guard for Private Space implementation
parents c038d58b b4e6f205
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -118,7 +118,8 @@ public class SettingsInitialize extends BroadcastReceiver {
    }

    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;
            }
+1 −0
Original line number Diff line number Diff line
@@ -1228,6 +1228,7 @@ public final class Utils extends com.android.settingslib.Utils {
            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)) {
+8 −3
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
    private boolean shouldSkipProfile(UserHandle profile) {
        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;
+10 −4
Original line number Diff line number Diff line
@@ -239,7 +239,9 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
                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 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
            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 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
        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 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
                            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,
Loading