1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::HardwareAuthToken; 20*4d7e907cSAndroid Build Coastguard Workerimport IConfirmationResultCallback; 21*4d7e907cSAndroid Build Coastguard Worker 22*4d7e907cSAndroid Build Coastguard Workerinterface IConfirmationUI { 23*4d7e907cSAndroid Build Coastguard Worker /** 24*4d7e907cSAndroid Build Coastguard Worker * Asynchronously initiates a confirmation UI dialog prompting the user to confirm a given text. 25*4d7e907cSAndroid Build Coastguard Worker * The TUI prompt must be implemented in such a way that a positive response indicates with 26*4d7e907cSAndroid Build Coastguard Worker * high confidence that a user has seen the given prompt text even if the Android framework 27*4d7e907cSAndroid Build Coastguard Worker * including the kernel was compromised. 28*4d7e907cSAndroid Build Coastguard Worker * 29*4d7e907cSAndroid Build Coastguard Worker * @param resultCB Implementation of IResultCallback. Used by the implementation to report 30*4d7e907cSAndroid Build Coastguard Worker * the result of the current pending user prompt. 31*4d7e907cSAndroid Build Coastguard Worker * 32*4d7e907cSAndroid Build Coastguard Worker * @param promptText UTF-8 encoded string which is to be presented to the user. 33*4d7e907cSAndroid Build Coastguard Worker * 34*4d7e907cSAndroid Build Coastguard Worker * @param extraData A binary blob that must be included in the formatted output message as is. 35*4d7e907cSAndroid Build Coastguard Worker * It is opaque to the implementation. Implementations must neither interpret 36*4d7e907cSAndroid Build Coastguard Worker * nor modify the content. 37*4d7e907cSAndroid Build Coastguard Worker * 38*4d7e907cSAndroid Build Coastguard Worker * @param locale String specifying the locale that must be used by the TUI dialog. The string 39*4d7e907cSAndroid Build Coastguard Worker * is an IETF BCP 47 tag. 40*4d7e907cSAndroid Build Coastguard Worker * 41*4d7e907cSAndroid Build Coastguard Worker * @param uiOptions A set of uiOptions manipulating how the confirmation prompt is displayed. 42*4d7e907cSAndroid Build Coastguard Worker * Refer to UIOption in types.hal for possible options. 43*4d7e907cSAndroid Build Coastguard Worker * 44*4d7e907cSAndroid Build Coastguard Worker * @return error - OK: IFF the dialog was successfully started. In this case, and only in this 45*4d7e907cSAndroid Build Coastguard Worker * case, the implementation must, eventually, call the callback to 46*4d7e907cSAndroid Build Coastguard Worker * indicate completion. 47*4d7e907cSAndroid Build Coastguard Worker * - OperationPending: Is returned when the confirmation provider is currently 48*4d7e907cSAndroid Build Coastguard Worker * in use. 49*4d7e907cSAndroid Build Coastguard Worker * - SystemError: An error occurred trying to communicate with the confirmation 50*4d7e907cSAndroid Build Coastguard Worker * provider (e.g. trusted app). 51*4d7e907cSAndroid Build Coastguard Worker * - UIError: The confirmation provider encountered an issue with displaying 52*4d7e907cSAndroid Build Coastguard Worker * the prompt text to the user. 53*4d7e907cSAndroid Build Coastguard Worker */ 54*4d7e907cSAndroid Build Coastguard Worker promptUserConfirmation(IConfirmationResultCallback resultCB, string promptText, 55*4d7e907cSAndroid Build Coastguard Worker vec<uint8_t> extraData, string locale, vec<UIOption> uiOptions) 56*4d7e907cSAndroid Build Coastguard Worker generates(ResponseCode error); 57*4d7e907cSAndroid Build Coastguard Worker 58*4d7e907cSAndroid Build Coastguard Worker /** 59*4d7e907cSAndroid Build Coastguard Worker * DeliverSecureInput is used by the framework to deliver a secure input event to the 60*4d7e907cSAndroid Build Coastguard Worker * confirmation provider. 61*4d7e907cSAndroid Build Coastguard Worker * 62*4d7e907cSAndroid Build Coastguard Worker * VTS test mode: 63*4d7e907cSAndroid Build Coastguard Worker * This function can be used to test certain code paths non-interactively. See TestModeCommands 64*4d7e907cSAndroid Build Coastguard Worker * in types.hal for details. 65*4d7e907cSAndroid Build Coastguard Worker * 66*4d7e907cSAndroid Build Coastguard Worker * @param secureInputToken An authentication token as generated by Android authentication 67*4d7e907cSAndroid Build Coastguard Worker * providers. 68*4d7e907cSAndroid Build Coastguard Worker * 69*4d7e907cSAndroid Build Coastguard Worker * @return error - Ignored: Unless used for testing (See TestModeCommands). 70*4d7e907cSAndroid Build Coastguard Worker */ 71*4d7e907cSAndroid Build Coastguard Worker deliverSecureInputEvent(HardwareAuthToken secureInputToken) 72*4d7e907cSAndroid Build Coastguard Worker generates(ResponseCode error); 73*4d7e907cSAndroid Build Coastguard Worker 74*4d7e907cSAndroid Build Coastguard Worker /** 75*4d7e907cSAndroid Build Coastguard Worker * Aborts a pending user prompt. This allows the framework to gracefully end a TUI dialog. 76*4d7e907cSAndroid Build Coastguard Worker * If a TUI operation was pending the corresponding call back is informed with 77*4d7e907cSAndroid Build Coastguard Worker * ErrorCode::Aborted. 78*4d7e907cSAndroid Build Coastguard Worker */ 79*4d7e907cSAndroid Build Coastguard Worker abort(); 80*4d7e907cSAndroid Build Coastguard Worker}; 81*4d7e907cSAndroid Build Coastguard Worker 82