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

Commit 53328b55 authored by Sangyun Yun's avatar Sangyun Yun Committed by Android (Google) Code Review
Browse files

Merge "Compare only values in database when updating SubsciptionInternal" into main

parents 229a304c 31d6c0b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1044,7 +1044,7 @@ public class SubscriptionDatabaseManager extends Handler {
                throw new IllegalArgumentException("updateSubscription: subscription does not "
                        + "exist. subId=" + subId);
            }
            if (oldSubInfo.equals(newSubInfo)) return;
            if (oldSubInfo.equalsDbItemsOnly(newSubInfo)) return;

            if (updateDatabase(subId, createDeltaContentValues(oldSubInfo, newSubInfo)) > 0) {
                mAllSubscriptionInfoInternalCache.put(subId, newSubInfo);
+19 −7
Original line number Diff line number Diff line
@@ -454,12 +454,13 @@ public class SubscriptionInfoInternal {
     */
    private final int mIsOnlyNonTerrestrialNetwork;

    // Below are the fields that do not exist in the SimInfo table.
    // This field does not exist in the SimInfo table.
    /**
     * The card ID of the SIM card. This maps uniquely to {@link #mCardString}.
     */
    private final int mCardId;

    // This field does not exist in the SimInfo table.
    /**
     * Whether group of the subscription is disabled. This is only useful if it's a grouped
     * opportunistic subscription. In this case, if all primary (non-opportunistic) subscriptions
@@ -1370,11 +1371,14 @@ public class SubscriptionInfoInternal {
                + "]";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SubscriptionInfoInternal that = (SubscriptionInfoInternal) o;
    /**
     * Campare only the columns existing in the SimInfo table and the mapped variables to see if
     * they are equal.
     *
     * @param that SubscriptionInfoInternal to be compared
     * @return {@code true} if equals.
     */
    public boolean equalsDbItemsOnly(@NonNull SubscriptionInfoInternal that) {
        return mId == that.mId && mSimSlotIndex == that.mSimSlotIndex
                && mDisplayNameSource == that.mDisplayNameSource && mIconTint == that.mIconTint
                && mDataRoaming == that.mDataRoaming && mIsEmbedded == that.mIsEmbedded
@@ -1407,7 +1411,6 @@ public class SubscriptionInfoInternal {
                && mPortIndex == that.mPortIndex && mUsageSetting == that.mUsageSetting
                && mLastUsedTPMessageReference == that.mLastUsedTPMessageReference
                && mUserId == that.mUserId && mIsSatelliteEnabled == that.mIsSatelliteEnabled
                && mCardId == that.mCardId && mIsGroupDisabled == that.mIsGroupDisabled
                && mIccId.equals(that.mIccId) && mDisplayName.equals(that.mDisplayName)
                && mCarrierName.equals(that.mCarrierName) && mNumber.equals(that.mNumber)
                && mMcc.equals(that.mMcc) && mMnc.equals(that.mMnc) && mEhplmns.equals(
@@ -1430,6 +1433,15 @@ public class SubscriptionInfoInternal {
                && mSatelliteEntitlementPlmns == that.mSatelliteEntitlementPlmns;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SubscriptionInfoInternal that = (SubscriptionInfoInternal) o;
        return equalsDbItemsOnly(that)
                && mCardId == that.mCardId && mIsGroupDisabled == that.mIsGroupDisabled;
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(mId, mIccId, mSimSlotIndex, mDisplayName, mCarrierName,