diff options
-rw-r--r-- | core/java/android/os/HidlSupport.java | 7 | ||||
-rw-r--r-- | core/jni/android_os_HidlSupport.cpp | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/os/HidlSupport.java b/core/java/android/os/HidlSupport.java index 91b796aba655..77160557f5c2 100644 --- a/core/java/android/os/HidlSupport.java +++ b/core/java/android/os/HidlSupport.java @@ -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() {} } diff --git a/core/jni/android_os_HidlSupport.cpp b/core/jni/android_os_HidlSupport.cpp index e3602d8f5c72..3e51e9315d89 100644 --- a/core/jni/android_os_HidlSupport.cpp +++ b/core/jni/android_os_HidlSupport.cpp @@ -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}, + {"getPidIfSharable", "()I", (void*)android_os_HidlSupport_getPidIfSharable}, + {"isHidlSupported", "()Z", (void*)android_os_HidlSupport_isHidlSupported}, }; const char* const kHidlSupportPathName = "android/os/HidlSupport"; |