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

Commit e97c024d authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Added missing equals override in new Transport Data classes"

parents b6df9fb2 2a55386e
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.util.Log;

import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.util.Arrays;

/**
 * Wrapper for Transport Discovery Data Transport Blocks.
@@ -59,8 +60,12 @@ public final class TransportBlock implements Parcelable {
        mOrgId = in.readInt();
        mTdsFlags = in.readInt();
        mTransportDataLength = in.readInt();
        if (mTransportDataLength > 0) {
            mTransportData = new byte[mTransportDataLength];
            in.readByteArray(mTransportData);
        } else {
            mTransportData = null;
        }
    }

    @Override
@@ -68,8 +73,10 @@ public final class TransportBlock implements Parcelable {
        dest.writeInt(mOrgId);
        dest.writeInt(mTdsFlags);
        dest.writeInt(mTransportDataLength);
        if (mTransportData != null) {
            dest.writeByteArray(mTransportData);
        }
    }

    /**
     * @hide
@@ -79,6 +86,21 @@ public final class TransportBlock implements Parcelable {
        return 0;
    }

    /**
     * @hide
     */
    @Override
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        TransportBlock other = (TransportBlock) obj;
        return Arrays.equals(toByteArray(), other.toByteArray());
    }

    public static final @NonNull Creator<TransportBlock> CREATOR = new Creator<TransportBlock>() {
        @Override
        public TransportBlock createFromParcel(Parcel in) {
+16 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@@ -96,6 +97,21 @@ public final class TransportDiscoveryData implements Parcelable {
        return 0;
    }

    /**
     * @hide
     */
    @Override
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        TransportDiscoveryData other = (TransportDiscoveryData) obj;
        return Arrays.equals(toByteArray(), other.toByteArray());
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeInt(mTransportDataType);