blob: f58c96b7384e10c3746089429177306005f6525c [file] [log] [blame]
Zachary Heidepriem7547d3e2017-11-06 19:10:44 -08001/*
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
17package com.android.voicemail;
18
19import android.support.annotation.IntDef;
20import android.support.annotation.WorkerThread;
21import java.lang.annotation.Retention;
22import java.lang.annotation.RetentionPolicy;
23
24/** Interface to change the PIN used to access the mailbox by calling. */
25public 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}