Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0f98aa1 authored by Devin Moore's avatar Devin Moore
Browse files

Add isHidlSupported Java API

The C++ API already exists, this brings it thorugh jni for the Java HIDL
service manager.

Test: m
Bug: 218588089
Change-Id: I352a0326cc80d518dfe98053f1847723755b83b8
parent 82eae714
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -218,6 +218,13 @@ public class HidlSupport {
    @SystemApi
    public static native int getPidIfSharable();

    /**
     * Return true if HIDL is supported on this device and false if not.
     *
     * @hide
     */
    public static native boolean isHidlSupported();

    /** @hide */
    public HidlSupport() {}
}
+7 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#include <hidl/HidlTransportSupport.h>
#include <hidl/ServiceManagement.h>
#include <nativehelper/JNIHelp.h>

#include "core_jni_helpers.h"
@@ -24,8 +25,13 @@ static jint android_os_HidlSupport_getPidIfSharable(JNIEnv*, jclass) {
    return android::hardware::details::getPidIfSharable();
}

static jboolean android_os_HidlSupport_isHidlSupported(JNIEnv*, jclass) {
    return android::hardware::isHidlSupported();
}

static const JNINativeMethod gHidlSupportMethods[] = {
        {"getPidIfSharable", "()I", (void*)android_os_HidlSupport_getPidIfSharable},
        {"isHidlSupported", "()Z", (void*)android_os_HidlSupport_isHidlSupported},
};

const char* const kHidlSupportPathName = "android/os/HidlSupport";