1# Copyright (C) 2023 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15from python.generators.trace_processor_table.public import Column as C 16from python.generators.trace_processor_table.public import CppInt64 17from python.generators.trace_processor_table.public import ColumnFlag 18from python.generators.trace_processor_table.public import Table 19from python.generators.trace_processor_table.public import CppTableId 20from python.generators.trace_processor_table.public import CppOptional 21from python.generators.trace_processor_table.public import TableDoc 22from python.generators.trace_processor_table.public import CppUint32 23from python.generators.trace_processor_table.public import CppString 24from python.generators.trace_processor_table.public import WrappingSqlView 25 26INPUTMETHOD_CLIENTS_TABLE = Table( 27 python_module=__file__, 28 class_name='InputMethodClientsTable', 29 sql_name='__intrinsic_inputmethod_clients', 30 columns=[ 31 C('ts', CppInt64(), ColumnFlag.SORTED), 32 C('arg_set_id', CppOptional(CppUint32())), 33 C('base64_proto_id', CppOptional(CppUint32())), 34 ], 35 tabledoc=TableDoc( 36 doc='InputMethod clients', 37 group='Winscope', 38 columns={ 39 'ts': 'The timestamp the dump was triggered', 40 'arg_set_id': 'Extra args parsed from the proto message', 41 'base64_proto_id': 'String id for raw proto message', 42 })) 43 44INPUTMETHOD_MANAGER_SERVICE_TABLE = Table( 45 python_module=__file__, 46 class_name='InputMethodManagerServiceTable', 47 sql_name='__intrinsic_inputmethod_manager_service', 48 columns=[ 49 C('ts', CppInt64(), ColumnFlag.SORTED), 50 C('arg_set_id', CppOptional(CppUint32())), 51 C('base64_proto_id', CppOptional(CppUint32())), 52 ], 53 tabledoc=TableDoc( 54 doc='InputMethod manager service', 55 group='Winscope', 56 columns={ 57 'ts': 'The timestamp the dump was triggered', 58 'arg_set_id': 'Extra args parsed from the proto message', 59 'base64_proto_id': 'String id for raw proto message', 60 })) 61 62INPUTMETHOD_SERVICE_TABLE = Table( 63 python_module=__file__, 64 class_name='InputMethodServiceTable', 65 sql_name='__intrinsic_inputmethod_service', 66 columns=[ 67 C('ts', CppInt64(), ColumnFlag.SORTED), 68 C('arg_set_id', CppOptional(CppUint32())), 69 C('base64_proto_id', CppOptional(CppUint32())), 70 ], 71 tabledoc=TableDoc( 72 doc='InputMethod service', 73 group='Winscope', 74 columns={ 75 'ts': 'The timestamp the dump was triggered', 76 'arg_set_id': 'Extra args parsed from the proto message', 77 'base64_proto_id': 'String id for raw proto message', 78 })) 79 80SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE = Table( 81 python_module=__file__, 82 class_name='SurfaceFlingerLayersSnapshotTable', 83 sql_name='surfaceflinger_layers_snapshot', 84 columns=[ 85 C('ts', CppInt64(), ColumnFlag.SORTED), 86 C('arg_set_id', CppOptional(CppUint32())), 87 C('base64_proto_id', CppOptional(CppUint32())), 88 ], 89 tabledoc=TableDoc( 90 doc='SurfaceFlinger layers snapshot', 91 group='Winscope', 92 columns={ 93 'ts': 'Timestamp of the snapshot', 94 'arg_set_id': 'Extra args parsed from the proto message', 95 'base64_proto_id': 'String id for raw proto message', 96 })) 97 98SURFACE_FLINGER_LAYER_TABLE = Table( 99 python_module=__file__, 100 class_name='SurfaceFlingerLayerTable', 101 sql_name='surfaceflinger_layer', 102 columns=[ 103 C('snapshot_id', CppTableId(SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE)), 104 C('arg_set_id', CppOptional(CppUint32())), 105 C('base64_proto_id', CppOptional(CppUint32())), 106 ], 107 tabledoc=TableDoc( 108 doc='SurfaceFlinger layer', 109 group='Winscope', 110 columns={ 111 'snapshot_id': 'The snapshot that generated this layer', 112 'arg_set_id': 'Extra args parsed from the proto message', 113 'base64_proto_id': 'String id for raw proto message', 114 })) 115 116SURFACE_FLINGER_TRANSACTIONS_TABLE = Table( 117 python_module=__file__, 118 class_name='SurfaceFlingerTransactionsTable', 119 sql_name='surfaceflinger_transactions', 120 columns=[ 121 C('ts', CppInt64(), ColumnFlag.SORTED), 122 C('arg_set_id', CppOptional(CppUint32())), 123 C('base64_proto_id', CppOptional(CppUint32())), 124 ], 125 tabledoc=TableDoc( 126 doc='SurfaceFlinger transactions. Each row contains a set of ' + 127 'transactions that SurfaceFlinger committed together.', 128 group='Winscope', 129 columns={ 130 'ts': 'Timestamp of the transactions commit', 131 'arg_set_id': 'Extra args parsed from the proto message', 132 'base64_proto_id': 'String id for raw proto message', 133 })) 134 135VIEWCAPTURE_TABLE = Table( 136 python_module=__file__, 137 class_name='ViewCaptureTable', 138 sql_name='__intrinsic_viewcapture', 139 columns=[ 140 C('ts', CppInt64(), ColumnFlag.SORTED), 141 C('arg_set_id', CppOptional(CppUint32())), 142 C('base64_proto_id', CppOptional(CppUint32())), 143 ], 144 tabledoc=TableDoc( 145 doc='ViewCapture', 146 group='Winscope', 147 columns={ 148 'ts': 'The timestamp the views were captured', 149 'arg_set_id': 'Extra args parsed from the proto message', 150 'base64_proto_id': 'String id for raw proto message', 151 })) 152 153VIEWCAPTURE_VIEW_TABLE = Table( 154 python_module=__file__, 155 class_name='ViewCaptureViewTable', 156 sql_name='__intrinsic_viewcapture_view', 157 columns=[ 158 C('snapshot_id', CppTableId(VIEWCAPTURE_TABLE)), 159 C('arg_set_id', CppOptional(CppUint32())), 160 C('base64_proto_id', CppOptional(CppUint32())), 161 ], 162 tabledoc=TableDoc( 163 doc='ViewCapture view', 164 group='Winscope', 165 columns={ 166 'snapshot_id': 'The snapshot that generated this view', 167 'arg_set_id': 'Extra args parsed from the proto message', 168 'base64_proto_id': 'String id for raw proto message', 169 })) 170 171VIEWCAPTURE_INTERNED_DATA_TABLE = Table( 172 python_module=__file__, 173 class_name='ViewCaptureInternedDataTable', 174 sql_name='__intrinsic_viewcapture_interned_data', 175 columns=[ 176 C('base64_proto_id', CppUint32()), 177 C('flat_key', CppString()), 178 C('iid', CppInt64()), 179 C('deinterned_value', CppString()), 180 ], 181 tabledoc=TableDoc( 182 doc='ViewCapture interned data', 183 group='Winscope', 184 columns={ 185 'base64_proto_id': 'String id for raw proto message', 186 'flat_key': 'Proto field name', 187 'iid': 'Int value set on proto', 188 'deinterned_value': 'Corresponding string value', 189 })) 190 191WINDOW_MANAGER_SHELL_TRANSITIONS_TABLE = Table( 192 python_module=__file__, 193 class_name='WindowManagerShellTransitionsTable', 194 sql_name='window_manager_shell_transitions', 195 columns=[ 196 C('ts', CppInt64()), 197 C('transition_id', CppInt64(), ColumnFlag.SORTED), 198 C('arg_set_id', CppOptional(CppUint32())), 199 ], 200 tabledoc=TableDoc( 201 doc='Window Manager Shell Transitions', 202 group='Winscope', 203 columns={ 204 'ts': 'The timestamp the transition started playing', 205 'transition_id': 'The id of the transition', 206 'arg_set_id': 'Extra args parsed from the proto message', 207 })) 208 209WINDOW_MANAGER_SHELL_TRANSITION_HANDLERS_TABLE = Table( 210 python_module=__file__, 211 class_name='WindowManagerShellTransitionHandlersTable', 212 sql_name='window_manager_shell_transition_handlers', 213 columns=[ 214 C('handler_id', CppInt64()), 215 C('handler_name', CppString()), 216 C('base64_proto_id', CppOptional(CppUint32())), 217 ], 218 tabledoc=TableDoc( 219 doc='Window Manager Shell Transition Handlers', 220 group='Winscope', 221 columns={ 222 'handler_id': 'The id of the handler', 223 'handler_name': 'The name of the handler', 224 'base64_proto_id': 'String id for raw proto message', 225 })) 226 227WINDOW_MANAGER_SHELL_TRANSITION_PROTOS_TABLE = Table( 228 python_module=__file__, 229 class_name='WindowManagerShellTransitionProtosTable', 230 sql_name='__intrinsic_window_manager_shell_transition_protos', 231 columns=[ 232 C('transition_id', CppInt64()), 233 C('base64_proto_id', CppUint32()), 234 ], 235 tabledoc=TableDoc( 236 doc='Window Manager Shell Transition Protos', 237 group='Winscope', 238 columns={ 239 'transition_id': 'The id of the transition', 240 'base64_proto_id': 'String id for raw proto message', 241 })) 242 243WINDOW_MANAGER_TABLE = Table( 244 python_module=__file__, 245 class_name='WindowManagerTable', 246 sql_name='__intrinsic_windowmanager', 247 columns=[ 248 C('ts', CppInt64(), ColumnFlag.SORTED), 249 C('arg_set_id', CppOptional(CppUint32())), 250 C('base64_proto_id', CppOptional(CppUint32())), 251 ], 252 wrapping_sql_view=WrappingSqlView('windowmanager'), 253 tabledoc=TableDoc( 254 doc='WindowManager', 255 group='Winscope', 256 columns={ 257 'ts': 'The timestamp the state snapshot was captured', 258 'arg_set_id': 'Extra args parsed from the proto message', 259 'base64_proto_id': 'String id for raw proto message', 260 })) 261 262PROTOLOG_TABLE = Table( 263 python_module=__file__, 264 class_name='ProtoLogTable', 265 sql_name='protolog', 266 columns=[ 267 C('ts', CppInt64(), ColumnFlag.SORTED), 268 C('level', CppString()), 269 C('tag', CppString()), 270 C('message', CppString()), 271 C('stacktrace', CppString()), 272 C('location', CppString()), 273 ], 274 tabledoc=TableDoc( 275 doc='Protolog', 276 group='Winscope', 277 columns={ 278 'ts': 279 'The timestamp the log message was sent', 280 'level': 281 'The log level of the protolog message', 282 'tag': 283 'The log tag of the protolog message', 284 'message': 285 'The protolog message', 286 'stacktrace': 287 'Stacktrace captured at the message\'s logpoint', 288 'location': 289 'The location of the logpoint (only for processed messages)', 290 })) 291 292# Keep this list sorted. 293ALL_TABLES = [ 294 PROTOLOG_TABLE, 295 INPUTMETHOD_CLIENTS_TABLE, 296 INPUTMETHOD_MANAGER_SERVICE_TABLE, 297 INPUTMETHOD_SERVICE_TABLE, 298 SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE, 299 SURFACE_FLINGER_LAYER_TABLE, 300 SURFACE_FLINGER_TRANSACTIONS_TABLE, 301 VIEWCAPTURE_TABLE, 302 VIEWCAPTURE_VIEW_TABLE, 303 VIEWCAPTURE_INTERNED_DATA_TABLE, 304 WINDOW_MANAGER_SHELL_TRANSITIONS_TABLE, 305 WINDOW_MANAGER_SHELL_TRANSITION_HANDLERS_TABLE, 306 WINDOW_MANAGER_SHELL_TRANSITION_PROTOS_TABLE, 307 WINDOW_MANAGER_TABLE, 308] 309