• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 android.security.apc;
18 
19 import android.security.apc.IConfirmationCallback;
20 
21 /** @hide */
22 interface IProtectedConfirmation {
23 
24     /**
25      * When set in the uiOptionFlags parameter of presentPrompt, indicates to the implementation
26      * that it shall use inverted color mode.
27      */
28     const int FLAG_UI_OPTION_INVERTED = 1;
29     /**
30      * When set in the uiOptionFlags parameter of presentPrompt, indicates to the implementation
31      * that it shall use magnified font mode.
32      */
33     const int FLAG_UI_OPTION_MAGNIFIED = 2;
34 
35     /**
36      * Present the confirmation prompt. The caller must implement IConfirmationCallback and pass
37      * it to this function as listener.
38      *
39      * @param listener Must implement IConfirmationCallback. Doubles as session identifier when
40      *           passed to cancelPrompt.
41      * @param promptText The text that will be displayed to the user using the protected
42      *           confirmation UI.
43      * @param extraData Extra data, e.g., a nonce, that will be included in the to-be-signed
44      *           message.
45      * @param locale The locale string is used to select the language for the instructions
46      *           displayed by the confirmation prompt.
47      * @param uiOptionFlags Bitwise combination of FLAG_UI_OPTION_* see above.
48      *
49      * Service specific error codes:
50      *  - ResponseCode.OPERATION_PENDING If another prompt is already pending.
51      *  - ResponseCode.SYSTEM_ERROR An unexpected error occurred.
52      */
presentPrompt(in IConfirmationCallback listener, in String promptText, in byte[] extraData, in String locale, in int uiOptionFlags)53     void presentPrompt(in IConfirmationCallback listener, in String promptText,
54             in byte[] extraData, in String locale, in int uiOptionFlags);
55 
56     /**
57      * Cancel an ongoing prompt.
58      *
59      * @param listener Must implement IConfirmationCallback, although in this context this binder
60      *            token is only used to identify the session that is to be cancelled.
61      *
62      * Service specific error code:
63      *  - ResponseCode.IGNORED If the listener does not represent an ongoing prompt session.
64      */
cancelPrompt(IConfirmationCallback listener)65     void cancelPrompt(IConfirmationCallback listener);
66 
67     /**
68      * Returns true if the device supports Android Protected Confirmation.
69      */
isSupported()70     boolean isSupported();
71 }
72