Merge "Hook up emergency metrics"
diff --git a/src/com/android/server/telecom/Analytics.java b/src/com/android/server/telecom/Analytics.java
index dbe1a29..c7b8afd 100644
--- a/src/com/android/server/telecom/Analytics.java
+++ b/src/com/android/server/telecom/Analytics.java
@@ -160,6 +160,9 @@
         public void setCallIsAdditional(boolean isAdditional) {
         }
 
+        public void setCallIsEmergency(boolean isEmergency) {
+        }
+
         public void setCallIsInterrupted(boolean isInterrupted) {
         }
 
@@ -295,6 +298,12 @@
         }
 
         @Override
+        public void setCallIsEmergency(boolean isEmergency) {
+            Log.d(TAG, "setting call as emergency: " + isEmergency);
+            this.isEmergency = isEmergency;
+        }
+
+        @Override
         public void setCallDisconnectCause(DisconnectCause disconnectCause) {
             Log.d(TAG, "setting disconnectCause for call " + callId + " to " + disconnectCause);
             this.callTerminationReason = disconnectCause;
@@ -361,6 +370,7 @@
                     + "    direction: " + getCallDirectionString() + '\n'
                     + "    isAdditionalCall: " + isAdditionalCall + '\n'
                     + "    isInterrupted: " + isInterrupted + '\n'
+                    + "    isEmergency: " + isEmergency + '\n'
                     + "    callTechnologies: " + getCallTechnologiesAsString() + '\n'
                     + "    callTerminationReason: " + getCallDisconnectReasonString() + '\n'
                     + "    connectionService: " + connectionService + '\n'
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 29ef183..bb382a9 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -414,7 +414,7 @@
     private final TelecomSystem.SyncRoot mLock;
     private final String mId;
     private String mConnectionId;
-    private Analytics.CallInfo mAnalytics;
+    private Analytics.CallInfo mAnalytics = new Analytics.CallInfo();
     private char mPlayingDtmfTone;
 
     private boolean mWasConferencePreviouslyMerged = false;
@@ -580,7 +580,6 @@
         mShouldAttachToExistingConnection = shouldAttachToExistingConnection
                 || callDirection == CALL_DIRECTION_INCOMING;
         maybeLoadCannedSmsResponses();
-        mAnalytics = new Analytics.CallInfo();
         mClockProxy = clockProxy;
         mCreationTimeMillis = mClockProxy.currentTimeMillis();
     }
@@ -657,6 +656,7 @@
                 analyticsDirection = Analytics.UNKNOWN_DIRECTION;
         }
         mAnalytics = Analytics.initiateCallAnalytics(mId, analyticsDirection);
+        mAnalytics.setCallIsEmergency(mIsEmergencyCall);
         Log.addEvent(this, LogUtils.Events.CREATED);
     }
 
@@ -1033,6 +1033,7 @@
                 mIsEmergencyCall = mHandle != null &&
                         mPhoneNumberUtilsAdapter.isLocalEmergencyNumber(mContext,
                                 mHandle.getSchemeSpecificPart());
+                mAnalytics.setCallIsEmergency(mIsEmergencyCall);
             }
             startCallerInfoLookup();
             for (Listener l : mListeners) {