Enable all older SIP-based accounts

Bug: 21436375
Change-Id: I1ba32804ba80fb32a961872c8fa0fcda7a49c831
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index cab2f41..0b1f722 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -117,7 +117,7 @@
 
     private static final String FILE_NAME = "phone-account-registrar-state.xml";
     @VisibleForTesting
-    public static final int EXPECTED_STATE_VERSION = 5;
+    public static final int EXPECTED_STATE_VERSION = 6;
 
     /** Keep in sync with the same in SipSettings.java */
     private static final String SIP_SHARED_PREFERENCES = "SIP_PREFERENCES";
@@ -1189,11 +1189,11 @@
                     }
                 }
 
+                ComponentName sipComponentName = new ComponentName("com.android.phone",
+                        "com.android.services.telephony.sip.SipConnectionService");
+
                 // Upgrade older phone accounts to specify the supported URI schemes.
                 if (version < 2) {
-                    ComponentName sipComponentName = new ComponentName("com.android.phone",
-                            "com.android.services.telephony.sip.SipConnectionService");
-
                     supportedUriSchemes = new ArrayList<>();
 
                     // Handle the SIP connection service.
@@ -1217,6 +1217,13 @@
                     }
                 }
 
+                if (version < 6) {
+                    // Always enable all SIP accounts on upgrade to version 6
+                    if (accountHandle.getComponentName().equals(sipComponentName)) {
+                        enabled = true;
+                    }
+                }
+
                 PhoneAccount.Builder builder = PhoneAccount.builder(accountHandle, label)
                         .setAddress(address)
                         .setSubscriptionAddress(subscriptionAddress)