Class Device


  • public final class Device
    extends java.lang.Object
    Instances of this class contain the specifications for a device. Use the Device.Builder class to construct a Device object, or the DeviceParser if constructing device objects from XML conforming to the DeviceSchema standards.
    • 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.
        Use getId() or getDisplayName() instead based on whether a stable identifier or a user visible name is needed
        Returns the name of the Device. This is intended to be displayed by the user and can vary over time. For a stable internal name of the device, use getId() instead.
        Returns:
        The name of the Device.
      • getDisplayName

        @NonNull
        public java.lang.String getDisplayName()
        Returns the user visible name of the Device. This is intended to be displayed by the user and can vary over time. For a stable internal name of the device, use getId() instead.
        Returns:
        The name of the Device.
      • getId

        @NonNull
        public java.lang.String getId()
        Returns the id of the Device.
        Returns:
        The id of the Device.
      • hasPlayStore

        public boolean hasPlayStore()
        Returns true if this type of emulated Device supports Google Play Store.
      • getManufacturer

        @NonNull
        public java.lang.String getManufacturer()
        Returns the manufacturer of the Device.
        Returns:
        The name of the manufacturer of the Device.
      • getAllSoftware

        @NonNull
        public java.util.List<Software> getAllSoftware()
        Returns all of the Software configurations of the Device.
        Returns:
        A list of all the Software configurations.
      • getAllStates

        @NonNull
        public java.util.List<State> getAllStates()
        Returns all of the States the Device can be in.
        Returns:
        A list of all the States.
      • getDefaultHardware

        @NonNull
        public Hardware getDefaultHardware()
        Returns the default Hardware configuration for the device. This is really just a shortcut for getting the Hardware on the default State
        Returns:
        The default Hardware for the device.
      • getMeta

        @NonNull
        public Meta getMeta()
        Returns the Meta object for the device, which contains meta information about the device, such as the location of icons.
        Returns:
        The Meta object for the Device.
      • getDefaultState

        @NonNull
        public State getDefaultState()
        Returns the default State of the Device.
        Returns:
        The default State of the Device.
      • 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        For *internal* usage only. Must not be serialized to disk.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        toString value suitable for debugging only.
        Overrides:
        toString in class java.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.