• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package com.android.app.motiontool;
20
21import "view_capture.proto";
22
23option java_multiple_files = true;
24
25message MotionToolsRequest {
26  oneof type {
27    HandshakeRequest handshake = 1;
28    BeginTraceRequest begin_trace = 2;
29    EndTraceRequest end_trace = 3;
30    PollTraceRequest poll_trace = 4;
31  }
32}
33
34// RPC response messages.
35//
36// Returns the result from the corresponding request.
37message MotionToolsResponse {
38  oneof type {
39    // Contains error information whenever the request failed.
40    ErrorResponse error = 1;
41
42    HandshakeResponse handshake = 2;
43    BeginTraceResponse begin_trace = 3;
44    EndTraceResponse end_trace = 4;
45    PollTraceResponse poll_trace = 5;
46  }
47}
48
49message ErrorResponse {
50  enum Code {
51    UNKNOWN = 0;
52    INVALID_REQUEST = 1;
53    UNKNOWN_TRACE_ID = 2;
54    WINDOW_NOT_FOUND = 3;
55  }
56
57  optional Code code = 1;
58  // Human readable error message.
59  optional string message = 2;
60}
61
62// Identifies the window, in which context the motion tools are executed
63message WindowIdentifier {
64  // An identifier for the root view, as accepted by
65  // WindowManagerGlobal#getRootView. This is formatted as
66  // `windowName/rootViewClassName@rootViewIdentityHashCode`,
67  // for example `NotificationShade/android.view.ViewRootImpl@bab6a53`.
68  optional string root_window = 1;
69}
70
71// Verifies the motion tools are available for the specified window.
72message HandshakeRequest {
73  optional WindowIdentifier window = 1;
74  optional int32 client_version = 2;
75}
76
77message HandshakeResponse {
78  enum Status {
79    OK = 1;
80    WINDOW_NOT_FOUND = 2;
81  }
82  optional Status status = 1;
83  optional int32 server_version = 2;
84}
85
86// Enables motion tracing for the specified window
87message BeginTraceRequest {
88  optional WindowIdentifier window = 1;
89}
90
91message BeginTraceResponse {
92  optional int32 trace_id = 1;
93}
94
95// Disabled motion tracing for the specified window
96message EndTraceRequest {
97  optional int32 trace_id = 1;
98}
99
100message EndTraceResponse {
101  optional com.android.app.viewcapture.data.ExportedData exported_data = 1;
102}
103
104// Polls collected motion trace data collected since the last PollTraceRequest (or the
105// BeginTraceRequest)
106message PollTraceRequest {
107  optional int32 trace_id = 1;
108}
109
110message PollTraceResponse {
111  optional com.android.app.viewcapture.data.ExportedData exported_data = 1;
112}
113
114