Persist SRVCC-related properties in GsmConnection

Makes sure that PROPERTY_IS_DOWNGRADED_CONFERENCE and
CAPABILITY_CONFERENCE_HAS_NO_CHILDREN are not erased when
updateConnectionProperties and updateConnectionCapabilities are called.

Bug: 29806833
Change-Id: Id8e3a81845df0bc144a040c68709db111f467473
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index eec0951..c480baa 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -57,6 +57,17 @@
     }
 
     @Override
+    protected int buildConnectionProperties() {
+        int properties = super.buildConnectionProperties();
+        // PROPERTY_IS_DOWNGRADED_CONFERENCE is permanent on GSM connections -- once it is set, it
+        // should be retained.
+        if ((getConnectionProperties() & PROPERTY_IS_DOWNGRADED_CONFERENCE) != 0) {
+            properties |= PROPERTY_IS_DOWNGRADED_CONFERENCE;
+        }
+        return properties;
+    }
+
+    @Override
     protected int buildConnectionCapabilities() {
         int capabilities = super.buildConnectionCapabilities();
         capabilities |= CAPABILITY_MUTE;
@@ -69,6 +80,13 @@
                 capabilities |= CAPABILITY_HOLD;
             }
         }
+
+        // For GSM connections, CAPABILITY_CONFERENCE_HAS_NO_CHILDREN should be applied whenever
+        // PROPERTY_IS_DOWNGRADED_CONFERENCE is true.
+        if ((getConnectionProperties() & PROPERTY_IS_DOWNGRADED_CONFERENCE) != 0) {
+            capabilities |= CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
+        }
+
         return capabilities;
     }
 
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index b6bbcac..241d54c 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -748,6 +748,9 @@
             if (!Objects.equals(address, getAddress()) ||
                     presentation != getAddressPresentation()) {
                 Log.v(this, "updateAddress, address changed");
+                if ((getConnectionProperties() & PROPERTY_IS_DOWNGRADED_CONFERENCE) != 0) {
+                    address = null;
+                }
                 setAddress(address, presentation);
             }