List of usage examples for android.app.admin DevicePolicyManager setProfileOwner
public boolean setProfileOwner(@NonNull ComponentName admin, @Deprecated String ownerName, int userHandle) throws IllegalArgumentException
From source file:com.android.managedprovisioning.ProfileOwnerProvisioningService.java
private void setMdmAsManagedProfileOwner() throws ProvisioningException { ProvisionLogger.logd("Setting package " + mParams.deviceAdminComponentName + " as managed profile owner."); DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); if (!dpm.setProfileOwner(mParams.deviceAdminComponentName, mParams.deviceAdminComponentName.getPackageName(), mManagedProfileOrUserInfo.id)) { ProvisionLogger.logw("Could not set profile owner."); throw raiseError("Could not set profile owner."); }/* ww w. j av a2 s. co m*/ }