am 36164a6e: am 5c881446: am 6f752c88: Migrate existing SIP PhoneAccount IDs to username.
* commit '36164a6ea15aff5a6b9e17eb6246bdef1359c691':
Migrate existing SIP PhoneAccount IDs to username.
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index d500eda..a18fcc0 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -121,7 +121,7 @@
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 @@
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)