From d258e68c77ae9b7eee640dcc60eb1e6eda0100df Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 1 Nov 2021 18:34:42 -0700 Subject: binder: recovery variant does not use libandroid_runtime_vm_headers There's no Android Runtime in recovery anyways. Test: builds Change-Id: Iff202493241932ceb92988580150d6338058bc94 --- libs/binder/RpcSession.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libs/binder/RpcSession.cpp') 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 #include #include -#include #include #include #include #include #include -#include #include #include "FdTrigger.h" @@ -48,6 +46,11 @@ extern "C" pid_t gettid(); #endif +#ifndef __ANDROID_RECOVERY__ +#include +#include +#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&& session, PreJoinSetupResult&& setupResult) { @@ -360,7 +367,7 @@ void RpcSession::join(sp&& 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); -- cgit v1.2.3-59-g8ed1b