diff options
author | Andrew Scull | 2017-03-27 09:29:32 -0500 |
---|---|---|
committer | Andrew Scull | 2017-04-10 11:09:11 -0500 |
commit | efd5e251e334c1c63eb2a0a04dba4c047ddf9df8 (patch) | |
tree | 963683d4ba54492beb3764084348d1e44a4ba9ea | |
parent | 23d9c7410442fce20f5558e8087f438ebf31c1f5 (diff) | |
download | platform-hardware-interfaces-efd5e251e334c1c63eb2a0a04dba4c047ddf9df8.tar.gz platform-hardware-interfaces-efd5e251e334c1c63eb2a0a04dba4c047ddf9df8.tar.xz platform-hardware-interfaces-efd5e251e334c1c63eb2a0a04dba4c047ddf9df8.zip |
OemLock HAL
This HAL allows vendor defined implementation of the OEM lock.
Bug: 34766843
Test: Boot and call from system_server
Change-Id: I5371fea496b6cae8cc6dd234d9302036ddb68ece
-rw-r--r-- | oemlock/1.0/Android.bp | 63 | ||||
-rw-r--r-- | oemlock/1.0/Android.mk | 156 | ||||
-rw-r--r-- | oemlock/1.0/IOemLock.hal | 77 | ||||
-rw-r--r-- | oemlock/1.0/types.hal | 28 | ||||
-rw-r--r-- | oemlock/Android.bp | 4 |
5 files changed, 328 insertions, 0 deletions
diff --git a/oemlock/1.0/Android.bp b/oemlock/1.0/Android.bp new file mode 100644 index 00000000..33096c39 --- /dev/null +++ b/oemlock/1.0/Android.bp | |||
@@ -0,0 +1,63 @@ | |||
1 | // This file is autogenerated by hidl-gen. Do not edit manually. | ||
2 | |||
3 | filegroup { | ||
4 | name: "android.hardware.oemlock@1.0_hal", | ||
5 | srcs: [ | ||
6 | "types.hal", | ||
7 | "IOemLock.hal", | ||
8 | ], | ||
9 | } | ||
10 | |||
11 | genrule { | ||
12 | name: "android.hardware.oemlock@1.0_genc++", | ||
13 | tools: ["hidl-gen"], | ||
14 | cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.oemlock@1.0", | ||
15 | srcs: [ | ||
16 | ":android.hardware.oemlock@1.0_hal", | ||
17 | ], | ||
18 | out: [ | ||
19 | "android/hardware/oemlock/1.0/types.cpp", | ||
20 | "android/hardware/oemlock/1.0/OemLockAll.cpp", | ||
21 | ], | ||
22 | } | ||
23 | |||
24 | genrule { | ||
25 | name: "android.hardware.oemlock@1.0_genc++_headers", | ||
26 | tools: ["hidl-gen"], | ||
27 | cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.oemlock@1.0", | ||
28 | srcs: [ | ||
29 | ":android.hardware.oemlock@1.0_hal", | ||
30 | ], | ||
31 | out: [ | ||
32 | "android/hardware/oemlock/1.0/types.h", | ||
33 | "android/hardware/oemlock/1.0/hwtypes.h", | ||
34 | "android/hardware/oemlock/1.0/IOemLock.h", | ||
35 | "android/hardware/oemlock/1.0/IHwOemLock.h", | ||
36 | "android/hardware/oemlock/1.0/BnHwOemLock.h", | ||
37 | "android/hardware/oemlock/1.0/BpHwOemLock.h", | ||
38 | "android/hardware/oemlock/1.0/BsOemLock.h", | ||
39 | ], | ||
40 | } | ||
41 | |||
42 | cc_library_shared { | ||
43 | name: "android.hardware.oemlock@1.0", | ||
44 | generated_sources: ["android.hardware.oemlock@1.0_genc++"], | ||
45 | generated_headers: ["android.hardware.oemlock@1.0_genc++_headers"], | ||
46 | export_generated_headers: ["android.hardware.oemlock@1.0_genc++_headers"], | ||
47 | shared_libs: [ | ||
48 | "libhidlbase", | ||
49 | "libhidltransport", | ||
50 | "libhwbinder", | ||
51 | "liblog", | ||
52 | "libutils", | ||
53 | "libcutils", | ||
54 | "android.hidl.base@1.0", | ||
55 | ], | ||
56 | export_shared_lib_headers: [ | ||
57 | "libhidlbase", | ||
58 | "libhidltransport", | ||
59 | "libhwbinder", | ||
60 | "libutils", | ||
61 | "android.hidl.base@1.0", | ||
62 | ], | ||
63 | } | ||
diff --git a/oemlock/1.0/Android.mk b/oemlock/1.0/Android.mk new file mode 100644 index 00000000..e50c2881 --- /dev/null +++ b/oemlock/1.0/Android.mk | |||
@@ -0,0 +1,156 @@ | |||
1 | # This file is autogenerated by hidl-gen. Do not edit manually. | ||
2 | |||
3 | LOCAL_PATH := $(call my-dir) | ||
4 | |||
5 | ################################################################################ | ||
6 | |||
7 | include $(CLEAR_VARS) | ||
8 | LOCAL_MODULE := android.hardware.oemlock@1.0-java | ||
9 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES | ||
10 | |||
11 | intermediates := $(call local-generated-sources-dir, COMMON) | ||
12 | |||
13 | HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) | ||
14 | |||
15 | LOCAL_JAVA_LIBRARIES := \ | ||
16 | android.hidl.base@1.0-java \ | ||
17 | |||
18 | |||
19 | # | ||
20 | # Build types.hal (OemLockSecureStatus) | ||
21 | # | ||
22 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/OemLockSecureStatus.java | ||
23 | $(GEN): $(HIDL) | ||
24 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
25 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal | ||
26 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
27 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
28 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
29 | -Ljava \ | ||
30 | -randroid.hardware:hardware/interfaces \ | ||
31 | -randroid.hidl:system/libhidl/transport \ | ||
32 | android.hardware.oemlock@1.0::types.OemLockSecureStatus | ||
33 | |||
34 | $(GEN): $(LOCAL_PATH)/types.hal | ||
35 | $(transform-generated-source) | ||
36 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
37 | |||
38 | # | ||
39 | # Build types.hal (OemLockStatus) | ||
40 | # | ||
41 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/OemLockStatus.java | ||
42 | $(GEN): $(HIDL) | ||
43 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
44 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal | ||
45 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
46 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
47 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
48 | -Ljava \ | ||
49 | -randroid.hardware:hardware/interfaces \ | ||
50 | -randroid.hidl:system/libhidl/transport \ | ||
51 | android.hardware.oemlock@1.0::types.OemLockStatus | ||
52 | |||
53 | $(GEN): $(LOCAL_PATH)/types.hal | ||
54 | $(transform-generated-source) | ||
55 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
56 | |||
57 | # | ||
58 | # Build IOemLock.hal | ||
59 | # | ||
60 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/IOemLock.java | ||
61 | $(GEN): $(HIDL) | ||
62 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
63 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemLock.hal | ||
64 | $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal | ||
65 | $(GEN): $(LOCAL_PATH)/types.hal | ||
66 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
67 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
68 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
69 | -Ljava \ | ||
70 | -randroid.hardware:hardware/interfaces \ | ||
71 | -randroid.hidl:system/libhidl/transport \ | ||
72 | android.hardware.oemlock@1.0::IOemLock | ||
73 | |||
74 | $(GEN): $(LOCAL_PATH)/IOemLock.hal | ||
75 | $(transform-generated-source) | ||
76 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
77 | include $(BUILD_JAVA_LIBRARY) | ||
78 | |||
79 | |||
80 | ################################################################################ | ||
81 | |||
82 | include $(CLEAR_VARS) | ||
83 | LOCAL_MODULE := android.hardware.oemlock@1.0-java-static | ||
84 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES | ||
85 | |||
86 | intermediates := $(call local-generated-sources-dir, COMMON) | ||
87 | |||
88 | HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) | ||
89 | |||
90 | LOCAL_STATIC_JAVA_LIBRARIES := \ | ||
91 | android.hidl.base@1.0-java-static \ | ||
92 | |||
93 | |||
94 | # | ||
95 | # Build types.hal (OemLockSecureStatus) | ||
96 | # | ||
97 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/OemLockSecureStatus.java | ||
98 | $(GEN): $(HIDL) | ||
99 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
100 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal | ||
101 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
102 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
103 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
104 | -Ljava \ | ||
105 | -randroid.hardware:hardware/interfaces \ | ||
106 | -randroid.hidl:system/libhidl/transport \ | ||
107 | android.hardware.oemlock@1.0::types.OemLockSecureStatus | ||
108 | |||
109 | $(GEN): $(LOCAL_PATH)/types.hal | ||
110 | $(transform-generated-source) | ||
111 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
112 | |||
113 | # | ||
114 | # Build types.hal (OemLockStatus) | ||
115 | # | ||
116 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/OemLockStatus.java | ||
117 | $(GEN): $(HIDL) | ||
118 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
119 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal | ||
120 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
121 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
122 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
123 | -Ljava \ | ||
124 | -randroid.hardware:hardware/interfaces \ | ||
125 | -randroid.hidl:system/libhidl/transport \ | ||
126 | android.hardware.oemlock@1.0::types.OemLockStatus | ||
127 | |||
128 | $(GEN): $(LOCAL_PATH)/types.hal | ||
129 | $(transform-generated-source) | ||
130 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
131 | |||
132 | # | ||
133 | # Build IOemLock.hal | ||
134 | # | ||
135 | GEN := $(intermediates)/android/hardware/oemlock/V1_0/IOemLock.java | ||
136 | $(GEN): $(HIDL) | ||
137 | $(GEN): PRIVATE_HIDL := $(HIDL) | ||
138 | $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemLock.hal | ||
139 | $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal | ||
140 | $(GEN): $(LOCAL_PATH)/types.hal | ||
141 | $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) | ||
142 | $(GEN): PRIVATE_CUSTOM_TOOL = \ | ||
143 | $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ | ||
144 | -Ljava \ | ||
145 | -randroid.hardware:hardware/interfaces \ | ||
146 | -randroid.hidl:system/libhidl/transport \ | ||
147 | android.hardware.oemlock@1.0::IOemLock | ||
148 | |||
149 | $(GEN): $(LOCAL_PATH)/IOemLock.hal | ||
150 | $(transform-generated-source) | ||
151 | LOCAL_GENERATED_SOURCES += $(GEN) | ||
152 | include $(BUILD_STATIC_JAVA_LIBRARY) | ||
153 | |||
154 | |||
155 | |||
156 | include $(call all-makefiles-under,$(LOCAL_PATH)) | ||
diff --git a/oemlock/1.0/IOemLock.hal b/oemlock/1.0/IOemLock.hal new file mode 100644 index 00000000..d5701235 --- /dev/null +++ b/oemlock/1.0/IOemLock.hal | |||
@@ -0,0 +1,77 @@ | |||
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 | package android.hardware.oemlock@1.0; | ||
17 | |||
18 | /* | ||
19 | * The OEM lock prevents the bootloader from allowing the device to be flashed. | ||
20 | * | ||
21 | * Both the carrier and the device itself have a say as to whether OEM unlock is | ||
22 | * allowed and both must agree that is allowed in order for unlock to be | ||
23 | * possible. | ||
24 | */ | ||
25 | interface IOemLock { | ||
26 | /** | ||
27 | * Returns a vendor specific identifier of the HAL. | ||
28 | * | ||
29 | * The name returned must not be interpreted by the framework but must be | ||
30 | * passed to vendor code which may use it to identify the security protocol | ||
31 | * used by setOemUnlockAllowedByCarrier. This allows the vendor to identify | ||
32 | * the protocol without having to maintain a device-to-protocol mapping. | ||
33 | * | ||
34 | * @return name of the implementation. | ||
35 | */ | ||
36 | getName() generates (OemLockStatus status, string name); | ||
37 | |||
38 | /** | ||
39 | * Updates whether OEM unlock is allowed by the carrier. | ||
40 | * | ||
41 | * The implementation may require a vendor defined signature to prove the | ||
42 | * validity of this request in order to harden its security. | ||
43 | * | ||
44 | * @param allowed is the new value of the flag. | ||
45 | * @param signature to prove validity of this request or empty if not | ||
46 | * required. | ||
47 | * @return status is OK if the flag was successfully updated, | ||
48 | * INVALID_SIGNATURE if a signature is required but the wrong one | ||
49 | * was provided or FAILED if the update was otherwise unsuccessful. | ||
50 | */ | ||
51 | setOemUnlockAllowedByCarrier(bool allowed, vec<uint8_t> signature) | ||
52 | generates (OemLockSecureStatus status); | ||
53 | |||
54 | /** | ||
55 | * Returns whether OEM unlock is allowed by the carrier. | ||
56 | * | ||
57 | * @return status is OK if the flag was successfully read. | ||
58 | * @return allowed is the current state of the flag. | ||
59 | */ | ||
60 | isOemUnlockAllowedByCarrier() generates (OemLockStatus status, bool allowed); | ||
61 | |||
62 | /** | ||
63 | * Updates whether OEM unlock is allowed by the device. | ||
64 | * | ||
65 | * @param allowed is the new value of the flag. | ||
66 | * @return status is OK if the flag was successfully updated. | ||
67 | */ | ||
68 | setOemUnlockAllowedByDevice(bool allowed) generates (OemLockStatus status); | ||
69 | |||
70 | /** | ||
71 | * Returns whether OEM unlock ia allowed by the device. | ||
72 | * | ||
73 | * @return status is OK if the flag was successfully read. | ||
74 | * @return allowed is the current state of the flag. | ||
75 | */ | ||
76 | isOemUnlockAllowedByDevice() generates (OemLockStatus status, bool allowed); | ||
77 | }; | ||
diff --git a/oemlock/1.0/types.hal b/oemlock/1.0/types.hal new file mode 100644 index 00000000..0b4a8d11 --- /dev/null +++ b/oemlock/1.0/types.hal | |||
@@ -0,0 +1,28 @@ | |||
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 | package android.hardware.oemlock@1.0; | ||
17 | |||
18 | enum OemLockStatus : uint32_t { | ||
19 | /** The operation completed successfully. */ | ||
20 | OK, | ||
21 | /** The operation encountered a problem. */ | ||
22 | FAILED, | ||
23 | }; | ||
24 | |||
25 | enum OemLockSecureStatus : OemLockStatus { | ||
26 | /** An invalid signature was provided so the operation was not performed. */ | ||
27 | INVALID_SIGNATURE, | ||
28 | }; | ||
diff --git a/oemlock/Android.bp b/oemlock/Android.bp new file mode 100644 index 00000000..bbb3e4ba --- /dev/null +++ b/oemlock/Android.bp | |||
@@ -0,0 +1,4 @@ | |||
1 | // This is an autogenerated file, do not edit. | ||
2 | subdirs = [ | ||
3 | "1.0", | ||
4 | ] | ||