diff options
author | 2020-11-13 02:39:26 +0000 | |
---|---|---|
committer | 2020-11-13 17:08:50 +0000 | |
commit | 89ddfc5f8c1c9f5bacc6d6d5133bb910d63663a3 (patch) | |
tree | 096eeb026fe1d9f58b49349cf44f3e6167e08114 /libs/binder/Parcel.cpp | |
parent | 05f351cb838fbb8ba85769f9b4d2ca638e0211b9 (diff) |
libbinder: binders hold wire protocol version
The libbinder wire protocol version is currently unstable, but we may
stablize it. This adds a version field in the stability token which is
passed around with binder objects, so it doesn't require additional
memory.
Future consideration/direction:
- when starting a transaction, attach a binder to a Parcel object
- when parceling, parcel according to the maximum of (locally
understood wire protocol, binder wire protocol)
- verify in transact the data parcel has the corresponding binder
- when the server creates a reply parcel, note version which is the
same as the version used in the data Parcel (we know that whoever
wrote this transaction can understand this level).
- save binary blobs of known write*/read* data flows, and test that
Parcel can understand and recreate these blobs after it is versioned.
Bug: 167966510
Test: 'atest binderStabilityTest' - verifies behavior
Test: internally checks version is always set
Change-Id: I9bb5be5b5b7d7255f8387cf690d86a055102f95d
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r-- | libs/binder/Parcel.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index feeb819a8a..cc30fa802a 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -171,7 +171,8 @@ status_t Parcel::finishFlattenBinder( if (status != OK) return status; internal::Stability::tryMarkCompilationUnit(binder.get()); - return writeInt32(internal::Stability::get(binder.get())); + auto category = internal::Stability::getCategory(binder.get()); + return writeInt32(category.repr()); } status_t Parcel::finishUnflattenBinder( @@ -181,7 +182,7 @@ status_t Parcel::finishUnflattenBinder( status_t status = readInt32(&stability); if (status != OK) return status; - status = internal::Stability::set(binder.get(), stability, true /*log*/); + status = internal::Stability::setRepr(binder.get(), stability, true /*log*/); if (status != OK) return status; *out = binder; |