Add extra to inform the role holder of the update attempt result

Role holders can request an update. When that happens, the flow
returns back to platform, platform performs the update and checks
the update result. If update was successful, it restared the role
holder, and if not, it failed provisioning. This CL updates this
so that the role holder is _always_ started, regardless of the
update result. That way the role holder can make a decision
whether to continue provisioning or fail it.

Bug: 224993192
Test: none
Change-Id: Ia7dd61d02c568e8c8ad17af0a61106d127c4869a
This commit is contained in:
arangelov
2022-03-16 18:00:32 +00:00
parent bcfeecc59a
commit 4fe4b2e65d
2 changed files with 29 additions and 0 deletions

View File

@@ -1149,6 +1149,7 @@ package android.app.admin {
field public static final String EXTRA_RESTRICTION = "android.app.extra.RESTRICTION";
field public static final String EXTRA_ROLE_HOLDER_PROVISIONING_INITIATOR_PACKAGE = "android.app.extra.ROLE_HOLDER_PROVISIONING_INITIATOR_PACKAGE";
field public static final String EXTRA_ROLE_HOLDER_STATE = "android.app.extra.ROLE_HOLDER_STATE";
field public static final String EXTRA_ROLE_HOLDER_UPDATE_RESULT_CODE = "android.app.extra.ROLE_HOLDER_UPDATE_RESULT_CODE";
field public static final int FLAG_SUPPORTED_MODES_DEVICE_OWNER = 4; // 0x4
field public static final int FLAG_SUPPORTED_MODES_ORGANIZATION_OWNED = 1; // 0x1
field public static final int FLAG_SUPPORTED_MODES_PERSONALLY_OWNED = 2; // 0x2

View File

@@ -3345,6 +3345,34 @@ public class DevicePolicyManager {
public static final int
RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_PROVISIONING_DISABLED = 3;
/**
* An {@code int} extra which contains the result code of the last attempt to update
* the device policy management role holder.
*
* <p>This extra is provided to the device policy management role holder via either {@link
* #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} or {@link
* #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE} when started after the role holder
* had previously returned {@link #RESULT_UPDATE_ROLE_HOLDER}.
*
* <p>If the role holder update had failed, the role holder can use the value of this extra to
* make a decision whether to fail the provisioning flow or to carry on with the older version
* of the role holder.
*
* <p>Possible values can be:
* <ul>
* <li>{@link Activity#RESULT_OK} if the update was successful
* <li>{@link #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR} if it
* encounters a problem that may be solved by relaunching it again.
* <li>{@link #RESULT_UPDATE_DEVICE_POLICY_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR} if
* it encounters a problem that will not be solved by relaunching it again.
* </ul>
*
* @hide
*/
@SystemApi
public static final String EXTRA_ROLE_HOLDER_UPDATE_RESULT_CODE =
"android.app.extra.ROLE_HOLDER_UPDATE_RESULT_CODE";
/**
* An {@link Intent} extra which resolves to a custom user consent screen.
*