diff options
author | 2021-11-01 18:34:42 -0700 | |
---|---|---|
committer | 2021-11-01 18:40:00 -0700 | |
commit | d258e68c77ae9b7eee640dcc60eb1e6eda0100df (patch) | |
tree | 44b13fdb30c5c2b67a0ac8e0317e897eb82976c7 | |
parent | 8347ab590004648816eb1101bf2b02993575319a (diff) |
binder: recovery variant does not use libandroid_runtime_vm_headers
There's no Android Runtime in recovery anyways.
Test: builds
Change-Id: Iff202493241932ceb92988580150d6338058bc94
-rw-r--r-- | libs/binder/Android.bp | 5 | ||||
-rw-r--r-- | libs/binder/RpcSession.cpp | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index bb1b5138e0..7ff128e4a0 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -147,6 +147,11 @@ cc_library { "UtilsHost.cpp", ], }, + recovery: { + exclude_header_libs: [ + "libandroid_runtime_vm_headers", + ], + }, }, aidl: { diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 486b67b62c..9b7b5e1ceb 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -29,13 +29,11 @@ #include <android-base/hex.h> #include <android-base/macros.h> #include <android-base/scopeguard.h> -#include <android_runtime/vm.h> #include <binder/BpBinder.h> #include <binder/Parcel.h> #include <binder/RpcServer.h> #include <binder/RpcTransportRaw.h> #include <binder/Stability.h> -#include <jni.h> #include <utils/String8.h> #include "FdTrigger.h" @@ -48,6 +46,11 @@ extern "C" pid_t gettid(); #endif +#ifndef __ANDROID_RECOVERY__ +#include <android_runtime/vm.h> +#include <jni.h> +#endif + namespace android { using base::unique_fd; @@ -301,6 +304,9 @@ RpcSession::PreJoinSetupResult RpcSession::preJoinSetup( } namespace { +#ifdef __ANDROID_RECOVERY__ +class JavaThreadAttacher {}; +#else // RAII object for attaching / detaching current thread to JVM if Android Runtime exists. If // Android Runtime doesn't exist, no-op. class JavaThreadAttacher { @@ -353,6 +359,7 @@ private: return fn(); } }; +#endif } // namespace void RpcSession::join(sp<RpcSession>&& session, PreJoinSetupResult&& setupResult) { @@ -360,7 +367,7 @@ void RpcSession::join(sp<RpcSession>&& session, PreJoinSetupResult&& setupResult if (setupResult.status == OK) { LOG_ALWAYS_FATAL_IF(!connection, "must have connection if setup succeeded"); - JavaThreadAttacher javaThreadAttacher; + [[maybe_unused]] JavaThreadAttacher javaThreadAttacher; while (true) { status_t status = session->state()->getAndExecuteCommand(connection, session, RpcState::CommandType::ANY); |