Loading startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java +8 −15 Original line number Original line Diff line number Diff line Loading @@ -103,8 +103,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onIntentStarted(@NonNull Intent intent, long timestampNs) { public void onIntentStarted(@NonNull Intent intent, long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("IntentStarted during UNKNOWN. " + intent); String.format("IntentStarted during UNKNOWN. " + intent)); incAccIntentStartedEvents(); incAccIntentStartedEvents(); return; return; } } Loading @@ -128,7 +127,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onIntentFailed() { public void onIntentFailed() { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace(String.format("onIntentFailed during UNKNOWN.")); logWarningWithStackTrace("onIntentFailed during UNKNOWN."); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -147,8 +146,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onActivityLaunched(@NonNull @ActivityRecordProto byte[] activity, public void onActivityLaunched(@NonNull @ActivityRecordProto byte[] activity, @Temperature int temperature) { @Temperature int temperature) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunched during UNKNOWN."); String.format("onActivityLaunched during UNKNOWN.")); return; return; } } if (state != State.INTENT_STARTED) { if (state != State.INTENT_STARTED) { Loading @@ -165,8 +163,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onActivityLaunchCancelled(@Nullable @ActivityRecordProto byte[] activity) { public void onActivityLaunchCancelled(@Nullable @ActivityRecordProto byte[] activity) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunchCancelled during UNKNOWN."); String.format("onActivityLaunchCancelled during UNKNOWN.")); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -185,8 +182,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onActivityLaunchFinished(@NonNull @ActivityRecordProto byte[] activity, public void onActivityLaunchFinished(@NonNull @ActivityRecordProto byte[] activity, long timestampNs) { long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunchFinished during UNKNOWN."); String.format("onActivityLaunchFinished during UNKNOWN.")); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -206,8 +202,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onReportFullyDrawn(@NonNull @ActivityRecordProto byte[] activity, public void onReportFullyDrawn(@NonNull @ActivityRecordProto byte[] activity, long timestampNs) { long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onReportFullyDrawn during UNKNOWN."); String.format("onReportFullyDrawn during UNKNOWN.")); return; return; } } if (state == State.INIT) { if (state == State.INIT) { Loading Loading @@ -237,8 +232,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { private void incAccIntentStartedEvents() { private void incAccIntentStartedEvents() { if (accIntentStartedEvents < 0) { if (accIntentStartedEvents < 0) { throw new AssertionError( throw new AssertionError("The number of unknowns cannot be negative"); String.format("The number of unknowns cannot be negative")); } } if (accIntentStartedEvents == 0) { if (accIntentStartedEvents == 0) { state = State.UNKNOWN; state = State.UNKNOWN; Loading @@ -250,8 +244,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { private void decAccIntentStartedEvents() { private void decAccIntentStartedEvents() { if (accIntentStartedEvents <= 0) { if (accIntentStartedEvents <= 0) { throw new AssertionError( throw new AssertionError("The number of unknowns cannot be negative"); String.format("The number of unknowns cannot be negative")); } } if(accIntentStartedEvents == 1) { if(accIntentStartedEvents == 1) { state = State.INIT; state = State.INIT; Loading Loading
startop/iorap/src/com/google/android/startop/iorap/EventSequenceValidator.java +8 −15 Original line number Original line Diff line number Diff line Loading @@ -103,8 +103,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onIntentStarted(@NonNull Intent intent, long timestampNs) { public void onIntentStarted(@NonNull Intent intent, long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("IntentStarted during UNKNOWN. " + intent); String.format("IntentStarted during UNKNOWN. " + intent)); incAccIntentStartedEvents(); incAccIntentStartedEvents(); return; return; } } Loading @@ -128,7 +127,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onIntentFailed() { public void onIntentFailed() { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace(String.format("onIntentFailed during UNKNOWN.")); logWarningWithStackTrace("onIntentFailed during UNKNOWN."); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -147,8 +146,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onActivityLaunched(@NonNull @ActivityRecordProto byte[] activity, public void onActivityLaunched(@NonNull @ActivityRecordProto byte[] activity, @Temperature int temperature) { @Temperature int temperature) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunched during UNKNOWN."); String.format("onActivityLaunched during UNKNOWN.")); return; return; } } if (state != State.INTENT_STARTED) { if (state != State.INTENT_STARTED) { Loading @@ -165,8 +163,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { @Override @Override public void onActivityLaunchCancelled(@Nullable @ActivityRecordProto byte[] activity) { public void onActivityLaunchCancelled(@Nullable @ActivityRecordProto byte[] activity) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunchCancelled during UNKNOWN."); String.format("onActivityLaunchCancelled during UNKNOWN.")); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -185,8 +182,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onActivityLaunchFinished(@NonNull @ActivityRecordProto byte[] activity, public void onActivityLaunchFinished(@NonNull @ActivityRecordProto byte[] activity, long timestampNs) { long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onActivityLaunchFinished during UNKNOWN."); String.format("onActivityLaunchFinished during UNKNOWN.")); decAccIntentStartedEvents(); decAccIntentStartedEvents(); return; return; } } Loading @@ -206,8 +202,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { public void onReportFullyDrawn(@NonNull @ActivityRecordProto byte[] activity, public void onReportFullyDrawn(@NonNull @ActivityRecordProto byte[] activity, long timestampNs) { long timestampNs) { if (state == State.UNKNOWN) { if (state == State.UNKNOWN) { logWarningWithStackTrace( logWarningWithStackTrace("onReportFullyDrawn during UNKNOWN."); String.format("onReportFullyDrawn during UNKNOWN.")); return; return; } } if (state == State.INIT) { if (state == State.INIT) { Loading Loading @@ -237,8 +232,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { private void incAccIntentStartedEvents() { private void incAccIntentStartedEvents() { if (accIntentStartedEvents < 0) { if (accIntentStartedEvents < 0) { throw new AssertionError( throw new AssertionError("The number of unknowns cannot be negative"); String.format("The number of unknowns cannot be negative")); } } if (accIntentStartedEvents == 0) { if (accIntentStartedEvents == 0) { state = State.UNKNOWN; state = State.UNKNOWN; Loading @@ -250,8 +244,7 @@ public class EventSequenceValidator implements ActivityMetricsLaunchObserver { private void decAccIntentStartedEvents() { private void decAccIntentStartedEvents() { if (accIntentStartedEvents <= 0) { if (accIntentStartedEvents <= 0) { throw new AssertionError( throw new AssertionError("The number of unknowns cannot be negative"); String.format("The number of unknowns cannot be negative")); } } if(accIntentStartedEvents == 1) { if(accIntentStartedEvents == 1) { state = State.INIT; state = State.INIT; Loading