唤醒车机时娱乐屏出现黑屏,卡顿的案例分享

ops/2024/10/31 2:49:18/

1. 背景
测试在正常操作车机的时候,出现了:唤醒车机时娱乐屏出现连续两次黑屏,且发现系统有卡顿的现象。

2. log分析

  • low_memory_killer 杀掉adj=100的visible进程,是因为memory 不足导致的。
行 16839: 10-26 16:22:11.900235   264   264 I lowmemorykiller: Kill 'com.bilibili.bilithings:ijkservice' (19543), uid 10045, oom_adj 200 to free 65668kB行 16840: 10-26 16:22:11.900316   264   264 I lowmemorykiller: Reclaimed 65668kB, cache(209812kB) and free(52500kB)-reserved(150240kB) below min(224692kB) for oom_adj 200行 16854: 10-26 16:22:11.918705   264   264 I lowmemorykiller: Kill 'com.android.inputmethod' (15307), uid 10020, oom_adj 200 to free 55604kB行 16855: 10-26 16:22:11.918735   264   264 I lowmemorykiller: Reclaimed 55604kB, cache(209292kB) and free(73144kB)-reserved(150240kB) below min(224692kB) for oom_adj 200行 17672: 10-26 16:22:12.369378   264   264 W lowmemorykiller: Failed to open /proc/11439/oom_score_adj; errno=2: process 11439 might have been killed行 18564: 10-26 16:22:12.916724   264   264 I lowmemorykiller: Reclaimed 0kB, cache(234016kB) and free(19076kB)-reserved(150240kB) below min(262144kB) for oom_adj 250行 18565: 10-26 16:22:12.916832   264   264 I lowmemorykiller: Suppressed 90 failed kill reports行 19690: 10-26 16:22:13.882001   264   264 I lowmemorykiller: Kill 'com.android.launcher' (2036), uid 1000, oom_adj 100 to free 493428kB行 19691: 10-26 16:22:13.882084   264   264 I lowmemorykiller: Reclaimed 493428kB, cache(186928kB) and free(12132kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 19692: 10-26 16:22:13.882106   264   264 I lowmemorykiller: Suppressed 29 failed kill reports行 19704: 10-26 16:22:13.887833   264   264 I lowmemorykiller: Kill 'com.android.media' (2937), uid 10029, oom_adj 100 to free 226284kB行 19705: 10-26 16:22:13.887862   264   264 I lowmemorykiller: Reclaimed 226284kB, cache(183808kB) and free(13916kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 20857: 10-26 16:22:14.882659   264   264 I lowmemorykiller: Reclaimed 0kB, cache(237948kB) and free(12096kB)-reserved(150240kB) below min(262144kB) for oom_adj 250行 20858: 10-26 16:22:14.882715   264   264 I lowmemorykiller: Suppressed 94 failed kill reports行 21610: 10-26 16:22:15.763508   264   264 I lowmemorykiller: Kill 'com.android.local.scene' (3278), uid 1000, oom_adj 100 to free 136676kB行 21611: 10-26 16:22:15.763572   264   264 I lowmemorykiller: Reclaimed 136676kB, cache(185368kB) and free(13676kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 21612: 10-26 16:22:15.763594   264   264 I lowmemorykiller: Suppressed 3 failed kill reports行 22183: 10-26 16:22:16.463138   264   264 I lowmemorykiller: Kill 'com.android.energycenter' (3254), uid 10030, oom_adj 100 to free 119084kB行 22184: 10-26 16:22:16.463160   264   264 I lowmemorykiller: Reclaimed 119084kB, cache(183628kB) and free(13204kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 22185: 10-26 16:22:16.463167   264   264 I lowmemorykiller: Suppressed 64 failed kill reports行 22193: 10-26 16:22:16.477960   264   264 I lowmemorykiller: Kill 'com.android.btphone' (2126), uid 10028, oom_adj 100 to free 67280kB行 22194: 10-26 16:22:16.477977   264   264 I lowmemorykiller: Reclaimed 67280kB, cache(180636kB) and free(34372kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 22199: 10-26 16:22:16.481801   264   264 I lowmemorykiller: Kill 'com.android.carplay' (2446), uid 1000, oom_adj 100 to free 66228kB行 22200: 10-26 16:22:16.481822   264   264 I lowmemorykiller: Reclaimed 66228kB, cache(178556kB) and free(39916kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 22219: 10-26 16:22:16.499102   264   264 I lowmemorykiller: Kill 'com.android.permissioncontroller' (2322), uid 10043, oom_adj 100 to free 63492kB行 22220: 10-26 16:22:16.499117   264   264 I lowmemorykiller: Reclaimed 63492kB, cache(172056kB) and free(99560kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 22230: 10-26 16:22:16.515621   264   264 I lowmemorykiller: Kill 'android.ext.services' (1731), uid 10039, oom_adj 100 to free 54652kB行 22231: 10-26 16:22:16.515644   264   264 I lowmemorykiller: Reclaimed 54652kB, cache(167376kB) and free(118736kB)-reserved(150240kB) below min(187244kB) for oom_adj 100行 22289: 10-26 16:22:16.535189   264   264 I lowmemorykiller: Kill 'com.android.linkmanager' (2296), uid 1000, oom_adj 100 to free 52544kB

从/android/frameworks/base/services/core/java/com/android/server/am/ProcessList.java
可以看到adj=100的定义:VISIBLE_APP_ADJ,从google的描述来看,adj=100的进程是可见activity对应的进程,不应被杀掉。

    // This is a process bound by the system (or other app) that's more important than services but// not so perceptible that it affects the user immediately if killed.public static final int PERCEPTIBLE_LOW_APP_ADJ = 250;// This is a process hosting services that are not perceptible to the user but the// client (system) binding to it requested to treat it as if it is perceptible and avoid killing// it if possible.public static final int PERCEPTIBLE_MEDIUM_APP_ADJ = 225;// This is a process only hosting components that are perceptible to the// user, and we really want to avoid killing them, but they are not// immediately visible. An example is background music playback.public static final int PERCEPTIBLE_APP_ADJ = 200;// This is a process only hosting activities that are visible to the// user, so we'd prefer they don't disappear.public static final int VISIBLE_APP_ADJ = 100;static final int VISIBLE_APP_LAYER_MAX = PERCEPTIBLE_APP_ADJ - VISIBLE_APP_ADJ - 1;// This is a process that was recently TOP and moved to FGS. Continue to treat it almost// like a foreground app for a while.// @see TOP_TO_FGS_GRACE_PERIODpublic static final int PERCEPTIBLE_RECENT_FOREGROUND_APP_ADJ = 50;// This is the process running the current foreground app.  We'd really// rather not kill it!public static final int FOREGROUND_APP_ADJ = 0;// This is a process that the system or a persistent process has bound to,// and indicated it is important.public static final int PERSISTENT_SERVICE_ADJ = -700;
  • log进程占用内存过大触发low memory
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ?? 1650301: logmgr (pid 855) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   77679: surfaceflinger (pid 497) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   58900: logd (pid 263) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   16023: android.hardware.automotive.vehicle@2.0-service (pid 428) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   15327: media.extractor (pid 764) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   13763: audioserver (pid 486) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   12345: media.metrics (pid 767) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   11470: zygote (pid 389) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??   10143: webview_zygote (pid 1542) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    7932: mediaserver (pid 769) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    7912: media.swcodec (pid 781) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    7103: cameraserver (pid 742) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    6721: android.hardware.graphics.composer@2.4-service (pid 442) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    6605: android.hardware.audio.service (pid 274) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    6383: init (pid 1) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    6122: zygote64 (pid 388) native
10-26 16:22:13.489428  1111 11527 I ActivityManager:   ntv   ??    5720: media.hwcodec (pid 462) native
  • Log V等级的log大量打印,导致logd进程来不及输出,占用内存所致。
	行    89: 10-26 16:22:02.900211   622 16572 V tbox_client: wait heartbeat signal timeout行    92: 10-26 16:22:02.900295   622 16572 V tbox_client: BaseMessageInterface行    93: 10-26 16:22:02.900319   622 16572 V tbox_client: init BaseMessageInterface new message:0xb400007665043780 data:0xb4000076e50310b0行    94: 10-26 16:22:02.900575   622 16572 V tbox_client: wait for heartbeat signal行    98: 10-26 16:22:02.900927   622 16123 V tbox_client: ~BaseMessageInterface ~BaseMessageInterface delete message:0xb400007665043780 data:0xb4000076e50310b0行   101: 10-26 16:22:02.901545   428 16144 V ANDROID_SOMEIP: SOME/IP-RM [0x0000] received message [NOTIFICATION] on service [0x0301:0x8003:0x0001]行   102: 10-26 16:22:02.901622   428 16144 V ANDROID_SOMEIP: Received [NOTIFICATION] message from Client [0x0000] for a Service [0x0301:0x0001] Method [0x8003] with len [33]行   103: 10-26 16:22:02.901638   428 16144 V ANDROID_SOMEIP: SOME/IP-SA received message [2] on Service [0x0301:0x0001:0x8003] client [0x0000] len [1]行   104: 10-26 16:22:02.901755   428   508 V -BIND   : [COM Callback: 0x0301:0x0001:0x8003]行   106: 10-26 16:22:02.902100   428 16144 V ANDROID_SOMEIP: SOME/IP-RM [0x0000] received message [NOTIFICATION] on service [0x0302:0x8001:0x0001]行   107: 10-26 16:22:02.902137   428 16144 V ANDROID_SOMEIP: Received [NOTIFICATION] message from Client [0x0000] for a Service [0x0302:0x0001] Method [0x8001] with len [103]行   108: 10-26 16:22:02.902202   428 16144 V ANDROID_SOMEIP: SOME/IP-SA received message [2] on Service [0x0302:0x0001:0x8001] client [0x0000] len [71]行   109: 10-26 16:22:02.902270   428   508 V -BIND   : [COM Callback: 0x0302:0x0001:0x8001]行   211: 10-26 16:22:02.941557   428 16144 V ANDROID_SOMEIP: SOME/IP-RM [0x0000] received message [NOTIFICATION] on service [0x0302:0x8001:0x0001]行   212: 10-26 16:22:02.941629   428 16144 V ANDROID_SOMEIP: Received [NOTIFICATION] message from Client [0x0000] for a Service [0x0302:0x0001] Method [0x8001] with len [103]行   213: 10-26 16:22:02.941647   428 16144 V ANDROID_SOMEIP: SOME/IP-SA received message [2] on Service [0x0302:0x0001:0x8001] client [0x0000] len [71]行   214: 10-26 16:22:02.941731   428 16144 V ANDROID_SOMEIP: SOME/IP-RM [0x0000] received message [NOTIFICATION] on service [0x0301:0x8003:0x0001]行   215: 10-26 16:22:02.941753   428 16144 V ANDROID_SOMEIP: Received [NOTIFICATION] message from Client [0x0000] for a Service [0x0301:0x0001] Method [0x8003] with len [33]行   216: 10-26 16:22:02.941762   428 16144 V ANDROID_SOMEIP: SOME/IP-SA received message [2] on Service [0x0301:0x0001:0x8003] client [0x0000] len [1]行   217: 10-26 16:22:02.941828   428   508 V -BIND   : [COM Callback: 0x0301:0x0001:0x8003]行   219: 10-26 16:22:02.941961   428   508 V -BIND   : [COM Callback: 0x0302:0x0001:0x8001]行   286: 10-26 16:22:02.964688  1111  1156 V SettingsProvider: callingUid=1000 call([settings, PUT_global, android_car_info_driving_speed, Bundle[{_user=0, value=48}]]) = null行   293: 10-26 16:22:02.967693  1111 11173 V SettingsProvider: callingUid=1000 call([settings, GET_global, dropbox_age_seconds, null]) = Bundle[{value=null}]行   295: 10-26 16:22:02.967786  1111 11173 V SettingsProvider: callingUid=1000 call([settings, GET_global, dropbox_max_files, null]) = Bundle[{value=null}]行   297: 10-26 16:22:02.967866  1111 11173 V SettingsProvider: callingUid=1000 call([settings, GET_global, dropbox_quota_percent, null]) = Bundle[{value=null}]行   298: 10-26 16:22:02.968010  1111 11173 V SettingsProvider: callingUid=1000 call([settings, GET_global, dropbox_reserve_percent, null]) = Bundle[{value=null}]行   300: 10-26 16:22:02.968181  1111 11173 V SettingsProvider: callingUid=1000 call([settings, GET_global, dropbox_quota_kb, null]) = Bundle[{value=null}]行   311: 10-26 16:22:02.971871  1111  5423 V SettingsProvider: callingUid=1000 call([settings, GET_global, com.android.assistant.full_wakeup_free.enable, null]) = Bundle[{value=null}]行   313: 10-26 16:22:02.972473  1111 17082 V SettingsProvider: callingUid=1000 call([settings, GET_global, driving_video_limit_key, null]) = Bundle[{value=0}]
  • logd输出如下log表示logd出现了内存不足的情况:
    行 1503: 10-26 16:22:03.451576 0 0 D logd : Kicking blocked reader, pid 855, from LogBuffer::kickMe()
    行 1508: 10-26 16:22:03.452153 0 0 D logd : Kicking blocked reader, pid 855, from LogBuffer::kickMe()

在这里插入图片描述

3. 修改方案

  • 精简log V的log
  • 工程模式去掉log V的调整入口,不让测试或者正常用户使用。

http://www.ppmy.cn/ops/129760.html

相关文章

STL---map与set前言(红黑树)

文章目录 红黑树概念性质AVL树和红黑树的对比红黑树的代码实现节点结构红黑树的结构红黑树的插入逻辑红黑树的插入的代码实现其他接口验证红黑树的正确性红黑树完整代码 红黑树 概念 红黑树是一种搜索二叉树,但红黑树在每个节点上增加一个存储位表示节点的颜色&am…

UART-通用异步收发器

1. UART的基本工作原理 UART通信主要有两个部分构成:发送器和接收器,也就是我们常见的(RX接收,TX发送)两个独立的线路来实现数据的双向传输,由于是异步的,UART并不需要时钟信号,而是…

VS中MFC的使用-学习笔记

IsWindow 函数 (winuser.h):确定指定的窗口句柄是否标识现有窗口。使用Visual C从文件读取XML数据 tinyxml2库 CMarkup类源代码下载地址 使用方法,将头文件和源文件拷贝添加到工程中即可,若编译错误,在源文件中添加#include “stdafx.h” 使用…

Java面试题——微服务篇

1.微服务的拆分原则/怎么样才算一个有效拆分 单一职责原则:每个微服务应该具有单一的责任。这意味着每个服务只关注于完成一项功能,并且该功能应该是独立且完整的。最小化通信:尽量减少服务之间的通信,服务间通信越少&#xff0c…

将CSDN博客转换为PDF的Python Web应用开发--Flask实战

文章目录 项目概述技术栈介绍 项目目录应用结构 功能实现单页博客转换示例: 专栏合集博客转换示例: PDF效果: 代码依赖文件requirements.txt:app.py:代码解释: /api/onepage.py:代码解释: /api/zhuanlan.py…

Flink CDC系列之:理解学习Kubernetes模式

Flink CDC系列之:理解学习Kubernetes模式 准备会话模式启动会话集群设置 Flink CDC提交 Flink CDC Job Kubernetes 是一种流行的容器编排系统,用于自动化计算机应用程序的部署、扩展和管理。Flink 的原生 Kubernetes 集成允许您直接在正在运行的 Kuberne…

【MTMSA】不确定缺失模态下基于情态翻译的多模态情感分析

MTMSA是基于TATE改进的,大致框架都和他一样,区别在于MTMSA没有提到tag,并且在多头注意力的部分进行了改进,也就是文中模态翻译模块,此外还加了两个损失函数。在TATE中有一章是不同设置的影响,里面有多个证明…

【Python系列】SQLAlchemy判断非空

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…