Skip to content

Commit 6396db3

Browse files
committed
Merge /usr/local/google/home/ascull/projects/ub-testdpc-oc-release/vendor/unbundled_google/packages/TestDPC into new-version
2 parents 7f2409f + f46e5db commit 6396db3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ext {
77
// exactly 1 digit
88
versionMinor = 0
99
// exactly 2 digits
10-
versionBuild = 02
10+
versionBuild = 03
1111
}
1212

1313
android {

app/src/main/java/com/afwsamples/testdpc/common/Util.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,11 @@ public static boolean isManagedProfileOwner(Context context) {
129129
return false;
130130
}
131131
}
132-
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
133-
return isProfileOwner(context) && userManager.getUserProfiles().size() > 1;
132+
133+
// Pre-N, TestDPC only supports being the profile owner for a managed profile. Other apps
134+
// may support being a profile owner in other contexts (e.g. a secondary user) which will
135+
// require further checks.
136+
return isProfileOwner(context);
134137
}
135138

136139
@TargetApi(VERSION_CODES.M)
@@ -207,4 +210,4 @@ public static boolean installCaCertificate(InputStream certificateInputStream,
207210
private static DevicePolicyManager getDevicePolicyManager(Context context) {
208211
return (DevicePolicyManager)context.getSystemService(Service.DEVICE_POLICY_SERVICE);
209212
}
210-
}
213+
}

app/src/main/java/com/afwsamples/testdpc/provision/PostProvisioningTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public class PostProvisioningTask {
7373

7474
public PostProvisioningTask(Context context) {
7575
mContext = context;
76-
mDevicePolicyManager = context.getSystemService(DevicePolicyManager.class);
76+
mDevicePolicyManager =
77+
(DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
7778
mSharedPrefs = context.getSharedPreferences(POST_PROV_PREFS, Context.MODE_PRIVATE);
7879
}
7980

0 commit comments

Comments
 (0)