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

Commit 9b20cdf3 authored by Thomas Stuart's avatar Thomas Stuart Committed by Android (Google) Code Review
Browse files

Revert "add CTS coverage for SM calls with sim based defaults"

Revert "add CTS coverage for SM calls with sim based defaults"

Revert submission 19776096-selfManagedDsdsCallTests

Reason for revert: causing 2 telecom tests to be flaky
Reverted Changes:
I5090c601c:add CTS coverage for SM calls with sim based defau...
I1c2b4202e:add CTS coverage for SM calls with sim based defau...

Change-Id: I8b09cd5d7fe042b9459be0b98d4a39276b86f045
parent e9954050
Loading
Loading
Loading
Loading
+9 −23
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.UserManager;
import android.provider.Settings;
import android.telecom.CallAudioState;
import android.telecom.ConnectionService;
import android.telecom.DefaultDialerManager;
import android.telecom.Log;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
@@ -57,6 +58,7 @@ import android.util.Xml;

// TODO: Needed for move to system service: import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.XmlUtils;

@@ -64,6 +66,7 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -82,9 +85,12 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Handles writing and reading PhoneAccountHandle registration entries. This is a simple verbatim
@@ -157,6 +163,7 @@ public class PhoneAccountRegistrar {

    /** Keep in sync with the same in SipSettings.java */
    private static final String SIP_SHARED_PREFERENCES = "SIP_PREFERENCES";

    private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
    private final AtomicFile mAtomicFile;
    private final Context mContext;
@@ -380,11 +387,10 @@ public class PhoneAccountRegistrar {
                            account.getGroupId()));
        }

        // Potentially update the default voice subid in SubscriptionManager so that Telephony and
        // Telecom are in sync.
        // Potentially update the default voice subid in SubscriptionManager.
        int newSubId = accountHandle == null ? SubscriptionManager.INVALID_SUBSCRIPTION_ID :
                getSubscriptionIdForPhoneAccount(accountHandle);
        if (shouldUpdateTelephonyDefaultVoiceSubId(accountHandle, isSimAccount, newSubId)) {
        if (isSimAccount || accountHandle == null) {
            int currentVoiceSubId = mSubscriptionManager.getDefaultVoiceSubscriptionId();
            if (newSubId != currentVoiceSubId) {
                Log.i(this, "setUserSelectedOutgoingPhoneAccount: update voice sub; "
@@ -401,26 +407,6 @@ public class PhoneAccountRegistrar {
        fireDefaultOutgoingChanged();
    }

    private boolean shouldUpdateTelephonyDefaultVoiceSubId(PhoneAccountHandle phoneAccountHandle,
            boolean isSimAccount, int newSubId) {

        // user requests no call preference
        if (phoneAccountHandle == null) {
            return true;
        }

        // do not update Telephony if the newSubId is invalid
        if (newSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            Log.w(this, "shouldUpdateTelephonyDefaultVoiceSubId: "
                            + "invalid subId scenario, not updating Telephony. "
                            + "phoneAccountHandle=[%s], isSimAccount=[%b], newSubId=[%s]",
                    phoneAccountHandle, isSimAccount, newSubId);
            return false;
        }

        return isSimAccount;
    }

    boolean isUserSelectedSmsPhoneAccount(PhoneAccountHandle accountHandle) {
        return getSubscriptionIdForPhoneAccount(accountHandle) ==
                SubscriptionManager.getDefaultSmsSubscriptionId();