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

Commit e9ef15d1 authored by Brian C. Young's avatar Brian C. Young
Browse files

Use correct call to get the user ID

When getting the user ID for authorization lists, this call will
actually get the correct user ID for the guest account.

Test: Switch to guest account, set PIN, lock and unlock.

Bug: 76460912

Change-Id: I50c40497cd9f79728ca54ea8eee85cdbba9ae1d7
parent 9347a6fa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.security;

import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.Application;
import android.app.KeyguardManager;
@@ -546,7 +547,7 @@ public class KeyStore {
            args = args != null ? args : new KeymasterArguments();
            entropy = entropy != null ? entropy : new byte[0];
            if (!args.containsTag(KeymasterDefs.KM_TAG_USER_ID)) {
                args.addUnsignedInt(KeymasterDefs.KM_TAG_USER_ID, UserHandle.getCallingUserId());
                args.addUnsignedInt(KeymasterDefs.KM_TAG_USER_ID, ActivityManager.getCurrentUser());
            }
            return mBinder.begin(getToken(), alias, purpose, pruneable, args, entropy, uid);
        } catch (RemoteException e) {
+2 −3
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package android.security.keystore;

import android.util.Log;
import android.app.ActivityManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.UserHandle;
import android.security.GateKeeper;
import android.security.KeyStore;
import android.security.keymaster.KeymasterArguments;
@@ -102,7 +101,7 @@ public abstract class KeymasterUtils {
     *         require user authentication.
     */
    public static void addUserAuthArgs(KeymasterArguments args, UserAuthArgs spec) {
        args.addUnsignedInt(KeymasterDefs.KM_TAG_USER_ID, UserHandle.getCallingUserId());
        args.addUnsignedInt(KeymasterDefs.KM_TAG_USER_ID, ActivityManager.getCurrentUser());

        if (spec.isUserConfirmationRequired()) {
            args.addBoolean(KeymasterDefs.KM_TAG_TRUSTED_CONFIRMATION_REQUIRED);