public class DeviceManager
extends java.lang.Object
Device
s within the SDKModifier and Type | Class and Description |
---|---|
static class |
DeviceManager.DeviceFilter |
static interface |
DeviceManager.DevicesChangedListener
Interface implemented by objects which want to know when changes occur to the
Device
lists. |
static class |
DeviceManager.DeviceStatus |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<DeviceManager.DeviceFilter> |
ALL_DEVICES
getDevices() flag to list all devices.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserDevice(Device d) |
static DeviceManager |
createInstance(java.io.File sdkLocation,
java.io.File androidFolder,
com.android.utils.ILogger log,
com.android.repository.io.FileOp fop)
Creates a new instance of DeviceManager.
|
static DeviceManager |
createInstance(java.io.File sdkLocation,
com.android.utils.ILogger log)
Creates a new instance of
DeviceManager , using the user's android folder. |
Device |
getDevice(java.lang.String id,
java.lang.String manufacturer) |
java.util.Collection<Device> |
getDevices(DeviceManager.DeviceFilter deviceFilter)
Returns the known
Device list. |
java.util.Collection<Device> |
getDevices(java.util.EnumSet<DeviceManager.DeviceFilter> deviceFilter)
Returns the known
Device list. |
DeviceManager.DeviceStatus |
getDeviceStatus(java.lang.String name,
java.lang.String manufacturer) |
static java.util.Map<java.lang.String,java.lang.String> |
getHardwareProperties(Device d)
Returns the hardware properties defined in
AvdManager.HARDWARE_INI as a Map . |
static java.util.Map<java.lang.String,java.lang.String> |
getHardwareProperties(State s)
Returns hardware properties (defined in hardware.ini) as a
Map . |
static java.lang.String |
hasHardwarePropHashChanged(Device d,
java.lang.String hashV2)
Checks whether the the hardware props have changed.
|
void |
registerListener(DeviceManager.DevicesChangedListener listener)
Register a listener to be notified when the device lists are modified.
|
void |
removeUserDevice(Device d) |
void |
replaceUserDevice(Device d) |
void |
saveUserDevices()
Saves out the user devices to
SdkConstants.FN_DEVICES_XML in the Android folder. |
boolean |
unregisterListener(DeviceManager.DevicesChangedListener listener)
Removes a listener from the notification list such that it will no longer receive
notifications when modifications to the
Device list occur. |
public static final java.util.EnumSet<DeviceManager.DeviceFilter> ALL_DEVICES
public static DeviceManager createInstance(@Nullable java.io.File sdkLocation, @NonNull com.android.utils.ILogger log)
DeviceManager
, using the user's android folder.public static DeviceManager createInstance(@Nullable java.io.File sdkLocation, @Nullable java.io.File androidFolder, @NonNull com.android.utils.ILogger log, @NonNull com.android.repository.io.FileOp fop)
sdkLocation
- Path to the current SDK. If null or invalid, vendor and system images
devices are ignored.androidFolder
- Path to the users' Android folder. If null or invalid, user devices are ignored.log
- SDK logger instance. Should be non-null.public void registerListener(@NonNull DeviceManager.DevicesChangedListener listener)
listener
- The listener to add. Ignored if already registered.public boolean unregisterListener(@NonNull DeviceManager.DevicesChangedListener listener)
Device
list occur.listener
- The listener to remove.@NonNull public DeviceManager.DeviceStatus getDeviceStatus(@NonNull java.lang.String name, @NonNull java.lang.String manufacturer)
@Nullable public Device getDevice(@NonNull java.lang.String id, @NonNull java.lang.String manufacturer)
@NonNull public java.util.Collection<Device> getDevices(@NonNull DeviceManager.DeviceFilter deviceFilter)
Device
list.deviceFilter
- One of the DeviceManager.DeviceFilter
constants.Device
s. Can be empty but not null.@NonNull public java.util.Collection<Device> getDevices(@NonNull java.util.EnumSet<DeviceManager.DeviceFilter> deviceFilter)
Device
list.deviceFilter
- A combination of the DeviceManager.DeviceFilter
constants
or the constant ALL_DEVICES
.Device
s. Can be empty but not null.public void addUserDevice(@NonNull Device d)
public void removeUserDevice(@NonNull Device d)
public void replaceUserDevice(@NonNull Device d)
public void saveUserDevices()
SdkConstants.FN_DEVICES_XML
in the Android folder.@NonNull public static java.util.Map<java.lang.String,java.lang.String> getHardwareProperties(@NonNull State s)
Map
.s
- The State
from which to derive the hardware properties.Map
of hardware properties.@NonNull public static java.util.Map<java.lang.String,java.lang.String> getHardwareProperties(@NonNull Device d)
AvdManager.HARDWARE_INI
as a Map
.
This is intended to be dumped in the config.ini and already contains
the device name, manufacturer and device hash.d
- The Device
from which to derive the hardware properties.Map
of hardware properties.@Nullable public static java.lang.String hasHardwarePropHashChanged(@NonNull Device d, @NonNull java.lang.String hashV2)
d
- The device.hashV2
- The previous saved AvdManager.AVD_INI_DEVICE_HASH_V2 property.