Reset IMS Capabilities when IMS disconnects
Brad Ebinger [Wed, 10 May 2017 22:54:49 +0000 (15:54 -0700)]
When IMS deregisters, reset the IMS capabilities
to false so we do not accidently return the wrong
result for TelephonyManager.isVolteAvailable()
if the ImsService does not set the capabilities to
false before deregistering.

Test: Telephony Unit Tests
Bug: 36374918
Change-Id: I42b066f8a97770f23d71a0c646f384f7cbfdb57b

src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java

index 3f171fa..3de4896 100644 (file)
@@ -2476,6 +2476,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
         @Override
         public void onImsDisconnected(ImsReasonInfo imsReasonInfo) {
             if (DBG) log("onImsDisconnected imsReasonInfo=" + imsReasonInfo);
+            resetImsCapabilities();
             mPhone.setServiceState(ServiceState.STATE_OUT_OF_SERVICE);
             mPhone.setImsRegistered(false);
             mPhone.processDisconnectReason(imsReasonInfo);
@@ -3199,6 +3200,13 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
         }
     }
 
+    private void resetImsCapabilities() {
+        log("Resetting Capabilities...");
+        for (int i = 0; i < mImsFeatureEnabled.length; i++) {
+            mImsFeatureEnabled[i] = false;
+        }
+    }
+
     /**
      * @return {@code true} if the device is connected to a WIFI network, {@code false} otherwise.
      */