Merge "Hide Save to drive in EML view. b/14277510." into ub-gmail-ur12-dev
diff --git a/src/com/android/mail/browse/EmlViewerActivity.java b/src/com/android/mail/browse/EmlViewerActivity.java
index 1812f13..ab3fd60 100644
--- a/src/com/android/mail/browse/EmlViewerActivity.java
+++ b/src/com/android/mail/browse/EmlViewerActivity.java
@@ -22,6 +22,7 @@
 import android.os.Bundle;
 
 import com.android.mail.R;
+import com.android.mail.analytics.Analytics;
 import com.android.mail.ui.AccountFeedbackActivity;
 import com.android.mail.utils.LogTag;
 import com.android.mail.utils.LogUtils;
@@ -47,6 +48,7 @@
                 transaction.add(R.id.root, EmlMessageViewFragment.newInstance(
                         intent.getData(), mAccountUri), FRAGMENT_TAG);
                 transaction.commit();
+                Analytics.getInstance().sendEvent("eml_viewer", null, null, 0);
             } else {
                 LogUtils.wtf(LOG_TAG,
                         "Entered EmlViewerActivity with wrong intent action or type: %s, %s",
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index bb5b1e9..30d3389 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -205,6 +205,8 @@
         }
     };
 
+    // Keep track of if we are waiting for the loading view. This variable is also used to check
+    // if the cursor corresponding to the current folder loaded (either partially or completely).
     private boolean mLoadingViewPending;
     private boolean mCanTakeDownLoadingView;
 
@@ -1146,13 +1148,11 @@
     /**
      * Extracted function that handles Analytics state and logging updates whenever a new non-null
      * cursor is set as the new cursor
-     * @param newCursor
+     * @param newCursor the new cursor pointer, cannot be null
      */
     private void updateAnalyticsData(ConversationCursor newCursor) {
-        Bundle extras = (newCursor.getExtras() != null) ? newCursor.getExtras() : Bundle.EMPTY;
-        int cursorStatus = extras.getInt(UIProvider.CursorExtraKeys.EXTRA_STATUS);
         // Check if the cursor is ready for display
-        if (!UIProvider.CursorStatus.isWaitingForResults(cursorStatus)) {
+        if (!mLoadingViewPending) {
             // If the count is 0, then we check which log is applicable
             if (newCursor.getCount() == 0) {
                 if (mJustLoadedNewList) {