赞
踩
Android 系统中fingerprint 在 build/make/core/Makefile
- # The string used to uniquely identify the combined build and product; used by the OTA server.
- ifeq (,$(strip $(BUILD_FINGERPRINT)))
- ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
- BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
- else
- BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
- endif
- BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
- endif
格式就是按照这样
$(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
这个地方定义的BUILD_FINGERPRINT 用于
- [ro.bootimage.build.fingerprint]: [xxx/xxx/xxx:10/QKQ1.xxx/20201025.105558:userdebug/release-keys]
- [ro.odm.build.fingerprint]: [xxx/xxx/xxx:10/QKQ1.xxx/20201025.105558:userdebug/release-keys]
- [ro.product.build.fingerprint]: [xxx/xxx/xxx:10/QKQ1xxx/20201025.105558:userdebug/release-keys]
- [ro.system.build.fingerprint]: [xxx/xxx/xxx:10/QKQ1xxx/20201025.105558:userdebug/release-keys]
- [ro.vendor.build.fingerprint]: [xxx/xxx/xxx:10/QKQ1xxx/20201025.105558:userdebug/release-keys]
还有个ro.build.fingerprint 是在system/core/init/property_service.cpp 定义的
- // If the ro.build.fingerprint property has not been set, derive it from constituent pieces
- static void property_derive_build_fingerprint() {
- std::string build_fingerprint = GetProperty("ro.build.fingerprint", "");
- if (!build_fingerprint.empty()) {
- return;
- }
-
- const std::string UNKNOWN = "unknown";
- build_fingerprint = GetProperty("ro.product.brand", UNKNOWN);
- build_fingerprint += '/';
- build_fingerprint += GetProperty("ro.product.name", UNKNOWN);
- build_fingerprint += '/';
- build_fingerprint += GetProperty("ro.product.device", UNKNOWN);
- build_fingerprint += ':';
- build_fingerprint += GetProperty("ro.build.version.release", UNKNOWN);
- build_fingerprint += '/';
- build_fingerprint += GetProperty("ro.build.id", UNKNOWN);
- build_fingerprint += '/';
- build_fingerprint += GetProperty("ro.build.version.incremental", UNKNOWN);
- build_fingerprint += ':';
- build_fingerprint += GetProperty("ro.build.type", UNKNOWN);
- build_fingerprint += '/';
- build_fingerprint += GetProperty("ro.build.tags", UNKNOWN);
-
- LOG(INFO) << "Setting property 'ro.build.fingerprint' to '" << build_fingerprint << "'";
-
- std::string error;
- uint32_t res = PropertySet("ro.build.fingerprint", build_fingerprint, &error);
- if (res != PROP_SUCCESS) {
- LOG(ERROR) << "Error setting property 'ro.build.fingerprint': err=" << res << " (" << error
- << ")";
- }
- }
其中ro.build.version.incremental 看build/tools/buildinfo.sh 是从$BUILD_NUMBER 获取的
- ...
- echo "ro.build.version.incremental=$BUILD_NUMBER"
- ...
看build/make/core/version_defaults.mk BUILD_NUMBER是在这边赋值的,HAS_BUILD_NUMBER 默认为true
如果事先没有定义BUILD_NUMBER的话 就会用默认格式BUILD_NUMBER := eng.$(shell echo $${BUILD_USERNAME:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
- # Everything should be using BUILD_DATETIME_FROM_FILE instead.
- # BUILD_DATETIME and DATE can be removed once BUILD_NUMBER moves
- # to soong_ui.
- $(KATI_obsolete_var BUILD_DATETIME,Use BUILD_DATETIME_FROM_FILE)
-
- HAS_BUILD_NUMBER := true
- ifndef BUILD_NUMBER
- # BUILD_NUMBER should be set to the source control value that
- # represents the current state of the source code. E.g., a
- # perforce changelist number or a git hash. Can be an arbitrary string
- # (to allow for source control that uses something other than numbers),
- # but must be a single word and a valid file name.
- #
- # If no BUILD_NUMBER is set, create a useful "I am an engineering build
- # from this date/time" value. Make it start with a non-digit so that
- # anyone trying to parse it as an integer will probably get "0".
- BUILD_NUMBER := eng.$(shell echo $${BUILD_USERNAME:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
- HAS_BUILD_NUMBER := false
- endif
- .KATI_READONLY := BUILD_NUMBER HAS_BUILD_NUMBER
-
- ifndef PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION
- # Used to set minimum supported target sdk version. Apps targeting sdk
- # version lower than the set value will result in a warning being shown
- # when any activity from the app is started.
- PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23
- endif
- .KATI_READONLY := PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION
看build/make/core/Makefile 如果HAS_BUILD_NUMBER = true 会用BUILD_NUMBER_FILE 的值
- ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
- BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
- else
- BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
- endif
BUILD_NUMBER_FILE 在build/make/core/main.mk 是从BUILD_NUMBER 获取的
- # Write the build number to a file so it can be read back in
- # without changing the command line every time. Avoids rebuilds
- # when using ninja.
- $(shell mkdir -p $(OUT_DIR) && \
- echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt)
- BUILD_NUMBER_FILE := $(OUT_DIR)/build_number.txt
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。