summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2013-04-28 12:44:55 -0700
committerBobby Georgescu <georgescu@google.com>2013-04-28 12:50:23 -0700
commit00c80bbed8cf59e374c6698c82a5d7fa830e2917 (patch)
tree94f8a6c9601b0b9c040613426a777a62e4f20917 /src/com
parentbeefbf5ad2ef69683f4c2f6c3d354b20c457a11c (diff)
downloadandroid_packages_apps_Snap-00c80bbed8cf59e374c6698c82a5d7fa830e2917.tar.gz
android_packages_apps_Snap-00c80bbed8cf59e374c6698c82a5d7fa830e2917.tar.bz2
android_packages_apps_Snap-00c80bbed8cf59e374c6698c82a5d7fa830e2917.zip
Instrument importer for usage statistics
Bug: 8744068 Change-Id: I416463ba15713d363ac0ce68109532b770fb02b3
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/ingest/ImportTask.java4
-rw-r--r--src/com/android/gallery3d/ingest/IngestActivity.java3
-rw-r--r--src/com/android/gallery3d/ingest/IngestService.java15
3 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/ingest/ImportTask.java b/src/com/android/gallery3d/ingest/ImportTask.java
index d82ccd61f..d850bb8e1 100644
--- a/src/com/android/gallery3d/ingest/ImportTask.java
+++ b/src/com/android/gallery3d/ingest/ImportTask.java
@@ -34,7 +34,7 @@ public class ImportTask implements Runnable {
public interface Listener {
void onImportProgress(int visitedCount, int totalCount, String pathIfSuccessful);
- void onImportFinish(Collection<MtpObjectInfo> objectsNotImported);
+ void onImportFinish(Collection<MtpObjectInfo> objectsNotImported, int visitedCount);
}
static private final String WAKELOCK_LABEL = "MTP Import Task";
@@ -84,7 +84,7 @@ public class ImportTask implements Runnable {
}
}
if (mListener != null) {
- mListener.onImportFinish(objectsNotImported);
+ mListener.onImportFinish(objectsNotImported, visited);
}
} finally {
mListener = null;
diff --git a/src/com/android/gallery3d/ingest/IngestActivity.java b/src/com/android/gallery3d/ingest/IngestActivity.java
index 893f59572..ffc4b50cd 100644
--- a/src/com/android/gallery3d/ingest/IngestActivity.java
+++ b/src/com/android/gallery3d/ingest/IngestActivity.java
@@ -440,7 +440,8 @@ public class IngestActivity extends Activity implements
}
@Override
- public void onImportFinish(Collection<MtpObjectInfo> objectsNotImported) {
+ public void onImportFinish(Collection<MtpObjectInfo> objectsNotImported,
+ int numVisited) {
// Not guaranteed to be called on the UI thread
mHandler.sendEmptyMessage(ItemListHandler.MSG_PROGRESS_HIDE);
// TODO: maybe show an extra dialog listing the ones that failed
diff --git a/src/com/android/gallery3d/ingest/IngestService.java b/src/com/android/gallery3d/ingest/IngestService.java
index 05cc6f936..0ce3ab6a9 100644
--- a/src/com/android/gallery3d/ingest/IngestService.java
+++ b/src/com/android/gallery3d/ingest/IngestService.java
@@ -38,6 +38,7 @@ import com.android.gallery3d.R;
import com.android.gallery3d.app.NotificationIds;
import com.android.gallery3d.data.MtpClient;
import com.android.gallery3d.util.BucketNames;
+import com.android.gallery3d.util.UsageStatistics;
import java.util.ArrayList;
import java.util.Collection;
@@ -63,6 +64,7 @@ public class IngestService extends Service implements ImportTask.Listener,
private MtpDeviceIndex mIndex;
private IngestActivity mClientActivity;
private boolean mRedeliverImportFinish = false;
+ private int mRedeliverImportFinishCount = 0;
private Collection<MtpObjectInfo> mRedeliverObjectsNotImported;
private boolean mRedeliverNotifyIndexChanged = false;
private boolean mRedeliverIndexFinish = false;
@@ -151,7 +153,8 @@ public class IngestService extends Service implements ImportTask.Listener,
mNotificationManager.cancel(NotificationIds.INGEST_NOTIFICATION_IMPORTING);
mNotificationManager.cancel(NotificationIds.INGEST_NOTIFICATION_SCANNING);
if (mRedeliverImportFinish) {
- mClientActivity.onImportFinish(mRedeliverObjectsNotImported);
+ mClientActivity.onImportFinish(mRedeliverObjectsNotImported,
+ mRedeliverImportFinishCount);
mRedeliverImportFinish = false;
mRedeliverObjectsNotImported = null;
}
@@ -188,6 +191,8 @@ public class IngestService extends Service implements ImportTask.Listener,
public void deviceAdded(MtpDevice device) {
if (mDevice == null) {
setDevice(device);
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_IMPORTER,
+ "DeviceConnected", null);
}
}
@@ -217,19 +222,23 @@ public class IngestService extends Service implements ImportTask.Listener,
}
@Override
- public void onImportFinish(Collection<MtpObjectInfo> objectsNotImported) {
+ public void onImportFinish(Collection<MtpObjectInfo> objectsNotImported,
+ int visitedCount) {
stopForeground(true);
mNeedRelaunchNotification = true;
if (mClientActivity != null) {
- mClientActivity.onImportFinish(objectsNotImported);
+ mClientActivity.onImportFinish(objectsNotImported, visitedCount);
} else {
mRedeliverImportFinish = true;
mRedeliverObjectsNotImported = objectsNotImported;
+ mRedeliverImportFinishCount = visitedCount;
mNotificationBuilder.setProgress(0, 0, false)
.setContentText(getResources().getText(R.string.import_complete));
mNotificationManager.notify(NotificationIds.INGEST_NOTIFICATION_IMPORTING,
mNotificationBuilder.build());
}
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_IMPORTER,
+ "ImportFinished", null, visitedCount);
}
@Override