Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42df3d41 authored by Pablo Gamito's avatar Pablo Gamito Committed by Android (Google) Code Review
Browse files

Merge changes from topic "shell-transition-bugreport" into udc-dev

* changes:
  Add shell side transition trace to bug reports
  Add transition trace on shell side
parents 4c6ec0db eaf61d88
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,10 @@ public class TraceBuffer<P, S extends P, T extends P> {
        this(bufferCapacity, new ProtoOutputStreamProvider(), null);
    }

    public TraceBuffer(int bufferCapacity, Consumer<T> protoDequeuedCallback) {
        this(bufferCapacity, new ProtoOutputStreamProvider(), protoDequeuedCallback);
    }

    public TraceBuffer(int bufferCapacity, ProtoProvider protoProvider,
            Consumer<T> protoDequeuedCallback) {
        mBufferCapacity = bufferCapacity;
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ public class BugreportManagerTest {
            Paths.get("/data/misc/wmtrace/layers_trace.winscope"),
            Paths.get("/data/misc/wmtrace/transactions_trace.winscope"),
            Paths.get("/data/misc/wmtrace/transition_trace.winscope"),
            Paths.get("/data/misc/wmtrace/shell_transition_trace.winscope"),
    };
    private static final Path[] UI_TRACES_GENERATED_DURING_BUGREPORT = {
            Paths.get("/data/misc/wmtrace/layers_trace_from_transactions.winscope"),
+29 −0
Original line number Diff line number Diff line
@@ -125,6 +125,34 @@ prebuilt_etc {

// End ProtoLog

gensrcs {
    name: "wm-shell-protos",

    tools: [
        "aprotoc",
        "protoc-gen-javastream",
        "soong_zip",
    ],

    tool_files: [
        ":libprotobuf-internal-protos",
    ],

    cmd: "mkdir -p $(genDir)/$(in) " +
        "&& $(location aprotoc) " +
        "  --plugin=$(location protoc-gen-javastream) " +
        "  --javastream_out=$(genDir)/$(in) " +
        "  -Iexternal/protobuf/src " +
        "  -I . " +
        "  $(in) " +
        "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",

    srcs: [
        "proto/**/*.proto",
    ],
    output_extension: "srcjar",
}

java_library {
    name: "WindowManager-Shell-proto",

@@ -142,6 +170,7 @@ android_library {
        // TODO(b/168581922) protologtool do not support kotlin(*.kt)
        ":wm_shell-sources-kt",
        ":wm_shell-aidls",
        ":wm-shell-protos",
    ],
    resource_dirs: [
        "res",
+55 −0
Original line number Diff line number Diff line
/*
 * 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.wm.shell;

option java_multiple_files = true;

/* Represents a file full of transition entries.
   Encoded, it should start with 0x09 0x57 0x4D 0x53 0x54 0x52 0x41 0x43 0x45 (.WMSTRACE), such
   that it can be easily identified. */
message WmShellTransitionTraceProto {
    /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
   (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
    constants into .proto files. */
    enum MagicNumber {
        INVALID = 0;
        MAGIC_NUMBER_L = 0x54534D57;  /* WMST (little-endian ASCII) */
        MAGIC_NUMBER_H = 0x45434152;  /* RACE (little-endian ASCII) */
    }

    // Must be the first field, set to value in MagicNumber
    required fixed64 magic_number = 1;
    repeated Transition transitions = 2;
    repeated HandlerMapping handlerMappings = 3;
}

message Transition {
    required int32 id = 1;
    optional int64 dispatch_time_ns = 2;
    optional int32 handler = 3;
    optional int64 merge_time_ns = 4;
    optional int64 merge_request_time_ns = 5;
    optional int32 merged_into = 6;
    optional int64 abort_time_ns = 7;
}

message HandlerMapping {
    required int32 id = 1;
    required string name = 2;
}
+3 −2
Original line number Diff line number Diff line
@@ -544,13 +544,14 @@ public abstract class WMShellBaseModule {
            DisplayController displayController,
            @ShellMainThread ShellExecutor mainExecutor,
            @ShellMainThread Handler mainHandler,
            @ShellAnimationThread ShellExecutor animExecutor) {
            @ShellAnimationThread ShellExecutor animExecutor,
            ShellCommandHandler shellCommandHandler) {
        if (!context.getResources().getBoolean(R.bool.config_registerShellTransitionsOnInit)) {
            // TODO(b/238217847): Force override shell init if registration is disabled
            shellInit = new ShellInit(mainExecutor);
        }
        return new Transitions(context, shellInit, shellController, organizer, pool,
                displayController, mainExecutor, mainHandler, animExecutor);
                displayController, mainExecutor, mainHandler, animExecutor, shellCommandHandler);
    }

    @WMSingleton
Loading