blob: d53cd7ee2a01d896e1d68b1c6f413c4fd1a891fe [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#ifndef ANDROID_HARDWARE_ISERVICE_MANAGER_H
18#define ANDROID_HARDWARE_ISERVICE_MANAGER_H
19
Steven Morelandcbefd352017-01-23 20:29:05 -080020#include <string>
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070021#include <utils/StrongPointer.h>
22
23namespace android {
24
25namespace hidl {
26namespace manager {
27namespace V1_0 {
28 struct IServiceManager;
29}; // namespace V1_0
Steven Moreland2a2678e2017-07-21 18:07:38 -070030namespace V1_1 {
31 struct IServiceManager;
32}; // namespace V1_0
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070033}; // namespace manager
34}; // namespace hidl
35
36namespace hardware {
37
Steven Morelandcbefd352017-01-23 20:29:05 -080038namespace details {
Steven Morelandcd4dbdf2017-04-07 20:31:22 -070039// e.x.: android.hardware.foo@1.0, IFoo, default
40void onRegistration(const std::string &packageName,
41 const std::string &interfaceName,
42 const std::string &instanceName);
43
44// e.x.: android.hardware.foo@1.0::IFoo, default
Steven Morelandcbefd352017-01-23 20:29:05 -080045void waitForHwService(const std::string &interface, const std::string &instanceName);
Steven Moreland519306f2017-06-06 17:14:12 -070046
47void preloadPassthroughService(const std::string &descriptor);
Steven Morelandcbefd352017-01-23 20:29:05 -080048};
49
Steven Moreland519306f2017-06-06 17:14:12 -070050// These functions are for internal use by hidl. If you want to get ahold
51// of an interface, the best way to do this is by calling IFoo::getService()
52sp<::android::hidl::manager::V1_0::IServiceManager> defaultServiceManager();
Steven Moreland2a2678e2017-07-21 18:07:38 -070053sp<::android::hidl::manager::V1_1::IServiceManager> defaultServiceManager1_1();
Steven Moreland519306f2017-06-06 17:14:12 -070054sp<::android::hidl::manager::V1_0::IServiceManager> getPassthroughServiceManager();
Steven Moreland2a2678e2017-07-21 18:07:38 -070055sp<::android::hidl::manager::V1_1::IServiceManager> getPassthroughServiceManager1_1();
Steven Moreland519306f2017-06-06 17:14:12 -070056
57/**
58 * Given a service that is in passthrough mode, this function will go ahead and load the
59 * required passthrough module library (but not call HIDL_FETCH_I* functions to instantiate it).
60 *
61 * E.x.: preloadPassthroughService<IFoo>();
62 */
63template<typename I>
64static inline void preloadPassthroughService() {
65 details::preloadPassthroughService(I::descriptor);
66}
67
Steven Moreland5d5ef7f2016-10-20 19:19:55 -070068}; // namespace hardware
69}; // namespace android
70
71#endif // ANDROID_HARDWARE_ISERVICE_MANAGER_H
72