Merge "Usage statistics for photo and video capture" into gb-ub-photos-bryce
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index f4bd4ce..22bd650 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1013,6 +1013,8 @@
mFaceDetectionStarted = false;
setCameraState(SNAPSHOT_IN_PROGRESS);
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_CAPTURE_DONE, "Photo");
return true;
}
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 1f31778..09a406c 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -450,6 +450,8 @@
mActivity.mCameraDevice.takePicture(null, null, null, new JpegPictureCallback(loc));
showVideoSnapshotUI(true);
mSnapshotInProgress = true;
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_CAPTURE_DONE, "VideoSnapshot");
}
@Override
@@ -1547,6 +1549,8 @@
updateRecordingTime();
keepScreenOn();
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_CAPTURE_START, "Video");
}
private void showCaptureResult() {
@@ -1662,6 +1666,10 @@
// Update the parameters here because the parameters might have been altered
// by MediaRecorder.
if (!mPaused) mParameters = mActivity.mCameraDevice.getParameters();
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ fail ? UsageStatistics.ACTION_CAPTURE_FAIL :
+ UsageStatistics.ACTION_CAPTURE_DONE, "Video",
+ SystemClock.uptimeMillis() - mRecordingStartTime);
return fail;
}
diff --git a/src_pd/com/android/gallery3d/util/UsageStatistics.java b/src_pd/com/android/gallery3d/util/UsageStatistics.java
index cf27ac5..9246ab1 100644
--- a/src_pd/com/android/gallery3d/util/UsageStatistics.java
+++ b/src_pd/com/android/gallery3d/util/UsageStatistics.java
@@ -36,6 +36,10 @@
public static final String TRANSITION_BUTTON_TAP = "ButtonTap";
public static final String TRANSITION_SWIPE = "Swipe";
+ public static final String ACTION_CAPTURE_START = "CaptureStart";
+ public static final String ACTION_CAPTURE_FAIL = "CaptureFail";
+ public static final String ACTION_CAPTURE_DONE = "CaptureDone";
+
public static void initialize(Context context) {}
public static void showOptInDialogIfNeeded(Activity activity) {}
public static void setPendingTransitionCause(String cause) {}