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', CppUint32()), 33 C('base64_proto', CppString()), 34 C('base64_proto_id', CppOptional(CppUint32())), 35 ], 36 tabledoc=TableDoc( 37 doc='InputMethod clients', 38 group='Winscope', 39 columns={ 40 'ts': 'The timestamp the dump was triggered', 41 'arg_set_id': 'Extra args parsed from the proto message', 42 'base64_proto': 'Raw proto message encoded in base64', 43 'base64_proto_id': 'String id for raw proto message', 44 })) 45 46INPUTMETHOD_MANAGER_SERVICE_TABLE = Table( 47 python_module=__file__, 48 class_name='InputMethodManagerServiceTable', 49 sql_name='__intrinsic_inputmethod_manager_service', 50 columns=[ 51 C('ts', CppInt64(), ColumnFlag.SORTED), 52 C('arg_set_id', CppUint32()), 53 C('base64_proto', CppString()), 54 C('base64_proto_id', CppOptional(CppUint32())), 55 ], 56 tabledoc=TableDoc( 57 doc='InputMethod manager service', 58 group='Winscope', 59 columns={ 60 'ts': 'The timestamp the dump was triggered', 61 'arg_set_id': 'Extra args parsed from the proto message', 62 'base64_proto': 'Raw proto message encoded in base64', 63 'base64_proto_id': 'String id for raw proto message', 64 })) 65 66INPUTMETHOD_SERVICE_TABLE = Table( 67 python_module=__file__, 68 class_name='InputMethodServiceTable', 69 sql_name='__intrinsic_inputmethod_service', 70 columns=[ 71 C('ts', CppInt64(), ColumnFlag.SORTED), 72 C('arg_set_id', CppUint32()), 73 C('base64_proto', CppString()), 74 C('base64_proto_id', CppOptional(CppUint32())), 75 ], 76 tabledoc=TableDoc( 77 doc='InputMethod service', 78 group='Winscope', 79 columns={ 80 'ts': 'The timestamp the dump was triggered', 81 'arg_set_id': 'Extra args parsed from the proto message', 82 'base64_proto': 'Raw proto message encoded in base64', 83 'base64_proto_id': 'String id for raw proto message', 84 })) 85 86SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE = Table( 87 python_module=__file__, 88 class_name='SurfaceFlingerLayersSnapshotTable', 89 sql_name='surfaceflinger_layers_snapshot', 90 columns=[ 91 C('ts', CppInt64(), ColumnFlag.SORTED), 92 C('arg_set_id', CppUint32()), 93 C('base64_proto', CppString()), 94 C('base64_proto_id', CppOptional(CppUint32())), 95 ], 96 tabledoc=TableDoc( 97 doc='SurfaceFlinger layers snapshot', 98 group='Winscope', 99 columns={ 100 'ts': 'Timestamp of the snapshot', 101 'arg_set_id': 'Extra args parsed from the proto message', 102 'base64_proto': 'Raw proto message encoded in base64', 103 'base64_proto_id': 'String id for raw proto message', 104 })) 105 106SURFACE_FLINGER_LAYER_TABLE = Table( 107 python_module=__file__, 108 class_name='SurfaceFlingerLayerTable', 109 sql_name='surfaceflinger_layer', 110 columns=[ 111 C('snapshot_id', CppTableId(SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE)), 112 C('arg_set_id', CppUint32()), 113 C('base64_proto', CppString()), 114 C('base64_proto_id', CppOptional(CppUint32())), 115 ], 116 tabledoc=TableDoc( 117 doc='SurfaceFlinger layer', 118 group='Winscope', 119 columns={ 120 'snapshot_id': 'The snapshot that generated this layer', 121 'arg_set_id': 'Extra args parsed from the proto message', 122 'base64_proto': 'Raw proto message encoded in base64', 123 'base64_proto_id': 'String id for raw proto message', 124 })) 125 126SURFACE_FLINGER_TRANSACTIONS_TABLE = Table( 127 python_module=__file__, 128 class_name='SurfaceFlingerTransactionsTable', 129 sql_name='surfaceflinger_transactions', 130 columns=[ 131 C('ts', CppInt64(), ColumnFlag.SORTED), 132 C('arg_set_id', CppUint32()), 133 C('base64_proto', CppString()), 134 C('base64_proto_id', CppOptional(CppUint32())), 135 ], 136 tabledoc=TableDoc( 137 doc='SurfaceFlinger transactions. Each row contains a set of ' + 138 'transactions that SurfaceFlinger committed together.', 139 group='Winscope', 140 columns={ 141 'ts': 'Timestamp of the transactions commit', 142 'arg_set_id': 'Extra args parsed from the proto message', 143 'base64_proto': 'Raw proto message encoded in base64', 144 'base64_proto_id': 'String id for raw proto message', 145 })) 146 147VIEWCAPTURE_TABLE = Table( 148 python_module=__file__, 149 class_name='ViewCaptureTable', 150 sql_name='__intrinsic_viewcapture', 151 columns=[ 152 C('ts', CppInt64(), ColumnFlag.SORTED), 153 C('arg_set_id', CppUint32()), 154 C('base64_proto', CppString()), 155 C('base64_proto_id', CppOptional(CppUint32())), 156 ], 157 tabledoc=TableDoc( 158 doc='ViewCapture', 159 group='Winscope', 160 columns={ 161 'ts': 'The timestamp the views were captured', 162 'arg_set_id': 'Extra args parsed from the proto message', 163 'base64_proto': 'Raw proto message encoded in base64', 164 'base64_proto_id': 'String id for raw proto message', 165 })) 166 167WINDOW_MANAGER_SHELL_TRANSITIONS_TABLE = Table( 168 python_module=__file__, 169 class_name='WindowManagerShellTransitionsTable', 170 sql_name='window_manager_shell_transitions', 171 columns=[ 172 C('ts', CppInt64()), 173 C('transition_id', CppInt64(), ColumnFlag.SORTED), 174 C('arg_set_id', CppUint32()), 175 C('base64_proto', CppString()), 176 C('base64_proto_id', CppOptional(CppUint32())), 177 ], 178 tabledoc=TableDoc( 179 doc='Window Manager Shell Transitions', 180 group='Winscope', 181 columns={ 182 'ts': 'The timestamp the transition started playing', 183 'transition_id': 'The id of the transition', 184 'arg_set_id': 'Extra args parsed from the proto message', 185 'base64_proto': 'Raw proto message encoded in base64', 186 'base64_proto_id': 'String id for raw proto message', 187 })) 188 189WINDOW_MANAGER_SHELL_TRANSITION_HANDLERS_TABLE = Table( 190 python_module=__file__, 191 class_name='WindowManagerShellTransitionHandlersTable', 192 sql_name='window_manager_shell_transition_handlers', 193 columns=[ 194 C('handler_id', CppInt64()), 195 C('handler_name', CppString()), 196 C('base64_proto', CppString()), 197 C('base64_proto_id', CppOptional(CppUint32())), 198 ], 199 tabledoc=TableDoc( 200 doc='Window Manager Shell Transition Handlers', 201 group='Winscope', 202 columns={ 203 'handler_id': 'The id of the handler', 204 'handler_name': 'The name of the handler', 205 'base64_proto': 'Raw proto message encoded in base64', 206 'base64_proto_id': 'String id for raw proto message', 207 })) 208 209WINDOW_MANAGER_TABLE = Table( 210 python_module=__file__, 211 class_name='WindowManagerTable', 212 sql_name='__intrinsic_windowmanager', 213 columns=[ 214 C('ts', CppInt64(), ColumnFlag.SORTED), 215 C('arg_set_id', CppUint32()), 216 C('base64_proto', CppString()), 217 C('base64_proto_id', CppOptional(CppUint32())), 218 ], 219 wrapping_sql_view=WrappingSqlView('windowmanager'), 220 tabledoc=TableDoc( 221 doc='WindowManager', 222 group='Winscope', 223 columns={ 224 'ts': 'The timestamp the state snapshot was captured', 225 'arg_set_id': 'Extra args parsed from the proto message', 226 'base64_proto': 'Raw proto message encoded in base64', 227 'base64_proto_id': 'String id for raw proto message', 228 })) 229 230PROTOLOG_TABLE = Table( 231 python_module=__file__, 232 class_name='ProtoLogTable', 233 sql_name='protolog', 234 columns=[ 235 C('ts', CppInt64(), ColumnFlag.SORTED), 236 C('level', CppString()), 237 C('tag', CppString()), 238 C('message', CppString()), 239 C('stacktrace', CppString()), 240 C('location', CppString()), 241 ], 242 tabledoc=TableDoc( 243 doc='Protolog', 244 group='Winscope', 245 columns={ 246 'ts': 247 'The timestamp the log message was sent', 248 'level': 249 'The log level of the protolog message', 250 'tag': 251 'The log tag of the protolog message', 252 'message': 253 'The protolog message', 254 'stacktrace': 255 'Stacktrace captured at the message\'s logpoint', 256 'location': 257 'The location of the logpoint (only for processed messages)', 258 })) 259 260# Keep this list sorted. 261ALL_TABLES = [ 262 PROTOLOG_TABLE, 263 INPUTMETHOD_CLIENTS_TABLE, 264 INPUTMETHOD_MANAGER_SERVICE_TABLE, 265 INPUTMETHOD_SERVICE_TABLE, 266 SURFACE_FLINGER_LAYERS_SNAPSHOT_TABLE, 267 SURFACE_FLINGER_LAYER_TABLE, 268 SURFACE_FLINGER_TRANSACTIONS_TABLE, 269 VIEWCAPTURE_TABLE, 270 WINDOW_MANAGER_SHELL_TRANSITIONS_TABLE, 271 WINDOW_MANAGER_SHELL_TRANSITION_HANDLERS_TABLE, 272 WINDOW_MANAGER_TABLE, 273] 274