Prevent app list doodle from being pinch-to-zoomed.
[chromium-blink-merge.git] / components / policy / proto / device_management_backend.proto
blob37322aaa302afcbc7dbf33813c6c5bb1f05e6294
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 syntax = "proto2";
7 option optimize_for = LITE_RUNTIME;
9 package enterprise_management;
11 // Request from device to server to register device.
12 message DeviceRegisterRequest {
13   // Reregister device without erasing server state.  It can be used
14   // to refresh dmtoken etc.  Client MUST set this value to true if it
15   // reuses an existing device id.
16   optional bool reregister = 1;
18   // Device register type.  This field does not exist for TT release.
19   // When a client requests for policies, server should verify the
20   // client has been registered properly.  For example, a client must
21   // register with type DEVICE in order to retrieve device policies.
22   enum Type {
23     TT   = 0;             // Register for TT release.
24     USER = 1;             // Register for Chrome OS user polices.
25     DEVICE = 2;           // Register for device policies.
26     BROWSER = 3;          // Register for Chrome user policies.
27     ANDROID_BROWSER = 4;  // Register for Android Chrome browser user policies.
28     IOS_BROWSER = 5;      // Register for iOS Chrome browser user policies.
29   }
30   // NOTE: we also use this field to detect client version.  If this
31   // field is missing, then the request comes from TT.  We will remove
32   // Chrome OS TT support once it is over.
33   optional Type type = 2 [default = TT];
35   // Machine hardware id, such as serial number.
36   // This field is required if register type == DEVICE.
37   optional string machine_id = 3;
39   // Machine model name, such as "ZGA", "Cr-48", "Nexus One".  If the
40   // model name is not available, client SHOULD send generic name like
41   // "Android", or "Chrome OS".
42   optional string machine_model = 4;
44   // OBSOLETE: Legacy auto-enrollment is not longer supported.
45   optional bool OBSOLETE_auto_enrolled = 5 [deprecated = true];
47   // Indicates a requisition of the registering entity that the server can act
48   // upon. This allows clients to pass hints e.g. at device enrollment time
49   // about the intended use of the device.
50   optional string requisition = 6;
52   // The current server-backed state key for the client, if applicable. This can
53   // be used by the server to link the registration request to an existing
54   // device record for re-enrollment.
55   optional bytes server_backed_state_key = 7;
57   // Enumerates different flavors of registration.
58   enum Flavor {
59     // User manually enrolls a device for device management.
60     FLAVOR_ENROLLMENT_MANUAL = 0;
61     // User re-starts enrollment manually to recover from loss of policy.
62     FLAVOR_ENROLLMENT_MANUAL_RENEW = 1;
63     // Device enrollment forced by local device configuration, such as OEM
64     // partition flags to force enrollment.
65     FLAVOR_ENROLLMENT_LOCAL_FORCED = 2;
66     // Enrollment advertised by local device configuration, such as OEM
67     // partition flags indicating to prompt for enrollment, but allowing the
68     // user to skip.
69     FLAVOR_ENROLLMENT_LOCAL_ADVERTISED = 3;
70     // Device state downloaded from the server during OOBE indicates that
71     // (re-)enrollment is mandatory.
72     FLAVOR_ENROLLMENT_SERVER_FORCED = 4;
73     // Device state downloaded from the server during OOBE indicates that the
74     // device should prompt for (re-)enrollment, but the user is allowed to
75     // skip.
76     FLAVOR_ENROLLMENT_SERVER_ADVERTISED = 5;
77     // Device detected in steady state that it is supposed to be enrolled, but
78     // the policy is missing.
79     FLAVOR_ENROLLMENT_RECOVERY = 6;
80     // User policy registration for a logged-in user.
81     FLAVOR_USER_REGISTRATION = 7;
82   };
84   // Indicates the registration flavor. This is passed to the server FYI when
85   // registering for policy so the server can distinguish registration triggers.
86   optional Flavor flavor = 8;
89 // Response from server to device register request.
90 message DeviceRegisterResponse {
91   // Device management token for this registration.  This token MUST be
92   // part of HTTP Authorization header for all future requests from
93   // device to server.
94   required string device_management_token = 1;
96   // Device display name.  By default, server generates the name in
97   // the format of "Machine Model - Machine Id".  However, domain
98   // admin can update it using CPanel, so do NOT treat it as constant.
99   optional string machine_name = 2;
101   // Enum listing the possible modes the device should be locked into when the
102   // registration is finished.
103   enum DeviceMode {
104     // In ENTERPRISE mode the device has no local owner and device settings are
105     // controlled through the cloud policy infrastructure. Auto-enrollment is
106     // supported in that mode.
107     ENTERPRISE = 0;
108     // Devices in RETAIL mode also have no local owner and get their device
109     // settings from the cloud, but additionally this mode enables the demo
110     // account on the device.
111     RETAIL = 1;
112   }
113   optional DeviceMode enrollment_type = 3 [default = ENTERPRISE];
116 // Request from device to server to unregister device.
117 // GoogleDMToken MUST be in HTTP Authorization header.
118 message DeviceUnregisterRequest {
121 // Response from server to device for unregister request.
122 message DeviceUnregisterResponse {
125 // Request from device to server to upload device EMCert
126 // (enterprise machine cert used for remote attestation).
127 // GoogleDMToken MUST be in HTTP Authorization header.
128 message DeviceCertUploadRequest {
129   // EMCert in X.509 format.
130   optional bytes device_certificate = 1;
133 // Response from server to device for cert upload request.
134 message DeviceCertUploadResponse {
137 // Request to access a Google service with the given scope.
138 message DeviceServiceApiAccessRequest {
139   // The list of auth scopes the device requests from DMServer.
140   repeated string auth_scope = 1;
142   // OAuth2 client ID to which the returned authorization code is bound.
143   optional string oauth2_client_id = 2;
146 message DeviceServiceApiAccessResponse {
147   // The OAuth2 authorization code for the requested scope(s).
148   // This can be exchanged for a refresh token.
149   optional string auth_code = 1;
152 message PolicyFetchRequest {
153   // This is the policy type, which maps to D3 policy type internally.
154   // By convention, we use "/" as separator to create policy namespace.
155   // The policy type names are case insensitive.
156   //
157   // Possible values for Chrome OS are:
158   //   google/chromeos/device => ChromeDeviceSettingsProto
159   //   google/chromeos/user => ChromeSettingsProto
160   //   google/chromeos/publicaccount => ChromeSettingsProto
161   //   google/chrome/extension => ExternalPolicyData
162   //   google/android/user => ChromeSettingsProto
163   //   google/ios/user => ChromeSettingsProto
164   optional string policy_type = 1;
166   // This is the last policy timestamp that client received from server.
167   optional int64 timestamp = 2;
169   // Tell server what kind of security signature is required.
170   enum SignatureType {
171     NONE = 0;
172     SHA1_RSA = 1;
173   }
174   optional SignatureType signature_type = 3 [default = NONE];
176   // The version number of the public key that is currently stored
177   // on the client. This should be the last number the server had
178   // supplied as new_public_key_version in PolicyData.
179   // This field is unspecified if the client does not yet have a
180   // public key.
181   optional int32 public_key_version = 4;
183   // Machine hardware id, such as serial number.
184   // This field is should be set only if the serial number for the device is
185   // missing from the server, as indicated by the valid_serial_number_missing
186   // field in the last policy fetch response.
187   optional string machine_id = 5;
189   // This field is used for devices to send the additional ID to fetch settings.
190   // Retrieving some settings requires more than just device or user ID.
191   // For example, to retrieve public account, devices need to pass in
192   // public account ID in addition to device ID. To retrieve extension or
193   // plug-in settings, devices need to pass in extension/plug-in ID in
194   // addition to user ID.
195   // policy_type represents the type of settings (e.g. public account,
196   // extension) devices request to fetch.
197   optional string settings_entity_id = 6;
199   // If this fetch is due to a policy invalidation, this field contains the
200   // version provided with the invalidation. The server interprets this value
201   // and the value of invalidation_payload to fetch the up-to-date policy.
202   optional int64 invalidation_version = 7;
204   // If this fetch is due to a policy invalidation, this field contains the
205   // payload delivered with the invalidation. The server interprets this value
206   // and the value of invalidation_version to fetch the up-to-date policy.
207   optional bytes invalidation_payload = 8;
209   // Hash string for the chrome policy verification public key which is embedded
210   // into Chrome binary. Matching private key will be used by the server
211   // to sign per-domain policy keys during key rotation. If server does not
212   // have the key which matches this hash string, that could indicate malicious
213   // or out-of-date Chrome client.
214   optional string verification_key_hash = 9;
217 // This message customizes how the device behaves when it is disabled by its
218 // owner. The message will be sent as part of the DeviceState fetched during
219 // normal operation and as part of the DeviceStateRetrievalResponse fetched when
220 // the device is wiped/reinstalled.
221 message DisabledState {
222   // A message to the finder/thief that should be shown on the screen.
223   optional string message = 1;
226 message DeviceState {
227   // Modes of operation that the device can be in.
228   enum DeviceMode {
229     // The device is operating normally. Sessions can be started and the device
230     // can be used.
231     DEVICE_MODE_NORMAL = 0;
232     // The device has been disabled by its owner. The device will show a warning
233     // screen and will not allow any sessions to be started.
234     DEVICE_MODE_DISABLED = 1;
235   }
236   // The mode of operation that the device should be in.
237   optional DeviceMode device_mode = 1 [default = DEVICE_MODE_NORMAL];
239   // State that is relevant only when the |device_mode| is
240   // |DEVICE_MODE_DISABLED|.
241   optional DisabledState disabled_state = 2;
244 // This message is included in serialized form in PolicyFetchResponse
245 // below.  It may also be signed, with the signature being created for
246 // the serialized form.
247 message PolicyData {
248   // See PolicyFetchRequest.policy_type.
249   optional string policy_type = 1;
251   // [timestamp] is milliseconds since Epoch in UTC timezone. It is
252   // included here so that the time at which the server issued this
253   // response cannot be faked (as protection against replay attacks).
254   // It is the timestamp generated by DMServer, NOT the time admin
255   // last updated the policy or anything like that.
256   optional int64 timestamp = 2;
258   // The DM token that was used by the client in the HTTP POST header
259   // for authenticating the request. It is included here again so that
260   // the client can verify that the response is meant for him (and not
261   // issued by a replay or man-in-the-middle attack).
262   optional string request_token = 3;
264   // The serialized value of the actual policy protobuf.  This can be
265   // deserialized to an instance of, for example, ChromeSettingsProto,
266   // ChromeDeviceSettingsProto, or ExternalPolicyData.
267   optional bytes policy_value = 4;
269   // The device display name assigned by the server.  It is only
270   // filled if the display name is available.
271   //
272   // The display name of the machine as generated by the server or set
273   // by the Administrator in the CPanel GUI. This is the same thing as
274   // |machine_name| in DeviceRegisterResponse but it might have
275   // changed since then.
276   optional string machine_name = 5;
278   // Version number of the server's current public key. (The key that
279   // was used to sign this response. Numbering should start at 1 and be
280   // increased by 1 at each key rotation.)
281   optional int32 public_key_version = 6;
283   // The user this policy is intended for. In case of device policy, the name
284   // of the owner (who registered the device).
285   optional string username = 7;
287   // In this field the DMServer should echo back the "deviceid" HTTP parameter
288   // from the request.
289   optional string device_id = 8;
291   // Indicates which state this association with DMServer is in. This can be
292   // used to tell the client that it is not receiving policy even though the
293   // registration with the server is kept active.
294   enum AssociationState {
295     // Association is active and policy is pushed.
296     ACTIVE = 0;
297     // Association is alive, but the corresponding domain is not managed.
298     UNMANAGED = 1;
299     // Client got dropped on the server side.
300     DEPROVISIONED = 2;
301   }
302   optional AssociationState state = 9 [default = ACTIVE];
304   // Indicates if the the server cannot find a valid serial number for the
305   // device.  If this flag is set, the device should send the valid serial
306   // number with a device policy fetch request.  Note that this only
307   // applies to device policy.
308   optional bool valid_serial_number_missing = 10;
310   // Indicates which public account or extension/plug-in this policy data is
311   // for. See PolicyFetchRequest.settings_entity_id for more details.
312   optional string settings_entity_id = 11;
314   // Indicates the identity the device service account is associated with.
315   // This is only sent as part of device policy fetch.
316   optional string service_account_identity = 12;
318   // The object source which hosts policy objects within the invalidation
319   // service. This value is combined with invalidation_name to form the object
320   // id used to register for invalidations to this policy.
321   optional int32 invalidation_source = 13;
323   // The name which uniquely identifies this policy within the invalidation
324   // service object source. This value is combined with invalidation_source to
325   // form the object id used to register for invalidations to this policy.
326   optional bytes invalidation_name = 14;
328   // Server-provided identifier of the fetched policy. This is to be used
329   // by the client when requesting Policy Posture assertion through an API
330   // call or SAML flow.
331   optional string policy_token = 15;
333   // Indicates the management mode of the device. Note that old policies do not
334   // have this field. If this field is not set but request_token is set, assume
335   // the management mode is ENTERPRISE_MANAGED. If both this field and
336   // request_token are not set, assume the management mode is LOCAL_OWNER.
337   enum ManagementMode {
338     // The device is owned locally. The policies are set by the local owner of
339     // the device.
340     LOCAL_OWNER = 0;
341     // The device is enterprise-managed. The policies come from the enterprise
342     // server. See the comment above for backward compatibility.
343     ENTERPRISE_MANAGED = 1;
344     // The device is consumer-managed. The policies currently can only be set
345     // by the local owner of the device.
346     CONSUMER_MANAGED = 2;
347   }
348   optional ManagementMode management_mode = 16;
350   // Indicates the state that the device should be in.
351   optional DeviceState device_state = 17;
353   // The free-text location info the admin enters to associate the device
354   // with a location.
355   optional string annotated_location = 20;
357   // The free-text asset identifier the admin enters to associate the device
358   // with a user-generated identifier.
359   optional string annotated_asset_id = 21;
361   // The unique directory api ID of the device which was generated on the
362   // server-side.
363   optional string directory_api_id = 22;
366 message PolicyFetchResponse {
367   // Since a single policy request may ask for multiple policies, we
368   // provide separate error code for each individual policy fetch.
370   // We will use standard HTTP Status Code as error code.
371   optional int32 error_code = 1;
373   // Human readable error message for customer support purpose.
374   optional string error_message = 2;
376   // This is a serialized |PolicyData| protobuf (defined above).
377   optional bytes policy_data = 3;
379   // Signature of the policy data above.
380   optional bytes policy_data_signature = 4;
382   // If the public key has been rotated on the server, the new public
383   // key is sent here. It is already used for |policy_data_signature|
384   // above, whereas |new_public_key_signature| is created using the
385   // old key (so the client can trust the new key). If this is the
386   // first time when the client requests policies (so it doesn't have
387   // on old public key), then |new_public_key_signature| is empty.
388   optional bytes new_public_key = 5;
389   optional bytes new_public_key_signature = 6;
391   // If new_public_key is specified, this field contains a signature
392   // of a PolicyPublicKeyAndDomain protobuf, signed using a key only
393   // available to DMServer. The public key portion of this well-known key is
394   // embedded into the Chrome binary. The hash of that embedded key is passed
395   // to DMServer as verification_key_hash field in PolicyFetchRequest. DMServer
396   // will pick a private key on the server which matches the hash (matches
397   // public key on the client). If DMServer is unable to find matching key, it
398   // will return an error instead of policy data.
399   // In case hash was not specified, DMServer will leave verification signature
400   // field empty (legacy behavior).
401   // In addition to the checks between new_public_key
402   // and new_public_key_signature described above, Chrome also verifies
403   // new_public_key with the embedded public key and
404   // new_public_key_verification_signature.
405   optional bytes new_public_key_verification_signature = 7;
408 // Protobuf used to generate the new_public_key_verification_signature field.
409 message PolicyPublicKeyAndDomain {
410   // The public key to sign (taken from the |new_public_key| field in
411   // PolicyFetchResponse).
412   optional bytes new_public_key = 1;
414   // The domain associated with this key (should match the domain portion of
415   // the username field of the policy).
416   optional string domain = 2;
419 // This protobuf defines a single remote command from server to client for
420 // execution.
421 message RemoteCommand {
422   enum Type {
423     // Simple echo command for testing, will be ignored in production code.
424     COMMAND_ECHO_TEST = -1;
426     // Reboot the device.
427     DEVICE_REBOOT = 0;
429     // Take a screenshot.
430     DEVICE_SCREENSHOT = 1;
431   }
433   // The command type.
434   optional Type type = 1;
436   // An opaque unique identifier for the command.
437   optional int64 unique_id = 2;
439   // The age of the command (in milliseconds) when it is sent from server to
440   // client, defined as current_server_time - command_generated_time.
441   optional int64 age_of_command = 3;
443   // Extra parameters for this command, expected to be a JSON string.
444   optional string payload = 4;
447 // This protobuf defines the execution result of a single remote command
448 // which will be sent back to the server.
449 message RemoteCommandResult {
450   enum ResultType {
451     RESULT_IGNORED = 0;  // The command was ignored as obsolete.
452     RESULT_FAILURE = 1;  // The command could not be executed.
453     RESULT_SUCCESS = 2;  // The command was successfully executed.
454   }
456   // The result of the command.
457   optional ResultType result = 1;
459   // The opaque unique identifier of the command. This value is copied from the
460   // RemoteCommand protobuf that contained the command.
461   optional int64 unique_id = 2;
463   // The time at which the command was executed, if the the result is
464   // RESULT_SUCCESS.
465   optional int64 timestamp = 3;
467   // Extra information sent to server as result of execution, expected to be a
468   // JSON string.
469   optional string payload = 4;
472 message DeviceRemoteCommandRequest {
473   // The command ID of the last command received from the server until
474   // now.  Omitted if no commands have been received yet.
475   optional int64 last_command_unique_id = 1;
477   // The execution results of previously fetched commands.
478   // The client should send back a command result whenever possible.
479   repeated RemoteCommandResult command_results = 2;
482 message DeviceRemoteCommandResponse {
483   // The queue of pending commands.
484   repeated RemoteCommand commands = 1;
487 // Request from device to server for reading policies.
488 message DevicePolicyRequest {
489   // The policy fetch request.  If this field exists, the request must
490   // comes from a non-TT client.  The repeated field allows client to
491   // request multiple policies for better performance.
492   repeated PolicyFetchRequest request = 3;
495 // Response from server to device for reading policies.
496 message DevicePolicyResponse {
497   // The policy fetch response.
498   repeated PolicyFetchResponse response = 3;
501 message TimePeriod {
502   // [timestamp] is milli seconds since Epoch in UTC timezone.
503   optional int64 start_timestamp = 1;
504   optional int64 end_timestamp = 2;
507 message ActiveTimePeriod {
508   optional TimePeriod time_period = 1;
510   // The active duration during the above time period.
511   // The unit is milli-second.
512   optional int32 active_duration = 2;
515 // This captures launch events for one app/extension or other installments.
516 message InstallableLaunch {
517   optional string install_id = 1;
519   // Time duration where this report covers. These are required
520   // and the record will be ignored if not set.
521   optional TimePeriod duration = 2;
523   // Client will send at most 50 timestamps to DM. All the rest
524   // launch activities will be summed into the total count.
525   // We will distribute the count evenly among the time span when
526   // doing time based aggregation.
527   repeated int64 timestamp = 3;
528   optional int64 total_count = 4;
531 // Used to report the device location.
532 message DeviceLocation {
533   enum ErrorCode {
534     ERROR_CODE_NONE                 = 0;
535     ERROR_CODE_POSITION_UNAVAILABLE = 1;
536   }
538   // Latitude in decimal degrees north (WGS84 coordinate frame).
539   optional double latitude = 1;
541   // Longitude in decimal degrees west (WGS84 coordinate frame).
542   optional double longitude = 2;
544   // Altitude in meters (above WGS84 datum).
545   optional double altitude = 3;
547   // Accuracy of horizontal position in meters.
548   optional double accuracy = 4;
550   // Accuracy of altitude in meters.
551   optional double altitude_accuracy = 5;
553   // Heading in decimal degrees clockwise from true north.
554   optional double heading = 6;
556   // Horizontal component of device velocity in meters per second.
557   optional double speed = 7;
559   // Time of position measurement in milisecons since Epoch in UTC time.
560   optional int64 timestamp = 8;
562   // Error code, see enum above.
563   optional ErrorCode error_code = 9;
565   // Human-readable error message.
566   optional string error_message = 10;
569 // Details about a network interface.
570 message NetworkInterface {
571   // Indicates the type of network device.
572   enum NetworkDeviceType {
573     TYPE_ETHERNET = 0;
574     TYPE_WIFI = 1;
575     TYPE_WIMAX = 2;
576     TYPE_BLUETOOTH = 3;
577     TYPE_CELLULAR = 4;
578   }
580   // Network device type.
581   optional NetworkDeviceType type = 1;
583   // MAC address (if applicable) of the corresponding network device. This is
584   // formatted as an ASCII string with 12 hex digits. Example: A0B1C2D3E4F5.
585   optional string mac_address = 2;
587   // MEID (if applicable) of the corresponding network device. Formatted as
588   // ASCII string composed of 14 hex digits. Example: A10000009296F2.
589   optional string meid = 3;
591   // IMEI (if applicable) of the corresponding network device. 15-16 decimal
592   // digits encoded as ASCII string. Example: 355402040158759.
593   optional string imei = 4;
595   // The device path associated with this network interface.
596   optional string device_path = 5;
600 // Information about configured/visible networks - this is separate from
601 // NetworkInterface because a configured network may not be associated with
602 // any specific interface, or may be visible across multiple interfaces.
603 message NetworkState {
604   // The current state of this network.
605   enum ConnectionState {
606     IDLE = 0;
607     CARRIER = 1;
608     ASSOCIATION = 2;
609     CONFIGURATION = 3;
610     READY = 4;
611     PORTAL = 5;
612     OFFLINE = 6;
613     ONLINE = 7;
614     DISCONNECT = 8;
615     FAILURE = 9;
616     ACTIVATION_FAILURE = 10;
617     UNKNOWN = 11;
618   }
620   // For networks associated with a device, the path of the device.
621   optional string device_path = 1;
623   // Current state of this connection as reported by shill.
624   optional ConnectionState connection_state = 2;
626   // For wireless networks, the signal_strength in dBm.
627   optional int32 signal_strength = 3;
629   // The IP address this interface is bound to, if any.
630   optional string ip_address = 4;
632   // The gateway IP for this interface, if any.
633   optional string gateway = 5;
636 // Details about a device user.
637 message DeviceUser {
638   // Types of device users which can be reported.
639   enum UserType {
640     // A user managed by the same domain as the device.
641     USER_TYPE_MANAGED = 0;
643     // A user not managed by the same domain as the device.
644     USER_TYPE_UNMANAGED = 1;
645   }
647   // The type of the user.
648   required UserType type = 1;
650   // Email address of the user. Present only if the user type is managed.
651   optional string email = 2;
654 // Information about a single disk volume.
655 message VolumeInfo {
656   optional string volume_id = 1;
657   optional int64 storage_total = 2;
658   optional int64 storage_free = 3;
661 // Report device level status.
662 message DeviceStatusReportRequest {
663   // The OS version reported by the device is a platform version
664   // e.g. 1435.0.2011_12_16_1635.
665   optional string os_version = 1;
666   optional string firmware_version = 2;
668   // "Verified", "Dev". Same as verified mode.
669   // If the mode is unknown, this field should not be set.
670   optional string boot_mode = 3;
672   // Device active times collection since last report rpc call.
673   // No longer used -- use active_period instead.
674   repeated TimePeriod active_time = 4 [deprecated = true];
676   // The browser version string as shown in the About dialog.
677   // e.g. 17.0.963.18.
678   optional string browser_version = 5;
680   // A list of periods when the device was active, aggregated by day.
681   repeated ActiveTimePeriod active_period = 6;
683   // The device location.
684   optional DeviceLocation device_location = 7;
686   // List of network interfaces.
687   repeated NetworkInterface network_interface = 8;
689   // List of recent device users, in descending order by last login time.
690   repeated DeviceUser user = 9;
692   // Disk space + other info about mounted/connected volumes.
693   repeated VolumeInfo volume_info = 10;
695   // List of visible/configured networks
696   repeated NetworkState network_state = 11;
698   // Samples of CPU utilization (0-100), sampled once every 120 seconds.
699   repeated int32 cpu_utilization_pct = 12;
701   // Free RAM (unreliable due to GC).
702   optional int64 deprecated_system_ram_free = 13 [deprecated = true];
704   // Total RAM on the device.
705   optional int64 system_ram_total = 14;
707   // Samples of free RAM [in bytes] (unreliable due to GC).
708   repeated int64 system_ram_free = 15;
711 // Provides status information for an installed app/extension.
712 message AppStatus {
713   // ID of the installed app/extension
714   optional string app_id = 1;
716   // Currently installed version of the app.
717   optional string extension_version = 2;
719   // Self-reported status summary (via chrome.reporting APIs)
720   optional string status = 3;
722   // If true, the application is currently in a self-reported error state.
723   optional bool error = 4;
726 // Report session (a user on one device) level status.
727 message SessionStatusReportRequest {
728   // Installed apps for this user on this device.
729   // No longer used -- use installed_apps instead.
730   repeated string installed_app_id = 1 [deprecated = true];
732   // Installed extensions for this user on this device.
733   // No longer used -- use installed_extensions instead.
734   repeated string installed_extension_id = 2 [deprecated = true];
736   // One stat per app for top 30 apps.
737   repeated InstallableLaunch app_launch_stat = 3;
739   // If this is a kiosk session, this is the device local account ID.
740   optional string device_local_account_id = 4;
742   // Information about installed apps for this user on this device.
743   repeated AppStatus installed_apps = 5;
745   // Information about installed extensions for this user on this device.
746   repeated AppStatus installed_extensions = 6;
749 // Response from DMServer to update devices' status.
750 // It is possible that status report fails but policy request succeed.  In such
751 // case, the DeviceStatusReportResponse will contain an error code and the
752 // device should re-send status report data in the next policy request.  The
753 // device should re-send report data if policy request fails, even if
754 // DeviceStatusReportResponse contains no error code.
755 message DeviceStatusReportResponse {
756   optional int32 error_code = 1;
758   // Human readable error message for customer support purpose.
759   optional string error_message = 2;
762 // Response from DMServer to update user devices' status.
763 // It is possible that status report fails but policy request succeed.  In such
764 // case, the SessionStatusReportResponse will contain an error code and the
765 // device should re-send status report data in the next policy request.  The
766 // device should re-send report data if policy request fails, even if
767 // SessionStatusReportResponse contains no error code.
768 message SessionStatusReportResponse {
769   optional int32 error_code = 1;
771   // Human readable error message for customer support purpose.
772   optional string error_message = 2;
775 // Request from device to server to determine whether the device should
776 // go through enterprise enrollment. Unlike the other requests, this request is
777 // not authenticated.
778 message DeviceAutoEnrollmentRequest {
779   // SHA-256 hash of the device's serial number, mod |modulus|.
780   // Should always be present.
781   optional int64 remainder = 1;
783   // Modulus of the hash used by the client. Should always be present. This
784   // is the number of buckets the client thinks the server has. For now,
785   // it is a power of 2, but due to the strict constraint on how many serial
786   // numbers a bucket can contain, it may become non power of 2. If that
787   // happens, client-side needs to change its assumption.
788   optional int64 modulus = 2;
791 // Response from server to auto-enrollment detection request.
792 message DeviceAutoEnrollmentResponse {
793   // If this field is present, the other fields are ignored and the client
794   // should send a new DeviceAutoEnrollmentRequest with a new |remainder|
795   // computed using this new |modulus|. If this field is empty, the client's
796   // request was accepted.
797   // DMServer guarantees that if the modulus sent by client in
798   // DeviceAutoEnrollmentRequest matches server's expectation, this field
799   // is unset.
800   optional int64 expected_modulus = 1;
802   // List of hashes in the client's hash bucket. If the client's hash matches
803   // any in this list, the client device should do enterprise enrollment.
804   // If it matches none, enrollment should be optional.
805   // Each entry has exactly 256 bits (32 bytes).
806   repeated bytes hash = 2;
809 // Sent by the client to the server. The device management server keeps a
810 // mapping of device identifiers to device state. Devices query this table after
811 // hard reset in order recover state. This request is keyed just by the opaque
812 // server-backed state key; there is no further authentication.
813 message DeviceStateRetrievalRequest {
814   // Opaque, client-determined, unpredictable, stable and unique device
815   // identifier to retrieve state for. This field contains 32 bytes of data that
816   // looks essentially random to the server. It may be generated e.g. by running
817   // a concatenation of suitable device identifiers through a cryptographic hash
818   // algorithm such as SHA-256.
819   optional bytes server_backed_state_key = 1;
822 // Sent by the client to the server when in registered state to update the
823 // device-determined device state keys.
824 message DeviceStateKeyUpdateRequest {
825   // The client-determined state keys. To the server, these look like 32 bytes
826   // of random data. The client should generate these keys using a deterministic
827   // algorithm that takes stable device identifiers as an input and produces a
828   // key as the output, possibly by running the identifiers through a
829   // cryptographic hash function such as SHA-256.
830   repeated bytes server_backed_state_key = 1;
833 // Server to client message carrying the device state response. Because the
834 // request is not authenticated, the only protection against state extraction
835 // from server is the unpredictability of the server-backed state ID. Thus, the
836 // response should not contain any sensitive data. If the server doesn't know
837 // the requested identifier, it just return a message with restore_mode set to
838 // RESTORE_MODE_NONE.
839 message DeviceStateRetrievalResponse {
840   // Restorative action to take after device reset.
841   enum RestoreMode {
842     // No state restoration.
843     RESTORE_MODE_NONE = 0;
844     // Enterprise enrollment requested, but user may skip.
845     RESTORE_MODE_REENROLLMENT_REQUESTED = 1;
846     // Enterprise enrollment is enforced and cannot be skipped.
847     RESTORE_MODE_REENROLLMENT_ENFORCED = 2;
848     // The device has been disabled by its owner. The device will show a warning
849     // screen and prevent the user from proceeding further.
850     RESTORE_MODE_DISABLED = 3;
851   };
852   // The server-indicated restore mode.
853   optional RestoreMode restore_mode = 1 [default = RESTORE_MODE_NONE];
855   // Primary domain the device is associated with.
856   optional string management_domain = 2;
858   // State that is relevant only when the |restore_mode| is
859   // |RESTORE_MODE_DISABLED|.
860   optional DisabledState disabled_state = 3;
863 // Sent by the client to the server to pair the Host device with the Controller
864 // device. The HTTP request contains an end-user OAuth token and only succeeds
865 // if both Host and Controller devices belong to the end-user domain.
866 message DevicePairingRequest {
868   // The device ID of the Host device.
869   optional string host_device_id = 1;
871   // The device ID of the Controller device.
872   optional string controller_device_id = 2;
875 // Response from the server to the device pairing request.
876 message DevicePairingResponse {
878   // The client should check HTTP status code first. If HTTP status code is not
879   // 200 (e.g. 500 internal error), then it means the pairing fails. If HTTP
880   // status code is 200, then the client should check the status code within the
881   // response.
882   enum StatusCode {
883     SUCCESS = 0;
885     // A generic failure code for pairing.
886     FAILED = 1;
888     // The Host device cannot be found in the user's domain.
889     HOST_DEVICE_NOT_FOUND = 2;
891     // The Controller device cannot be found in the user's domain.
892     CONTROLLER_DEVICE_NOT_FOUND  = 3;
894     // The Host device is deprovisioned.
895     HOST_DEVICE_DEPROVISIONED = 4;
897     // The Controller device is deprovisioned.
898     CONTROLLER_DEVICE_DEPROVISIONED = 5;
899   }
901   optional StatusCode status_code = 1 [default = FAILED];
904 // Sent by the client to the server to check if the devices are paired. The HTTP
905 // request contains controller service account OAuth token as well as the
906 // DMToken from the Host device.
907 message CheckDevicePairingRequest {
909   // The device ID of the Host device.
910   optional string host_device_id = 1;
912   // The device ID of the Controller device.
913   optional string controller_device_id = 2;
916 // Response from the server to the check device pairing request.
917 message CheckDevicePairingResponse {
919   // The client should check HTTP status code first. If HTTP status code is not
920   // 200 (e.g. 500 internal error), then it means the pairing status is unknown.
921   // If HTTP status code is 200, then the client should check the status code
922   // within the response.
923   enum StatusCode {
924     PAIRED = 0;
926     // The Host and Controller devices are not paired.
927     NOT_PAIRED = 1;
929     // The Host device cannot be found in the Host device domain.
930     HOST_DEVICE_NOT_FOUND = 2;
932     // The Controller device cannot be found in the Host device domain.
933     CONTROLLER_DEVICE_NOT_FOUND  = 3;
935     // The Host device is deprovisioned.
936     HOST_DEVICE_DEPROVISIONED = 4;
938     // The Controller device is deprovisioned.
939     CONTROLLER_DEVICE_DEPROVISIONED = 5;
941     // Invalid controller identity.
942     INVALID_CONTROLLER_DEVICE_IDENTITY = 6;
943   }
945   optional StatusCode status_code = 1 [default = NOT_PAIRED];
948 // Sent by the client to the server to check if the current user is allowed
949 // to update attributes (asset id and location).  The HTTP request contains an
950 // end-user OAuth token.
951 message DeviceAttributeUpdatePermissionRequest {
954 // Response from the server specifying whether the current user is allowed to
955 // update attributes (asset id and location).
956 message DeviceAttributeUpdatePermissionResponse {
957   enum ResultType {
958     ATTRIBUTE_UPDATE_DISALLOWED = 0;
959     ATTRIBUTE_UPDATE_ALLOWED = 1;
960   }
962   optional ResultType result = 1;
965 // Sent by the client to the server to update device attributes (asset id and
966 // location).  The HTTP request contains an end-user OAuth token.
967 message DeviceAttributeUpdateRequest {
968   // The user-generated asset identifier.
969   optional string asset_id = 1;
971   // The user input device location.
972   optional string location = 2;
975 // Response from the server to update device attributes (asset id and location).
976 message DeviceAttributeUpdateResponse {
977   enum ResultType {
978     ATTRIBUTE_UPDATE_ERROR = 0;
979     ATTRIBUTE_UPDATE_SUCCESS = 1;
980   }
982   optional ResultType result = 1;
985 // Request from the DMAgent on the device to the DMServer.  This is
986 // container for all requests from device to server.  The overall HTTP
987 // request MUST be in the following format:
989 // * HTTP method is POST
990 // * Data mime type is application/x-protobuffer
991 // * HTTP parameters are (all required, all case sensitive):
992 //   * request: MUST BE one of
993 //     * api_authorization
994 //     * cert_upload
995 //     * check_device_pairing
996 //     * device_pairing
997 //     * device_state_retrieval
998 //     * enterprise_check
999 //     * ping
1000 //     * policy
1001 //     * register
1002 //     * status
1003 //     * unregister
1004 //     * remote_commands
1005 //     * attribute_update_permission
1006 //     * attribute_update
1008 //   * devicetype: MUST BE "1" for Android or "2" for Chrome OS.
1009 //   * apptype: MUST BE Android or Chrome.
1010 //   * deviceid: MUST BE no more than 64-char in [\x21-\x7E].
1011 //   * agent: MUST BE a string of characters.
1012 // * HTTP Authorization header MUST be in the following formats:
1013 //   * For register and ping requests
1014 //     Authorization: GoogleLogin auth=<auth cookie for Mobile Sync>
1016 //   * For unregister, policy, status, cert_upload and remote commands requests
1017 //      Authorization: GoogleDMToken token=<dm token from register>
1019 //   * The Authorization header isn't used for enterprise_check
1020 //     request, nor for register requests using OAuth. In the latter case,
1021 //     the OAuth token is passed in the "oauth" parameter.
1023 // DeviceManagementRequest should only contain one request which matches the
1024 // HTTP query parameter - request, as listed below. Other requests within the
1025 // container will be ignored.
1026 //   cert_upload: cert_upload_request
1027 //   check_device_pairing: check_device_pairing_request
1028 //   device_pairing: device_pairing_request
1029 //   device_state_retrieval: device_state_retrieval_request
1030 //   enterprise_check: auto_enrollment_request
1031 //   ping: policy_request
1032 //   policy: policy_request
1033 //   register: register_request
1034 //   status: device_status_report_request or session_status_report_request
1035 //   unregister: unregister_request
1036 //   remote_commands: remote_command_request
1037 //   attribute_update_permission: device_attribute_update_permission_request
1038 //   attribute_update: device_attribute_update_request
1040 message DeviceManagementRequest {
1041   // Register request.
1042   optional DeviceRegisterRequest register_request = 1;
1044   // Unregister request.
1045   optional DeviceUnregisterRequest unregister_request = 2;
1047   // Policy request.
1048   optional DevicePolicyRequest policy_request = 3;
1050   // Update status.
1051   optional DeviceStatusReportRequest device_status_report_request = 4;
1052   optional SessionStatusReportRequest session_status_report_request = 5;
1054   // Auto-enrollment detection.
1055   optional DeviceAutoEnrollmentRequest auto_enrollment_request = 6;
1057   // EMCert upload (for remote attestation)
1058   optional DeviceCertUploadRequest cert_upload_request = 7;
1060   // Request for OAuth2 authorization codes to access Google services.
1061   optional DeviceServiceApiAccessRequest service_api_access_request = 8;
1063   // Device-state retrieval.
1064   optional DeviceStateRetrievalRequest device_state_retrieval_request = 9;
1066   // Device state key update.
1067   optional DeviceStateKeyUpdateRequest device_state_key_update_request = 10;
1069   // Pair two devices.
1070   optional DevicePairingRequest device_pairing_request = 11;
1072   // Check if two devices are paired.
1073   optional CheckDevicePairingRequest check_device_pairing_request = 12;
1075   // Remote command fetching.
1076   optional DeviceRemoteCommandRequest remote_command_request = 13;
1078   // Check permission for updating device attribute.
1079   optional DeviceAttributeUpdatePermissionRequest
1080       device_attribute_update_permission_request = 14;
1082   // Update device attribute.
1083   optional DeviceAttributeUpdateRequest device_attribute_update_request
1084       = 15;
1087 // Response from server to device.
1089 // The server uses the following numbers as HTTP status codes
1090 // to report top-level errors.
1092 // 200 OK: valid response is returned to client.
1093 // 400 Bad Request: invalid argument.
1094 // 401 Unauthorized: invalid auth cookie or DM token.
1095 // 403 Forbidden: device management is not allowed.
1096 // 404 Not Found: the request URL is invalid.
1097 // 410 Device Not Found: the device id is not found.
1098 // 491 Request Pending: the request is pending approval.
1099 // 500 Internal Server Error: most likely a bug in DM server.
1100 // 503 Service Unavailable: most likely a backend error.
1101 // 901 Device Not Found: the device id is not found.
1102 // 902 Policy Not Found: the policy is not found.
1103 message DeviceManagementResponse {
1104   // Error message.
1105   optional string error_message = 2;
1107   // Register response
1108   optional DeviceRegisterResponse register_response = 3;
1110   // Unregister response
1111   optional DeviceUnregisterResponse unregister_response = 4;
1113   // Policy response.
1114   optional DevicePolicyResponse policy_response = 5;
1116   // Device status report response.
1117   optional DeviceStatusReportResponse device_status_report_response = 6;
1119   // Session status report response.
1120   optional SessionStatusReportResponse session_status_report_response = 7;
1122   // Auto-enrollment detection response.
1123   optional DeviceAutoEnrollmentResponse auto_enrollment_response = 8;
1125   // EMCert upload response.
1126   optional DeviceCertUploadResponse cert_upload_response = 9;
1128   // Response to OAuth2 authorization code request.
1129   optional DeviceServiceApiAccessResponse service_api_access_response = 10;
1131   // Device-state retrieval.
1132   optional DeviceStateRetrievalResponse device_state_retrieval_response = 11;
1134   // Response to device pairing request.
1135   optional DevicePairingResponse device_pairing_response = 12;
1137   // Response to check device pairing request.
1138   optional CheckDevicePairingResponse check_device_pairing_response = 13;
1140   // Response to remote command request.
1141   optional DeviceRemoteCommandResponse remote_command_response = 14;
1143   // Response to check device attribute update permission.
1144   optional DeviceAttributeUpdatePermissionResponse
1145       device_attribute_update_permission_response = 15;
1147   // Response to update device attribute.
1148   optional DeviceAttributeUpdateResponse device_attribute_update_response = 16;