android中关于class Build以及如何修改android固件版本号
16lz
2021-01-23
在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。
更多相关文章
- Android 如何自定义View?
- Android 自定义CheckBoxPreference的CheckBox复选框
- Android架构分析之使用自定义硬件抽象层(HAL)模块
- Android Studio 默认keystore 以及自定义keystore使用
- 【Android】自定义View之Canvas的使用
- 编写自定义的 Android Preference 组件
- Android Native代码中的status_t定义
- 自定义ListView中的分割线(转)
- Android 自定义实现TextView单行超出部分显示为省略号