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

Commit fb008c24 authored by Roshan Pius's avatar Roshan Pius
Browse files

Check if numbers have changed to update the contact cache.

Along with checking if the call ID's are the same, add a check to see if
the 2 phone call numbers are still the same to correctly update the
contact info cache used to present the UI to the user.

Bug: 20032056
Change-Id: I81bcc6b31df9fa12c3a399ce6a2897662a1be74b
parent 2b9b9d41
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.telecom.GatewayInfo;
import android.telecom.InCallService.VideoCall;
import android.telecom.PhoneAccountHandle;
import android.telecom.VideoProfile;
import android.text.TextUtils;

import java.util.ArrayList;
import java.util.List;
@@ -538,6 +539,17 @@ public class Call {
        return call1.getId().equals(call2.getId());
    }

    public static boolean areSameNumber(Call call1, Call call2) {
        if (call1 == null && call2 == null) {
            return true;
        } else if (call1 == null || call2 == null) {
            return false;
        }

        // otherwise compare call Numbers
        return TextUtils.equals(call1.getNumber(), call2.getNumber());
    }

    public int getSessionModificationState() {
        return mSessionModificationState;
    }
+4 −2
Original line number Diff line number Diff line
@@ -201,8 +201,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
        Log.d(this, "Primary call: " + primary);
        Log.d(this, "Secondary call: " + secondary);

        final boolean primaryChanged = !Call.areSame(mPrimary, primary);
        final boolean secondaryChanged = !Call.areSame(mSecondary, secondary);
        final boolean primaryChanged = !(Call.areSame(mPrimary, primary) &&
                Call.areSameNumber(mPrimary, primary));
        final boolean secondaryChanged = !(Call.areSame(mSecondary, secondary) &&
                Call.areSameNumber(mSecondary, secondary));

        mSecondary = secondary;
        Call previousPrimary = mPrimary;