在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。

更多相关文章

  1. Android 如何自定义View?
  2. Android 自定义CheckBoxPreference的CheckBox复选框
  3. Android架构分析之使用自定义硬件抽象层(HAL)模块
  4. Android Studio 默认keystore 以及自定义keystore使用
  5. 【Android】自定义View之Canvas的使用
  6. 编写自定义的 Android Preference 组件
  7. Android Native代码中的status_t定义
  8. 自定义ListView中的分割线(转)
  9. Android 自定义实现TextView单行超出部分显示为省略号

随机推荐

  1. Android 之 Spinner
  2. Android中shape中的属性大全
  3. Android 秒表分析源码
  4. Android studio SweetAlert for Android
  5. android将EditText设置为只可点击 不弹出
  6. Android 瀑布流 Demo
  7. Android实现自定义顶部标题栏
  8. android gradle编译 多个flavor中加载不
  9. 在Android上使用XML
  10. Android等宽字体