blob: a97cedef1e2fc91c1d0382a69debe1fcd56fefa8 [file] [log] [blame]
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.wm.traces.common.service.assertors
import com.android.server.wm.traces.common.assertions.Fact
import com.android.server.wm.traces.common.layers.LayersTrace
import com.android.server.wm.traces.common.service.ScenarioInstance
import com.android.server.wm.traces.common.windowmanager.WindowManagerTrace
data class FaasData(
val scenarioInstance: ScenarioInstance,
val entireWmTrace: WindowManagerTrace,
val entireLayersTrace: LayersTrace
) {
fun toFacts(): Collection<Fact> {
return mutableListOf(
Fact("Extracted from WM trace start", entireWmTrace.first().timestamp),
Fact("Extracted from WM trace end", entireWmTrace.first().timestamp),
Fact("Extracted from SF trace start", entireLayersTrace.first().timestamp),
Fact("Extracted from SF trace end", entireLayersTrace.first().timestamp),
Fact("Scenario description", scenarioInstance.description),
Fact("Scenario rotation", scenarioInstance.startRotation),
Fact("Scenario start", "${scenarioInstance.startTimestamp}"),
Fact("Scenario end", "${scenarioInstance.endTimestamp}")
)
.apply {
if (scenarioInstance.associatedTransition != null) {
this.add(
Fact(
"Associated transition changes",
scenarioInstance.associatedTransition.changes.joinToString(
"\n -",
"\n -"
) { "${it.transitMode} ${it.layerId}" }
)
)
}
if (scenarioInstance.associatedCuj !== null) {
this.add(Fact("Associated CUJ", scenarioInstance.associatedCuj))
}
}
}
}