Merge "Reset speakerphone at beginning and end of calls"
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index c516274..65f9b5a 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -477,6 +477,10 @@
      * Integer constant from {@link android.telecom.Call.RttCall}. Describes the current RTT mode.
      */
     private int mRttMode;
+    /**
+     * True if the call was ever an RTT call.
+     */
+    private boolean mWasEverRtt = false;
 
     /**
      * Integer indicating the remote RTT request ID that is pending a response from the user.
@@ -2383,6 +2387,7 @@
                 && mConnectionServiceToInCallStreams != null;
         if (shouldBeRtt && !areStreamsInitialized) {
             try {
+                mWasEverRtt = true;
                 mInCallToConnectionServiceStreams = ParcelFileDescriptor.createReliablePipe();
                 mConnectionServiceToInCallStreams = ParcelFileDescriptor.createReliablePipe();
             } catch (IOException e) {
@@ -2442,6 +2447,10 @@
         return (mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT;
     }
 
+    public boolean wasEverRttCall() {
+        return mWasEverRtt;
+    }
+
     public ParcelFileDescriptor getCsToInCallRttPipeForCs() {
         return mConnectionServiceToInCallStreams == null ? null
                 : mConnectionServiceToInCallStreams[RTT_PIPE_WRITE_SIDE_INDEX];
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index b509d08..ce062c0 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -230,7 +230,8 @@
                 call.getDisconnectCause().getCode() == DisconnectCause.CALL_PULLED,
                 shouldSaveHdInfo(call, accountHandle),
                 (call.getConnectionProperties() & Connection.PROPERTY_ASSISTED_DIALING_USED) ==
-                        Connection.PROPERTY_ASSISTED_DIALING_USED);
+                        Connection.PROPERTY_ASSISTED_DIALING_USED,
+                call.wasEverRttCall());
         logCall(call.getCallerInfo(), logNumber, call.getPostDialDigits(), formattedViaNumber,
                 call.getHandlePresentation(), callLogType, callFeatures, accountHandle,
                 creationTime, age, callDataUsage, call.isEmergencyCall(), call.getInitiatingUser(),
@@ -310,7 +311,7 @@
      * @return The call features.
      */
     private static int getCallFeatures(int videoState, boolean isPulledCall, boolean isStoreHd,
-                                       boolean isUsingAssistedDialing) {
+            boolean isUsingAssistedDialing, boolean isRtt) {
         int features = 0;
         if (VideoProfile.isVideo(videoState)) {
             features |= Calls.FEATURES_VIDEO;
@@ -324,6 +325,9 @@
         if (isUsingAssistedDialing) {
             features |= Calls.FEATURES_ASSISTED_DIALING_USED;
         }
+        if (isRtt) {
+            features |= Calls.FEATURES_RTT;
+        }
         return features;
     }