Package com.android.dvlib
Class DeviceSchema
- java.lang.Object
-
- com.android.dvlib.DeviceSchema
-
public class DeviceSchema extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTR_DEFAULTstatic java.lang.StringATTR_NAMEstatic java.lang.StringATTR_UNITstatic java.lang.StringNODE_ABIstatic java.lang.StringNODE_API_LEVELstatic java.lang.StringNODE_AUTOFOCUSstatic java.lang.StringNODE_BLUETOOTH_PROFILESstatic java.lang.StringNODE_BOOT_PROPstatic java.lang.StringNODE_BOOT_PROPSstatic java.lang.StringNODE_BUTTONSstatic java.lang.StringNODE_CAMERAstatic java.lang.StringNODE_CPUstatic java.lang.StringNODE_DESCRIPTIONstatic java.lang.StringNODE_DEVICEA "device" element contains a "hardware" element, a "software" element for each API version it supports, and a "state" element for each possible state the device could be in.static java.lang.StringNODE_DEVICESThe "devices" element is the root element of this schema.static java.lang.StringNODE_DIAGONAL_LENGTHstatic java.lang.StringNODE_DIMENSIONSstatic java.lang.StringNODE_DOCKstatic java.lang.StringNODE_FLASHstatic java.lang.StringNODE_FRAMEstatic java.lang.StringNODE_GL_EXTENSIONSstatic java.lang.StringNODE_GL_VERSIONstatic java.lang.StringNODE_GPUstatic java.lang.StringNODE_HARDWAREThe "hardware" element contains all of the hardware information for a given device.static java.lang.StringNODE_ICONSstatic java.lang.StringNODE_IDstatic java.lang.StringNODE_INTERNAL_STORAGEstatic java.lang.StringNODE_KEYBOARDstatic java.lang.StringNODE_KEYBOARD_STATEstatic java.lang.StringNODE_LANDSCAPE_X_OFFSETstatic java.lang.StringNODE_LANDSCAPE_Y_OFFSETstatic java.lang.StringNODE_LIVE_WALLPAPER_SUPPORTstatic java.lang.StringNODE_LOCATIONstatic java.lang.StringNODE_MANUFACTURERstatic java.lang.StringNODE_MECHANISMstatic java.lang.StringNODE_METAstatic java.lang.StringNODE_MICstatic java.lang.StringNODE_MULTITOUCHstatic java.lang.StringNODE_NAMEstatic java.lang.StringNODE_NAVstatic java.lang.StringNODE_NAV_STATEstatic java.lang.StringNODE_NETWORKINGstatic java.lang.StringNODE_PATHstatic java.lang.StringNODE_PIXEL_DENSITYstatic java.lang.StringNODE_PLAYSTORE_ENABLEDstatic java.lang.StringNODE_PORTRAIT_X_OFFSETstatic java.lang.StringNODE_PORTRAIT_Y_OFFSETstatic java.lang.StringNODE_POWER_TYPEstatic java.lang.StringNODE_PROP_NAMEstatic java.lang.StringNODE_PROP_VALUEstatic java.lang.StringNODE_RAMstatic java.lang.StringNODE_REMOVABLE_STORAGEstatic java.lang.StringNODE_SCREENstatic java.lang.StringNODE_SCREEN_ORIENTATIONstatic java.lang.StringNODE_SCREEN_RATIOstatic java.lang.StringNODE_SCREEN_SIZEstatic java.lang.StringNODE_SCREEN_TYPEstatic java.lang.StringNODE_SENSORSstatic java.lang.StringNODE_SIXTEENstatic java.lang.StringNODE_SIXTY_FOURstatic java.lang.StringNODE_SKINstatic java.lang.StringNODE_SOFTWAREThe "software" element contains all of the software information for an API version of the given device.static java.lang.StringNODE_STATEThe "state" element contains all of the parameters for a given state of the device.static java.lang.StringNODE_STATUS_BARstatic java.lang.StringNODE_TAG_IDstatic java.lang.StringNODE_TOUCHstatic java.lang.StringNODE_X_DIMENSIONstatic java.lang.StringNODE_X_FOLDED_DIMENSIONstatic java.lang.StringNODE_X_FOLDED_DIMENSION_2static java.lang.StringNODE_X_FOLDED_DIMENSION_3static java.lang.StringNODE_X_FOLDED_OFFSETstatic java.lang.StringNODE_X_FOLDED_OFFSET_2static java.lang.StringNODE_X_FOLDED_OFFSET_3static java.lang.StringNODE_XDPIstatic java.lang.StringNODE_Y_DIMENSIONstatic java.lang.StringNODE_Y_FOLDED_DIMENSIONstatic java.lang.StringNODE_Y_FOLDED_DIMENSION_2static java.lang.StringNODE_Y_FOLDED_DIMENSION_3static java.lang.StringNODE_Y_FOLDED_OFFSETstatic java.lang.StringNODE_Y_FOLDED_OFFSET_2static java.lang.StringNODE_Y_FOLDED_OFFSET_3static java.lang.StringNODE_YDPIstatic java.lang.StringNS_DEVICES_URIThe XML namespace of the latest device XML.static intNS_LATEST_VERSIONThe latest version of the device XML Schema.
-
Constructor Summary
Constructors Constructor Description DeviceSchema()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.xml.validation.SchemagetSchema(int version)Helper method that returns a validator for a specific version of the XSD.static java.lang.StringgetSchemaUri(int version)Returns the URI of the SDK Repository schema for the given version number.static intgetXmlSchemaVersion(java.io.InputStream xml)Manually parses the root element of the XML to extract the schema version at the end of the xmlns:sdk="http://schemas.android.com/sdk/devices/$N" declaration.static java.io.InputStreamgetXsdStream(int version)Returns a stream to the requesteddeviceXML Schema.static booleanvalidate(java.io.InputStream deviceXml, java.io.OutputStream out, java.io.File parent)Validates the input stream against the corresponding Devices XSD schema and then does a sanity check on the content.
-
-
-
Field Detail
-
NS_LATEST_VERSION
public static final int NS_LATEST_VERSION
The latest version of the device XML Schema. Valid version numbers are between 1 and this number, included.- See Also:
- Constant Field Values
-
NS_DEVICES_URI
public static final java.lang.String NS_DEVICES_URI
The XML namespace of the latest device XML.
-
NODE_DEVICES
public static final java.lang.String NODE_DEVICES
The "devices" element is the root element of this schema. It must contain one or more "device" elements that each define the hardware, software, and states for a given device.- See Also:
- Constant Field Values
-
NODE_DEVICE
public static final java.lang.String NODE_DEVICE
A "device" element contains a "hardware" element, a "software" element for each API version it supports, and a "state" element for each possible state the device could be in.- See Also:
- Constant Field Values
-
NODE_HARDWARE
public static final java.lang.String NODE_HARDWARE
The "hardware" element contains all of the hardware information for a given device.- See Also:
- Constant Field Values
-
NODE_SOFTWARE
public static final java.lang.String NODE_SOFTWARE
The "software" element contains all of the software information for an API version of the given device.- See Also:
- Constant Field Values
-
NODE_STATE
public static final java.lang.String NODE_STATE
The "state" element contains all of the parameters for a given state of the device. It's also capable of redefining hardware configurations if they change based on state.- See Also:
- Constant Field Values
-
NODE_KEYBOARD
public static final java.lang.String NODE_KEYBOARD
- See Also:
- Constant Field Values
-
NODE_TOUCH
public static final java.lang.String NODE_TOUCH
- See Also:
- Constant Field Values
-
NODE_GL_EXTENSIONS
public static final java.lang.String NODE_GL_EXTENSIONS
- See Also:
- Constant Field Values
-
NODE_GL_VERSION
public static final java.lang.String NODE_GL_VERSION
- See Also:
- Constant Field Values
-
NODE_NETWORKING
public static final java.lang.String NODE_NETWORKING
- See Also:
- Constant Field Values
-
NODE_REMOVABLE_STORAGE
public static final java.lang.String NODE_REMOVABLE_STORAGE
- See Also:
- Constant Field Values
-
NODE_FLASH
public static final java.lang.String NODE_FLASH
- See Also:
- Constant Field Values
-
NODE_LIVE_WALLPAPER_SUPPORT
public static final java.lang.String NODE_LIVE_WALLPAPER_SUPPORT
- See Also:
- Constant Field Values
-
NODE_STATUS_BAR
public static final java.lang.String NODE_STATUS_BAR
- See Also:
- Constant Field Values
-
NODE_BUTTONS
public static final java.lang.String NODE_BUTTONS
- See Also:
- Constant Field Values
-
NODE_CAMERA
public static final java.lang.String NODE_CAMERA
- See Also:
- Constant Field Values
-
NODE_LOCATION
public static final java.lang.String NODE_LOCATION
- See Also:
- Constant Field Values
-
NODE_GPU
public static final java.lang.String NODE_GPU
- See Also:
- Constant Field Values
-
NODE_DOCK
public static final java.lang.String NODE_DOCK
- See Also:
- Constant Field Values
-
NODE_YDPI
public static final java.lang.String NODE_YDPI
- See Also:
- Constant Field Values
-
NODE_POWER_TYPE
public static final java.lang.String NODE_POWER_TYPE
- See Also:
- Constant Field Values
-
NODE_Y_DIMENSION
public static final java.lang.String NODE_Y_DIMENSION
- See Also:
- Constant Field Values
-
NODE_SCREEN_RATIO
public static final java.lang.String NODE_SCREEN_RATIO
- See Also:
- Constant Field Values
-
NODE_NAV_STATE
public static final java.lang.String NODE_NAV_STATE
- See Also:
- Constant Field Values
-
NODE_MIC
public static final java.lang.String NODE_MIC
- See Also:
- Constant Field Values
-
NODE_RAM
public static final java.lang.String NODE_RAM
- See Also:
- Constant Field Values
-
NODE_XDPI
public static final java.lang.String NODE_XDPI
- See Also:
- Constant Field Values
-
NODE_DIMENSIONS
public static final java.lang.String NODE_DIMENSIONS
- See Also:
- Constant Field Values
-
NODE_ABI
public static final java.lang.String NODE_ABI
- See Also:
- Constant Field Values
-
NODE_MECHANISM
public static final java.lang.String NODE_MECHANISM
- See Also:
- Constant Field Values
-
NODE_MULTITOUCH
public static final java.lang.String NODE_MULTITOUCH
- See Also:
- Constant Field Values
-
NODE_NAV
public static final java.lang.String NODE_NAV
- See Also:
- Constant Field Values
-
NODE_PIXEL_DENSITY
public static final java.lang.String NODE_PIXEL_DENSITY
- See Also:
- Constant Field Values
-
NODE_SCREEN_ORIENTATION
public static final java.lang.String NODE_SCREEN_ORIENTATION
- See Also:
- Constant Field Values
-
NODE_AUTOFOCUS
public static final java.lang.String NODE_AUTOFOCUS
- See Also:
- Constant Field Values
-
NODE_SCREEN_SIZE
public static final java.lang.String NODE_SCREEN_SIZE
- See Also:
- Constant Field Values
-
NODE_DESCRIPTION
public static final java.lang.String NODE_DESCRIPTION
- See Also:
- Constant Field Values
-
NODE_BLUETOOTH_PROFILES
public static final java.lang.String NODE_BLUETOOTH_PROFILES
- See Also:
- Constant Field Values
-
NODE_SCREEN
public static final java.lang.String NODE_SCREEN
- See Also:
- Constant Field Values
-
NODE_SENSORS
public static final java.lang.String NODE_SENSORS
- See Also:
- Constant Field Values
-
NODE_DIAGONAL_LENGTH
public static final java.lang.String NODE_DIAGONAL_LENGTH
- See Also:
- Constant Field Values
-
NODE_SCREEN_TYPE
public static final java.lang.String NODE_SCREEN_TYPE
- See Also:
- Constant Field Values
-
NODE_KEYBOARD_STATE
public static final java.lang.String NODE_KEYBOARD_STATE
- See Also:
- Constant Field Values
-
NODE_X_DIMENSION
public static final java.lang.String NODE_X_DIMENSION
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_OFFSET
public static final java.lang.String NODE_X_FOLDED_OFFSET
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_OFFSET
public static final java.lang.String NODE_Y_FOLDED_OFFSET
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_DIMENSION
public static final java.lang.String NODE_X_FOLDED_DIMENSION
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_DIMENSION
public static final java.lang.String NODE_Y_FOLDED_DIMENSION
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_OFFSET_2
public static final java.lang.String NODE_X_FOLDED_OFFSET_2
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_OFFSET_2
public static final java.lang.String NODE_Y_FOLDED_OFFSET_2
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_DIMENSION_2
public static final java.lang.String NODE_X_FOLDED_DIMENSION_2
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_DIMENSION_2
public static final java.lang.String NODE_Y_FOLDED_DIMENSION_2
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_OFFSET_3
public static final java.lang.String NODE_X_FOLDED_OFFSET_3
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_OFFSET_3
public static final java.lang.String NODE_Y_FOLDED_OFFSET_3
- See Also:
- Constant Field Values
-
NODE_X_FOLDED_DIMENSION_3
public static final java.lang.String NODE_X_FOLDED_DIMENSION_3
- See Also:
- Constant Field Values
-
NODE_Y_FOLDED_DIMENSION_3
public static final java.lang.String NODE_Y_FOLDED_DIMENSION_3
- See Also:
- Constant Field Values
-
NODE_CPU
public static final java.lang.String NODE_CPU
- See Also:
- Constant Field Values
-
NODE_INTERNAL_STORAGE
public static final java.lang.String NODE_INTERNAL_STORAGE
- See Also:
- Constant Field Values
-
NODE_META
public static final java.lang.String NODE_META
- See Also:
- Constant Field Values
-
NODE_ICONS
public static final java.lang.String NODE_ICONS
- See Also:
- Constant Field Values
-
NODE_SIXTY_FOUR
public static final java.lang.String NODE_SIXTY_FOUR
- See Also:
- Constant Field Values
-
NODE_SIXTEEN
public static final java.lang.String NODE_SIXTEEN
- See Also:
- Constant Field Values
-
NODE_FRAME
public static final java.lang.String NODE_FRAME
- See Also:
- Constant Field Values
-
NODE_PATH
public static final java.lang.String NODE_PATH
- See Also:
- Constant Field Values
-
NODE_PORTRAIT_X_OFFSET
public static final java.lang.String NODE_PORTRAIT_X_OFFSET
- See Also:
- Constant Field Values
-
NODE_PORTRAIT_Y_OFFSET
public static final java.lang.String NODE_PORTRAIT_Y_OFFSET
- See Also:
- Constant Field Values
-
NODE_LANDSCAPE_X_OFFSET
public static final java.lang.String NODE_LANDSCAPE_X_OFFSET
- See Also:
- Constant Field Values
-
NODE_LANDSCAPE_Y_OFFSET
public static final java.lang.String NODE_LANDSCAPE_Y_OFFSET
- See Also:
- Constant Field Values
-
NODE_NAME
public static final java.lang.String NODE_NAME
- See Also:
- Constant Field Values
-
NODE_ID
public static final java.lang.String NODE_ID
- See Also:
- Constant Field Values
-
NODE_API_LEVEL
public static final java.lang.String NODE_API_LEVEL
- See Also:
- Constant Field Values
-
NODE_PLAYSTORE_ENABLED
public static final java.lang.String NODE_PLAYSTORE_ENABLED
- See Also:
- Constant Field Values
-
NODE_MANUFACTURER
public static final java.lang.String NODE_MANUFACTURER
- See Also:
- Constant Field Values
-
NODE_TAG_ID
public static final java.lang.String NODE_TAG_ID
- See Also:
- Constant Field Values
-
NODE_BOOT_PROPS
public static final java.lang.String NODE_BOOT_PROPS
- See Also:
- Constant Field Values
-
NODE_BOOT_PROP
public static final java.lang.String NODE_BOOT_PROP
- See Also:
- Constant Field Values
-
NODE_PROP_NAME
public static final java.lang.String NODE_PROP_NAME
- See Also:
- Constant Field Values
-
NODE_PROP_VALUE
public static final java.lang.String NODE_PROP_VALUE
- See Also:
- Constant Field Values
-
NODE_SKIN
public static final java.lang.String NODE_SKIN
- See Also:
- Constant Field Values
-
ATTR_DEFAULT
public static final java.lang.String ATTR_DEFAULT
- See Also:
- Constant Field Values
-
ATTR_UNIT
public static final java.lang.String ATTR_UNIT
- See Also:
- Constant Field Values
-
ATTR_NAME
public static final java.lang.String ATTR_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSchemaUri
public static java.lang.String getSchemaUri(int version)
Returns the URI of the SDK Repository schema for the given version number.- Parameters:
version- Between 1 andNS_LATEST_VERSIONincluded.
-
getXsdStream
public static java.io.InputStream getXsdStream(int version)
Returns a stream to the requesteddeviceXML Schema.- Parameters:
version- Between 1 andNS_LATEST_VERSION, included.- Returns:
- An
InputStreamobject for the local XSD file or null if there is no schema for the requested version.
-
validate
public static boolean validate(java.io.InputStream deviceXml, java.io.OutputStream out, java.io.File parent)Validates the input stream against the corresponding Devices XSD schema and then does a sanity check on the content.- Parameters:
deviceXml- The XML InputStream to validate. The XML input stream must supports the mark/reset() methods (that is itsInputStream.markSupported()must return true) and which mark has already been set to the beginning of the stream.out- The OutputStream for error messages.parent- The parent directory of the input stream.- Returns:
- Whether the given input constitutes a valid devices file.
-
getSchema
@Nullable public static javax.xml.validation.Schema getSchema(int version) throws org.xml.sax.SAXExceptionHelper method that returns a validator for a specific version of the XSD.- Parameters:
version- Between 1 andNS_LATEST_VERSION, included.- Returns:
- A
Schemavalidator or null. - Throws:
org.xml.sax.SAXException
-
getXmlSchemaVersion
public static int getXmlSchemaVersion(java.io.InputStream xml)
Manually parses the root element of the XML to extract the schema version at the end of the xmlns:sdk="http://schemas.android.com/sdk/devices/$N" declaration.- Parameters:
xml- An XML input stream that supports the mark/reset() methods (that is itsInputStream.markSupported()must return true) and which mark has already been set to the beginning of the stream.- Returns:
- 1+ for a valid schema version or 0 if no schema could be found.
-
-