fix view_folder analytics issues
* order-of-magnitude values were confusing. now they are just
the number of zeroes in the folder count (easy!)
* fix use of the obfuscated Fragment name in CLF screen views
* fix search 'folders' counting as "user_folder"
* fix account switch wrongly double-counting the origin folder
and not counting the dest folder
Change-Id: Ic602d3d0a8d5e98cdcee07dc4c2788068c9f181d
diff --git a/src/com/android/mail/providers/Folder.java b/src/com/android/mail/providers/Folder.java
index 88d8d81..8717d26 100644
--- a/src/com/android/mail/providers/Folder.java
+++ b/src/com/android/mail/providers/Folder.java
@@ -583,15 +583,18 @@
@Override
public String toString() {
// log extra info at DEBUG level or finer
- final StringBuilder sb = new StringBuilder("[folder id=");
+ final StringBuilder sb = new StringBuilder(super.toString());
+ sb.append("{id=");
sb.append(id);
if (LogUtils.isLoggable(LOG_TAG, LogUtils.DEBUG)) {
sb.append(", uri=");
sb.append(folderUri);
sb.append(", name=");
sb.append(name);
+ sb.append(", count=");
+ sb.append(totalCount);
}
- sb.append("]");
+ sb.append("}");
return sb.toString();
}
@@ -758,6 +761,8 @@
desc = "trash";
} else if (isType(FolderType.UNREAD)) {
desc = "unread";
+ } else if (isType(FolderType.SEARCH)) {
+ desc = "search";
} else if (isViewAll()) {
desc = "all_mail";
} else if (isProviderFolder()) {
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index 36885d1..34a1e16 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -605,7 +605,7 @@
public void onStart() {
super.onStart();
mHandler.postDelayed(mUpdateTimestampsRunnable, TIMESTAMP_UPDATE_INTERVAL);
- Analytics.getInstance().sendView(getClass().getName());
+ Analytics.getInstance().sendView("ConversationListFragment");
}
@Override
@@ -649,6 +649,21 @@
mListView.setEmptyView(null);
onFolderUpdated(mActivity.getFolderController().getFolder());
onConversationListStatusUpdated();
+
+ // try to get an order-of-magnitude sense for message count within folders
+ // (N.B. this count currently isn't working for search folders, since their counts stream
+ // in over time in pieces.)
+ final Folder f = mViewContext.folder;
+ if (f != null) {
+ final long countLog;
+ if (f.totalCount > 0) {
+ countLog = (long) Math.log10(f.totalCount);
+ } else {
+ countLog = 0;
+ }
+ Analytics.getInstance().sendEvent("view_folder", f.getTypeDescription(),
+ Long.toString(countLog), f.totalCount);
+ }
}
/**
@@ -884,19 +899,6 @@
saveLastScrolledPosition();
}
- // log the first cursor load. don't log on each updated cursor!
- if (newCursor != null && (mListAdapter == null || mListAdapter.getCursor() == null)) {
- // try to get an order-of-magnitude sense for message count within folders
- final long countLog;
- if (mFolder.totalCount > 0) {
- countLog = Math.round(Math.log10(mFolder.totalCount));
- } else {
- countLog = 0;
- }
- Analytics.getInstance().sendEvent("view_folder", mFolder.getTypeDescription(),
- Long.toString(countLog), mFolder.totalCount);
- }
-
mListAdapter.swapCursor(newCursor);
// When the conversation cursor is *updated*, we get back the same instance. In that
// situation, CursorAdapter.swapCursor() silently returns, without forcing a