• Signing a build for release
  • Customization In this document
  • Boot Screen Customization
  • Network Customization Platform
  • Build-time APN configuration
  • APN configuration at run time
  • Customizing pre-loaded applications
  • Customizing browser bookmarks
  • Email Provider Customization
  • Themes and Styles System level styles are defined in //android/framework/base/core/res/res/values/styles.xml. Animations
  • Creating Release Keys and Signing Builds




    Download 1.03 Mb.
    bet4/10
    Sana22.12.2019
    Hajmi1.03 Mb.
    1   2   3   4   5   6   7   8   9   10

    Creating Release Keys and Signing Builds

    In this document

    Introduction


    Android requires that each application be signed with the developer's digital keys to enforce signature permissions and application request to use shared user ID or target process. For more information on the general Android security principles and signing requirements, see the Android Security and Permissions section in the Android Developer Guide). The core Android platform uses four keys to maintain security of core platform components:

    • platform: a key for packages that are part of the core platform.

    • shared: a key for things that are shared in the home/contacts process.

    • media: a key for packages that are part of the media/download system.

    • releasekey: the default key to sign with if not otherwise specified

    These keys are used to sign applications separately for release images and are not used by the Android build system. The build system signs packages with the testkeys provided in build/target/product/security/. Because the testkeys are part of the standard Android open source distribution, they should never be used for production devices. Instead, device manufacturers should generate their own private keys for shipping release builds.

    Generating keys


    A device manufacturer's keys for each product should be stored under vendor//security/
    , where and
    represent the manufacturer and product names. To simplify key creation, copy the script below to this directory in a file called mkkey.sh. To customize your keys, change the line that starts with AUTH to reflect the correct information for your company:

    #!/bin/sh

    AUTH='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'

    if [ "$1" == "" ]; then

    echo "Create a test certificate key."

    echo "Usage: $0 NAME"

    echo "Will generate NAME.pk8 and NAME.x509.pem"

    echo " $AUTH"

    exit

    fi
    openssl genrsa -3 -out $1.pem 2048


    openssl req -new -x509 -key $1.pem -out $1.x509.pem -days 10000 \

    -subj "$AUTH"


    echo "Please enter the password for this key:"

    openssl pkcs8 -in $1.pem -topk8 -outform DER -out $1.pk8 -passout stdin

    mkkey.sh is a helper script to generate the platform's keys. NOTE: the password you type will be visible in your terminal window. Note the passwords you use as you will need them to sign release builds.

    To generate the required 4 platform keys, run mkkey.sh four times specifying the key name and password for each:

    sh mkkey.sh platform # enter password

    sh mkkey.sh media # enter password

    sh mkkey.sh shared # enter password

    sh mkkey.sh release # enter password

    You should now have new keys for your product.

    Signing a build for release


    Signing a build for a release is a two-step process.

    1. Sign all the individual parts of the build.

    2. Put the parts back together into image files.

    Signing applications


    Use build/tools/releasetools/sign_target_files_apks to sign a target_files package. The target_files package isn't built by default, you need to make sure to specify the "dist" target when you call make. For example:

    make -j4 PRODUCT-


    -user dist

    The command above creates a a file under out/dist called


    -target_files.zip. This is the file you need to pass to the sign_target_files_apks script.

    You would typically run the script like this:

    ./build/tools/releasetools/sign_target_files_apks -d vendor//security/

    -target_files.zip signed-target-files.zip

    If you have prebuilt and pre-signed apk's in your build that you don't want re-signed, you must explicitly ignore them by adding -e Foo.apk= to the command line for each apk you wish to ignore.

    sign_target_files_apks also has many other options that could be useful for signing release builds. Run it with -h as the only option to see the full help.


    Creating image files


    Once you have signed-target-files.zip, create the images so you can put it onto a device with the command below:

    build/tools/releasetools/img_from_target_files signed-target-files.zip signed-img.zip

    signed-img.zip contains all the .img files. You can use fastboot update signed-img.zip to use fastboot to get them on the device.

    Customization

    In this document


    • Boot Screen Customization

    • Network Customization Platform

    • Customizing pre-loaded applications

    • Customizing browser bookmarks

    • Email Provider Customization

    • Platform Themes

    Boot Screen Customization


    At startup, Android displays a splashscreen image while booting the device. Do the following if you wish to modify the default splash screen:

    1. Create a 320x480 image, splashscreen.jpg in this example.

    2. Using ImageMagick, convert your .jpg file to .r format:



    3. convert screen.jpg screen.r

    4. Use the rgb2565 application to convert the image to 565 format:



    5. rgb2565 < screen.rgb > screen.565

    6. Use fastboot to flash the image to the device:



    7. fastboot flash splash1 screen.565

    Network Customization Platform

    Network Configuration


    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 //android/frameworks/base/core/res/res/xml/apns.xml. 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).

    Each network configuration is stored in an XML element following this syntax:



    mcc="310"

    mnc="260"

    apn=" wap.voicestream.com"

    user="none"

    server="*"

    password="none"

    proxy=" 216.155.165.50"

    port="8080"

    mmsc="http://216.155.174.84/servlets/mms"

    />

    Build-time APN configuration


    To set the APN configuration for a particular product target, add an apns-conf.xml 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.

    To configure APNs at the product level, add a line to the product configuration file like the example below (vendor//products/myphone-us.mk):

    PRODUCT_COPY_FILES := vendor/acme/etc/apns-conf-us.xml:system/etc/apns-conf.xml

    APN configuration at run time


    At runtime, the Android reads APNs from the following file:

    system/etc/apns-conf.xml

    Android supports the following run-time network configuration methods to choose the appropriate APN from the list of configured APNs:


    • Automatic Configuration: 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.

    • Manual Configuration: 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.

    • WAP / SMS Push Configuration: 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.

    Customizing pre-loaded applications


    To customize the list of Android packages for a particular product (applications, input methods, providers, services, etc.), set PRODUCT_PACKAGES property in the product configuration, as illustrated below:

    PRODUCT_PACKAGES := \



    Mail \

    IM \

    HomeScreen \

    Maps \

    SystemUpdater

    Package names should correspond to the LOCAL_PACKAGE_NAME specified for each package's build target. For example, the Android.mk build target for Mail, referenced above, could look like this:

    # Build the Mail application

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE_TAGS := user development

    LOCAL_SRC_FILES := $(call all-java-files-under,src,tests)

    LOCAL_STATIC_JAVA_LIBRARIES := login-client

    # Specify the package name

    LOCAL_PACKAGE_NAME := Mail

    # Specify the certificate used to sign the application

    LOCAL_CERTIFICATE := vendor//certs/app

    include $(BUILD_PACKAGE)

    # Build the login client static library

    include $(LOCAL_PATH)/client/Android.mk

    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.).


    Customizing browser bookmarks


    Browser bookmarks are stored as string resources in the Browser application: //android/packages/apps/Browser/res/values/strings.xml. 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:



    Google

    http://www.google.com/

    Yahoo!

    http://www.yahoo.com/

    MSN

    http://www.msn.com/

    MySpace

    http://www.myspace.com/

    Facebook

    http://www.facebook.com/

    Wikipedia

    http://www.wikipedia.org/

    eBay

    http://www.ebay.com/

    CNN

    http://www.cnn.com/

    New York Times

    http://www.nytimes.com/

    ESPN

    http://espn.go.com/

    Amazon

    http://www.amazon.com/

    Weather Channel

    http://www.weather.com/

    BBC

    http://www.bbc.co.uk/

    Like and Android application resource, the platform will load alternate resources based on the platform configuration values. See Resources and Internationalization in the Android SDK for details. To configure bookmarks for a specific mobile network operator, place your customized bookmarks in a separate strings.xml file and place it under a Mobile Network Code (MNO) specific resource folder. For example, Browser/res/values-mccXXX-mncYYY/strings.xml where XXX and YYY represent the three-digit MCC and two to three digit MNC values.



    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.

    Email Provider Customization


    The default email provider settings are stored as string resources in the Email application (//android/packages/apps/Email/res/xml/providers.xml) as illustrated below.











































































































    As with all Android application resources, the platform will load alternate resources based on the platform configuration values. See Resources and Internationalization in the Android SDK for details. To configure email providers for a specific mobile network operator, place the customized providers in a separate providers.xml file and place it under a Mobile Network Code (MNO) specific resource folder. For example, Email/res/xml-mccXXX-mncYYY/providers.xml where XXX and YYY represent the three-digit MCC and two to three digit MNC values.


    Platform Themes

    Themes and Styles


    System level styles are defined in //android/framework/base/core/res/res/values/styles.xml.

    Animations


    Android supports configurable animations for window and view transitions. System-level animations are defined in XML in global resource files located in //android/framework/base/core/res/res/anim/.

    Download 1.03 Mb.
    1   2   3   4   5   6   7   8   9   10




    Download 1.03 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Creating Release Keys and Signing Builds

    Download 1.03 Mb.