summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/CameraActivity.java63
-rw-r--r--src/com/android/camera/ComboPreferences.java4
-rw-r--r--src/com/android/camera/FocusOverlayManager.java4
-rw-r--r--src/com/android/camera/PhotoModule.java3
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java4
-rw-r--r--src/com/android/camera/ui/FilmStripView.java3
-rw-r--r--src/com/android/camera/util/CameraUtil.java2
-rw-r--r--src_pd/com/android/camera/util/UsageStatistics.java26
8 files changed, 105 insertions, 4 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 11e7610..29bf408 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -87,13 +87,17 @@ import com.android.camera.util.GcamHelper;
import com.android.camera.util.IntentHelper;
import com.android.camera.util.PhotoSphereHelper;
import com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper;
+import com.android.camera.util.UsageStatistics;
import com.android.camera2.R;
+import java.io.File;
+
import static com.android.camera.CameraManager.CameraOpenErrorCallback;
public class CameraActivity extends Activity
implements ModuleSwitcher.ModuleSwitchListener,
- ActionBar.OnMenuVisibilityListener {
+ ActionBar.OnMenuVisibilityListener,
+ ShareActionProvider.OnShareTargetSelectedListener {
private static final String TAG = "CAM_Activity";
@@ -228,18 +232,27 @@ public class CameraActivity extends Activity
new CameraOpenErrorCallback() {
@Override
public void onCameraDisabled(int cameraId) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_OPEN_FAIL, "security");
+
CameraUtil.showErrorAndFinish(CameraActivity.this,
R.string.camera_disabled);
}
@Override
public void onDeviceOpenFailure(int cameraId) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_OPEN_FAIL, "open");
+
CameraUtil.showErrorAndFinish(CameraActivity.this,
R.string.cannot_connect_camera);
}
@Override
public void onReconnectionFailure(CameraManager mgr) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_OPEN_FAIL, "reconnect");
+
CameraUtil.showErrorAndFinish(CameraActivity.this,
R.string.cannot_connect_camera);
}
@@ -292,15 +305,30 @@ public class CameraActivity extends Activity
sFirstStartAfterScreenOn = false;
}
+ private String fileNameFromDataID(int dataID) {
+ final LocalData localData = mDataAdapter.getLocalData(dataID);
+
+ File localFile = new File(localData.getPath());
+ return localFile.getName();
+ }
+
private FilmStripView.Listener mFilmStripListener =
new FilmStripView.Listener() {
@Override
public void onDataPromoted(int dataID) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_DELETE, "promoted", 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(dataID)));
+
removeData(dataID);
}
@Override
public void onDataDemoted(int dataID) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_DELETE, "demoted", 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(dataID)));
+
removeData(dataID);
}
@@ -448,6 +476,9 @@ public class CameraActivity extends Activity
};
public void gotoGallery() {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA, UsageStatistics.ACTION_FILMSTRIP,
+ "thumbnailTap");
+
mFilmStripView.getController().goToNextItem();
}
@@ -588,6 +619,18 @@ public class CameraActivity extends Activity
}
}
+ @Override
+ public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) {
+ int currentDataId = mFilmStripView.getCurrentId();
+ if (currentDataId < 0) {
+ return false;
+ }
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA, UsageStatistics.ACTION_SHARE,
+ intent.getComponent().getPackageName(), 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(currentDataId)));
+ return true;
+ }
+
/**
* According to the data type, make the menu items for supported operations
* visible.
@@ -858,6 +901,9 @@ public class CameraActivity extends Activity
mPanoramaShareActionProvider.setShareIntent(mPanoramaShareIntent);
}
+ mStandardShareActionProvider.setOnShareTargetSelectedListener(this);
+ mPanoramaShareActionProvider.setOnShareTargetSelectedListener(this);
+
return super.onCreateOptionsMenu(menu);
}
@@ -881,9 +927,15 @@ public class CameraActivity extends Activity
finish();
}
case R.id.action_delete:
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_DELETE, null, 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(currentDataId)));
removeData(currentDataId);
return true;
case R.id.action_edit:
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_EDIT, null, 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(currentDataId)));
launchEditor(localData);
return true;
case R.id.action_trim: {
@@ -904,6 +956,9 @@ public class CameraActivity extends Activity
localData.rotate90Degrees(this, mDataAdapter, currentDataId, true);
return true;
case R.id.action_crop: {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_CROP, null, 0,
+ UsageStatistics.hashFileName(fileNameFromDataID(currentDataId)));
Intent intent = new Intent(CropActivity.CROP_ACTION);
intent.setClass(this, CropActivity.class);
intent.setDataAndType(localData.getContentUri(), localData.getMimeType())
@@ -1075,6 +1130,8 @@ public class CameraActivity extends Activity
@Override
public void onClick(View view) {
try {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_GALLERY, null);
startActivity(IntentHelper.getGalleryIntent(CameraActivity.this));
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Failed to launch gallery activity, closing");
@@ -1171,6 +1228,10 @@ public class CameraActivity extends Activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
mAutoRotateScreen = true;
}
+
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_FOREGROUNDED, this.getClass().getSimpleName());
+
mOrientationListener.enable();
mCurrentModule.onResumeBeforeSuper();
super.onResume();
diff --git a/src/com/android/camera/ComboPreferences.java b/src/com/android/camera/ComboPreferences.java
index 142f698..80adfbe 100644
--- a/src/com/android/camera/ComboPreferences.java
+++ b/src/com/android/camera/ComboPreferences.java
@@ -330,6 +330,8 @@ public class ComboPreferences implements
listener.onSharedPreferenceChanged(this, key);
}
BackupManager.dataChanged(mPackageName);
- UsageStatistics.onEvent("CameraSettingsChange", null, key);
+
+ Object newValue = sharedPreferences.getAll().get(key);
+ UsageStatistics.onEvent("CameraSettingsChange", newValue.toString(), key);
}
}
diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java
index edc2db7..f382a2a 100644
--- a/src/com/android/camera/FocusOverlayManager.java
+++ b/src/com/android/camera/FocusOverlayManager.java
@@ -29,6 +29,7 @@ import android.os.Message;
import android.util.Log;
import com.android.camera.util.CameraUtil;
+import com.android.camera.util.UsageStatistics;
import java.util.ArrayList;
import java.util.List;
@@ -357,6 +358,9 @@ public class FocusOverlayManager {
public void onSingleTapUp(int x, int y) {
if (!mInitialized || mState == STATE_FOCUSING_SNAP_ON_FINISH) return;
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_TOUCH_FOCUS, x + "," + y);
+
// Let users be able to cancel previous touch focus.
if ((!mFocusDefault) && (mState == STATE_FOCUSING ||
mState == STATE_SUCCESS || mState == STATE_FAIL)) {
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 4e2b604..d6b1b65 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1013,7 +1013,8 @@ public class PhotoModule
mFaceDetectionStarted = false;
setCameraState(SNAPSHOT_IN_PROGRESS);
UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
- UsageStatistics.ACTION_CAPTURE_DONE, "Photo");
+ UsageStatistics.ACTION_CAPTURE_DONE, "Photo", 0,
+ UsageStatistics.hashFileName(mNamedImages.mQueue.lastElement().title + ".jpg"));
return true;
}
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 8d00c70..34b3071 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -744,6 +744,10 @@ public class WideAnglePanoramaModule
mActivity.getResources().getString(R.string.pano_file_name_format), mTimeTaken);
String filepath = Storage.generateFilepath(filename);
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_PANORAMA,
+ UsageStatistics.ACTION_CAPTURE_DONE, null, 0,
+ UsageStatistics.hashFileName(filename + ".jpg"));
+
Location loc = mLocationManager.getCurrentLocation();
ExifInterface exif = new ExifInterface();
try {
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index f6f1b6c..60c9322 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -43,6 +43,7 @@ import com.android.camera.ui.FilmStripView.ImageData.PanoramaSupportCallback;
import com.android.camera.ui.FilmstripBottomControls.BottomControlsListener;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper;
+import com.android.camera.util.UsageStatistics;
import com.android.camera2.R;
import java.util.Arrays;
@@ -1790,6 +1791,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
&& deltaX < mSlop * (-1)) {
// intercept left swipe
if (Math.abs(deltaX) >= Math.abs(deltaY) * 2) {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_FILMSTRIP, null);
return true;
}
}
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index cd8facc..708308b 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -916,6 +916,8 @@ public class CameraUtil {
public static void playVideo(Activity activity, Uri uri, String title) {
try {
boolean isSecureCamera = ((CameraActivity)activity).isSecureCamera();
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_PLAY_VIDEO, null);
if (!isSecureCamera) {
Intent intent = IntentHelper.getVideoPlayerIntent(activity, uri)
.putExtra(Intent.EXTRA_TITLE, title)
diff --git a/src_pd/com/android/camera/util/UsageStatistics.java b/src_pd/com/android/camera/util/UsageStatistics.java
index 40f74a4..faacb9d 100644
--- a/src_pd/com/android/camera/util/UsageStatistics.java
+++ b/src_pd/com/android/camera/util/UsageStatistics.java
@@ -8,6 +8,9 @@ public class UsageStatistics {
public static final String COMPONENT_CAMERA = "Camera";
public static final String COMPONENT_EDITOR = "Editor";
public static final String COMPONENT_IMPORTER = "Importer";
+ public static final String COMPONENT_LIGHTCYCLE = "Lightcycle";
+ public static final String COMPONENT_PANORAMA = "Panorama";
+ public static final String COMPONENT_GCAM = "GCam";
public static final String TRANSITION_BACK_BUTTON = "BackButton";
public static final String TRANSITION_UP_BUTTON = "UpButton";
@@ -22,16 +25,37 @@ public class UsageStatistics {
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 final String ACTION_SHARE = "Share";
+
+ public static final String ACTION_STITCHING_START = "StitchingStart";
+ public static final String ACTION_STITCHING_DONE = "StitchingDone";
+
+ public static final String ACTION_FOREGROUNDED = "Foregrounded";
+ public static final String ACTION_OPEN_FAIL = "OpenFailure";
+ public static final String ACTION_SCREEN_CHANGED = "ScreenChanged";
+ public static final String ACTION_FILMSTRIP = "Filmstrip";
+ public static final String ACTION_TOUCH_FOCUS= "TouchFocus";
+ public static final String ACTION_DELETE = "Delete";
+ public static final String ACTION_GALLERY = "Gallery";
+ public static final String ACTION_EDIT= "Edit";
+ public static final String ACTION_CROP= "Crop";
+ public static final String ACTION_PLAY_VIDEO= "PlayVideo";
public static final String CATEGORY_LIFECYCLE = "AppLifecycle";
public static final String CATEGORY_BUTTON_PRESS = "ButtonPress";
public static final String LIFECYCLE_START = "Start";
+ public static final String ACTION_SHARE = "Share";
+
public static void initialize(Context context) {}
public static void setPendingTransitionCause(String cause) {}
public static void onContentViewChanged(String screenComponent, String screenName) {}
public static void onEvent(String category, String action, String label) {};
public static void onEvent(String category, String action, String label, long optional_value) {};
+ public static void onEvent(String category, String action, String label, long optional_value,
+ String fileNameHash) {};
+
+ public static String hashFileName(String fileName) {
+ return "";
+ }
}