Communicate right error code from DPMS to MP in response to STATUS_HEADLESS_SYSTEM_USER_MODE_NOT_SUPPORTED
This status code occurs when an user attempts to provision an unsupported DPC into DO on a headless device Bug: 268168017 Test: manual Change-Id: If97998a628279ca4e7c2fba8633f5af1ae408000
This commit is contained in:
@@ -10907,8 +10907,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
/* deviceOwnerUserId= */ deviceOwnerUserId, /* callingUserId*/ caller.getUserId(),
|
||||
isAdb(caller), hasIncompatibleAccountsOrNonAdb);
|
||||
if (code != STATUS_OK) {
|
||||
throw new IllegalStateException(computeProvisioningErrorStringLocked(code,
|
||||
deviceOwnerUserId, owner, showComponentOnError));
|
||||
final String provisioningErrorStringLocked = computeProvisioningErrorStringLocked(code,
|
||||
deviceOwnerUserId, owner, showComponentOnError);
|
||||
if (code == STATUS_HEADLESS_SYSTEM_USER_MODE_NOT_SUPPORTED) {
|
||||
throw new ServiceSpecificException(code, provisioningErrorStringLocked);
|
||||
} else {
|
||||
throw new IllegalStateException(provisioningErrorStringLocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10962,6 +10967,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
case STATUS_HAS_PAIRED:
|
||||
return "Not allowed to set the device owner because this device has already "
|
||||
+ "paired.";
|
||||
case STATUS_HEADLESS_SYSTEM_USER_MODE_NOT_SUPPORTED:
|
||||
return "Cannot provision an unsupported DPC into DO on a"
|
||||
+ " headless device";
|
||||
default:
|
||||
return "Unexpected @ProvisioningPreCondition: " + code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user