| 1 |
UPDATING devices.xml FOR A NEW DEVICE |
| 2 |
---------------------------------------- |
| 3 |
|
| 4 |
First, import the sdk/apps/DeviceConfig project into ADT, and run it |
| 5 |
on the given device. When prompted, click on the button on the bottom |
| 6 |
to generate a config file, then send it to yourself, for example via |
| 7 |
Drive. |
| 8 |
|
| 9 |
Next, edit the device description as follows: |
| 10 |
|
| 11 |
* Double check the vendor (fix capitalization etc) |
| 12 |
|
| 13 |
* Fix the screen attributes. In particular, the detection does not |
| 14 |
seem to account for the space taken by the system bar, so look up |
| 15 |
the official specs for the device and change the screen size. This |
| 16 |
also affects the screen diagonal length, and the xdpi and ydpi |
| 17 |
densities. For example, here are the specs used for the Nexus 4, |
| 18 |
Nexus 7 and Nexus 10 configurations: |
| 19 |
|
| 20 |
http://www.google.com/nexus/4/specs/ |
| 21 |
http://www.google.com/nexus/7/specs/ |
| 22 |
http://www.google.com/nexus/10/specs/ |
| 23 |
|
| 24 |
|
| 25 |
* For devices that don't have external storage, the element |
| 26 |
<d:removable-storage> </d:removable-storage> |
| 27 |
is missing the required unit attribute; change it to |
| 28 |
<d:removable-storage unit="MiB"> </d:removable-storage> |
| 29 |
|
| 30 |
* The config detector cannot detect the available states; insert these |
| 31 |
manually by copying from another device description in devices.xml, |
| 32 |
assuming it has the normal states (landscape, portrait). Make sure |
| 33 |
you pick the default state carefully; e.g. for Nexus 4 portrait is |
| 34 |
the default and for Nexus 10 landscape is the default. |
| 35 |
|
| 36 |
* Double check the <ram> and <internal-storage> values; they did not |
| 37 |
seem to be correct for the devices I configured. I looked up the |
| 38 |
specs instead, and then converted to the (required) MiB or GiB |
| 39 |
units. E.g. 2GB of RAM means 1.86GiB. |
| 40 |
|
| 41 |
NOTE: The <ram> element (and possibly the other storage sizes as |
| 42 |
well) requires the value to be an integer, so use KiB rather than |
| 43 |
say 1.86GiB here (since decimals aren't allowed). |
| 44 |
|
| 45 |
I used the GB/GiB calculator found here: |
| 46 |
http://www.dr-lex.be/info-stuff/bytecalc.html |
| 47 |
|
| 48 |
* The DeviceConfig app does not produce values for all the required |
| 49 |
elements. It leaves these as blank, but if you don't fill them in, |
| 50 |
the devices.xml file will fail to parse properly at runtime, which |
| 51 |
means the devices won't be added. |
| 52 |
|
| 53 |
To fix this, make sure the following elements have proper values |
| 54 |
(some sample values are shown; if these are not correct, consult |
| 55 |
devices.xsd for the valid enum values): |
| 56 |
<d:mechanism>finger</d:mechanism> |
| 57 |
<d:screen-type>capacitive</d:screen-type> |
| 58 |
<d:power-type>battery</d:power-type> |
| 59 |
<d:nav>nonav</d:nav> |
| 60 |
<d:cpu>Dual-core A15</d:cpu> |
| 61 |
<d:gpu>Quad-core Mali T604</d:gpu> |
| 62 |
|
| 63 |
* You must add this required line (set value to true or false as |
| 64 |
appropriate) to the end of the <software> section: |
| 65 |
<d:status-bar>true</d:status-bar> |
| 66 |
after the <gl-extensions> element. |
| 67 |
|
| 68 |
* If you are running a newer version of the OS than the device |
| 69 |
originally shipped with, adjust the <api-level> element to the |
| 70 |
lowest supported value. |
| 71 |
|
| 72 |
* Reformat the XML, using a 4 space indent. The format of the file as |
| 73 |
emitted by DeviceConfig does not use the same formatting as the |
| 74 |
overall devices.xml file, and besides, a couple of lines aren't |
| 75 |
indented as expected. |
| 76 |
|
| 77 |
* Finally, merge the new device description (e.g. everything except |
| 78 |
the root XML <devices> element) into devices.xml and check it in. |
| 79 |
|
| 80 |
* To test, copy the file into the SDK install (tools/lib/devices.xml), |
| 81 |
open the layout editor and make sure the new device shows up in the |
| 82 |
Device dropdown, and that when selecting it things look good. You |
| 83 |
should also try creating a device based on this description in the |
| 84 |
AVD manager and then creating and running an AVD based on it. |