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

Commit 2b7292b6 authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Fix the new keyguard check in CDM on HSUM builds

KeyguardManager.isKeyguardSecure is user-aware and checks for
INTERACT_ACROSS_USERS permission. On HSUM devices the caller
userId and the userId of the system context are different

Change-Id: Ibc7acc68d256c801741033628686bb1950f6686b
Fix: 393382525
Test: atest with HSUM target
Flag: EXEMPT test fix
parent 9d4cbbde
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -695,8 +695,10 @@ public class CompanionDeviceManagerService extends SystemService {
        }

        private void checkCallerCanSkipRoleGrant() {
            final Context context =
                    getContext().createContextAsUser(Binder.getCallingUserHandle(), 0);
            final KeyguardManager keyguardManager =
                    getContext().getSystemService(KeyguardManager.class);
                    context.getSystemService(KeyguardManager.class);
            if (keyguardManager != null && keyguardManager.isKeyguardSecure()) {
                throw new SecurityException("Skipping CDM role grant requires insecure keyguard.");
            }