PolicyUpdateResult

public final class PolicyUpdateResult
extends Object

java.lang.Object
   ↳ android.app.admin.PolicyUpdateResult


Class containing the reason for the policy (set from DevicePolicyManager) update (e.g. success, failure reasons, etc.). This is passed in to PolicyUpdateReceiver#onPolicySetResult) and PolicyUpdateReceiver#onPolicyChanged).

Summary

Constants

int RESULT_FAILURE_CONFLICTING_ADMIN_POLICY

Result code to indicate that the policy has not been enforced or has changed because another admin has set a conflicting policy on the device.

int RESULT_FAILURE_HARDWARE_LIMITATION

Result code to indicate that the policy set by the admin has not been enforced because of a permanent hardware limitation/issue.

int RESULT_FAILURE_STORAGE_LIMIT_REACHED

Result code to indicate that the policy set by the admin has not been enforced because the local storage has reached its max limit.

int RESULT_FAILURE_UNKNOWN

Result code to indicate that the policy has not been enforced or has changed for an unknown reason.

int RESULT_POLICY_CLEARED

Result code to indicate that the policy set by the admin has been successfully cleared, admins will no longer receive policy updates for this policy after this point.

int RESULT_POLICY_SET

Result code to indicate that the policy has been changed to the desired value set by the admin.

Public constructors

PolicyUpdateResult(int resultCode)

Constructor for PolicyUpdateResult that takes in a result code describing why the policy has changed.

Public methods

int getResultCode()

Returns result code describing why the policy has changed.

Inherited methods

Constants

RESULT_FAILURE_CONFLICTING_ADMIN_POLICY

Added in API level 34
public static final int RESULT_FAILURE_CONFLICTING_ADMIN_POLICY

Result code to indicate that the policy has not been enforced or has changed because another admin has set a conflicting policy on the device.

The system will automatically try to enforce the policy when it can without additional calls from the admin.

Constant Value: 1 (0x00000001)

RESULT_FAILURE_HARDWARE_LIMITATION

Added in API level 34
public static final int RESULT_FAILURE_HARDWARE_LIMITATION

Result code to indicate that the policy set by the admin has not been enforced because of a permanent hardware limitation/issue.

The system will NOT try to automatically store and enforce this policy again.

Constant Value: 4 (0x00000004)

RESULT_FAILURE_STORAGE_LIMIT_REACHED

Added in API level 34
public static final int RESULT_FAILURE_STORAGE_LIMIT_REACHED

Result code to indicate that the policy set by the admin has not been enforced because the local storage has reached its max limit.

The system will NOT try to automatically store and enforce this policy again.

Constant Value: 3 (0x00000003)

RESULT_FAILURE_UNKNOWN

Added in API level 34
public static final int RESULT_FAILURE_UNKNOWN

Result code to indicate that the policy has not been enforced or has changed for an unknown reason.

Constant Value: -1 (0xffffffff)

RESULT_POLICY_CLEARED

Added in API level 34
public static final int RESULT_POLICY_CLEARED

Result code to indicate that the policy set by the admin has been successfully cleared, admins will no longer receive policy updates for this policy after this point.

Note that the policy can still be enforced by some other admin.

Constant Value: 2 (0x00000002)

RESULT_POLICY_SET

Added in API level 34
public static final int RESULT_POLICY_SET

Result code to indicate that the policy has been changed to the desired value set by the admin.

Constant Value: 0 (0x00000000)

Public constructors

PolicyUpdateResult

Added in API level 34
public PolicyUpdateResult (int resultCode)

Constructor for PolicyUpdateResult that takes in a result code describing why the policy has changed.

Parameters
resultCode int: Describes why the policy has changed. Value is RESULT_FAILURE_UNKNOWN, RESULT_POLICY_SET, RESULT_FAILURE_CONFLICTING_ADMIN_POLICY, RESULT_POLICY_CLEARED, RESULT_FAILURE_STORAGE_LIMIT_REACHED, or RESULT_FAILURE_HARDWARE_LIMITATION

Public methods

getResultCode

Added in API level 34
public int getResultCode ()

Returns result code describing why the policy has changed.

Returns
int Value is RESULT_FAILURE_UNKNOWN, RESULT_POLICY_SET, RESULT_FAILURE_CONFLICTING_ADMIN_POLICY, RESULT_POLICY_CLEARED, RESULT_FAILURE_STORAGE_LIMIT_REACHED, or RESULT_FAILURE_HARDWARE_LIMITATION