当前位置: 首页 > news >正文

logd守护进程

logd守护进程

  • 1、adb logcat命令
  • 2、logd守护进程启动
    • 2.1 logd文件目录
    • 2.2 main方法启动
  • 3、LogBuffer缓存大小
    • 3.1 缓存大小优先级设置
    • 3.2 缓存大小相关代码位置

android12-release


1、adb logcat命令

命令功能
adb bugreport > bugreport.txtbugreport 日志
adb shell dmesg > dmesg.txtdmesg 日志
adb logcat -d -v time -b “main” > main.txtmain 日志
adb logcat -d -v time -b “system” > system.txtsystem日志
adb logcat -d -v time -b “events” > events.txtevents 日志
adb logcat -b crash输出crash日志
… …等等
adb logcat -h查看logcat命令帮助
Usage: logcat [options] [filterspecs]General options:-b, --buffer=<buffer>       Request alternate ring buffer(s):main system radio events crash default allAdditionally, 'kernel' for userdebug and eng builds, and'security' for Device Owner installations.Multiple -b parameters or comma separated list of buffers areallowed. Buffers are interleaved.Default -b main,system,crash,kernel.-L, --last                  Dump logs from prior to last reboot from pstore.-c, --clear                 Clear (flush) the entire log and exit.if -f is specified, clear the specified file and its related rotatedlog files instead.if -L is specified, clear pstore log instead.-d                          Dump the log and then exit (don't block).--pid=<pid>                 Only print logs from the given pid.--wrap                      Sleep for 2 hours or when buffer about to wrap whichevercomes first. Improves efficiency of polling by providingan about-to-wrap wakeup.Formatting:-v, --format=<format>       Sets log print format verb and adverbs, where <format> is one of:brief help long process raw tag thread threadtime timeModifying adverbs can be added:color descriptive epoch monotonic printable uid usec UTC year zoneMultiple -v parameters or comma separated list of format and formatmodifiers are allowed.-D, --dividers              Print dividers between each log buffer.-B, --binary                Output the log in binary.Outfile files:-f, --file=<file>           Log to file instead of stdout.-r, --rotate-kbytes=<n>     Rotate log every <n> kbytes. Requires -f option.-n, --rotate-count=<count>  Sets max number of rotated logs to <count>, default 4.--id=<id>                   If the signature <id> for logging to file changes, then clear theassociated files and continue.Logd control:These options send a control message to the logd daemon on device, print its return message ifapplicable, then exit. They are incompatible with -L, as these attributes do not apply to pstore.-g, --buffer-size           Get the size of the ring buffers within logd.-G, --buffer-size=<size>    Set size of a ring buffer in logd. May suffix with K or M.This can individually control each buffer's size with -b.-S, --statistics            Output statistics.--pid can be used to provide pid specific stats.-p, --prune                 Print prune rules. Each rule is specified as UID, UID/PID or /PID. A'~' prefix indicates that elements matching the rule should be prunedwith higher priority otherwise they're pruned with lower priority. Allother pruning activity is oldest first. Special case ~! represents anautomatic pruning for the noisiest UID as determined by the currentstatistics.  Special case ~1000/! represents pruning of the worst PIDwithin AID_SYSTEM when AID_SYSTEM is the noisiest UID.-P, --prune='<list> ...'    Set prune rules, using same format as listed above. Must be quoted.Filtering:-s                          Set default filter to silent. Equivalent to filterspec '*:S'-e, --regex=<expr>          Only print lines where the log message matches <expr> where <expr> isan ECMAScript regular expression.-m, --max-count=<count>     Quit after printing <count> lines. This is meant to be paired with--regex, but will work on its own.--print                     This option is only applicable when --regex is set and only useful if--max-count is also provided.With --print, logcat will print all messages even if they do notmatch the regex. Logcat will quit after printing the max-count numberof lines that match the regex.-t <count>                  Print only the most recent <count> lines (implies -d).-t '<time>'                 Print the lines since specified time (implies -d).-T <count>                  Print only the most recent <count> lines (does not imply -d).-T '<time>'                 Print the lines since specified time (not imply -d).count is pure numerical, time is 'MM-DD hh:mm:ss.mmm...''YYYY-MM-DD hh:mm:ss.mmm...' or 'sssss.mmm...' format.--uid=<uids>                Only display log messages from UIDs present in the comma separate list<uids>. No name look-up is performed, so UIDs must be provided asnumeric values. This option is only useful for the 'root', 'log', and'system' users since only those users can view logs from other users.filterspecs are a series of<tag>[:priority]where <tag> is a log component tag (or * for all) and priority is:V    Verbose (default for <tag>)D    Debug (default for '*')I    InfoW    WarnE    ErrorF    FatalS    Silent (suppress all output)'*' by itself means '*:D' and <tag> by itself means <tag>:V.
If no '*' filterspec or -s on command line, all filter defaults to '*:V'.
eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.If not specified on the command line, filterspec is set from ANDROID_LOG_TAGS.If not specified with -v on command line, format is set from ANDROID_PRINTF_LOG
or defaults to "threadtime"-v <format>, --format=<format> options:Sets log print format verb and adverbs, where <format> is:brief long process raw tag thread threadtime timeand individually flagged modifying adverbs can be added:color descriptive epoch monotonic printable uid usec UTC year zoneSingle format verbs:brief      — Display priority/tag and PID of the process issuing the message.long       — Display all metadata fields, separate messages with blank lines.process    — Display PID only.raw        — Display the raw log message, with no other metadata fields.tag        — Display the priority/tag only.thread     — Display priority, PID and TID of process issuing the message.threadtime — Display the date, invocation time, priority, tag, and the PIDand TID of the thread issuing the message. (the default format).time       — Display the date, invocation time, priority/tag, and PID of theprocess issuing the message.Adverb modifiers can be used in combination:color       — Display in highlighted color to match priority. i.e. VERBOSEDEBUG INFO WARNING ERROR FATALdescriptive — events logs only, descriptions from event-log-tags database.epoch       — Display time as seconds since Jan 1 1970.monotonic   — Display time as cpu seconds since last boot.printable   — Ensure that any binary logging content is escaped.uid         — If permitted, display the UID or Android ID of logged process.usec        — Display time down the microsecond precision.UTC         — Display time as UTC.year        — Add the year to the displayed time.zone        — Add the local timezone to the displayed time."<zone>"    — Print using this public named timezone (experimental).

2、logd守护进程启动

2.1 logd文件目录

Android系统启动 查看 init 进程解析 rc 文件,其中解析 logd.rc,调用到logd/main.cpp主函数。
相关目录:
system/logging/logd/logd.rc
system/logging/logd/main.cpp
在这里插入图片描述
logd.rc文件:

service logd /system/bin/logdsocket logd stream 0666 logd logdsocket logdr seqpacket 0666 logd logdsocket logdw dgram+passcred 0222 logd logdfile /proc/kmsg rfile /dev/kmsg wuser logdgroup logd system package_info readproccapabilities SYSLOG AUDIT_CONTROLpriority 10writepid /dev/cpuset/system-background/tasksservice logd-reinit /system/bin/logd --reinitoneshotdisableduser logdgroup logdwritepid /dev/cpuset/system-background/tasks# Limit SELinux denial generation to 5/second
service logd-auditctl /system/bin/auditctl -r 5oneshotdisableduser logdgroup logdcapabilities AUDIT_CONTROLon fswrite /dev/event-log-tags "# content owned by logd
"chown logd logd /dev/event-log-tagschmod 0644 /dev/event-log-tagson property:sys.boot_completed=1start logd-auditctl

2.2 main方法启动

    1. 使用 android::base::KernelLogger 调试logd内部的日志输出,这部分日志输出到kernel log中,通过dmesg获取/dev/kmsg
    1. 处理“reinit”命令
    1. ro.logd.kernel 属性控制获取/proc/kmsg的FD
    1. log_buffer 有chatty、serialized、simple模式(默认serialized),通过属性logd.buffer_type获取;LogBuffer 是负责保存所有日志条目的对象。
    1. 相关监听线程:
    • /dev/socket/logdr LogReader监听
    • /dev/socket/logdw LogListener监听
    • /dev/socket/logd CommandListener监听
int main(int argc, char* argv[]) {// We want EPIPE when a reader disconnects, not to terminate logd.signal(SIGPIPE, SIG_IGN);// logd is written under the assumption that the timezone is UTC.// If TZ is not set, persist.sys.timezone is looked up in some time utility// libc functions, including mktime. It confuses the logd time handling,// so here explicitly set TZ to UTC, which overrides the property.setenv("TZ", "UTC", 1);// issue reinit command. KISS argument parsing.if ((argc > 1) && argv[1] && !strcmp(argv[1], "--reinit")) {return issueReinit();}android::base::InitLogging(argv, [](android::base::LogId log_id, android::base::LogSeverity severity,const char* tag, const char* file, unsigned int line, const char* message) {if (tag && strcmp(tag, "logd") != 0) {auto prefixed_message = android::base::StringPrintf("%s: %s", tag, message);android::base::KernelLogger(log_id, severity, "logd", file, line,prefixed_message.c_str());} else {android::base::KernelLogger(log_id, severity, "logd", file, line, message);}});static const char dev_kmsg[] = "/dev/kmsg";int fdDmesg = android_get_control_file(dev_kmsg);if (fdDmesg < 0) {fdDmesg = TEMP_FAILURE_RETRY(open(dev_kmsg, O_WRONLY | O_CLOEXEC));}int fdPmesg = -1;bool klogd = GetBoolPropertyEngSvelteDefault("ro.logd.kernel");if (klogd) {SetProperty("ro.logd.kernel", "true");static const char proc_kmsg[] = "/proc/kmsg";fdPmesg = android_get_control_file(proc_kmsg);if (fdPmesg < 0) {fdPmesg = TEMP_FAILURE_RETRY(open(proc_kmsg, O_RDONLY | O_NDELAY | O_CLOEXEC));}if (fdPmesg < 0) PLOG(ERROR) << "Failed to open " << proc_kmsg;}bool auditd = GetBoolProperty("ro.logd.auditd", true);DropPrivs(klogd, auditd);// A cache of event log tagsLogTags log_tags;// Pruning configuration.PruneList prune_list;std::string buffer_type = GetProperty("logd.buffer_type", "serialized");// Partial (required for chatty) or full logging statistics.LogStatistics log_statistics(GetBoolPropertyEngSvelteDefault("logd.statistics"),buffer_type == "serialized");// Serves the purpose of managing the last logs times read on a socket connection, and as a// reader lock on a range of log entries.LogReaderList reader_list;// LogBuffer is the object which is responsible for holding all log entries.LogBuffer* log_buffer = nullptr;if (buffer_type == "chatty") {log_buffer = new ChattyLogBuffer(&reader_list, &log_tags, &prune_list, &log_statistics);} else if (buffer_type == "serialized") {log_buffer = new SerializedLogBuffer(&reader_list, &log_tags, &log_statistics);} else if (buffer_type == "simple") {log_buffer = new SimpleLogBuffer(&reader_list, &log_tags, &log_statistics);} else {LOG(FATAL) << "buffer_type must be one of 'chatty', 'serialized', or 'simple'";}// LogReader listens on /dev/socket/logdr. When a client// connects, log entries in the LogBuffer are written to the client.LogReader* reader = new LogReader(log_buffer, &reader_list);if (reader->startListener()) {return EXIT_FAILURE;}// LogListener listens on /dev/socket/logdw for client// initiated log messages. New log entries are added to LogBuffer// and LogReader is notified to send updates to connected clients.LogListener* swl = new LogListener(log_buffer);if (!swl->StartListener()) {return EXIT_FAILURE;}// Command listener listens on /dev/socket/logd for incoming logd// administrative commands.CommandListener* cl = new CommandListener(log_buffer, &log_tags, &prune_list, &log_statistics);if (cl->startListener()) {return EXIT_FAILURE;}// LogAudit listens on NETLINK_AUDIT socket for selinux// initiated log messages. New log entries are added to LogBuffer// and LogReader is notified to send updates to connected clients.LogAudit* al = nullptr;if (auditd) {int dmesg_fd = GetBoolProperty("ro.logd.auditd.dmesg", true) ? fdDmesg : -1;al = new LogAudit(log_buffer, dmesg_fd, &log_statistics);}LogKlog* kl = nullptr;if (klogd) {kl = new LogKlog(log_buffer, fdDmesg, fdPmesg, al != nullptr, &log_statistics);}readDmesg(al, kl);// failure is an option ... messages are in dmesg (required by standard)if (kl && kl->startListener()) {delete kl;}if (al && al->startListener()) {delete al;}TEMP_FAILURE_RETRY(pause());return EXIT_SUCCESS;
}

3、LogBuffer缓存大小

3.1 缓存大小优先级设置

1、persist.logd.size.[buffer_name]; 比如buffer_name为main、system、events、crash;
2、ro.logd.size.[buffer_name]
3、persist.logd.size 开发模式中可以设置大小
4、ro.logd.size
5、kLogBufferMinSize = 64 * 1024 默认64k

3.2 缓存大小相关代码位置

system/logging/logd/SerializedLogBuffer.cpp
在这里插入图片描述
system/logging/logd/SimpleLogBuffer.cpp
在这里插入图片描述
system/logging/logd/ChattyLogBuffer.cpp
在这里插入图片描述
system/logging/logd/LogBuffer.h
system/logging/logd/LogSize.cpp
在这里插入图片描述
system/logging/liblog/logger_name.cpp
在这里插入图片描述

相关文章:

logd守护进程

logd守护进程1、adb logcat命令2、logd守护进程启动2.1 logd文件目录2.2 main方法启动3、LogBuffer缓存大小3.1 缓存大小优先级设置3.2 缓存大小相关代码位置android12-release1、adb logcat命令 命令功能adb bugreport > bugreport.txtbugreport 日志adb shell dmesg >…...

【汽车雷达通往自动驾驶的关键技术】

本文编辑&#xff1a;调皮哥的小助理 现代汽车雷达装置比手机还小&#xff0c;能探测前方、后方或侧方的盲点位置是否存在障碍物&#xff0c;但这还不百分之百实现全自动驾驶的。传统的汽车雷达分辨率都不高&#xff0c;只能“看到”一团东西&#xff0c;可以检测到汽车周围存在…...

2023实习面经

实习面经 秋招笔试面试全记录 字节-电商 字节实习一面&#xff1a; 二分类的损失函数是什么&#xff0c;怎么算&#xff1f;多分类的损失函数怎么算&#xff1f;如果文本分类的标签有多个&#xff0c;比如一个文本同时属于多个label那怎么办&#xff1f;如果文本分类里面的…...

linux shell 入门学习笔记2shell脚本

什么是shell脚本 当命令或者程序语句写在文件中&#xff0c;我们执行文件&#xff0c;读取其中的代码&#xff0c;这个程序就称之为shell脚本。 有了shell脚本肯定是要有对应的解释器了&#xff0c;常见的shell脚本解释器有sh、python、perl、tcl、php、ruby等。一般这种使用文…...

Android稳定性系列-01-使用 Address Sanitizer检测原生代码中的内存错误

前言想必大家曾经被各种Native Crash折磨过&#xff0c;本地测试没啥问题&#xff0c;一到线上或者自动化测试就出现各种SIGSEGV、SIGABRT、SIGILL、SIGBUS、SIGFPE异常&#xff0c;而且堆栈还是崩溃到libc.so这种&#xff0c;看起来跟我们的代码没啥关系&#xff0c;关键还不好…...

HyperOpt-quniform 范围问题

在使用 quniform 的时候&#xff0c;可能会出现超出指定范围的值&#xff0c;例如对于 GBDT 设置参数空间为 learning_rate:hp.quniform(learning_rate,0.05,2.05,0.2)&#xff0c;但是仍然会报错 ValueError: learning_rate must be greater than 0 but was 0.0&#xff0c;但…...

Pycharm搭建一个Django项目

File->new project 点击create&#xff0c; 等待一下即可 查看安装 Django 版本&#xff1a; 在 Pycharm 底部选择 Terminal 然后在里面输入&#xff1a;python -m django --version 启动项目&#xff1a; 在 Terminal 里面输入: python manage.py runserver 查看文件目…...

浅析前端工程化中的一部曲——模块化

在日益复杂和多元的 Web 业务背景下&#xff0c;前端工程化经常会被提及。工程化的目的是高性能、稳定性、可用性、可维护性、高效协同&#xff0c;只要是以这几个角度为目标所做的操作&#xff0c;都可成为工程化的一部分。工程化是软件工程中的一种思想&#xff0c;当下的工程…...

新版bing(集成ChatGPT)申请通过后在谷歌浏览器(Chrome)上的使用方法

大家好,我是herosunly。985院校硕士毕业,现担任算法研究员一职,热衷于机器学习算法研究与应用。曾获得阿里云天池比赛第一名,科大讯飞比赛第三名,CCF比赛第四名。拥有多项发明专利。对机器学习和深度学习拥有自己独到的见解。曾经辅导过若干个非计算机专业的学生进入到算法…...

Time-distributed 的理解

前言 今天看到论文中用到 Time-distributed CNN&#xff0c;第一次见到 Time-distributed&#xff0c;不理解是什么含义&#xff0c;看到代码实现也很懵。不管什么网络结构&#xff0c;外面都能套一个TimeDistributed。看了几个博客&#xff0c;还是不明白&#xff0c;问了问C…...

matlab 计算矩阵的Moore-Penrose 伪逆

目录 一、Moore-Penrose 伪逆1、主要函数2、输入输出参数二、代码示例使用伪逆求解线性方程组一、Moore-Penrose 伪逆 Moore-Penrose 伪逆是一种矩阵,可在不存在逆矩阵的情况下作为逆矩阵的部分替代。此矩阵常被用于求解没有唯一解或有许多解的线性方程组。    对于任何矩阵…...

简历制作方面的经验与建议

专栏推荐:2023 数字IC设计秋招复盘——数十家公司笔试题、面试实录 专栏首页:2023 数字IC设计秋招复盘——数十家公司笔试题、面试实录 专栏内容: 笔试复盘篇 2023秋招过程中整理的笔试题,来源包括我自己求职笔试以及整理其他同学的笔试。包含华为、中兴、联发科、AMD、大…...

C语言--static、const、volatile关键字

Static static修饰局部变量改变了变量的生命周期&#xff0c;让静态局部变量出了作用域依然存在&#xff0c;到程序结束&#xff0c;生命周期才结束。 static 修饰局部变量 改变局部变量的生命周期&#xff0c;本质上是改变了局部变量的存储位置&#xff0c;让局部变量不再是…...

Rust学习入门--【18】Rust结构体

系列文章目录 Rust 语言是一种高效、可靠的通用高级语言&#xff0c;效率可以媲美 C / C 。本系列文件记录博主自学Rust的过程。欢迎大家一同学习。 Rust学习入门–【1】引言 Rust学习入门–【2】Rust 开发环境配置 Rust学习入门–【3】Cargo介绍 Rust学习入门–【4】Rust 输…...

LeetCode142 环形链表Ⅱ

题目&#xff1a; 给定一个链表的头节点 head &#xff0c;返回链表开始入环的第一个节点。 如果链表无环&#xff0c;则返回 null。 如果链表中有某个节点&#xff0c;可以通过连续跟踪 next 指针再次到达&#xff0c;则链表中存在环。 为了表示给定链表中的环&#xff0c;评…...

JavaScript刷LeetCode拿offer-高频链表题

首先需要了解链表的概念 先把 next 记录下来 无论是插入&#xff0c;删除&#xff0c;还是翻转等等操作&#xff0c;先把 next 指针用临时变量保存起来&#xff0c;这可以解决 90% 重组链表中指向出错的问题&#xff0c; 如果不知道什么时候需要用到守卫&#xff0c;那就都用…...

linux系统编程2--网络编程

在linux系统编程中网络编程是使用socket&#xff08;套接字&#xff09;&#xff0c;socket这个词可以表示很多概念&#xff1a;在TCP/IP协议中&#xff0c;“IP地址TCP或UDP端口号”唯一标识网络通讯中的一个进程&#xff0c;“IP地址端口号”就称为socket。在TCP协议中&#…...

Allegro如何重命名光绘操作指导

Allegro如何重命名光绘操作指导 在做PCB设计的时候,光绘设置是输出生产文件必要的流程,设置好光绘之后,如何对光绘重新命名,如下图 如何把L1改成TOP,L6改成BOTTOM,具体操作步骤如下 点击Manufacture选择Artwork...

[PMLR 2018] Hyperbolic entailment cones for learning hierarchical embeddings

Contents IntroductionEntailment Cones in the Poincar BallConvex cones in a complete Riemannian manifoldAngular cones in the Poincar ballfour intuitive propertiesClosed form expression of the optimal ψ \psi...

2023春季露营投影怎么选?轻薄投影极米Z6X Pro值得推荐

近年来&#xff0c;露营经济在多重因素的共同助推下快速发展&#xff0c;精致露营的攻略开始占据小红书、微博、朋友圈等各类社交平台&#xff0c;吸引着更多用户种草并加入到露营大军中&#xff0c;而露营经济的强势“破圈”给家用智能投影带来了更多的发展契机。凭借着小巧的…...

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...

AI-调查研究-01-正念冥想有用吗?对健康的影响及科学指南

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; &#x1f680; AI篇持续更新中&#xff01;&#xff08;长期更新&#xff09; 目前2025年06月05日更新到&#xff1a; AI炼丹日志-28 - Aud…...

VB.net复制Ntag213卡写入UID

本示例使用的发卡器&#xff1a;https://item.taobao.com/item.htm?ftt&id615391857885 一、读取旧Ntag卡的UID和数据 Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click轻松读卡技术支持:网站:Dim i, j As IntegerDim cardidhex, …...

大型活动交通拥堵治理的视觉算法应用

大型活动下智慧交通的视觉分析应用 一、背景与挑战 大型活动&#xff08;如演唱会、马拉松赛事、高考中考等&#xff09;期间&#xff0c;城市交通面临瞬时人流车流激增、传统摄像头模糊、交通拥堵识别滞后等问题。以演唱会为例&#xff0c;暖城商圈曾因观众集中离场导致周边…...

《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)

CSI-2 协议详细解析 (一&#xff09; 1. CSI-2层定义&#xff08;CSI-2 Layer Definitions&#xff09; 分层结构 &#xff1a;CSI-2协议分为6层&#xff1a; 物理层&#xff08;PHY Layer&#xff09; &#xff1a; 定义电气特性、时钟机制和传输介质&#xff08;导线&#…...

理解 MCP 工作流:使用 Ollama 和 LangChain 构建本地 MCP 客户端

&#x1f31f; 什么是 MCP&#xff1f; 模型控制协议 (MCP) 是一种创新的协议&#xff0c;旨在无缝连接 AI 模型与应用程序。 MCP 是一个开源协议&#xff0c;它标准化了我们的 LLM 应用程序连接所需工具和数据源并与之协作的方式。 可以把它想象成你的 AI 模型 和想要使用它…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

相机从app启动流程

一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...

反射获取方法和属性

Java反射获取方法 在Java中&#xff0c;反射&#xff08;Reflection&#xff09;是一种强大的机制&#xff0c;允许程序在运行时访问和操作类的内部属性和方法。通过反射&#xff0c;可以动态地创建对象、调用方法、改变属性值&#xff0c;这在很多Java框架中如Spring和Hiberna…...

Android Bitmap治理全解析:从加载优化到泄漏防控的全生命周期管理

引言 Bitmap&#xff08;位图&#xff09;是Android应用内存占用的“头号杀手”。一张1080P&#xff08;1920x1080&#xff09;的图片以ARGB_8888格式加载时&#xff0c;内存占用高达8MB&#xff08;192010804字节&#xff09;。据统计&#xff0c;超过60%的应用OOM崩溃与Bitm…...