Skip to content

Commit 92abd19

Browse files
author
android-build-team Robot
committed
Merge cherrypicks of [2342197] into ub-testdpc-oc-release
Change-Id: Ifbec1e7f1a626fd861ab77f6cebc03d9c35b7105
2 parents c50afdb + 090a276 commit 92abd19

File tree

1 file changed

+6
-3
lines changed
  • app/src/main/java/com/afwsamples/testdpc/common

1 file changed

+6
-3
lines changed

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+
}

0 commit comments

Comments
 (0)