@Implements(value=android.os.Environment.class) public class ShadowEnvironment extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ShadowEnvironment.ShadowUserEnvironment
Shadow for
Environment.UserEnvironment |
| Constructor and Description |
|---|
ShadowEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.File |
addExternalDir(java.lang.String path)
Adds a directory to list returned by
ShadowEnvironment.ShadowUserEnvironment.getExternalDirs(). |
protected static java.io.File |
getExternalStorageDirectory() |
protected static java.io.File |
getExternalStoragePublicDirectory(java.lang.String type) |
protected static java.lang.String |
getExternalStorageState() |
protected static java.lang.String |
getExternalStorageState(java.io.File directory) |
protected static java.lang.String |
getStorageState(java.io.File directory) |
protected static boolean |
isExternalStorageEmulated() |
protected static boolean |
isExternalStorageEmulated(java.io.File path) |
protected static boolean |
isExternalStorageRemovable() |
protected static boolean |
isExternalStorageRemovable(java.io.File path) |
static void |
reset() |
static void |
setExternalStorageEmulated(java.io.File file,
boolean isEmulated)
Sets the “isEmulated” flag of a particular file.
|
static void |
setExternalStorageRemovable(java.io.File file,
boolean isRemovable)
Sets the “isRemovable” flag of a particular file.
|
static void |
setExternalStorageState(java.io.File directory,
java.lang.String state)
Sets the
getExternalStorageState(File) for given directory. |
static void |
setExternalStorageState(java.lang.String externalStorageState)
Sets the return value of
getExternalStorageState(). |
static void |
setIsExternalStorageEmulated(boolean emulated)
Sets the return value of
isExternalStorageEmulated(). |
@Implementation protected static java.lang.String getExternalStorageState()
public static void setExternalStorageState(java.lang.String externalStorageState)
Sets the return value of getExternalStorageState().
externalStorageState - Value to return from getExternalStorageState().public static void setIsExternalStorageEmulated(boolean emulated)
Sets the return value of isExternalStorageEmulated().
emulated - Value to return from isExternalStorageEmulated().@Implementation protected static java.io.File getExternalStorageDirectory()
@Implementation protected static java.io.File getExternalStoragePublicDirectory(java.lang.String type)
@Resetter public static void reset()
@Implementation protected static boolean isExternalStorageRemovable()
@Implementation(minSdk=19) protected static java.lang.String getStorageState(java.io.File directory)
@Implementation(minSdk=21) protected static java.lang.String getExternalStorageState(java.io.File directory)
@Implementation(minSdk=21) protected static boolean isExternalStorageRemovable(java.io.File path)
@Implementation(minSdk=21) protected static boolean isExternalStorageEmulated(java.io.File path)
@Implementation protected static boolean isExternalStorageEmulated()
public static void setExternalStorageRemovable(java.io.File file,
boolean isRemovable)
Sets the “isRemovable” flag of a particular file.
file - Target file.isRemovable - True if the filesystem is removable.public static void setExternalStorageEmulated(java.io.File file,
boolean isEmulated)
Sets the “isEmulated” flag of a particular file.
file - Target file.isEmulated - True if the filesystem is emulated.public static java.io.File addExternalDir(java.lang.String path)
Adds a directory to list returned by ShadowEnvironment.ShadowUserEnvironment.getExternalDirs().
path - the external dir to addpublic static void setExternalStorageState(java.io.File directory,
java.lang.String state)
Sets the getExternalStorageState(File) for given directory.
externalStorageState - Value to return from getExternalStorageState(File).