diff options
author | android-build-team Robot | 2018-01-31 11:25:54 -0600 |
---|---|---|
committer | android-build-team Robot | 2018-01-31 11:25:54 -0600 |
commit | a3f2d3b8f411384cad8ca0cd2bcd819e8e1a728f (patch) | |
tree | d29244ec1086ad96b9620d91d57b43f13ea75496 | |
parent | f7b598d61fe38b28e24fa08c9c4d3fa57e2119e7 (diff) | |
parent | 9fe3cc4e3411c8fb45736919116d51b66c7d3950 (diff) | |
download | platform-hardware-interfaces-a3f2d3b8f411384cad8ca0cd2bcd819e8e1a728f.tar.gz platform-hardware-interfaces-a3f2d3b8f411384cad8ca0cd2bcd819e8e1a728f.tar.xz platform-hardware-interfaces-a3f2d3b8f411384cad8ca0cd2bcd819e8e1a728f.zip |
Snap for 4577102 from 9fe3cc4e3411c8fb45736919116d51b66c7d3950 to pi-release
Change-Id: I848eab11c4e5ee6ee135290d9f93c7e6d34bd8ef
-rw-r--r-- | automotive/vehicle/2.0/Android.bp | 1 | ||||
-rw-r--r-- | automotive/vehicle/2.0/types.hal | 54 | ||||
-rw-r--r-- | health/2.0/README | 2 | ||||
-rw-r--r-- | media/bufferpool/1.0/Android.bp | 26 | ||||
-rw-r--r-- | media/bufferpool/1.0/IAccessor.hal | 68 | ||||
-rw-r--r-- | media/bufferpool/1.0/IClientManager.hal | 47 | ||||
-rw-r--r-- | media/bufferpool/1.0/IConnection.hal | 43 | ||||
-rw-r--r-- | media/bufferpool/1.0/README.md | 54 | ||||
-rw-r--r-- | media/bufferpool/1.0/types.hal | 93 | ||||
-rw-r--r-- | secure_element/1.0/Android.bp | 23 | ||||
-rw-r--r-- | secure_element/1.0/ISecureElement.hal | 121 | ||||
-rw-r--r-- | secure_element/1.0/ISecureElementHalCallback.hal | 21 | ||||
-rw-r--r-- | secure_element/1.0/types.hal | 33 |
13 files changed, 530 insertions, 56 deletions
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp index a0d20f35..bdc44efe 100644 --- a/automotive/vehicle/2.0/Android.bp +++ b/automotive/vehicle/2.0/Android.bp | |||
@@ -48,7 +48,6 @@ hidl_interface { | |||
48 | "VehicleHvacFanDirection", | 48 | "VehicleHvacFanDirection", |
49 | "VehicleHwKeyInputAction", | 49 | "VehicleHwKeyInputAction", |
50 | "VehicleIgnitionState", | 50 | "VehicleIgnitionState", |
51 | "VehicleInstrumentClusterType", | ||
52 | "VehiclePropConfig", | 51 | "VehiclePropConfig", |
53 | "VehiclePropValue", | 52 | "VehiclePropValue", |
54 | "VehicleProperty", | 53 | "VehicleProperty", |
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index f673d1ad..be98a568 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal | |||
@@ -988,41 +988,6 @@ enum VehicleProperty: int32_t { | |||
988 | | VehicleArea:GLOBAL), | 988 | | VehicleArea:GLOBAL), |
989 | 989 | ||
990 | /** | 990 | /** |
991 | * Property to define instrument cluster information. | ||
992 | * For VehicleInstrumentClusterType:EXTERNAL_DISPLAY: | ||
993 | * READ: | ||
994 | * int32Values[0] : The current screen mode index. Screen mode is defined | ||
995 | * as a configuration in car service and represents | ||
996 | * which area of screen is renderable. | ||
997 | * int32Values[1] : Android can render to instrument cluster (=1) or | ||
998 | * not(=0). When this is 0, instrument cluster may be | ||
999 | * rendering some information in the area allocated for | ||
1000 | * android and android side rendering is invisible. | ||
1001 | * WRITE from android: | ||
1002 | * int32Values[0] : Preferred mode for android side. Depending on the app | ||
1003 | * rendering to instrument cluster, preferred mode can | ||
1004 | * change. Instrument cluster still needs to send | ||
1005 | * event with new mode to trigger actual mode change. | ||
1006 | * int32Values[1] : The current app context relevant for instrument | ||
1007 | * cluster. Use the same flag with | ||
1008 | * VehicleAudioContextFlag but this context represents | ||
1009 | * active apps, not active audio. Instrument cluster | ||
1010 | * side may change mode depending on the currently | ||
1011 | * active contexts. | ||
1012 | * When system boots up, Android side will write {0, 0, 0, 0} when it is | ||
1013 | * ready to render to instrument cluster. Before this message, rendering | ||
1014 | * from android must not be visible in the cluster. | ||
1015 | * @change_mode VehiclePropertyChangeMode:ON_CHANGE | ||
1016 | * @access VehiclePropertyAccess:READ_WRITE | ||
1017 | * @configArray 0:VehicleInstrumentClusterType 1:hw type | ||
1018 | */ | ||
1019 | INSTRUMENT_CLUSTER_INFO = ( | ||
1020 | 0x0A20 | ||
1021 | | VehiclePropertyGroup:SYSTEM | ||
1022 | | VehiclePropertyType:INT32_VEC | ||
1023 | | VehicleArea:GLOBAL), | ||
1024 | |||
1025 | /** | ||
1026 | * Current date and time, encoded as Unix time. | 991 | * Current date and time, encoded as Unix time. |
1027 | * This value denotes the number of seconds that have elapsed since | 992 | * This value denotes the number of seconds that have elapsed since |
1028 | * 1/1/1970. | 993 | * 1/1/1970. |
@@ -2067,25 +2032,6 @@ enum VehicleDisplay : int32_t { | |||
2067 | }; | 2032 | }; |
2068 | 2033 | ||
2069 | /** | 2034 | /** |
2070 | * Represents instrument cluster type available in system | ||
2071 | */ | ||
2072 | enum VehicleInstrumentClusterType : int32_t { | ||
2073 | /** Android has no access to instument cluster */ | ||
2074 | NONE = 0, | ||
2075 | |||
2076 | /** | ||
2077 | * Instrument cluster can communicate through vehicle hal with additional | ||
2078 | * properties to exchange meta-data | ||
2079 | */ | ||
2080 | HAL_INTERFACE = 1, | ||
2081 | |||
2082 | /** | ||
2083 | * Instrument cluster is external display where android can render contents | ||
2084 | */ | ||
2085 | EXTERNAL_DISPLAY = 2, | ||
2086 | }; | ||
2087 | |||
2088 | /** | ||
2089 | * Units used for int or float type with no attached enum types. | 2035 | * Units used for int or float type with no attached enum types. |
2090 | */ | 2036 | */ |
2091 | enum VehicleUnit : int32_t { | 2037 | enum VehicleUnit : int32_t { |
diff --git a/health/2.0/README b/health/2.0/README index a0a5f086..49b2b1eb 100644 --- a/health/2.0/README +++ b/health/2.0/README | |||
@@ -96,4 +96,4 @@ void get_disk_stats(std::vector<struct DiskStats>& stats) { | |||
96 | 96 | ||
97 | # device/<manufacturer>/<device>/sepolicy/vendor/hal_health_default.te | 97 | # device/<manufacturer>/<device>/sepolicy/vendor/hal_health_default.te |
98 | # Add device specific permissions to hal_health_default domain, especially | 98 | # Add device specific permissions to hal_health_default domain, especially |
99 | # if Step 6.2 or Step 7.2 is done. | 99 | # if Step 6.1 or Step 7.2 is done. |
diff --git a/media/bufferpool/1.0/Android.bp b/media/bufferpool/1.0/Android.bp new file mode 100644 index 00000000..986da8a4 --- /dev/null +++ b/media/bufferpool/1.0/Android.bp | |||
@@ -0,0 +1,26 @@ | |||
1 | // This file is autogenerated by hidl-gen -Landroidbp. | ||
2 | |||
3 | hidl_interface { | ||
4 | name: "android.hardware.media.bufferpool@1.0", | ||
5 | root: "android.hardware", | ||
6 | vndk: { | ||
7 | enabled: true, | ||
8 | }, | ||
9 | srcs: [ | ||
10 | "types.hal", | ||
11 | "IAccessor.hal", | ||
12 | "IClientManager.hal", | ||
13 | "IConnection.hal", | ||
14 | ], | ||
15 | interfaces: [ | ||
16 | "android.hidl.base@1.0", | ||
17 | ], | ||
18 | types: [ | ||
19 | "Buffer", | ||
20 | "BufferStatus", | ||
21 | "BufferStatusMessage", | ||
22 | "ResultStatus", | ||
23 | ], | ||
24 | gen_java: false, | ||
25 | } | ||
26 | |||
diff --git a/media/bufferpool/1.0/IAccessor.hal b/media/bufferpool/1.0/IAccessor.hal new file mode 100644 index 00000000..5b5aec04 --- /dev/null +++ b/media/bufferpool/1.0/IAccessor.hal | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 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.hardware.media.bufferpool@1.0; | ||
18 | |||
19 | import IConnection; | ||
20 | /** | ||
21 | * IAccessor creates IConnection which is used from IClientManager in order to | ||
22 | * use functionality of the specified buffer pool. | ||
23 | */ | ||
24 | interface IAccessor { | ||
25 | |||
26 | /** | ||
27 | * Registers a new client and creates IConnection to the buffer pool for | ||
28 | * the client. IConnection and FMQ are used by IClientManager in order to | ||
29 | * communicate with the buffer pool. Via FMQ IClientManager sends | ||
30 | * BufferStatusMesage(s) to the buffer pool. | ||
31 | * | ||
32 | * FMQ is used to send buffer ownership status changes to a buffer pool | ||
33 | * from a buffer pool client. A buffer pool synchronizes FMQ messages when | ||
34 | * there is a hidl request from the clients. Every client has its own | ||
35 | * connection and FMQ to communicate with the buffer pool. So sending an | ||
36 | * FMQ message on behalf of other clients is not possible. | ||
37 | * | ||
38 | * FMQ messages are sent when a buffer is acquired or released. Also, FMQ | ||
39 | * messages are sent when a buffer is transferred from a client to another | ||
40 | * client. FMQ has its own ID from a buffer pool. A client is specified | ||
41 | * with the ID. | ||
42 | * | ||
43 | * To transfer a buffer, a sender must send an FMQ message. The message | ||
44 | * must include a receiver's ID and a transaction ID. A receiver must send | ||
45 | * the transaction ID to fetch a buffer from a buffer pool. Since the | ||
46 | * sender already registered the receiver via an FMQ message, The buffer | ||
47 | * pool must verify the receiver with the transaction ID. In order to | ||
48 | * prevent faking a receiver, a connection to a buffer pool from client is | ||
49 | * made and kept private. Also part of transaction ID is a sender ID in | ||
50 | * order to prevent fake transactions from other clients. This must be | ||
51 | * verified with an FMQ message from a buffer pool. | ||
52 | * | ||
53 | * @return status The status of the call. | ||
54 | * OK - A connection is made successfully. | ||
55 | * NO_MEMORY - Memory allocation failure occurred. | ||
56 | * ALREADY_EXISTS - A connection was already made. | ||
57 | * CRITICAL_ERROR - Other errors. | ||
58 | * @return connection The IConnection have interfaces | ||
59 | * to get shared buffers from the buffer pool. | ||
60 | * @return connectionId Id of IConnection. The Id identifies | ||
61 | * sender and receiver in FMQ messages during buffer transfer. | ||
62 | * @return mqDesc FMQ descriptor. The descriptor can be used to | ||
63 | * send/receive FMQ messages. | ||
64 | */ | ||
65 | connect() | ||
66 | generates (ResultStatus status, IConnection connection, | ||
67 | int64_t connectionId, fmq_sync<BufferStatusMessage> mqDesc); | ||
68 | }; | ||
diff --git a/media/bufferpool/1.0/IClientManager.hal b/media/bufferpool/1.0/IClientManager.hal new file mode 100644 index 00000000..e1e8f95b --- /dev/null +++ b/media/bufferpool/1.0/IClientManager.hal | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 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.hardware.media.bufferpool@1.0; | ||
18 | |||
19 | import IAccessor; | ||
20 | /** | ||
21 | * IClientManager manages IConnection(s) inside a process. A locally | ||
22 | * created IConnection represents a communication node(receiver) with the | ||
23 | * specified buffer pool(IAccessor). | ||
24 | * IConnection(s) are not exposed to other processes(IClientManager). | ||
25 | * IClientManager instance must be unique within a process. | ||
26 | */ | ||
27 | interface IClientManager { | ||
28 | |||
29 | /** | ||
30 | * Sets up a buffer receiving communication node for the specified | ||
31 | * buffer pool. A manager must create a IConnection to the buffer | ||
32 | * pool if it does not already have a connection. | ||
33 | * | ||
34 | * @param bufferPool a buffer pool which is specified with the IAccessor. | ||
35 | * The specified buffer pool is the owner of received buffers. | ||
36 | * @return status The status of the call. | ||
37 | * OK - A sender was set successfully. | ||
38 | * NO_MEMORY - Memory allocation failure occurred. | ||
39 | * ALREADY_EXISTS - A sender was registered already. | ||
40 | * CRITICAL_ERROR - Other errors. | ||
41 | * @return connectionId the Id of the communication node to the buffer pool. | ||
42 | * This id is used in FMQ to notify IAccessor that a buffer has been | ||
43 | * sent to that connection during transfers. | ||
44 | */ | ||
45 | registerSender(IAccessor bufferPool) generates | ||
46 | (ResultStatus status, int64_t connectionId); | ||
47 | }; | ||
diff --git a/media/bufferpool/1.0/IConnection.hal b/media/bufferpool/1.0/IConnection.hal new file mode 100644 index 00000000..e284db28 --- /dev/null +++ b/media/bufferpool/1.0/IConnection.hal | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 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.hardware.media.bufferpool@1.0; | ||
18 | |||
19 | /** | ||
20 | * A connection to a buffer pool which handles requests from a buffer pool | ||
21 | * client. The connection must be made in order to receive buffers from | ||
22 | * other buffer pool clients. | ||
23 | */ | ||
24 | interface IConnection { | ||
25 | |||
26 | /** | ||
27 | * Retrieves a buffer using bufferId. The method must be called from | ||
28 | * receiving side of buffer during transferring only when the specified | ||
29 | * buffer is neither cached nor used. This fails if the specified | ||
30 | * transaction is not valid. | ||
31 | * | ||
32 | * @param transactionId Unique transaction id for buffer transferring. | ||
33 | * @param bufferId Id of the buffer to be fetched. | ||
34 | * @return status The status of the call. | ||
35 | * OK - A buffer was fetched successfully. | ||
36 | * NO_MEMORY - Memory allocation failure occurred. | ||
37 | * NOT_FOUND - A buffer was not found due to invalidation. | ||
38 | * CRITICAL_ERROR - Other errors. | ||
39 | * @return buffer The actual buffer which is specified with bufferId. | ||
40 | */ | ||
41 | fetch(uint64_t transactionId, uint32_t bufferId) generates | ||
42 | (ResultStatus status, Buffer buffer); | ||
43 | }; | ||
diff --git a/media/bufferpool/1.0/README.md b/media/bufferpool/1.0/README.md new file mode 100644 index 00000000..ed985d82 --- /dev/null +++ b/media/bufferpool/1.0/README.md | |||
@@ -0,0 +1,54 @@ | |||
1 | 1. Overview | ||
2 | |||
3 | A buffer pool enables processes to transfer buffers asynchronously. | ||
4 | Without a buffer pool, a process calls a synchronous method of the other | ||
5 | process and waits until the call finishes transferring a buffer. This adds | ||
6 | unwanted latency due to context switching. With help from a buffer pool, a | ||
7 | process can pass buffers asynchronously and reduce context switching latency. | ||
8 | |||
9 | Passing an interface and a handle adds extra latency also. To mitigate the | ||
10 | latency, passing IDs with local cache is used. For security concerns about | ||
11 | rogue clients, FMQ is used to communicate between a buffer pool and a client | ||
12 | process. FMQ is used to send buffer ownership change status from a client | ||
13 | process to a buffer pool. Except FMQ, a buffer pool does not use any shared | ||
14 | memory. | ||
15 | |||
16 | 2. FMQ | ||
17 | |||
18 | FMQ is used to send buffer ownership status changes to a buffer pool from a | ||
19 | buffer pool client. A buffer pool synchronizes FMQ messages when there is a | ||
20 | hidl request from the clients. Every client has its own connection and FMQ | ||
21 | to communicate with the buffer pool. So sending an FMQ message on behalf of | ||
22 | other clients is not possible. | ||
23 | |||
24 | FMQ messages are sent when a buffer is acquired or released. Also, FMQ messages | ||
25 | are sent when a buffer is transferred from a client to another client. FMQ has | ||
26 | its own ID from a buffer pool. A client is specified with the ID. | ||
27 | |||
28 | To transfer a buffer, a sender must send an FMQ message. The message must | ||
29 | include a receiver's ID and a transaction ID. A receiver must send the | ||
30 | transaction ID to fetch a buffer from a buffer pool. Since the sender already | ||
31 | registered the receiver via an FMQ message, The buffer pool must verify the | ||
32 | receiver with the transaction ID. In order to prevent faking a receiver, a | ||
33 | connection to a buffer pool from client is made and kept privately. Also part of | ||
34 | transaction ID is a sender ID in order to prevent fake transactions from other | ||
35 | clients. This must be verified with an FMQ message from a buffer pool. | ||
36 | |||
37 | FMQ messages are defined in BufferStatus and BufferStatusMessage of 'types.hal'. | ||
38 | |||
39 | 3. Interfaces | ||
40 | |||
41 | IConnection | ||
42 | A connection to a buffer pool from a buffer pool client. The connection | ||
43 | provides the functionalities to share buffers between buffer pool clients. | ||
44 | The connection must be unique for each client. | ||
45 | |||
46 | IAccessor | ||
47 | An accessor to a buffer pool which makes a connection to the buffer pool. | ||
48 | IAccesssor#connect creates an IConnection. | ||
49 | |||
50 | IClientManager | ||
51 | A manager of buffer pool clients and clients' connections to buffer pools. It | ||
52 | sets up a process to be a receiver of buffers from a buffer pool. The manager | ||
53 | is unique in a process. | ||
54 | |||
diff --git a/media/bufferpool/1.0/types.hal b/media/bufferpool/1.0/types.hal new file mode 100644 index 00000000..d8ab5977 --- /dev/null +++ b/media/bufferpool/1.0/types.hal | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 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.hardware.media.bufferpool@1.0; | ||
18 | |||
19 | enum ResultStatus : int32_t { | ||
20 | OK = 0, | ||
21 | |||
22 | NO_MEMORY = 1, | ||
23 | ALREADY_EXISTS = 2, | ||
24 | NOT_FOUND = 3, | ||
25 | CRITICAL_ERROR = 4, | ||
26 | }; | ||
27 | |||
28 | /** | ||
29 | * Generic buffer for fast recycling for media/stagefright. | ||
30 | * | ||
31 | * During media pipeline buffer references are created, shared and | ||
32 | * destroyed frequently. The underlying buffers are allocated on demand | ||
33 | * by a buffer pool, and are recycled to the buffer pool when they are | ||
34 | * no longer referenced by the clients. | ||
35 | * | ||
36 | * E.g. ion or gralloc buffer | ||
37 | */ | ||
38 | struct Buffer { | ||
39 | uint32_t id; | ||
40 | handle buffer; | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * Buffer ownership status for the specified client. | ||
45 | * Buffer transfer status for the specified buffer transafer transaction. | ||
46 | * BufferStatus is posted along with BufferStatusMessage from a client to | ||
47 | * the buffer pool for synchronization after status change. | ||
48 | */ | ||
49 | enum BufferStatus : int32_t { | ||
50 | /** No longer used by the specified client. */ | ||
51 | NOT_USED = 0, | ||
52 | /** Buffer is acquired by the specified client. */ | ||
53 | USED = 1, | ||
54 | /** Buffer is sent by the specified client. */ | ||
55 | TRANSFER_TO = 2, | ||
56 | /** Buffer transfer is acked by the receiver client. */ | ||
57 | TRANSFER_FROM = 3, | ||
58 | /** Buffer transfer is timed out by receiver client. */ | ||
59 | TRANSFER_TIMEOUT = 4, | ||
60 | /** Buffer transfer is not acked by the receiver. */ | ||
61 | TRANSFER_LOST = 5, | ||
62 | /** Buffer fetch request from the client. */ | ||
63 | TRANSFER_FETCH = 6, | ||
64 | /** Buffer transaction succeeded. */ | ||
65 | TRANSFER_OK = 7, | ||
66 | /** Buffer transaction failure. */ | ||
67 | TRANSFER_ERROR = 8, | ||
68 | }; | ||
69 | |||
70 | /** | ||
71 | * Buffer ownership status change message. This message is | ||
72 | * sent via fmq to the buffer pool from client processes. | ||
73 | */ | ||
74 | struct BufferStatusMessage { | ||
75 | /** | ||
76 | * Transaction Id = (SenderId : sender local transaction Id) | ||
77 | * Transaction Id is created from sender and posted via fmq within | ||
78 | * TRANSFER_TO message. | ||
79 | */ | ||
80 | uint64_t transactionId; | ||
81 | uint32_t bufferId; | ||
82 | BufferStatus newStatus; | ||
83 | /** Used by the buffer pool. not by client. */ | ||
84 | int64_t connectionId; | ||
85 | /** Valid only when TRANSFER_TO is posted. */ | ||
86 | int64_t targetConnectionId; | ||
87 | /** | ||
88 | * Used by the buffer pool, not by client. | ||
89 | * Monotonic timestamp in Us since fixed point in time as decided | ||
90 | * by the sender of the message | ||
91 | */ | ||
92 | int64_t timestampUs; | ||
93 | }; | ||
diff --git a/secure_element/1.0/Android.bp b/secure_element/1.0/Android.bp new file mode 100644 index 00000000..e8081dfd --- /dev/null +++ b/secure_element/1.0/Android.bp | |||
@@ -0,0 +1,23 @@ | |||
1 | // This file is autogenerated by hidl-gen -Landroidbp. | ||
2 | |||
3 | hidl_interface { | ||
4 | name: "android.hardware.secure_element@1.0", | ||
5 | root: "android.hardware", | ||
6 | vndk: { | ||
7 | enabled: true, | ||
8 | }, | ||
9 | srcs: [ | ||
10 | "types.hal", | ||
11 | "ISecureElement.hal", | ||
12 | "ISecureElementHalCallback.hal", | ||
13 | ], | ||
14 | interfaces: [ | ||
15 | "android.hidl.base@1.0", | ||
16 | ], | ||
17 | types: [ | ||
18 | "LogicalChannelResponse", | ||
19 | "SecureElementStatus", | ||
20 | ], | ||
21 | gen_java: true, | ||
22 | } | ||
23 | |||
diff --git a/secure_element/1.0/ISecureElement.hal b/secure_element/1.0/ISecureElement.hal new file mode 100644 index 00000000..d1e36f7d --- /dev/null +++ b/secure_element/1.0/ISecureElement.hal | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 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.hardware.secure_element@1.0; | ||
18 | |||
19 | import ISecureElementHalCallback; | ||
20 | |||
21 | /** According to ISO/IEC 7816 */ | ||
22 | interface ISecureElement { | ||
23 | /** | ||
24 | * Initializes the Secure Element. This may include updating the applet | ||
25 | * and/or vendor-specific initialization. | ||
26 | * | ||
27 | * HAL service must send onStateChange() with connected equal to true | ||
28 | * after all the initialization has been successfully completed. | ||
29 | * Clients must wait for a onStateChange(true) before opening channels. | ||
30 | * | ||
31 | * @param clientCallback callback used to sent status of the SE back to the | ||
32 | * client | ||
33 | */ | ||
34 | init(ISecureElementHalCallback clientCallback); | ||
35 | |||
36 | /** | ||
37 | * Returns Answer to Reset as per ISO/IEC 7816 | ||
38 | * | ||
39 | * @return response containing the response. Empty vector if Secure Element | ||
40 | * doesn't support ATR. | ||
41 | */ | ||
42 | getAtr() generates (vec<uint8_t> response); | ||
43 | |||
44 | /** | ||
45 | * Returns the current state of the card. | ||
46 | * | ||
47 | * This is particularly useful for removable | ||
48 | * Secure Elements like UICC, Secure Elements on SD cards etc. | ||
49 | * | ||
50 | * @return present true if present, false otherwise | ||
51 | */ | ||
52 | isCardPresent() generates (bool present); | ||
53 | |||
54 | /** | ||
55 | * Transmits an APDU command (as per ISO/IEC 7816) to the SE. | ||
56 | * | ||
57 | * @param data APDU command to be sent | ||
58 | * @return response to the command. In case of error in communicating with | ||
59 | * the secure element, an empty vector is returned. | ||
60 | */ | ||
61 | transmit(vec<uint8_t> data) generates (vec<uint8_t> response); | ||
62 | |||
63 | /** | ||
64 | * Opens a logical channel with the Secure Element, selecting the applet | ||
65 | * represented by the Application ID (AID). | ||
66 | * | ||
67 | * @param aid AID to uniquely identify the applet on the Secure Element | ||
68 | * @param p2 P2 paramter of SELECT APDU as per ISO 7816-4 | ||
69 | * @return status SecureElementStatus::SUCCESS on success, | ||
70 | * SecureElementStatus::CHANNEL_NOT_AVAILABLE if secure | ||
71 | * element has reached the maximum limit on the number of | ||
72 | * channels it can support, | ||
73 | * SecureElementStatus::NO_SUCH_ELEMENT_ERROR if AID provided | ||
74 | * doesn't match any applet on the secure element and | ||
75 | * SecureElementStatus::UNSUPPORTED_OPERATION if operation | ||
76 | * provided by the P2 parameter is not permitted by the | ||
77 | * applet. | ||
78 | * SecureElementStatus::IOERROR if there was an error | ||
79 | * communicating with the Secure Element. | ||
80 | * @return response On success, response to SELECT command is returned | ||
81 | * empty vector on failure. | ||
82 | */ | ||
83 | openLogicalChannel(vec<uint8_t> aid, uint8_t p2) | ||
84 | generates (LogicalChannelResponse response, SecureElementStatus status); | ||
85 | |||
86 | |||
87 | /** | ||
88 | * Opens a basic channel with the Secure Element, selecting the applet | ||
89 | * represented by the Application ID (AID). | ||
90 | * | ||
91 | * @param aid AID to uniquely identify the applet on the Secure Element | ||
92 | * @param p2 P2 paramter of SELECT APDU as per ISO 7816-4 | ||
93 | * @return status SecureElementStatus::SUCCESS on success, | ||
94 | * SecureElementStatus::CHANNEL_NOT_AVAILABLE if secure | ||
95 | * element has reached the maximum limit on the number of | ||
96 | * channels it can support, | ||
97 | * SecureElementStatus::NO_SUCH_ELEMENT_ERROR if AID provided | ||
98 | * doesn't match any applet on the secure element and | ||
99 | * SecureElementStatus::UNSUPPORTED_OPERATION if operation | ||
100 | * provided by the P2 parameter is not permitted by the | ||
101 | * applet. | ||
102 | * SecureElementStatus::IOERROR if there was an error | ||
103 | * communicating with the Secure Element. | ||
104 | * @return selectResponse On success, response to SELECT command is returned | ||
105 | * empty vector on failure. | ||
106 | */ | ||
107 | openBasicChannel(vec<uint8_t> aid, uint8_t p2) | ||
108 | generates (vec<uint8_t> selectResponse, SecureElementStatus status); | ||
109 | |||
110 | /** | ||
111 | * Closes the channel indicated by the channelNumber. | ||
112 | * | ||
113 | * Closing a basic channel, i.e with channelNumber 0 must return | ||
114 | * SecureElementStatus::FAILED. | ||
115 | * | ||
116 | * @param channelNumber to be closed | ||
117 | * @return status SecureElementStatus::SUCCESS on success and | ||
118 | * SecureElementStatus::FAILED on error. | ||
119 | */ | ||
120 | closeChannel(uint8_t channelNumber) generates (SecureElementStatus status); | ||
121 | }; | ||
diff --git a/secure_element/1.0/ISecureElementHalCallback.hal b/secure_element/1.0/ISecureElementHalCallback.hal new file mode 100644 index 00000000..d11600fb --- /dev/null +++ b/secure_element/1.0/ISecureElementHalCallback.hal | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 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.hardware.secure_element@1.0; | ||
18 | |||
19 | interface ISecureElementHalCallback { | ||
20 | onStateChange(bool connected); | ||
21 | }; | ||
diff --git a/secure_element/1.0/types.hal b/secure_element/1.0/types.hal new file mode 100644 index 00000000..8150be4d --- /dev/null +++ b/secure_element/1.0/types.hal | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 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.hardware.secure_element@1.0; | ||
18 | |||
19 | enum SecureElementStatus : uint8_t { | ||
20 | SUCCESS = 0, | ||
21 | FAILED = 1, | ||
22 | CHANNEL_NOT_AVAILABLE = 2, | ||
23 | NO_SUCH_ELEMENT_ERROR = 3, | ||
24 | UNSUPPORTED_OPERATION = 4, | ||
25 | IOERROR = 5 | ||
26 | }; | ||
27 | |||
28 | struct LogicalChannelResponse { | ||
29 | /** Channel number to uniquely identify the channel */ | ||
30 | uint8_t channelNumber; | ||
31 | /** Response to SELECT command as per ISO/IEC 7816 */ | ||
32 | vec<uint8_t> selectResponse; | ||
33 | }; | ||