Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.15.13
-
None
Description
What the title says: QAndroidParcel::writeData() with an empty ByteArray does nothing, while it should write an empty ByteArray
Run this on Android:
fun ByteArray.toHexString() = "[" + joinToString(separator = ",") { eachByte -> "%02X".format(eachByte) } + "]" .... // in a function which has `reply: Parcel?`, i.e. a `Binder.onTransact()` override println("xxxx empty Parcel: ${reply?.marshall()?.toHexString()}") reply?.writeByteArray(ByteArray(0)) println("xxxx Parcel with empty byte array: ${reply?.marshall()?.toHexString()}")
prints
2023-09-06 12:03:37.045 6505-6525 System.out com.example.parcelcreatebytearray I xxxx empty Parcel: [] 2023-09-06 12:03:37.045 6505-6525 System.out com.example.parcelcreatebytearray I xxxx Parcel with empty byte array: [00,00,00,00]
So an empty parcel is not the same as one with an empty Byte Array
Also, parcel.createByteArray() will also return different results in the two cases: null for a Parcel with NoOp vs an empty ByteArray for a parcel which called writeByteArray()