Skip to content

Commit 718bfdb

Browse files
author
Steven Moreland
committed
libbinder: usage warnings for some older features
We should migrate off of Blob and SafeInterface, and use more encapsulated types and AIDL-compatible types instead. Bug: few recent discussions Test: N/A Change-Id: Idaf92fcdb57701616b925f3b31ad1f61e2348304
1 parent 38a4ab9 commit 718bfdb

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

libs/binder/include/binder/Parcel.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ class Parcel {
388388
LIBBINDER_EXPORTED status_t
389389
writeUniqueFileDescriptorVector(const std::vector<binder::unique_fd>& val);
390390

391+
// WARNING: deprecated and incompatible with AIDL. You should use Parcelable
392+
// definitions outside of Parcel to represent shared memory, such as
393+
// IMemory or with ParcelFileDescriptor. We should remove this, or move it to be
394+
// external to Parcel, it's not a very encapsulated API.
395+
//
391396
// Writes a blob to the parcel.
392397
// If the blob is small, then it is stored in-place, otherwise it is
393398
// transferred by way of an anonymous shared memory region. Prefer sending
@@ -631,6 +636,11 @@ class Parcel {
631636
LIBBINDER_EXPORTED status_t
632637
readUniqueFileDescriptorVector(std::vector<binder::unique_fd>* val) const;
633638

639+
// WARNING: deprecated and incompatible with AIDL. You should use Parcelable
640+
// definitions outside of Parcel to represent shared memory, such as
641+
// IMemory or with ParcelFileDescriptor. We should remove this, or move it to be
642+
// external to Parcel, it's not a very encapsulated API.
643+
//
634644
// Reads a blob from the parcel.
635645
// The caller should call release() on the blob after reading its contents.
636646
LIBBINDER_EXPORTED status_t readBlob(size_t len, ReadableBlob* outBlob) const;

libs/binder/include/binder/SafeInterface.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
namespace android {
3535
namespace SafeInterface {
3636

37+
/**
38+
* WARNING: Prefer to use AIDL-generated interfaces. Using SafeInterface to generate interfaces
39+
* does not support tracing, and many other AIDL features out of the box. The general direction
40+
* we should go is to migrate safe interface users to AIDL and then remove this so that there
41+
* is only one thing to learn/use/test/integrate, not this as well.
42+
*/
43+
3744
// ParcelHandler is responsible for writing/reading various types to/from a Parcel in a generic way
3845
class LIBBINDER_EXPORTED ParcelHandler {
3946
public:

0 commit comments

Comments
 (0)