syntax = "proto2";

package android.os.statsd.accessibility;

import "frameworks/proto_logging/stats/atoms.proto";
import "frameworks/proto_logging/stats/atom_field_options.proto";
import "frameworks/proto_logging/stats/enums/accessibility/enums.proto";

option java_package = "com.android.os.accessibility";
option java_multiple_files = true;

extend Atom {
    optional AccessibilityCheckResultReported accessibility_check_result_reported = 910
    [(module) = "accessibility", (restriction_category) = RESTRICTION_DIAGNOSTIC];

    optional AutoclickEventReported autoclick_event_reported = 1067
    [(module) = "framework"];

    optional AutoclickEnabledReported autoclick_enabled_reported = 1068
    [(module) = "framework"];

    optional AutoclickSessionDurationReported autoclick_session_duration_reported = 1069
    [(module) = "framework"];

    optional AutoclickSettingsStateReported autoclick_settings_state_reported = 1079
    [(module) = "framework"];
}

/** Logs the result of an AccessibilityCheck. */
message AccessibilityCheckResultReported {
    // Package name of the app containing the checked View.
    optional string package_name = 1;
    // Version code of the app containing the checked View.
    optional int64 app_version = 2;
    // The path of the View starting from the root element in the window. Each element is
    // represented by the View's resource id, when available, or the View's class name.
    optional string ui_element_path = 3;
    // Class name of the activity containing the checked View.
    optional string activity_name = 4;
    // Title of the window containing the checked View.
    optional string window_title = 5;
    // The flattened component name of the app running the AccessibilityService which provided the a11y node.
    optional string source_component_name = 6;
    // Version code of the app running the AccessibilityService that provided the a11y node.
    optional int64 source_version = 7;
    // Class Name of the AccessibilityCheck that produced the result.
    optional android.accessibility.AccessibilityCheckClass result_check_class = 8;
    // Result type of the AccessibilityCheckResult.
    optional android.accessibility.AccessibilityCheckResultType result_type = 9;
    // Result ID of the AccessibilityCheckResult.
    optional int32 result_id = 10;
}

/**
 * Logs when an autoclick event occurs with information about the click type.
 * Logged from:
 *    frameworks/base/services/accessibility/java/com/android/server/accessibility/
 *    AutoclickController.java
 * Estimated Logging Rate (for users with autoclick feature enabled):
 *    Peak: 15 times in 1 min | Avg: ~1000 times per day per user.
 */
message AutoclickEventReported {
    // Type of Autoclick action performed.
    optional android.accessibility.AutoclickType click_type = 1;
}

/**
 * Logs when autoclick feature is enabled.
 * Logged from:
 *    frameworks/base/services/accessibility/java/com/android/server/accessibility/
 *    AutoclickController.java
 * Estimated Logging Rate:
 *    Peak: 5 times in 1 min | Avg: 5 times per day per user.
 */
message AutoclickEnabledReported {
    // Whether the feature was enabled or disabled.
    optional bool enabled = 1;
}

/**
 * Logs how long the autoclick feature is used.
 * Logged from:
 *    frameworks/base/services/accessibility/java/com/android/server/accessibility/
 *    AutoclickController.java
 * Estimated Logging Rate:
 *    Peak: 2 times in 1 min | Avg: 2 times per day per user.
 */
message AutoclickSessionDurationReported {
    // How long the feature was enabled in seconds.
    optional int32 session_duration_seconds = 1;
}

/**
 * Logs the state of autoclick settings.
 * Logged from:
 *    frameworks/base/services/accessibility/java/com/android/server/accessibility/
 *    AutoclickController.java
 * Estimated Logging Rate:
 *    Peak: 10 times in 1 min | Avg: 10 times per day per user.
 */
message AutoclickSettingsStateReported {
    // Delay in milliseconds before autoclick triggers.
    optional int64 delay_before_click_ms = 1;

    // The cursor area size of autoclick indicator.
    optional int32 cursor_area_size = 2;

    // Whether minor cursor movements are ignored.
    optional bool ignore_minor_cursor_movement = 3;

    // Whether autoclick reverts to left click after action.
    optional bool revert_to_left_click = 4;
}
