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

Commit c0e79004 authored by Jigar Thakkar's avatar Jigar Thakkar
Browse files

Set screen lock for the parent profile instead of system user

Here we change the logic to call the set screen lock prompt to ensure it
is called from the parent user of the private profile thereby moving
away from the assumption that screen lock needs to be set only on system
users to access private space.

Bug: 332482633
Test: Tested by flashing cheetah_hsum-staging-userdebug and trying to
unlock PS both with and without the screen lock being set.

Change-Id: Id9df5174ad87c25e36bf92efb38e614cdc3d905b
parent fa03ad1d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1718,10 +1718,11 @@ public class UserManagerService extends IUserManager.Stub {
                    }

                    final KeyguardManager km = mContext.getSystemService(KeyguardManager.class);
                    if (km != null && km.isDeviceSecure()) {
                    int parentUserId = getProfileParentId(userId);
                    if (km != null && km.isDeviceSecure(parentUserId)) {
                        showConfirmCredentialToDisableQuietMode(userId, target, callingPackage);
                        return false;
                    } else if (km != null && !km.isDeviceSecure()
                    } else if (km != null && !km.isDeviceSecure(parentUserId)
                            && android.multiuser.Flags.showSetScreenLockDialog()
                            // TODO(b/330720545): Add a better way to accomplish this, also use it
                            //  to block profile creation w/o device credentials present.
@@ -1731,7 +1732,8 @@ public class UserManagerService extends IUserManager.Stub {
                                SetScreenLockDialogActivity
                                        .createBaseIntent(LAUNCH_REASON_DISABLE_QUIET_MODE);
                        setScreenLockPromptIntent.putExtra(EXTRA_ORIGIN_USER_ID, userId);
                        mContext.startActivity(setScreenLockPromptIntent);
                        mContext.startActivityAsUser(setScreenLockPromptIntent,
                                UserHandle.of(parentUserId));
                        return false;
                    } else {
                        Slog.w(LOG_TAG, "Allowing profile unlock even when device credentials "