java.lang.Object | |
↳ | android.os.storage.StorageManager |
StorageManager is the interface to the systems storage service. The storage manager handles storage-related items such as Opaque Binary Blobs (OBBs).
OBBs contain a filesystem that maybe be encrypted on disk and mounted on-demand from an application. OBBs are a good way of providing large amounts of binary assets without packaging them into APKs as they may be multiple gigabytes in size. However, due to their size, they're most likely stored in a shared storage pool accessible from all programs. The system does not guarantee the security of the OBB file itself: if any program modifies the OBB, there is no guarantee that a read from that OBB will produce the expected output.
Get an instance of this class by calling
getSystemService(java.lang.String)
with an
argument of
STORAGE_SERVICE
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Check the mounted path of an Opaque Binary Blob (OBB) file.
|
||||||||||
|
Check whether an Opaque Binary Blob (OBB) is mounted or not.
|
||||||||||
|
Mount an Opaque Binary Blob (OBB) file.
|
||||||||||
|
Unmount an Opaque Binary Blob (OBB) file asynchronously.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Check the mounted path of an Opaque Binary Blob (OBB) file. This will give you the path to where you can obtain access to the internals of the OBB.
rawPath | path to OBB image |
---|
null
if
not mounted or exception encountered trying to read status
Check whether an Opaque Binary Blob (OBB) is mounted or not.
rawPath | path to OBB image |
---|
Mount an Opaque Binary Blob (OBB) file. If a
key
is
specified, it is supplied to the mounting process to be used in any
encryption used in the OBB.
The OBB will remain mounted for as long as the StorageManager reference
is held by the application. As soon as this reference is lost, the OBBs
in use will be unmounted. The
OnObbStateChangeListener
registered
with this call will receive the success or failure of this operation.
Note: you can only mount OBB files for which the OBB tag on the file matches a package ID that is owned by the calling program's UID. That is, shared UID applications can attempt to mount any other application's OBB that shares its UID.
rawPath | the path to the OBB file |
---|---|
key |
secret used to encrypt the OBB; may be
null
if no
encryption was used on the OBB.
|
listener | will receive the success or failure of the operation |
Unmount an Opaque Binary Blob (OBB) file asynchronously. If the
force
flag is true, it will kill any application needed to
unmount the given OBB (even the calling application).
The
OnObbStateChangeListener
registered with this call will
receive the success or failure of this operation.
Note: you can only mount OBB files for which the OBB tag on the file matches a package ID that is owned by the calling program's UID. That is, shared UID applications can obtain access to any other application's OBB that shares its UID.
rawPath | path to the OBB file |
---|---|
force | whether to kill any programs using this in order to unmount it |
listener | will receive the success or failure of the operation |