summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2010-07-15 23:05:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-15 23:05:35 -0700
commit721c4162c3ad46d55ac09bf68f5922bb683d36f7 (patch)
treea3023fa114cd510d3139752cde94cd415ffdafab /libs/binder
parentba57d1b9a512a56eaaed3b95b8144d0a25f2b01b (diff)
parent7f7fa79c4e373f58439e3bf34278364607dffb05 (diff)
downloadframeworks_native-721c4162c3ad46d55ac09bf68f5922bb683d36f7.zip
frameworks_native-721c4162c3ad46d55ac09bf68f5922bb683d36f7.tar.gz
frameworks_native-721c4162c3ad46d55ac09bf68f5922bb683d36f7.tar.bz2
am cc52121c: am c4b204bd: Merge "More StrictMode work, keeping Binder & BlockGuard\'s thread-locals in-sync." into gingerbread
Merge commit 'cc52121c4f88e9feb8404937bcbfff6e73084666' * commit 'cc52121c4f88e9feb8404937bcbfff6e73084666': More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.
Diffstat (limited to 'libs/binder')
-rw-r--r--libs/binder/IPCThreadState.cpp4
-rw-r--r--libs/binder/Parcel.cpp13
2 files changed, 13 insertions, 4 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 28706ba..f6582e6 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -372,8 +372,8 @@ void IPCThreadState::setStrictModePolicy(int32_t policy)
mStrictModePolicy = policy;
}
-
-int32_t IPCThreadState::getStrictModePolicy() const {
+int32_t IPCThreadState::getStrictModePolicy() const
+{
return mStrictModePolicy;
}
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 47be1bf..bed893a 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -48,6 +48,9 @@
#define PAD_SIZE(s) (((s)+3)&~3)
+// Note: must be kept in sync with android/os/StrictMode.java's PENALTY_GATHER
+#define STRICT_MODE_PENALTY_GATHER 0x100
+
// XXX This can be made public if we want to provide
// support for typed data.
struct small_flat_data
@@ -440,7 +443,8 @@ bool Parcel::hasFileDescriptors() const
// Write RPC headers. (previously just the interface token)
status_t Parcel::writeInterfaceToken(const String16& interface)
{
- writeInt32(IPCThreadState::self()->getStrictModePolicy());
+ writeInt32(IPCThreadState::self()->getStrictModePolicy() |
+ STRICT_MODE_PENALTY_GATHER);
// currently the interface identification token is just its name as a string
return writeString16(interface);
}
@@ -450,9 +454,14 @@ bool Parcel::checkInterface(IBinder* binder) const
return enforceInterface(binder->getInterfaceDescriptor());
}
-bool Parcel::enforceInterface(const String16& interface) const
+bool Parcel::enforceInterface(const String16& interface,
+ int32_t* strict_policy_out) const
{
int32_t strict_policy = readInt32();
+ IPCThreadState::self()->setStrictModePolicy(strict_policy);
+ if (strict_policy_out != NULL) {
+ *strict_policy_out = strict_policy;
+ }
const String16 str(readString16());
if (str == interface) {
return true;