Skip to content

Commit

Permalink
Remove the reset event
Browse files Browse the repository at this point in the history
  • Loading branch information
bidetofevil committed Dec 31, 2024
1 parent ef7f7bb commit 5698c9f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,4 @@ interface UiLoadEventListener {
* or after it has loaded. Calls to this for a given instance should be idempotent.
*/
fun exit(instanceId: Int, activityName: String, timestampMs: Long)

/**
* When the app is no longer in a state where it is trying to open up UI. All traces should be abandoned and
* Any events received after this should assume the app is emerging or have emerged from a background state.
*/
fun reset(lastInstanceId: Int)
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ private class ActivityLoadEventEmitter(
override fun onActivityPrePaused(activity: Activity) {
lifecycleEventEmitter.pause(activity)
}

override fun onActivityStopped(activity: Activity) {
lifecycleEventEmitter.stop(activity)
}
}

/**
Expand Down Expand Up @@ -117,10 +113,6 @@ private class LegacyActivityLoadEventEmitter(
override fun onActivityPaused(activity: Activity) {
lifecycleEventEmitter.pause(activity)
}

override fun onActivityStopped(activity: Activity) {
lifecycleEventEmitter.stop(activity)
}
}

/**
Expand Down Expand Up @@ -186,12 +178,6 @@ private class LifecycleEventEmitter(
)
}

fun stop(activity: Activity) {
uiLoadEventListener.reset(
lastInstanceId = traceInstanceId(activity),
)
}

private fun traceInstanceId(activity: Activity): Int = activity.hashCode()

private fun nowMs(): Long = clock.now().nanosToMillis()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ class UiLoadTraceEmitter(
)
}

override fun reset(lastInstanceId: Int) {
}

private fun startTrace(
uiLoadType: UiLoadType,
instanceId: Int,
Expand All @@ -174,8 +171,7 @@ class UiLoadTraceEmitter(
) {
if (!activeTraces.containsKey(instanceId)) {
val newInstance = UiInstance(activityName, instanceId)
val previousInstance = currentInstance.getAndSet(newInstance)
if (previousInstance != null) {
currentInstance.getAndSet(newInstance)?.let { previousInstance ->
exit(previousInstance.id, previousInstance.name, timestampMs)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + (POST_DURATION + STATE_DURATION + PRE_DURATION) * 3 + PRE_DURATION
),
createEvent(
stage = "reset",
),
)
)
}
Expand Down Expand Up @@ -118,9 +115,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + (POST_DURATION + STATE_DURATION + PRE_DURATION) * 2 + PRE_DURATION
),
createEvent(
stage = "reset",
),
)
)
}
Expand All @@ -136,9 +130,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + (POST_DURATION + STATE_DURATION + PRE_DURATION) * 3 + PRE_DURATION
),
createEvent(
stage = "reset",
),
)
)
}
Expand Down Expand Up @@ -173,9 +164,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + STATE_DURATION * 4
),
createEvent(
stage = "reset",
),
)
)
}
Expand Down Expand Up @@ -206,9 +194,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + STATE_DURATION * 3
),
createEvent(
stage = "reset",
),
)
)
}
Expand All @@ -224,9 +209,6 @@ internal class UiLoadExtTest {
stage = "abandon",
timestampMs = startTimeMs + STATE_DURATION * 4
),
createEvent(
stage = "reset",
),
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ internal class UiLoadTraceEmitterTest {
instanceId = lastInstanceId,
firePreAndPost = firePreAndPost,
)
traceEmitter.exit(
instanceId = lastInstanceId,
activityName = lastActivityName,
timestampMs = lastActivityExitMs
)
traceEmitter.reset(lastInstanceId)
}

PreviousState.FROM_INTERRUPTED_LOAD -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ class FakeUiLoadEventListener : UiLoadEventListener {
)
}

override fun reset(lastInstanceId: Int) {
events.add(
EventData(
stage = "reset",
instanceId = lastInstanceId,
)
)
}

override fun create(instanceId: Int, activityName: String, timestampMs: Long, manualEnd: Boolean) {
events.add(
EventData(
Expand Down

0 comments on commit 5698c9f

Please sign in to comment.