Merge "Switch DDS on MSIM emergency call" into qt-dev
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index fed41b0..0f8f146 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -796,6 +796,7 @@
         pw.println("mNoDataDueToRoaming=" + mNoDataDueToRoaming);
         pw.println("mDefaultDataSubId=" + mDefaultDataSubId);
         pw.println("mDataRoamingNotifLog:");
+        pw.println("isSmsCapable=" + TelephonyManager.from(this).isSmsCapable());
         pw.increaseIndent();
         mDataRoamingNotifLog.dump(fd, pw, args);
         pw.decreaseIndent();
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index ed1de19..d0ed9bd 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -7090,4 +7090,36 @@
             Binder.restoreCallingIdentity(identity);
         }
     }
+
+    @Override
+    public boolean setDataAllowedDuringVoiceCall(int subId, boolean allow) {
+        enforceModifyPermission();
+
+        // Now that all security checks passes, perform the operation as ourselves.
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            Phone phone = getPhone(subId);
+            if (phone == null) return false;
+
+            return phone.getDataEnabledSettings().setAllowDataDuringVoiceCall(allow);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
+    }
+
+    @Override
+    public boolean isDataAllowedInVoiceCall(int subId) {
+        enforceReadPrivilegedPermission("isDataAllowedInVoiceCall");
+
+        // Now that all security checks passes, perform the operation as ourselves.
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            Phone phone = getPhone(subId);
+            if (phone == null) return false;
+
+            return phone.getDataEnabledSettings().isDataAllowedInVoiceCall();
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
+    }
 }
diff --git a/src/com/android/services/telephony/ConferenceParticipantConnection.java b/src/com/android/services/telephony/ConferenceParticipantConnection.java
index 1f330f9..651ace5 100644
--- a/src/com/android/services/telephony/ConferenceParticipantConnection.java
+++ b/src/com/android/services/telephony/ConferenceParticipantConnection.java
@@ -53,10 +53,13 @@
      * Creates a new instance.
      *
      * @param participant The conference participant to create the instance for.
+     * @param isRemotelyHosted {@code true} if this participant is part of a conference remotely
+     *                         hosted on another device, {@code false} otherwise.
      */
     public ConferenceParticipantConnection(
             com.android.internal.telephony.Connection parentConnection,
-            ConferenceParticipant participant) {
+            ConferenceParticipant participant,
+            boolean isRemotelyHosted) {
 
         mParentConnection = parentConnection;
 
@@ -75,7 +78,7 @@
         mUserEntity = participant.getHandle();
         mEndpoint = participant.getEndpoint();
 
-        setCapabilities();
+        setCapabilitiesAndProperties(isRemotelyHosted);
     }
 
     /**
@@ -147,13 +150,19 @@
     }
 
     /**
-     * Configures the capabilities applicable to this connection.  A
+     * Configures the capabilities and properties applicable to this connection.  A
      * conference participant can only be disconnected from a conference since there is not
      * actual connection to the participant which could be split from the conference.
+     * @param isRemotelyHosted {@code true} if this participant is part of a conference hosted
+     *                         hosted on a remote device, {@code false} otherwise.
      */
-    private void setCapabilities() {
+    private void setCapabilitiesAndProperties(boolean isRemotelyHosted) {
         int capabilities = CAPABILITY_DISCONNECT_FROM_CONFERENCE;
         setConnectionCapabilities(capabilities);
+
+        if (isRemotelyHosted) {
+            setConnectionProperties(PROPERTY_REMOTELY_HOSTED);
+        }
     }
 
 
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 8cd8051..9b66487 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -395,6 +395,9 @@
                 Connection.PROPERTY_IS_EXTERNAL_CALL,
                 can(properties, Connection.PROPERTY_IS_EXTERNAL_CALL));
 
+        conferenceProperties = changeBitmask(conferenceProperties,
+                Connection.PROPERTY_REMOTELY_HOSTED, !isConferenceHost());
+
         return conferenceProperties;
     }
 
@@ -683,6 +686,16 @@
                     mConferenceHostPhoneAccountHandle);
         }
 
+        // If the conference is not hosted on this device copy over the address and presentation and
+        // connect times so that we can log this appropriately in the call log.
+        if (!isConferenceHost()) {
+            setAddress(mConferenceHost.getAddress(), mConferenceHost.getAddressPresentation());
+            setCallerDisplayName(mConferenceHost.getCallerDisplayName(),
+                    mConferenceHost.getCallerDisplayNamePresentation());
+            setConnectionStartElapsedRealTime(mConferenceHost.getConnectElapsedTimeMillis());
+            setConnectionTime(mConferenceHost.getConnectTimeMillis());
+        }
+
         mConferenceHost.addConnectionListener(mConferenceHostListener);
         mConferenceHost.addTelephonyConnectionListener(mTelephonyConnectionListener);
         setConnectionCapabilities(applyHostCapabilities(getConnectionCapabilities(),
@@ -952,7 +965,8 @@
         // Create and add the new connection in holding state so that it does not become the
         // active call.
         ConferenceParticipantConnection connection = new ConferenceParticipantConnection(
-                parent.getOriginalConnection(), participant);
+                parent.getOriginalConnection(), participant,
+                !isConferenceHost() /* isRemotelyHosted */);
         connection.addConnectionListener(mParticipantListener);
         if (participant.getConnectTime() == 0) {
             connection.setConnectTimeMillis(parent.getConnectTimeMillis());