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

Commit f128bcc4 authored by Tony Mak's avatar Tony Mak Committed by Android (Google) Code Review
Browse files

Merge "Update atoms.proto for textclassifier"

parents 80c49d7a e2b1b67b
Loading
Loading
Loading
Loading
+143 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import "frameworks/base/core/proto/android/telecomm/enums.proto";
import "frameworks/base/core/proto/android/telephony/enums.proto";
import "frameworks/base/core/proto/android/view/enums.proto";
import "frameworks/base/core/proto/android/wifi/enums.proto";
import "frameworks/base/core/proto/android/stats/textclassifier/textclassifier_enums.proto";

/**
 * The master atom class. This message defines all of the available
@@ -319,6 +320,15 @@ message Atom {
            217 [(log_from_module) = "permissioncontroller"];
        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
            218  [(log_from_module) = "permissioncontroller"];
        TextSelectionEvent text_selection_event =
            219  [(log_from_module) = "textclassifier"];
        TextLinkifyEvent text_linkify_event =
            220  [(log_from_module) = "textclassifier"];
        ConversationActionsEvent conversation_actions_event =
            221  [(log_from_module) = "textclassifier"];
        LanguageDetectionEvent language_detection_event =
            222  [(log_from_module) = "textclassifier"];

    }

    // Pulled events will start at field 10000.
@@ -6790,3 +6800,136 @@ message PermissionAppsFragmentViewed {
    }
    optional Category category = 6;
}

/**
 * Logs when there is a smart selection related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message TextSelectionEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Index of this event in a session.
    optional int32 event_index = 5;

    // Entity type that is involved.
    optional string entity_type = 6;

    // Relative word index of the start of the selection.
    optional int32 relative_word_start_index = 7;

    // Relative word (exclusive) index of the end of the selection.
    optional int32 relative_word_end_index = 8;

    // Relative word index of the start of the smart selection.
    optional int32 relative_suggested_word_start_index = 9;

    // Relative word (exclusive) index of the end of the smart selection.
    optional int32 relative_suggested_word_end_index = 10;
}

/**
 * Logs when there is a smart linkify related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message TextLinkifyEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Index of this event in a session.
    optional int32 event_index = 5;

    // Entity type that is involved.
    optional string entity_type = 6;

    // Number of links detected.
    optional int32 num_links = 7;

    // The total length of all links.
    optional int32 linked_text_length = 8;

    // Length of input text.
    optional int32 text_length = 9;

    // Time spent on generating links in ms.
    optional int64 latency_millis = 10;
}

/**
 * Logs when there is a conversation actions related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message ConversationActionsEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // The first entity type that is involved.
    optional string first_entity_type = 5;

    // The second entity type that is involved.
    optional string second_entity_type = 6;

    // The third entity type that is involved.
    optional string third_entity_type = 7;

    // The score of the first entity type.
    optional float score = 8;
}

/**
 * Logs when there is a language detection related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message LanguageDetectionEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Detected language.
    optional string language_tag = 5;

    // Score of the detected language.
    optional float score = 6;

    // Position of this action.
    optional int32 action_index = 7;
}
+85 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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 android.stats.textclassifier;
option java_multiple_files = true;

enum EventType {
    TYPE_UNKNOWN = 0;
    // User started a new selection.
    SELECTION_STARTED = 1;
    // User modified an existing selection.
    SELECTION_MODIFIED = 2;
    // Smart selection triggered for a single token (word).
    SMART_SELECTION_SINGLE = 3;
    // Smart selection triggered spanning multiple tokens (words).
    SMART_SELECTION_MULTI = 4;
    // Something else other than user or the default TextClassifier triggered a selection.
    AUTO_SELECTION = 5;
    // Smart actions shown to the user.
    ACTIONS_SHOWN = 6;
    // User clicked a link.
    LINK_CLICKED = 7;
    // User typed over the selection.
    OVERTYPE = 8;
    // User clicked on Copy action.
    COPY_ACTION = 9;
    // User clicked on Paste action.
    PASTE_ACTION = 10;
    // User clicked on Cut action.
    CUT_ACTION = 11;
    // User clicked on Share action.
    SHARE_ACTION = 12;
    // User clicked on a Smart action.
    SMART_ACTION = 13;
    // User dragged+dropped the selection.
    SELECTION_DRAG = 14;
    // Selection is destroyed.
    SELECTION_DESTROYED = 15;
    // User clicked on a custom action.
    OTHER_ACTION = 16;
    // User clicked on Select All action
    SELECT_ALL = 17;
    // User reset the smart selection.
    SELECTION_RESET = 18;
    // User composed a reply.
    MANUAL_REPLY = 19;
    // TextClassifier generated some actions
    ACTIONS_GENERATED = 20;
}

enum WidgetType {
    WIDGET_TYPE_UNKNOWN = 0;
    // Standard TextView
    WIDGET_TYPE_TEXTVIEW = 1;
    // EditText
    WIDGET_TYPE_EDITTEXT = 2;
    // Not selectable textview
    WIDGET_TYPE_UNSELECTABLE_TEXTVIEW = 3;
    // Standard Webview
    WIDGET_TYPE_WEBVIEW = 4;
    // Editable TextView
    WIDGET_TYPE_EDIT_WEBVIEW = 5;
    // Custom text widget
    WIDGET_TYPE_CUSTOM_TEXTVIEW = 6;
    // Custom editable text widget.
    WIDGET_TYPE_CUSTOM_EDITTEXT = 7;
    // Non-selectable text widget.
    WIDGET_TYPE_CUSTOM_UNSELECTABLE_TEXTVIEW = 8;
    // Notification
    WIDGET_TYPE_NOTIFICATION = 9;
}