From: Erin Dahlgren Date: Fri, 31 Jan 2014 19:13:33 +0000 (-0800) Subject: Correctly log the source of a foreground event. X-Git-Tag: android-x86-6.0-r3~1064^2~317 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f6edd53668afe094c8dc09ac35d294d049f6cec1;p=android-x86%2Fpackages-apps-Camera2.git Correctly log the source of a foreground event. Bug: 12589465 Change-Id: Ib26d44e1a8fdc4e03561c6a00886682881106ec2 --- 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) {