1/* 2 * Copyright (C) 2020 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 android.view.inputmethod; 20 21option java_multiple_files = true; 22 23/** 24 * Represents a {@link android.view.inputmethod.InputConnection} object. 25 */ 26message InputConnectionProto { 27 reserved 1; // string editable_text 28 reserved 2; // string selected_text 29 optional int32 selected_text_start = 3; 30 optional int32 selected_text_end = 4; 31 optional int32 cursor_caps_mode = 5; 32} 33 34/** 35 * Shows information about parameters and result for method calls to 36 * {@link android.view.inputmethod.InputConnection}. 37 */ 38message InputConnectionCallProto { 39 oneof method_call { 40 GetTextBeforeCursor get_text_before_cursor = 1; 41 GetTextAfterCursor get_text_after_cursor = 2; 42 GetSelectedText get_selected_text = 3; 43 GetSurroundingText get_surrounding_text = 4; 44 GetCursorCapsMode get_cursor_caps_mode = 5; 45 GetExtractedText get_extracted_text = 6; 46 } 47 48 message GetTextBeforeCursor { 49 optional int32 length = 1; 50 optional int32 flags = 2; 51 reserved 3; // string result 52 } 53 54 message GetTextAfterCursor { 55 optional int32 length = 1; 56 optional int32 flags = 2; 57 reserved 3; // string result = 3 58 } 59 60 message GetSelectedText { 61 optional int32 flags = 1; 62 reserved 2; // string result = 2 63 } 64 65 message GetSurroundingText { 66 optional int32 before_length = 1; 67 optional int32 after_length = 2; 68 optional int32 flags = 3; 69 optional SurroundingText result = 4; 70 71 message SurroundingText { 72 reserved 1; // string text = 1 73 optional int32 selection_start = 2; 74 optional int32 selection_end = 3; 75 optional int32 offset = 4; 76 } 77 } 78 79 message GetCursorCapsMode { 80 optional int32 req_modes = 1; 81 optional int32 result = 2; 82 } 83 84 message GetExtractedText { 85 optional ExtractedTextRequest request = 1; 86 optional int32 flags = 2; 87 reserved 3; // string result = 3 88 89 message ExtractedTextRequest { 90 optional int32 token = 1; 91 optional int32 flags = 2; 92 optional int32 hint_max_lines = 3; 93 optional int32 hint_max_chars = 4; 94 } 95 } 96}