1 /* 2 * Copyright (C) 2019 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.car.setupwizardlib; 18 19 import android.annotation.IntDef; 20 21 /** 22 * Defines the constants used for the communication between the client and service in setting 23 * the initial lock. 24 */ 25 public interface InitialLockSetupConstants { 26 27 /** 28 * The library version. All relevant changes should bump this version number and ensure 29 * all relevant parts of the interface handle backwards compatibility. 30 */ 31 int LIBRARY_VERSION = 1; 32 33 /** 34 * Lock types supported by the InitialLockSetupService. 35 */ 36 @IntDef({ 37 LockTypes.PASSWORD, 38 LockTypes.PIN, 39 LockTypes.PATTERN, 40 LockTypes.NONE 41 }) 42 @interface LockTypes { 43 int PASSWORD = 0; 44 int PIN = 1; 45 int PATTERN = 2; 46 int NONE = 3; 47 } 48 49 /** 50 * Result codes from validating a lock. No flags (0) indicates success. 51 */ 52 @IntDef(flag = true, value = { 53 ValidateLockFlags.INVALID_LENGTH, 54 ValidateLockFlags.INVALID_BAD_SYMBOLS, 55 ValidateLockFlags.INVALID_LACKS_COMPLEXITY, 56 ValidateLockFlags.INVALID_GENERIC 57 }) 58 @interface ValidateLockFlags { 59 int INVALID_LENGTH = 1 << 0; 60 int INVALID_BAD_SYMBOLS = 1 << 1; 61 int INVALID_LACKS_COMPLEXITY = 1 << 2; 62 int INVALID_GENERIC = 1 << 3; 63 } 64 65 /** 66 * Result codes from attempting to set a lock. 67 */ 68 @IntDef({ 69 SetLockCodes.SUCCESS, 70 SetLockCodes.FAIL_LOCK_EXISTS, 71 SetLockCodes.FAIL_LOCK_INVALID, 72 SetLockCodes.FAIL_LOCK_GENERIC 73 }) 74 @interface SetLockCodes { 75 int SUCCESS = 1; 76 int FAIL_LOCK_EXISTS = -1; 77 int FAIL_LOCK_INVALID = -2; 78 int FAIL_LOCK_GENERIC = -3; 79 } 80 81 /** PasswordComplexity as defined in DevicePolicyManager. */ 82 @IntDef({ 83 PasswordComplexity.PASSWORD_COMPLEXITY_NONE, 84 PasswordComplexity.PASSWORD_COMPLEXITY_LOW, 85 PasswordComplexity.PASSWORD_COMPLEXITY_MEDIUM, 86 PasswordComplexity.PASSWORD_COMPLEXITY_HIGH, 87 }) 88 @interface PasswordComplexity { 89 int PASSWORD_COMPLEXITY_NONE = 0; 90 int PASSWORD_COMPLEXITY_LOW = 0x10000; 91 int PASSWORD_COMPLEXITY_MEDIUM = 0x30000; 92 int PASSWORD_COMPLEXITY_HIGH = 0x50000; 93 } 94 } 95 96