summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Shvadskiy <ashvadskiy@cyngn.com>2016-03-17 22:11:55 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-03-21 20:27:37 (GMT)
commit27f915deda69206c7707fb8139c73de442cd5c1c (patch)
treeb27e9c24e461a5f8473501dc1abbd1d752121bf9
parent153b4cea501d68c90a442fbd286e6e77c86acbf3 (diff)
downloadandroid_packages_apps_Trebuchet-27f915deda69206c7707fb8139c73de442cd5c1c.zip
android_packages_apps_Trebuchet-27f915deda69206c7707fb8139c73de442cd5c1c.tar.gz
android_packages_apps_Trebuchet-27f915deda69206c7707fb8139c73de442cd5c1c.tar.bz2
Fix metric reporting for remote folder
Change-Id: I07ff54f2bd2c615ffb8625b4016704468bfb006f issue-id: CYNGNOS-2251
-rw-r--r--RemoteFolder/src/com/android/launcher3/stats/internal/model/RemoteFolderAction.java30
-rw-r--r--src/com/android/launcher3/stats/internal/model/TrackingEvent.java14
-rw-r--r--src/com/android/launcher3/stats/internal/service/AggregationIntentService.java36
3 files changed, 53 insertions, 27 deletions
diff --git a/RemoteFolder/src/com/android/launcher3/stats/internal/model/RemoteFolderAction.java b/RemoteFolder/src/com/android/launcher3/stats/internal/model/RemoteFolderAction.java
new file mode 100644
index 0000000..dc36332
--- /dev/null
+++ b/RemoteFolder/src/com/android/launcher3/stats/internal/model/RemoteFolderAction.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016. The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.stats.internal.model;
+
+import android.os.Bundle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RemoteFolderAction implements ITrackingAction {
+ @Override
+ public List<Bundle> createTrackingBundles(String trackingId, TrackingEvent.Category category,
+ List<TrackingEvent> eventList) {
+ return new ArrayList<Bundle>();
+ }
+}
diff --git a/src/com/android/launcher3/stats/internal/model/TrackingEvent.java b/src/com/android/launcher3/stats/internal/model/TrackingEvent.java
index 552dac7..44aaeb3 100644
--- a/src/com/android/launcher3/stats/internal/model/TrackingEvent.java
+++ b/src/com/android/launcher3/stats/internal/model/TrackingEvent.java
@@ -51,23 +51,13 @@ public class TrackingEvent {
WALLPAPER_CHANGE,
HOMESCREEN_PAGE,
WIDGET,
-
- // Remote folder specific
- REMOTE_FOLDER_DISABLED,
- REMOTE_DRAWER_DISABLED,
- REMOTE_FOLDER_OPENED,
- REMOTE_FOLDER_INFO_OPENED,
- REMOTE_APP_OPENED,
- REMOTE_APP_INSTALLED,
- REMOTE_SYNC_TIME,
- REMOTE_SYNC_ERROR,
- REMOTE_SYNC_UNFILLED,
- REMOTE_FEATURE_DISABLED_FEEDBACK
+ REMOTE_FOLDER
}
public static final String KEY_ORIGIN = TrackingBundle.KEY_METADATA_ORIGIN;
public static final String KEY_VALUE = TrackingBundle.KEY_METADATA_VALUE;
public static final String KEY_PACKAGE = TrackingBundle.KEY_METADATA_PACKAGE;
+ public static final String KEY_ACTION = TrackingBundle.KEY_EVENT_ACTION;
/**
* Constructor
diff --git a/src/com/android/launcher3/stats/internal/service/AggregationIntentService.java b/src/com/android/launcher3/stats/internal/service/AggregationIntentService.java
index cd9eaf7..b32d79b 100644
--- a/src/com/android/launcher3/stats/internal/service/AggregationIntentService.java
+++ b/src/com/android/launcher3/stats/internal/service/AggregationIntentService.java
@@ -28,14 +28,15 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
+
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.LauncherApplication;
import com.android.launcher3.stats.external.StatsUtil;
import com.android.launcher3.stats.external.TrackingBundle;
import com.android.launcher3.stats.internal.db.DatabaseHelper;
import com.android.launcher3.stats.internal.model.CountAction;
import com.android.launcher3.stats.internal.model.CountOriginByPackageAction;
import com.android.launcher3.stats.internal.model.ITrackingAction;
+import com.android.launcher3.stats.internal.model.RemoteFolderAction;
import com.android.launcher3.stats.internal.model.TrackingEvent;
import com.android.launcher3.stats.util.Logger;
@@ -115,20 +116,15 @@ public class AggregationIntentService extends IntentService {
continue;
}
- // Now crunch the data into actionable events for the server
- for (ITrackingAction action : TRACKED_ACTIONS) {
- try {
- for (Bundle bundle : action.createTrackingBundles(TRACKING_ID, category,
- eventList)) {
- performTrackingCall(bundle);
- }
- } catch (NullPointerException e) {
- Log.e(TAG, "NPE fetching bundle list!", e);
- } catch (IllegalArgumentException e) {
- Log.e(TAG, "Illegal argument!", e);
+ // Now crunch the data into actionable events for the server.
+ // Remote Folder data will process itself separately.
+ if (category == TrackingEvent.Category.REMOTE_FOLDER) {
+ performTrackingCall(new RemoteFolderAction(), category, eventList);
+ } else {
+ for (ITrackingAction action : TRACKED_ACTIONS) {
+ performTrackingCall(action, category, eventList);
}
}
-
}
}
@@ -168,8 +164,18 @@ public class AggregationIntentService extends IntentService {
StatsUtil.sendEvent(this, bundle);
}
- private void performTrackingCall(Bundle bundle) throws IllegalArgumentException {
- StatsUtil.sendEvent(this, bundle);
+ private void performTrackingCall(ITrackingAction action, TrackingEvent.Category category,
+ List<TrackingEvent> eventList)
+ throws IllegalArgumentException {
+ try {
+ for (Bundle bundle : action.createTrackingBundles(TRACKING_ID, category, eventList)) {
+ StatsUtil.sendEvent(this, bundle);
+ }
+ } catch (NullPointerException e) {
+ Log.e(TAG, "NPE fetching bundle list!", e);
+ } catch (IllegalArgumentException e) {
+ Log.e(TAG, "Illegal argument!", e);
+ }
}
private void unscheduleService() {