From 28cc6e88fdfa1434b99219a0eb59dae82c10887c Mon Sep 17 00:00:00 2001 From: Sundong Ahn Date: Thu, 13 Jul 2017 16:34:01 +0900 Subject: [PATCH] Add hwbinder library HAL impls will depend hwbinder.jar instead of framework.jar on build-time, but on runtime framework.jar will be used. This is to cut the circular dependency when using configstore from Android framework. Also added JNI call to HwBinder.java to cut configstore's dependency on systemproperty in framework.jar. Note that hwbinder.jar is LOCAL_UNINSTALLABLE_MODULE and so it won't be installed in an actual image. Bug: 35771640 Test: build & run Change-Id: I2420298cf9df5d6bbcead3e4451b703ce9bc3e29 --- Android.mk | 26 ++++++++++++++++++++++++++ core/java/android/os/HwBinder.java | 9 +++++++++ core/jni/android_os_HwBinder.cpp | 9 +++++++++ 3 files changed, 44 insertions(+) diff --git a/Android.mk b/Android.mk index d05feb5eb88b8..28ff5c1b6c219 100644 --- a/Android.mk +++ b/Android.mk @@ -545,6 +545,32 @@ $(framework_module): | $(dir $(framework_module))framework-res.apk framework_built := $(call java-lib-deps,framework) +# HwBinder +# ======================================================= +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + core/java/android/os/HidlSupport.java \ + core/java/android/annotation/NonNull.java \ + core/java/android/os/HwBinder.java \ + core/java/android/os/HwBlob.java \ + core/java/android/os/HwParcel.java \ + core/java/android/os/IHwBinder.java \ + core/java/android/os/IHwInterface.java \ + core/java/android/os/DeadObjectException.java \ + core/java/android/os/DeadSystemException.java \ + core/java/android/os/RemoteException.java \ + core/java/android/util/AndroidException.java \ + +LOCAL_NO_STANDARD_LIBRARIES := true +LOCAL_JAVA_LIBRARIES := core-oj core-libart +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := hwbinder + +LOCAL_DX_FLAGS := --core-library +LOCAL_UNINSTALLABLE_MODULE := true +include $(BUILD_JAVA_LIBRARY) + # Copy AIDL files to be preprocessed and included in the SDK, # specified relative to the root of the build tree. # ============================================================ diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java index 866e20c26a0c6..270e63f408a77 100644 --- a/core/java/android/os/HwBinder.java +++ b/core/java/android/os/HwBinder.java @@ -71,4 +71,13 @@ public abstract class HwBinder implements IHwBinder { } private long mNativeContext; + + private static native void native_report_sysprop_change(); + + /** + * Notifies listeners that a system property has changed + */ + public static void reportSyspropChanged() { + native_report_sysprop_change(); + } } diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp index 132891e9e09ec..eaa7904eacd56 100644 --- a/core/jni/android_os_HwBinder.cpp +++ b/core/jni/android_os_HwBinder.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "core_jni_helpers.h" @@ -403,6 +404,11 @@ void JHwBinder_native_joinRpcThreadpool() { IPCThreadState::self()->joinThreadPool(); } +static void JHwBinder_report_sysprop_change(JNIEnv /**env*/, jobject /*clazz*/) +{ + report_sysprop_change(); +} + static JNINativeMethod gMethods[] = { { "native_init", "()J", (void *)JHwBinder_native_init }, { "native_setup", "()V", (void *)JHwBinder_native_setup }, @@ -422,6 +428,9 @@ static JNINativeMethod gMethods[] = { { "joinRpcThreadpool", "()V", (void *)JHwBinder_native_joinRpcThreadpool }, + + { "native_report_sysprop_change", "()V", + (void *)JHwBinder_report_sysprop_change }, }; namespace android {