commit | 207c98ab02c7477d12953e946585b8df2597db60 | [log] [tgz] |
---|---|---|
author | Steven Moreland <smoreland@google.com> | Mon Aug 22 22:43:47 2022 +0000 |
committer | Steven Moreland <smoreland@google.com> | Wed Aug 24 23:00:27 2022 +0000 |
tree | 802d30f628f5688af1eb13a1a68a38d72ff9fa42 | |
parent | 2eb58bc2a848cc483badadda5ae08f3a18d72094 [diff] |
Custom NDK Parcelables Define custom parcelables for use with aidl_interface. This was previously left out of the design intentionally in order to discourage manual parcelables (both because they were unsafe and also because later, we realized they would also limit our ability to use RPC binder). Now! In the throes of progress we abandon our idealist dreams for unrestrained orthogonality. In this spirit, arbitrary shared lib dependencies are allowed to be added to aidl_interface. Be weary, travelers! In order to use NDK parcelables with this: 1. declare the NDK parcelable with ndk_header. You must declare this separately from the aidl_interface and then either use imports or aidl_interface_headers. An unstructured parcelable still can't be used with aidl_interface srcs. 2. declare the NDK parcelable as @NdkOnlyStableParcelable. Note: this is for parity with Java. Also, in the future, it can be used to distinguish between NDK-provided parcelables and also stable parcelables of the NDK format which don't use this (e.g. those used in apps). 3. make sure your NDK parcelable implements the same interface as is expected by regular NDK-backend parcelables. class MyCustomParcelable { binder_status_t readFromParcel(const AParcel* parcel); binder_status_t writeToParcel(AParcel* parcel) const; } Fixes: 242206118 Test: ran several locally, but FIXME: need to actually use this with an NDK parcelable. Change-Id: Ib556416c095fa42ecd753cac93666518106814a8
Documentation for this project is currently maintained here:
https://source.android.com/devices/architecture/aidl/overview