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

Commit f1bbe75e authored by Eva Bertels's avatar Eva Bertels
Browse files

Minor changes to check for misprovisioned Pixel 2 devices

Check for brand parameter specified in config file. Implementing suggestion that was added to the original CL (ag/4791307) after it was submitted.

Bug: 69471841
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Change-Id: I9b257f406d5b47265db4dbf022df75865f496cdd
parent 32f68e6b
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.security.keymaster.KeymasterArguments;
import android.security.keymaster.KeymasterCertificateChain;
import android.security.keymaster.KeymasterDefs;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArraySet;

import java.io.ByteArrayInputStream;
@@ -128,12 +129,12 @@ public abstract class AttestationUtils {
    @NonNull public static KeymasterArguments prepareAttestationArgumentsIfMisprovisioned(
            Context context, @NonNull int[] idTypes, @NonNull byte[] attestationChallenge) throws
            DeviceIdAttestationException {
        if (!isPotentiallyMisprovisionedDevice(context)) {
            return null;
        }
        Resources resources = context.getResources();
        String misprovisionedBrand = resources.getString(
                com.android.internal.R.string.config_misprovisionedBrandValue);
        if (!TextUtils.isEmpty(misprovisionedBrand) && !isPotentiallyMisprovisionedDevice(context)){
            return null;
        }
        return prepareAttestationArguments(
                context, idTypes, attestationChallenge, misprovisionedBrand);
    }