Revert "Added check for misprovisioned Pixel 2 device."

Revert "Minor changes to check for misprovisioned Pixel 2 devices"

This reverts commits f1bbe75ede and
e238d589f1.
This code is no longer needed as Pixel 2 devices are not supported
on master.

Bug: 156316516
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Change-Id: Ia32b1712b53d4bc72118507c5177ff5db5fa6cdc
This commit is contained in:
Eran Messeri
2020-05-12 10:18:53 +01:00
parent b92e445aa8
commit 74e5dc0006

View File

@@ -22,14 +22,12 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.security.KeyStore;
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;
@@ -126,37 +124,6 @@ public abstract class AttestationUtils {
@NonNull public static KeymasterArguments prepareAttestationArguments(Context context,
@NonNull int[] idTypes, @NonNull byte[] attestationChallenge) throws
DeviceIdAttestationException {
return prepareAttestationArguments(context, idTypes,attestationChallenge, Build.BRAND);
}
/**
* Prepares Keymaster Arguments with attestation data for misprovisioned Pixel 2 device.
* See http://go/keyAttestationFailure and http://b/69471841 for more info.
* @hide should only be used by KeyChain.
*/
@NonNull public static KeymasterArguments prepareAttestationArgumentsIfMisprovisioned(
Context context, @NonNull int[] idTypes, @NonNull byte[] attestationChallenge) throws
DeviceIdAttestationException {
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);
}
@NonNull private static boolean isPotentiallyMisprovisionedDevice(Context context) {
Resources resources = context.getResources();
String misprovisionedModel = resources.getString(
com.android.internal.R.string.config_misprovisionedDeviceModel);
return (Build.MODEL.equals(misprovisionedModel));
}
@NonNull private static KeymasterArguments prepareAttestationArguments(Context context,
@NonNull int[] idTypes, @NonNull byte[] attestationChallenge, String brand) throws
DeviceIdAttestationException {
// Check method arguments, retrieve requested device IDs and prepare attestation arguments.
if (attestationChallenge == null) {
throw new NullPointerException("Missing attestation challenge");
@@ -213,7 +180,7 @@ public abstract class AttestationUtils {
}
}
attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_BRAND,
brand.getBytes(StandardCharsets.UTF_8));
Build.BRAND.getBytes(StandardCharsets.UTF_8));
attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_DEVICE,
Build.DEVICE.getBytes(StandardCharsets.UTF_8));
attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_PRODUCT,