am 5b32e8e7: am fa560f71: am d5c571df: am 1c96c6f8: Merge "Analytics: report the number of accounts used in the application" into ub-gmail-ur14-dev

* commit '5b32e8e75310ab1b84425a91c300b190d84f4254':
  Analytics: report the number of accounts used in the application
diff --git a/src/com/android/mail/preferences/MailPrefs.java b/src/com/android/mail/preferences/MailPrefs.java
index ae9fcfe..c8d83cd 100644
--- a/src/com/android/mail/preferences/MailPrefs.java
+++ b/src/com/android/mail/preferences/MailPrefs.java
@@ -125,6 +125,12 @@
 
         public static final String MIGRATION_STATE = "migration-state";
 
+        /**
+         * The time in epoch ms when the number of accounts in the app was reported to analytics.
+         */
+        public static final String ANALYTICS_NB_ACCOUNT_LATEST_REPORT =
+                "analytics-send-nb_accounts-epoch";
+
         // State indicating that no migration has yet occurred.
         public static final int MIGRATION_STATE_NONE = 0;
         // State indicating that we have migrated imap and pop accounts, but not
@@ -582,4 +588,20 @@
     public void setRequiredSanitizerVersionNumber(int versionNumber) {
         getEditor().putInt(PreferenceKeys.REQUIRED_SANITIZER_VERSION_NUMBER, versionNumber).apply();
     }
+
+    /**
+     * Returns the latest time the number of accounts in the application was sent to Analyitcs.
+     * @return the datetime in epoch milliseconds.
+     */
+    public long getNbAccountsLatestReport() {
+        return getSharedPreferences().getLong(PreferenceKeys.ANALYTICS_NB_ACCOUNT_LATEST_REPORT, 0);
+    }
+
+    /**
+     * Set the latest time the number of accounts in the application was sent to Analytics.
+     */
+    public void setNbAccountsLatestReport(long timeMs) {
+        getEditor().putLong(
+                PreferenceKeys.ANALYTICS_NB_ACCOUNT_LATEST_REPORT, timeMs);
+    }
 }