dom/system/gonk/nsIVolume.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial