/*
 * Copyright (C) 2015 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 systemui;

option java_package = "com.android.systemui.statusbar.phone";
option java_outer_classname = "TouchAnalyticsProto";

message Session {
    message TouchEvent {
        message BoundingBox {
            optional float width = 1;
            optional float height = 2;
        }

        enum Action {
            // Keep in sync with MotionEvent.
            DOWN = 0;
            UP = 1;
            MOVE = 2;
            CANCEL = 3;
            OUTSIDE = 4;
            POINTER_DOWN = 5;
            POINTER_UP = 6;
        }

        message Pointer {
            optional float x = 1;
            optional float y = 2;
            optional float size = 3;
            optional float pressure = 4;
            optional int32 id = 5;
            optional float removed_length = 6;
            optional BoundingBox removed_boundingBox = 7;
        }

        optional uint64 timeOffsetNanos = 1;
        optional Action action = 2;
        optional int32 actionIndex = 3;
        repeated Pointer pointers = 4;
        optional bool removed_redacted = 5;
        optional BoundingBox removed_boundingBox = 6;
    }

    message SensorEvent {
        enum Type {
            ACCELEROMETER = 1;
            GYROSCOPE = 4;
            LIGHT = 5;
            PROXIMITY = 8;
            ROTATION_VECTOR = 11;
        }

        optional Type type = 1;
        optional uint64 timeOffsetNanos = 2;
        repeated float values = 3;
        optional uint64 timestamp = 4;
    }

    message PhoneEvent {
        enum Type {
            ON_SCREEN_ON = 0;
            ON_SCREEN_ON_FROM_TOUCH = 1;
            ON_SCREEN_OFF = 2;
            ON_SUCCESSFUL_UNLOCK = 3;
            ON_BOUNCER_SHOWN = 4;
            ON_BOUNCER_HIDDEN = 5;
            ON_QS_DOWN = 6;
            SET_QS_EXPANDED_TRUE = 7;
            SET_QS_EXPANDED_FALSE = 8;
            ON_TRACKING_STARTED = 9;
            ON_TRACKING_STOPPED = 10;
            ON_NOTIFICATION_ACTIVE = 11;
            ON_NOTIFICATION_INACTIVE = 12;
            ON_NOTIFICATION_DOUBLE_TAP = 13;
            SET_NOTIFICATION_EXPANDED = 14;
            RESET_NOTIFICATION_EXPANDED = 15;
            ON_NOTIFICATION_START_DRAGGING_DOWN = 16;
            ON_NOTIFICATION_STOP_DRAGGING_DOWN = 17;
            ON_NOTIFICATION_DISMISSED = 18;
            ON_NOTIFICATION_START_DISMISSING = 19;
            ON_NOTIFICATION_STOP_DISMISSING = 20;
            ON_RIGHT_AFFORDANCE_SWIPING_STARTED = 21;
            ON_LEFT_AFFORDANCE_SWIPING_STARTED = 22;
            ON_AFFORDANCE_SWIPING_ABORTED = 23;
            ON_CAMERA_ON = 24;
            ON_LEFT_AFFORDANCE_ON = 25;
            ON_UNLOCK_HINT_STARTED = 26;
            ON_CAMERA_HINT_STARTED = 27;
            ON_LEFT_AFFORDANCE_HINT_STARTED = 28;
        }

        optional Type type = 1;
        optional uint64 timeOffsetNanos = 2;
    }

    enum Result {
        FAILURE = 0;
        SUCCESS = 1;
        UNKNOWN = 2;
    }

    enum Type {
        RESERVED_1 = 0;
        RESERVED_2 = 1;
        RANDOM_WAKEUP = 2;
        REAL = 3;
        REJECTED_TOUCH_REPORT = 4;
    }

    optional uint64 startTimestampMillis = 1;
    optional uint64 durationMillis = 2;
    optional string build = 3;
    optional Result result = 4;
    repeated TouchEvent touchEvents = 5;
    repeated SensorEvent sensorEvents = 6;

    optional int32 touchAreaWidth = 9;
    optional int32 touchAreaHeight = 10;
    optional Type type = 11;
    repeated PhoneEvent phoneEvents = 12;

    optional string device_id = 13;
}