From f6edd53668afe094c8dc09ac35d294d049f6cec1 Mon Sep 17 00:00:00 2001 From: Erin Dahlgren Date: Fri, 31 Jan 2014 11:13:33 -0800 Subject: [PATCH] Correctly log the source of a foreground event. Bug: 12589465 Change-Id: Ib26d44e1a8fdc4e03561c6a00886682881106ec2 --- src/com/android/camera/CameraActivity.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index ae9ab7524..c6f7afb2b 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -1003,6 +1003,12 @@ public class CameraActivity extends Activity } if (mSecureCamera) { + // Foreground event caused by lock screen startup. + // It is necessary to log this in onCreate, to avoid the + // onResume->onPause->onResume sequence. + UsageStatistics.foregrounded( + eventprotos.ForegroundEvent.ForegroundSource.LOCK_SCREEN); + // Change the window flags so that secure camera can show when locked Window win = getWindow(); WindowManager.LayoutParams params = win.getAttributes(); @@ -1213,8 +1219,15 @@ public class CameraActivity extends Activity mAutoRotateScreen = true; } - // TODO: set source appropriately - UsageStatistics.foregrounded(eventprotos.ForegroundEvent.ForegroundSource.ICON_LAUNCHER); + if (isCaptureIntent()) { + // Foreground event caused by photo or video capure intent. + UsageStatistics.foregrounded( + eventprotos.ForegroundEvent.ForegroundSource.INTENT_PICKER); + } else if (!mSecureCamera) { + // Foreground event that is not caused by an intent. + UsageStatistics.foregrounded( + eventprotos.ForegroundEvent.ForegroundSource.ICON_LAUNCHER); + } Drawable galleryLogo; if (mSecureCamera) { -- 2.11.0