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

网站建设微信托管中国万网官网

网站建设微信托管,中国万网官网,网站建设与管理专业人才调研,wordpress上传安装包Android Car WatchDog I/O监控服务 背景: 某基于Android 13的车载系统。 某天长时间测试一款3方(非SystemApp)时,该款应用偶发闪退现象。 通过日志分析,发现应用被系统的 Car WatchDog(喂狗服务&#xff…

Android Car WatchDog I/O监控服务

  • 背景:
    某基于Android 13的车载系统。

某天长时间测试一款3方(非SystemApp)时,该款应用偶发闪退现象。
通过日志分析,发现应用被系统的 Car WatchDog(喂狗服务)Disable掉了。
日志如下

Disabled package *** on user*** until used due to resource overuse

对应的代码部分。
/packages/services/Car/service/src/com/android/car/watchdog/WatchdogPerfHandler.java

/** Disables a package for specific user until used. */
public boolean disablePackageForUser(String packageName, @UserIdInt int userId) {try {int currentEnabledState =PackageManagerHelper.getApplicationEnabledSettingForUser(packageName, userId);switch (currentEnabledState) {case COMPONENT_ENABLED_STATE_DISABLED:case COMPONENT_ENABLED_STATE_DISABLED_USER:case COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:Slogf.w(TAG, "Unable to disable application for user %d, package '%s' as the "+ "current enabled state is %s", userId, packageName,toEnabledStateString(currentEnabledState));return false;}PackageManagerHelper.setApplicationEnabledSettingForUser(packageName,COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED, /* flags= */ 0, userId,mContext.getPackageName());appendToDisabledPackagesSettingsString(packageName, userId);Slogf.i(TAG, "Disabled package '%s' on user %d until used due to resource overuse",packageName, userId);} catch (Exception e) {Slogf.e(TAG, e, "Failed to disable application for user %d, package '%s'", userId,packageName);return false;}return true;
}

问题分析

Car WatchDog中的IO Monitor,会监监控所有应用或服务的磁盘I/O用量。以保证系统的稳定。主要包括:

  • 应用的磁盘I/O写入量。
  • 应用的System-wide I/O写入量(宽带)

当应用或服务超过预定义的阈值时,Car WatchDog会对相应的应用或者服务执行相应操作(比如 kill掉):

  • 系统服务或应用,不受限制(可以通过配置文件指定,哪些系统服务或应用受到监控)
  • 三方应用,监控被进行限制。

设定的阈值统计范围时,一天内。
Car WatchDog中的IO Monitor,会统计一天内的I/O使用情况。

上述问题分析

回到上面说的问题。某一款三方应用,偶尔退出,并且系统中存在下述日志。

Disabled package *** on user*** until used due to resource overuse

该日志说明,这款应用因为I/O使用超过阈值,被系统Kill。
后续通过复现,抓取IO相应日志,发现出现问题时该应用,在一天内的写入量超过3GB,这个值已经超过系统的阈值配置。

阈值配置文件:
/packages/services/Car/cpp/watchdog/server/data/third_party_resource_overuse_configuration.xml

<?xml version='1.0' encoding='utf-8'?>
<!-- Copyright (C) 2021 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
--><resourceOveruseConfiguration version="1.0"><componentType> THIRD_PARTY </componentType><ioOveruseConfiguration><!-- Default thresholds in MiB for all third-party packages that don't have app categoryspecific thresholds. --><componentLevelThresholds><state id="foreground_mode"> 3072 </state><state id="background_mode"> 2048 </state><state id="garage_mode"> 4096 </state></componentLevelThresholds></ioOveruseConfiguration>
</resourceOveruseConfiguration>

修改: 去掉该三方引用的无用I/O操作。后续测试,无偶先问题。

关于Android源码部分的实现,可以感兴趣的可以阅读如下源文件。
packages/services/Car/cpp/watchdog/server/src/IoOveruseMonitor.cpp

http://www.15wanjia.com/news/33104.html

相关文章:

  • 珠海网站建设最新报价微博推广平台
  • 做洁具最好的网站最新国际新闻50条简短
  • 网站腾讯qq对话框怎么做最新营销模式有哪些
  • 北京微信网站设计费用百度指数查询官网大数据
  • 做高端网站建设seo渠道是什么意思
  • 建设网站制作实训报告网络营销的特征
  • 济南学习做网站seo排名优化推广教程
  • 做网站济宁自助优化排名工具
  • 性是怎么做视频网站seoul
  • 做网站的教程google关键词搜索工具
  • 肇庆网站建设方案优化网站视频
  • 工业设计网站排行榜前十名有哪些软文营销案例文章
  • 网站备案后怎么做网站流量查询网站统计查询
  • 广州五屏网站建设seo自动点击排名
  • wordpress制作友情链接页面百度关键词优化公司
  • 惠州公司做网站关键词歌词图片
  • 做网站模板 优帮云茂名百度seo公司
  • 广州网站制作功能陕西网页设计
  • 网站建设颊算网站推广工作
  • 贵州做农业网站seo建站工具
  • 小米商城网页设计论文百度seo公司
  • 北京网站设计公司兴田德润怎么样下载百度app最新版到桌面
  • 做网站开发学什么语言app推广
  • 宿迁网站制作网站多少钱
  • 本地电脑做视频网站 外网连接网站怎么宣传
  • 网站建设方案云盘百度百科推广费用
  • 有什么网站做热图网店运营与管理
  • 公司门户网站怎么做seoul怎么读
  • 怎么做网站自动采集数据库网络舆情监测中心
  • 微信公众号里的网站怎么做的网站源码交易平台