重启Android后SystemProperties属性变化

article/2023/6/4 16:00:56

重启Android后SystemProperties属性变化

  • 1、SystemProperties属性加载
  • 2、PropertySet条件限制
  • 3、SystemProperties属性变化

android12-release


1、SystemProperties属性加载

查看 SystemProperties属性加载 属性映射区域LoadPath("/dev/__properties__/property_info");在PropertyLoadBootDefaults()加载如下配置文件等属性,最终设置PropertySet()

  • /system/build.prop
  • /system_ext/etc/build.prop
    /system_ext/default.prop
    /system_ext/build.prop
  • /vendor/default.prop
  • /vendor/build.prop
  • /vendor_dlkm/etc/build.prop
  • /odm_dlkm/etc/build.prop
  • /odm/etc/build.prop
    /odm/default.prop
    /odm/build.prop
  • /product/etc/build.prop
    /product/default.prop
    /product/build.prop

2、PropertySet条件限制

查看 SystemProperties属性加载 条件限制IsLegalPropertyNameIsLegalPropertyValue()

static uint32_t PropertySet(const std::string& name, const std::string& value, std::string* error) {size_t valuelen = value.size();if (!IsLegalPropertyName(name)) {*error = "Illegal property name";return PROP_ERROR_INVALID_NAME;}if (auto result = IsLegalPropertyValue(name, value); !result.ok()) {*error = result.error().message();return PROP_ERROR_INVALID_VALUE;}prop_info* pi = (prop_info*) __system_property_find(name.c_str());if (pi != nullptr) {// ro.* properties are actually "write-once".if (StartsWith(name, "ro.")) {*error = "Read-only property was already set";return PROP_ERROR_READ_ONLY_PROPERTY;}__system_property_update(pi, value.c_str(), valuelen);} else {int rc = __system_property_add(name.c_str(), name.size(), value.c_str(), valuelen);if (rc < 0) {*error = "__system_property_add failed";return PROP_ERROR_SET_FAILED;}}// Don't write properties to disk until after we have read all default// properties to prevent them from being overwritten by default values.if (persistent_properties_loaded && StartsWith(name, "persist.")) {WritePersistentProperty(name, value);}// If init hasn't started its main loop, then it won't be handling property changed messages// anyway, so there's no need to try to send them.auto lock = std::lock_guard{accept_messages_lock};if (accept_messages) {PropertyChanged(name, value);}return PROP_SUCCESS;
}

3、SystemProperties属性变化

PropertySet条件限制 关注"ro.""persist."开头属性:

  • "ro."属性实际上是“一次写入”,只能设置一次
  • "persist."在我们读取所有默认属性之前,不要将persist开头属性写入磁盘,以防止它们被默认值覆盖。,所以只有persist开头的系统属性在重启后保持不变
  • persistent_properties_loaded表示StartPropertyService(&property_fd)服务启动完成,即ro.persistent_properties.ready=true。PropertyService在PropertyInit()之后启动。
  • WritePersistentProperty(name, value)其中persist开头属性位置std::string persistent_property_filename = "/data/property/persistent_properties"
    system/core/init/persistent_properties.cpp
http://www.ngui.cc/article/show-1007635.html

相关文章

CentOs7 + Stable Diffusion + Novel AI实现AI绘画

前提条件 GPU服务器含有NVIDIA显卡安装Git环境&#xff08;版本 > 1.8.5&#xff09; 查看版本&#xff1a;git version 升级git&#xff1a;yum install -y https://repo.ius.io/ius-release-el7.rpm && yum install -y epel-release && yum erase -y git…

SpringCloud:SpringAMQP介绍

Spring AMQP是基于RabbitMQ封装的一套模板&#xff0c;并且还利用SpringBoot对其实现了自动装配&#xff0c;使用起来非常方便。Spring AMQP官方地址 Spring AMQP提供了三个功能&#xff1a; 自动声明队列、交换机及其绑定关系基于注解的监听器模式&#xff0c;异步接收消息封…

【致敬未来的攻城狮计划】连续打卡第4天+物联网操作系统概述

开启攻城狮的成长之旅&#xff01;这是我参与的由 CSDN博客专家 架构师李肯&#xff08;http://yyds.recan-li.cn&#xff09;和 瑞萨MCU &#xff08;https://www.renesas.cn/cn/zh&#xff09; 联合发起的「 致敬未来的攻城狮计划 」的第 4 天&#xff0c;点击查看活动计划详…

hastcat

hashcat 下载地址: https://hashcat.net/hashcat/ 案例 Usage: hashcat [options]... hash|hashfile|hccapxfile [dictionary|mask|directory]...https://xz.aliyun.com/t/4008破解linux shadow /etc/shadow中密码格式: $id$salt$encrypted如:$1$2eWq10AC$NaQqalCk3 1表…

ssm+vue在线课程培训系统java

在线培训系统的需求和管理上的不断提升&#xff0c;在线培训系统的潜力将无限扩大&#xff0c;在线培训系统在业界被广泛关注&#xff0c;本网站及对此进行总体分析&#xff0c;将在线培训系统信息管理的发展提供学校的管理帮助更大。 根据现有的模块&#xff0c;除管理员对系统…

docker安装Redis高可用(一主二从三哨兵)

本次教程使用docker swarm安装 准备三台机器 hostIP用途node1192.168.31.130redis-master01&#xff0c;redis哨兵节点01node2192.168.31.131redis-slave01, redis哨兵节点02node3192.168.31.132redis-slave02 redis哨兵节点02 注意事项&#xff1a; 1&#xff1a;需要保证三…

(数字图像处理MATLAB+Python)第二章数字图像处理基础-第二节:色度学基础与颜色模型

文章目录一&#xff1a;颜色匹配二&#xff1a;CIE 1931-RGB系统三&#xff1a;CIE 1931标准色度系统四&#xff1a;CIE 1976Lab均匀颜色空间五&#xff1a;孟塞尔表色系统&#xff08;1&#xff09;孟塞尔明度(Value&#xff0c;记为V)&#xff08;2&#xff09;孟塞尔彩度(Ch…

Linq使用where sql in (...)

List<int?> 机构编号数组 new List<int?>();var begin new DateTime(year, 1, 1);var end begin.AddYears(1);IQueryable<DtoReport健康体检表> Q_健康体检表 es.jktjEntitys.Where(m > m.体检日期 > begin && m.体检日期 < end).Whe…

linux 产生随机数 并遍历

1、产生随机数 varRANDOMvarRANDOM varRANDOMvar[ $var % 150 ] 2、产生不重复的随机数 $ entries($(shuf -i 0-149 -n 15)) $ echo “${entries[]}” 3、对随机数排序 $ entries($(shuf -i 0-149 -n 15 | sort -n)) $ echo “entries[]"12224549546678798393118119124140…

Vue的:key用法及示例

在 Vue 中&#xff0c;使用 v-for 指令循环遍历数组或对象时&#xff0c;每个子元素都需要绑定一个唯一的 key 值&#xff0c;用于标识这个子元素。我们可以使用 :key 属性来绑定这个 key 值。例如&#xff1a; <div v-for"item in itemList" :key"item.id&…