Merge "libbinder_ndk: make AIBinder_isRemote const."
diff --git a/libs/binder/ndk/AIBinder.cpp b/libs/binder/ndk/AIBinder.cpp
index fe07914..f452511 100644
--- a/libs/binder/ndk/AIBinder.cpp
+++ b/libs/binder/ndk/AIBinder.cpp
@@ -183,7 +183,7 @@
return ret.get();
}
-bool AIBinder_isRemote(AIBinder* binder) {
+bool AIBinder_isRemote(const AIBinder* binder) {
if (binder == nullptr) {
return true;
}
diff --git a/libs/binder/ndk/AIBinder_internal.h b/libs/binder/ndk/AIBinder_internal.h
index ed3b37b..23949bb 100644
--- a/libs/binder/ndk/AIBinder_internal.h
+++ b/libs/binder/ndk/AIBinder_internal.h
@@ -42,7 +42,10 @@
virtual ABBinder* asABBinder() { return nullptr; }
virtual ABpBinder* asABpBinder() { return nullptr; }
- bool isRemote() { return getBinder()->remoteBinder() != nullptr; }
+ bool isRemote() const {
+ ::android::sp<::android::IBinder> binder = const_cast<AIBinder*>(this)->getBinder();
+ return binder->remoteBinder() != nullptr;
+ }
private:
// AIBinder instance is instance of this class for a local object. In order to transact on a
diff --git a/libs/binder/ndk/include_ndk/android/binder_ibinder.h b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
index fb82ab6..2f88779 100644
--- a/libs/binder/ndk/include_ndk/android/binder_ibinder.h
+++ b/libs/binder/ndk/include_ndk/android/binder_ibinder.h
@@ -144,7 +144,7 @@
/**
* If this is hosted in a process other than the current one.
*/
-bool AIBinder_isRemote(AIBinder* binder);
+bool AIBinder_isRemote(const AIBinder* binder);
/**
* This can only be called if a strong reference to this object already exists in process.