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
12 files changed
tree: 802d30f628f5688af1eb13a1a68a38d72ff9fa42
  1. aidl_api/
  2. build/
  3. metadata/
  4. scripts/
  5. tests/
  6. trace/
  7. aidl-format.sh
  8. aidl.cpp
  9. aidl.h
  10. aidl_checkapi.cpp
  11. aidl_checkapi.h
  12. aidl_const_expressions.cpp
  13. aidl_dumpapi.cpp
  14. aidl_dumpapi.h
  15. aidl_language.cpp
  16. aidl_language.h
  17. aidl_language_l.ll
  18. aidl_language_y.yy
  19. aidl_to_cpp.cpp
  20. aidl_to_cpp.h
  21. aidl_to_cpp_common.cpp
  22. aidl_to_cpp_common.h
  23. aidl_to_java.cpp
  24. aidl_to_java.h
  25. aidl_to_ndk.cpp
  26. aidl_to_ndk.h
  27. aidl_to_rust.cpp
  28. aidl_to_rust.h
  29. aidl_typenames.cpp
  30. aidl_typenames.h
  31. aidl_unittest.cpp
  32. Android.bp
  33. ast_java.cpp
  34. ast_java.h
  35. ast_java_unittest.cpp
  36. check_valid.cpp
  37. check_valid.h
  38. code_writer.cpp
  39. code_writer.h
  40. code_writer_unittest.cpp
  41. comments.cpp
  42. comments.h
  43. diagnostics.cpp
  44. diagnostics.h
  45. diagnostics.inc
  46. diagnostics_unittest.cpp
  47. generate_aidl_mappings.cpp
  48. generate_aidl_mappings.h
  49. generate_cpp.cpp
  50. generate_cpp.h
  51. generate_cpp_unittest.cpp
  52. generate_java.cpp
  53. generate_java.h
  54. generate_java_binder.cpp
  55. generate_ndk.cpp
  56. generate_ndk.h
  57. generate_rust.cpp
  58. generate_rust.h
  59. hiddenapi-greylist
  60. import_resolver.cpp
  61. import_resolver.h
  62. io_delegate.cpp
  63. io_delegate.h
  64. io_delegate_unittest.cpp
  65. location.cpp
  66. location.h
  67. logging.cpp
  68. logging.h
  69. main.cpp
  70. NOTICE
  71. options.cpp
  72. options.h
  73. options_unittest.cpp
  74. os.h
  75. OWNERS
  76. parser.cpp
  77. parser.h
  78. permission.cpp
  79. permission.h
  80. preprocess.cpp
  81. preprocess.h
  82. PREUPLOAD.cfg
  83. README.md
  84. run_integration_tests.sh
  85. TEST_MAPPING
README.md

Documentation for this project is currently maintained here:

https://source.android.com/devices/architecture/aidl/overview