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

Commit b213354c authored by Roshan Pius's avatar Roshan Pius Committed by Android Git Automerger
Browse files

am 6f752c88: Migrate existing SIP PhoneAccount IDs to username.

* commit '6f752c88':
  Migrate existing SIP PhoneAccount IDs to username.
parents 417184b1 6f752c88
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public final class PhoneAccountRegistrar {

    private static final String FILE_NAME = "phone-account-registrar-state.xml";
    @VisibleForTesting
    public static final int EXPECTED_STATE_VERSION = 7;
    public static final int EXPECTED_STATE_VERSION = 8;

    /** Keep in sync with the same in SipSettings.java */
    private static final String SIP_SHARED_PREFERENCES = "SIP_PREFERENCES";
@@ -1259,6 +1259,18 @@ public final class PhoneAccountRegistrar {
                        enabled = true;
                    }
                }
                if (version < 8) {
                    // Migrate the SIP account handle ids to use SIP username instead of SIP URI.
                    if (accountHandle.getComponentName().equals(sipComponentName)) {
                        Uri accountUri = Uri.parse(accountHandle.getId());
                        if (accountUri.getScheme() != null &&
                            accountUri.getScheme().equals(PhoneAccount.SCHEME_SIP)) {
                            accountHandle = new PhoneAccountHandle(accountHandle.getComponentName(),
                                    accountUri.getSchemeSpecificPart(),
                                    accountHandle.getUserHandle());
                        }
                    }
                }

                PhoneAccount.Builder builder = PhoneAccount.builder(accountHandle, label)
                        .setAddress(address)