summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2010-06-23 10:18:18 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-06-23 10:18:18 -0700
commitfc94e89a7f7aadf101ac1144073be964d9bfcf6b (patch)
tree6d65eb3af3c12f4f073fd715260fbdceba6f988f /libs
parentf3a8f74f7b8a0fb3672534d50b1fd942ab0742a2 (diff)
parentefcf68aa1fd7fcfd52cf3d2837ed8db8e797194b (diff)
downloadframeworks_base-fc94e89a7f7aadf101ac1144073be964d9bfcf6b.zip
frameworks_base-fc94e89a7f7aadf101ac1144073be964d9bfcf6b.tar.gz
frameworks_base-fc94e89a7f7aadf101ac1144073be964d9bfcf6b.tar.bz2
am efcf68aa: am ef8f96a7: Merge "Start of work on passing around StrictMode policy over Binder calls." into gingerbread
Merge commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b' * commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b': Start of work on passing around StrictMode policy over Binder calls.
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/IPCThreadState.cpp13
-rw-r--r--libs/binder/IServiceManager.cpp7
-rw-r--r--libs/binder/Parcel.cpp8
3 files changed, 21 insertions, 7 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 0016503..28706ba 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -367,6 +367,16 @@ int64_t IPCThreadState::clearCallingIdentity()
return token;
}
+void IPCThreadState::setStrictModePolicy(int32_t policy)
+{
+ mStrictModePolicy = policy;
+}
+
+
+int32_t IPCThreadState::getStrictModePolicy() const {
+ return mStrictModePolicy;
+}
+
void IPCThreadState::restoreCallingIdentity(int64_t token)
{
mCallingUid = (int)(token>>32);
@@ -588,7 +598,8 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy)
}
IPCThreadState::IPCThreadState()
- : mProcess(ProcessState::self()), mMyThreadId(androidGetTid())
+ : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()),
+ mStrictModePolicy(0)
{
pthread_setspecific(gTLS, this);
clearCaller();
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 0cf4158..a3a3f0e 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -129,19 +129,19 @@ public:
: BpInterface<IServiceManager>(impl)
{
}
-
+
virtual sp<IBinder> getService(const String16& name) const
{
unsigned n;
for (n = 0; n < 5; n++){
sp<IBinder> svc = checkService(name);
if (svc != NULL) return svc;
- LOGI("Waiting for sevice %s...\n", String8(name).string());
+ LOGI("Waiting for service %s...\n", String8(name).string());
sleep(1);
}
return NULL;
}
-
+
virtual sp<IBinder> checkService( const String16& name) const
{
Parcel data, reply;
@@ -226,4 +226,3 @@ status_t BnServiceManager::onTransact(
}
}; // namespace android
-
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 00d2210..c2574bd 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -19,6 +19,7 @@
#include <binder/Parcel.h>
+#include <binder/IPCThreadState.h>
#include <binder/Binder.h>
#include <binder/BpBinder.h>
#include <utils/Debug.h>
@@ -436,19 +437,22 @@ bool Parcel::hasFileDescriptors() const
return mHasFds;
}
+// Write RPC headers. (previously just the interface token)
status_t Parcel::writeInterfaceToken(const String16& interface)
{
+ writeInt32(IPCThreadState::self()->getStrictModePolicy());
// currently the interface identification token is just its name as a string
return writeString16(interface);
}
bool Parcel::checkInterface(IBinder* binder) const
{
- return enforceInterface(binder->getInterfaceDescriptor());
+ return enforceInterface(binder->getInterfaceDescriptor());
}
bool Parcel::enforceInterface(const String16& interface) const
{
+ int32_t strict_policy = readInt32();
const String16 str(readString16());
if (str == interface) {
return true;
@@ -457,7 +461,7 @@ bool Parcel::enforceInterface(const String16& interface) const
String8(interface).string(), String8(str).string());
return false;
}
-}
+}
const size_t* Parcel::objects() const
{