summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2010-07-13 15:57:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-13 15:57:20 -0700
commitf5574e0f8ca5624c822737eae497e27b60e33662 (patch)
treef639515cf04c39a41b0af38c2980b13291b582f4 /libs/binder
parentd11f6e6460dcc41597e3a7f6cd3023f116f8c696 (diff)
parent706623ddb8314850c0551f0b66e24b5f0bd28620 (diff)
downloadframeworks_base-f5574e0f8ca5624c822737eae497e27b60e33662.zip
frameworks_base-f5574e0f8ca5624c822737eae497e27b60e33662.tar.gz
frameworks_base-f5574e0f8ca5624c822737eae497e27b60e33662.tar.bz2
am 706623dd: am c0a7e690: Add Parcel::readExceptionCode() and Parcel::writeNoException()
Merge commit '706623ddb8314850c0551f0b66e24b5f0bd28620' * commit '706623ddb8314850c0551f0b66e24b5f0bd28620': Add Parcel::readExceptionCode() and Parcel::writeNoException()
Diffstat (limited to 'libs/binder')
-rw-r--r--libs/binder/IPermissionController.cpp8
-rw-r--r--libs/binder/IServiceManager.cpp2
-rw-r--r--libs/binder/Parcel.cpp11
3 files changed, 15 insertions, 6 deletions
diff --git a/libs/binder/IPermissionController.cpp b/libs/binder/IPermissionController.cpp
index bff4c9b..e13036f 100644
--- a/libs/binder/IPermissionController.cpp
+++ b/libs/binder/IPermissionController.cpp
@@ -36,7 +36,7 @@ public:
: BpInterface<IPermissionController>(impl)
{
}
-
+
virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid)
{
Parcel data, reply;
@@ -46,7 +46,7 @@ public:
data.writeInt32(uid);
remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply);
// fail on exception
- if (reply.readInt32() != 0) return 0;
+ if (reply.readExceptionCode() != 0) return 0;
return reply.readInt32() != 0;
}
};
@@ -66,8 +66,7 @@ status_t BnPermissionController::onTransact(
int32_t pid = data.readInt32();
int32_t uid = data.readInt32();
bool res = checkPermission(permission, pid, uid);
- // write exception
- reply->writeInt32(0);
+ reply->writeNoException();
reply->writeInt32(res ? 1 : 0);
return NO_ERROR;
} break;
@@ -77,4 +76,3 @@ status_t BnPermissionController::onTransact(
}
}; // namespace android
-
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index a3a3f0e..1fa4c35 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -158,7 +158,7 @@ public:
data.writeString16(name);
data.writeStrongBinder(service);
status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply);
- return err == NO_ERROR ? reply.readInt32() : err;
+ return err == NO_ERROR ? reply.readExceptionCode() : err;
}
virtual Vector<String16> listServices()
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index c2574bd..47be1bf 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -754,6 +754,11 @@ restart_write:
goto restart_write;
}
+status_t Parcel::writeNoException()
+{
+ return writeInt32(0);
+}
+
void Parcel::remove(size_t start, size_t amt)
{
LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!");
@@ -942,6 +947,12 @@ wp<IBinder> Parcel::readWeakBinder() const
return val;
}
+int32_t Parcel::readExceptionCode() const
+{
+ int32_t exception_code = readAligned<int32_t>();
+ // TODO: skip over the response header here, once that's in.
+ return exception_code;
+}
native_handle* Parcel::readNativeHandle() const
{