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

Android 无签名系统 debug 版本APK push到设备引起的开机异常问题分析(zygote进程)

问题背景

前置操作:

替换原system/priv-app 目录下已有的应用包未未签名的debug版本,然后重启。

现象:

无法正常开机,卡在开机动画,并且pm没有起来,因为执行adb install 命令是返回“cmd: Can't find service: package”。

应用信息:

跟Settings系统应用在同一进程。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"coreApp="true"package="com.demo.unit"android:sharedUserId="android.uid.system"><uses-sdk android:minSdkVersion="28" />

日志分析

//按size值依次添加应用包

11-12 16:36:42.139  3310  3310 D PERF/BehaviorHuber: addPackage-> uid=10059, pkg=com.android.soundpicker, type=643777, size=143

11-12 16:36:42.140  3310  3310 D PERF/BehaviorHuber: addPackage-> uid=2000, pkg=com.android.shell, type=128001, size=144
11-12 16:36:42.144  3310  3310 D PERF/BehaviorHuber: addPackage-> uid=10078, pkg=com.google.android.tag, type=644995, size=146

很明显zygote进程都没跑起来

11-12 16:36:42.146  3310  3310 I PackageManager: /system/priv-app/DemoUnit changed; collecting certs
11-12 16:36:42.149  3310  3310 I Watchdog: Resuming HandlerChecker: main thread for reason: packagemanagermain. Pause count: 0
11-12 16:36:42.149  3310  3310 E System  : ******************************************
11-12 16:36:42.149  3310  3310 E System  : ************ Failure starting system services
11-12 16:36:42.149  3310  3310 E System  : java.lang.IllegalStateException: Signature mismatch on system package com.demo.unit for shared user SharedUserSetting{73b98d7 android.uid.system/1000}

11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.ReconcilePackageUtils.reconcilePackages(ReconcilePackageUtils.java:284)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.InstallPackageHelper.addForInitLI(InstallPackageHelper.java:3988)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.InstallPackageHelper.installPackagesFromDir(InstallPackageHelper.java:3797)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.InitAppsHelper.scanDirTracedLI(InitAppsHelper.java:463)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.InitAppsHelper.scanSystemDirs(InitAppsHelper.java:418)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.InitAppsHelper.initSystemApps(InitAppsHelper.java:209)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2362)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1806)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:1366)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.SystemServer.run(SystemServer.java:983)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.server.SystemServer.main(SystemServer.java:685)
11-12 16:36:42.149  3310  3310 E System  :     at java.lang.reflect.Method.invoke(Native Method)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
11-12 16:36:42.149  3310  3310 E System  :     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-12 16:36:42.149  3310  3310 V SystemServerTiming: StartPackageManagerService took to complete: 784ms
11-12 16:36:42.150  3310  3310 E Zygote  : System zygote died with fatal exception
11-12 16:36:42.150  3310  3310 E Zygote  : java.lang.IllegalStateException: Signature mismatch on system package com.demo.unit for shared user SharedUserSetting{73b98d7 android.uid.system/1000}
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.ReconcilePackageUtils.reconcilePackages(ReconcilePackageUtils.java:284)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.InstallPackageHelper.addForInitLI(InstallPackageHelper.java:3988)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.InstallPackageHelper.installPackagesFromDir(InstallPackageHelper.java:3797)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.InitAppsHelper.scanDirTracedLI(InitAppsHelper.java:463)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.InitAppsHelper.scanSystemDirs(InitAppsHelper.java:418)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.InitAppsHelper.initSystemApps(InitAppsHelper.java:209)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2362)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1806)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:1366)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.SystemServer.run(SystemServer.java:983)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.server.SystemServer.main(SystemServer.java:685)
11-12 16:36:42.150  3310  3310 E Zygote  :     at java.lang.reflect.Method.invoke(Native Method)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
11-12 16:36:42.150  3310  3310 E Zygote  :     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-12 16:36:42.150  3310  3310 D AndroidRuntime: Shutting down VM
--------- beginning of crash
11-12 16:36:42.150  3310  3310 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
11-12 16:36:42.150  3310  3310 E AndroidRuntime: java.lang.IllegalStateException: Signature mismatch on system package com.demo.unit for shared user SharedUserSetting{73b98d7 android.uid.system/1000}
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.ReconcilePackageUtils.reconcilePackages(ReconcilePackageUtils.java:284)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.InstallPackageHelper.addForInitLI(InstallPackageHelper.java:3988)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.InstallPackageHelper.installPackagesFromDir(InstallPackageHelper.java:3797)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.InitAppsHelper.scanDirTracedLI(InitAppsHelper.java:463)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.InitAppsHelper.scanSystemDirs(InitAppsHelper.java:418)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.InitAppsHelper.initSystemApps(InitAppsHelper.java:209)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:2362)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1806)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:1366)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.SystemServer.run(SystemServer.java:983)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.server.SystemServer.main(SystemServer.java:685)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
11-12 16:36:42.150  3310  3310 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
11-12 16:36:42.152  3310  3310 E AndroidRuntime: Error reporting crash
11-12 16:36:42.152  3310  3310 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'void android.app.IActivityManager.handleApplicationCrash(android.os.IBinder, android.app.ApplicationErrorReport$ParcelableCrashInfo)' on a null object reference
11-12 16:36:42.152  3310  3310 E AndroidRuntime:     at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:207)
11-12 16:36:42.152  3310  3310 E AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1071)
11-12 16:36:42.152  3310  3310 E AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1066)
11-12 16:36:42.152  3310  3310 E AndroidRuntime:     at java.lang.Thread.dispatchUncaughtException(Thread.java:2306)
11-12 16:36:42.152  3310  3310 I Process : Sending signal. PID: 3310 SIG: 9
11-12 16:36:42.188  3129  3129 E Zygote  : Zygote failed to write to system_server FD: Connection refused
11-12 16:36:42.188  3129  3129 I Zygote  : Process 3310 exited due to signal 9 (Killed)
11-12 16:36:42.188  3129  3129 W libc    : Access denied finding property "ro.vendor.iqi"
11-12 16:36:42.188  3129  3129 D Zygote  : IQI Zygote  false
11-12 16:36:42.188  3129  3129 E Zygote  : Exit zygote because system server (pid 3310) has terminated
11-12 16:36:42.229  3133  3133 D DeviceHAL: closeOutputStream mOpenedStreamsCount 5
11-12 16:36:42.229  3133  3142 D DeviceHAL: ~Device ++, doClose()
11-12 16:36:42.229  3133  3142 D DeviceHAL: doClose mIsClosed 0, mOpenedStreamsCount 0
11-12 16:36:42.229  3133  3133 D AudioALSAStreamManager: +closeOutputStream(), out = 0xb40000713de38100, mStreamOutVector.size() = 5
11-12 16:36:42.229  3133  3142 I r_submix: adev_close()
11-12 16:36:42.229  3133  3142 D DeviceHAL: ~Device --
11-12 16:36:42.229  3133  3141 D DeviceHAL: closeOutputStream mOpenedStreamsCount 5

参考资料

The Android Boot Processicon-default.png?t=O83Ahttps://copperhead.co/blog/android-boot-process/

 

What is the Android Boot Sequence
What is the Android Boot Sequence

1. Boot ROM code execution

2. The bootloader

3. The Linux kernel

4. The ‘Init’ process

5. Zygote and Dalvik VM

6. The System Server and Managers

 

Zygote launches the system services and forks a new process to launch.

System service
System service

 


http://www.mrgr.cn/news/75435.html

相关文章:

  • 大数据新视界 -- 大数据大厂之 Impala 存储格式转换:从原理到实践,开启大数据性能优化星际之旅(下)(20/30)
  • 雷池waf安装并部署防护站点
  • 时序预测 | 改进图卷积+informer时间序列预测,pytorch架构
  • FFmpeg 4.3 音视频-多路H265监控录放C++开发十三:将AVFrame转换成AVPacket。视频编码原理.编码相关api
  • Git - Think in Git
  • 云计算在教育领域的应用
  • 双十二有什么好物推荐?盘点2024年双十二最值得入手的好物!
  • P3372 【模板】线段树 1
  • 大模型重塑软件研发,从辅助编程到多 Agent 协同还有多远?
  • WSADATA 关键字详细介绍
  • 用EXCEL一列数据拼接SQL的where条件in语句
  • 使用Python实现智能食品储存管理的深度学习模型
  • 快速上手 Hugging Face Transformers:完整模型微调训练步骤全攻略
  • 历久弥新的c-Met:靶向疗法研究进展
  • 【route】route add命令详解
  • 去中心化应用(DApps)在Web3生态中的发展趋势
  • 大模型时代,呼叫中心的呼入机器人系统如何建设?
  • 【Visual Studio】使用VS调试(Debug)
  • APEX高性能减速机MG/MGH系列 高负载应用下的精准动力传输
  • 2024年11月14日
  • 如何有效的解决LabVIEW项目中的问题?
  • win11修改鼠标右键界面
  • 计算机组成原理之总线和输入/输出系统
  • 【Kafka】集成案例:与Spark大数据组件的协同应用
  • Springboot采用jasypt加密配置
  • 表达式求值问题(中缀转后缀,对后缀求值)详解