Merge "Add configureRpcThreadpool to java interface" am: d8dab11547
am: 791a698a6a
Change-Id: I9b98013a894aa01268ed69a14c6b425e04771936
This commit is contained in:
@@ -51,6 +51,11 @@ public abstract class HwBinder implements IHwBinder {
|
|||||||
String serviceName)
|
String serviceName)
|
||||||
throws RemoteException, NoSuchElementException;
|
throws RemoteException, NoSuchElementException;
|
||||||
|
|
||||||
|
public static native final void configureRpcThreadpool(
|
||||||
|
long maxThreads, boolean callerWillJoin);
|
||||||
|
|
||||||
|
public static native final void joinRpcThreadpool();
|
||||||
|
|
||||||
// Returns address of the "freeFunction".
|
// Returns address of the "freeFunction".
|
||||||
private static native final long native_init();
|
private static native final long native_init();
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
using android::AndroidRuntime;
|
using android::AndroidRuntime;
|
||||||
using android::hardware::hidl_vec;
|
using android::hardware::hidl_vec;
|
||||||
using android::hardware::hidl_string;
|
using android::hardware::hidl_string;
|
||||||
|
using android::hardware::IPCThreadState;
|
||||||
|
using android::hardware::ProcessState;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using Return = android::hardware::Return<T>;
|
using Return = android::hardware::Return<T>;
|
||||||
|
|
||||||
@@ -395,6 +397,15 @@ static jobject JHwBinder_native_getService(
|
|||||||
return JHwRemoteBinder::NewObject(env, service);
|
return JHwRemoteBinder::NewObject(env, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JHwBinder_native_configureRpcThreadpool(jlong maxThreads, jboolean callerWillJoin) {
|
||||||
|
CHECK(maxThreads > 0);
|
||||||
|
ProcessState::self()->setThreadPoolConfiguration(maxThreads, callerWillJoin /*callerJoinsPool*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
void JHwBinder_native_joinRpcThreadpool() {
|
||||||
|
IPCThreadState::self()->joinThreadPool();
|
||||||
|
}
|
||||||
|
|
||||||
static JNINativeMethod gMethods[] = {
|
static JNINativeMethod gMethods[] = {
|
||||||
{ "native_init", "()J", (void *)JHwBinder_native_init },
|
{ "native_init", "()J", (void *)JHwBinder_native_init },
|
||||||
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
|
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
|
||||||
@@ -408,6 +419,12 @@ static JNINativeMethod gMethods[] = {
|
|||||||
|
|
||||||
{ "getService", "(Ljava/lang/String;Ljava/lang/String;)L" PACKAGE_PATH "/IHwBinder;",
|
{ "getService", "(Ljava/lang/String;Ljava/lang/String;)L" PACKAGE_PATH "/IHwBinder;",
|
||||||
(void *)JHwBinder_native_getService },
|
(void *)JHwBinder_native_getService },
|
||||||
|
|
||||||
|
{ "configureRpcThreadpool", "(JZ)V",
|
||||||
|
(void *)JHwBinder_native_configureRpcThreadpool },
|
||||||
|
|
||||||
|
{ "joinRpcThreadpool", "()V",
|
||||||
|
(void *)JHwBinder_native_joinRpcThreadpool },
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|||||||
Reference in New Issue
Block a user