diff options
50 files changed, 1003 insertions, 387 deletions
@@ -8,6 +8,7 @@ subdirs = [ | |||
8 | "biometrics/fingerprint/2.1", | 8 | "biometrics/fingerprint/2.1", |
9 | "bluetooth/1.0", | 9 | "bluetooth/1.0", |
10 | "boot/1.0", | 10 | "boot/1.0", |
11 | "broadcastradio/1.0", | ||
11 | "example/extension/light/2.0", | 12 | "example/extension/light/2.0", |
12 | "gnss/1.0", | 13 | "gnss/1.0", |
13 | "graphics/allocator/2.0", | 14 | "graphics/allocator/2.0", |
@@ -35,6 +36,7 @@ subdirs = [ | |||
35 | "tests/foo/1.0/default", | 36 | "tests/foo/1.0/default", |
36 | "tests/foo/1.0/default/lib", | 37 | "tests/foo/1.0/default/lib", |
37 | "tests/libhwbinder/1.0", | 38 | "tests/libhwbinder/1.0", |
39 | "tests/libhwbinder/1.0/default", | ||
38 | "tests/msgq/1.0", | 40 | "tests/msgq/1.0", |
39 | "tests/pointer/1.0", | 41 | "tests/pointer/1.0", |
40 | "tests/pointer/1.0/default", | 42 | "tests/pointer/1.0/default", |
@@ -44,6 +46,8 @@ subdirs = [ | |||
44 | "vehicle/2.0", | 46 | "vehicle/2.0", |
45 | "vibrator/1.0", | 47 | "vibrator/1.0", |
46 | "vibrator/1.0/default", | 48 | "vibrator/1.0/default", |
49 | "vr/1.0", | ||
50 | "vr/1.0/default", | ||
47 | "wifi/1.0", | 51 | "wifi/1.0", |
48 | "wifi/supplicant/1.0", | 52 | "wifi/supplicant/1.0", |
49 | ] | 53 | ] |
diff --git a/benchmarks/msgq/1.0/Android.bp b/benchmarks/msgq/1.0/Android.bp index 51841c24..b222cfbd 100644 --- a/benchmarks/msgq/1.0/Android.bp +++ b/benchmarks/msgq/1.0/Android.bp | |||
@@ -39,4 +39,9 @@ cc_library_shared { | |||
39 | "libutils", | 39 | "libutils", |
40 | "libcutils", | 40 | "libcutils", |
41 | ], | 41 | ], |
42 | export_shared_lib_headers: [ | ||
43 | "libhidl", | ||
44 | "libhwbinder", | ||
45 | "libutils", | ||
46 | ], | ||
42 | } | 47 | } |
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp index c5f898d4..ef7f1090 100644 --- a/bluetooth/1.0/Android.bp +++ b/bluetooth/1.0/Android.bp | |||
@@ -51,4 +51,9 @@ cc_library_shared { | |||
51 | "libutils", | 51 | "libutils", |
52 | "libcutils", | 52 | "libcutils", |
53 | ], | 53 | ], |
54 | export_shared_lib_headers: [ | ||
55 | "libhidl", | ||
56 | "libhwbinder", | ||
57 | "libutils", | ||
58 | ], | ||
54 | } | 59 | } |
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp index 98341ef3..dc300387 100644 --- a/boot/1.0/Android.bp +++ b/boot/1.0/Android.bp | |||
@@ -43,4 +43,9 @@ cc_library_shared { | |||
43 | "libutils", | 43 | "libutils", |
44 | "libcutils", | 44 | "libcutils", |
45 | ], | 45 | ], |
46 | export_shared_lib_headers: [ | ||
47 | "libhidl", | ||
48 | "libhwbinder", | ||
49 | "libutils", | ||
50 | ], | ||
46 | } | 51 | } |
diff --git a/boot/1.0/default/service.cpp b/boot/1.0/default/service.cpp index b059f9a2..a594db6e 100644 --- a/boot/1.0/default/service.cpp +++ b/boot/1.0/default/service.cpp | |||
@@ -1,44 +1,11 @@ | |||
1 | #define LOG_TAG "android.hardware.boot@1.0-service" | 1 | #define LOG_TAG "android.hardware.boot@1.0-service" |
2 | #include <utils/Log.h> | ||
3 | |||
4 | #include <iostream> | ||
5 | #include <unistd.h> | ||
6 | 2 | ||
7 | #include <android/hardware/boot/1.0/IBootControl.h> | 3 | #include <android/hardware/boot/1.0/IBootControl.h> |
8 | 4 | #include <hidl/LegacySupport.h> | |
9 | #include <hidl/IServiceManager.h> | ||
10 | #include <hwbinder/IPCThreadState.h> | ||
11 | #include <hwbinder/ProcessState.h> | ||
12 | #include <utils/Errors.h> | ||
13 | #include <utils/StrongPointer.h> | ||
14 | |||
15 | using android::sp; | ||
16 | |||
17 | using android::hardware::IPCThreadState; | ||
18 | using android::hardware::ProcessState; | ||
19 | 5 | ||
20 | using ::android::hardware::boot::V1_0::IBootControl; | 6 | using ::android::hardware::boot::V1_0::IBootControl; |
7 | using android::hardware::defaultPassthroughServiceImplementation; | ||
21 | 8 | ||
22 | int main (int /* argc */, char * /* argv */ []) { | 9 | int main (int /* argc */, char * /* argv */ []) { |
23 | ALOGI("Service is starting."); | 10 | return defaultPassthroughServiceImplementation<IBootControl>("bootctrl"); |
24 | const char instance[] = "bootctrl"; | ||
25 | ALOGI("Retrieving default implementation of instance %s.", | ||
26 | instance); | ||
27 | |||
28 | sp<IBootControl> service = IBootControl::getService(instance, true /* getStub */); | ||
29 | |||
30 | if (service.get() == nullptr) { | ||
31 | ALOGE("IBootControl::getService returned NULL, exiting"); | ||
32 | return -1; | ||
33 | } | ||
34 | |||
35 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
36 | |||
37 | ALOGI("Registering instance %s.", instance); | ||
38 | service->registerAsService(instance); | ||
39 | ALOGI("Ready."); | ||
40 | |||
41 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
42 | ProcessState::self()->startThreadPool(); | ||
43 | IPCThreadState::self()->joinThreadPool(); | ||
44 | } | 11 | } |
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp new file mode 100644 index 00000000..44af4aaf --- /dev/null +++ b/broadcastradio/1.0/Android.bp | |||
@@ -0,0 +1,70 @@ | |||
1 | // This file is autogenerated by hidl-gen. Do not edit manually. | ||
2 | |||
3 | genrule { | ||
4 | name: "android.hardware.broadcastradio@1.0_genc++", | ||
5 | tool: "hidl-gen", | ||
6 | cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0", | ||
7 | srcs: [ | ||
8 | "types.hal", | ||
9 | "IBroadcastRadio.hal", | ||
10 | "IBroadcastRadioFactory.hal", | ||
11 | "ITuner.hal", | ||
12 | "ITunerCallback.hal", | ||
13 | ], | ||
14 | out: [ | ||
15 | "android/hardware/broadcastradio/1.0/types.cpp", | ||
16 | "android/hardware/broadcastradio/1.0/BroadcastRadioAll.cpp", | ||
17 | "android/hardware/broadcastradio/1.0/BroadcastRadioFactoryAll.cpp", | ||
18 | "android/hardware/broadcastradio/1.0/TunerAll.cpp", | ||
19 | "android/hardware/broadcastradio/1.0/TunerCallbackAll.cpp", | ||
20 | ], | ||
21 | } | ||
22 | |||
23 | genrule { | ||
24 | name: "android.hardware.broadcastradio@1.0_genc++_headers", | ||
25 | tool: "hidl-gen", | ||
26 | cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0", | ||
27 | srcs: [ | ||
28 | "types.hal", | ||
29 | "IBroadcastRadio.hal", | ||
30 | "IBroadcastRadioFactory.hal", | ||
31 | "ITuner.hal", | ||
32 | "ITunerCallback.hal", | ||
33 | ], | ||
34 | out: [ | ||
35 | "android/hardware/broadcastradio/1.0/types.h", | ||
36 | "android/hardware/broadcastradio/1.0/IBroadcastRadio.h", | ||
37 | "android/hardware/broadcastradio/1.0/IHwBroadcastRadio.h", | ||
38 | "android/hardware/broadcastradio/1.0/BnBroadcastRadio.h", | ||
39 | "android/hardware/broadcastradio/1.0/BpBroadcastRadio.h", | ||
40 | "android/hardware/broadcastradio/1.0/BsBroadcastRadio.h", | ||
41 | "android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h", | ||
42 | "android/hardware/broadcastradio/1.0/IHwBroadcastRadioFactory.h", | ||
43 | "android/hardware/broadcastradio/1.0/BnBroadcastRadioFactory.h", | ||
44 | "android/hardware/broadcastradio/1.0/BpBroadcastRadioFactory.h", | ||
45 | "android/hardware/broadcastradio/1.0/BsBroadcastRadioFactory.h", | ||
46 | "android/hardware/broadcastradio/1.0/ITuner.h", | ||
47 | "android/hardware/broadcastradio/1.0/IHwTuner.h", | ||
48 | "android/hardware/broadcastradio/1.0/BnTuner.h", | ||
49 | "android/hardware/broadcastradio/1.0/BpTuner.h", | ||
50 | "android/hardware/broadcastradio/1.0/BsTuner.h", | ||
51 | "android/hardware/broadcastradio/1.0/ITunerCallback.h", | ||
52 | "android/hardware/broadcastradio/1.0/IHwTunerCallback.h", | ||
53 | "android/hardware/broadcastradio/1.0/BnTunerCallback.h", | ||
54 | "android/hardware/broadcastradio/1.0/BpTunerCallback.h", | ||
55 | "android/hardware/broadcastradio/1.0/BsTunerCallback.h", | ||
56 | ], | ||
57 | } | ||
58 | |||
59 | cc_library_shared { | ||
60 | name: "android.hardware.broadcastradio@1.0", | ||
61 | generated_sources: ["android.hardware.broadcastradio@1.0_genc++"], | ||
62 | generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"], | ||
63 | export_generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"], | ||
64 | shared_libs: [ | ||
65 | "libhidl", | ||
66 | "libhwbinder", | ||
67 | "libutils", | ||
68 | "libcutils", | ||
69 | ], | ||
70 | } | ||
diff --git a/broadcastradio/1.0/IBroadcastRadio.hal b/broadcastradio/1.0/IBroadcastRadio.hal new file mode 100644 index 00000000..c7fe62df --- /dev/null +++ b/broadcastradio/1.0/IBroadcastRadio.hal | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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.broadcastradio@1.0; | ||
18 | |||
19 | import ITunerCallback; | ||
20 | import ITuner; | ||
21 | |||
22 | interface IBroadcastRadio { | ||
23 | |||
24 | /* | ||
25 | * Retrieve implementation properties. | ||
26 | * @return result Operation completion status: OK in case of success, | ||
27 | * NOT_INITIALIZED in case of initialization error. | ||
28 | * @return properties A Properties structure containing implementation | ||
29 | * description and capabilities. | ||
30 | */ | ||
31 | getProperties() generates (Result result, Properties properties); | ||
32 | |||
33 | /* | ||
34 | * Open a tuner interface for the requested configuration. | ||
35 | * If no other tuner is opened, this will power on the radio hardware. | ||
36 | * The hardware must be powered down when all tuner interface are released. | ||
37 | * @param config A BandConfig struct containing the band configuration to apply | ||
38 | * @param audio True if this tuner must be used for live radio listening and | ||
39 | * should be connected to the radio audio source. | ||
40 | * @param callback the callback interface | ||
41 | * @return result Operation completion status: OK in case of success, | ||
42 | * INVALID_ARGUMENTS if configuration requested is invalid, | ||
43 | * INVALID_STATE if called out of sequence | ||
44 | * @return tuner The interface to control the tuner | ||
45 | * | ||
46 | * Callback ITunerCallback.ConfigChanged MUST be called once the | ||
47 | * configuration is applied or a failure occurs or after a time out. | ||
48 | */ | ||
49 | openTuner(BandConfig config, bool audio, ITunerCallback callback) | ||
50 | generates (Result result, ITuner tuner); | ||
51 | }; | ||
diff --git a/broadcastradio/1.0/IBroadcastRadioFactory.hal b/broadcastradio/1.0/IBroadcastRadioFactory.hal new file mode 100644 index 00000000..82a97c48 --- /dev/null +++ b/broadcastradio/1.0/IBroadcastRadioFactory.hal | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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.broadcastradio@1.0; | ||
18 | |||
19 | import IBroadcastRadio; | ||
20 | |||
21 | interface IBroadcastRadioFactory { | ||
22 | |||
23 | /* | ||
24 | * Connects to a broadcast radio HAL module for a given class | ||
25 | * (AM/FM, Satellite, DAB). | ||
26 | * | ||
27 | * @param classId Class of the module to connect to . | ||
28 | * @return retval operation completion status. Returns INVALID_ARGUMENTS | ||
29 | * if there is no corresponding hardware module found, | ||
30 | * NOT_INITIALIZED if an error occurred while opening the hardware | ||
31 | * module. | ||
32 | * @return result the interface for the created module. | ||
33 | */ | ||
34 | connectModule(Class classId) | ||
35 | generates (Result retval, IBroadcastRadio result); | ||
36 | }; | ||
diff --git a/broadcastradio/1.0/ITuner.hal b/broadcastradio/1.0/ITuner.hal new file mode 100644 index 00000000..5e2bffe3 --- /dev/null +++ b/broadcastradio/1.0/ITuner.hal | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 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.broadcastradio@1.0; | ||
18 | |||
19 | import ITunerCallback; | ||
20 | |||
21 | interface ITuner { | ||
22 | |||
23 | /* | ||
24 | * Apply current radio band configuration (band, range, channel spacing...). | ||
25 | * Automatically cancels pending scan, step or tune. | ||
26 | * ITunerCallback.configChange() method MUST be called once the | ||
27 | * configuration is applied or a failure occurs or after a time out. | ||
28 | * @param config The band configuration to apply. | ||
29 | * @return result OK if configuration could be applied | ||
30 | * NOT_INITIALIZED in case of initialization error. | ||
31 | * INVALID_ARGUMENTS if configuration requested is invalid | ||
32 | * | ||
33 | */ | ||
34 | setConfiguration(BandConfig config) generates(Result result); | ||
35 | |||
36 | /* | ||
37 | * Retrieve current radio band configuration. | ||
38 | * @return result OK if valid configuration is returned, | ||
39 | * NOT_INITIALIZED in case of initialization error. | ||
40 | * @param config Current band configuration | ||
41 | */ | ||
42 | getConfiguration() generates(Result result, BandConfig config); | ||
43 | |||
44 | /* | ||
45 | * Start scanning up to next valid station. | ||
46 | * Shall be called only when a valid configuration has been applied. | ||
47 | * Automatically cancels pending scan, step or tune. | ||
48 | * ITunerCallback.tuneComplete() MUST be called once locked on a station | ||
49 | * or after a time out or full band scan if no station found. | ||
50 | * The status should indicate if a valid station is tuned or not. | ||
51 | * @param direction UP or DOWN. | ||
52 | * @param skipSubChannel valid for HD radio or digital radios only: | ||
53 | * ignore sub channels (e.g SPS for HD radio). | ||
54 | * @return result OK if scan successfully started | ||
55 | * INVALID_STATE if called out of sequence | ||
56 | * NOT_INITIALIZED if another error occurs | ||
57 | */ | ||
58 | scan(Direction direction, bool skipSubChannel) generates(Result result); | ||
59 | |||
60 | /* | ||
61 | * Move one channel spacing up or down. | ||
62 | * Must be called when a valid configuration has been applied. | ||
63 | * Automatically cancels pending scan, step or tune. | ||
64 | * ITunerCallback.tuneComplete() MUST be called once locked on a station | ||
65 | * or after a time out or full band scan if no station found. | ||
66 | * The status should indicate if a valid station is tuned or not. | ||
67 | * @param direction UP or DOWN. | ||
68 | * @param skipSubChannel valid for HD radio or digital radios only: | ||
69 | * ignore sub channels (e.g SPS for HD radio). | ||
70 | * @return result OK if scan successfully started | ||
71 | * INVALID_STATE if called out of sequence | ||
72 | * NOT_INITIALIZED if another error occurs | ||
73 | */ | ||
74 | step(Direction direction, bool skipSubChannel) generates(Result result); | ||
75 | |||
76 | /* | ||
77 | * Tune to specified channel. | ||
78 | * Must be called when a valid configuration has been applied. | ||
79 | * Automatically cancels pending scan, step or tune. | ||
80 | * ITunerCallback.tuneComplete() MUST be called once locked on a station | ||
81 | * or after a time out or full band scan if no station found. | ||
82 | * The status should indicate if a valid station is tuned or not. | ||
83 | * @param channel Channel to tune to. A frequency in kHz for AM/FM/HD Radio | ||
84 | * bands. | ||
85 | * @param subChannel Valid for HD radio or digital radios only | ||
86 | * (e.g SPS number for HD radio).. | ||
87 | * @return result OK if scan successfully started | ||
88 | * INVALID_ARGUMENTS if invalid arguments are passed | ||
89 | * INVALID_STATE if called out of sequence | ||
90 | * NOT_INITIALIZED if another error occurs | ||
91 | */ | ||
92 | tune(uint32_t channel, uint32_t subChannel) generates(Result result); | ||
93 | |||
94 | /* | ||
95 | * Cancel a scan, step or tune operation. | ||
96 | * Shall be called only while a scan, step or tune operation is pending. | ||
97 | * ITunerCallback.tuneComplete() MUST NOT be sent by the HAL. | ||
98 | * @return result OK if scan successfully started | ||
99 | * INVALID_STATE if called out of sequence | ||
100 | * NOT_INITIALIZED if another error occurs | ||
101 | */ | ||
102 | cancel() generates(Result result); | ||
103 | |||
104 | /* | ||
105 | * Retrieve current station information. | ||
106 | * @param withMetadata True if Metadata should be returned, false otherwise. | ||
107 | * @return result OK if scan successfully started | ||
108 | * NOT_INITIALIZED if another error occurs | ||
109 | * @return info Current program information. | ||
110 | */ | ||
111 | getProgramInformation(bool withMetadata) | ||
112 | generates(Result result, ProgramInfo info); | ||
113 | }; | ||
diff --git a/broadcastradio/1.0/ITunerCallback.hal b/broadcastradio/1.0/ITunerCallback.hal new file mode 100644 index 00000000..f8054723 --- /dev/null +++ b/broadcastradio/1.0/ITunerCallback.hal | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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.broadcastradio@1.0; | ||
18 | |||
19 | |||
20 | interface ITunerCallback { | ||
21 | |||
22 | /* | ||
23 | * Method called by the HAL when a HW failure occurs. | ||
24 | * The framework MUST close the ITuner interface and open a new one. | ||
25 | */ | ||
26 | oneway hardwareFailure(); | ||
27 | |||
28 | /* | ||
29 | * Method called by the HAL when a new configuration is applied | ||
30 | * in response to IDevice.openTuner() or ITuner.setConfiguration(). | ||
31 | * @param result OK if the configuration has been applied, | ||
32 | * INVALID_ARGUMENTS if not or TIMEOUT in case of time out. | ||
33 | * @param config A BandConfig structure describing the new configuration | ||
34 | * applied. | ||
35 | */ | ||
36 | oneway configChange(Result result, BandConfig config); | ||
37 | |||
38 | /* | ||
39 | * Method called by the HAL when a tuning operation completes | ||
40 | * following a step(), scan() or tune() command. | ||
41 | * @param result OK if tune succeeded or TIMEOUT in case of time out. | ||
42 | * @param info A ProgramInfo structure describing the tuned station. | ||
43 | */ | ||
44 | oneway tuneComplete(Result result, ProgramInfo info); | ||
45 | |||
46 | /* | ||
47 | * Method called by the HAL when a frequency switch occurs. | ||
48 | * @param info A ProgramInfo structure describing the new tuned station. | ||
49 | */ | ||
50 | oneway afSwitch(ProgramInfo info); | ||
51 | |||
52 | /* | ||
53 | * Method called by the HAL when the antenna connection state changes. | ||
54 | * @param connected True if the antenna is connected, false otherwise. | ||
55 | */ | ||
56 | oneway antennaStateChange(bool connected); | ||
57 | |||
58 | /* | ||
59 | * Method called by the HAL when a traffic announcement starts or | ||
60 | * stops. | ||
61 | * @param active True if the announcement starts, false if it stops. | ||
62 | */ | ||
63 | oneway trafficAnnouncement(bool active); | ||
64 | |||
65 | /* | ||
66 | * Method called by the HAL when an emergency announcement starts | ||
67 | * or stops. | ||
68 | * @param active True if the announcement starts, false if it stops. | ||
69 | */ | ||
70 | oneway emergencyAnnouncement(bool active); | ||
71 | |||
72 | /* | ||
73 | * Method called by the HAL when metadata for current station | ||
74 | * are updated. | ||
75 | * @param metadatas A list of all updated metada. | ||
76 | */ | ||
77 | oneway newMetadata(vec<MetaData> metadatas); | ||
78 | }; \ No newline at end of file | ||
diff --git a/broadcastradio/1.0/types.hal b/broadcastradio/1.0/types.hal new file mode 100644 index 00000000..c5b44119 --- /dev/null +++ b/broadcastradio/1.0/types.hal | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * Copyright 2016 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.broadcastradio@1.0; | ||
18 | |||
19 | enum Result { | ||
20 | OK, | ||
21 | NOT_INITIALIZED, | ||
22 | INVALID_ARGUMENTS, | ||
23 | INVALID_STATE, | ||
24 | TIMEOUT, | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * Radio hardware module class. A given radio hardware module HAL is of one | ||
29 | * class only. The platform can not have more than one hardware module of | ||
30 | * each class. Current version of the framework only supports RADIO_CLASS_AM_FM. | ||
31 | */ | ||
32 | enum Class : uint32_t { | ||
33 | /* FM (including HD radio) and AM */ | ||
34 | AM_FM = 0, | ||
35 | /* Satellite Radio */ | ||
36 | SAT = 1, | ||
37 | /* Digital Radio (DAB) */ | ||
38 | DT = 2, | ||
39 | }; | ||
40 | |||
41 | /* value for field "type" of radio band described in struct radio_hal_band_config */ | ||
42 | enum Band : uint32_t { | ||
43 | /* Amplitude Modulation band: LW, MW, SW */ | ||
44 | AM = 0, | ||
45 | /* Frequency Modulation band: FM */ | ||
46 | FM = 1, | ||
47 | /* FM HD Radio / DRM (IBOC) */ | ||
48 | FM_HD = 2, | ||
49 | /* AM HD Radio / DRM (IBOC) */ | ||
50 | AM_HD = 3, | ||
51 | }; | ||
52 | |||
53 | /* RDS variant implemented. A struct FmBandConfig can list none or several. */ | ||
54 | enum Rds : uint32_t { | ||
55 | NONE = 0, | ||
56 | WORLD = (1<<0), | ||
57 | RDS_US = (1<<1), | ||
58 | }; | ||
59 | |||
60 | |||
61 | /* FM deemphasis variant implemented. | ||
62 | * A struct FmBandConfig can list one or more. */ | ||
63 | enum Deemphasis : uint32_t { | ||
64 | D50 = (1<<0), | ||
65 | D75 = (1<<1), | ||
66 | }; | ||
67 | |||
68 | /* Scanning direction for scan() and step() tuner APIs */ | ||
69 | enum Direction : uint32_t { | ||
70 | UP, | ||
71 | DOWN | ||
72 | }; | ||
73 | |||
74 | /* Unique handle allocated to a radio module */ | ||
75 | typedef uint32_t Handle; | ||
76 | |||
77 | |||
78 | /* Additional attributes for an FM band configuration */ | ||
79 | struct FmBandConfig { | ||
80 | /* deemphasis variant */ | ||
81 | Deemphasis deemphasis; | ||
82 | /* stereo supported */ | ||
83 | bool stereo; | ||
84 | /* RDS variants supported */ | ||
85 | Rds rds; | ||
86 | /* Traffic Announcement supported */ | ||
87 | bool ta; | ||
88 | /* Alternate Frequency supported */ | ||
89 | bool af; | ||
90 | /* Emergency announcements supported */ | ||
91 | bool ea; | ||
92 | }; | ||
93 | |||
94 | /* Additional attributes for an AM band configuration */ | ||
95 | struct AmBandConfig { | ||
96 | /* Stereo supported */ | ||
97 | bool stereo; | ||
98 | }; | ||
99 | |||
100 | /* Radio band configuration. Describes a given band supported by the radio | ||
101 | * module. The HAL can expose only one band per type with the the maximum range | ||
102 | * supported and all options. The framework will derive the actual regions were | ||
103 | * this module can operate and expose separate band configurations for | ||
104 | * applications to chose from. */ | ||
105 | struct BandConfig { | ||
106 | Band type; | ||
107 | bool antennaConnected; | ||
108 | uint32_t lowerLimit; | ||
109 | uint32_t upperLimit; | ||
110 | vec<uint32_t> spacings; | ||
111 | union Ext { | ||
112 | FmBandConfig fm; | ||
113 | AmBandConfig am; | ||
114 | }; | ||
115 | }; | ||
116 | |||
117 | /* Exposes properties of a given hardware radio module. | ||
118 | * NOTE: current framework implementation supports only one audio source | ||
119 | * (num_audio_sources = 1). The source corresponds to AUDIO_DEVICE_IN_FM_TUNER. | ||
120 | * If more than one tuner is supported (num_tuners > 1), only one can be | ||
121 | * connected to the audio source. */ | ||
122 | struct Properties { | ||
123 | /* Class of this module. E.g AM_FM */ | ||
124 | Class classId; | ||
125 | /* implementor name */ | ||
126 | string implementor; | ||
127 | /* product name */ | ||
128 | string product; | ||
129 | /* product version */ | ||
130 | string version; | ||
131 | /* serial number (for subscription services) */ | ||
132 | string serial; | ||
133 | /* number of tuners controllable independently */ | ||
134 | uint32_t numTuners; | ||
135 | /* number of audio sources driven simultaneously */ | ||
136 | uint32_t numAudioSources; | ||
137 | /* the hardware supports capture of audio source from audio HAL */ | ||
138 | bool supportsCapture; | ||
139 | vec<BandConfig> bands; /* band descriptors */ | ||
140 | }; | ||
141 | |||
142 | enum MetadataType { | ||
143 | INVALID = -1, | ||
144 | /* Signed 32 bit integer */ | ||
145 | INT = 0, | ||
146 | /* String */ | ||
147 | TEXT = 1, | ||
148 | /* Raw binary data (icon or art) | ||
149 | This data must be transparent to the android framework */ | ||
150 | RAW = 2, | ||
151 | /* clock data, see MetaDataClock */ | ||
152 | CLOCK = 3, | ||
153 | }; | ||
154 | |||
155 | enum MetadataKey { | ||
156 | INVALID = -1, | ||
157 | /* RDS PI - string */ | ||
158 | RDS_PI = 0, | ||
159 | /* RDS PS - string */ | ||
160 | RDS_PS = 1, | ||
161 | /* RDS PTY - int32_t */ | ||
162 | RDS_PTY = 2, | ||
163 | /* RBDS PTY - int32_t */ | ||
164 | RBDS_PTY = 3, | ||
165 | /* RDS RT - string */ | ||
166 | RDS_RT = 4, | ||
167 | /* Song title - string */ | ||
168 | TITLE = 5, | ||
169 | /* Artist name - string */ | ||
170 | ARTIST = 6, | ||
171 | /* Album name - string */ | ||
172 | ALBUM = 7, | ||
173 | /* Musical genre - string */ | ||
174 | GENRE = 8, | ||
175 | /* Station icon - raw */ | ||
176 | ICON = 9, | ||
177 | /* Album art - raw */ | ||
178 | ART = 10, | ||
179 | /* Clock - MetaDataClock */ | ||
180 | CLOCK = 11, | ||
181 | }; | ||
182 | |||
183 | struct MetaDataClock { | ||
184 | /* Seconds since epoch at GMT + 0. */ | ||
185 | uint64_t utcSecondsSinceEpoch; | ||
186 | /* Minutes offset from the GMT. */ | ||
187 | int32_t timezoneOffsetInMinutes; | ||
188 | }; | ||
189 | |||
190 | struct MetaData { | ||
191 | MetadataType type; | ||
192 | MetadataKey key; | ||
193 | /* Value used for type MetadataType.INT */ | ||
194 | int32_t intValue; | ||
195 | /* Value used for type MetadataType.CLOCK */ | ||
196 | MetaDataClock clockValue; | ||
197 | /* Value used for type MetadataType.TEXT */ | ||
198 | string stringValue; | ||
199 | /* Value used for type MetadataType.RAW */ | ||
200 | vec<uint8_t> rawValue; | ||
201 | }; | ||
202 | |||
203 | |||
204 | /* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED. | ||
205 | * Contains information on currently tuned channel. | ||
206 | */ | ||
207 | struct ProgramInfo { | ||
208 | uint32_t channel; /* current channel. (e.g kHz for band type AM_FM) */ | ||
209 | uint32_t subChannel; /* current sub channel. (FM_HD) */ | ||
210 | bool tuned; /* tuned to a program or not */ | ||
211 | bool stereo; /* program is stereo or not */ | ||
212 | bool digital; /* digital program or not (e.g HD Radio program) */ | ||
213 | uint32_t signalStrength; /* signal strength from 0 to 100 */ | ||
214 | vec<MetaData> metadata; /* non empty if meta data are present (e.g PTY, song title ...) */ | ||
215 | }; | ||
216 | |||
diff --git a/graphics/allocator/2.0/default/service.cpp b/graphics/allocator/2.0/default/service.cpp index fd89aa80..525b342a 100644 --- a/graphics/allocator/2.0/default/service.cpp +++ b/graphics/allocator/2.0/default/service.cpp | |||
@@ -14,38 +14,15 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define LOG_TAG "GrallocService" | 17 | #define LOG_TAG "android.hardware.graphics.allocator@2.0-service" |
18 | 18 | ||
19 | #include <android/hardware/graphics/allocator/2.0/IAllocator.h> | 19 | #include <android/hardware/graphics/allocator/2.0/IAllocator.h> |
20 | #include <hwbinder/IPCThreadState.h> | ||
21 | #include <hwbinder/ProcessState.h> | ||
22 | #include <utils/StrongPointer.h> | ||
23 | 20 | ||
24 | using android::sp; | 21 | #include <hidl/LegacySupport.h> |
25 | using android::hardware::IPCThreadState; | ||
26 | using android::hardware::ProcessState; | ||
27 | using android::hardware::graphics::allocator::V2_0::IAllocator; | ||
28 | |||
29 | int main() | ||
30 | { | ||
31 | const char instance[] = "gralloc"; | ||
32 | |||
33 | ALOGI("Service is starting."); | ||
34 | |||
35 | sp<IAllocator> service = IAllocator::getService(instance, | ||
36 | true /* getStub */); | ||
37 | if (service == nullptr) { | ||
38 | ALOGI("getService returned NULL"); | ||
39 | return -1; | ||
40 | } | ||
41 | 22 | ||
42 | LOG_FATAL_IF(service->isRemote(), "Service is REMOTE!"); | 23 | using android::hardware::graphics::allocator::V2_0::IAllocator; |
43 | 24 | using android::hardware::defaultPassthroughServiceImplementation; | |
44 | service->registerAsService(instance); | ||
45 | |||
46 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
47 | ProcessState::self()->startThreadPool(); | ||
48 | IPCThreadState::self()->joinThreadPool(); | ||
49 | 25 | ||
50 | return 0; | 26 | int main() { |
27 | return defaultPassthroughServiceImplementation<IAllocator>("gralloc"); | ||
51 | } | 28 | } |
diff --git a/light/2.0/default/service.cpp b/light/2.0/default/service.cpp index e4468784..b3848e95 100644 --- a/light/2.0/default/service.cpp +++ b/light/2.0/default/service.cpp | |||
@@ -1,46 +1,27 @@ | |||
1 | #define LOG_TAG "android.hardware.light@2.0-service" | 1 | /* |
2 | #include <utils/Log.h> | 2 | * Copyright 2016 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 | */ | ||
3 | 16 | ||
4 | #include <iostream> | 17 | #define LOG_TAG "android.hardware.light@2.0-service" |
5 | #include <unistd.h> | ||
6 | 18 | ||
7 | #include <android/hardware/light/2.0/ILight.h> | 19 | #include <android/hardware/light/2.0/ILight.h> |
20 | #include <hidl/LegacySupport.h> | ||
8 | 21 | ||
9 | #include <hidl/IServiceManager.h> | ||
10 | #include <hwbinder/IPCThreadState.h> | ||
11 | #include <hwbinder/ProcessState.h> | ||
12 | #include <utils/Errors.h> | ||
13 | #include <utils/StrongPointer.h> | ||
14 | |||
15 | using android::sp; | ||
16 | |||
17 | // libhwbinder: | ||
18 | using android::hardware::IPCThreadState; | ||
19 | using android::hardware::ProcessState; | ||
20 | |||
21 | // Generated HIDL files | ||
22 | using android::hardware::light::V2_0::ILight; | 22 | using android::hardware::light::V2_0::ILight; |
23 | using android::hardware::defaultPassthroughServiceImplementation; | ||
23 | 24 | ||
24 | int main() { | 25 | int main() { |
25 | ALOGI("Service is starting."); | 26 | return defaultPassthroughServiceImplementation<ILight>("light"); |
26 | const char instance[] = "light"; | ||
27 | ALOGI("Retrieving default implementation of instance %s.", | ||
28 | instance); | ||
29 | |||
30 | android::sp<ILight> service = ILight::getService(instance, true /* getStub */); | ||
31 | |||
32 | if (service.get() == nullptr) { | ||
33 | ALOGE("ILight::getService returned NULL, exiting"); | ||
34 | return EXIT_FAILURE; | ||
35 | } | ||
36 | |||
37 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
38 | |||
39 | ALOGI("Registering instance %s.", instance); | ||
40 | service->registerAsService(instance); | ||
41 | ALOGI("Ready."); | ||
42 | |||
43 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
44 | ProcessState::self()->startThreadPool(); | ||
45 | IPCThreadState::self()->joinThreadPool(); | ||
46 | } | 27 | } |
diff --git a/memtrack/1.0/default/service.cpp b/memtrack/1.0/default/service.cpp index 63ac6957..f705b157 100644 --- a/memtrack/1.0/default/service.cpp +++ b/memtrack/1.0/default/service.cpp | |||
@@ -15,37 +15,13 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define LOG_TAG "android.hardware.memtrack@1.0-service" | 17 | #define LOG_TAG "android.hardware.memtrack@1.0-service" |
18 | #include <utils/Log.h> | ||
19 | |||
20 | #include <iostream> | ||
21 | #include <unistd.h> | ||
22 | 18 | ||
23 | #include <android/hardware/memtrack/1.0/IMemtrack.h> | 19 | #include <android/hardware/memtrack/1.0/IMemtrack.h> |
24 | 20 | #include <hidl/LegacySupport.h> | |
25 | #include <hidl/IServiceManager.h> | ||
26 | #include <hwbinder/IPCThreadState.h> | ||
27 | #include <hwbinder/ProcessState.h> | ||
28 | #include <utils/Errors.h> | ||
29 | #include <utils/StrongPointer.h> | ||
30 | |||
31 | using android::sp; | ||
32 | |||
33 | using android::hardware::IPCThreadState; | ||
34 | using android::hardware::ProcessState; | ||
35 | 21 | ||
36 | using android::hardware::memtrack::V1_0::IMemtrack; | 22 | using android::hardware::memtrack::V1_0::IMemtrack; |
23 | using android::hardware::defaultPassthroughServiceImplementation; | ||
37 | 24 | ||
38 | int main() { | 25 | int main() { |
39 | const char instance[] = "memtrack"; | 26 | return defaultPassthroughServiceImplementation<IMemtrack>("memtrack"); |
40 | android::sp<IMemtrack> service = IMemtrack::getService(instance, true); | ||
41 | if (service.get() == nullptr) { | ||
42 | ALOGE("IMemtrack::getService returned NULL, exiting"); | ||
43 | return -1; | ||
44 | } | ||
45 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
46 | service->registerAsService(instance); | ||
47 | |||
48 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
49 | ProcessState::self()->startThreadPool(); | ||
50 | IPCThreadState::self()->joinThreadPool(); | ||
51 | } | 27 | } |
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp index d9f197ec..2b8f3afb 100644 --- a/nfc/1.0/Android.bp +++ b/nfc/1.0/Android.bp | |||
@@ -51,4 +51,9 @@ cc_library_shared { | |||
51 | "libutils", | 51 | "libutils", |
52 | "libcutils", | 52 | "libcutils", |
53 | ], | 53 | ], |
54 | export_shared_lib_headers: [ | ||
55 | "libhidl", | ||
56 | "libhwbinder", | ||
57 | "libutils", | ||
58 | ], | ||
54 | } | 59 | } |
diff --git a/power/1.0/default/service.cpp b/power/1.0/default/service.cpp index bad1adf1..f77ff5b0 100644 --- a/power/1.0/default/service.cpp +++ b/power/1.0/default/service.cpp | |||
@@ -15,37 +15,13 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define LOG_TAG "android.hardware.power@1.0-service" | 17 | #define LOG_TAG "android.hardware.power@1.0-service" |
18 | #include <utils/Log.h> | ||
19 | |||
20 | #include <iostream> | ||
21 | #include <unistd.h> | ||
22 | 18 | ||
23 | #include <android/hardware/power/1.0/IPower.h> | 19 | #include <android/hardware/power/1.0/IPower.h> |
24 | 20 | #include <hidl/LegacySupport.h> | |
25 | #include <hidl/IServiceManager.h> | ||
26 | #include <hwbinder/IPCThreadState.h> | ||
27 | #include <hwbinder/ProcessState.h> | ||
28 | #include <utils/Errors.h> | ||
29 | #include <utils/StrongPointer.h> | ||
30 | |||
31 | using android::sp; | ||
32 | |||
33 | using android::hardware::IPCThreadState; | ||
34 | using android::hardware::ProcessState; | ||
35 | 21 | ||
36 | using android::hardware::power::V1_0::IPower; | 22 | using android::hardware::power::V1_0::IPower; |
23 | using android::hardware::defaultPassthroughServiceImplementation; | ||
37 | 24 | ||
38 | int main() { | 25 | int main() { |
39 | const char instance[] = "power"; | 26 | return defaultPassthroughServiceImplementation<IPower>("power"); |
40 | android::sp<IPower> service = IPower::getService(instance, true); | ||
41 | if (service.get() == nullptr) { | ||
42 | ALOGE("IPower::getService returned NULL, exiting"); | ||
43 | return -1; | ||
44 | } | ||
45 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
46 | service->registerAsService(instance); | ||
47 | |||
48 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
49 | ProcessState::self()->startThreadPool(); | ||
50 | IPCThreadState::self()->joinThreadPool(); | ||
51 | } | 27 | } |
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp index 682e12c6..34eaf33d 100644 --- a/radio/1.0/Android.bp +++ b/radio/1.0/Android.bp | |||
@@ -51,4 +51,9 @@ cc_library_shared { | |||
51 | "libutils", | 51 | "libutils", |
52 | "libcutils", | 52 | "libcutils", |
53 | ], | 53 | ], |
54 | export_shared_lib_headers: [ | ||
55 | "libhidl", | ||
56 | "libhwbinder", | ||
57 | "libutils", | ||
58 | ], | ||
54 | } | 59 | } |
diff --git a/sensors/1.0/default/service.cpp b/sensors/1.0/default/service.cpp index da543ef4..230ead37 100644 --- a/sensors/1.0/default/service.cpp +++ b/sensors/1.0/default/service.cpp | |||
@@ -14,38 +14,14 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <android-base/logging.h> | 17 | #define LOG_TAG "android.hardware.nfc@1.0-service" |
18 | #include <android/hardware/sensors/1.0/ISensors.h> | ||
19 | #include <hwbinder/IPCThreadState.h> | ||
20 | #include <hwbinder/ProcessState.h> | ||
21 | |||
22 | int main() { | ||
23 | using android::hardware::sensors::V1_0::ISensors; | ||
24 | using android::sp; | ||
25 | using android::OK; | ||
26 | using namespace android::hardware; | ||
27 | |||
28 | LOG(INFO) << "Service is starting."; | ||
29 | sp<ISensors> sensors = ISensors::getService("sensors", true /* getStub */); | ||
30 | |||
31 | if (sensors.get() == nullptr) { | ||
32 | LOG(ERROR) << "ISensors::getService returned nullptr, exiting."; | ||
33 | return 1; | ||
34 | } | ||
35 | 18 | ||
36 | LOG(INFO) << "Default implementation using sensors is " | 19 | #include <android/hardware/sensors/1.0/ISensors.h> |
37 | << (sensors->isRemote() ? "REMOTE" : "LOCAL"); | 20 | #include <hidl/LegacySupport.h> |
38 | |||
39 | CHECK(!sensors->isRemote()); | ||
40 | |||
41 | LOG(INFO) << "Registering instance sensors."; | ||
42 | sensors->registerAsService("sensors"); | ||
43 | LOG(INFO) << "Ready."; | ||
44 | 21 | ||
45 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | 22 | using android::hardware::sensors::V1_0::ISensors; |
46 | ProcessState::self()->startThreadPool(); | 23 | using android::hardware::defaultPassthroughServiceImplementation; |
47 | IPCThreadState::self()->joinThreadPool(); | ||
48 | 24 | ||
49 | return 0; | 25 | int main() { |
26 | return defaultPassthroughServiceImplementation<ISensors>("sensors"); | ||
50 | } | 27 | } |
51 | |||
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp index 617b08f1..06db6d02 100644 --- a/tests/bar/1.0/Android.bp +++ b/tests/bar/1.0/Android.bp | |||
@@ -48,4 +48,9 @@ cc_library_shared { | |||
48 | "libcutils", | 48 | "libcutils", |
49 | "android.hardware.tests.foo@1.0", | 49 | "android.hardware.tests.foo@1.0", |
50 | ], | 50 | ], |
51 | export_shared_lib_headers: [ | ||
52 | "libhidl", | ||
53 | "libhwbinder", | ||
54 | "libutils", | ||
55 | ], | ||
51 | } | 56 | } |
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp index 6da9eec4..34ec087e 100644 --- a/tests/bar/1.0/default/Bar.cpp +++ b/tests/bar/1.0/default/Bar.cpp | |||
@@ -21,10 +21,6 @@ Return<void> Bar::doThis(float param) { | |||
21 | return mFoo->doThis(param); | 21 | return mFoo->doThis(param); |
22 | } | 22 | } |
23 | 23 | ||
24 | Return<void> Bar::doThis(uint32_t param) { | ||
25 | return mFoo->doThis(param); | ||
26 | } | ||
27 | |||
28 | Return<int32_t> Bar::doThatAndReturnSomething( | 24 | Return<int32_t> Bar::doThatAndReturnSomething( |
29 | int64_t param) { | 25 | int64_t param) { |
30 | return mFoo->doThatAndReturnSomething(param); | 26 | return mFoo->doThatAndReturnSomething(param); |
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h index ae18d93c..d2c2635e 100644 --- a/tests/bar/1.0/default/Bar.h +++ b/tests/bar/1.0/default/Bar.h | |||
@@ -29,7 +29,6 @@ struct Bar : public IBar { | |||
29 | 29 | ||
30 | // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow. | 30 | // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow. |
31 | virtual Return<void> doThis(float param) override; | 31 | virtual Return<void> doThis(float param) override; |
32 | virtual Return<void> doThis(uint32_t param) override; | ||
33 | virtual Return<int32_t> doThatAndReturnSomething(int64_t param) override; | 32 | virtual Return<int32_t> doThatAndReturnSomething(int64_t param) override; |
34 | virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d) override; | 33 | virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d) override; |
35 | virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb) override; | 34 | virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb) override; |
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp index d3eefe52..64a88030 100644 --- a/tests/baz/1.0/Android.bp +++ b/tests/baz/1.0/Android.bp | |||
@@ -59,4 +59,9 @@ cc_library_shared { | |||
59 | "libutils", | 59 | "libutils", |
60 | "libcutils", | 60 | "libcutils", |
61 | ], | 61 | ], |
62 | export_shared_lib_headers: [ | ||
63 | "libhidl", | ||
64 | "libhwbinder", | ||
65 | "libutils", | ||
66 | ], | ||
62 | } | 67 | } |
diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp index 32d46828..2ad94fa4 100644 --- a/tests/expression/1.0/Android.bp +++ b/tests/expression/1.0/Android.bp | |||
@@ -47,4 +47,9 @@ cc_library_shared { | |||
47 | "libutils", | 47 | "libutils", |
48 | "libcutils", | 48 | "libcutils", |
49 | ], | 49 | ], |
50 | export_shared_lib_headers: [ | ||
51 | "libhidl", | ||
52 | "libhwbinder", | ||
53 | "libutils", | ||
54 | ], | ||
50 | } | 55 | } |
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp index e7bcad24..96133ac8 100644 --- a/tests/foo/1.0/Android.bp +++ b/tests/foo/1.0/Android.bp | |||
@@ -75,4 +75,9 @@ cc_library_shared { | |||
75 | "libutils", | 75 | "libutils", |
76 | "libcutils", | 76 | "libcutils", |
77 | ], | 77 | ], |
78 | export_shared_lib_headers: [ | ||
79 | "libhidl", | ||
80 | "libhwbinder", | ||
81 | "libutils", | ||
82 | ], | ||
78 | } | 83 | } |
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal index b6ef5c87..2afaec1b 100644 --- a/tests/foo/1.0/IFoo.hal +++ b/tests/foo/1.0/IFoo.hal | |||
@@ -81,7 +81,6 @@ interface IFoo { | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | doThis(float param); | 83 | doThis(float param); |
84 | doThis(uint32_t param); | ||
85 | doThatAndReturnSomething(int64_t param) generates (int32_t result); | 84 | doThatAndReturnSomething(int64_t param) generates (int32_t result); |
86 | doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something); | 85 | doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something); |
87 | doSomethingElse(int32_t[15] param) generates (int32_t[32] something); | 86 | doSomethingElse(int32_t[15] param) generates (int32_t[32] something); |
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp index 8571c874..185e5ea4 100644 --- a/tests/foo/1.0/default/Android.bp +++ b/tests/foo/1.0/default/Android.bp | |||
@@ -6,8 +6,6 @@ cc_library_shared { | |||
6 | srcs: [ | 6 | srcs: [ |
7 | "Foo.cpp", | 7 | "Foo.cpp", |
8 | "FooCallback.cpp", | 8 | "FooCallback.cpp", |
9 | "MyTypes.cpp", | ||
10 | "TheirTypes.cpp", | ||
11 | ], | 9 | ], |
12 | 10 | ||
13 | shared_libs: [ | 11 | shared_libs: [ |
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp index 4cfcfa25..f855f21e 100644 --- a/tests/foo/1.0/default/Foo.cpp +++ b/tests/foo/1.0/default/Foo.cpp | |||
@@ -22,11 +22,6 @@ Return<void> Foo::doThis(float param) { | |||
22 | return Void(); | 22 | return Void(); |
23 | } | 23 | } |
24 | 24 | ||
25 | Return<void> Foo::doThis(uint32_t param) { | ||
26 | ALOGI("SERVER(Foo) doThis (int) (%d)", param); | ||
27 | return Void(); | ||
28 | } | ||
29 | |||
30 | Return<int32_t> Foo::doThatAndReturnSomething( | 25 | Return<int32_t> Foo::doThatAndReturnSomething( |
31 | int64_t param) { | 26 | int64_t param) { |
32 | LOG(INFO) << "SERVER(Foo) doThatAndReturnSomething(" << param << ")"; | 27 | LOG(INFO) << "SERVER(Foo) doThatAndReturnSomething(" << param << ")"; |
@@ -73,10 +68,7 @@ Return<void> Foo::doStuffAndReturnAString( | |||
73 | doStuffAndReturnAString_cb _cb) { | 68 | doStuffAndReturnAString_cb _cb) { |
74 | ALOGI("SERVER(Foo) doStuffAndReturnAString"); | 69 | ALOGI("SERVER(Foo) doStuffAndReturnAString"); |
75 | 70 | ||
76 | hidl_string s; | 71 | _cb("Hello, world"); |
77 | s = "Hello, world"; | ||
78 | |||
79 | _cb(s); | ||
80 | 72 | ||
81 | return Void(); | 73 | return Void(); |
82 | } | 74 | } |
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h index 804a6a3d..b3785d2c 100644 --- a/tests/foo/1.0/default/Foo.h +++ b/tests/foo/1.0/default/Foo.h | |||
@@ -25,7 +25,6 @@ using ::android::sp; | |||
25 | struct Foo : public IFoo { | 25 | struct Foo : public IFoo { |
26 | // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow. | 26 | // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow. |
27 | virtual Return<void> doThis(float param) override; | 27 | virtual Return<void> doThis(float param) override; |
28 | virtual Return<void> doThis(uint32_t param) override; | ||
29 | virtual Return<int32_t> doThatAndReturnSomething(int64_t param) override; | 28 | virtual Return<int32_t> doThatAndReturnSomething(int64_t param) override; |
30 | virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d) override; | 29 | virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d) override; |
31 | virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb) override; | 30 | virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb) override; |
diff --git a/tests/foo/1.0/default/MyTypes.cpp b/tests/foo/1.0/default/MyTypes.cpp deleted file mode 100644 index 0d1a4581..00000000 --- a/tests/foo/1.0/default/MyTypes.cpp +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #include "MyTypes.h" | ||
2 | |||
3 | namespace android { | ||
4 | namespace hardware { | ||
5 | namespace tests { | ||
6 | namespace foo { | ||
7 | namespace V1_0 { | ||
8 | namespace implementation { | ||
9 | |||
10 | // Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow. | ||
11 | |||
12 | IMyTypes* HIDL_FETCH_IMyTypes(const char* /* name */) { | ||
13 | return new MyTypes(); | ||
14 | } | ||
15 | |||
16 | } // namespace implementation | ||
17 | } // namespace V1_0 | ||
18 | } // namespace foo | ||
19 | } // namespace tests | ||
20 | } // namespace hardware | ||
21 | } // namespace android | ||
diff --git a/tests/foo/1.0/default/MyTypes.h b/tests/foo/1.0/default/MyTypes.h deleted file mode 100644 index 6e9a3e12..00000000 --- a/tests/foo/1.0/default/MyTypes.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_ | ||
2 | #define HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_ | ||
3 | |||
4 | #include <android/hardware/tests/foo/1.0/IMyTypes.h> | ||
5 | #include <hidl/Status.h> | ||
6 | |||
7 | #include <hidl/MQDescriptor.h> | ||
8 | namespace android { | ||
9 | namespace hardware { | ||
10 | namespace tests { | ||
11 | namespace foo { | ||
12 | namespace V1_0 { | ||
13 | namespace implementation { | ||
14 | |||
15 | using ::android::hardware::tests::foo::V1_0::IMyTypes; | ||
16 | using ::android::hardware::Return; | ||
17 | using ::android::hardware::Void; | ||
18 | using ::android::hardware::hidl_vec; | ||
19 | using ::android::hardware::hidl_string; | ||
20 | using ::android::sp; | ||
21 | |||
22 | struct MyTypes : public IMyTypes { | ||
23 | // Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow. | ||
24 | |||
25 | }; | ||
26 | |||
27 | extern "C" IMyTypes* HIDL_FETCH_IMyTypes(const char* name); | ||
28 | |||
29 | } // namespace implementation | ||
30 | } // namespace V1_0 | ||
31 | } // namespace foo | ||
32 | } // namespace tests | ||
33 | } // namespace hardware | ||
34 | } // namespace android | ||
35 | |||
36 | #endif // HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_ | ||
diff --git a/tests/foo/1.0/default/TheirTypes.cpp b/tests/foo/1.0/default/TheirTypes.cpp deleted file mode 100644 index 0f678f0a..00000000 --- a/tests/foo/1.0/default/TheirTypes.cpp +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #include "TheirTypes.h" | ||
2 | |||
3 | namespace android { | ||
4 | namespace hardware { | ||
5 | namespace tests { | ||
6 | namespace foo { | ||
7 | namespace V1_0 { | ||
8 | namespace implementation { | ||
9 | |||
10 | // Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow. | ||
11 | |||
12 | ITheirTypes* HIDL_FETCH_ITheirTypes(const char* /* name */) { | ||
13 | return new TheirTypes(); | ||
14 | } | ||
15 | |||
16 | } // namespace implementation | ||
17 | } // namespace V1_0 | ||
18 | } // namespace foo | ||
19 | } // namespace tests | ||
20 | } // namespace hardware | ||
21 | } // namespace android | ||
diff --git a/tests/foo/1.0/default/TheirTypes.h b/tests/foo/1.0/default/TheirTypes.h deleted file mode 100644 index 24ade70a..00000000 --- a/tests/foo/1.0/default/TheirTypes.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_ | ||
2 | #define HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_ | ||
3 | |||
4 | #include <android/hardware/tests/foo/1.0/ITheirTypes.h> | ||
5 | #include <hidl/Status.h> | ||
6 | |||
7 | #include <hidl/MQDescriptor.h> | ||
8 | namespace android { | ||
9 | namespace hardware { | ||
10 | namespace tests { | ||
11 | namespace foo { | ||
12 | namespace V1_0 { | ||
13 | namespace implementation { | ||
14 | |||
15 | using ::android::hardware::tests::foo::V1_0::ITheirTypes; | ||
16 | using ::android::hardware::Return; | ||
17 | using ::android::hardware::Void; | ||
18 | using ::android::hardware::hidl_vec; | ||
19 | using ::android::hardware::hidl_string; | ||
20 | using ::android::sp; | ||
21 | |||
22 | struct TheirTypes : public ITheirTypes { | ||
23 | // Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow. | ||
24 | |||
25 | }; | ||
26 | |||
27 | extern "C" ITheirTypes* HIDL_FETCH_ITheirTypes(const char* name); | ||
28 | |||
29 | } // namespace implementation | ||
30 | } // namespace V1_0 | ||
31 | } // namespace foo | ||
32 | } // namespace tests | ||
33 | } // namespace hardware | ||
34 | } // namespace android | ||
35 | |||
36 | #endif // HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_ | ||
diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp index 508de228..52a81869 100644 --- a/tests/libhwbinder/1.0/Android.bp +++ b/tests/libhwbinder/1.0/Android.bp | |||
@@ -39,4 +39,9 @@ cc_library_shared { | |||
39 | "libutils", | 39 | "libutils", |
40 | "libcutils", | 40 | "libcutils", |
41 | ], | 41 | ], |
42 | export_shared_lib_headers: [ | ||
43 | "libhidl", | ||
44 | "libhwbinder", | ||
45 | "libutils", | ||
46 | ], | ||
42 | } | 47 | } |
diff --git a/tests/libhwbinder/1.0/default/Android.bp b/tests/libhwbinder/1.0/default/Android.bp new file mode 100644 index 00000000..91149e8d --- /dev/null +++ b/tests/libhwbinder/1.0/default/Android.bp | |||
@@ -0,0 +1,16 @@ | |||
1 | cc_library_shared { | ||
2 | name: "android.hardware.tests.libhwbinder@1.0-impl", | ||
3 | relative_install_path: "hw", | ||
4 | srcs: [ | ||
5 | "Benchmark.cpp", | ||
6 | ], | ||
7 | |||
8 | shared_libs: [ | ||
9 | "libbase", | ||
10 | "libhidl", | ||
11 | "libhwbinder", | ||
12 | "liblog", | ||
13 | "libutils", | ||
14 | "android.hardware.tests.libhwbinder@1.0", | ||
15 | ], | ||
16 | } \ No newline at end of file | ||
diff --git a/tests/libhwbinder/1.0/default/Benchmark.cpp b/tests/libhwbinder/1.0/default/Benchmark.cpp new file mode 100644 index 00000000..47b0ea00 --- /dev/null +++ b/tests/libhwbinder/1.0/default/Benchmark.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #define LOG_TAG "libhwbinder_benchmark" | ||
2 | |||
3 | #include "Benchmark.h" | ||
4 | |||
5 | namespace android { | ||
6 | namespace hardware { | ||
7 | namespace tests { | ||
8 | namespace libhwbinder { | ||
9 | namespace V1_0 { | ||
10 | namespace implementation { | ||
11 | |||
12 | Return<void> Benchmark::sendVec( | ||
13 | const ::android::hardware::hidl_vec<uint8_t>& data, | ||
14 | sendVec_cb _hidl_cb) { | ||
15 | _hidl_cb(data); | ||
16 | return Void(); | ||
17 | } | ||
18 | |||
19 | IBenchmark* HIDL_FETCH_IBenchmark(const char* /* name */) { | ||
20 | return new Benchmark(); | ||
21 | } | ||
22 | |||
23 | } // namespace implementation | ||
24 | } // namespace V1_0 | ||
25 | } // namespace libhwbinder | ||
26 | } // namespace tests | ||
27 | } // namespace hardware | ||
28 | } // namespace android | ||
diff --git a/tests/libhwbinder/1.0/default/Benchmark.h b/tests/libhwbinder/1.0/default/Benchmark.h new file mode 100644 index 00000000..454fdf29 --- /dev/null +++ b/tests/libhwbinder/1.0/default/Benchmark.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_ | ||
2 | #define HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_ | ||
3 | |||
4 | #include <android/hardware/tests/libhwbinder/1.0/IBenchmark.h> | ||
5 | #include <hidl/Status.h> | ||
6 | |||
7 | namespace android { | ||
8 | namespace hardware { | ||
9 | namespace tests { | ||
10 | namespace libhwbinder { | ||
11 | namespace V1_0 { | ||
12 | namespace implementation { | ||
13 | |||
14 | using ::android::hardware::tests::libhwbinder::V1_0::IBenchmark; | ||
15 | using ::android::hardware::Return; | ||
16 | using ::android::hardware::hidl_vec; | ||
17 | |||
18 | struct Benchmark : public IBenchmark { | ||
19 | virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb) override; | ||
20 | }; | ||
21 | |||
22 | extern "C" IBenchmark* HIDL_FETCH_IBenchmark(const char* name); | ||
23 | |||
24 | } // namespace implementation | ||
25 | } // namespace V1_0 | ||
26 | } // namespace libhwbinder | ||
27 | } // namespace tests | ||
28 | } // namespace hardware | ||
29 | } // namespace android | ||
30 | |||
31 | #endif // HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_ | ||
diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp index 16454ec7..58ee3d4e 100644 --- a/tests/msgq/1.0/Android.bp +++ b/tests/msgq/1.0/Android.bp | |||
@@ -39,4 +39,9 @@ cc_library_shared { | |||
39 | "libutils", | 39 | "libutils", |
40 | "libcutils", | 40 | "libcutils", |
41 | ], | 41 | ], |
42 | export_shared_lib_headers: [ | ||
43 | "libhidl", | ||
44 | "libhwbinder", | ||
45 | "libutils", | ||
46 | ], | ||
42 | } | 47 | } |
diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp index 45659d71..2601a5b3 100644 --- a/tests/pointer/1.0/Android.bp +++ b/tests/pointer/1.0/Android.bp | |||
@@ -47,4 +47,9 @@ cc_library_shared { | |||
47 | "libutils", | 47 | "libutils", |
48 | "libcutils", | 48 | "libcutils", |
49 | ], | 49 | ], |
50 | export_shared_lib_headers: [ | ||
51 | "libhidl", | ||
52 | "libhwbinder", | ||
53 | "libutils", | ||
54 | ], | ||
50 | } | 55 | } |
diff --git a/thermal/1.0/default/service.cpp b/thermal/1.0/default/service.cpp index b09b5ec4..ea86de43 100644 --- a/thermal/1.0/default/service.cpp +++ b/thermal/1.0/default/service.cpp | |||
@@ -14,40 +14,14 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <iostream> | ||
18 | #include <unistd.h> | ||
19 | |||
20 | #include <android/hardware/thermal/1.0/IThermal.h> | ||
21 | |||
22 | #include <hidl/IServiceManager.h> | ||
23 | #include <hwbinder/IPCThreadState.h> | ||
24 | #include <hwbinder/ProcessState.h> | ||
25 | #include <utils/Errors.h> | ||
26 | |||
27 | #define LOG_TAG "android.hardware.thermal@1.0-service" | 17 | #define LOG_TAG "android.hardware.thermal@1.0-service" |
28 | #include <utils/Log.h> | ||
29 | #include <utils/StrongPointer.h> | ||
30 | 18 | ||
31 | using android::sp; | 19 | #include <android/hardware/thermal/1.0/IThermal.h> |
32 | 20 | #include <hidl/LegacySupport.h> | |
33 | // libhwbinder: | ||
34 | using android::hardware::IPCThreadState; | ||
35 | using android::hardware::ProcessState; | ||
36 | 21 | ||
37 | // Generated HIDL files | ||
38 | using android::hardware::thermal::V1_0::IThermal; | 22 | using android::hardware::thermal::V1_0::IThermal; |
23 | using android::hardware::defaultPassthroughServiceImplementation; | ||
39 | 24 | ||
40 | int main() { | 25 | int main() { |
41 | const char instance[] = "thermal"; | 26 | return defaultPassthroughServiceImplementation<IThermal>("thermal"); |
42 | sp<IThermal> service = IThermal::getService(instance, true /* getStub */); | ||
43 | if (service.get() == nullptr) { | ||
44 | ALOGE("IThermal::getService returned NULL, exiting"); | ||
45 | return EXIT_FAILURE; | ||
46 | } | ||
47 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
48 | service->registerAsService(instance); | ||
49 | |||
50 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
51 | ProcessState::self()->startThreadPool(); | ||
52 | IPCThreadState::self()->joinThreadPool(); | ||
53 | } | 27 | } |
diff --git a/vibrator/1.0/default/service.cpp b/vibrator/1.0/default/service.cpp index a4a71329..064e1e2f 100644 --- a/vibrator/1.0/default/service.cpp +++ b/vibrator/1.0/default/service.cpp | |||
@@ -14,46 +14,13 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | #define LOG_TAG "android.hardware.vibrator@1.0-service" | 16 | #define LOG_TAG "android.hardware.vibrator@1.0-service" |
17 | #include <utils/Log.h> | ||
18 | |||
19 | #include <iostream> | ||
20 | #include <unistd.h> | ||
21 | 17 | ||
22 | #include <android/hardware/vibrator/1.0/IVibrator.h> | 18 | #include <android/hardware/vibrator/1.0/IVibrator.h> |
19 | #include <hidl/LegacySupport.h> | ||
23 | 20 | ||
24 | #include <hidl/IServiceManager.h> | ||
25 | #include <hwbinder/IPCThreadState.h> | ||
26 | #include <hwbinder/ProcessState.h> | ||
27 | #include <utils/Errors.h> | ||
28 | #include <utils/StrongPointer.h> | ||
29 | |||
30 | using android::sp; | ||
31 | |||
32 | // libhwbinder: | ||
33 | using android::hardware::IPCThreadState; | ||
34 | using android::hardware::ProcessState; | ||
35 | |||
36 | // Generated HIDL files | ||
37 | using android::hardware::vibrator::V1_0::IVibrator; | 21 | using android::hardware::vibrator::V1_0::IVibrator; |
22 | using android::hardware::defaultPassthroughServiceImplementation; | ||
38 | 23 | ||
39 | int main() { | 24 | int main() { |
40 | ALOGI("Service is starting."); | 25 | return defaultPassthroughServiceImplementation<IVibrator>("vibrator"); |
41 | const char instance[] = "vibrator"; | ||
42 | ALOGI("Retrieving default implementation of instance %s.", | ||
43 | instance); | ||
44 | android::sp<IVibrator> service = IVibrator::getService(instance, true); | ||
45 | if (service.get() == nullptr) { | ||
46 | ALOGE("IVibrator::getService returned NULL, exiting"); | ||
47 | return -1; | ||
48 | } | ||
49 | ALOGI("Default implementation using %s is %s", | ||
50 | instance, (service->isRemote() ? "REMOTE" : "LOCAL")); | ||
51 | LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); | ||
52 | ALOGI("Registering instance %s.", instance); | ||
53 | service->registerAsService(instance); | ||
54 | ALOGI("Ready."); | ||
55 | |||
56 | ProcessState::self()->setThreadPoolMaxThreadCount(0); | ||
57 | ProcessState::self()->startThreadPool(); | ||
58 | IPCThreadState::self()->joinThreadPool(); | ||
59 | } | 26 | } |
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp new file mode 100644 index 00000000..8fd00c5b --- /dev/null +++ b/vr/1.0/Android.bp | |||
@@ -0,0 +1,42 @@ | |||
1 | // This file is autogenerated by hidl-gen. Do not edit manually. | ||
2 | |||
3 | genrule { | ||
4 | name: "android.hardware.vr@1.0_genc++", | ||
5 | tool: "hidl-gen", | ||
6 | cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0", | ||
7 | srcs: [ | ||
8 | "IVr.hal", | ||
9 | ], | ||
10 | out: [ | ||
11 | "android/hardware/vr/1.0/VrAll.cpp", | ||
12 | ], | ||
13 | } | ||
14 | |||
15 | genrule { | ||
16 | name: "android.hardware.vr@1.0_genc++_headers", | ||
17 | tool: "hidl-gen", | ||
18 | cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0", | ||
19 | srcs: [ | ||
20 | "IVr.hal", | ||
21 | ], | ||
22 | out: [ | ||
23 | "android/hardware/vr/1.0/IVr.h", | ||
24 | "android/hardware/vr/1.0/IHwVr.h", | ||
25 | "android/hardware/vr/1.0/BnVr.h", | ||
26 | "android/hardware/vr/1.0/BpVr.h", | ||
27 | "android/hardware/vr/1.0/BsVr.h", | ||
28 | ], | ||
29 | } | ||
30 | |||
31 | cc_library_shared { | ||
32 | name: "android.hardware.vr@1.0", | ||
33 | generated_sources: ["android.hardware.vr@1.0_genc++"], | ||
34 | generated_headers: ["android.hardware.vr@1.0_genc++_headers"], | ||
35 | export_generated_headers: ["android.hardware.vr@1.0_genc++_headers"], | ||
36 | shared_libs: [ | ||
37 | "libhidl", | ||
38 | "libhwbinder", | ||
39 | "libutils", | ||
40 | "libcutils", | ||
41 | ], | ||
42 | } | ||
diff --git a/vr/1.0/IVr.hal b/vr/1.0/IVr.hal new file mode 100644 index 00000000..1f996e9e --- /dev/null +++ b/vr/1.0/IVr.hal | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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.vr@1.0; | ||
18 | |||
19 | interface IVr { | ||
20 | /** | ||
21 | * Convenience method to set up any state needed at runtime startup. This is | ||
22 | * called once from the VrManagerService during its boot phase. | ||
23 | */ | ||
24 | @callflow(next={"*"}) | ||
25 | @entry | ||
26 | @exit | ||
27 | init(); | ||
28 | |||
29 | /** | ||
30 | * Set the VR mode state. Possible states of the enabled parameter are: | ||
31 | * false - VR mode is disabled, turn off all VR-specific settings. | ||
32 | * true - VR mode is enabled, turn on all VR-specific settings. | ||
33 | * | ||
34 | * This must be called whenever the the Android system enters or leaves VR | ||
35 | * mode. This will typically occur when the user switches to or from a VR | ||
36 | * application that is doing stereoscopic rendering. | ||
37 | */ | ||
38 | @callflow(next={"*"}) | ||
39 | @exit | ||
40 | setVrMode(bool enabled); | ||
41 | }; | ||
diff --git a/vr/1.0/default/Android.bp b/vr/1.0/default/Android.bp new file mode 100644 index 00000000..09b00029 --- /dev/null +++ b/vr/1.0/default/Android.bp | |||
@@ -0,0 +1,16 @@ | |||
1 | cc_library_shared { | ||
2 | name: "android.hardware.vr@1.0-impl", | ||
3 | relative_install_path: "hw", | ||
4 | srcs: ["Vr.cpp"], | ||
5 | shared_libs: [ | ||
6 | "liblog", | ||
7 | "libcutils", | ||
8 | "libhardware", | ||
9 | "libhwbinder", | ||
10 | "libbase", | ||
11 | "libcutils", | ||
12 | "libutils", | ||
13 | "libhidl", | ||
14 | "android.hardware.vr@1.0", | ||
15 | ], | ||
16 | } | ||
diff --git a/vr/1.0/default/Vr.cpp b/vr/1.0/default/Vr.cpp new file mode 100644 index 00000000..4b2c6035 --- /dev/null +++ b/vr/1.0/default/Vr.cpp | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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 | #define LOG_TAG "VrService" | ||
18 | |||
19 | #include <hardware/hardware.h> | ||
20 | #include <hardware/vr.h> | ||
21 | #include "Vr.h" | ||
22 | |||
23 | namespace android { | ||
24 | namespace hardware { | ||
25 | namespace vr { | ||
26 | namespace V1_0 { | ||
27 | namespace implementation { | ||
28 | |||
29 | Vr::Vr(vr_module_t *device) : mDevice(device) {} | ||
30 | |||
31 | // Methods from ::android::hardware::vr::V1_0::IVr follow. | ||
32 | Return<void> Vr::init() { | ||
33 | mDevice->init(mDevice); | ||
34 | return Void(); | ||
35 | } | ||
36 | |||
37 | Return<void> Vr::setVrMode(bool enabled) { | ||
38 | mDevice->set_vr_mode(mDevice, enabled); | ||
39 | return Void(); | ||
40 | } | ||
41 | |||
42 | IVr* HIDL_FETCH_IVr(const char *name) { | ||
43 | vr_module_t *vr_module; | ||
44 | const hw_module_t *hw_module = NULL; | ||
45 | |||
46 | int ret = hw_get_module(name, &hw_module); | ||
47 | if (ret == 0) { | ||
48 | return new Vr(reinterpret_cast<vr_module_t*>( | ||
49 | const_cast<hw_module_t*>(hw_module))); | ||
50 | } else { | ||
51 | ALOGE("hw_get_module %s failed: %d", name, ret); | ||
52 | return nullptr; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | } // namespace implementation | ||
57 | } // namespace V1_0 | ||
58 | } // namespace vr | ||
59 | } // namespace hardware | ||
60 | } // namespace android | ||
diff --git a/vr/1.0/default/Vr.h b/vr/1.0/default/Vr.h new file mode 100644 index 00000000..90694d9a --- /dev/null +++ b/vr/1.0/default/Vr.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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 | #ifndef HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_ | ||
17 | #define HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_ | ||
18 | |||
19 | #include <android/hardware/vr/1.0/IVr.h> | ||
20 | #include <hardware/vr.h> | ||
21 | #include <hidl/MQDescriptor.h> | ||
22 | |||
23 | namespace android { | ||
24 | namespace hardware { | ||
25 | namespace vr { | ||
26 | namespace V1_0 { | ||
27 | namespace implementation { | ||
28 | |||
29 | using ::android::hardware::vr::V1_0::IVr; | ||
30 | using ::android::hardware::Return; | ||
31 | |||
32 | struct Vr : public IVr { | ||
33 | Vr(vr_module_t *device); | ||
34 | |||
35 | // Methods from ::android::hardware::vr::V1_0::IVr follow. | ||
36 | Return<void> init() override; | ||
37 | Return<void> setVrMode(bool enabled) override; | ||
38 | |||
39 | private: | ||
40 | vr_module_t *mDevice; | ||
41 | }; | ||
42 | |||
43 | extern "C" IVr* HIDL_FETCH_IVr(const char* name); | ||
44 | |||
45 | } // namespace implementation | ||
46 | } // namespace V1_0 | ||
47 | } // namespace vr | ||
48 | } // namespace hardware | ||
49 | } // namespace android | ||
50 | |||
51 | #endif // HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_ | ||
diff --git a/vr/1.0/default/android.hardware.vr@1.0-service.rc b/vr/1.0/default/android.hardware.vr@1.0-service.rc new file mode 100644 index 00000000..61770893 --- /dev/null +++ b/vr/1.0/default/android.hardware.vr@1.0-service.rc | |||
@@ -0,0 +1,4 @@ | |||
1 | service vr-1-0 /system/bin/hw/android.hardware.vr@1.0-service | ||
2 | class hal | ||
3 | user system | ||
4 | group system readproc | ||
diff --git a/vr/1.0/default/service.cpp b/vr/1.0/default/service.cpp new file mode 100644 index 00000000..c27ceafe --- /dev/null +++ b/vr/1.0/default/service.cpp | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 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 | #define LOG_TAG "android.hardware.vr@1.0-service" | ||
17 | |||
18 | #include <android/hardware/vr/1.0/IVr.h> | ||
19 | #include <hidl/LegacySupport.h> | ||
20 | |||
21 | // Generated HIDL files | ||
22 | using android::hardware::vr::V1_0::IVr; | ||
23 | using android::hardware::defaultPassthroughServiceImplementation; | ||
24 | |||
25 | int main() { | ||
26 | return defaultPassthroughServiceImplementation<IVr>("vr"); | ||
27 | } | ||
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp index 59ad2c59..504da7b3 100644 --- a/wifi/1.0/Android.bp +++ b/wifi/1.0/Android.bp | |||
@@ -115,4 +115,9 @@ cc_library_shared { | |||
115 | "libutils", | 115 | "libutils", |
116 | "libcutils", | 116 | "libcutils", |
117 | ], | 117 | ], |
118 | export_shared_lib_headers: [ | ||
119 | "libhidl", | ||
120 | "libhwbinder", | ||
121 | "libutils", | ||
122 | ], | ||
118 | } | 123 | } |
diff --git a/wifi/1.0/default/service.cpp b/wifi/1.0/default/service.cpp index 10ce1dba..751e8f6c 100644 --- a/wifi/1.0/default/service.cpp +++ b/wifi/1.0/default/service.cpp | |||
@@ -15,7 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <android-base/logging.h> | 17 | #include <android-base/logging.h> |
18 | #include <hidl/IServiceManager.h> | ||
19 | #include <hwbinder/IPCThreadState.h> | 18 | #include <hwbinder/IPCThreadState.h> |
20 | #include <hwbinder/ProcessState.h> | 19 | #include <hwbinder/ProcessState.h> |
21 | #include <utils/Looper.h> | 20 | #include <utils/Looper.h> |
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp index 6b4ca849..a60179d2 100644 --- a/wifi/supplicant/1.0/Android.bp +++ b/wifi/supplicant/1.0/Android.bp | |||
@@ -83,4 +83,9 @@ cc_library_shared { | |||
83 | "libutils", | 83 | "libutils", |
84 | "libcutils", | 84 | "libcutils", |
85 | ], | 85 | ], |
86 | export_shared_lib_headers: [ | ||
87 | "libhidl", | ||
88 | "libhwbinder", | ||
89 | "libutils", | ||
90 | ], | ||
86 | } | 91 | } |