private void readFromParcel(Parcel in) { if (in.readInt() == 1) { mDevice = BluetoothDevice.CREATOR.createFromParcel(in); } if (in.readInt() == 1) { mScanRecord = ScanRecord.parseFromBytes(in.createByteArray()); } mRssi = in.readInt(); mTimestampNanos = in.readLong(); }
@Override public void writeToParcel(Parcel dest, int flags) { if (mDevice != null) { dest.writeInt(1); mDevice.writeToParcel(dest, flags); } else { dest.writeInt(0); } if (mScanRecord != null) { dest.writeInt(1); dest.writeByteArray(mScanRecord.getBytes()); } else { dest.writeInt(0); } dest.writeInt(mRssi); dest.writeLong(mTimestampNanos); }