| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // Next MinVersion: 4 |
| |
| module arc.mojom; |
| |
| [Extensible] |
| enum MountEvent { |
| // Mounts a volume in Android. |
| MOUNTING, |
| // Unmounts a volume in Android. |
| UNMOUNTING, |
| }; |
| |
| [Extensible] |
| enum DeviceType { |
| // Neither USB device nor SD card is inserted. |
| DEVICE_TYPE_UNKNOWN, |
| // USB device is inserted. |
| DEVICE_TYPE_USB, |
| // SD card is inserted. |
| DEVICE_TYPE_SD, |
| }; |
| |
| struct MountPointInfo { |
| // The type of mount event to be triggered in Android. |
| MountEvent mount_event; |
| // The device source path of this mount point. |
| string source_path; |
| // The path to the mounted volume. |
| string mount_path; |
| // The fs_uuid of the disk. If empty, the event should be ignored. |
| string fs_uuid; |
| // The file system label. |
| string label; |
| // The device type that contains this mount point. If unknown, the event |
| // should be ignored. |
| DeviceType device_type; |
| // Whether the mounted volume should be visible to Android apps. |
| // This is a user-controlled setting, which is accessible in "External |
| // storage preferences" screen in device settings. |
| [MinVersion=2] bool visible; |
| }; |
| |
| // Next Method ID: 3 |
| interface VolumeMounterHost { |
| // Requests all recorded MountPointInfos to be sent through a series of |
| // VolumeMounterInstance::OnMountEvent call. |
| [MinVersion=0] RequestAllMountPoints@1(); |
| |
| // Reports the number of mount failures for a volume. The value 0 indicates |
| // that the volume is successfully mounted without any failures. The maximum |
| // number (defined in Android's ArcVolumeMounterService) indicates that |
| // mounting the volume is given up after failing in maximum number of retries. |
| // A value n between them indicates that the volume is successfully mounted |
| // after n failures (= n retries). |
| // This method is called basically once for each volume, i.e., it's called |
| // once for the MyFiles volume after every Android boot, and called once every |
| // time a removable media device is inserted to Chrome OS. An exception is |
| // when a volume is ejected before it's mounted, in which time it's not |
| // called at all. Also, when Android's volume daemon (vold) is reset, all |
| // volumes are remounted and this method is called again for each of them. |
| [MinVersion=3] ReportMountFailureCount@2(uint16 count); |
| }; |
| |
| // Notifies Android about Mounting events. |
| // Next Method ID: 2 |
| interface VolumeMounterInstance { |
| // Establishes full-duplex communication with the host. |
| [MinVersion=1] Init@0(pending_remote<VolumeMounterHost> host_remote) => (); |
| |
| // Triggers a mount event in Android. |
| OnMountEvent@1(MountPointInfo mount_point_info); |
| }; |