Dan Morrill | 3cd199f | 2009-11-06 14:04:16 -0800 | [diff] [blame] | 1 | page.title=Customization |
| 2 | pdk.version=1.0 |
| 3 | doc.type=porting |
| 4 | @jd:body |
| 5 | |
| 6 | <div id="qv-wrapper"> |
| 7 | <div id="qv"> |
| 8 | <h2>In this document</h2> |
| 9 | <a name="toc"/> |
| 10 | <ul> |
| 11 | <li><a href="#androidBootScreenCustomization">Boot Screen Customization</a></li> |
| 12 | <li><a href="#androidNetCustPlat">Network Customization Platform</a></li> |
| 13 | <li><a href="#androidCustomizingPre-LoadedApps">Customizing pre-loaded applications</a></li> |
| 14 | <li><a href="#androidBrowserBookmarks">Customizing browser bookmarks</a></li> |
| 15 | <li><a href="#androidEmailProviderCustomization">Email Provider Customization</a></li> |
| 16 | <li><a href="#androidThemes">Platform Themes</a></li> |
| 17 | </ul> |
| 18 | </div> |
| 19 | </div> |
| 20 | |
| 21 | |
| 22 | |
| 23 | <a name="androidBootScreenCustomization"></a><h3>Boot Screen Customization</h3> |
| 24 | |
| 25 | <p>At startup, Android displays a splashscreen image while booting the device. Do the following if you wish to modify the default splash screen:</p> |
| 26 | <p> |
| 27 | <ol><li>Create a 320x480 image, <code>splashscreen.jpg</code> in this example.</li> |
| 28 | <li>Using ImageMagick, convert your .jpg file to .r format: |
| 29 | <pre class="prettify"> |
| 30 | convert screen.jpg screen.r |
| 31 | </pre> |
| 32 | </li> |
| 33 | <li>Use the rgb2565 application to convert the image to 565 format: |
| 34 | <pre class="prettify"> |
| 35 | rgb2565 < screen.rgb > screen.565 |
| 36 | </pre> |
| 37 | </li> |
| 38 | <li>Use fastboot to flash the image to the device: |
| 39 | <pre class="prettify"> |
| 40 | fastboot flash splash1 screen.565 |
| 41 | </pre> |
| 42 | </li> |
| 43 | </ol> |
| 44 | |
| 45 | |
| 46 | <a name="androidNetCustPlat"></a><h3>Network Customization Platform</h3> |
| 47 | |
| 48 | |
| 49 | |
| 50 | <a name="androidNetCustPlatNetworkConfig"></a><h4>Network Configuration</h4> |
| 51 | |
| 52 | <p>Android stores network configurations as a resource that gets compiled into binary at form at build time. The XML representation of this resource is located at <code>//android/frameworks/base/core/res/res/xml/apns.xml</code>. This file does not include any configured APNs. You should not modify this file, but instead configure APNs by product at build time (see Build-time APN Configuration below).</p> |
| 53 | <p>Each network configuration is stored in an XML element following this syntax:</p> |
| 54 | <pre class="prettify"> |
| 55 | <apn carrier="T-Mobile US" |
| 56 | mcc="310" |
| 57 | mnc="260" |
| 58 | apn=" wap.voicestream.com" |
| 59 | user="none" |
| 60 | server="*" |
| 61 | password="none" |
| 62 | proxy=" 216.155.165.50" |
| 63 | port="8080" |
| 64 | mmsc="http://216.155.174.84/servlets/mms" |
| 65 | /> |
| 66 | </pre> |
| 67 | |
| 68 | |
| 69 | <a name="androidNetCustPlatAPNConfig"></a><h4>Build-time APN configuration</h4> |
| 70 | |
| 71 | <p>To set the APN configuration for a particular product target, add an <code>apns-conf.xml</code> file to the product configuration (do not modify the default platform APNs). This allows multiple products, all with different APNs, to be built off the same code base. </p> |
| 72 | |
| 73 | <p>To configure APNs at the product level, add a line to the product configuration file like the example below (<code>vendor/<vendor_name>/products/myphone-us.mk</code>): </p> |
| 74 | |
| 75 | <pre class="prettify"> |
| 76 | PRODUCT_COPY_FILES := vendor/acme/etc/apns-conf-us.xml:system/etc/apns-conf.xml |
| 77 | </pre> |
| 78 | |
| 79 | |
| 80 | |
| 81 | <a name="androidNetCustPlatAPNRunTime"></a><h4>APN configuration at run time</h4> |
| 82 | |
| 83 | <p>At runtime, the Android reads APNs from the following file:</p> |
| 84 | <pre class="prettify"> |
| 85 | system/etc/apns-conf.xml |
| 86 | </pre> |
| 87 | |
| 88 | <p>Android supports the following run-time network configuration methods to choose the appropriate APN from the list of configured APNs:</p> |
| 89 | <p><ul> |
| 90 | <li><b>Automatic Configuration</b>: At boot time, Android determines the correct network configuration based on the MCC and MNC from the SIM card and automatically configure all network settings.</li> |
| 91 | <li><b>Manual Configuration</b>: The platform will also support runtime (user) manual selection of network settings by name, for example, "Company Name US," and will support manual network configuration entry.</li> |
| 92 | <li><b>WAP / SMS Push Configuration</b>: The network configurations are standard Android resources. You can upgrade a resource at runtime by installing a new system resource APK package. It will be possible to develop a network configuration service which listens to a specific binary SMS port for binary SMS messages containing the network configurations. NOTE: The implementation will likely be network operator dependent due to inconsistent SMS ports, binary SMS formats, etc.</li> |
| 93 | </ul> |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | <a name="androidCustomizingPre-LoadedApps"></a><h3>Customizing pre-loaded applications</h3> |
| 99 | |
| 100 | <p>To customize the list of Android packages for a particular product (applications, input methods, providers, services, etc.), set <code>PRODUCT_PACKAGES</code> property in the product configuration, as illustrated below:</p> |
| 101 | |
| 102 | <pre class="prettify"> |
| 103 | PRODUCT_PACKAGES := \ |
| 104 | <company_name>Mail \ |
| 105 | <company_name>IM \ |
| 106 | <company_name>HomeScreen \ |
| 107 | <company_name>Maps \ |
| 108 | <company_name>SystemUpdater |
| 109 | </pre> |
| 110 | |
| 111 | <p>Package names should correspond to the <code>LOCAL_PACKAGE_NAME</code> specified for each package's build target. For example, the <code>Android.mk</code> build target for <company_name>Mail, referenced above, could look like this: |
| 112 | |
| 113 | <pre class="prettify"> |
| 114 | # Build the <company_name>Mail application |
| 115 | LOCAL_PATH:= $(call my-dir) |
| 116 | include $(CLEAR_VARS) |
| 117 | |
| 118 | LOCAL_MODULE_TAGS := user development |
| 119 | |
| 120 | LOCAL_SRC_FILES := $(call all-java-files-under,src,tests) |
| 121 | |
| 122 | LOCAL_STATIC_JAVA_LIBRARIES := <company_name>login-client |
| 123 | |
| 124 | # Specify the package name |
| 125 | LOCAL_PACKAGE_NAME := <company_name>Mail |
| 126 | |
| 127 | # Specify the certificate used to sign the application |
| 128 | LOCAL_CERTIFICATE := vendor/<company_name>/certs/app |
| 129 | |
| 130 | include $(BUILD_PACKAGE) |
| 131 | |
| 132 | # Build the login client static library |
| 133 | include $(LOCAL_PATH)/client/Android.mk |
| 134 | </pre> |
| 135 | |
| 136 | <p>Note that the home screen is just an Android application that can be replaced entirely or customized by changing source code and application resources (Java source, layouts, etc.).</p> |
| 137 | |
| 138 | |
| 139 | |
| 140 | <a name="androidBrowserBookmarks"></a><h3>Customizing browser bookmarks</h3> |
| 141 | |
| 142 | <p>Browser bookmarks are stored as string resources in the Browser application: <code>//android/packages/apps/Browser/res/values/strings.xml</code>. Bookmarks are defined as simple value string arrays called "bookmarks". Each bookmark entry is stored as a pair of array values; the first represents the bookmark name and the second the bookmark URL. For example:</p> |
| 143 | <pre class="prettify"> |
| 144 | <!-- Bookmarks --> |
| 145 | <string-array name="bookmarks"> |
| 146 | <item>Google</item> |
| 147 | <item>http://www.google.com/</item> |
| 148 | <item>Yahoo!</item> |
| 149 | <item>http://www.yahoo.com/</item> |
| 150 | <item>MSN</item> |
| 151 | <item>http://www.msn.com/</item> |
| 152 | <item>MySpace</item> |
| 153 | <item>http://www.myspace.com/</item> |
| 154 | <item>Facebook</item> |
| 155 | <item>http://www.facebook.com/</item> |
| 156 | <item>Wikipedia</item> |
| 157 | <item>http://www.wikipedia.org/</item> |
| 158 | <item>eBay</item> |
| 159 | <item>http://www.ebay.com/</item> |
| 160 | <item>CNN</item> |
| 161 | <item>http://www.cnn.com/</item> |
| 162 | <item>New York Times</item> |
| 163 | <item>http://www.nytimes.com/</item> |
| 164 | <item>ESPN</item> |
| 165 | <item>http://espn.go.com/</item> |
| 166 | <item>Amazon</item> |
| 167 | <item>http://www.amazon.com/</item> |
| 168 | <item>Weather Channel</item> |
| 169 | <item>http://www.weather.com/</item> |
| 170 | <item>BBC</item> |
| 171 | <item>http://www.bbc.co.uk/</item> |
| 172 | </string-array> |
| 173 | </pre> |
| 174 | <p>Like and Android application resource, the platform will load alternate resources based on the platform configuration values. See <a href="http://developer.android.com/guide/topics/resources/resources-i18n.html">Resources and Internationalization</a> in the Android SDK for details. To configure bookmarks for a specific mobile network operator, place your customized bookmarks in a separate <code>strings.xml</code> file and place it under a Mobile Network Code (MNO) specific resource folder. For example, <code>Browser/res/values-mccXXX-mncYYY/strings.xml</code> where XXX and YYY represent the three-digit MCC and two to three digit MNC values.</p> |
| 175 | <p>Android loads any configuration-specific resources as override values for the default values, so it is only necessary to include the bookmarks string-array values in this file.</p> |
| 176 | |
| 177 | |
| 178 | |
| 179 | <a name="androidEmailProviderCustomization"></a> |
| 180 | <h3>Email Provider Customization</h3> |
| 181 | |
| 182 | <p>The default email provider settings are stored as string resources in the Email application (<code>//android/packages/apps/Email/res/xml/providers.xml</code>) as illustrated below.</p> |
| 183 | <p><providers></p> |
| 184 | <pre class="prettify"> |
| 185 | <!-- Gmail variants --> |
| 186 | <provider id="gmail" label="Gmail" domain="gmail.com"> |
| 187 | <incoming uri="imap+ssl+://imap.gmail.com" username="$email"/> |
| 188 | <outgoing uri="smtp+ssl+://smtp.gmail.com" username="$email"/> |
| 189 | </provider> |
| 190 | <provider id="googlemail" label="Google Mail" domain="googlemail.com"> |
| 191 | <incoming uri="imap+ssl+://imap.googlemail.com" username="$email"/> |
| 192 | <outgoing uri="smtp+ssl+://smtp.googlemail.com" username="$email"/> |
| 193 | </provider> |
| 194 | <provider id="google" label="Google" domain="google.com"> |
| 195 | <incoming uri="imap+ssl+://imap.gmail.com" username="$email"/> |
| 196 | <outgoing uri="smtp+ssl+://smtp.gmail.com" username="$email"/> |
| 197 | </provider> |
| 198 | <provider id="android" label="Android" domain="android.com"> |
| 199 | <incoming uri="imap+ssl+://imap.gmail.com" username="$email"/> |
| 200 | <outgoing uri="smtp+ssl+://smtp.gmail.com" username="$email"/> |
| 201 | </provider></p> |
| 202 | |
| 203 | <!-- Common US providers --> |
| 204 | |
| 205 | <provider id="aim" label="AIM" domain="aim.com"> |
| 206 | <incoming uri="imap://imap.aim.com" label="IMAP" username="$email"/> |
| 207 | <outgoing uri="smtp://smtp.aim.com:587" username="$email"/> |
| 208 | </provider> |
| 209 | <provider id="aol" label="AOL" domain="aol.com"> |
| 210 | <incoming uri="imap://imap.aol.com" label="IMAP" username="$email"/> |
| 211 | <outgoing uri="smtp://smtp.aol.com:587" username="$email"/> |
| 212 | </provider> |
| 213 | <provider id="comcast" label="Comcast" domain="comcast.net"> |
| 214 | <incoming uri="pop3+ssl+://mail.comcast.net" username="$user"/> |
| 215 | <outgoing uri="smtp+ssl+://smtp.comcast.net" username="$user"/> |
| 216 | </provider> |
| 217 | <provider id="compuserve" label="CompuServe" domain="cs.com"> |
| 218 | <incoming uri="imap://imap.cs.com" username="$user"/> |
| 219 | <outgoing uri="smtp://smtp.cs.com" username="$user"/> |
| 220 | </provider> |
| 221 | <provider id="dotmac" label=".Mac" domain="mac.com"> |
| 222 | <incoming uri="imap+tls://mail.mac.com" username="$email"/> |
| 223 | <outgoing uri="smtp+tls://smtp.mac.com" username="$email"/> |
| 224 | </provider> |
| 225 | <provider id="earthlink" label="Earthlink" domain="earthlink.net"> |
| 226 | <incoming uri="pop3://pop.earthlink.net" username="$email"/> |
| 227 | <outgoing uri="smtp://smtpauth.earthlink.net:587" username="$email"/> |
| 228 | </provider> |
| 229 | <provider id="juno" label="Juno" domain="juno.com"> |
| 230 | <incoming uri="pop3://pop.juno.com" username="$user"/> |
| 231 | <outgoing uri="smtp://smtp.juno.com" username="$user"/> |
| 232 | </provider> |
| 233 | <provider id="live" label="Windows Live Hotmail Plus" domain="live.com" note="@string/provider_note_live"> |
| 234 | <incoming uri="pop3+ssl+://pop3.live.com" username="$email"/> |
| 235 | <outgoing uri="smtp+tls+://smtp.live.com" username="$email"/> |
| 236 | </provider> |
| 237 | <provider id="hotmail" label="Windows Live Hotmail Plus" domain="hotmail.com" note="@string/provider_note_live"> |
| 238 | <incoming uri="pop3+ssl+://pop3.live.com" username="$email"/> |
| 239 | <outgoing uri="smtp+tls+://smtp.live.com" username="$email"/> |
| 240 | </provider> |
| 241 | <provider id="msn" label="Windows Live Hotmail Plus" domain="msn.com" note="@string/provider_note_live"> |
| 242 | <incoming uri="pop3+ssl+://pop3.live.com" username="$email"/> |
| 243 | <outgoing uri="smtp+tls+://smtp.live.com" username="$email"/> |
| 244 | </provider> |
| 245 | <provider id="mobileme" label="MobileMe" domain="me.com"> |
| 246 | <incoming uri="imap+tls://mail.me.com" username="$email"/> |
| 247 | <outgoing uri="smtp+tls://smtp.me.com" username="$email"/> |
| 248 | </provider> |
| 249 | <provider id="netzero" label="NetZero" domain="netzero.com"> |
| 250 | <incoming uri="pop3://pop.netzero.com" username="$user"/> |
| 251 | <outgoing uri="smtp://smtp.netzero.com" username="$user"/> |
| 252 | </provider> |
| 253 | <provider id="sbcglobal" label="SBC Global" domain="sbcglobal.net"> |
| 254 | <incoming uri="pop3://pop.sbcglobal.yahoo.com" username="$email"/> |
| 255 | <outgoing uri="smtp://smtp.sbcglobal.yahoo.com" username="$email"/> |
| 256 | </provider> |
| 257 | <provider id="verizon" label="Verizon" domain="verizon.net"> |
| 258 | <incoming uri="pop3://incoming.verizon.net" username="$user"/> |
| 259 | <outgoing uri="smtp://outgoing.verizon.net" username="$user"/> |
| 260 | </provider> |
| 261 | <provider id="yahoo" label="Yahoo Plus" domain="yahoo.com" note="@string/provider_note_yahoo"> |
| 262 | <incoming uri="pop3+ssl+://plus.pop.mail.yahoo.com" username="$user"/> |
| 263 | <outgoing uri="smtp+ssl+://plus.smtp.mail.yahoo.com" username="$user"/> |
| 264 | </provider> |
| 265 | |
| 266 | <!-- Common UK providers --> |
| 267 | |
| 268 | <provider id="aol-uk" label="AOL" domain="aol.co.uk"> |
| 269 | <incoming uri="imap+ssl+://imap.uk.aol.com" label="IMAP" username="$user"/> |
| 270 | <outgoing uri="smtp+ssl+://smtp.uk.aol.com" username="$user"/> |
| 271 | </provider> |
| 272 | <provider id="bt" label="BT Internet" domain="btinternet.com"> |
| 273 | <incoming uri="pop3://mail.btinternet.com" username="$email"/> |
| 274 | <outgoing uri="smtp://mail.btinternet.com" username=""/> |
| 275 | </provider> |
| 276 | <provider id="tiscali" label="Tiscali" domain="tiscali.co.uk"> |
| 277 | <incoming uri="pop3://pop.tiscali.co.uk" username="$email"/> |
| 278 | <outgoing uri="smtp://smtp.tiscali.co.uk" username="$email:wq"/> |
| 279 | </provider> |
| 280 | <provider id="yahoo-uk" label="Yahoo" domain="yahoo.co.uk" note="@string/provider_note_yahoo_uk"> |
| 281 | <incoming uri="pop3+ssl+://pop.mail.yahoo.co.uk" username="$user"/> |
| 282 | <outgoing uri="smtp+ssl+://smtp.mail.yahoo.co.uk" username="$user"/> |
| 283 | </provider> |
| 284 | |
| 285 | <!-- Common Germany providers --> |
| 286 | |
| 287 | <provider id="freenet" label="Freenet" domain="freenet.de"> |
| 288 | <incoming uri="pop3://mx.freenet.de" username="$user"/> |
| 289 | <outgoing uri="smtp+ssl://mx.freenet.de" username="$email"/> |
| 290 | </provider> |
| 291 | <provider id="gmx" label="GMX" domain="gmx.de"> |
| 292 | <incoming uri="pop3+tls://pop.gmx.net" username="$email"/> |
| 293 | <outgoing uri="smtp+tls://mail.gmx.net" username="$email"/> |
| 294 | </provider> |
| 295 | <provider id="T-Online" label="T-Online" domain="t-online.de" note="@string/provider_note_t_online"> |
| 296 | <incoming uri="pop3://popmail.t-online.de" username="$email"/> |
| 297 | <outgoing uri="smtp://smtpmail.t-online.de" username="$email"/> |
| 298 | </provider> |
| 299 | <provider id="web.de" label="Web.de" domain="web.de"> |
| 300 | <incoming uri="pop3+tls://pop3.web.de" username="$user"/> |
| 301 | <outgoing uri="smtp+tls://smtp.web.de" username="$user"/> |
| 302 | </provider> |
| 303 | </providers> |
| 304 | </pre> |
| 305 | <p>As with all Android application resources, the platform will load alternate resources based on the platform configuration values. See <a href="http://developer.android.com/guide/topics/resources/resources-i18n.html">Resources and Internationalization</a> in the Android SDK for details. To configure email providers for a specific mobile network operator, place the customized providers in a separate <code>providers.xml</code> file and place it under a Mobile Network Code (MNO) specific resource folder. For example, <code>Email/res/xml-mccXXX-mncYYY/providers.xml</code> where XXX and YYY represent the three-digit MCC and two to three digit MNC values.</p> |
| 306 | |
| 307 | |
| 308 | |
| 309 | <a name="androidThemes"></a><h3>Platform Themes</h3> |
| 310 | |
| 311 | |
| 312 | |
| 313 | <a name="androidThemesStyles"></a><h4>Themes and Styles</h4> |
| 314 | |
| 315 | <p>System level styles are defined in <code>//android/framework/base/core/res/res/values/styles.xml</code>.</p> |
| 316 | |
| 317 | |
| 318 | <a name="androidThemesAnimations"></a><h4>Animations</h4> |
| 319 | |
| 320 | <p>Android supports configurable animations for window and view transitions. System-level animations are defined in XML in global resource files located in <code>//android/framework/base/core/res/res/anim/</code>.</p> |
| 321 | |