1/* 2 * Copyright (C) 2024 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 optional 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 19option java_multiple_files = true; 20 21package android.widget; 22 23import "frameworks/base/core/proto/android/privacy.proto"; 24import "frameworks/base/core/proto/android/content/res/color_state_list.proto"; 25 26/** 27 * An android.widget.RemoteViews object. This is used by RemoteViews.createPreviewFromProto 28 * and RemoteViews.writePreviewToProto. 29 * 30 * Any addition of fields here will require an update to the parsing code in RemoteViews.java. 31 * Otherwise the field will be ignored when parsing (with a logged warning). 32 * 33 * Do not change the tag number or type of any fields in order to maintain compatibility with 34 * previous versions. If a field is deleted, use `reserved` to mark its tag number. 35 * 36 * Next tag: 17 37 */ 38message RemoteViewsProto { 39 option (android.msg_privacy).dest = DEST_AUTOMATIC; 40 optional int32 mode = 1; 41 optional string package_name = 2; 42 optional string layout_id = 3; 43 optional string light_background_layout_id = 4; 44 optional string view_id = 5; 45 optional SizeFProto ideal_size = 6; 46 optional int32 apply_flags = 7; 47 optional int64 provider_instance_id = 8; 48 // RemoteViews for different sizes (created with RemoteViews(Map<SizeF, RemoteViews) 49 // constructor). 50 repeated RemoteViewsProto sized_remoteviews = 9; 51 // RemoteViews for portrait/landscape (created with RemoteViews(RemoteViews, RemoteViews)i 52 // constructor). 53 optional RemoteViewsProto portrait_remoteviews = 10; 54 optional RemoteViewsProto landscape_remoteviews = 11; 55 optional bool is_root = 12; 56 optional bool has_draw_instructions = 13; 57 repeated bytes bitmap_cache = 14; 58 optional RemoteCollectionCache remote_collection_cache = 15; 59 repeated Action actions = 16; 60 optional int32 uid = 17; 61 62 message RemoteCollectionCache { 63 message Entry { 64 optional int64 id = 1; 65 optional string uri = 2; 66 optional RemoteCollectionItems items = 3; 67 } 68 69 repeated Entry entries = 1; 70 } 71 72 message RemoteCollectionItems { 73 repeated int64 ids = 1 [packed = true]; 74 repeated RemoteViewsProto views = 2; 75 optional bool has_stable_ids = 3; 76 optional int32 view_type_count = 4; 77 optional bool attached = 5; 78 } 79 80 /** 81 * An android.graphics.drawable Icon. 82 */ 83 message Icon { 84 option (android.msg_privacy).dest = DEST_AUTOMATIC; 85 optional int32 blend_mode = 1; 86 optional android.content.res.ColorStateListProto tint_list = 2; 87 oneof icon { 88 bytes bitmap = 3; 89 string resource = 4; 90 bytes data = 5; 91 string uri = 6; 92 string uri_adaptive_bitmap = 7; 93 bytes adaptive_bitmap = 8; 94 }; 95 } 96 97 /** 98 * Represents a CharSequence with Spans. 99 */ 100 message CharSequence { 101 optional string text = 1; 102 repeated Span spans = 2; 103 104 message Span { 105 optional int32 start = 1; 106 optional int32 end = 2; 107 optional int32 flags = 3; 108 // We use `repeated` for the following fields so that ProtoOutputStream does not omit 109 // empty messages (e.g. EasyEdit, Superscript). In practice, only one of the following 110 // fields will be written per Span message. We cannot use `oneof` here because 111 // ProtoOutputStream will omit empty messages. 112 repeated AbsoluteSize absolute_size = 4; 113 repeated AccessibilityClickable accessibility_clickable = 5; 114 repeated AccessibilityReplacement accessibility_replacement = 6; 115 repeated AccessibilityUrl accessibility_url = 7; 116 repeated Alignment alignment = 8; 117 repeated Annotation annotation = 9; 118 repeated BackgroundColor background_color = 10; 119 repeated Bullet bullet = 11; 120 repeated EasyEdit easy_edit = 12; 121 repeated ForegroundColor foreground_color = 13; 122 repeated LeadingMargin leading_margin = 14; 123 repeated LineBackground line_background = 15; 124 repeated LineBreak line_break = 16; 125 repeated LineHeight line_height = 17; 126 repeated Locale locale = 18; 127 repeated Quote quote = 19; 128 repeated RelativeSize relative_size = 20; 129 repeated ScaleX scale_x = 21; 130 repeated SpellCheck spell_check = 22; 131 repeated Strikethrough strikethrough = 23; 132 repeated Style style = 24; 133 repeated Subscript subscript = 25; 134 repeated Suggestion suggestion = 26; 135 repeated SuggestionRange suggestion_range = 27; 136 repeated Superscript superscript = 28; 137 repeated TextAppearance text_appearance = 29; 138 repeated Tts tts = 30; 139 repeated Typeface typeface = 31; 140 repeated Underline underline = 32; 141 repeated Url url = 33; 142 143 message AbsoluteSize { 144 optional int32 size = 1; 145 optional bool dip = 2; 146 } 147 148 message AccessibilityClickable { 149 optional int32 original_clickable_span_id = 1; 150 } 151 152 message AccessibilityReplacement { 153 optional CharSequence content_description = 1; 154 } 155 156 message AccessibilityUrl { 157 optional string url = 1; 158 } 159 160 message Alignment { 161 optional string alignment = 1; 162 } 163 164 message Annotation { 165 optional string key = 1; 166 optional string value = 2; 167 } 168 169 message BackgroundColor { 170 optional int32 color = 1; 171 } 172 173 message Bullet { 174 optional int32 gap_width = 1; 175 optional int32 color = 2; 176 optional int32 bullet_radius = 3; 177 optional bool want_color = 4; 178 } 179 180 message EasyEdit {} 181 182 message ForegroundColor { 183 optional int32 color = 1; 184 } 185 186 message LeadingMargin { 187 optional int32 first = 1; 188 optional int32 rest = 2; 189 } 190 191 message LineBackground { 192 optional int32 color = 1; 193 } 194 195 message LineBreak { 196 optional int32 line_break_style = 1; 197 optional int32 line_break_word_style = 2; 198 optional int32 hyphenation = 3; 199 } 200 201 message LineHeight { 202 optional int32 height = 1; 203 } 204 205 message Locale { 206 optional string language_tags = 1; 207 } 208 209 message Quote { 210 optional int32 color = 1; 211 optional int32 stripe_width = 2; 212 optional int32 gap_width = 3; 213 } 214 215 message RelativeSize { 216 optional float proportion = 1; 217 } 218 219 message ScaleX { 220 optional float proportion = 1; 221 } 222 223 message SpellCheck { 224 optional bool in_progress = 1; 225 } 226 227 message Strikethrough {} 228 229 message Style { 230 optional int32 style = 1; 231 optional int32 font_weight_adjustment = 2; 232 } 233 234 message Subscript {} 235 236 message Suggestion { 237 repeated string suggestions = 1; 238 optional int32 flags = 2; 239 optional string locale_string_for_compatibility = 3; 240 optional string language_tag = 4; 241 optional int32 hash_code = 5; 242 optional int32 easy_correct_underline_color = 6; 243 optional float easy_correct_underline_thickness = 7; 244 optional int32 misspelled_underline_color = 8; 245 optional float misspelled_underline_thickness = 9; 246 optional int32 auto_correction_underline_color = 10; 247 optional float auto_correction_underline_thickness = 11; 248 optional int32 grammar_error_underline_color = 12; 249 optional float grammar_error_underline_thickness = 13; 250 } 251 252 message SuggestionRange { 253 optional int32 background_color = 1; 254 } 255 256 message Superscript {} 257 258 // Typeface is omitted 259 message TextAppearance { 260 optional string family_name = 1; 261 optional int32 style = 2; 262 optional int32 text_size = 3; 263 optional android.content.res.ColorStateListProto text_color = 4; 264 optional android.content.res.ColorStateListProto text_color_link = 5; 265 optional int32 text_font_weight = 7; 266 optional string text_locale = 8; 267 optional float shadow_radius = 9; 268 optional float shadow_dx = 10; 269 optional float shadow_dy = 11; 270 optional int32 shadow_color = 12; 271 optional bool has_elegant_text_height_field = 13; 272 optional bool elegant_text_height = 14; 273 optional bool has_letter_spacing_field = 15; 274 optional float letter_spacing = 16; 275 optional string font_feature_settings = 17; 276 optional string font_variation_settings = 18; 277 } 278 279 message Tts { 280 optional string type = 1; 281 optional string args = 2; 282 } 283 284 message Typeface { 285 optional string family = 1; 286 } 287 288 message Underline {} 289 290 message Url { 291 optional string url = 1; 292 } 293 } 294 } 295 296 // Next tag: 23 297 message Action { 298 oneof action { 299 AttributeReflectionAction attribute_reflection_action = 1; 300 BitmapReflectionAction bitmap_reflection_action = 2; 301 ComplexUnitDimensionReflectionAction complex_unit_dimension_reflection_action = 3; 302 LayoutParamAction layout_param_action = 4; 303 NightModeReflectionAction night_mode_reflection_action = 5; 304 ReflectionAction reflection_action = 6; 305 RemoveFromParentAction remove_from_parent_action = 7; 306 ResourceReflectionAction resource_reflection_action = 8; 307 SetCompoundButtonCheckedAction set_compound_button_checked_action = 9; 308 SetDrawableTintAction set_drawable_tint_action = 10; 309 SetEmptyViewAction set_empty_view_action = 11; 310 SetIntTagAction set_int_tag_action = 12; 311 SetRadioGroupCheckedAction set_radio_group_checked_action = 13; 312 SetRemoteCollectionItemListAdapterAction set_remote_collection_item_list_adapter_action = 14; 313 SetRippleDrawableColorAction set_ripple_drawable_color_action = 15; 314 SetViewOutlinePreferredRadiusAction set_view_outline_preferred_radius_action = 16; 315 TextViewDrawableAction text_view_drawable_action = 17; 316 TextViewSizeAction text_view_size_action = 18; 317 ViewGroupAddAction view_group_add_action = 19; 318 ViewGroupRemoveAction view_group_remove_action = 20; 319 ViewPaddingAction view_padding_action = 21; 320 SetDrawInstructionAction set_draw_instruction_action = 22; 321 } 322 } 323 324 message AttributeReflectionAction { 325 optional string view_id = 1; 326 optional string method_name = 2; 327 optional int32 parameter_type = 3; 328 optional int32 resource_type = 4; 329 optional string attribute_id = 5; 330 } 331 332 message BitmapReflectionAction { 333 optional string view_id = 1; 334 optional string method_name = 2; 335 optional int32 bitmap_id = 3; 336 } 337 338 message ComplexUnitDimensionReflectionAction { 339 optional string view_id = 1; 340 optional string method_name = 2; 341 optional int32 parameter_type = 3; 342 optional float dimension_value = 4; 343 optional int32 unit = 5; 344 } 345 346 message LayoutParamAction { 347 optional string view_id = 1; 348 optional int32 property = 2; 349 optional int32 layout_value = 3; 350 optional int32 value_type = 4; 351 } 352 353 message NightModeReflectionAction { 354 optional string view_id = 1; 355 optional string method_name = 2; 356 optional int32 parameter_type = 3; 357 oneof light { 358 Icon light_icon = 4; 359 android.content.res.ColorStateListProto light_color_state_list = 5; 360 int32 light_int = 6; 361 } 362 oneof dark { 363 Icon dark_icon = 7; 364 android.content.res.ColorStateListProto dark_color_state_list = 8; 365 int32 dark_int = 9; 366 } 367 } 368 369 message ReflectionAction { 370 optional string view_id = 1; 371 optional string method_name = 2; 372 optional int32 parameter_type = 3; 373 oneof reflection_value { 374 bool boolean_value = 4; 375 bytes byte_value = 5; 376 int32 short_value = 6; 377 int32 int_value = 7; 378 int64 long_value = 8; 379 float float_value = 9; 380 double double_value = 10; 381 int32 char_value = 11; 382 string string_value = 12; 383 CharSequence char_sequence_value = 13; 384 string uri_value = 14; 385 bytes bitmap_value = 15; 386 android.content.res.ColorStateListProto color_state_list_value = 16; 387 Icon icon_value = 17; 388 int32 blend_mode_value = 18; 389 // Intent and Bundle values are excluded. 390 } 391 } 392 393 message RemoveFromParentAction { 394 optional string view_id = 1; 395 } 396 397 message ResourceReflectionAction { 398 optional string view_id = 1; 399 optional string method_name = 2; 400 optional int32 resource_type = 3; 401 optional string res_id = 4; 402 optional int32 parameter_type = 5; 403 } 404 405 message SetCompoundButtonCheckedAction { 406 optional string view_id = 1; 407 optional bool checked = 2; 408 } 409 410 message SetDrawableTintAction { 411 optional string view_id = 1; 412 optional bool target_background = 2; 413 optional int32 color_filter = 3; 414 optional int32 filter_mode = 4; 415 } 416 417 message SetEmptyViewAction { 418 optional string view_id = 1; 419 optional string empty_view_id = 2; 420 } 421 422 message SetIntTagAction { 423 optional string view_id = 1; 424 optional string key = 2; 425 optional int32 tag = 3; 426 } 427 428 message SetRadioGroupCheckedAction { 429 optional string view_id = 1; 430 optional string checked_id = 2; 431 } 432 433 message SetRemoteCollectionItemListAdapterAction { 434 optional string view_id = 1; 435 optional RemoteCollectionItems items = 2; 436 } 437 438 message SetRippleDrawableColorAction { 439 optional string view_id = 1; 440 optional android.content.res.ColorStateListProto color_state_list = 2; 441 } 442 443 message SetViewOutlinePreferredRadiusAction { 444 optional string view_id = 1; 445 optional int32 value_type = 2; 446 optional int32 value = 3; 447 } 448 449 message TextViewDrawableAction { 450 optional string view_id = 1; 451 optional bool is_relative = 2; 452 oneof drawables { 453 Resources resources = 3; 454 Icons icons = 4; 455 }; 456 457 message Resources { 458 optional string one = 1; 459 optional string two = 2; 460 optional string three = 3; 461 optional string four = 4; 462 } 463 464 message Icons { 465 optional Icon one = 1; 466 optional Icon two = 2; 467 optional Icon three = 3; 468 optional Icon four = 4; 469 } 470 } 471 472 message TextViewSizeAction { 473 optional string view_id = 1; 474 optional int32 units = 2; 475 optional float size = 3; 476 } 477 478 message ViewGroupAddAction { 479 optional string view_id = 1; 480 optional RemoteViewsProto nested_views = 2; 481 optional int32 index = 3; 482 optional int32 stableId = 4; 483 } 484 485 message ViewGroupRemoveAction { 486 optional string view_id = 1; 487 optional string view_id_to_keep = 2; 488 } 489 490 message ViewPaddingAction { 491 optional string view_id = 1; 492 optional int32 left = 2; 493 optional int32 right = 3; 494 optional int32 top = 4; 495 optional int32 bottom = 5; 496 } 497 498 message SetDrawInstructionAction { 499 repeated bytes instructions = 1; 500 } 501} 502 503 504message SizeFProto { 505 optional float width = 1; 506 optional float height = 2; 507} 508