|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.sdklib.internal.avd.AvdManager
public class AvdManager
Android Virtual Device Manager to manage AVDs.
| Nested Class Summary | |
|---|---|
static class |
AvdManager.AvdConflict
Status returned by isAvdNameConflicting(String). |
| Field Summary | |
|---|---|
static java.lang.String |
AVD_FOLDER_EXTENSION
|
static java.lang.String |
AVD_INFO_ABS_PATH
The *absolute* path to the AVD folder (which contains the #CONFIG_INI file). |
static java.lang.String |
AVD_INFO_REL_PATH
The path to the AVD folder (which contains the #CONFIG_INI file) relative to the AndroidLocation.FOLDER_DOT_ANDROID. |
static java.lang.String |
AVD_INFO_TARGET
The IAndroidTarget.hashString() of the AVD. |
static java.lang.String |
AVD_INI_ABI_TYPE
AVD/config.ini key name representing the abi type of the specific avd |
static java.lang.String |
AVD_INI_CAMERA_BACK
AVD/config.ini key name representing how to emulate the rear facing camera |
static java.lang.String |
AVD_INI_CAMERA_FRONT
AVD/config.ini key name representing how to emulate the front facing camera |
static java.lang.String |
AVD_INI_CPU_ARCH
AVD/config.ini key name representing the CPU architecture of the specific avd |
static java.lang.String |
AVD_INI_CPU_MODEL
AVD/config.ini key name representing the CPU architecture of the specific avd |
static java.lang.String |
AVD_INI_DATA_PARTITION_SIZE
AVD/config.ini key name representing the size of the data partition |
static java.lang.String |
AVD_INI_DEVICE_HASH
AVD/config.ini key name representing the hash of the device this AVD is based on |
static java.lang.String |
AVD_INI_DEVICE_MANUFACTURER
AVD/config.ini key name representing the manufacturer of the device this avd was based on. |
static java.lang.String |
AVD_INI_DEVICE_NAME
AVD/config.ini key name representing the name of the device this avd was based on. |
static java.lang.String |
AVD_INI_ENCODING
Charset encoding used by the avd.ini/config.ini. |
static java.lang.String |
AVD_INI_GPU_EMULATION
AVD/config.ini key name representing whether hardware OpenGLES emulation is enabled |
static java.lang.String |
AVD_INI_IMAGES_1
AVD/config.ini key name representing the first path where the emulator looks for system images. |
static java.lang.String |
AVD_INI_IMAGES_2
AVD/config.ini key name representing the second path where the emulator looks for system images. |
static java.lang.String |
AVD_INI_RAM_SIZE
AVD/config.ini key name representing the amount of RAM the emulated device should have |
static java.lang.String |
AVD_INI_SDCARD_PATH
AVD/config.ini key name representing the path to the sdcard file. |
static java.lang.String |
AVD_INI_SDCARD_SIZE
AVD/config.ini key name representing the size of the SD card. |
static java.lang.String |
AVD_INI_SKIN_DYNAMIC
AVD/config.ini key name representing whether a dynamic skin should be displayed. |
static java.lang.String |
AVD_INI_SKIN_NAME
AVD/config.ini key name representing an UI name for the skin. |
static java.lang.String |
AVD_INI_SKIN_PATH
AVD/config.ini key name representing the SDK-relative path of the skin folder, if any, or a 320x480 like constant for a numeric skin size. |
static java.lang.String |
AVD_INI_SNAPSHOT_PRESENT
AVD/config.ini key name representing the presence of the snapshots file. |
static java.lang.String |
AVD_INI_VM_HEAP_SIZE
AVD/config.ini key name representing the amount of memory available to applications by default |
static java.lang.String |
CHARS_AVD_NAME
List of valid characters for an AVD name. |
static java.lang.String |
HARDWARE_INI
|
static java.util.regex.Pattern |
NUMERIC_SKIN_SIZE
Pattern to match pixel-sized skin "names", e.g. |
static java.util.regex.Pattern |
RE_AVD_NAME
Regex used to validate characters that compose an AVD name. |
static long |
SDCARD_MAX_BYTE_SIZE
Maximal size of an SDCard image file in bytes. |
static long |
SDCARD_MIN_BYTE_SIZE
Minimal size of an SDCard image file in bytes. |
static int |
SDCARD_NOT_SIZE_PATTERN
The sdcard string doesn't look like a size, it might be a path instead. |
static int |
SDCARD_SIZE_INVALID
The sdcard string looks like a size number+suffix but the number failed to decode. |
static int |
SDCARD_SIZE_NOT_IN_RANGE
The sdcard string represents a valid number but the size is outside of the allowed range. |
| Constructor Summary | |
|---|---|
protected |
AvdManager(SdkManager sdkManager,
com.android.utils.ILogger log)
Creates an AVD Manager for a given SDK represented by a SdkManager. |
| Method Summary | |
|---|---|
AvdInfo |
createAvd(java.io.File avdFolder,
java.lang.String avdName,
IAndroidTarget target,
java.lang.String abiType,
java.lang.String skinName,
java.lang.String sdcard,
java.util.Map<java.lang.String,java.lang.String> hardwareConfig,
boolean createSnapshot,
boolean removePrevious,
boolean editExisting,
com.android.utils.ILogger log)
Creates a new AVD. |
boolean |
deleteAvd(AvdInfo avdInfo,
com.android.utils.ILogger log)
Actually deletes the files of an existing AVD. |
AvdInfo[] |
getAllAvds()
Returns all the existing AVDs. |
AvdInfo |
getAvd(java.lang.String name,
boolean validAvdOnly)
Returns the AvdInfo matching the given name. |
java.lang.String |
getBaseAvdFolder()
Returns the base folder where AVDs are created. |
AvdInfo[] |
getBrokenAvds()
Returns all the broken AVDs. |
static AvdManager |
getInstance(SdkManager sdkManager,
com.android.utils.ILogger log)
|
SdkManager |
getSdkManager()
Returns the SdkManager associated with the AvdManager. |
java.io.File |
getSkinPath(java.lang.String skinName,
IAndroidTarget target)
Returns the full absolute OS path to a skin specified by name for a given target. |
java.lang.String |
getSkinRelativePath(java.lang.String skinName,
IAndroidTarget target,
com.android.utils.ILogger log)
Returns the path to the skin, as a relative path to the SDK. |
AvdInfo[] |
getValidAvds()
Returns all the valid AVDs. |
com.android.utils.Pair<AvdManager.AvdConflict,java.lang.String> |
isAvdNameConflicting(java.lang.String name)
Returns whether this AVD name would generate a conflict. |
boolean |
moveAvd(AvdInfo avdInfo,
java.lang.String newName,
java.lang.String paramFolderPath,
com.android.utils.ILogger log)
Moves and/or rename an existing AVD and its files. |
static long |
parseSdcardSize(java.lang.String sdcard,
java.lang.String[] parsedStrings)
Parse the sdcard string to decode the size. |
void |
reloadAvds(com.android.utils.ILogger log)
Reloads the AVD list. |
boolean |
removeAvd(AvdInfo avdInfo)
Removes an AvdInfo from the internal list. |
void |
updateAvd(AvdInfo avd,
com.android.utils.ILogger log)
Updates an AVD with new path to the system image folders. |
void |
updateAvd(AvdInfo avd,
java.util.Map<java.lang.String,java.lang.String> newProperties,
AvdInfo.AvdStatus status,
com.android.utils.ILogger log)
|
void |
updateAvd(java.lang.String name,
com.android.utils.ILogger log)
Updates an AVD with new path to the system image folders. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String AVD_FOLDER_EXTENSION
public static final java.lang.String AVD_INI_ENCODING
public static final java.lang.String AVD_INFO_ABS_PATH
public static final java.lang.String AVD_INFO_REL_PATH
AndroidLocation.FOLDER_DOT_ANDROID. This information is written
in the avd ini only if the AVD folder is located under the .android path
(that is the relative that has no backward .. references).
public static final java.lang.String AVD_INFO_TARGET
IAndroidTarget.hashString() of the AVD.
public static final java.lang.String AVD_INI_ABI_TYPE
public static final java.lang.String AVD_INI_CPU_ARCH
public static final java.lang.String AVD_INI_CPU_MODEL
public static final java.lang.String AVD_INI_DEVICE_MANUFACTURER
public static final java.lang.String AVD_INI_DEVICE_NAME
public static final java.lang.String AVD_INI_SKIN_PATH
NUMERIC_SKIN_SIZE,
Constant Field Valuespublic static final java.lang.String AVD_INI_SKIN_NAME
AVD_INI_SKIN_PATH key instead.
public static final java.lang.String AVD_INI_SKIN_DYNAMIC
public static final java.lang.String AVD_INI_SDCARD_PATH
SDCARD_IMG,
Constant Field Valuespublic static final java.lang.String AVD_INI_SDCARD_SIZE
SDCARD_SIZE_PATTERN,
parseSdcardSize(String, String[]),
Constant Field Valuespublic static final java.lang.String AVD_INI_IMAGES_1
AVD_INI_IMAGES_1 before AVD_INI_IMAGES_2.
public static final java.lang.String AVD_INI_IMAGES_2
AVD_INI_IMAGES_1,
Constant Field Valuespublic static final java.lang.String AVD_INI_SNAPSHOT_PRESENT
SNAPSHOTS_IMG,
Constant Field Valuespublic static final java.lang.String AVD_INI_GPU_EMULATION
public static final java.lang.String AVD_INI_CAMERA_FRONT
public static final java.lang.String AVD_INI_CAMERA_BACK
public static final java.lang.String AVD_INI_RAM_SIZE
public static final java.lang.String AVD_INI_VM_HEAP_SIZE
public static final java.lang.String AVD_INI_DATA_PARTITION_SIZE
public static final java.lang.String AVD_INI_DEVICE_HASH
public static final java.util.regex.Pattern NUMERIC_SKIN_SIZE
public static final long SDCARD_MIN_BYTE_SIZE
public static final long SDCARD_MAX_BYTE_SIZE
public static final int SDCARD_SIZE_NOT_IN_RANGE
public static final int SDCARD_SIZE_INVALID
public static final int SDCARD_NOT_SIZE_PATTERN
public static final java.util.regex.Pattern RE_AVD_NAME
public static final java.lang.String CHARS_AVD_NAME
public static final java.lang.String HARDWARE_INI
| Constructor Detail |
|---|
protected AvdManager(SdkManager sdkManager,
com.android.utils.ILogger log)
throws com.android.prefs.AndroidLocation.AndroidLocationException
SdkManager.
sdkManager - The SDK.log - The log object to receive the log of the initial loading of the AVDs.
This log object is not kept by this instance of AvdManager and each
method takes its own logger. The rationale is that the AvdManager
might be called from a variety of context, each with different
logging needs. Cannot be null.
com.android.prefs.AndroidLocation.AndroidLocationException| Method Detail |
|---|
public static AvdManager getInstance(SdkManager sdkManager,
com.android.utils.ILogger log)
throws com.android.prefs.AndroidLocation.AndroidLocationException
com.android.prefs.AndroidLocation.AndroidLocationException
public java.lang.String getBaseAvdFolder()
throws com.android.prefs.AndroidLocation.AndroidLocationException
com.android.prefs.AndroidLocation.AndroidLocationExceptionpublic SdkManager getSdkManager()
SdkManager associated with the AvdManager.
public static long parseSdcardSize(java.lang.String sdcard,
java.lang.String[] parsedStrings)
SDCARD_SIZE_NOT_IN_RANGE (0)
if the sdcard string is a valid size NOT in the allowed range.
SDCARD_SIZE_INVALID (-1)
if the sdcard string is number that fails to parse correctly.
SDCARD_NOT_SIZE_PATTERN (-2)
if the sdcard string is not a number, in which case it's probably a file path.
sdcard - The sdcard string, which can be a file path, a size string or something else.parsedStrings - If non-null, an array of 2 strings. The first string will be
filled with the parsed numeric size and the second one will be filled with the
parsed suffix. This is filled even if the returned size is deemed out of range or
failed to parse. The values are null if the sdcard is not a size pattern.
SDCARD_SIZE_NOT_IN_RANGE,
SDCARD_SIZE_INVALID or SDCARD_NOT_SIZE_PATTERN as error codes.public AvdInfo[] getAllAvds()
public AvdInfo[] getValidAvds()
public AvdInfo[] getBrokenAvds()
public AvdInfo getAvd(java.lang.String name,
boolean validAvdOnly)
AvdInfo matching the given name.
The search is case-insensitive.
name - the name of the AVD to returnvalidAvdOnly - if true, only look through the list of valid AVDs.
null if none were found.public com.android.utils.Pair<AvdManager.AvdConflict,java.lang.String> isAvdNameConflicting(java.lang.String name)
name - the name of the AVD to return
AvdManager.AvdConflict and the path or AVD name that conflicts.
public void reloadAvds(com.android.utils.ILogger log)
throws com.android.prefs.AndroidLocation.AndroidLocationException
log - the log object to receive action logs. Cannot be null.
com.android.prefs.AndroidLocation.AndroidLocationException - if there was an error finding the location of the
AVD folder.
public AvdInfo createAvd(java.io.File avdFolder,
java.lang.String avdName,
IAndroidTarget target,
java.lang.String abiType,
java.lang.String skinName,
java.lang.String sdcard,
java.util.Map<java.lang.String,java.lang.String> hardwareConfig,
boolean createSnapshot,
boolean removePrevious,
boolean editExisting,
com.android.utils.ILogger log)
avdFolder - the data folder for the AVD. It will be created as needed.
Unless you want to locate it in a specific directory, the ideal default is
AvdManager.AvdInfo.getAvdFolder.avdName - the name of the AVDtarget - the target of the AVDabiType - the abi type of the AVDskinName - the name of the skin. Can be null. Must have been verified by caller.sdcard - the parameter value for the sdCard. Can be null. This is either a path to
an existing sdcard image or a sdcard size (\d+, \d+K, \dM).hardwareConfig - the hardware setup for the AVD. Can be null to use defaults.createSnapshot - If true copy a blank snapshot image into the AVD.removePrevious - If true remove any previous files.editExisting - If true, edit an existing AVD, changing only the minimum required.
This won't remove files unless required or unless removePrevious is set.log - the log object to receive action logs. Cannot be null.
AvdInfo in case of success (which has just been added to the
internal list) or null in case of failure.
public java.lang.String getSkinRelativePath(java.lang.String skinName,
IAndroidTarget target,
com.android.utils.ILogger log)
skinName - The name of the skin to find. Case-sensitive.target - The target where to find the skin.log - the log object to receive action logs. Cannot be null.
public java.io.File getSkinPath(java.lang.String skinName,
IAndroidTarget target)
skinName - The name of the skin to find. Case-sensitive.target - The target where to find the skin.
File that may or may not actually exist.
public boolean deleteAvd(AvdInfo avdInfo,
com.android.utils.ILogger log)
removeAvd(AvdInfo) afterwards.
This method is designed to somehow work with an unavailable AVD, that is an AVD that
could not be loaded due to some error. That means this method still tries to remove
the AVD ini file or its folder if it can be found. An error will be output if any of
these operations fail.
avdInfo - the information on the AVD to deletelog - the log object to receive action logs. Cannot be null.
public boolean moveAvd(AvdInfo avdInfo,
java.lang.String newName,
java.lang.String paramFolderPath,
com.android.utils.ILogger log)
avdInfo - the information on the AVD to move.newName - the new name of the AVD if non null.paramFolderPath - the new data folder if non null.log - the log object to receive action logs. Cannot be null.
public boolean removeAvd(AvdInfo avdInfo)
AvdInfo from the internal list.
avdInfo - The AvdInfo to remove.
AvdInfo was present and has been removed.
public void updateAvd(java.lang.String name,
com.android.utils.ILogger log)
throws java.io.IOException
name - the name of the AVD to update.log - the log object to receive action logs. Cannot be null.
java.io.IOException
public void updateAvd(AvdInfo avd,
com.android.utils.ILogger log)
throws java.io.IOException
avd - the AVD to update.log - the log object to receive action logs. Cannot be null.
java.io.IOException
public void updateAvd(AvdInfo avd,
java.util.Map<java.lang.String,java.lang.String> newProperties,
AvdInfo.AvdStatus status,
com.android.utils.ILogger log)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||