blob: f241a76096676151aefb86e363c05d060fdf2ddf [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();
46 return operation.init(resultCB, promptText, extraData, locale, uiOptions);
47}
48
49Return<ResponseCode> ConfirmationUI::deliverSecureInputEvent(
50 const HardwareAuthToken& secureInputToken) {
51 auto& operation = MyOperation::get();
52 return operation.deliverSecureInputEvent(secureInputToken);
53}
54
55Return<void> ConfirmationUI::abort() {
56 auto& operation = MyOperation::get();
57 operation.abort();
58 operation.finalize(hmacKey);
59 return Void();
60}
61
62} // namespace implementation
63} // namespace V1_0
64} // namespace confirmationui
65} // namespace hardware
66} // namespace android