设置-关于手机-版本号
./vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java找到函数getSummary
@Override public CharSequence getSummary() { // 读取的是Build.DISPLAY的值 return mExt.customeBuildNumber(BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY)); }
frameworks/base/core/java/android/os/Build.java
/** A build ID string meant for displaying to the user */ public static final String DISPLAY = getString("ro.build.display.id");
ro.build.display.id在build/tools/buildinfo.sh里面赋值的
# 实际使用的是BUILD_DISPLAY_ID echo "ro.build.display.id=$BUILD_DISPLAY_ID"
BUILD_DISPLAY_ID在build/make/core/sysprop.mk里面定义赋值的
# BUILD_DISPLAY_ID is shown under Settings -> About Phone # 判断是否user版本 ifeq ($(TARGET_BUILD_VARIANT),user) # User builds should show: # release build number or branch.buld_number non-release builds # Dev. branches should have DISPLAY_BUILD_NUMBER set # 这里的区别就是要不要显示DISPLAY_BUILD_NUMBER ifeq (true,$(DISPLAY_BUILD_NUMBER)) BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS) else BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS) endif else # Non-user builds should show detailed build information # 不是user版本就显示BUILD_DESC的值 BUILD_DISPLAY_ID := $(BUILD_DESC) endif
先看User版本
先找BUILD_ID
build/core/build_id.mk
BUILD_ID=SP1A.210812.016
再找BUILD_KEYS
build/core/sysprop.mk
# 判断默认的系统开发证书 ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) BUILD_KEYS := test-keys else BUILD_KEYS := dev-keys endif
BUILD_NUMBER_FROM_FILE的位置
build/core/config.mk
# 从$(SOONG_OUT_DIR)/build_number.txt中读取 # 其实就是从out/soong/build_number.txt中读取 BUILD_NUMBER_FROM_FILE := $$(cat $(SOONG_OUT_DIR)/build_number.txt)
非User版本
BUILD_DISPLAY_ID使用的是BUILD_DESC的值, 在build/make/core/sysprop.mk里面定义的BUILD_DESC
# BUILD_ID: detail info; has the same info as the build fingerprint BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
由$(TARGET_PRODUCT)、$(TARGET_BUILD_VARIANT)、$(PLATFORM_VERSION)、$(BUILD_ID)、$(BUILD_NUMBER_FROM_FILE)、$(BUILD_VERSION_TAGS)这些值组成
TARGET_PRODUCT:lunch选择的项
TARGET_BUILD_VARIANT:eng、userdebug、user
PLATFORM_VERSION:Android版本
BUILD_ID:build/core/build_id.mk
BUILD_NUMBER_FROM_FILE:
BUILD_VERSION_TAGS:
后面两个后续再更新...
标签:TARGET,版本号,NUMBER,DISPLAY,BUILD,设置,手机,ID,build From: https://www.cnblogs.com/wanglongjiang/p/18029743