blob: beaa625e9589f5fb28627039b059e6fa16b1495c [file] [log] [blame]
/*
* Copyright (C) 2016 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 = "proto3";
package profiler.proto;
option java_package = "com.android.tools.profiler.proto";
option java_outer_classname = "EventProfiler";
import "common.proto";
service EventService {
// Requests profiler data associated with a session, in the time range
// from |start_timestamp| (exclusive) to |end_timestamp| (inclusive), or
// mathematically written as in interval (start_timestamp, end_timestamp].
rpc GetActivityData(EventDataRequest) returns (ActivityDataResponse) {
}
rpc GetSystemData(EventDataRequest) returns (SystemDataResponse) {
}
rpc StartMonitoringApp(EventStartRequest) returns (EventStartResponse) {
}
rpc StopMonitoringApp(EventStopRequest) returns (EventStopResponse) {
}
}
message EventStartRequest {
Session session = 1;
}
message EventStartResponse {
enum Status {
UNSPECIFICED = 0;
SUCCESS = 1;
FAILURE_UNKNOWN = 2;
}
Status status = 1;
}
message EventStopRequest {
Session session = 1;
}
message EventStopResponse {
enum Status {
UNSPECIFICED = 0;
SUCCESS = 1;
FAILURE_UNKNOWN = 2;
}
Status status = 1;
}
message ActivityDataResponse {
repeated ActivityData data = 1;
}
message SystemDataResponse {
repeated SystemData data = 1;
}
// TODO: Add support for KeyEvents, and ButtonEvents. The current setup allows
// for only touch.
message SystemData {
// Each system event message is associated with one event type.
enum SystemEventType {
UNSPECIFIED = 0;
TOUCH = 1;
KEY = 2;
ROTATION = 3;
}
SystemEventType type = 1;
// This field stores actions triggered by an event. Actions are
// defined in MotionEvent.java.
// https://developer.android.com/reference/android/view/MotionEvent.html
int32 action_id = 2;
int64 start_timestamp = 3;
int64 end_timestamp = 4;
int32 pid = 5;
int64 event_id = 6;
string event_data = 7;
}
message ActivityData {
// Name of the activity
string name = 1;
// Unique hash identifying this activity from similarly named ones.
int64 hash = 2;
// Application Id this activity is associated with.
int32 pid = 3;
// State changes for activities and fragments.
repeated ActivityStateData state_changes = 4;
// TODO: Expand this to a oneof if more components need to add specific information.
// Additional data needed by specific UI components
FragmentData fragment_data = 5;
}
message ActivityStateData {
enum ActivityState {
UNSPECIFIED = 0;
ADDED = 1;
ATTACHED = 2;
CREATED = 3;
CREATEDVIEW = 4;
ACTIVITYCREATED = 5;
STARTED = 6;
RESUMED = 7;
PAUSED = 8;
STOPPED = 9;
SAVED = 10;
DETACHED = 11;
REMOVED = 12;
DESTROYED = 13;
DESTROYEDVIEW = 14;
RESTARTED = 15;
}
int64 timestamp = 1;
ActivityState state = 2;
}
message FragmentData {
int64 activity_context_hash = 1;
}
message EventDataRequest {
enum EventType {
UNSPECIFIED = 0;
// All types of data are requested.
ALL = 1;
// All system level events, touch, rotate, button presses ect...
SYSTEM_EVENTS = 2;
// All activity level events, created, activated, resumed, suspended ect...
ACTIVITY_EVENTS = 3;
// All fragment events
FRAGMENT_EVENTS = 4;
}
Session session = 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
EventType data_type = 4;
}