• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.tools.common.traces
18 
19 import android.tools.common.traces.events.EventLog
20 import android.tools.common.traces.surfaceflinger.LayersTrace
21 import android.tools.common.traces.surfaceflinger.TransactionsTrace
22 import android.tools.common.traces.wm.TransitionsTrace
23 import android.tools.common.traces.wm.WindowManagerTrace
24 
25 /**
26  * Represents a state dump containing the [WindowManagerTrace] and the [LayersTrace] both parsed and
27  * in raw (byte) data.
28  *
29  * @param wmTrace Parsed [WindowManagerTrace]
30  * @param layersTrace Parsed [LayersTrace]
31  * @param transactionsTrace Parse [TransactionsTrace]
32  * @param transitionsTrace Parsed [TransitionsTrace]
33  * @param eventLog Parsed [EventLog]
34  */
35 class DeviceTraceDump(
36     val wmTrace: WindowManagerTrace?,
37     val layersTrace: LayersTrace?,
38     val transactionsTrace: TransactionsTrace? = null,
39     val transitionsTrace: TransitionsTrace? = null,
40     val eventLog: EventLog? = null,
41 ) {
42     /** A deviceTraceDump is considered valid if at least one of the layers/wm traces is non-null */
43     val isValid: Boolean
44         get() {
45             if (wmTrace == null && layersTrace == null) {
46                 return false
47             }
48             return true
49         }
50 }
51