现在的位置: 首页 > 综合 > 正文

android中关于class Build以及如何修改android固件版本号

2013年11月05日 ⁄ 综合 ⁄ 共 1668字 ⁄ 字号 评论关闭

        在frameworks/base/core/java/android/os/Build.java中定义了class Build类,这个类定义了所有关于产品的参数,例如固件版本号,product 名字,板子名字等等,有些参数会在设置->关于手机中显示。

public class Build {
    /** Value used for when a build property is unknown. */
    public static final String UNKNOWN = "unknown";

    /** Either a changelist number, or a label like "M4-rc20". */
    public static final String ID = getString("ro.build.id");

    /** A build ID string meant for displaying to the user */
    public static final String DISPLAY = getString("ro.build.display.id");

        /**a firmware realse */
        public static final String FIRMWARE = getString("ro.product.firmware");

    /** The name of the overall product. */
    public static final String PRODUCT = getString("ro.product.name");

    /** The name of the industrial design. */
    public static final String DEVICE = getString("ro.product.device");

    /** The name of the underlying board, like "goldfish". */
    public static final String BOARD = getString("ro.product.board");

    /** The name of the instruction set (CPU type + ABI convention) of native code. */
    public static final String CPU_ABI = getString("ro.product.cpu.abi");

    /** The name of the second instruction set (CPU type + ABI convention) of native code. */
    public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");

    /** The manufacturer of the product/hardware. */
    public static final String MANUFACTURER = getString("ro.product.manufacturer");

    /** The brand (e.g., carrier) the software is customized for, if any. */
    public static final String BRAND = getString("ro.product.brand");

           因此,如果想修改这些参数,只要在修改相关的参数就可以了。例如,如果想修改固件版本号,那么找到定义ro.product.firmware的文件(在我做的项目里,是./device/softwinner/crane-gm-g9/crane_gm_g9.mk),修改成想要的版本号,就可以了。

           要注意的是,在重新编译的时候,首先要先删掉./out/target/product/crane-gm-g9/recovery/root/default.prop和./out/target/product/crane-gm-g9/system/build.prop再编译才能生效。否则,这个build不一定能重新编译,因为改的是mk文件本身,而不是.java。

抱歉!评论已关闭.