xref: /aosp_15_r20/system/libhwbinder/include/hwbinder/HidlSupport.h (revision 77b80299c8bdfeca3ae6d0ce27ae1ad3db289be3)
1 /*
2  * Copyright (C) 2024 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 #pragma once
18 #include <stdint.h>
19 #include <sys/cdefs.h>
20 #include <sys/types.h>
21 
22 // WARNING: this code is part of libhwbinder, a fork of libbinder. Generally,
23 // this means that it is only relevant to HIDL. Any AIDL- or libbinder-specific
24 // code should not try to use these things.
25 namespace android::hardware {
26 // Return whether or not hwbinder is supported on this device based on the existence
27 // of hwservicemanager.
28 //
29 // If the service is installed on the device, this method blocks and waits for
30 // hwservicemanager to be either ready or disabled.
31 //
32 // This function will block during early init while hwservicemanager is
33 // starting. If hwbinder is supported on the device, it waill wait until
34 // the hwservicemanager.ready property is set to true. If hwbinder is not supported
35 // but hwservicemanager is still installed on the device, it will wait
36 // until hwservicemanager.enabled is set to false.
37 //
38 // return - false if the service isn't installed on the device
39 //          false if the service is installed, but disabled
40 //          true if the service is ready
41 bool isHwbinderSupportedBlocking();
42 } // namespace android::hardware
43 
44