Package com.android.sdklib.devices
Class Device
- java.lang.Object
-
- com.android.sdklib.devices.Device
-
public final class Device extends java.lang.ObjectInstances of this class contain the specifications for a device. Use theDevice.Builderclass to construct a Device object, or theDeviceParserif constructing device objects from XML conforming to theDeviceSchemastandards.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDevice.Builder
-
Field Summary
Fields Modifier and Type Field Description static doubleMINIMUM_TABLET_SIZEMinimum diagonal size of a tablet, in inches.static doubleMINIMUM_TV_SIZEMinimum diagonal size of a TV, in inches.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.util.List<Software>getAllSoftware()java.util.List<State>getAllStates()java.util.Map<java.lang.String,java.lang.String>getBootProps()Returns the optional boot.props of the device.intgetChinSize()A convenience method to get the chin size for this device.HardwaregetDefaultHardware()Returns the defaultHardwareconfiguration for the device.StategetDefaultState()static java.util.Comparator<Device>getDisplayComparator()Returns a comparator suitable to sort a device list using a sort-aware display name.java.lang.StringgetDisplayName()Returns the user visible name of theDevice.java.lang.StringgetId()Returns the id of theDevice.java.lang.StringgetManufacturer()Returns the manufacturer of theDevice.MetagetMeta()Returns theMetaobject for the device, which contains meta information about the device, such as the location of icons.java.lang.StringgetName()Deprecated.UsegetId()orgetDisplayName()instead based on whether a stable identifier or a user visible name is neededjava.awt.DimensiongetScreenSize(com.android.resources.ScreenOrientation orientation)SoftwaregetSoftware(int apiVersion)Returns the software configuration for the given API version.StategetState(java.lang.String name)Returns the state of the device with the given name.java.lang.StringgetTagId()Returns the optional tag-id of the device.inthashCode()For *internal* usage only.booleanhasPlayStore()Returns true if this type of emulatedDevicesupports Google Play Store.booleanisScreenRound()A convenience method to get if the screen for this device is round.java.lang.StringtoString()toString value suitable for debugging only.
-
-
-
Field Detail
-
MINIMUM_TABLET_SIZE
public static final double MINIMUM_TABLET_SIZE
Minimum diagonal size of a tablet, in inches. A device with a smaller diagonal size is considered a phone.- See Also:
- Constant Field Values
-
MINIMUM_TV_SIZE
public static final double MINIMUM_TV_SIZE
Minimum diagonal size of a TV, in inches. A device with a smaller diagonal size is considered a phone or tablet- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
@NonNull @Deprecated public java.lang.String getName()
Deprecated.UsegetId()orgetDisplayName()instead based on whether a stable identifier or a user visible name is neededReturns the name of theDevice. This is intended to be displayed by the user and can vary over time. For a stable internal name of the device, usegetId()instead.- Returns:
- The name of the
Device.
-
getDisplayName
@NonNull public java.lang.String getDisplayName()
Returns the user visible name of theDevice. This is intended to be displayed by the user and can vary over time. For a stable internal name of the device, usegetId()instead.- Returns:
- The name of the
Device.
-
getId
@NonNull public java.lang.String getId()
Returns the id of theDevice.- Returns:
- The id of the
Device.
-
hasPlayStore
public boolean hasPlayStore()
Returns true if this type of emulatedDevicesupports Google Play Store.
-
getManufacturer
@NonNull public java.lang.String getManufacturer()
Returns the manufacturer of theDevice.- Returns:
- The name of the manufacturer of the
Device.
-
getAllSoftware
@NonNull public java.util.List<Software> getAllSoftware()
- Returns:
- A list of all the
Softwareconfigurations.
-
getAllStates
@NonNull public java.util.List<State> getAllStates()
- Returns:
- A list of all the
States.
-
getDefaultHardware
@NonNull public Hardware getDefaultHardware()
Returns the defaultHardwareconfiguration for the device. This is really just a shortcut for getting theHardwareon the defaultState- Returns:
- The default
Hardwarefor the device.
-
getMeta
@NonNull public Meta getMeta()
Returns theMetaobject for the device, which contains meta information about the device, such as the location of icons.
-
getSoftware
@Nullable public Software getSoftware(int apiVersion)
Returns the software configuration for the given API version.- Parameters:
apiVersion- The API version requested.- Returns:
- The Software instance for the requested API version or null if the API version is unsupported for this device.
-
getState
@Nullable public State getState(java.lang.String name)
Returns the state of the device with the given name.- Parameters:
name- The name of the state requested.- Returns:
- The State object requested or null if there's no state with the given name.
-
getScreenSize
@Nullable public java.awt.Dimension getScreenSize(@NonNull com.android.resources.ScreenOrientation orientation)
-
getTagId
@Nullable public java.lang.String getTagId()
Returns the optional tag-id of the device.- Returns:
- the optional tag-id of the device. Can be null.
-
getBootProps
@NonNull public java.util.Map<java.lang.String,java.lang.String> getBootProps()
Returns the optional boot.props of the device.- Returns:
- the optional boot.props of the device. Can be null or empty.
-
isScreenRound
public boolean isScreenRound()
A convenience method to get if the screen for this device is round.
-
getChinSize
public int getChinSize()
A convenience method to get the chin size for this device.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
For *internal* usage only. Must not be serialized to disk.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
toString value suitable for debugging only.- Overrides:
toStringin classjava.lang.Object
-
getDisplayComparator
public static java.util.Comparator<Device> getDisplayComparator()
Returns a comparator suitable to sort a device list using a sort-aware display name. The list is displayed in an order that is user friendly with devices using names first sorted alphabetically followed by all devices that use a numeric screen size sorted by actual size.
-
-