From cbddf0ad6c1495f0dd046690ce0f1a5202fbf3b7 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Mon, 16 Mar 2020 16:33:08 -0700 Subject: [PATCH] Move wayland support from default build Wayland trace files are not available in AOSP so building Winscope will break. Instead, pick up stub files by default and provide an option via env args to pick up Wayland support. Also removes obsolete protolog stubs which are no longer needed. Test: Remove wayland trace from path and check if winscope still builds Test: Build winscope with WAYLAND=true and confirm it pick up waylandproto file Fixes: 151239942 Change-Id: Ie5b237725cd656c478a2ea99d469963956399714 --- tools/winscope/README.md | 4 ++++ tools/winscope/src/decode.js | 2 +- tools/winscope/src/stubs/protolog.proto | 21 ---------------- .../src/stubs/services.core.protolog.json | 3 --- tools/winscope/src/transform_protolog.js | 2 +- tools/winscope/webpack.config.js | 24 +++---------------- 6 files changed, 9 insertions(+), 47 deletions(-) delete mode 100644 tools/winscope/src/stubs/protolog.proto delete mode 100644 tools/winscope/src/stubs/services.core.protolog.json diff --git a/tools/winscope/README.md b/tools/winscope/README.md index ca6c12b5d..dc4c2ea6f 100644 --- a/tools/winscope/README.md +++ b/tools/winscope/README.md @@ -17,3 +17,7 @@ contain the proto definitions for their internal states. * Navigate to `development/tools/winscope` * Run `yarn run dev` +### Building with internal extensions +Internal paths in vendor/ which are not available in AOSP must be replaced by +stub files. Actual path can be optionally picked up using env args. For +example, to pick up Wayland support, run `WAYLAND=yes yarn run dev` diff --git a/tools/winscope/src/decode.js b/tools/winscope/src/decode.js index 6b3b4c2df..a83adb5a4 100644 --- a/tools/winscope/src/decode.js +++ b/tools/winscope/src/decode.js @@ -16,7 +16,7 @@ import jsonProtoDefs from 'frameworks/base/core/proto/android/server/windowmanagertrace.proto' -import jsonProtoLogDefs from 'ProtoLogSafePath/protolog.proto' +import jsonProtoLogDefs from 'frameworks/base/core/proto/android/server/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 'WaylandSafePath/waylandtrace.proto' diff --git a/tools/winscope/src/stubs/protolog.proto b/tools/winscope/src/stubs/protolog.proto deleted file mode 100644 index dba82e3eb..000000000 --- a/tools/winscope/src/stubs/protolog.proto +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 {} \ No newline at end of file diff --git a/tools/winscope/src/stubs/services.core.protolog.json b/tools/winscope/src/stubs/services.core.protolog.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/tools/winscope/src/stubs/services.core.protolog.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/tools/winscope/src/transform_protolog.js b/tools/winscope/src/transform_protolog.js index 78e7c3207..89e87d557 100644 --- a/tools/winscope/src/transform_protolog.js +++ b/tools/winscope/src/transform_protolog.js @@ -14,7 +14,7 @@ * limitations under the License. */ -import viewerConfig from "ProtoLogJsonSafePath/services.core.protolog.json" +import viewerConfig from "../../../../frameworks/base/data/etc/services.core.protolog.json" import { nanos_to_string } from './transform.js' diff --git a/tools/winscope/webpack.config.js b/tools/winscope/webpack.config.js index 3a1b92db7..2dcb43809 100644 --- a/tools/winscope/webpack.config.js +++ b/tools/winscope/webpack.config.js @@ -20,26 +20,10 @@ 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'); + if (process.env.WAYLAND) { + return path.resolve(__dirname, '../../../vendor/google_arc/libs/wayland_service'); } - 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'); + return path.resolve(__dirname, 'src/stubs'); } module.exports = { @@ -86,8 +70,6 @@ module.exports = { resolve: { alias: { WaylandSafePath: getWaylandSafePath(), - ProtoLogSafePath: getProtoLogSafePath(), - ProtoLogJsonSafePath: getProtoLogJsonSafePath(), }, modules: [ 'node_modules',