blob: 41e03ce80af25213b3a51999790a2751a0a05e4f [file] [log] [blame]
Janis Danisevskisa0c33ea2017-11-09 14:58:36 -08001/*
2**
3** Copyright 2017, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18#include "ConfirmationUI.h"
19
20#include "PlatformSpecifics.h"
21
22#include <android/hardware/confirmationui/support/cbor.h>
23#include <android/hardware/confirmationui/support/confirmationui_utils.h>
24
25#include <android/hardware/confirmationui/1.0/generic/GenericOperation.h>
26
27#include <time.h>
28
29namespace android {
30namespace hardware {
31namespace confirmationui {
32namespace V1_0 {
33namespace implementation {
34
35using ::android::hardware::confirmationui::V1_0::generic::Operation;
36using ::android::hardware::keymaster::V4_0::HardwareAuthToken;
37
38uint8_t hmacKey[32];
39
40// Methods from ::android::hardware::confirmationui::V1_0::IConfirmationUI follow.
41Return<ResponseCode> ConfirmationUI::promptUserConfirmation(
42 const sp<IConfirmationResultCallback>& resultCB, const hidl_string& promptText,
43 const hidl_vec<uint8_t>& extraData, const hidl_string& locale,
44 const hidl_vec<UIOption>& uiOptions) {
45 auto& operation = MyOperation::get();
Janis Danisevskisbb6377e2018-02-23 11:23:20 -080046 auto result = operation.init(resultCB, promptText, extraData, locale, uiOptions);
47 if (result == ResponseCode::OK) {
48 // This is where implementation start the UI and then call setPending on success.
49 operation.setPending();
50 }
51 return result;
Janis Danisevskisa0c33ea2017-11-09 14:58:36 -080052}
53
54Return<ResponseCode> ConfirmationUI::deliverSecureInputEvent(
55 const HardwareAuthToken& secureInputToken) {
56 auto& operation = MyOperation::get();
57 return operation.deliverSecureInputEvent(secureInputToken);
58}
59
60Return<void> ConfirmationUI::abort() {
61 auto& operation = MyOperation::get();
62 operation.abort();
63 operation.finalize(hmacKey);
64 return Void();
65}
66
67} // namespace implementation
68} // namespace V1_0
69} // namespace confirmationui
70} // namespace hardware
71} // namespace android