public static @Nullable Optional<ComponentName> getProfileOwnerAsUser(final Context context, final UserHandle profile) {
		if (SDK_INT >= Q) return null;
		if (SDK_INT < P) return getProfileOwnerAsUser(context, UserHandles.getIdentifier(profile));
		if (Hacks.DevicePolicyManager_getProfileOwner.isAbsent()) return null;
		try {
			return Optional.ofNullable(Hacks.DevicePolicyManager_getProfileOwner.invoke().on(new DevicePolicies(context, profile).mDevicePolicyManager));
		} catch (final RuntimeException e) {	// IllegalArgumentException("Requested profile owner for invalid userId", re) on API 21~23
			return null;						//   or RuntimeException by RemoteException.rethrowFromSystemServer() on API 24+
		}
	}
Utility to ease the use of {@link android.app.admin.DevicePolicyManager}

Created by Oasis on 2016/6/14.
shared/src/main/java/com/oasisfeng/island/util/DevicePolicies.java