有人能解释或指出我可以阅读Android应用程序升级实际上是如何在操作系统层面上工作的资源吗?
wnvonmuf1#
从软件包管理器日志来看,似乎采取了以下步骤进行升级:1)在临时位置下载程序包。act=android.意图.操作.包_需要_验证数据=文件:///数据/应用程序/vmdl1854135520.tmp类型=应用程序/vnd.android.包-存档2)进行 Package 验证。06-30 17:59:02.751 3701 3751 D Package 经理:[MSG] Package _已验证:观察员{237546897}3)重命名包。06-30 17:59:03.361 3701 3751 D Package 经理:将/数据/应用程序/vmdl1854135520.tmp重命名为/数据/应用程序/com.vzw.hss.myverizon-14)终止现有应用程序06-30 17:59:03.361 3701 3751 D Package 经理:!@ kill应用程序:10031,更换系统 Package5)Dexopt的APK06-30 17:59:03.381 3701 3751 D Package 经理:运行dexopt:/数据/应用程序/com.vzw.hss.myverizon-1/基础.apk Package =com.vzw.hss.myverizon伊萨= arm 64 vmSafeMode=假仅解释=假
**06-30 17:59:02.741 3701 3751 D PackageManager: [VERIFY] Found 1 verifiers for intent Intent { act=android.intent.action.PACKAGE_NEEDS_VERIFICATION dat=file:///data/app/vmdl1854135520.tmp** typ=application/vnd.android.package-archive flg=0x10000001 } with 0 optional verifiers 06-30 17:59:02.741 3701 3751 D PackageManager: [VERIFY] sendOrderedBroadcastToRequiredVerifier: 06-30 17:59:02.741 3701 3751 D PackageManager: PackageVerificationState{ 06-30 17:59:02.741 3701 3751 D PackageManager: verifier packages=com.android.vending(10034), 06-30 17:59:02.741 3701 3751 D PackageManager: intent=Intent { act=android.intent.action.PACKAGE_NEEDS_VERIFICATION dat=file:///data/app/vmdl1854135520.tmp typ=application/vnd.android.package-archive flg=0x10000001 (has extras) } 06-30 17:59:02.741 3701 3751 D PackageManager: others=28, false, false, false, false, false 06-30 17:59:02.741 3701 3751 D PackageManager: } 06-30 17:59:02.741 3701 3751 D PackageManager: remove MCS_UNBIND message and Posting MCS_UNBIND 10 secs later 06-30 17:59:02.751 3701 3701 D PackageManager: [VERIFY] onReceive for RequiredVerifier id=28 06-30 17:59:02.751 3701 3701 D PackageManager: [VERIFY] send delayed message for CHECK_PENDING_VERIFICATION after : 10000 06-30 17:59:02.751 3701 4589 D PackageManager: [VERIFY] verifyPendingInstall(28, VERIFICATION_ALLOW), uid=10034 06-30 17:59:02.751 3701 3751 D PackageManager: [MSG] PACKAGE_VERIFIED: observer{237546897} 06-30 17:59:02.751 3701 3751 D PackageManager: [VERIFY] PACKAGE_VERIFIED: 06-30 17:59:02.751 3701 3751 D PackageManager: PackageVerificationState{ 06-30 17:59:02.751 3701 3751 D PackageManager: verifier packages=com.android.vending(10034), 06-30 17:59:02.751 3701 3751 D PackageManager: intent=Intent { act=android.intent.action.PACKAGE_NEEDS_VERIFICATION dat=file:///data/app/vmdl1854135520.tmp typ=application/vnd.android.package-archive flg=0x10000001 cmp=com.android.vending/com.google.android.vending.verifier.PackageVerificationReceiver (has extras) } 06-30 17:59:02.751 3701 3751 D PackageManager: others=28, false, false, false, false, false 06-30 17:59:02.751 3701 3751 D PackageManager: } 06-30 17:59:02.751 3701 3751 D PackageManager: [VERIFY] broadcastPackageVerified(28, VERIFICATION_ALLOW, file:///data/app/vmdl1854135520.tmp) 06-30 17:59:02.761 3701 3751 D PackageManager: /data/app/vmdl1854135520.tmp already staged; skipping copy 06-30 17:59:02.761 3701 3751 D PackageManager: remove MCS_UNBIND and Posting MCS_UNBIND 06-30 17:59:02.761 3701 3751 D PackageManager: [MSG] PROCESS_PENDING_INSTALL: observer{237546897} 06-30 17:59:02.761 3701 3751 D PackageManager: currentStatus{1} 06-30 17:59:02.761 3701 3751 D PackageManager: installPackageLI: path 06-30 17:59:03.321 3701 3751 W PackageManager: verifying app can be installed or not **06-30 17:59:03.361 3701 3751 D PackageManager: Renaming /data/app/vmdl1854135520.tmp to /data/app/com.vzw.hss.myverizon-1** **06-30 17:59:03.361 3701 3751 D PackageManager: replacePackageLI** **06-30 17:59:03.361 3701 3751 D PackageManager: !@killApplicatoin: 10031, replace sys pkg** 06-30 17:59:03.371 3701 3751 W PackageManager: Trying to update system app code path from /system/priv-app/MyVerizon to /data/app/com.vzw.hss.myverizon-1 06-30 17:59:03.371 3701 3751 I PackageManager: scanFileNewer : com.vzw.hss.myverizon **06-30 17:59:03.381 3701 3751 D PackageManager: Running dexopt on: /data/app/com.vzw.hss.myverizon-1/base.apk pkg=com.vzw.hss.myverizon isa=arm64 vmSafeMode=false interpret_only=false** 06-30 17:59:06.861 3701 3751 I PackageManager: do mInstaller.dexopt : 0 06-30 17:59:06.861 3701 3751 D PackageManager: Time to dexopt: 3.482 seconds 06-30 17:59:06.861 3701 3751 D PackageManager: !@killApplicatoin: 10031, update pkg 06-30 17:59:06.861 3701 3751 W PackageManager: Code path for pkg : com.vzw.hss.myverizon changing from /system/priv-app/MyVerizon to /data/app/com.vzw.hss.myverizon-1 06-30 17:59:06.861 3701 3751 W PackageManager: Resource path for pkg : com.vzw.hss.myverizon changing from /system/priv-app/MyVerizon to /data/app/com.vzw.hss.myverizon-1 06-30 17:59:06.961 3701 3751 D PackageManager: New package installed 06-30 17:59:06.971 3701 3751 I PackageManager: Un-granting permission android.permission.sec.ENTERPRISE_DEVICE_ADMIN from package com.samsung.mdmtest1 (protectionLevel=2 flags=0x89be44) 06-30 17:59:06.971 3701 3751 I PackageManager: Un-granting permission com.sec.enterprise.knox.permission.KNOX_ENTERPRISE_BILLING from package com.samsung.mdmtest1 (protectionLevel=2 flags=0x89be44) 06-30 17:59:07.141 3701 3751 D PackageManager: doPostInstall for uid{10031} 06-30 17:59:07.151 3701 3751 D PackageManager: [MSG] MCS_UNBIND 06-30 17:59:07.151 3701 3751 D PackageManager: [MSG] POST_INSTALL: observer{237546897} 06-30 17:59:07.151 3701 3751 D PackageManager: Handling post-install for 29 06-30 17:59:07.661 3701 3751 D PackageManager: result of install: 1{237546897}
s5a0g9ez2#
我找不到一个好的资源,但这里是我对这个过程的理解。APK在安装时会存储在手机的私人目录中。升级时,会从存储中下载新APK,然后用新APK替换旧APK。新的AndroidManifest会像新安装一样进行解析和安装,并检查版本、签名密钥、和等等,以确保升级是允许的。实际的应用程序数据存储在一个单独的位置,在升级过程中不会被触及。如果您更改了数据库架构或其他内容,您将需要在首次启动时迁移数据。
z0qdvdin3#
我不知道你是不是在找这个,但我能找到的最好的就是这个。软件包管理器API负责管理APK文件的安装、卸载和升级。它使用“uri”、“installFlags”、“observer”和“InstallPackageName”参数调用方法“InstallPackage”,然后启动名为“package”的服务,该服务将实际安装/升级它。程序包管理器服务在system_server进程中运行,安装守护进程(installd)作为本机进程运行。两者都在系统 Boot 时启动。流程概述:
软件包管理器将应用程序信息存储在位于/data/system中的三个文件中:
程序包管理器https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/Settings.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PackageManagerService.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/IPackageManager.aidlhttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PackageSignatures.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PreferredActivity.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/PreferredComponent.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/IntentFilter.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/PackageParser.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/IPackageManager.aidlhttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/Installer.javahttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/com/android/internal/app/IMediaContainerService.aidlhttps://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
程序包安装程序
https://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/PackageInstallerActivity.javahttps://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/PackageUtil.javahttps://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/InstallAppProgress.java
3条答案
按热度按时间wnvonmuf1#
从软件包管理器日志来看,似乎采取了以下步骤进行升级:
1)在临时位置下载程序包。
act=android.意图.操作.包_需要_验证数据=文件:///数据/应用程序/vmdl1854135520.tmp类型=应用程序/vnd.android.包-存档
2)进行 Package 验证。
06-30 17:59:02.751 3701 3751 D Package 经理:[MSG] Package _已验证:观察员{237546897}
3)重命名包。
06-30 17:59:03.361 3701 3751 D Package 经理:将/数据/应用程序/vmdl1854135520.tmp重命名为/数据/应用程序/com.vzw.hss.myverizon-1
4)终止现有应用程序
06-30 17:59:03.361 3701 3751 D Package 经理:!@ kill应用程序:10031,更换系统 Package
5)Dexopt的APK
06-30 17:59:03.381 3701 3751 D Package 经理:运行dexopt:/数据/应用程序/com.vzw.hss.myverizon-1/基础.apk Package =com.vzw.hss.myverizon伊萨= arm 64 vmSafeMode=假仅解释=假
s5a0g9ez2#
我找不到一个好的资源,但这里是我对这个过程的理解。
APK在安装时会存储在手机的私人目录中。升级时,会从存储中下载新APK,然后用新APK替换旧APK。新的AndroidManifest会像新安装一样进行解析和安装,并检查版本、签名密钥、和等等,以确保升级是允许的。实际的应用程序数据存储在一个单独的位置,在升级过程中不会被触及。如果您更改了数据库架构或其他内容,您将需要在首次启动时迁移数据。
z0qdvdin3#
来源:http://java.dzone.com/articles/depth-android-package-manager
我不知道你是不是在找这个,但我能找到的最好的就是这个。
软件包管理器API负责管理APK文件的安装、卸载和升级。
它使用“uri”、“installFlags”、“observer”和“InstallPackageName”参数调用方法“InstallPackage”,然后启动名为“package”的服务,该服务将实际安装/升级它。
程序包管理器服务在system_server进程中运行,安装守护进程(installd)作为本机进程运行。两者都在系统 Boot 时启动。
流程概述:
软件包管理器将应用程序信息存储在位于/data/system中的三个文件中:
包管理器(和包安装程序)的相关源代码链接如下:
程序包管理器https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/Settings.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PackageManagerService.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/IPackageManager.aidl
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PackageSignatures.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/PreferredActivity.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/PreferredComponent.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/IntentFilter.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/PackageParser.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/android/content/pm/IPackageManager.aidl
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/services/java/com/android/server/pm/Installer.java
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/core/java/com/android/internal/app/IMediaContainerService.aidl
https://android.googlesource.com/platform/frameworks/base/+/483f3b06ea84440a082e21b68ec2c2e54046f5a6/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
程序包安装程序
https://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/PackageInstallerActivity.java
https://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/PackageUtil.java
https://android.googlesource.com/platform/packages/apps/PackageInstaller/+/47fe118e0178e9d72c98073ff588ee5cf353258e/src/com/android/packageinstaller/InstallAppProgress.java