chromium/ash/components/arc/mojom/volume_mounter.mojom

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next MinVersion: 5

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;
};

// Deprecated method IDs: 2
// Next Method ID: 4
interface VolumeMounterHost {
  // Requests all recorded MountPointInfos to be sent through a series of
  // VolumeMounterInstance::OnMountEvent call.
  [MinVersion=0] RequestAllMountPoints@1();

  // Sets up external storage mount points for MyFiles and removable media by
  // setting their owner to be Android's MediaProvider.
  [MinVersion=4] SetUpExternalStorageMountPoints@3(uint32 media_provider_uid)
      => (bool success);
};

// 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);
};