Log time spent on different UI surfaces
- When swipe happens on worskpace, elapsed container ms is reset
- Fling DOWN is also logged so that we now know how much time was spent on
all apps screen
- If screen off or power button trigger onPause, log this event.
Bug: 67745115
Change-Id: Ie3a0090c78195a4a028de9935131e9e034dcf48a
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4efb911..eda5bb1 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -292,6 +292,8 @@
public ViewGroupFocusHelper mFocusHandler;
private boolean mRotationEnabled = false;
+ private boolean mAppLaunchSuccess;
+
@Thunk void setOrientation() {
if (mRotationEnabled) {
unlockScreenOrientation(true);
@@ -781,6 +783,10 @@
mAppWidgetHost.stopListening();
}
+ if (!mAppLaunchSuccess) {
+ getUserEventDispatcher().logActionCommand(Action.Command.STOP,
+ mWorkspace.getState().containerType);
+ }
NotificationListener.removeNotificationsChangedListener();
}
@@ -827,6 +833,7 @@
super.onResume();
TraceHelper.partitionSection("ON_RESUME", "superCall");
+ mAppLaunchSuccess = false;
getUserEventDispatcher().resetElapsedSessionMillis();
mPaused = false;
if (mOnResumeNeedsLoad) {
@@ -2115,7 +2122,6 @@
throw new IllegalArgumentException("Input must have a valid intent");
}
startActivitySafely(v, intent, item);
- getUserEventDispatcher().logAppLaunch(v, intent); // TODO for discovered apps b/35802115
}
/**
@@ -2276,9 +2282,10 @@
}
public boolean startActivitySafely(View v, Intent intent, ItemInfo item) {
+ mAppLaunchSuccess = false;
if (mIsSafeModeEnabled && !Utilities.isSystemApp(this, intent)) {
Toast.makeText(this, R.string.safemode_shortcut_error, Toast.LENGTH_SHORT).show();
- return false;
+ return mAppLaunchSuccess;
}
// Only launch using the new animation if the shortcut has not opted out (this is a
// private contract between launcher and may be ignored in the future).
@@ -2318,12 +2325,13 @@
btv.setStayPressed(true);
setOnResumeCallback(btv);
}
- return true;
+ mAppLaunchSuccess = true;
+ getUserEventDispatcher().logAppLaunch(v, intent); // TODO for discovered apps b/35802115
} catch (ActivityNotFoundException|SecurityException e) {
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
Log.e(TAG, "Unable to launch. tag=" + item + " intent=" + intent, e);
}
- return false;
+ return mAppLaunchSuccess;
}
@Override