summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2010-07-13 15:33:35 -0700
committerBrad Fitzpatrick <bradfitz@android.com>2010-07-13 15:45:18 -0700
commitc0a7e690bfd32dd897ceccd04dd0fa6bf6e9cee6 (patch)
treea0cbda85dcb855134d89f4f1b27f0457f4ee5e7f /core/jni
parent70c6c9a1e2240e82d8eb442b34efa9629ef2bba4 (diff)
downloadframeworks_base-c0a7e690bfd32dd897ceccd04dd0fa6bf6e9cee6.zip
frameworks_base-c0a7e690bfd32dd897ceccd04dd0fa6bf6e9cee6.tar.gz
frameworks_base-c0a7e690bfd32dd897ceccd04dd0fa6bf6e9cee6.tar.bz2
Add Parcel::readExceptionCode() and Parcel::writeNoException()
Add native Parcel methods analogous to the Java versions. Currently, these don't do much, but upcoming StrictMode work changes the RPC calling conventions in some cases, so it's important that everybody uses these consistently, rather than having a lot of code trying to parse RPC responses out of Parcels themselves. As a summary, the current convention that Java Binder services use is to prepend the reply Parcel with an int32 signaling the exception status: 0: no exception -1: Security exception -2: Bad Parcelable -3: ... -4: ... -5: ... ... followed by Parceled String if the exception code is non-zero. With an upcoming change, it'll be the case that a response Parcel can, non-exceptionally return rich data in the header, and also return data to the caller. The important thing to note in this new case is that the first int32 in the reply parcel *will not be zero*, so anybody manually checking for it with reply.readInt32() will get false negative failures. Short summary: If you're calling into a Java service and manually checking the exception status with reply.readInt32(), change it to reply.readExceptionCode(). Change-Id: I23f9a0e53a8cfbbd9759242cfde16723641afe04
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/ActivityManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/jni/ActivityManager.cpp b/core/jni/ActivityManager.cpp
index 8950dfb..0bd14fa 100644
--- a/core/jni/ActivityManager.cpp
+++ b/core/jni/ActivityManager.cpp
@@ -39,7 +39,7 @@ int openContentProviderFile(const String16& uri)
data.writeString16(uri);
status_t ret = am->transact(OPEN_CONTENT_URI_TRANSACTION, data, &reply);
if (ret == NO_ERROR) {
- int32_t exceptionCode = reply.readInt32();
+ int32_t exceptionCode = reply.readExceptionCode();
if (!exceptionCode) {
// Success is indicated here by a nonzero int followed by the fd;
// failure by a zero int with no data following.