Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92c596ab authored by ziyiw's avatar ziyiw
Browse files

[bug fix] Handle the case when rfFieldOnTime is not set in OemLog.

Test: atest CtsNfcTestCases
Bug: 378612451
Change-Id: I4199792f4b7f97cda7225c6d7a8113e5896c5ef4
parent 4fe0c9b8
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -142,8 +142,11 @@ public final class OemLogItems implements Parcelable {
        dest.writeByteArray(mCommandApdus);
        dest.writeInt(mResponseApdus.length);
        dest.writeByteArray(mResponseApdus);
        dest.writeBoolean(mRfFieldOnTime != null);
        if (mRfFieldOnTime != null) {
            dest.writeLong(mRfFieldOnTime.getEpochSecond());
            dest.writeInt(mRfFieldOnTime.getNano());
        }
        dest.writeParcelable(mTag, 0);
    }

@@ -305,7 +308,12 @@ public final class OemLogItems implements Parcelable {
        in.readByteArray(this.mCommandApdus);
        this.mResponseApdus = new byte[in.readInt()];
        in.readByteArray(this.mResponseApdus);
        boolean isRfFieldOnTimeSet = in.readBoolean();
        if (isRfFieldOnTimeSet) {
            this.mRfFieldOnTime = Instant.ofEpochSecond(in.readLong(), in.readInt());
        } else {
            this.mRfFieldOnTime = null;
        }
        this.mTag = in.readParcelable(Tag.class.getClassLoader(), Tag.class);
    }