File: phonehub_api.proto

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (535 lines) | stat: -rw-r--r-- 14,896 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

package ash.phonehub.proto;

option optimize_for = LITE_RUNTIME;

// This enum is tied directly to the PhoneHubMessageType enum defined in
// //tools/metrics/histograms/metadata/phonehub/enums.xml, and should always
// reflect it (do not change one without changing the other). Entries should be
// never modified or deleted. Only additions possible.
//
// LINT.IfChange(PhoneHubMessageType)
enum MessageType {
  PROVIDE_CROS_STATE = 0;
  PHONE_STATUS_SNAPSHOT = 1;
  PHONE_STATUS_UPDATE = 2;
  UPDATE_NOTIFICATION_MODE_REQUEST = 3;
  UPDATE_NOTIFICATION_MODE_RESPONSE = 4;
  RING_DEVICE_REQUEST = 5;
  RING_DEVICE_RESPONSE = 6;
  UPDATE_BATTERY_MODE_REQUEST = 7;
  UPDATE_BATTERY_MODE_RESPONSE = 8;
  DISMISS_NOTIFICATION_REQUEST = 9;
  DISMISS_NOTIFICATION_RESPONSE = 10;
  NOTIFICATION_INLINE_REPLY_REQUEST = 11;
  NOTIFICATION_INLINE_REPLY_RESPONSE = 12;
  SHOW_NOTIFICATION_ACCESS_SETUP_REQUEST = 13;
  SHOW_NOTIFICATION_ACCESS_SETUP_RESPONSE = 14;
  FETCH_CAMERA_ROLL_ITEMS_REQUEST = 15;
  FETCH_CAMERA_ROLL_ITEMS_RESPONSE = 16;
  FETCH_CAMERA_ROLL_ITEM_DATA_REQUEST = 17;
  FETCH_CAMERA_ROLL_ITEM_DATA_RESPONSE = 18;
  INITIATE_CAMERA_ROLL_ITEM_TRANSFER_REQUEST = 19;
  DECLINE_INCOMING_CALL_REQUEST = 20;
  DECLINE_INCOMING_CALL_RESPONSE = 21;
  HANGUP_ONGOING_CALL_REQUEST = 22;
  HANGUP_ONGOING_CALL_RESPONSE = 23;
  FEATURE_SETUP_REQUEST = 24;
  FEATURE_SETUP_RESPONSE = 25;
  PING_REQUEST = 26;
  PING_RESPONSE = 27;
  APP_STREAM_UPDATE = 28;
  APP_LIST_UPDATE = 29;
  APP_LIST_INCREMENTAL_UPDATE = 30;
}
// LINT.ThenChange(//tools/metrics/histograms/metadata/phonehub/enums.xml:PhoneHubMessageTypes)

enum NotificationSetting {
  NOTIFICATIONS_OFF = 0;
  NOTIFICATIONS_ON = 1;
}

enum CameraRollSetting {
  CAMERA_ROLL_OFF = 0;
  CAMERA_ROLL_ON = 1;
}

enum AppStreamabilityStatus {
  STREAMABLE = 0;
  BLOCK_LISTED = 1;
  BLOCKED_BY_APP = 2;
}

enum ChargingState {
  NOT_CHARGING = 0;
  CHARGING_AC = 1;
  CHARGING_USB = 2;
  CHARGING_WIRELESS = 3;
}

enum BatteryMode {
  BATTERY_SAVER_OFF = 0;
  BATTERY_SAVER_ON = 1;
}

enum NotificationMode {
  DO_NOT_DISTURB_OFF = 0;
  DO_NOT_DISTURB_ON = 1;
}

enum NotificationAccessState {
  ACCESS_NOT_GRANTED = 0;
  ACCESS_GRANTED = 1;
}

enum FindMyDeviceRingStatus {
  NOT_RINGING = 0;
  RINGING = 1;
}

enum SignalStrength {
  ZERO_BARS = 0;
  ONE_BAR = 1;
  TWO_BARS = 2;
  THREE_BARS = 3;
  FOUR_BARS = 4;
}

enum MobileConnectionState {
  NO_SIM = 0;
  SIM_BUT_NO_RECEPTION = 1;
  SIM_WITH_RECEPTION = 2;
}

enum NotificationImportance {
  UNSPECIFIED = 0;
  NONE = 1;
  MIN = 2;
  LOW = 3;
  DEFAULT = 4;
  HIGH = 5;
}

enum ProfileType {
  DEFAULT_PROFILE = 0;
  WORK_PROFILE = 1;
}

enum ProfileDisableReason {
  DISABLE_REASON_UNKNOWN = 0;
  DISABLE_REASON_NOT_SUPPORTED = 1;
  DISABLE_REASON_DISABLED_BY_POLICY = 2;
}

enum DoNotDisturbCapability {
  DO_NOT_DISTURB_NORMAL = 0;
  DO_NOT_DISTURB_NOT_ALLOWED = 1;
}

enum FindMyDeviceCapability {
  NORMAL = 0;
  NOT_ALLOWED = 1;
}

enum FeatureStatus {
  FEATURE_STATUS_UNSPECIFIED = 0;
  FEATURE_STATUS_UNSUPPORTED = 1;
  FEATURE_STATUS_SUPPORTED = 2;
  FEATURE_STATUS_ENABLED = 3;

  // Feature is supported, but disabled by enterprise policy setting.
  FEATURE_STATUS_PROHIBITED_BY_POLICY = 4;

  // Feature is supported but requires attestation, and the connected device
  // can not be verified.
  FEATURE_STATUS_ATTESTATION_FAILED = 5;
}

// Information about the phone whether is secured with a PIN, pattern or
// password.
enum ScreenLockState {
  SCREEN_LOCK_UNKNOWN = 0;
  SCREEN_LOCK_OFF = 1;
  SCREEN_LOCK_ON = 2;
}

enum FeatureSetupResult {
  RESULT_NOT_ATTEMPTED = 0;
  RESULT_PERMISSION_GRANTED = 1;
  RESULT_ERROR_USER_REJECT = 2;
  RESULT_ERROR_ACTION_TIMEOUT = 3;
  RESULT_ERROR_ACTION_CANCELED = 4;
}

// Information about access to the camera roll feature on a connected Android
// device
message CameraRollAccessState {
  // Whether the user has explicitly granted permission to enable the Camera
  // Roll feature which allows connected Chromebooks to access the phone's
  // recent photos and media.
  bool feature_enabled = 1;
  // Whether necessary Android storage permissions have been granted to access
  // camera roll items.
  bool storage_permission_granted = 2;
}

// Information about the phone's support for cross-device feature setup.
message FeatureSetupConfig {
  // Whether the phone supports setting up multiple features at the same time
  // using the FeatureSetupRequest. When this is false, the notification
  // feature will be set up using the legacy
  // ShowNotificationAccessSetupRequest.
  bool feature_setup_request_supported = 1;
  // Supports responding to ping requests from the Chromebook. When this is
  // false, the Chromebook should not send pings to the Phone.
  bool ping_capability_supported = 2;
}

enum NetworkStatus {
  DISCONNECTED = 0;
  CELLULAR = 1;
  WIFI = 2;
}

message PhoneProperties {
  int32 battery_percentage = 1;
  ChargingState charging_state = 2;
  BatteryMode battery_mode = 3;

  // Note: If |connection_state| is not SIM_WITH_RECEPTION,
  // |signal_strength| and |mobile_provider| should be ignored.
  MobileConnectionState connection_state = 4;
  SignalStrength signal_strength = 5;
  string mobile_provider = 6;

  NotificationMode notification_mode = 7;
  NotificationAccessState notification_access_state = 8;

  FindMyDeviceRingStatus ring_status = 9;

  ProfileType profile_type = 10;
  ProfileDisableReason profile_disable_reason = 17;

  FindMyDeviceCapability find_my_device_capability = 11;

  DoNotDisturbCapability do_not_disturb_capability = 12;

  int32 android_version = 13;
  int64 gmscore_version = 14;

  CameraRollAccessState camera_roll_access_state = 15;
  // Note: This is whether the phone uses a lock screen(and not whether the
  // phone is currently locked).
  ScreenLockState screen_lock_state = 16;
  // To hide recent apps for users that turn on quiet mode.
  repeated UserState user_states = 18;

  FeatureSetupConfig feature_setup_config = 19;

  FeatureStatus eche_feature_status = 20;

  // Used for Phone Hub Structured Metrics
  optional string phone_manufacturer = 21;
  optional string phone_model = 22;
  optional int64 ambient_version = 23;
  optional NetworkStatus network_status = 24;
  optional bytes ssid = 25;
  optional string locale = 26;
  optional string phone_pseudonymous_id = 27;
  optional int64 pseudonymous_id_next_rotation_date = 28;

  // Next ID: 29
}

message UserState {
  // Records each user's ID for filter in ChromeOS.
  int64 user_id = 1;
  // The state when user turn on/off apps/notification, e.g. in work profile.
  bool is_quiet_mode_enabled = 2;
}

message App {
  string package_name = 1;
  string visible_name = 2;
  bytes icon = 3;
  int64 user_id = 4;

  // When unset, the ChromeOS side uses the system theme's default color.
  ColorRgb monochrome_icon_color = 6;
  AppStreamabilityStatus app_streamability_status = 7;
  optional bytes monochrome_icon_mask = 8;

  reserved 5;  // deprecated icon_stying field.
}

// Data required to verify the remote device.
// Next ID: 3
message AttestationData {
  enum Type {
    UNKNOWN = 0;

    // A Chrome OS "soft-bind" certificate chain.
    // The |certificates| field holds a PEM encoded X.509 certificate chain
    // ordered from leaf to root.
    CROS_SOFT_BIND_CERT_CHAIN = 1;
  }

  Type type = 1;

  // The certificate data as specified by |type|.
  repeated bytes certificates = 2;
}

message CrosState {
  NotificationSetting notification_setting = 1;
  CameraRollSetting camera_roll_setting = 2;
  // Optional for older Chromebooks pre-attestation.
  AttestationData attestation_data = 4;
  // Request Eche feature status info from the phone through Phone hub.
  bool should_provide_eche_status = 5;

  optional int64 pseudonymous_id_next_rotation_date = 6;
  optional string phone_hub_session_id = 7;

  reserved 3;  // deprecated notification_icon_styling field.
}

message Action {
  enum InputType {
    UNKNOWN = 0;
    TEXT = 1;
    CONFIRMATION = 2;
    OPEN = 3;
    CANNED_REPLY = 4;
  }

  enum CallAction {
    UNSPECIFIED = 0;
    ANSWER = 1;   // User can answer call for the CallStyle notification
    DECLINE = 2;  // User can decline call for the CallStyle notification
    HANGUP = 3;   // User can hang up call for the CallStyle notification
    // User can start the screening call for the CallStyle notification
    SCREENING = 4;
  }

  int64 id = 1;
  string title = 2;
  // Optional, but not specifying a type implies no response can be sent.
  InputType type = 3;
  // Only specified for actions in phone call notifications.
  CallAction call_action = 4;
}

message Notification {
  enum Category {
    UNSPECIFIED = 0;
    CONVERSATION = 1;
    INCOMING_CALL = 2;
    ONGOING_CALL = 3;
    SCREEN_CALL = 4;
  }

  int64 id = 1;
  int64 epoch_time_millis = 2;
  App origin_app = 3;
  NotificationImportance importance = 4;
  string title = 5;
  string text_content = 6;
  repeated Action actions = 7;

  // Optionals:
  bytes contact_image = 8;     // for messages
  bytes background_image = 9;  // for media
  bytes shared_image = 10;     // for messages
  // The category of the notification, phone hub in CrOS will decide which
  // category will be processed and display on CrOS notification,
  Category category = 11;
}

// Stores the information about the apps that are ready to be streamed.
// We used a dedicated proto for this instead of inlining this to make it
// future proof.
message StreamableApps {
  // List of apps that are ready to be streamed.
  // The order of the apps in the list is important and is set by the source.
  // The client should show the apps in the same order.
  repeated App apps = 1;
}

message PhoneStatusSnapshot {
  PhoneProperties properties = 1;
  repeated Notification notifications = 2;
  // TODO(nayebi): remove this and use AppListUpdate.recent_apps instead
  StreamableApps streamable_apps = 3;
}

message PhoneStatusUpdate {
  PhoneProperties properties = 1;
  // Notifications which have changed since the last update.
  repeated Notification updated_notifications = 2;
  // IDs of notification which have been removed since the last update.
  repeated int64 removed_notification_ids = 3;
  // Whether camera roll items has changed on the Android device and need to be
  // refeteched.
  bool has_camera_roll_updates = 4;
}

message UpdateNotificationModeRequest {
  NotificationMode notification_mode = 1;
}

message UpdateNotificationModeResponse {}

message RingDeviceRequest {
  FindMyDeviceRingStatus ring_status = 1;
}

message RingDeviceResponse {}

message UpdateBatteryModeRequest {
  BatteryMode battery_mode = 1;
}

message UpdateBatteryModeResponse {}

message DismissNotificationRequest {
  int64 notification_id = 1;
}

message DismissNotificationResponse {}

message NotificationInlineReplyRequest {
  int64 notification_id = 1;
  string reply_text = 2;
}

message NotificationInlineReplyResponse {}

message ShowNotificationAccessSetupRequest {}

message ShowNotificationAccessSetupResponse {}

message FeatureSetupRequest {
  bool notification_setup_requested = 1;
  bool camera_roll_setup_requested = 2;
}

message FeatureSetupResponse {
  FeatureSetupResult notification_setup_result = 1;
  FeatureSetupResult camera_roll_setup_result = 2;
}

message AppStreamUpdate {
  // This is optional by design and is set when the streamed app is changed.
  optional App foreground_app = 1;
}

message AppListUpdate {
  // List of apps available to stream, sorted by recency.
  optional StreamableApps all_apps = 1;
  optional StreamableApps recent_apps = 2;
}

message AppListIncrementalUpdate {
  // For removed apps, only package_names and user_ids are populated in the
  // apps.
  optional StreamableApps removed_apps = 3;
  optional StreamableApps installed_apps = 4;
}

// When adding new fields to this message, update CameraRollItem#operator==
// Located in chromeos/ash/components/phonehub/camera_roll_item.cc.
message CameraRollItemMetadata {
  // A unique and stable identifier for camera roll items on the Android device.
  string key = 1;
  string file_name = 5;
  string mime_type = 2;
  int64 last_modified_millis = 3;
  int64 file_size_bytes = 4;
  // Next ID: 6
}

// Contains data needed to display the thumbnail of a camera roll item.
message CameraRollItemThumbnail {
  enum Format {
    UNKNOWN = 0;
    JPEG = 1;
    PNG = 2;
  }
  // The format in which the thumbnail is encoded.
  Format format = 1;
  // Encoded thumbnail bytes.
  bytes data = 2;
}

// Represents a photo or video from a connected Android device's gallery.
message CameraRollItem {
  CameraRollItemMetadata metadata = 1;
  // Thumbnail data of the item. May not be set by the Android device if the
  // up-to-date thumbnail is already available on the Chrome OS device.
  CameraRollItemThumbnail thumbnail = 2;
}

// A command used by the Chrome OS device to fetch the up-to-date set of camera
// roll items that should be displayed.
message FetchCameraRollItemsRequest {
  // The maximum number of camera roll items that can be displayed.
  int32 max_item_count = 1;
  // Metadata of camera roll items already available on the Chrome OS device.
  repeated CameraRollItemMetadata current_item_metadata = 2;
}

message FetchCameraRollItemsResponse {
  // The up-to-date set of camera roll items that should be displayed.
  repeated CameraRollItem items = 1;
}

// A command to request a full-quality photo or video file from the connected
// Android device.
message FetchCameraRollItemDataRequest {
  // Metadata of the requested camera roll item.
  CameraRollItemMetadata metadata = 1;
}

// Next ID: 4
message FetchCameraRollItemDataResponse {
  CameraRollItemMetadata metadata = 3;
  enum FileAvailability {
    UNKNOWN = 0;
    AVAILABLE = 1;
    NOT_FOUND = 2;
  }
  // Indicates whether the requested file is available and can be sent to the
  // Chrome OS device.
  FileAvailability file_availability = 1;
  // A payload ID that the Chrome OS device should use to create a new local
  // file for storing the incoming file content via the Nearby Connections API.
  int64 payload_id = 2;
}

// A command to let the connected Android device start transferring the
// requested camera roll item via Nearby Connections. This should be issued
// after the Chrome OS device has allocated a new file with the provided payload
// ID.
message InitiateCameraRollItemTransferRequest {
  // Metadata of the camera roll item requested.
  CameraRollItemMetadata metadata = 1;
  // The payload ID provided by the connected Android device for the requested
  // camera roll item.
  int64 payload_id = 2;
}

message PingRequest {}

message PingResponse {}

message ColorRgb {
  uint32 red = 1;
  uint32 green = 2;
  uint32 blue = 3;
};