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

Commit 11791dcd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix NPEs in DataCallResponse"

parents 68c7fbf8 f5d17511
Loading
Loading
Loading
Loading
+36 −9
Original line number Diff line number Diff line
@@ -468,14 +468,14 @@ public final class DataCallResponse implements Parcelable {
        final boolean isQosBearerSessionsSame =
                (mQosBearerSessions == null || other.mQosBearerSessions == null)
                ? mQosBearerSessions == other.mQosBearerSessions
                : mQosBearerSessions.size() == other.mQosBearerSessions.size()
                && mQosBearerSessions.containsAll(other.mQosBearerSessions);
                : (mQosBearerSessions.size() == other.mQosBearerSessions.size()
                        && mQosBearerSessions.containsAll(other.mQosBearerSessions));

        final boolean isTrafficDescriptorsSame =
                (mTrafficDescriptors == null || other.mTrafficDescriptors == null)
                ? mTrafficDescriptors == other.mTrafficDescriptors
                : mTrafficDescriptors.size() == other.mTrafficDescriptors.size()
                && mTrafficDescriptors.containsAll(other.mTrafficDescriptors);
                : (mTrafficDescriptors.size() == other.mTrafficDescriptors.size()
                        && mTrafficDescriptors.containsAll(other.mTrafficDescriptors));

        return mCause == other.mCause
                && mSuggestedRetryTime == other.mSuggestedRetryTime
@@ -504,10 +504,35 @@ public final class DataCallResponse implements Parcelable {

    @Override
    public int hashCode() {
        // Generate order-independent hashes for lists
        int addressesHash = mAddresses.stream()
                .map(LinkAddress::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        int dnsAddressesHash = mDnsAddresses.stream()
                .map(InetAddress::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        int gatewayAddressesHash = mGatewayAddresses.stream()
                .map(InetAddress::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        int pcscfAddressesHash = mPcscfAddresses.stream()
                .map(InetAddress::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        int qosBearerSessionsHash = mQosBearerSessions.stream()
                .map(QosBearerSession::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        int trafficDescriptorsHash = mTrafficDescriptors.stream()
                .map(TrafficDescriptor::hashCode)
                .mapToInt(Integer::intValue)
                .sum();
        return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
                mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
                mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId, mDefaultQos,
                mQosBearerSessions, mSliceInfo, mTrafficDescriptors);
                mInterfaceName, addressesHash, dnsAddressesHash, gatewayAddressesHash,
                pcscfAddressesHash, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId,
                mDefaultQos, qosBearerSessionsHash, mSliceInfo, trafficDescriptorsHash);
    }

    @Override
@@ -817,7 +842,7 @@ public final class DataCallResponse implements Parcelable {
         * Set pdu session id.
         * <p/>
         * The id must be between 1 and 15 when linked to a pdu session. If no pdu session
         * exists for the current data call, the id must be set to {@link PDU_SESSION_ID_NOT_SET}.
         * exists for the current data call, the id must be set to {@link #PDU_SESSION_ID_NOT_SET}.
         *
         * @param pduSessionId Pdu Session Id of the data call.
         * @return The same instance of the builder.
@@ -858,6 +883,7 @@ public final class DataCallResponse implements Parcelable {
         */
        public @NonNull Builder setQosBearerSessions(
                @NonNull List<QosBearerSession> qosBearerSessions) {
            Objects.requireNonNull(qosBearerSessions);
            mQosBearerSessions = qosBearerSessions;
            return this;
        }
@@ -891,6 +917,7 @@ public final class DataCallResponse implements Parcelable {
         */
        public @NonNull Builder setTrafficDescriptors(
                @NonNull List<TrafficDescriptor> trafficDescriptors) {
            Objects.requireNonNull(trafficDescriptors);
            mTrafficDescriptors = trafficDescriptors;
            return this;
        }