pkms-start-scan and install

start-scan:

@startuml
participant SystemServer as SS
participant PackageManagerService as PKMS
participant ParallelPackageParser as P_PP
participant PackageParser as PP

==PKMS START and scan apk==
SS -> SS: run
SS -> SS: startBootstrapServices
activate SS
SS -> PKMS : mPackageManagerService = PackageManagerService.main
activate PKMS 
PKMS -> PKMS: m = new PackageManagerService
	'construct call'
	activate PKMS #FF55FF
	==scan apk ==
	PKMS -> PKMS:scanDirTracedLI:dir
	loop for file in dir
		PKMS -> P_PP : parallelPackageParser.submit
		P_PP -> PP: PackageParser.Package pr = packageParser.parsePackage\n(scanFile, parseFlags, true) 
		
		alt if packageFile.isDirectory()
			PP -> PP: parsed = parseClusterPackage(packageFile, flags);
		else
			PP -> PP: parsed = parseMonolithicPackage(packageFile, flags);
			activate PP #FF55FF
			PP -> PP:parseBaseApk(apkFile, assets, flags)
			activate PP #FFFF55
				PP -> PP:parseBaseApkCommon
				PP->PP: parse the AndroidManifest.xml
			deactivate PP
			PP -> PP:return pkg;
			deactivate PP
		end
		PP->P_PP: return parsed
		
		P_PP -> P_PP:mQueue.put(pr)
		PKMS -> P_PP :ParallelPackageParser.ParseResult parseResult\n = parallelPackageParser.take
		note left
			get the parse result from the mQueue
		end note
		alt no error case
			PKMS -> PKMS: <b>scanPackageLI</b>(parseResult.pkg,parseResult.scanFile,```)
			activate PKMS #FFFF55
				PKMS -> PKMS:<b>scanPackageInternalLI</b>
				PKMS -> PKMS:check something about apk update
				PKMS -> PKMS:collectCertificatesLI
				note left
					verify the apk and collect certificates, 
					if verify ok: 
						collect certificates to Package.mCertificates
					if fail: 
						throw SignatureException/GeneralSecurityException/...
				end note
				PKMS -> PKMS:<b>scanPackageLI</b>(pkg, policyFlags,...)
				note left
					the another method of scanPackageLI
				end note
				PKMS -> PKMS:scanPackageDirtyLI
				alt if scanFlags & SCAN_CHECK_ONLY) != 0 
					
				else else: update this package info to <b>PKMS</b>
					PKMS -> PKMS:commitPackageSettings
					PKMS -> PKMS:<b>mPackages.put(pkg.applicationInfo.packageName, pkg)&
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值