summaryrefslogtreecommitdiff
path: root/confirmationui/1.0/types.hal
blob: fd7ae6afdd10e2555e8166e4912b1e23ffcca860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.confirmationui@1.0;

/**
 * UI modification options.
 */
enum UIOption : uint32_t {
    /** Accessibility: Requests color inverted style. */
    AccessibilityInverted = 0,
    /** Accessibility: Requests magnified style. */
    AccessibilityMagnified = 1,
};

/**
 * Codes returned by ConfirmationUI API calls.
 */
enum ResponseCode : uint32_t {
    /** API call succeeded or the user gave approval (result callback). */
    OK = 0,
    /** The user canceled the TUI (result callback). */
    Canceled = 1,
    /** IConfirmationUI::abort() was called. (result callback). */
    Aborted = 2,
    /** Cannot start another prompt. */
    OperationPending = 3,
    /** IConfirmationUI::deliverSecureInputEvent call was ingored. */
    Ignored = 4,
    /** An unexpected system error occured. */
    SystemError = 5,
    /** Returned by an unimplemented API call. */
    Unimplemented = 6,
     /**
       * This is returned when an error is diagnosed that should have been
       * caught by earlier input sanitization. Should never be seen in production.
       */
    Unexpected = 7,
    /** General UI error. */
    UIError = 0x10000,
    UIErrorMissingGlyph,
    /**
     * The implementation must return this error code on promptUserConfirmation if the
     * resulting formatted message does not fit into MessageSize::MAX bytes. It is
     * advised that the implementation formats the message upon receiving this API call to
     * be able to diagnose this syndrome.
     */
    UIErrorMessageTooLong,
    UIErrorMalformedUTF8Encoding,
};

/**
 * This defines the maximum message size. This indirectly limits the size of the prompt text
 * and the extra data that can be passed to the confirmation UI. The prompt text and extra data
 * must fit in to this size including CBOR header information.
 */
enum MessageSize : uint32_t { MAX = 0x1800 };

/**
 * The test key is 32byte word with all bytes set to TestKeyBits::BYTE.
 */
enum TestKeyBits: uint8_t { BYTE = 0xA5 };

/**
 * Test mode commands.
 *
 * IConfirmationUI::deliverSecureInputEvent can be used to test certain code paths.
 * To that end, the caller passes an auth token that has an HMAC keyed with the test key
 * (see TestKeyBits in types.hal). Implementations first check the HMAC against test key.
 * If the test key produces a matching HMAC, the implementation evaluates the challenge field
 * of the auth token against the values defined in TestModeCommand.
 * If the command indicates that a confirmation token is to be generated the test key MUST be used
 * to generate this confirmation token.
 *
 * See command code for individual test command descriptions.
 */
enum TestModeCommands: uint64_t {
    /**
     * Simulates the user pressing the OK button on the UI. If no operation is pending
     * ResponseCode::Ignored must be returned. A pending operation is finalized successfully
     * see IConfirmationResultCallback::result, however, the test key (see TestKeyBits) MUST be
     * used to generate the confirmation token.
     */
    OK_EVENT = 0,
    /**
     * Simulates the user pressing the CANCEL button on the UI. If no operation is pending
     * Result::Ignored must be returned. A pending operation is finalized as specified in
     * IConfirmationResultCallback.hal.
     */
    CANCEL_EVENT = 1,
};