summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-06-04 17:02:05 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-06-04 17:02:05 +0000
commitee22bc842bb2362a0bb3a91b49133cefa12daa0b (patch)
tree8230f7b1f20185502ca78ee712569b92a9b4d38c /libs/binder/Parcel.cpp
parente9946488176fb164fe27131da030292ee0435f9a (diff)
parentd67c8e89d2589866f509640bfbac3799c1eca4f8 (diff)
Merge changes Id2c1d0dc,I654fcd2c
* changes: libbinder: Add binder already sent checks libbinder: +2 bytes in BBinder from stability rep
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r--libs/binder/Parcel.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index d19b4d83fb..232a70c894 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -173,8 +173,8 @@ static void release_object(const sp<ProcessState>& proc,
status_t Parcel::finishFlattenBinder(const sp<IBinder>& binder)
{
internal::Stability::tryMarkCompilationUnit(binder.get());
- auto category = internal::Stability::getCategory(binder.get());
- return writeInt32(category.repr());
+ int16_t rep = internal::Stability::getCategory(binder.get()).repr();
+ return writeInt32(rep);
}
status_t Parcel::finishUnflattenBinder(
@@ -184,7 +184,8 @@ status_t Parcel::finishUnflattenBinder(
status_t status = readInt32(&stability);
if (status != OK) return status;
- status = internal::Stability::setRepr(binder.get(), stability, true /*log*/);
+ status = internal::Stability::setRepr(binder.get(), static_cast<int16_t>(stability),
+ true /*log*/);
if (status != OK) return status;
*out = binder;
@@ -195,8 +196,11 @@ static constexpr inline int schedPolicyMask(int policy, int priority) {
return (priority & FLAT_BINDER_FLAG_PRIORITY_MASK) | ((policy & 3) << FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT);
}
-status_t Parcel::flattenBinder(const sp<IBinder>& binder)
-{
+status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
+ BBinder* local = nullptr;
+ if (binder) local = binder->localBinder();
+ if (local) local->setParceled();
+
if (isForRpc()) {
if (binder) {
status_t status = writeInt32(1); // non-null
@@ -222,7 +226,6 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder)
}
if (binder != nullptr) {
- BBinder *local = binder->localBinder();
if (!local) {
BpBinder *proxy = binder->remoteBinder();
if (proxy == nullptr) {