android / ndk

The Android Native Development Kit
1.97k stars 255 forks source link

[FR] AParcel_writeVector function in binder_parcel_utils.h file should support vector<int8_t> type #2068

Closed timipig closed 2 weeks ago

timipig commented 2 weeks ago

Description

When I use the following code and compile in cmake the following error is triggered

  vector<int8_t> server_message_id;
  _aidl_ret_status = ::ndk::AParcel_writeVector(parcel, server_message_id);
  if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;

Snipaste_2024-09-04_15-49-15 I found out that the reason is that the overloaded function AParcel_writeVector does not support vector, but the other AParcel_writeByteArray function provided by the NDK does support vector. AParcel_writexxxArray is used inside the AParcel_writeVector function, so I don't understand why AParcel_writeVector supports vector but not vector

DanAlbert commented 2 weeks ago

You'll need to file a platform bug following http://b.android.com (the frameworks component, probably). We don't own the APIs, and these headers actually are only in the NDK due to a historical accident anyway (that's really a helper library for aidl; it's not a platform API).