2012-07-16 09:38:18 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIVolumeStat.idl"
|
|
|
|
|
2014-12-21 18:33:33 -08:00
|
|
|
[scriptable, uuid(946B5334-6EC9-11E4-8689-F3061E5D46B0)]
|
2012-07-16 09:38:18 -07:00
|
|
|
interface nsIVolume : nsISupports
|
|
|
|
{
|
|
|
|
// These MUST match the states from android's system/vold/Volume.h header
|
|
|
|
const long STATE_INIT = -1;
|
|
|
|
const long STATE_NOMEDIA = 0;
|
|
|
|
const long STATE_IDLE = 1;
|
|
|
|
const long STATE_PENDING = 2;
|
|
|
|
const long STATE_CHECKING = 3;
|
|
|
|
const long STATE_MOUNTED = 4;
|
|
|
|
const long STATE_UNMOUNTING = 5;
|
|
|
|
const long STATE_FORMATTING = 6;
|
|
|
|
const long STATE_SHARED = 7;
|
|
|
|
const long STATE_SHAREDMNT = 8;
|
2014-10-30 19:30:48 -07:00
|
|
|
const long STATE_CHECKMNT = 100;
|
2012-07-16 09:38:18 -07:00
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
// The name of the volume. Often there is only one volume, called sdcard.
|
|
|
|
// But some phones support multiple volumes.
|
2012-07-16 09:38:18 -07:00
|
|
|
readonly attribute DOMString name;
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
// The mount point is the path on the system where the volume is mounted
|
|
|
|
// and is only valid when state == STATE_MOUNTED.
|
2012-07-16 09:38:18 -07:00
|
|
|
readonly attribute DOMString mountPoint;
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
// Reflects the current state of the volume, using STATE_xxx constants
|
|
|
|
// from above.
|
2012-07-16 09:38:18 -07:00
|
|
|
readonly attribute long state;
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
// mountGeneration is a unique number which is used distinguish between
|
|
|
|
// periods of time that a volume is in the mounted state. Each time a
|
|
|
|
// volume transitions to the mounted state, the mountGeneration will
|
|
|
|
// be different from the last time it transitioned to the mounted state.
|
|
|
|
readonly attribute long mountGeneration;
|
|
|
|
|
|
|
|
// While a volume is mounted, it can be locked, preventing it from being
|
2014-01-07 04:16:07 -08:00
|
|
|
// shared with the PC. To lock a volume, acquire an MozWakeLock
|
2012-12-14 16:01:34 -08:00
|
|
|
// using the name of this attribute. Note that mountLockName changes
|
|
|
|
// every time the mountGeneration changes, so you'll need to reacquire
|
|
|
|
// the wakelock every time the volume becomes mounted.
|
|
|
|
readonly attribute DOMString mountLockName;
|
|
|
|
|
2013-04-02 12:52:17 -07:00
|
|
|
// Determines if a mountlock is currently being held against this volume.
|
|
|
|
readonly attribute boolean isMountLocked;
|
|
|
|
|
2013-08-22 16:12:25 -07:00
|
|
|
// Determines if media is actually present or not. Note, that when an sdcard
|
|
|
|
// is ejected, it may go through several tranistory states before finally
|
|
|
|
// arriving at STATE_NOMEDIA. So isMediaPresent may be false even when the
|
|
|
|
// current state isn't STATE_NOMEDIA.
|
|
|
|
readonly attribute boolean isMediaPresent;
|
|
|
|
|
|
|
|
// Determines if the volume is currently being shared. This covers off
|
|
|
|
// more than just state == STATE_SHARED. isSharing will return true from the
|
|
|
|
// time that the volume leaves the mounted state, until it gets back to
|
|
|
|
// mounted, nomedia, or formatting states. This attribute is to allow
|
|
|
|
// device storage to suppress unwanted 'unavailable' status when
|
|
|
|
// transitioning from mounted to sharing and back again.
|
|
|
|
readonly attribute boolean isSharing;
|
|
|
|
|
2013-09-05 23:11:58 -07:00
|
|
|
// Determines if the volume is currently formatting. This sets true once
|
|
|
|
// mFormatRequest == true and mState == STATE_MOUNTED, and sets false
|
|
|
|
// once the volume has been formatted and mounted again.
|
|
|
|
readonly attribute boolean isFormatting;
|
|
|
|
|
2014-09-21 20:42:33 -07:00
|
|
|
readonly attribute boolean isUnmounting;
|
|
|
|
|
2012-07-16 09:38:18 -07:00
|
|
|
nsIVolumeStat getStats();
|
2013-07-08 23:37:47 -07:00
|
|
|
|
2013-09-05 23:11:58 -07:00
|
|
|
// Formats the volume in IO thread, if the volume is ready to be formatted.
|
|
|
|
// Automounter will unmount it, format it and then mount it again.
|
|
|
|
void format();
|
|
|
|
|
2014-03-04 03:24:19 -08:00
|
|
|
// Mounts the volume in IO thread, if the volume is already unmounted.
|
|
|
|
// Automounter will mount it. Otherwise Automounter will skip this.
|
|
|
|
void mount();
|
|
|
|
|
|
|
|
// Unmounts the volume in IO thread, if the volume is already mounted.
|
|
|
|
// Automounter will unmount it. Otherwise Automounter will skip this.
|
|
|
|
void unmount();
|
|
|
|
|
2013-07-08 23:37:47 -07:00
|
|
|
// Whether this is a fake volume.
|
|
|
|
readonly attribute boolean isFake;
|
2014-12-21 18:33:33 -08:00
|
|
|
|
|
|
|
// Whether this is a removable volume
|
|
|
|
readonly attribute boolean isRemovable;
|
|
|
|
|
|
|
|
// Whether this is a hot-swappable volume
|
|
|
|
readonly attribute boolean isHotSwappable;
|
|
|
|
|
2012-07-16 09:38:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
// For use with the ObserverService
|
|
|
|
#define NS_VOLUME_STATE_CHANGED "volume-state-changed"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
|
|
|
// Convert a state into a loggable/printable string.
|
2013-01-07 08:43:02 -08:00
|
|
|
const char* NS_VolumeStateStr(int32_t aState);
|
2012-07-16 09:38:18 -07:00
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
%}
|