SipSettings: handle more registration error codes.

Change-Id: I68da7868ed37b5866a9e275000d7cc0b77a11fa5
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 16bad77..6965284 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1299,15 +1299,19 @@
     <!-- Text of Internet-call registration status, still trying to register with SIP server [CHAR LIMIT=NONE] -->
     <string name="registration_status_still_trying">Still trying...</string>
     <!-- Text of Internet-call registration status, currently not receiving calls on this account [CHAR LIMIT=NONE] -->
-    <string name="registration_status_not_receiving">Not receiving calls</string>
+    <string name="registration_status_not_receiving">Not receiving calls.</string>
+    <!-- Text of Internet-call registration status, no data connection [CHAR LIMIT=NONE] -->
+    <string name="registration_status_no_data">No data connection, registration stopped.</string>
+    <!-- Text of Internet-call registration status, registration process is not running due to some error [CHAR LIMIT=NONE] -->
+    <string name="registration_status_not_running">Registration stopped due to error(s).</string>
     <!-- Text of Internet-call registration status, currently we can receive calls on this account [CHAR LIMIT=NONE] -->
-    <string name="registration_status_done">Receiving calls</string>
+    <string name="registration_status_done">Receiving calls.</string>
     <!-- Text of Internet-call registration status, registration failed with a reason; will try again later [CHAR LIMIT=NONE] -->
-    <string name="registration_status_failed_try_later">Registration failed (<xliff:g id="registration_error_message" example="timed out">%s</xliff:g>); will try later</string>
+    <string name="registration_status_failed_try_later">Registration failed (<xliff:g id="registration_error_message" example="timed out">%s</xliff:g>); will try later.</string>
     <!-- Text of Internet-call registration status, registration failed with a reason [CHAR LIMIT=NONE] -->
-    <string name="registration_status_failed">Registration failed (<xliff:g id="registration_error_message" example="timed out">%s</xliff:g>)</string>
+    <string name="registration_status_failed">Registration failed (<xliff:g id="registration_error_message" example="timed out">%s</xliff:g>).</string>
     <!-- Text for describing the account's owner and status. For example, 'Active, in use by Google Talk', it means that the account managed by SIP service was registered by the application 'Google Talk' and the status is active. [CHAR LIMIT=NONE] -->
-    <string name="third_party_account_summary">Active, in use by <xliff:g id="account_owner" example="Google Talk">%s</xliff:g></string>
+    <string name="third_party_account_summary">Active, in use by <xliff:g id="account_owner" example="Google Talk">%s</xliff:g>.</string>
 
 
     <!-- Title of the sip editor screen. [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/phone/sip/SipSettings.java b/src/com/android/phone/sip/SipSettings.java
index 028cb3a..d6ad69a 100644
--- a/src/com/android/phone/sip/SipSettings.java
+++ b/src/com/android/phone/sip/SipSettings.java
@@ -322,6 +322,10 @@
         mSipListContainer.removeAll();
         for (SipProfile p : mSipProfileList) {
             addPreferenceFor(p);
+        }
+
+        if (!mSipSharedPreferences.isReceivingCallsEnabled()) return;
+        for (SipProfile p : mSipProfileList) {
             if (mUid == p.getCallingUid()) {
                 try {
                     mSipManager.setRegistrationListener(
@@ -504,6 +508,14 @@
                         showRegistrationMessage(profileUri, getString(
                                 R.string.registration_status_failed, message));
                         break;
+                    case SipErrorCode.DATA_CONNECTION_LOST:
+                        showRegistrationMessage(profileUri, getString(
+                                R.string.registration_status_no_data));
+                        break;
+                    case SipErrorCode.CLIENT_ERROR:
+                        showRegistrationMessage(profileUri, getString(
+                                R.string.registration_status_not_running));
+                        break;
                     default:
                         showRegistrationMessage(profileUri, getString(
                                 R.string.registration_status_failed_try_later,