Skip to content

Commit 1143970

Browse files
committed
raise minimum OS version to Android 10
Android 11 is the oldest version receiving official security support but the Android 10 end-of-life was relatively recent.
1 parent bb15283 commit 1143970

File tree

5 files changed

+21
-35
lines changed

5 files changed

+21
-35
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ android {
4545

4646
defaultConfig {
4747
applicationId = "app.attestation.auditor"
48-
minSdk = 26
48+
minSdk = 29
4949
targetSdk = 33
5050
versionCode = 69
5151
versionName = versionCode.toString()

app/src/main/java/app/attestation/auditor/AttestationProtocol.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class AttestationProtocol {
243243
private static final byte AUDITOR_APP_VARIANT_PLAY = 1;
244244
private static final byte AUDITOR_APP_VARIANT_DEBUG = 2;
245245
private static final int AUDITOR_APP_MINIMUM_VERSION = 47;
246-
private static final int OS_VERSION_MINIMUM = 80000;
246+
private static final int OS_VERSION_MINIMUM = 100000;
247247
private static final int OS_PATCH_LEVEL_MINIMUM = 201801;
248248
private static final int VENDOR_PATCH_LEVEL_MINIMUM = 201808;
249249
private static final int BOOT_PATCH_LEVEL_MINIMUM = 201809;
@@ -1362,11 +1362,6 @@ static class AttestationResult {
13621362
}
13631363
}
13641364

1365-
@TargetApi(28)
1366-
static void enableStrongBox(final KeyGenParameterSpec.Builder builder) {
1367-
builder.setIsStrongBoxBacked(true);
1368-
}
1369-
13701365
@TargetApi(31)
13711366
static void setAttestKeyAlias(final KeyGenParameterSpec.Builder builder, final String alias) {
13721367
builder.setAttestKeyAlias(alias);
@@ -1384,7 +1379,7 @@ static KeyGenParameterSpec.Builder getKeyBuilder(final String alias, final int p
13841379
builder.setKeyValidityEnd(new Date(startTime.getTime() + EXPIRE_OFFSET_MS));
13851380
}
13861381
if (useStrongBox) {
1387-
enableStrongBox(builder);
1382+
builder.setIsStrongBoxBacked(true);
13881383
}
13891384
return builder;
13901385
}

app/src/main/java/app/attestation/auditor/RemoteVerifyJob.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ static void schedule(final Context context, int interval) {
8888
final long intervalMillis = interval * 1000;
8989
final long flexMillis = intervalMillis / 10;
9090
if (jobInfo != null &&
91-
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
92-
jobInfo.getEstimatedNetworkDownloadBytes() == ESTIMATED_DOWNLOAD_BYTES &&
93-
jobInfo.getEstimatedNetworkUploadBytes() == ESTIMATED_UPLOAD_BYTES) &&
91+
jobInfo.getEstimatedNetworkDownloadBytes() == ESTIMATED_DOWNLOAD_BYTES &&
92+
jobInfo.getEstimatedNetworkUploadBytes() == ESTIMATED_UPLOAD_BYTES &&
9493
jobInfo.getIntervalMillis() == intervalMillis &&
9594
jobInfo.getFlexMillis() == flexMillis) {
9695
Log.d(TAG, "job already registered");
@@ -100,10 +99,8 @@ static void schedule(final Context context, int interval) {
10099
if (jobInfo == null) {
101100
final JobInfo.Builder builder = new JobInfo.Builder(FIRST_RUN_JOB_ID, serviceName)
102101
.setPersisted(true)
103-
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
104-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
105-
builder.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
106-
}
102+
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
103+
.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
107104
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
108105
builder.setExpedited(true);
109106
}
@@ -117,10 +114,8 @@ static void schedule(final Context context, int interval) {
117114
final JobInfo.Builder builder = new JobInfo.Builder(PERIODIC_JOB_ID, serviceName)
118115
.setPeriodic(intervalMillis, flexMillis)
119116
.setPersisted(true)
120-
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
121-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
122-
builder.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
123-
}
117+
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
118+
.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
124119
if (scheduler.schedule(builder.build()) == JobScheduler.RESULT_FAILURE) {
125120
throw new RuntimeException("job schedule failed");
126121
}

app/src/main/java/app/attestation/auditor/SubmitSampleJob.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ static void schedule(final Context context) {
6363
final JobScheduler scheduler = context.getSystemService(JobScheduler.class);
6464
final JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, serviceName)
6565
.setPersisted(true)
66-
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
67-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
68-
builder.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
69-
}
66+
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
67+
.setEstimatedNetworkBytes(ESTIMATED_DOWNLOAD_BYTES, ESTIMATED_UPLOAD_BYTES);
7068
if (scheduler.schedule(builder.build()) == JobScheduler.RESULT_FAILURE) {
7169
throw new RuntimeException("job schedule failed");
7270
}
@@ -96,17 +94,15 @@ public boolean onStartJob(final JobParameters params) {
9694
keyStore.deleteEntry(KEYSTORE_ALIAS_SAMPLE);
9795

9896
Certificate[] strongBoxCerts = null;
99-
if (Build.VERSION.SDK_INT >= 28) {
100-
try {
101-
builder.setIsStrongBoxBacked(true);
102-
AttestationProtocol.generateKeyPair(builder.build());
103-
strongBoxCerts = keyStore.getCertificateChain(KEYSTORE_ALIAS_SAMPLE);
104-
keyStore.deleteEntry(KEYSTORE_ALIAS_SAMPLE);
105-
} catch (final StrongBoxUnavailableException ignored) {
106-
} catch (final IOException e) {
107-
if (!(e.getCause() instanceof StrongBoxUnavailableException)) {
108-
throw e;
109-
}
97+
try {
98+
builder.setIsStrongBoxBacked(true);
99+
AttestationProtocol.generateKeyPair(builder.build());
100+
strongBoxCerts = keyStore.getCertificateChain(KEYSTORE_ALIAS_SAMPLE);
101+
keyStore.deleteEntry(KEYSTORE_ALIAS_SAMPLE);
102+
} catch (final StrongBoxUnavailableException ignored) {
103+
} catch (final IOException e) {
104+
if (!(e.getCause() instanceof StrongBoxUnavailableException)) {
105+
throw e;
110106
}
111107
}
112108

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources>
22
<string name="app_name">Auditor</string>
3-
<string name="introduction">Two devices are needed to perform verification:\n\n- The device to be verified (Auditee), which needs to be one of the supported devices launched with Android 8.0+.\n\n- An Android 8.0+ device to perform the verification (Auditor).\n\nThe verification process requires sending data between the devices by scanning QR codes.</string>
3+
<string name="introduction">Two devices with Android 10 or higher are needed to perform verification:\n\n- The device to be verified (Auditee), which needs to be one of the supported devices.\n\n- An Android device to perform the verification (Auditor).\n\nThe verification process requires sending data between the devices by scanning QR codes.</string>
44
<string name="unsupported_auditee">Device is not one of the supported models.</string>
55
<string name="camera_permission_denied">Camera permission is required to scan QR codes.</string>
66
<string name="auditee_button">Auditee (device being verified)</string>

0 commit comments

Comments
 (0)