Create stub proto definitions for traces that are not available in AOSP

Also add a readme for winscope development.

Bug: 148409169
Test: builds and opens traces in AOSP

Change-Id: I2767301734bcd90410e0f97bc3da22a647bf195c
This commit is contained in:
Vishnu Nair
2020-01-27 15:00:13 -08:00
parent 0fa0953237
commit 92dccb506d
8 changed files with 111 additions and 4 deletions

View File

@@ -1 +0,0 @@
Tool for visualizing window manager traces

19
tools/winscope/README.md Normal file
View File

@@ -0,0 +1,19 @@
# Tool for visualizing window manager traces
## Developing WinScope
When the trace is enabled, Window Manager and Surface Flinger capture and
save current state to a file at each point of interest.
`frameworks/base/core/proto/android/server/windowmanagertrace.proto`
and `frameworks/native/services/surfaceflinger/layerproto/layerstrace.proto`
contain the proto definitions for their internal states.
### Checking out code and setting up environment
* Install [Yarn](https://yarnpkg.com), a JS package manager
* [Download Android source](https://source.android.com/setup/build/downloading)
* Navigate to `development/tools/winscope`
* Run `yarn install`
### Building & testing changes
* Navigate to `development/tools/winscope`
* Run `yarn run dev`

View File

@@ -16,10 +16,10 @@
import jsonProtoDefs from 'frameworks/base/core/proto/android/server/windowmanagertrace.proto'
import jsonProtoLogDefs from 'frameworks/base/core/proto/android/server/protolog.proto'
import jsonProtoLogDefs from 'ProtoLogSafePath/protolog.proto'
import jsonProtoDefsSF from 'frameworks/native/services/surfaceflinger/layerproto/layerstrace.proto'
import jsonProtoDefsTrans from 'frameworks/native/cmds/surfacereplayer/proto/src/trace.proto'
import jsonProtoDefsWL from 'vendor/google_arc/libs/wayland_service/waylandtrace.proto'
import jsonProtoDefsWL from 'WaylandSafePath/waylandtrace.proto'
import protobuf from 'protobufjs'
import { transform_layers, transform_layers_trace } from './transform_sf.js'
import { transform_window_service, transform_window_trace } from './transform_wm.js'

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2020 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.
*/
syntax = "proto2";
package com.android.server.protolog;
message ProtoLogMessage {}
message ProtoLogFileProto {}

View File

@@ -0,0 +1,3 @@
{
"version": "1.0.0"
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2020 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.
*/
syntax = "proto2";
package org.chromium.arc.wayland_composer;
message TraceFileProto {}
message OutputStateProto {}

View File

@@ -1,4 +1,20 @@
import viewerConfig from "../../../../frameworks/base/data/etc/services.core.protolog.json"
/*
* Copyright 2020, 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.
*/
import viewerConfig from "ProtoLogJsonSafePath/services.core.protolog.json"
import { nanos_to_string } from './transform.js'

View File

@@ -19,6 +19,29 @@ var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin')
function getWaylandSafePath() {
if (process.env.AOSP) {
return path.resolve(__dirname, 'src/stubs');
}
return path.resolve(__dirname, '../../../vendor/google_arc/libs/wayland_service');
}
// b/148409169 remove once proto log support is in AOSP.
function getProtoLogSafePath() {
if (process.env.AOSP) {
return path.resolve(__dirname, 'src/stubs');
}
return path.resolve(__dirname, '../../../frameworks/base/core/proto/android/server');
}
// b/148409169 remove once proto log support is in AOSP.
function getProtoLogJsonSafePath() {
if (process.env.AOSP) {
return path.resolve(__dirname, 'src/stubs');
}
return path.resolve(__dirname, '../../../frameworks/base/data/etc');
}
module.exports = {
entry: './src/main.js',
output: {
@@ -61,6 +84,11 @@ module.exports = {
]
},
resolve: {
alias: {
WaylandSafePath: getWaylandSafePath(),
ProtoLogSafePath: getProtoLogSafePath(),
ProtoLogJsonSafePath: getProtoLogJsonSafePath(),
},
modules: [
'node_modules',
path.resolve(__dirname, '../../..')