Loading core/jni/ActivityManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,7 @@ int openContentProviderFile(const String16& uri) data.writeString16(uri); data.writeString16(uri); status_t ret = am->transact(OPEN_CONTENT_URI_TRANSACTION, data, &reply); status_t ret = am->transact(OPEN_CONTENT_URI_TRANSACTION, data, &reply); if (ret == NO_ERROR) { if (ret == NO_ERROR) { int32_t exceptionCode = reply.readInt32(); int32_t exceptionCode = reply.readExceptionCode(); if (!exceptionCode) { if (!exceptionCode) { // Success is indicated here by a nonzero int followed by the fd; // Success is indicated here by a nonzero int followed by the fd; // failure by a zero int with no data following. // failure by a zero int with no data following. Loading include/binder/Parcel.h +13 −1 Original line number Original line Diff line number Diff line Loading @@ -103,6 +103,11 @@ public: status_t writeObject(const flat_binder_object& val, bool nullMetaData); status_t writeObject(const flat_binder_object& val, bool nullMetaData); // Like Parcel.java's writeNoException(). Just writes a zero int32. // Currently the native implementation doesn't do any of the StrictMode // stack gathering and serialization that the Java implementation does. status_t writeNoException(); void remove(size_t start, size_t amt); void remove(size_t start, size_t amt); status_t read(void* outData, size_t len) const; status_t read(void* outData, size_t len) const; Loading @@ -126,6 +131,13 @@ public: wp<IBinder> readWeakBinder() const; wp<IBinder> readWeakBinder() const; status_t read(Flattenable& val) const; status_t read(Flattenable& val) const; // Like Parcel.java's readExceptionCode(). Reads the first int32 // off of a Parcel's header, returning 0 or the negative error // code on exceptions, but also deals with skipping over rich // response headers. Callers should use this to read & parse the // response headers rather than doing it by hand. int32_t readExceptionCode() const; // Retrieve native_handle from the parcel. This returns a copy of the // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller // parcel's native_handle (the caller takes ownership). The caller // must free the native_handle with native_handle_close() and // must free the native_handle with native_handle_close() and Loading libs/binder/IPermissionController.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: data.writeInt32(uid); data.writeInt32(uid); remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply); remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply); // fail on exception // fail on exception if (reply.readInt32() != 0) return 0; if (reply.readExceptionCode() != 0) return 0; return reply.readInt32() != 0; return reply.readInt32() != 0; } } }; }; Loading @@ -66,8 +66,7 @@ status_t BnPermissionController::onTransact( int32_t pid = data.readInt32(); int32_t pid = data.readInt32(); int32_t uid = data.readInt32(); int32_t uid = data.readInt32(); bool res = checkPermission(permission, pid, uid); bool res = checkPermission(permission, pid, uid); // write exception reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(res ? 1 : 0); reply->writeInt32(res ? 1 : 0); return NO_ERROR; return NO_ERROR; } break; } break; Loading @@ -77,4 +76,3 @@ status_t BnPermissionController::onTransact( } } }; // namespace android }; // namespace android libs/binder/IServiceManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -158,7 +158,7 @@ public: data.writeString16(name); data.writeString16(name); data.writeStrongBinder(service); data.writeStrongBinder(service); status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply); 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() virtual Vector<String16> listServices() Loading libs/binder/Parcel.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -754,6 +754,11 @@ restart_write: goto restart_write; goto restart_write; } } status_t Parcel::writeNoException() { return writeInt32(0); } void Parcel::remove(size_t start, size_t amt) void Parcel::remove(size_t start, size_t amt) { { LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); Loading Loading @@ -942,6 +947,12 @@ wp<IBinder> Parcel::readWeakBinder() const return val; 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 native_handle* Parcel::readNativeHandle() const { { Loading Loading
core/jni/ActivityManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,7 @@ int openContentProviderFile(const String16& uri) data.writeString16(uri); data.writeString16(uri); status_t ret = am->transact(OPEN_CONTENT_URI_TRANSACTION, data, &reply); status_t ret = am->transact(OPEN_CONTENT_URI_TRANSACTION, data, &reply); if (ret == NO_ERROR) { if (ret == NO_ERROR) { int32_t exceptionCode = reply.readInt32(); int32_t exceptionCode = reply.readExceptionCode(); if (!exceptionCode) { if (!exceptionCode) { // Success is indicated here by a nonzero int followed by the fd; // Success is indicated here by a nonzero int followed by the fd; // failure by a zero int with no data following. // failure by a zero int with no data following. Loading
include/binder/Parcel.h +13 −1 Original line number Original line Diff line number Diff line Loading @@ -103,6 +103,11 @@ public: status_t writeObject(const flat_binder_object& val, bool nullMetaData); status_t writeObject(const flat_binder_object& val, bool nullMetaData); // Like Parcel.java's writeNoException(). Just writes a zero int32. // Currently the native implementation doesn't do any of the StrictMode // stack gathering and serialization that the Java implementation does. status_t writeNoException(); void remove(size_t start, size_t amt); void remove(size_t start, size_t amt); status_t read(void* outData, size_t len) const; status_t read(void* outData, size_t len) const; Loading @@ -126,6 +131,13 @@ public: wp<IBinder> readWeakBinder() const; wp<IBinder> readWeakBinder() const; status_t read(Flattenable& val) const; status_t read(Flattenable& val) const; // Like Parcel.java's readExceptionCode(). Reads the first int32 // off of a Parcel's header, returning 0 or the negative error // code on exceptions, but also deals with skipping over rich // response headers. Callers should use this to read & parse the // response headers rather than doing it by hand. int32_t readExceptionCode() const; // Retrieve native_handle from the parcel. This returns a copy of the // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller // parcel's native_handle (the caller takes ownership). The caller // must free the native_handle with native_handle_close() and // must free the native_handle with native_handle_close() and Loading
libs/binder/IPermissionController.cpp +3 −5 Original line number Original line Diff line number Diff line Loading @@ -46,7 +46,7 @@ public: data.writeInt32(uid); data.writeInt32(uid); remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply); remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply); // fail on exception // fail on exception if (reply.readInt32() != 0) return 0; if (reply.readExceptionCode() != 0) return 0; return reply.readInt32() != 0; return reply.readInt32() != 0; } } }; }; Loading @@ -66,8 +66,7 @@ status_t BnPermissionController::onTransact( int32_t pid = data.readInt32(); int32_t pid = data.readInt32(); int32_t uid = data.readInt32(); int32_t uid = data.readInt32(); bool res = checkPermission(permission, pid, uid); bool res = checkPermission(permission, pid, uid); // write exception reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(res ? 1 : 0); reply->writeInt32(res ? 1 : 0); return NO_ERROR; return NO_ERROR; } break; } break; Loading @@ -77,4 +76,3 @@ status_t BnPermissionController::onTransact( } } }; // namespace android }; // namespace android
libs/binder/IServiceManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -158,7 +158,7 @@ public: data.writeString16(name); data.writeString16(name); data.writeStrongBinder(service); data.writeStrongBinder(service); status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply); 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() virtual Vector<String16> listServices() Loading
libs/binder/Parcel.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -754,6 +754,11 @@ restart_write: goto restart_write; goto restart_write; } } status_t Parcel::writeNoException() { return writeInt32(0); } void Parcel::remove(size_t start, size_t amt) void Parcel::remove(size_t start, size_t amt) { { LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); Loading Loading @@ -942,6 +947,12 @@ wp<IBinder> Parcel::readWeakBinder() const return val; 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 native_handle* Parcel::readNativeHandle() const { { Loading