com.android.sdklib.internal.avd
Class AvdInfo

java.lang.Object
  extended by com.android.sdklib.internal.avd.AvdInfo
All Implemented Interfaces:
java.lang.Comparable<AvdInfo>

public final class AvdInfo
extends java.lang.Object
implements java.lang.Comparable<AvdInfo>

An immutable structure describing an Android Virtual Device.


Nested Class Summary
static class AvdInfo.AvdStatus
          Status for an AvdInfo.
 
Constructor Summary
AvdInfo(java.lang.String name, java.io.File iniFile, java.lang.String folderPath, java.lang.String targetHash, IAndroidTarget target, java.lang.String abiType, java.util.Map<java.lang.String,java.lang.String> properties)
          Creates a new valid AVD info.
AvdInfo(java.lang.String name, java.io.File iniFile, java.lang.String folderPath, java.lang.String targetHash, IAndroidTarget target, java.lang.String abiType, java.util.Map<java.lang.String,java.lang.String> properties, AvdInfo.AvdStatus status)
          Creates a new invalid AVD info.
 
Method Summary
 int compareTo(AvdInfo o)
          Compares this object with the specified object for order.
 java.lang.String getAbiType()
          Returns the processor type of the AVD.
 java.io.File getConfigFile()
          Returns the Config File for this AVD.
static java.io.File getConfigFile(java.lang.String path)
          Helper method that returns the Config File for a given AVD name.
 java.lang.String getCpuArch()
           
 java.lang.String getDataFolderPath()
          Returns the path of the AVD data directory.
static java.io.File getDefaultAvdFolder(AvdManager manager, java.lang.String avdName)
          Helper method that returns the default AVD folder that would be used for a given AVD name if and only if the AVD was created with the default choice.
static java.io.File getDefaultIniFile(AvdManager manager, java.lang.String avdName)
          Helper method that returns the .ini File for a given AVD name.
 java.lang.String getDeviceManufacturer()
           
 java.lang.String getDeviceName()
           
 java.lang.String getErrorMessage()
          Returns the error message for the AVD or null if getStatus() returns AvdInfo.AvdStatus.OK
 java.io.File getIniFile()
          Returns the .ini File for this AVD.
 java.lang.String getName()
          Returns the name of the AVD.
static java.lang.String getPrettyAbiType(java.lang.String raw)
          Convenience function to return a more user friendly name of the abi type.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Returns an unmodifiable map of properties for the AVD.
 AvdInfo.AvdStatus getStatus()
          Returns the AvdInfo.AvdStatus of the receiver.
 IAndroidTarget getTarget()
          Returns the target of the AVD, or null if it has not been resolved.
 java.lang.String getTargetHash()
          Returns the target hash string.
 boolean isRunning()
          Returns whether an emulator is currently running the AVD.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvdInfo

public AvdInfo(java.lang.String name,
               java.io.File iniFile,
               java.lang.String folderPath,
               java.lang.String targetHash,
               IAndroidTarget target,
               java.lang.String abiType,
               java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new valid AVD info. Values are immutable.

Such an AVD is available and can be used. The error string is set to null.

Parameters:
name - The name of the AVD (for display or reference)
iniFile - The path to the config.ini file
folderPath - The path to the data directory
targetHash - the target hash
target - The target. Can be null, if the target was not resolved.
abiType - Name of the abi.
properties - The property map. If null, an empty map will be created.

AvdInfo

public AvdInfo(java.lang.String name,
               java.io.File iniFile,
               java.lang.String folderPath,
               java.lang.String targetHash,
               IAndroidTarget target,
               java.lang.String abiType,
               java.util.Map<java.lang.String,java.lang.String> properties,
               AvdInfo.AvdStatus status)
Creates a new invalid AVD info. Values are immutable.

Such an AVD is not complete and cannot be used. The error string must be non-null.

Parameters:
name - The name of the AVD (for display or reference)
iniFile - The path to the config.ini file
folderPath - The path to the data directory
targetHash - the target hash
target - The target. Can be null, if the target was not resolved.
abiType - Name of the abi.
properties - The property map. If null, an empty map will be created.
status - The AvdInfo.AvdStatus of this AVD. Cannot be null.
Method Detail

getName

public java.lang.String getName()
Returns the name of the AVD.


getDataFolderPath

public java.lang.String getDataFolderPath()
Returns the path of the AVD data directory.


getAbiType

public java.lang.String getAbiType()
Returns the processor type of the AVD.


getCpuArch

public java.lang.String getCpuArch()

getDeviceManufacturer

public java.lang.String getDeviceManufacturer()

getDeviceName

public java.lang.String getDeviceName()

getPrettyAbiType

public static java.lang.String getPrettyAbiType(java.lang.String raw)
Convenience function to return a more user friendly name of the abi type.


getTargetHash

public java.lang.String getTargetHash()
Returns the target hash string.


getTarget

public IAndroidTarget getTarget()
Returns the target of the AVD, or null if it has not been resolved.


getStatus

public AvdInfo.AvdStatus getStatus()
Returns the AvdInfo.AvdStatus of the receiver.


getDefaultAvdFolder

public static java.io.File getDefaultAvdFolder(AvdManager manager,
                                               java.lang.String avdName)
                                        throws com.android.prefs.AndroidLocation.AndroidLocationException
Helper method that returns the default AVD folder that would be used for a given AVD name if and only if the AVD was created with the default choice.

Callers must NOT use this to "guess" the actual folder from an actual AVD since the purpose of the AVD .ini file is to be able to change this folder. Callers should however use this to create a new AvdInfo to setup its data folder to the default.

The default is getDefaultAvdFolder()/avdname.avd/.

For an actual existing AVD, callers must use getDataFolderPath() instead.

Parameters:
manager - The AVD Manager, used to get the AVD storage path.
avdName - The name of the desired AVD.
Throws:
com.android.prefs.AndroidLocation.AndroidLocationException - if there's a problem getting android root directory.

getDefaultIniFile

public static java.io.File getDefaultIniFile(AvdManager manager,
                                             java.lang.String avdName)
                                      throws com.android.prefs.AndroidLocation.AndroidLocationException
Helper method that returns the .ini File for a given AVD name.

The default is getDefaultAvdFolder()/avdname.ini.

Parameters:
manager - The AVD Manager, used to get the AVD storage path.
avdName - The name of the desired AVD.
Throws:
com.android.prefs.AndroidLocation.AndroidLocationException - if there's a problem getting android root directory.

getIniFile

public java.io.File getIniFile()
Returns the .ini File for this AVD.


getConfigFile

public static java.io.File getConfigFile(java.lang.String path)
Helper method that returns the Config File for a given AVD name.


getConfigFile

public java.io.File getConfigFile()
Returns the Config File for this AVD.


getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
Returns an unmodifiable map of properties for the AVD. This can be empty but not null. Callers must NOT try to modify this immutable map.


getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message for the AVD or null if getStatus() returns AvdInfo.AvdStatus.OK


isRunning

public boolean isRunning()
Returns whether an emulator is currently running the AVD.


compareTo

public int compareTo(AvdInfo o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable<AvdInfo>
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.