android12属性设置

ro.build.display.id

源码如下,可以看到ro.build.display.id是由其它属性值拼接成的。

shell 复制代码
# 文件路径:system/core/init/property_service.cpp

// If the ro.build.display.id property has not been set, derive it from constituent pieces
static void property_derive_build_display_id() {
    std::string build_display_id = GetProperty("ro.build.display.id", "");
    if (!build_display_id.empty()) {
        return;
    }

    const std::string UNKNOWN = "unknown";
    std::string build_type = GetProperty("ro.build.type", "");
    if (build_type == "user") {
        std::string display_build_number = GetProperty("ro.build.display_build_number", "");
        if (display_build_number == "true") {
            build_display_id = GetProperty("ro.build.id", UNKNOWN);
            build_display_id += '.';
            build_display_id += GetProperty("ro.build.version.incremental", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.keys", UNKNOWN);
        } else {
            build_display_id = GetProperty("ro.build.id", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.keys", UNKNOWN);
        }
    } else {
            build_display_id = GetProperty("ro.product.name", UNKNOWN);
            build_display_id += '-';
            build_display_id += GetProperty("ro.build.type", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.version.release", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.id", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.version.incremental", UNKNOWN);
            build_display_id += ' ';
            build_display_id += GetProperty("ro.build.tags", UNKNOWN);
    }

    LOG(INFO) << "Setting property 'ro.build.display.id' to '" << build_display_id << "'";

    std::string error;
    uint32_t res = PropertySet("ro.build.display.id", build_display_id, &error);
    if (res != PROP_SUCCESS) {
        LOG(ERROR) << "Error setting property 'ro.build.display.id': err=" << res << " (" << error
                   << ")";
    }
}

ro.build.id

build/make/tools/buildinfo.sh

ro.build.tags

ro.build.type

ro.build.version.release

ro.build.version.incremental

上面这几个属性都在下面的源码中设置

shell 复制代码
# 文件路径:build/make/tools/buildinfo.sh

#!/bin/bash

echo "# begin build properties"
echo "# autogenerated by buildinfo.sh"

# The ro.build.id will be set dynamically by init, by appending the unique vbmeta digest.
if [ "$BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT" = "true" ] ; then
  echo "ro.build.legacy.id=$BUILD_ID"
else
  echo "ro.build.id=$BUILD_ID"
fi
echo "ro.build.keys=$BUILD_KEYS"
if [ -n "$DISPLAY_BUILD_NUMBER" ] ; then
echo "ro.build.display_build_number=$DISPLAY_BUILD_NUMBER"
fi
echo "ro.build.version.incremental=$BUILD_NUMBER"
echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION"
echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION"
echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
echo "ro.build.version.release=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH"
echo "ro.build.version.base_os=$PLATFORM_BASE_OS"
echo "ro.build.version.min_supported_target_sdk=$PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION"
echo "ro.build.date=`$DATE`"
echo "ro.build.date.utc=`$DATE +%s`"
echo "ro.build.type=$TARGET_BUILD_TYPE"
echo "ro.build.user=$BUILD_USERNAME"
echo "ro.build.host=$BUILD_HOSTNAME"
echo "ro.build.tags=$BUILD_VERSION_TAGS"
echo "ro.build.flavor=$TARGET_BUILD_FLAVOR"
...
相关推荐
我又来搬代码了1 小时前
【Android】使用TextView实现按钮开关代替Switch开关
android
江-月*夜4 小时前
uniapp vuex 搭建
android·javascript·uni-app
大风起兮云飞扬丶5 小时前
Android——显式/隐式Intent
android
大风起兮云飞扬丶5 小时前
Android——metaData
android
看山还是山,看水还是。5 小时前
Nginx 的 Http 模块介绍(中)
android·运维·网络·nginx·http
SouthBay4938 小时前
PHP内存马:不死马
android·开发语言·php
安於宿命8 小时前
【Linux内核揭秘】深入理解命令行参数和环境变量
android·linux·服务器
Gerry_Liang9 小时前
Android Studio 无法查看Kotlin源码的解决办法
android·kotlin·android studio
IT生活课堂10 小时前
唤醒车机时娱乐屏出现黑屏,卡顿的案例分享
android·智能手机·汽车
翔云API11 小时前
PC端增值税发票识别API-翔云智能财务发票识别OCR接口
android·c语言·开发语言·php