Skip to content

Commit 5cda94d

Browse files
author
Pavel Grafov
committed
Drive-by fix: crash when not DO/PO.
Currently loadEnrollmentSpedificId() throws SecurityException Bug: 187808221 Test: manual Change-Id: I7671f6a974dfc04a9773b0d1714a635f2cb4d43d
1 parent 3a5b441 commit 5cda94d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,6 +2496,10 @@ private void loadSecurityPatch() {
24962496
@TargetApi(VERSION_CODES.S)
24972497
private void loadEnrollmentSpecificId() {
24982498
Preference enrollmentSpecificIdPreference = findPreference(ENROLLMENT_SPECIFIC_ID_KEY);
2499+
if (!enrollmentSpecificIdPreference.isEnabled()) {
2500+
return;
2501+
}
2502+
24992503
String esid = "";
25002504
try {
25012505
//TODO: Call directly when the S SDK is available.

app/src/main/res/xml/device_policy_header.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
android:key="enrollment_specific_id"
3333
android:selectable="false"
3434
android:title="@string/enrollment_specific_id"
35-
testdpc:admin="any"
35+
testdpc:admin="deviceOwner|profileOwner"
36+
testdpc:delegation="delegation-cert-install"
3637
testdpc:minSdkVersion="S" />
3738

3839
<PreferenceCategory android:title="@string/accessibility_title">

0 commit comments

Comments
 (0)