1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.devicelockcontroller.common; 18 19 import androidx.annotation.IntDef; 20 21 import java.lang.annotation.ElementType; 22 import java.lang.annotation.Retention; 23 import java.lang.annotation.RetentionPolicy; 24 import java.lang.annotation.Target; 25 26 /** Constants being used by more than one class in the Device Lock application. */ 27 public final class DeviceLockConstants { 28 /** Device reset count down minute when mandatory provision fails */ 29 public static final int MANDATORY_PROVISION_DEVICE_RESET_COUNTDOWN_MINUTE = 2; 30 /** Device reset count down minute when non-mandatory provision fails */ 31 public static final int NON_MANDATORY_PROVISION_DEVICE_RESET_COUNTDOWN_MINUTE = 30; 32 33 // Constants related to unique device identifiers. 34 @Retention(RetentionPolicy.SOURCE) 35 @IntDef(value = { 36 DeviceIdType.DEVICE_ID_TYPE_UNSPECIFIED, 37 DeviceIdType.DEVICE_ID_TYPE_IMEI, 38 DeviceIdType.DEVICE_ID_TYPE_MEID, 39 }) 40 public @interface DeviceIdType { 41 // The device id type is unspecified 42 int DEVICE_ID_TYPE_UNSPECIFIED = -1; 43 // The device id is a IMEI 44 int DEVICE_ID_TYPE_IMEI = 0; 45 // The device id is a MEID 46 int DEVICE_ID_TYPE_MEID = 1; 47 } 48 49 @DeviceIdType 50 private static final int LAST_DEVICE_ID_TYPE = DeviceIdType.DEVICE_ID_TYPE_MEID; 51 public static final int TOTAL_DEVICE_ID_TYPES = LAST_DEVICE_ID_TYPE + 1; 52 53 // Constants related to unique device identifiers. 54 @Retention(RetentionPolicy.SOURCE) 55 @IntDef(value = { 56 STATUS_UNSPECIFIED, 57 RETRY_CHECK_IN, 58 READY_FOR_PROVISION, 59 STOP_CHECK_IN, 60 }) 61 public @interface DeviceCheckInStatus { 62 } 63 64 public static final int STATUS_UNSPECIFIED = 0; 65 public static final int RETRY_CHECK_IN = 1; 66 public static final int READY_FOR_PROVISION = 2; 67 public static final int STOP_CHECK_IN = 3; 68 69 @Retention(RetentionPolicy.SOURCE) 70 @IntDef(value = { 71 REASON_UNSPECIFIED, 72 USER_DEFERRED_DEVICE_PROVISIONING, 73 }) 74 public @interface PauseDeviceProvisioningReason { 75 } 76 77 public static final int REASON_UNSPECIFIED = 0; 78 public static final int USER_DEFERRED_DEVICE_PROVISIONING = 1; 79 80 @Target(ElementType.TYPE_USE) 81 @Retention(RetentionPolicy.SOURCE) 82 @IntDef(value = { 83 ProvisioningType.TYPE_UNDEFINED, 84 ProvisioningType.TYPE_FINANCED, 85 ProvisioningType.TYPE_SUBSIDY, 86 }) 87 public @interface ProvisioningType { 88 int TYPE_UNDEFINED = 0; 89 int TYPE_FINANCED = 1; 90 int TYPE_SUBSIDY = 2; 91 } 92 93 @Retention(RetentionPolicy.SOURCE) 94 @IntDef(value = { 95 ProvisionFailureReason.UNKNOWN_REASON, 96 ProvisionFailureReason.PLAY_TASK_UNAVAILABLE, 97 ProvisionFailureReason.PLAY_INSTALLATION_FAILED, 98 ProvisionFailureReason.COUNTRY_INFO_UNAVAILABLE, 99 ProvisionFailureReason.NOT_IN_ELIGIBLE_COUNTRY, 100 ProvisionFailureReason.POLICY_ENFORCEMENT_FAILED, 101 }) 102 public @interface ProvisionFailureReason { 103 int UNKNOWN_REASON = 0; 104 int PLAY_TASK_UNAVAILABLE = 1; 105 int PLAY_INSTALLATION_FAILED = 2; 106 int COUNTRY_INFO_UNAVAILABLE = 3; 107 int NOT_IN_ELIGIBLE_COUNTRY = 4; 108 int POLICY_ENFORCEMENT_FAILED = 5; 109 int DEADLINE_PASSED = 6; 110 } 111 112 public static final String EXTRA_KIOSK_PACKAGE = 113 "com.android.devicelockcontroller.KIOSK_PACKAGE"; 114 public static final String EXTRA_KIOSK_DISABLE_OUTGOING_CALLS = 115 "com.android.devicelockcontroller.KIOSK_DISABLE_OUTGOING_CALLS"; 116 /** 117 * Used to control if notifications are enabled in lock task mode. The default value is false. 118 * 119 * @see android.app.admin.DevicePolicyManager#LOCK_TASK_FEATURE_NOTIFICATIONS 120 */ 121 public static final String EXTRA_KIOSK_ENABLE_NOTIFICATIONS_IN_LOCK_TASK_MODE = 122 "com.android.devicelockcontroller.KIOSK_ENABLE_NOTIFICATIONS_IN_LOCK_TASK_MODE"; 123 124 /** 125 * Used to control if adb debugging should be allowed on prod devices. The default value is 126 * false. 127 */ 128 public static final String EXTRA_ALLOW_DEBUGGING = 129 "com.android.devicelockcontroller.ALLOW_DEBUGGING"; 130 public static final String EXTRA_KIOSK_ALLOWLIST = 131 "com.android.devicelockcontroller.KIOSK_ALLOWLIST"; 132 public static final String EXTRA_PROVISIONING_TYPE = 133 "com.android.devicelockcontroller.PROVISIONING_TYPE"; 134 public static final String EXTRA_MANDATORY_PROVISION = 135 "com.android.devicelockcontroller.MANDATORY_PROVISION"; 136 public static final String EXTRA_KIOSK_APP_PROVIDER_NAME = 137 "com.android.devicelockcontroller.KIOSK_APP_PROVIDER_NAME"; 138 public static final String EXTRA_DISALLOW_INSTALLING_FROM_UNKNOWN_SOURCES = 139 "com.android.devicelockcontroller.DISALLOW_INSTALLING_FROM_UNKNOWN_SOURCES"; 140 141 public static final String EXTRA_TERMS_AND_CONDITIONS_URL = 142 "com.android.devicelockcontroller.TERMS_AND_CONDITIONS_URL"; 143 144 public static final String EXTRA_SUPPORT_URL = "com.android.devicelockcontroller.SUPPORT_URL"; 145 146 public static final String ACTION_START_DEVICE_FINANCING_PROVISIONING = 147 "com.android.devicelockcontroller.action.START_DEVICE_FINANCING_PROVISIONING"; 148 149 public static final String ACTION_START_DEVICE_SUBSIDY_PROVISIONING = 150 "com.android.devicelockcontroller.action.START_DEVICE_SUBSIDY_PROVISIONING"; 151 152 /** Definitions for device provision states. */ 153 @Retention(RetentionPolicy.SOURCE) 154 @IntDef( 155 value = { 156 DeviceProvisionState.PROVISION_STATE_UNSPECIFIED, 157 DeviceProvisionState.PROVISION_STATE_RETRY, 158 DeviceProvisionState.PROVISION_STATE_DISMISSIBLE_UI, 159 DeviceProvisionState.PROVISION_STATE_PERSISTENT_UI, 160 DeviceProvisionState.PROVISION_STATE_FACTORY_RESET, 161 DeviceProvisionState.PROVISION_STATE_SUCCESS, 162 }) 163 public @interface DeviceProvisionState { 164 /** The provision state of the device is unspecified */ 165 int PROVISION_STATE_UNSPECIFIED = 0; 166 /** The Device need retry to provision the device. */ 167 int PROVISION_STATE_RETRY = 1; 168 /** 169 * The Device need inform the user that there has been an issue with device provisioning. 170 * The user can dismiss this. 171 */ 172 int PROVISION_STATE_DISMISSIBLE_UI = 2; 173 /** 174 * The Device need inform the user that there has been an issue with device provisioning. 175 * The user cannot dismiss this. 176 */ 177 int PROVISION_STATE_PERSISTENT_UI = 3; 178 /** The Device need factory reset because device provisioning could not be done. */ 179 int PROVISION_STATE_FACTORY_RESET = 4; 180 /** Device provisioning was a success. */ 181 int PROVISION_STATE_SUCCESS = 5; 182 } 183 184 /** Prevent instantiation. */ DeviceLockConstants()185 private DeviceLockConstants() { 186 } 187 } 188