summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/stats/LauncherStats.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/stats/LauncherStats.java')
-rw-r--r--src/com/android/launcher3/stats/LauncherStats.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/com/android/launcher3/stats/LauncherStats.java b/src/com/android/launcher3/stats/LauncherStats.java
index e1dd1bbc6..5e8cb83d5 100644
--- a/src/com/android/launcher3/stats/LauncherStats.java
+++ b/src/com/android/launcher3/stats/LauncherStats.java
@@ -16,12 +16,12 @@
package com.android.launcher3.stats;
+import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
-import com.android.launcher3.LauncherApplication;
import com.android.launcher3.stats.internal.db.DatabaseHelper;
import com.android.launcher3.stats.internal.model.TrackingEvent;
@@ -41,6 +41,9 @@ public class LauncherStats {
public static final String ORIGIN_APPDRAWER = "appdrawer";
public static final String ORIGIN_TREB_LONGPRESS = "trebuchet_longpress";
public static final String ORIGIN_CHOOSER = "theme_chooser";
+ public static final String ORIGIN_SETTINGS = "settings";
+ public static final String ORIGIN_DRAG_DROP = "drag_drop";
+ public static final String ORIGIN_FOLDER = "folder";
private static void log(String msg) throws IllegalArgumentException {
if (TextUtils.isEmpty(msg)) {
@@ -101,17 +104,16 @@ public class LauncherStats {
private static LauncherStats sInstance = null;
// Members
- private static WriteHandlerThread sHandlerThread = new WriteHandlerThread();
+ private static WriteHandlerThread sHandlerThread;
private static WriteHandler sWriteHandler;
private static DatabaseHelper sDatabaseHelper;
- private LauncherApplication mApplication;
/**
* Send a message to the handler to store event data
*
* @param trackingEvent {@link TrackingEvent}
*/
- private void sendStoreEventMessage(TrackingEvent trackingEvent) {
+ protected void sendStoreEventMessage(TrackingEvent trackingEvent) {
log("Sending tracking event to handler: " + trackingEvent);
Message msg = new Message();
msg.what = MSG_STORE_EVENT;
@@ -134,32 +136,37 @@ public class LauncherStats {
}
/**
+ * Used only for overlay extensions
+ */
+ protected LauncherStats() { }
+
+ /**
* Constructor
*
- * @param application {@link LauncherApplication} not null!
+ * @param context {@link Context} not null!
* @throws IllegalArgumentException {@link IllegalArgumentException}
*/
- private LauncherStats(LauncherApplication application) throws IllegalArgumentException {
- if (application == null) {
- throw new IllegalArgumentException("'application' cannot be null!");
+ private LauncherStats(Context context) throws IllegalArgumentException {
+ if (context == null) {
+ throw new IllegalArgumentException("'context' cannot be null!");
}
- mApplication = application;
- sDatabaseHelper = new DatabaseHelper(application);
+ sDatabaseHelper = new DatabaseHelper(context);
+ sHandlerThread = new WriteHandlerThread();
sHandlerThread.start();
sWriteHandler = new WriteHandler();
}
/**
- * Creates a singleton instance of the stats utility
+ * Gets a singleton instance of the stats utility
*
- * @param application {@link LauncherApplication} not null!
+ * @param context {@link Context} not null!
* @return {@link LauncherStats}
* @throws IllegalArgumentException {@link IllegalArgumentException}
*/
- public static LauncherStats createInstance(LauncherApplication application)
+ public static LauncherStats getInstance(Context context)
throws IllegalArgumentException {
if (sInstance == null) {
- sInstance = new LauncherStats(application);
+ sInstance = new LauncherStats(context);
}
return sInstance;
}