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

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

Merge "fix Telecom out of sync w/ Telephony#defaultVoiceSubId" into tm-qpr-dev

parents 891dfe33 44f5e141
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -287,6 +287,12 @@ public class PhoneAccountRegistrar {
        if (account != null) {
            return defaultPhoneAccountHandle.phoneAccountHandle;
        }

        Log.v(this,
                "getUserSelectedOutgoingPhoneAccount: defaultPhoneAccountHandle"
                        + ".phoneAccountHandle=[%s] is not registered or owned by %s"
                , defaultPhoneAccountHandle.phoneAccountHandle, userHandle);

        return null;
    }

@@ -343,6 +349,15 @@ public class PhoneAccountRegistrar {
                mState.defaultOutgoingAccountHandles.get(userHandle);
        PhoneAccountHandle currentDefaultPhoneAccount = currentDefaultInfo == null ? null :
                currentDefaultInfo.phoneAccountHandle;

        Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s", accountHandle);

        if (Objects.equals(currentDefaultPhoneAccount, accountHandle)) {
            Log.i(this, "setUserSelectedOutgoingPhoneAccount: "
                    + "no change in default phoneAccountHandle.  current is same as new.");
            return;
        }

        boolean isSimAccount = false;
        if (accountHandle == null) {
            // Asking to clear the default outgoing is a valid request
@@ -371,10 +386,8 @@ public class PhoneAccountRegistrar {
                    .put(userHandle, new DefaultPhoneAccountHandle(userHandle, accountHandle,
                            account.getGroupId()));
        }
        Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s", accountHandle);

        // Potentially update the default voice subid in SubscriptionManager.
        if (!Objects.equals(currentDefaultPhoneAccount, accountHandle)) {
        int newSubId = accountHandle == null ? SubscriptionManager.INVALID_SUBSCRIPTION_ID :
                getSubscriptionIdForPhoneAccount(accountHandle);
        if (isSimAccount || accountHandle == null) {
@@ -383,12 +396,11 @@ public class PhoneAccountRegistrar {
                Log.i(this, "setUserSelectedOutgoingPhoneAccount: update voice sub; "
                        + "account=%s, subId=%d", accountHandle, newSubId);
                mSubscriptionManager.setDefaultVoiceSubscriptionId(newSubId);
                }
            } else {
                Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s is not a sub", accountHandle);
                Log.i(this, "setUserSelectedOutgoingPhoneAccount: no change to voice sub");
            }
        } else {
            Log.i(this, "setUserSelectedOutgoingPhoneAccount: no change to voice sub");
            Log.i(this, "setUserSelectedOutgoingPhoneAccount: %s is not a sub", accountHandle);
        }

        write();