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

Commit c5e07bb6 authored by Manish Singh's avatar Manish Singh
Browse files

Don't show private accounts when locked

screen recoriding - https://drive.google.com/file/d/1_QzXJgISWhiYFGOGQkqDw6ZMxlVmojH_/view?usp=drive_link&resourcekey=0-64S56eFqFukR2ez4yKQlpQ

Bug: 324574475
Test: manual
Change-Id: I08eafbd66ee81d2ea539993d2d96c28b89a6dad0
parent 7dee0538
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings;

import static android.app.admin.DevicePolicyResources.Strings.Settings.PERSONAL_CATEGORY_HEADER;
import static android.app.admin.DevicePolicyResources.Strings.Settings.PRIVATE_CATEGORY_HEADER;
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_CATEGORY_HEADER;

import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
@@ -505,6 +506,9 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
            final UserInfo userInfo = profiles.get(profileIndex);
            final int profileId = userInfo.id;
            final UserHandle userHandle = new UserHandle(profileId);
            if (Utils.shouldHideUser(userHandle, um)) {
                continue;
            }
            Account[] accounts = mgr.getAccountsAsUser(profileId);
            final int accountLength = accounts.length;
            if (accountLength == 0) {
@@ -529,6 +533,13 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
                    titleText.setText(devicePolicyManager.getResources().getString(
                            WORK_CATEGORY_HEADER, () -> getString(
                                    com.android.settingslib.R.string.category_work)));
                } else if (android.os.Flags.allowPrivateProfile()
                        && android.multiuser.Flags.enablePrivateSpaceFeatures()
                        && android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
                        && userInfo.isPrivateProfile()) {
                    titleText.setText(devicePolicyManager.getResources().getString(
                            PRIVATE_CATEGORY_HEADER, () -> getString(
                                    com.android.settingslib.R.string.category_private)));
                } else {
                    titleText.setText(devicePolicyManager.getResources().getString(
                            PERSONAL_CATEGORY_HEADER, () -> getString(
+10 −0
Original line number Diff line number Diff line
@@ -1364,6 +1364,16 @@ public final class Utils extends com.android.settingslib.Utils {
        }
    }

    /**
     * Returns true if the user should be hidden in Settings when it's in quiet mode.
     */
    public static boolean shouldHideUser(
            @NonNull UserHandle userHandle, @NonNull UserManager userManager) {
        UserProperties userProperties = userManager.getUserProperties(userHandle);
        return userProperties.getShowInQuietMode() == UserProperties.SHOW_IN_QUIET_MODE_HIDDEN
                && userManager.isQuietModeEnabled(userHandle);
    }

    private static FaceManager.RemovalCallback faceManagerRemovalCallback(int userId) {
        return new FaceManager.RemovalCallback() {
            @Override