libbinder: disable JavaThreadAttacher on non-Android OSes

Bug: 224644083
Test: m
Change-Id: Ibfa0535fa09af569f55aa1e6b8d5ff6adb720eb3
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 6c48c88..6ae5357 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -43,7 +43,7 @@
 #include "RpcWireFormat.h"
 #include "Utils.h"
 
-#ifndef __ANDROID_RECOVERY__
+#if defined(__ANDROID__) && !defined(__ANDROID_RECOVERY__)
 #include <android_runtime/vm.h>
 #include <jni.h>
 #endif
@@ -316,7 +316,7 @@
 }
 
 namespace {
-#ifdef __ANDROID_RECOVERY__
+#if !defined(__ANDROID__) || defined(__ANDROID_RECOVERY__)
 class JavaThreadAttacher {};
 #else
 // RAII object for attaching / detaching current thread to JVM if Android Runtime exists. If