dom/system/gonk/nsIVolume.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "nsISupports.idl"
     6 #include "nsIVolumeStat.idl"
     8 [scriptable, uuid(13caa69c-8f1f-11e3-8e36-10bf48d707fb)]
     9 interface nsIVolume : nsISupports
    10 {
    11   // These MUST match the states from android's system/vold/Volume.h header
    12   const long STATE_INIT        = -1;
    13   const long STATE_NOMEDIA     = 0;
    14   const long STATE_IDLE        = 1;
    15   const long STATE_PENDING     = 2;
    16   const long STATE_CHECKING    = 3;
    17   const long STATE_MOUNTED     = 4;
    18   const long STATE_UNMOUNTING  = 5;
    19   const long STATE_FORMATTING  = 6;
    20   const long STATE_SHARED      = 7;
    21   const long STATE_SHAREDMNT   = 8;
    23   // The name of the volume. Often there is only one volume, called sdcard.
    24   // But some phones support multiple volumes.
    25   readonly attribute DOMString name;
    27   // The mount point is the path on the system where the volume is mounted
    28   // and is only valid when state == STATE_MOUNTED.
    29   readonly attribute DOMString mountPoint;
    31   // Reflects the current state of the volume, using STATE_xxx constants
    32   // from above.
    33   readonly attribute long state;
    35   // mountGeneration is a unique number which is used distinguish between
    36   // periods of time that a volume is in the mounted state. Each time a
    37   // volume transitions to the mounted state, the mountGeneration will
    38   // be different from the last time it transitioned to the mounted state.
    39   readonly attribute long mountGeneration;
    41   // While a volume is mounted, it can be locked, preventing it from being
    42   // shared with the PC. To lock a volume, acquire an MozWakeLock
    43   // using the name of this attribute. Note that mountLockName changes
    44   // every time the mountGeneration changes, so you'll need to reacquire
    45   // the wakelock every time the volume becomes mounted.
    46   readonly attribute DOMString mountLockName;
    48   // Determines if a mountlock is currently being held against this volume.
    49   readonly attribute boolean isMountLocked;
    51   // Determines if media is actually present or not. Note, that when an sdcard
    52   // is ejected, it may go through several tranistory states before finally
    53   // arriving at STATE_NOMEDIA. So isMediaPresent may be false even when the
    54   // current state isn't STATE_NOMEDIA.
    55   readonly attribute boolean isMediaPresent;
    57   // Determines if the volume is currently being shared. This covers off
    58   // more than just state == STATE_SHARED. isSharing will return true from the
    59   // time that the volume leaves the mounted state, until it gets back to
    60   // mounted, nomedia, or formatting states. This attribute is to allow
    61   // device storage to suppress unwanted 'unavailable' status when
    62   // transitioning from mounted to sharing and back again.
    63   readonly attribute boolean isSharing;
    65   // Determines if the volume is currently formatting. This sets true once 
    66   // mFormatRequest == true and mState == STATE_MOUNTED, and sets false
    67   // once the volume has been formatted and mounted again.
    68   readonly attribute boolean isFormatting;
    70   nsIVolumeStat getStats();
    72   // Formats the volume in IO thread, if the volume is ready to be formatted.
    73   // Automounter will unmount it, format it and then mount it again.
    74   void format();
    76   // Mounts the volume in IO thread, if the volume is already unmounted.
    77   // Automounter will mount it. Otherwise Automounter will skip this.
    78   void mount();
    80   // Unmounts the volume in IO thread, if the volume is already mounted.
    81   // Automounter will unmount it. Otherwise Automounter will skip this.
    82   void unmount();
    84   // Whether this is a fake volume.
    85   readonly attribute boolean isFake;
    86 };
    88 %{C++
    89 // For use with the ObserverService
    90 #define NS_VOLUME_STATE_CHANGED  "volume-state-changed"
    92 namespace mozilla {
    93 namespace system {
    95 // Convert a state into a loggable/printable string.
    96 const char* NS_VolumeStateStr(int32_t aState);
    98 } // system
    99 } // mozilla
   100 %}

mercurial