Don't log transition time if no process switch
If the process of an activity that is launching has another
non-stopped activity, the data is not that interesting,
so remove the logging in these cases.
Bug: 27295491
Change-Id: I65d4a0e01b1e634a589ce8ecbbab337f0e6497ca
diff --git a/services/core/java/com/android/server/am/ActivityMetricsLogger.java b/services/core/java/com/android/server/am/ActivityMetricsLogger.java
index 43e1bdf..0331470 100644
--- a/services/core/java/com/android/server/am/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/am/ActivityMetricsLogger.java
@@ -98,13 +98,16 @@
* launch
* @param componentName the component name of the activity being launched
* @param processRunning whether the process that will contains the activity is already running
+ * @param processSwitch whether the process that will contain the activity didn't have any
+ * activity that was stopped, i.e. the started activity is "switching"
+ * processes
*/
void notifyActivityLaunched(int resultCode, @Nullable String componentName,
- boolean processRunning) {
+ boolean processRunning, boolean processSwitch) {
- if (resultCode < 0 || componentName == null) {
+ if (resultCode < 0 || componentName == null || !processSwitch) {
- // Failed to launch, don't track anything.
+ // Failed to launch or it was not a process switch, so we don't care about the timing.
reset();
return;
}