Zachary Heidepriem | 7547d3e | 2017-11-06 19:10:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.voicemail; |
| 18 | |
| 19 | import android.support.annotation.IntDef; |
| 20 | import android.support.annotation.WorkerThread; |
| 21 | import java.lang.annotation.Retention; |
| 22 | import java.lang.annotation.RetentionPolicy; |
| 23 | |
| 24 | /** Interface to change the PIN used to access the mailbox by calling. */ |
| 25 | public interface PinChanger { |
| 26 | |
| 27 | /** Results from {@link #changePin(String, String)} */ |
| 28 | @Retention(RetentionPolicy.SOURCE) |
| 29 | @IntDef( |
| 30 | value = { |
| 31 | CHANGE_PIN_SUCCESS, |
| 32 | CHANGE_PIN_TOO_SHORT, |
| 33 | CHANGE_PIN_TOO_LONG, |
| 34 | CHANGE_PIN_TOO_WEAK, |
| 35 | CHANGE_PIN_MISMATCH, |
| 36 | CHANGE_PIN_INVALID_CHARACTER, |
| 37 | CHANGE_PIN_SYSTEM_ERROR |
| 38 | } |
| 39 | ) |
| 40 | @interface ChangePinResult {} |
| 41 | |
| 42 | int CHANGE_PIN_SUCCESS = 0; |
| 43 | int CHANGE_PIN_TOO_SHORT = 1; |
| 44 | int CHANGE_PIN_TOO_LONG = 2; |
| 45 | int CHANGE_PIN_TOO_WEAK = 3; |
| 46 | int CHANGE_PIN_MISMATCH = 4; |
| 47 | int CHANGE_PIN_INVALID_CHARACTER = 5; |
| 48 | int CHANGE_PIN_SYSTEM_ERROR = 6; |
| 49 | |
| 50 | @WorkerThread |
| 51 | @ChangePinResult |
| 52 | int changePin(String oldPin, String newPin); |
| 53 | |
| 54 | /** |
| 55 | * Set the scrambled PIN if it is auto generated during provisioning. Set to {@code null} to |
| 56 | * clear. |
| 57 | */ |
| 58 | void setScrambledPin(String pin); |
| 59 | |
| 60 | String getScrambledPin(); |
| 61 | |
| 62 | /** Format requirements for the PIN. */ |
| 63 | class PinSpecification { |
| 64 | public int minLength; |
| 65 | public int maxLength; |
| 66 | } |
| 67 | |
| 68 | PinSpecification getPinSpecification(); |
| 69 | } |