Test read and write parcel of ScanResult
BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(
"01:02:03:04:05:06");
byte[] scanRecord = new byte[] {
1, 2, 3 };
int rssi = -10;
long timestampMicros = 10000L;
ScanResult result = new ScanResult(device, ScanRecord.parseFromBytes(scanRecord), rssi,
timestampMicros);
Parcel parcel = Parcel.obtain();
result.writeToParcel(parcel, 0);
// Need to reset parcel data position to the beginning.
parcel.setDataPosition(0);
ScanResult resultFromParcel = ScanResult.CREATOR.createFromParcel(parcel);
assertEquals(result, resultFromParcel);