@@ -151,6 +151,7 @@ class AttestationProtocol {
151151 // short autoRebootMinutes (-1 for unknown)
152152 // byte portSecurityMode (-1 for unknown)
153153 // byte userCount (-1 for unknown)
154+ // byte oemUnlockAllowed (-1 for unknown)
154155 // }
155156 // byte[] signature (rest of message)
156157 //
@@ -159,6 +160,7 @@ class AttestationProtocol {
159160 // 6: autoRebootMinutes added
160161 // 6: portSecurityMode added
161162 // 6: userCount added
163+ // 6: oemUnlockAllowed added
162164 //
163165 // n/a
164166 //
@@ -214,7 +216,7 @@ class AttestationProtocol {
214216 private static final int OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS = 1 << 5 ;
215217 private static final int OS_ENFORCED_FLAGS_DENY_NEW_USB = 1 << 6 ; // obsolete since version 86
216218 private static final int OS_ENFORCED_FLAGS_DEVICE_ADMIN_NON_SYSTEM = 1 << 7 ;
217- private static final int OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED = 1 << 8 ;
219+ private static final int OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED = 1 << 8 ; // obsolete since version 89
218220 private static final int OS_ENFORCED_FLAGS_SYSTEM_USER = 1 << 9 ;
219221 private static final int OS_ENFORCED_FLAGS_ALL =
220222 OS_ENFORCED_FLAGS_USER_PROFILE_SECURE |
@@ -961,7 +963,7 @@ private static VerificationResult verify(final Context context, final byte[] fin
961963 final boolean accessibility , final boolean deviceAdmin ,
962964 final boolean deviceAdminNonSystem , final boolean adbEnabled ,
963965 final boolean addUsersWhenLocked , final boolean enrolledBiometrics ,
964- final boolean oemUnlockAllowed , final boolean systemUser )
966+ final boolean systemUser )
965967 throws GeneralSecurityException {
966968 final String fingerprintHex = BaseEncoding .base16 ().encode (fingerprint );
967969 final byte [] currentFingerprint = getFingerprint (attestationCertificates [0 ]);
@@ -1132,8 +1134,6 @@ private static VerificationResult verify(final Context context, final byte[] fin
11321134 toYesNoString (context , adbEnabled )));
11331135 osEnforced .append (context .getString (R .string .add_users_when_locked ,
11341136 toYesNoString (context , addUsersWhenLocked )));
1135- osEnforced .append (context .getString (R .string .oem_unlock_allowed ,
1136- toYesNoString (context , oemUnlockAllowed )));
11371137 osEnforced .append (context .getString (R .string .system_user ,
11381138 toYesNoString (context , systemUser )));
11391139
@@ -1227,7 +1227,6 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
12271227 final boolean adbEnabled = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADB_ENABLED ) != 0 ;
12281228 final boolean addUsersWhenLocked = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADD_USERS_WHEN_LOCKED ) != 0 ;
12291229 final boolean enrolledBiometrics = (osEnforcedFlags & OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS ) != 0 ;
1230- final boolean oemUnlockAllowed = (osEnforcedFlags & OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED ) != 0 ;
12311230 final boolean systemUser = (osEnforcedFlags & OS_ENFORCED_FLAGS_SYSTEM_USER ) != 0 ;
12321231
12331232 if (deviceAdminNonSystem && !deviceAdmin ) {
@@ -1238,6 +1237,7 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
12381237 final short autoRebootMinutes = deserializer .getShort ();
12391238 final byte portSecurityMode = deserializer .get ();
12401239 final byte userCount = deserializer .get ();
1240+ final byte oemUnlockAllowed = deserializer .get ();
12411241 }
12421242
12431243 final int signatureLength = deserializer .remaining ();
@@ -1250,7 +1250,7 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
12501250 final byte [] challenge = Arrays .copyOfRange (challengeMessage , 1 + RANDOM_TOKEN_LENGTH , 1 + RANDOM_TOKEN_LENGTH * 2 );
12511251 return verify (context , fingerprint , challenge , deserializer .asReadOnlyBuffer (), signature ,
12521252 certificates , userProfileSecure , accessibility , deviceAdmin , deviceAdminNonSystem ,
1253- adbEnabled , addUsersWhenLocked , enrolledBiometrics , oemUnlockAllowed , systemUser );
1253+ adbEnabled , addUsersWhenLocked , enrolledBiometrics , systemUser );
12541254 }
12551255
12561256 record AttestationResult (boolean pairing , byte [] serialized ) {}
@@ -1430,9 +1430,6 @@ static AttestationResult generateSerialized(final Context context, final byte[]
14301430 final boolean addUsersWhenLocked = Settings .Global .getInt (context .getContentResolver (),
14311431 ADD_USERS_WHEN_LOCKED , 0 ) != 0 ;
14321432
1433- final String oemUnlockAllowedValue = SystemProperties .get ("sys.oem_unlock_allowed" , "0" );
1434- final boolean oemUnlockAllowed = oemUnlockAllowedValue .equals ("1" );
1435-
14361433 final UserManager userManager = context .getSystemService (UserManager .class );
14371434 final boolean systemUser = userManager .isSystemUser ();
14381435
@@ -1480,9 +1477,6 @@ static AttestationResult generateSerialized(final Context context, final byte[]
14801477 if (enrolledBiometrics ) {
14811478 osEnforcedFlags |= OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS ;
14821479 }
1483- if (oemUnlockAllowed ) {
1484- osEnforcedFlags |= OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED ;
1485- }
14861480 if (systemUser ) {
14871481 osEnforcedFlags |= OS_ENFORCED_FLAGS_SYSTEM_USER ;
14881482 }
@@ -1497,6 +1491,9 @@ static AttestationResult generateSerialized(final Context context, final byte[]
14971491
14981492 final byte userCount = 0 ;
14991493 serializer .put (userCount );
1494+
1495+ final byte oemUnlockAllowed = 0 ;
1496+ serializer .put (oemUnlockAllowed );
15001497 }
15011498
15021499 final ByteBuffer message = serializer .duplicate ();
0 commit comments