Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ef04bfb authored by Craig Lafayette's avatar Craig Lafayette
Browse files

DeviceInitializerStatus API review changes

- Remove DeviceInitializerStatus.is*Status()
- Remove DeviceInitializerStatus.FLAG_STATUS_RESERVED
- Rename STATUS_STATE_CONNECT_BLUETOOTH_PROXY to
  STATUS_STATE_CONNECTING_BLUETOOTH_PROXY
- Rename STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY to
  STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY

Bug: 20819590
Change-Id: I276c5674a36726d3681dcc29e896ad39888d116d
parent 6223ec12
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -5696,9 +5696,6 @@ package android.app.admin {
  }
  public class DeviceInitializerStatus {
    method public static boolean isCustomStatus(int);
    method public static boolean isErrorStatus(int);
    method public static boolean isHighPriority(int);
    field public static final int FLAG_STATUS_CUSTOM = 33554432; // 0x2000000
    field public static final int FLAG_STATUS_ERROR = 16777216; // 0x1000000
    field public static final int FLAG_STATUS_HIGH_PRIORITY = 134217728; // 0x8000000
@@ -5710,9 +5707,9 @@ package android.app.admin {
    field public static final int STATUS_ERROR_INSTALL_PACKAGE = 16777240; // 0x1000018
    field public static final int STATUS_ERROR_RESET_PROTECTION_BLOCKING_PROVISIONING = 16777238; // 0x1000016
    field public static final int STATUS_ERROR_SET_DEVICE_POLICY = 16777241; // 0x1000019
    field public static final int STATUS_STATE_CONNECT_BLUETOOTH_PROXY = 134217736; // 0x8000008
    field public static final int STATUS_STATE_CONNECTING_BLUETOOTH_PROXY = 134217736; // 0x8000008
    field public static final int STATUS_STATE_DEVICE_PROVISIONED = 134217738; // 0x800000a
    field public static final int STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY = 134217737; // 0x8000009
    field public static final int STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY = 134217737; // 0x8000009
  }
  public class DevicePolicyManager {
+2 −5
Original line number Diff line number Diff line
@@ -5792,9 +5792,6 @@ package android.app.admin {
  }
  public class DeviceInitializerStatus {
    method public static boolean isCustomStatus(int);
    method public static boolean isErrorStatus(int);
    method public static boolean isHighPriority(int);
    field public static final int FLAG_STATUS_CUSTOM = 33554432; // 0x2000000
    field public static final int FLAG_STATUS_ERROR = 16777216; // 0x1000000
    field public static final int FLAG_STATUS_HIGH_PRIORITY = 134217728; // 0x8000000
@@ -5806,9 +5803,9 @@ package android.app.admin {
    field public static final int STATUS_ERROR_INSTALL_PACKAGE = 16777240; // 0x1000018
    field public static final int STATUS_ERROR_RESET_PROTECTION_BLOCKING_PROVISIONING = 16777238; // 0x1000016
    field public static final int STATUS_ERROR_SET_DEVICE_POLICY = 16777241; // 0x1000019
    field public static final int STATUS_STATE_CONNECT_BLUETOOTH_PROXY = 134217736; // 0x8000008
    field public static final int STATUS_STATE_CONNECTING_BLUETOOTH_PROXY = 134217736; // 0x8000008
    field public static final int STATUS_STATE_DEVICE_PROVISIONED = 134217738; // 0x800000a
    field public static final int STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY = 134217737; // 0x8000009
    field public static final int STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY = 134217737; // 0x8000009
  }
  public class DevicePolicyManager {
+4 −36
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ package android.app.admin;
 * <li>{@link #STATUS_ERROR_SET_DEVICE_POLICY}
 * <li>{@link #STATUS_ERROR_DELETE_APPS}
 * <li>{@link #STATUS_ERROR_DOUBLE_BUMP}
 * <li>{@link #STATUS_STATE_CONNECT_BLUETOOTH_PROXY}
 * <li>{@link #STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY}
 * <li>{@link #STATUS_STATE_CONNECTING_BLUETOOTH_PROXY}
 * <li>{@link #STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY}
 * <li>{@link #STATUS_STATE_DEVICE_PROVISIONED}
 * </ul>
 */
@@ -84,13 +84,13 @@ public class DeviceInitializerStatus {
     * Device provisioning status code that indicates that a device is connecting to establish
     * a Bluetooth network proxy.
     */
    public static final int STATUS_STATE_CONNECT_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 8;
    public static final int STATUS_STATE_CONNECTING_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 8;

    /**
     * Device provisioning status code that indicates that a connected Bluetooth network proxy
     * is being shut down.
     */
    public static final int STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 9;
    public static final int STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 9;

    /**
     * Device provisioning status code that indicates that a device has been successfully
@@ -141,37 +141,5 @@ public class DeviceInitializerStatus {
     */
    public static final int STATUS_ERROR_DOUBLE_BUMP = FLAG_STATUS_ERROR | 30;

    /**
     * Determine if the specified status code represents an error status.
     * @param statusCode status code to check
     * @return {@code true} if the status code is an error status code
     */
    public static boolean isErrorStatus(int statusCode) {
        return isFlagSet(statusCode, FLAG_STATUS_ERROR);
    }

    /**
     * Determine if the specified status code is a custom status. Custom status codes are defined
     * and sent by device initialization agents.
     * @param statusCode status code to check
     * @return {@code true} if the status code is a custom status code
     */
    public static boolean isCustomStatus(int statusCode) {
        return isFlagSet(statusCode, FLAG_STATUS_CUSTOM);
    }

    /**
     * Determine if the specified status code is a high priority status code.
     * @param statusCode status code to check
     * @return {@code true} if the status code is a high priority status code
     */
    public static boolean isHighPriority(int statusCode) {
        return isFlagSet(statusCode, FLAG_STATUS_HIGH_PRIORITY);
    }

    private static boolean isFlagSet(int statusCode, int flag) {
        return (statusCode & flag) != 0;
    }

    private DeviceInitializerStatus() {}
}
+3 −3
Original line number Diff line number Diff line
@@ -702,7 +702,7 @@ public class DevicePolicyManager {
     * reported to the remote setup device over Bluetooth.
     *
     * <p>Broadcasts with this action must supply a
     * {@linkplain DeviceInitializerStatus#isCustomStatus(int) custom} status code in the
     * {@linkplain DeviceInitializerStatus#FLAG_STATUS_CUSTOM custom} status code in the
     * {@link EXTRA_DEVICE_INITIALIZER_STATUS_CODE} extra.
     *
     * <p>Broadcasts may optionally contain a description in the
@@ -718,7 +718,7 @@ public class DevicePolicyManager {
     * sent as part of a broadcast with an action of {@code ACTION_SEND_DEVICE_INITIALIZER_STATUS}.
     *
     * <p>The status code sent with this extra must be a custom status code as defined by
     * {@link DeviceInitializerStatus#isCustomStatus(int)}.
     * {@link DeviceInitializerStatus#FLAG_STATUS_CUSTOM}.
     * @hide
     */
    @SystemApi
@@ -4229,7 +4229,7 @@ public class DevicePolicyManager {
     * Called by device initializer to send a provisioning status update to the remote setup device.
     *
     * @param statusCode a custom status code value as defined by
     *    {@link DeviceInitializerStatus#isCustomStatus(int)}.
     *    {@link DeviceInitializerStatus#FLAG_STATUS_CUSTOM}.
     * @param description custom description of the status code sent
     */
    public void sendDeviceInitializerStatus(int statusCode, String description) {