blob: 40a7ff5dfb5e19a3ffee3595559f9eb2a3908a9a [file] [log] [blame]
Steven Moreland5d5ef7f2016-10-20 19:19:55 -07001/*
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 "ServiceManagement"
18
Jiyong Park3ab546c2017-04-06 20:28:07 +090019#include <android/dlext.h>
Yifan Hong9a22d1d2017-01-25 14:19:26 -080020#include <condition_variable>
21#include <dlfcn.h>
22#include <dirent.h>
Steven Moreland405d7612017-04-07 20:31:22 -070023#include <fstream>
24#include <pthread.h>
Yifan Hong9a22d1d2017-01-25 14:19:26 -080025#include <unistd.h>
26
27#include <mutex>
28#include <regex>
Yifan Hongbd0d8f72017-05-24 19:43:51 -070029#include <set>
Yifan Hong9a22d1d2017-01-25 14:19:26 -080030
Martijn Coenen12f04d92016-12-07 17:29:41 +010031#include <hidl/HidlBinderSupport.h>
Justin Yun1f048102017-12-01 15:30:08 +090032#include <hidl/HidlInternal.h>
Steven Morelande69e8d32018-03-14 10:55:42 -070033#include <hidl/HidlTransportUtils.h>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070034#include <hidl/ServiceManagement.h>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070035#include <hidl/Status.h>
Peter Kalauskas64ffced2018-09-05 16:41:08 -070036#include <utils/SystemClock.h>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070037
Peter Kalauskas64ffced2018-09-05 16:41:08 -070038#include <android-base/file.h>
Steven Moreland337e6b62017-01-18 17:25:13 -080039#include <android-base/logging.h>
Peter Kalauskas64ffced2018-09-05 16:41:08 -070040#include <android-base/parseint.h>
Steven Morelandc1cee2c2017-03-24 16:23:11 +000041#include <android-base/properties.h>
Justin Yun1f048102017-12-01 15:30:08 +090042#include <android-base/stringprintf.h>
Peter Kalauskas64ffced2018-09-05 16:41:08 -070043#include <android-base/strings.h>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070044#include <hwbinder/IPCThreadState.h>
45#include <hwbinder/Parcel.h>
Jerry Zhang86ae9992018-05-30 17:11:09 -070046#if !defined(__ANDROID_RECOVERY__)
Jiyong Parkba8ace12017-05-15 15:44:39 +090047#include <vndksupport/linker.h>
Jerry Zhang86ae9992018-05-30 17:11:09 -070048#endif
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070049
Steven Moreland89909692018-05-30 14:11:19 -070050#include <android/hidl/manager/1.2/BnHwServiceManager.h>
51#include <android/hidl/manager/1.2/BpHwServiceManager.h>
52#include <android/hidl/manager/1.2/IServiceManager.h>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070053
Yifan Hong9a22d1d2017-01-25 14:19:26 -080054#define RE_COMPONENT "[a-zA-Z_][a-zA-Z_0-9]*"
55#define RE_PATH RE_COMPONENT "(?:[.]" RE_COMPONENT ")*"
56static const std::regex gLibraryFileNamePattern("(" RE_PATH "@[0-9]+[.][0-9]+)-impl(.*?).so");
57
Steven Morelandc1cee2c2017-03-24 16:23:11 +000058using android::base::WaitForProperty;
59
Steven Morelandbb9eb2a2018-10-11 12:10:01 -070060using ::android::hidl::base::V1_0::IBase;
Steven Moreland2a2678e2017-07-21 18:07:38 -070061using IServiceManager1_0 = android::hidl::manager::V1_0::IServiceManager;
62using IServiceManager1_1 = android::hidl::manager::V1_1::IServiceManager;
Steven Moreland89909692018-05-30 14:11:19 -070063using IServiceManager1_2 = android::hidl::manager::V1_2::IServiceManager;
Steven Morelandbb9eb2a2018-10-11 12:10:01 -070064using ::android::hidl::manager::V1_0::IServiceNotification;
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070065
66namespace android {
67namespace hardware {
68
Steven Morelandc1cee2c2017-03-24 16:23:11 +000069static const char* kHwServicemanagerReadyProperty = "hwservicemanager.ready";
70
Yifan Hongdeacf142018-07-10 17:33:34 -070071#if defined(__ANDROID_RECOVERY__)
72static constexpr bool kIsRecovery = true;
73#else
74static constexpr bool kIsRecovery = false;
75#endif
76
Steven Morelandbb9eb2a2018-10-11 12:10:01 -070077static void waitForHwServiceManager() {
Steven Morelandc1cee2c2017-03-24 16:23:11 +000078 using std::literals::chrono_literals::operator""s;
79
80 while (!WaitForProperty(kHwServicemanagerReadyProperty, "true", 1s)) {
81 LOG(WARNING) << "Waited for hwservicemanager.ready for a second, waiting another...";
82 }
83}
84
Steven Morelandbb9eb2a2018-10-11 12:10:01 -070085static std::string binaryName() {
Steven Moreland405d7612017-04-07 20:31:22 -070086 std::ifstream ifs("/proc/self/cmdline");
87 std::string cmdline;
88 if (!ifs.is_open()) {
89 return "";
90 }
91 ifs >> cmdline;
92
Chih-Hung Hsieh41649d52017-08-03 14:27:21 -070093 size_t idx = cmdline.rfind('/');
Steven Moreland405d7612017-04-07 20:31:22 -070094 if (idx != std::string::npos) {
95 cmdline = cmdline.substr(idx + 1);
96 }
97
98 return cmdline;
99}
100
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700101static std::string packageWithoutVersion(const std::string& packageAndVersion) {
Steven Moreland7d09a402018-04-06 10:44:05 -0700102 size_t at = packageAndVersion.find('@');
103 if (at == std::string::npos) return packageAndVersion;
104 return packageAndVersion.substr(0, at);
105}
106
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700107static void tryShortenProcessName(const std::string& descriptor) {
Steven Moreland7d09a402018-04-06 10:44:05 -0700108 const static std::string kTasks = "/proc/self/task/";
109
110 // make sure that this binary name is in the same package
Steven Moreland405d7612017-04-07 20:31:22 -0700111 std::string processName = binaryName();
112
Steven Moreland7d09a402018-04-06 10:44:05 -0700113 // e.x. android.hardware.foo is this package
Steven Moreland8092aa02018-10-12 15:54:56 -0700114 if (!base::StartsWith(packageWithoutVersion(processName), packageWithoutVersion(descriptor))) {
Steven Moreland405d7612017-04-07 20:31:22 -0700115 return;
116 }
117
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700118 // e.x. android.hardware.module.foo@1.2::IFoo -> foo@1.2
119 size_t lastDot = descriptor.rfind('.');
Steven Moreland7d09a402018-04-06 10:44:05 -0700120 if (lastDot == std::string::npos) return;
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700121 size_t secondDot = descriptor.rfind('.', lastDot - 1);
Steven Moreland7d09a402018-04-06 10:44:05 -0700122 if (secondDot == std::string::npos) return;
Steven Moreland405d7612017-04-07 20:31:22 -0700123
Steven Moreland7d09a402018-04-06 10:44:05 -0700124 std::string newName = processName.substr(secondDot + 1, std::string::npos);
125 ALOGI("Removing namespace from process name %s to %s.", processName.c_str(), newName.c_str());
126
127 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(kTasks.c_str()), closedir);
128 if (dir == nullptr) return;
129
130 dirent* dp;
131 while ((dp = readdir(dir.get())) != nullptr) {
132 if (dp->d_type != DT_DIR) continue;
133 if (dp->d_name[0] == '.') continue;
134
135 std::fstream fs(kTasks + dp->d_name + "/comm");
136 if (!fs.is_open()) {
137 ALOGI("Could not rename process, failed read comm for %s.", dp->d_name);
138 continue;
139 }
140
141 std::string oldComm;
142 fs >> oldComm;
143
144 // don't rename if it already has an explicit name
Steven Moreland8092aa02018-10-12 15:54:56 -0700145 if (base::StartsWith(descriptor, oldComm)) {
Steven Moreland7d09a402018-04-06 10:44:05 -0700146 fs.seekg(0, fs.beg);
147 fs << newName;
148 }
Steven Moreland405d7612017-04-07 20:31:22 -0700149 }
Steven Moreland405d7612017-04-07 20:31:22 -0700150}
151
152namespace details {
153
Peter Kalauskas64ffced2018-09-05 16:41:08 -0700154/*
155 * Returns the age of the current process by reading /proc/self/stat and comparing starttime to the
156 * current time. This is useful for measuring how long it took a HAL to register itself.
157 */
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700158static long getProcessAgeMs() {
Peter Kalauskas64ffced2018-09-05 16:41:08 -0700159 constexpr const int PROCFS_STAT_STARTTIME_INDEX = 21;
160 std::string content;
161 android::base::ReadFileToString("/proc/self/stat", &content, false);
162 auto stats = android::base::Split(content, " ");
163 if (stats.size() <= PROCFS_STAT_STARTTIME_INDEX) {
164 LOG(INFO) << "Could not read starttime from /proc/self/stat";
165 return -1;
166 }
167 const std::string& startTimeString = stats[PROCFS_STAT_STARTTIME_INDEX];
168 static const int64_t ticksPerSecond = sysconf(_SC_CLK_TCK);
169 const int64_t uptime = android::uptimeMillis();
170
171 unsigned long long startTimeInClockTicks = 0;
172 if (android::base::ParseUint(startTimeString, &startTimeInClockTicks)) {
173 long startTimeMs = 1000ULL * startTimeInClockTicks / ticksPerSecond;
174 return uptime - startTimeMs;
175 }
176 return -1;
177}
178
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700179static void onRegistrationImpl(const std::string& descriptor, const std::string& instanceName) {
Peter Kalauskas64ffced2018-09-05 16:41:08 -0700180 long halStartDelay = getProcessAgeMs();
181 if (halStartDelay >= 0) {
182 // The "start delay" printed here is an estimate of how long it took the HAL to go from
183 // process creation to registering itself as a HAL. Actual start time could be longer
184 // because the process might not have joined the threadpool yet, so it might not be ready to
185 // process transactions.
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700186 LOG(INFO) << "Registered " << descriptor << "/" << instanceName << " (start delay of "
Peter Kalauskas64ffced2018-09-05 16:41:08 -0700187 << halStartDelay << "ms)";
188 }
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700189
190 tryShortenProcessName(descriptor);
191}
192
193void onRegistration(const std::string& packageName, const std::string& interfaceName,
194 const std::string& instanceName) {
195 return onRegistrationImpl(packageName + "::" + interfaceName, instanceName);
Steven Moreland405d7612017-04-07 20:31:22 -0700196}
197
198} // details
199
Steven Moreland2a2678e2017-07-21 18:07:38 -0700200sp<IServiceManager1_0> defaultServiceManager() {
Steven Moreland89909692018-05-30 14:11:19 -0700201 return defaultServiceManager1_2();
Steven Moreland2a2678e2017-07-21 18:07:38 -0700202}
203sp<IServiceManager1_1> defaultServiceManager1_1() {
Steven Moreland89909692018-05-30 14:11:19 -0700204 return defaultServiceManager1_2();
205}
206sp<IServiceManager1_2> defaultServiceManager1_2() {
207 using android::hidl::manager::V1_2::BnHwServiceManager;
208 using android::hidl::manager::V1_2::BpHwServiceManager;
209
210 static std::mutex gDefaultServiceManagerLock;
211 static sp<IServiceManager1_2> gDefaultServiceManager;
212
Steven Moreland5d5ef7f2016-10-20 19:19:55 -0700213 {
Steven Moreland89909692018-05-30 14:11:19 -0700214 std::lock_guard<std::mutex> _l(gDefaultServiceManagerLock);
215 if (gDefaultServiceManager != nullptr) {
216 return gDefaultServiceManager;
Yifan Hong8fb656b2017-03-16 14:30:40 -0700217 }
Steven Moreland405d7612017-04-07 20:31:22 -0700218
Yifan Hong8fb656b2017-03-16 14:30:40 -0700219 if (access("/dev/hwbinder", F_OK|R_OK|W_OK) != 0) {
220 // HwBinder not available on this device or not accessible to
221 // this process.
222 return nullptr;
223 }
Steven Morelandc1cee2c2017-03-24 16:23:11 +0000224
225 waitForHwServiceManager();
226
Steven Moreland89909692018-05-30 14:11:19 -0700227 while (gDefaultServiceManager == nullptr) {
228 gDefaultServiceManager =
229 fromBinder<IServiceManager1_2, BpHwServiceManager, BnHwServiceManager>(
230 ProcessState::self()->getContextObject(nullptr));
231 if (gDefaultServiceManager == nullptr) {
Steven Morelandc1cee2c2017-03-24 16:23:11 +0000232 LOG(ERROR) << "Waited for hwservicemanager, but got nullptr.";
Steven Moreland5d5ef7f2016-10-20 19:19:55 -0700233 sleep(1);
Yifan Hong8fb656b2017-03-16 14:30:40 -0700234 }
Steven Moreland5d5ef7f2016-10-20 19:19:55 -0700235 }
236 }
237
Steven Moreland89909692018-05-30 14:11:19 -0700238 return gDefaultServiceManager;
Steven Moreland5d5ef7f2016-10-20 19:19:55 -0700239}
240
Steven Moreland0091c092017-01-20 23:15:18 +0000241std::vector<std::string> search(const std::string &path,
242 const std::string &prefix,
243 const std::string &suffix) {
244 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir);
245 if (!dir) return {};
246
247 std::vector<std::string> results{};
248
249 dirent* dp;
250 while ((dp = readdir(dir.get())) != nullptr) {
251 std::string name = dp->d_name;
252
Steven Moreland8092aa02018-10-12 15:54:56 -0700253 if (base::StartsWith(name, prefix) && base::EndsWith(name, suffix)) {
Steven Moreland0091c092017-01-20 23:15:18 +0000254 results.push_back(name);
255 }
256 }
257
258 return results;
259}
260
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700261bool matchPackageName(const std::string& lib, std::string* matchedName, std::string* implName) {
Yifan Hong9a22d1d2017-01-25 14:19:26 -0800262 std::smatch match;
263 if (std::regex_match(lib, match, gLibraryFileNamePattern)) {
264 *matchedName = match.str(1) + "::I*";
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700265 *implName = match.str(2);
Yifan Hong9a22d1d2017-01-25 14:19:26 -0800266 return true;
267 }
268 return false;
269}
270
Yifan Hong7f49f592017-02-03 15:11:44 -0800271static void registerReference(const hidl_string &interfaceName, const hidl_string &instanceName) {
Yifan Hongdeacf142018-07-10 17:33:34 -0700272 if (kIsRecovery) {
273 // No hwservicemanager in recovery.
274 return;
275 }
276
Steven Moreland2a2678e2017-07-21 18:07:38 -0700277 sp<IServiceManager1_0> binderizedManager = defaultServiceManager();
Yifan Hong7f49f592017-02-03 15:11:44 -0800278 if (binderizedManager == nullptr) {
279 LOG(WARNING) << "Could not registerReference for "
280 << interfaceName << "/" << instanceName
281 << ": null binderized manager.";
282 return;
283 }
Martijn Coenenaf4aba52017-04-27 09:41:13 -0700284 auto ret = binderizedManager->registerPassthroughClient(interfaceName, instanceName);
Yifan Hong7f49f592017-02-03 15:11:44 -0800285 if (!ret.isOk()) {
286 LOG(WARNING) << "Could not registerReference for "
287 << interfaceName << "/" << instanceName
288 << ": " << ret.description();
Steven Moreland0aeaa782017-03-22 08:11:07 -0700289 return;
Yifan Hong7f49f592017-02-03 15:11:44 -0800290 }
Steven Morelande681aa52017-02-15 16:22:37 -0800291 LOG(VERBOSE) << "Successfully registerReference for "
292 << interfaceName << "/" << instanceName;
Yifan Hong7f49f592017-02-03 15:11:44 -0800293}
294
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700295using InstanceDebugInfo = hidl::manager::V1_0::IServiceManager::InstanceDebugInfo;
296static inline void fetchPidsForPassthroughLibraries(
297 std::map<std::string, InstanceDebugInfo>* infos) {
298 static const std::string proc = "/proc/";
299
300 std::map<std::string, std::set<pid_t>> pids;
301 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(proc.c_str()), closedir);
302 if (!dir) return;
303 dirent* dp;
304 while ((dp = readdir(dir.get())) != nullptr) {
Stephen Hinesfd9ecee2017-09-27 18:52:52 -0700305 pid_t pid = strtoll(dp->d_name, nullptr, 0);
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700306 if (pid == 0) continue;
307 std::string mapsPath = proc + dp->d_name + "/maps";
308 std::ifstream ifs{mapsPath};
309 if (!ifs.is_open()) continue;
310
311 for (std::string line; std::getline(ifs, line);) {
312 // The last token of line should look like
313 // vendor/lib64/hw/android.hardware.foo@1.0-impl-extra.so
314 // Use some simple filters to ignore bad lines before extracting libFileName
315 // and checking the key in info to make parsing faster.
316 if (line.back() != 'o') continue;
317 if (line.rfind('@') == std::string::npos) continue;
318
319 auto spacePos = line.rfind(' ');
320 if (spacePos == std::string::npos) continue;
321 auto libFileName = line.substr(spacePos + 1);
322 auto it = infos->find(libFileName);
323 if (it == infos->end()) continue;
324 pids[libFileName].insert(pid);
325 }
326 }
327 for (auto& pair : *infos) {
328 pair.second.clientPids =
329 std::vector<pid_t>{pids[pair.first].begin(), pids[pair.first].end()};
330 }
331}
332
Steven Moreland2a2678e2017-07-21 18:07:38 -0700333struct PassthroughServiceManager : IServiceManager1_1 {
Chih-Hung Hsieh41649d52017-08-03 14:27:21 -0700334 static void openLibs(
335 const std::string& fqName,
336 const std::function<bool /* continue */ (void* /* handle */, const std::string& /* lib */,
337 const std::string& /* sym */)>& eachLib) {
Steven Moreland819c05d2017-04-06 17:24:22 -0700338 //fqName looks like android.hardware.foo@1.0::IFoo
Steven Moreland519306f2017-06-06 17:14:12 -0700339 size_t idx = fqName.find("::");
Steven Moreland819c05d2017-04-06 17:24:22 -0700340
341 if (idx == std::string::npos ||
Steven Moreland519306f2017-06-06 17:14:12 -0700342 idx + strlen("::") + 1 >= fqName.size()) {
Steven Moreland337e6b62017-01-18 17:25:13 -0800343 LOG(ERROR) << "Invalid interface name passthrough lookup: " << fqName;
Steven Moreland519306f2017-06-06 17:14:12 -0700344 return;
Steven Moreland337e6b62017-01-18 17:25:13 -0800345 }
346
Steven Moreland519306f2017-06-06 17:14:12 -0700347 std::string packageAndVersion = fqName.substr(0, idx);
348 std::string ifaceName = fqName.substr(idx + strlen("::"));
Steven Moreland819c05d2017-04-06 17:24:22 -0700349
350 const std::string prefix = packageAndVersion + "-impl";
351 const std::string sym = "HIDL_FETCH_" + ifaceName;
Steven Moreland348802d2017-02-23 12:48:55 -0800352
Steven Moreland77f4c852017-10-12 11:05:53 -0700353 constexpr int dlMode = RTLD_LAZY;
354 void* handle = nullptr;
Steven Moreland337e6b62017-01-18 17:25:13 -0800355
Steven Morelanda29905c2017-03-01 10:42:35 -0800356 dlerror(); // clear
357
Justin Yun1f048102017-12-01 15:30:08 +0900358 static std::string halLibPathVndkSp = android::base::StringPrintf(
359 HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION, details::getVndkVersionStr().c_str());
Justin Yun6a323ed2018-10-18 18:41:56 +0900360 std::vector<std::string> paths = {
361 HAL_LIBRARY_PATH_ODM, HAL_LIBRARY_PATH_VENDOR, halLibPathVndkSp,
362#ifndef __ANDROID_VNDK__
363 HAL_LIBRARY_PATH_SYSTEM,
364#endif
365 };
Steven Moreland77f4c852017-10-12 11:05:53 -0700366
Steven Morelandf7dea692017-07-14 12:49:28 -0700367#ifdef LIBHIDL_TARGET_DEBUGGABLE
368 const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
369 const bool trebleTestingOverride = env && !strcmp(env, "true");
370 if (trebleTestingOverride) {
Steven Moreland77f4c852017-10-12 11:05:53 -0700371 // Load HAL implementations that are statically linked
372 handle = dlopen(nullptr, dlMode);
373 if (handle == nullptr) {
374 const char* error = dlerror();
375 LOG(ERROR) << "Failed to dlopen self: "
376 << (error == nullptr ? "unknown error" : error);
377 } else if (!eachLib(handle, "SELF", sym)) {
378 return;
379 }
380
Steven Morelandf7dea692017-07-14 12:49:28 -0700381 const char* vtsRootPath = std::getenv("VTS_ROOT_PATH");
382 if (vtsRootPath && strlen(vtsRootPath) > 0) {
383 const std::string halLibraryPathVtsOverride =
384 std::string(vtsRootPath) + HAL_LIBRARY_PATH_SYSTEM;
Steven Moreland77f4c852017-10-12 11:05:53 -0700385 paths.insert(paths.begin(), halLibraryPathVtsOverride);
Steven Morelandf7dea692017-07-14 12:49:28 -0700386 }
387 }
388#endif
Steven Moreland77f4c852017-10-12 11:05:53 -0700389
Steven Morelandf7dea692017-07-14 12:49:28 -0700390 for (const std::string& path : paths) {
Steven Moreland0091c092017-01-20 23:15:18 +0000391 std::vector<std::string> libs = search(path, prefix, ".so");
392
Steven Moreland0091c092017-01-20 23:15:18 +0000393 for (const std::string &lib : libs) {
Steven Moreland348802d2017-02-23 12:48:55 -0800394 const std::string fullPath = path + lib;
395
Yifan Hongdeacf142018-07-10 17:33:34 -0700396 if (kIsRecovery || path == HAL_LIBRARY_PATH_SYSTEM) {
Jiyong Park3ab546c2017-04-06 20:28:07 +0900397 handle = dlopen(fullPath.c_str(), dlMode);
Steven Moreland65c00cb2017-10-12 11:35:22 -0700398 } else {
Jerry Zhang86ae9992018-05-30 17:11:09 -0700399#if !defined(__ANDROID_RECOVERY__)
Steven Moreland65c00cb2017-10-12 11:35:22 -0700400 handle = android_load_sphal_library(fullPath.c_str(), dlMode);
Jerry Zhang86ae9992018-05-30 17:11:09 -0700401#endif
Jiyong Park3ab546c2017-04-06 20:28:07 +0900402 }
403
Steven Moreland348802d2017-02-23 12:48:55 -0800404 if (handle == nullptr) {
405 const char* error = dlerror();
406 LOG(ERROR) << "Failed to dlopen " << lib << ": "
407 << (error == nullptr ? "unknown error" : error);
408 continue;
Steven Moreland0091c092017-01-20 23:15:18 +0000409 }
Steven Moreland348802d2017-02-23 12:48:55 -0800410
Steven Moreland519306f2017-06-06 17:14:12 -0700411 if (!eachLib(handle, lib, sym)) {
412 return;
Steven Moreland348802d2017-02-23 12:48:55 -0800413 }
Steven Moreland337e6b62017-01-18 17:25:13 -0800414 }
415 }
Steven Moreland519306f2017-06-06 17:14:12 -0700416 }
Steven Moreland337e6b62017-01-18 17:25:13 -0800417
Steven Moreland519306f2017-06-06 17:14:12 -0700418 Return<sp<IBase>> get(const hidl_string& fqName,
419 const hidl_string& name) override {
420 sp<IBase> ret = nullptr;
421
422 openLibs(fqName, [&](void* handle, const std::string &lib, const std::string &sym) {
423 IBase* (*generator)(const char* name);
424 *(void **)(&generator) = dlsym(handle, sym.c_str());
425 if(!generator) {
426 const char* error = dlerror();
427 LOG(ERROR) << "Passthrough lookup opened " << lib
428 << " but could not find symbol " << sym << ": "
429 << (error == nullptr ? "unknown error" : error);
430 dlclose(handle);
431 return true;
432 }
433
434 ret = (*generator)(name.c_str());
435
436 if (ret == nullptr) {
437 dlclose(handle);
438 return true; // this module doesn't provide this instance name
439 }
440
Steven Morelande69e8d32018-03-14 10:55:42 -0700441 // Actual fqname might be a subclass.
442 // This assumption is tested in vts_treble_vintf_test
443 using ::android::hardware::details::getDescriptor;
444 std::string actualFqName = getDescriptor(ret.get());
445 CHECK(actualFqName.size() > 0);
446 registerReference(actualFqName, name);
Steven Moreland519306f2017-06-06 17:14:12 -0700447 return false;
448 });
449
450 return ret;
Steven Moreland337e6b62017-01-18 17:25:13 -0800451 }
452
Martijn Coenen67a02492017-03-06 13:04:48 +0100453 Return<bool> add(const hidl_string& /* name */,
Steven Moreland337e6b62017-01-18 17:25:13 -0800454 const sp<IBase>& /* service */) override {
455 LOG(FATAL) << "Cannot register services with passthrough service manager.";
456 return false;
457 }
458
Steven Morelandc601c5f2017-04-06 09:26:07 -0700459 Return<Transport> getTransport(const hidl_string& /* fqName */,
460 const hidl_string& /* name */) {
461 LOG(FATAL) << "Cannot getTransport with passthrough service manager.";
462 return Transport::EMPTY;
463 }
464
Yifan Hong705e5da2017-03-02 16:59:39 -0800465 Return<void> list(list_cb /* _hidl_cb */) override {
466 LOG(FATAL) << "Cannot list services with passthrough service manager.";
Steven Moreland337e6b62017-01-18 17:25:13 -0800467 return Void();
468 }
469 Return<void> listByInterface(const hidl_string& /* fqInstanceName */,
470 listByInterface_cb /* _hidl_cb */) override {
471 // TODO: add this functionality
472 LOG(FATAL) << "Cannot list services with passthrough service manager.";
473 return Void();
474 }
475
476 Return<bool> registerForNotifications(const hidl_string& /* fqName */,
477 const hidl_string& /* name */,
478 const sp<IServiceNotification>& /* callback */) override {
479 // This makes no sense.
480 LOG(FATAL) << "Cannot register for notifications with passthrough service manager.";
481 return false;
482 }
483
Yifan Hong705e5da2017-03-02 16:59:39 -0800484 Return<void> debugDump(debugDump_cb _hidl_cb) override {
485 using Arch = ::android::hidl::base::V1_0::DebugInfo::Architecture;
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700486 using std::literals::string_literals::operator""s;
Justin Yun1f048102017-12-01 15:30:08 +0900487 static std::string halLibPathVndkSp64 = android::base::StringPrintf(
488 HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION, details::getVndkVersionStr().c_str());
489 static std::string halLibPathVndkSp32 = android::base::StringPrintf(
490 HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION, details::getVndkVersionStr().c_str());
Jiyong Park56eb1492017-08-04 16:16:13 +0900491 static std::vector<std::pair<Arch, std::vector<const char*>>> sAllPaths{
492 {Arch::IS_64BIT,
Justin Yun6a323ed2018-10-18 18:41:56 +0900493 {
494 HAL_LIBRARY_PATH_ODM_64BIT, HAL_LIBRARY_PATH_VENDOR_64BIT,
495 halLibPathVndkSp64.c_str(),
496#ifndef __ANDROID_VNDK__
497 HAL_LIBRARY_PATH_SYSTEM_64BIT,
498#endif
499 }},
Jiyong Park56eb1492017-08-04 16:16:13 +0900500 {Arch::IS_32BIT,
Justin Yun6a323ed2018-10-18 18:41:56 +0900501 {
502 HAL_LIBRARY_PATH_ODM_32BIT, HAL_LIBRARY_PATH_VENDOR_32BIT,
503 halLibPathVndkSp32.c_str(),
504#ifndef __ANDROID_VNDK__
505 HAL_LIBRARY_PATH_SYSTEM_32BIT,
506#endif
507 }}};
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700508 std::map<std::string, InstanceDebugInfo> map;
Yifan Hong705e5da2017-03-02 16:59:39 -0800509 for (const auto &pair : sAllPaths) {
510 Arch arch = pair.first;
511 for (const auto &path : pair.second) {
512 std::vector<std::string> libs = search(path, "", ".so");
513 for (const std::string &lib : libs) {
514 std::string matchedName;
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700515 std::string implName;
516 if (matchPackageName(lib, &matchedName, &implName)) {
517 std::string instanceName{"* ("s + path + ")"s};
518 if (!implName.empty()) instanceName += " ("s + implName + ")"s;
519 map.emplace(path + lib, InstanceDebugInfo{.interfaceName = matchedName,
520 .instanceName = instanceName,
521 .clientPids = {},
522 .arch = arch});
Yifan Hong705e5da2017-03-02 16:59:39 -0800523 }
524 }
525 }
526 }
Yifan Hongbd0d8f72017-05-24 19:43:51 -0700527 fetchPidsForPassthroughLibraries(&map);
528 hidl_vec<InstanceDebugInfo> vec;
529 vec.resize(map.size());
530 size_t idx = 0;
531 for (auto&& pair : map) {
532 vec[idx++] = std::move(pair.second);
533 }
Yifan Hong705e5da2017-03-02 16:59:39 -0800534 _hidl_cb(vec);
Yifan Hong7f49f592017-02-03 15:11:44 -0800535 return Void();
536 }
537
Martijn Coenenaf4aba52017-04-27 09:41:13 -0700538 Return<void> registerPassthroughClient(const hidl_string &, const hidl_string &) override {
Yifan Hong7f49f592017-02-03 15:11:44 -0800539 // This makes no sense.
540 LOG(FATAL) << "Cannot call registerPassthroughClient on passthrough service manager. "
541 << "Call it on defaultServiceManager() instead.";
Yifan Hong9a22d1d2017-01-25 14:19:26 -0800542 return Void();
543 }
544
Steven Moreland2a2678e2017-07-21 18:07:38 -0700545 Return<bool> unregisterForNotifications(const hidl_string& /* fqName */,
546 const hidl_string& /* name */,
547 const sp<IServiceNotification>& /* callback */) override {
548 // This makes no sense.
549 LOG(FATAL) << "Cannot unregister for notifications with passthrough service manager.";
550 return false;
551 }
552
Steven Moreland337e6b62017-01-18 17:25:13 -0800553};
554
Steven Moreland2a2678e2017-07-21 18:07:38 -0700555sp<IServiceManager1_0> getPassthroughServiceManager() {
556 return getPassthroughServiceManager1_1();
557}
558sp<IServiceManager1_1> getPassthroughServiceManager1_1() {
Steven Moreland337e6b62017-01-18 17:25:13 -0800559 static sp<PassthroughServiceManager> manager(new PassthroughServiceManager());
560 return manager;
561}
562
Steven Morelandcbefd352017-01-23 20:29:05 -0800563namespace details {
564
Steven Moreland519306f2017-06-06 17:14:12 -0700565void preloadPassthroughService(const std::string &descriptor) {
566 PassthroughServiceManager::openLibs(descriptor,
567 [&](void* /* handle */, const std::string& /* lib */, const std::string& /* sym */) {
568 // do nothing
569 return true; // open all libs
570 });
571}
572
Steven Morelandcbefd352017-01-23 20:29:05 -0800573struct Waiter : IServiceNotification {
Martijn Coenen773609e2017-10-24 09:57:53 +0200574 Waiter(const std::string& interface, const std::string& instanceName,
575 const sp<IServiceManager1_1>& sm) : mInterfaceName(interface),
576 mInstanceName(instanceName), mSm(sm) {
Martijn Coenene6cdfd32017-11-13 14:03:05 +0100577 }
578
579 void onFirstRef() override {
Martijn Coenenb88ae7f2017-10-24 11:45:41 +0200580 // If this process only has one binder thread, and we're calling wait() from
581 // that thread, it will block forever because we hung up the one and only
582 // binder thread on a condition variable that can only be notified by an
583 // incoming binder call.
Tobias Lindskog88e886f2018-01-05 10:32:43 +0100584 if (IPCThreadState::self()->isOnlyBinderThread()) {
Martijn Coenenb88ae7f2017-10-24 11:45:41 +0200585 LOG(WARNING) << "Can't efficiently wait for " << mInterfaceName << "/"
586 << mInstanceName << ", because we are called from "
587 << "the only binder thread in this process.";
588 return;
589 }
590
Martijn Coenene6cdfd32017-11-13 14:03:05 +0100591 Return<bool> ret = mSm->registerForNotifications(mInterfaceName, mInstanceName, this);
Martijn Coenen773609e2017-10-24 09:57:53 +0200592
593 if (!ret.isOk()) {
594 LOG(ERROR) << "Transport error, " << ret.description()
Martijn Coenene6cdfd32017-11-13 14:03:05 +0100595 << ", during notification registration for " << mInterfaceName << "/"
596 << mInstanceName << ".";
Martijn Coenen773609e2017-10-24 09:57:53 +0200597 return;
598 }
599
600 if (!ret) {
Martijn Coenene6cdfd32017-11-13 14:03:05 +0100601 LOG(ERROR) << "Could not register for notifications for " << mInterfaceName << "/"
602 << mInstanceName << ".";
Martijn Coenen773609e2017-10-24 09:57:53 +0200603 return;
604 }
605
606 mRegisteredForNotifications = true;
607 }
608
609 ~Waiter() {
Martijn Coenen3fa15c22018-02-10 11:30:00 +0100610 if (!mDoneCalled) {
611 LOG(FATAL)
612 << "Waiter still registered for notifications, call done() before dropping ref!";
Martijn Coenen773609e2017-10-24 09:57:53 +0200613 }
614 }
615
Steven Morelandcbefd352017-01-23 20:29:05 -0800616 Return<void> onRegistration(const hidl_string& /* fqName */,
617 const hidl_string& /* name */,
618 bool /* preexisting */) override {
619 std::unique_lock<std::mutex> lock(mMutex);
620 if (mRegistered) {
621 return Void();
622 }
623 mRegistered = true;
624 lock.unlock();
625
626 mCondition.notify_one();
627 return Void();
628 }
629
Steven Moreland0771d8a2018-05-09 13:29:14 -0700630 void wait(bool timeout) {
Steven Moreland49605102017-03-28 09:33:06 -0700631 using std::literals::chrono_literals::operator""s;
632
Martijn Coenen773609e2017-10-24 09:57:53 +0200633 if (!mRegisteredForNotifications) {
634 // As an alternative, just sleep for a second and return
635 LOG(WARNING) << "Waiting one second for " << mInterfaceName << "/" << mInstanceName;
636 sleep(1);
637 return;
638 }
639
Steven Morelandcbefd352017-01-23 20:29:05 -0800640 std::unique_lock<std::mutex> lock(mMutex);
Steven Moreland0771d8a2018-05-09 13:29:14 -0700641 do {
Steven Moreland49605102017-03-28 09:33:06 -0700642 mCondition.wait_for(lock, 1s, [this]{
643 return mRegistered;
644 });
645
646 if (mRegistered) {
647 break;
648 }
649
Steven Moreland0771d8a2018-05-09 13:29:14 -0700650 LOG(WARNING) << "Waited one second for " << mInterfaceName << "/" << mInstanceName;
651 } while (!timeout);
Steven Morelandcbefd352017-01-23 20:29:05 -0800652 }
653
Martijn Coenen773609e2017-10-24 09:57:53 +0200654 // Be careful when using this; after calling reset(), you must always try to retrieve
655 // the corresponding service before blocking on the waiter; otherwise, you might run
656 // into a race-condition where the service has just (re-)registered, you clear the state
657 // here, and subsequently calling waiter->wait() will block forever.
658 void reset() {
659 std::unique_lock<std::mutex> lock(mMutex);
660 mRegistered = false;
661 }
Martijn Coenen3fa15c22018-02-10 11:30:00 +0100662
663 // done() must be called before dropping the last strong ref to the Waiter, to make
664 // sure we can properly unregister with hwservicemanager.
665 void done() {
666 if (mRegisteredForNotifications) {
667 if (!mSm->unregisterForNotifications(mInterfaceName, mInstanceName, this)
668 .withDefault(false)) {
669 LOG(ERROR) << "Could not unregister service notification for " << mInterfaceName
670 << "/" << mInstanceName << ".";
671 } else {
672 mRegisteredForNotifications = false;
673 }
674 }
675 mDoneCalled = true;
676 }
677
678 private:
Martijn Coenen773609e2017-10-24 09:57:53 +0200679 const std::string mInterfaceName;
680 const std::string mInstanceName;
Steven Morelandad1f9922018-10-02 19:37:05 -0700681 sp<IServiceManager1_1> mSm;
Steven Morelandcbefd352017-01-23 20:29:05 -0800682 std::mutex mMutex;
683 std::condition_variable mCondition;
684 bool mRegistered = false;
Martijn Coenen773609e2017-10-24 09:57:53 +0200685 bool mRegisteredForNotifications = false;
Martijn Coenen3fa15c22018-02-10 11:30:00 +0100686 bool mDoneCalled = false;
Steven Morelandcbefd352017-01-23 20:29:05 -0800687};
688
689void waitForHwService(
690 const std::string &interface, const std::string &instanceName) {
Martijn Coenen773609e2017-10-24 09:57:53 +0200691 sp<Waiter> waiter = new Waiter(interface, instanceName, defaultServiceManager1_1());
Steven Moreland0771d8a2018-05-09 13:29:14 -0700692 waiter->wait(false /* timeout */);
Martijn Coenen3fa15c22018-02-10 11:30:00 +0100693 waiter->done();
Martijn Coenen773609e2017-10-24 09:57:53 +0200694}
Steven Morelandcbefd352017-01-23 20:29:05 -0800695
Martijn Coenen773609e2017-10-24 09:57:53 +0200696// Prints relevant error/warning messages for error return values from
697// details::canCastInterface(), both transaction errors (!castReturn.isOk())
698// as well as actual cast failures (castReturn.isOk() && castReturn = false).
699// Returns 'true' if the error is non-fatal and it's useful to retry
700bool handleCastError(const Return<bool>& castReturn, const std::string& descriptor,
701 const std::string& instance) {
702 if (castReturn.isOk()) {
703 if (castReturn) {
704 details::logAlwaysFatal("Successful cast value passed into handleCastError.");
705 }
706 // This should never happen, and there's not really a point in retrying.
707 ALOGE("getService: received incompatible service (bug in hwservicemanager?) for "
708 "%s/%s.", descriptor.c_str(), instance.c_str());
709 return false;
Steven Morelandcbefd352017-01-23 20:29:05 -0800710 }
Martijn Coenen773609e2017-10-24 09:57:53 +0200711 if (castReturn.isDeadObject()) {
712 ALOGW("getService: found dead hwbinder service for %s/%s.", descriptor.c_str(),
713 instance.c_str());
714 return true;
Steven Morelandcbefd352017-01-23 20:29:05 -0800715 }
Martijn Coenen773609e2017-10-24 09:57:53 +0200716 // This can happen due to:
717 // 1) No SELinux permissions
718 // 2) Other transaction failure (no buffer space, kernel error)
719 // The first isn't recoverable, but the second is.
720 // Since we can't yet differentiate between the two, and clients depend
721 // on us not blocking in case 1), treat this as a fatal error for now.
722 ALOGW("getService: unable to call into hwbinder service for %s/%s.",
723 descriptor.c_str(), instance.c_str());
724 return false;
Steven Morelandcbefd352017-01-23 20:29:05 -0800725}
726
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200727sp<::android::hidl::base::V1_0::IBase> getRawServiceInternal(const std::string& descriptor,
728 const std::string& instance,
729 bool retry, bool getStub) {
730 using Transport = ::android::hidl::manager::V1_0::IServiceManager::Transport;
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200731 using ::android::hidl::manager::V1_0::IServiceManager;
Martijn Coenend35678f2018-03-07 09:51:01 +0100732 sp<Waiter> waiter;
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200733
Yifan Hongdeacf142018-07-10 17:33:34 -0700734 sp<IServiceManager1_1> sm;
735 Transport transport = Transport::EMPTY;
736 if (kIsRecovery) {
Yifan Hongdeacf142018-07-10 17:33:34 -0700737 transport = Transport::PASSTHROUGH;
Yifan Hongdeacf142018-07-10 17:33:34 -0700738 } else {
739 sm = defaultServiceManager1_1();
740 if (sm == nullptr) {
741 ALOGE("getService: defaultServiceManager() is null");
742 return nullptr;
743 }
744
745 Return<Transport> transportRet = sm->getTransport(descriptor, instance);
746
747 if (!transportRet.isOk()) {
748 ALOGE("getService: defaultServiceManager()->getTransport returns %s",
749 transportRet.description().c_str());
750 return nullptr;
751 }
752 transport = transportRet;
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200753 }
754
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200755 const bool vintfHwbinder = (transport == Transport::HWBINDER);
756 const bool vintfPassthru = (transport == Transport::PASSTHROUGH);
757
Steven Moreland757394b2017-12-13 14:09:24 -0800758#ifdef ENFORCE_VINTF_MANIFEST
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200759
760#ifdef LIBHIDL_TARGET_DEBUGGABLE
761 const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
762 const bool trebleTestingOverride = env && !strcmp(env, "true");
763 const bool vintfLegacy = (transport == Transport::EMPTY) && trebleTestingOverride;
Steven Moreland757394b2017-12-13 14:09:24 -0800764#else // ENFORCE_VINTF_MANIFEST but not LIBHIDL_TARGET_DEBUGGABLE
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200765 const bool trebleTestingOverride = false;
766 const bool vintfLegacy = false;
767#endif // LIBHIDL_TARGET_DEBUGGABLE
768
Steven Moreland757394b2017-12-13 14:09:24 -0800769#else // not ENFORCE_VINTF_MANIFEST
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200770 const char* env = std::getenv("TREBLE_TESTING_OVERRIDE");
771 const bool trebleTestingOverride = env && !strcmp(env, "true");
772 const bool vintfLegacy = (transport == Transport::EMPTY);
Steven Moreland757394b2017-12-13 14:09:24 -0800773#endif // ENFORCE_VINTF_MANIFEST
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200774
Steven Moreland76371242018-04-19 17:11:39 -0700775 for (int tries = 0; !getStub && (vintfHwbinder || vintfLegacy); tries++) {
776 if (waiter == nullptr && tries > 0) {
Martijn Coenend35678f2018-03-07 09:51:01 +0100777 waiter = new Waiter(descriptor, instance, sm);
778 }
Steven Moreland76371242018-04-19 17:11:39 -0700779 if (waiter != nullptr) {
780 waiter->reset(); // don't reorder this -- see comments on reset()
781 }
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200782 Return<sp<IBase>> ret = sm->get(descriptor, instance);
783 if (!ret.isOk()) {
784 ALOGE("getService: defaultServiceManager()->get returns %s for %s/%s.",
785 ret.description().c_str(), descriptor.c_str(), instance.c_str());
786 break;
787 }
788 sp<IBase> base = ret;
Martijn Coenen773609e2017-10-24 09:57:53 +0200789 if (base != nullptr) {
790 Return<bool> canCastRet =
791 details::canCastInterface(base.get(), descriptor.c_str(), true /* emitError */);
792
793 if (canCastRet.isOk() && canCastRet) {
Steven Moreland76371242018-04-19 17:11:39 -0700794 if (waiter != nullptr) {
795 waiter->done();
796 }
Martijn Coenen773609e2017-10-24 09:57:53 +0200797 return base; // still needs to be wrapped by Bp class.
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200798 }
Martijn Coenen773609e2017-10-24 09:57:53 +0200799
800 if (!handleCastError(canCastRet, descriptor, instance)) break;
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200801 }
802
Martijn Coenen773609e2017-10-24 09:57:53 +0200803 // In case of legacy or we were not asked to retry, don't.
804 if (vintfLegacy || !retry) break;
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200805
Steven Moreland76371242018-04-19 17:11:39 -0700806 if (waiter != nullptr) {
807 ALOGI("getService: Trying again for %s/%s...", descriptor.c_str(), instance.c_str());
Steven Moreland0771d8a2018-05-09 13:29:14 -0700808 waiter->wait(true /* timeout */);
Steven Moreland76371242018-04-19 17:11:39 -0700809 }
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200810 }
811
Martijn Coenend35678f2018-03-07 09:51:01 +0100812 if (waiter != nullptr) {
813 waiter->done();
814 }
Martijn Coenen3fa15c22018-02-10 11:30:00 +0100815
Martijn Coenen86c3abb2017-10-24 09:33:28 +0200816 if (getStub || vintfPassthru || vintfLegacy) {
817 const sp<IServiceManager> pm = getPassthroughServiceManager();
818 if (pm != nullptr) {
819 sp<IBase> base = pm->get(descriptor, instance).withDefault(nullptr);
820 if (!getStub || trebleTestingOverride) {
821 base = wrapPassthrough(base);
822 }
823 return base;
824 }
825 }
826
827 return nullptr;
828}
829
Steven Morelandbb9eb2a2018-10-11 12:10:01 -0700830status_t registerAsServiceInternal(const sp<IBase>& service, const std::string& name) {
831 if (service == nullptr) {
832 return UNEXPECTED_NULL;
833 }
834
835 sp<IServiceManager1_2> sm = defaultServiceManager1_2();
836 if (sm == nullptr) {
837 return INVALID_OPERATION;
838 }
839
840 bool registered = false;
841 Return<void> ret = service->interfaceChain([&](const auto& chain) {
842 registered = sm->addWithChain(name.c_str(), service, chain).withDefault(false);
843 });
844
845 if (!ret.isOk()) {
846 LOG(ERROR) << "Could not retrieve interface chain: " << ret.description();
847 }
848
849 if (registered) {
850 onRegistrationImpl(getDescriptor(service.get()), name);
851 }
852
853 return registered ? OK : UNKNOWN_ERROR;
854}
855
Bernhard Rosenkränzer0c28fd22018-06-04 16:01:47 +0200856} // namespace details
Steven Morelandcbefd352017-01-23 20:29:05 -0800857
Bernhard Rosenkränzer0c28fd22018-06-04 16:01:47 +0200858} // namespace hardware
859} // namespace android