多个PackageInstaller导致无法开机

出错信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
09-11 15:25:48.414   858   858 E System  : ******************************************
09-11 15:25:48.414 858 858 E System : ************ Failure starting system services
09-11 15:25:48.414 858 858 E System : java.lang.RuntimeException: There must be exactly one installer; found [ResolveInfo{4f7a3fa com.android.packageinstaller/.InstallStart m=0x608000}, ResolveInfo{ec32dab com.google.android.packageinstaller/com.android.packageinstaller.InstallStart m=0x608000}]
09-11 15:25:48.414 858 858 E System : at com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:3538)
09-11 15:25:48.414 858 858 E System : at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:3189)
09-11 15:25:48.414 858 858 E System : at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:2310)
09-11 15:25:48.414 858 858 E System : at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:628)
09-11 15:25:48.414 858 858 E System : at com.android.server.SystemServer.run(SystemServer.java:429)
09-11 15:25:48.414 858 858 E System : at com.android.server.SystemServer.main(SystemServer.java:294)
09-11 15:25:48.414 858 858 E System : at java.lang.reflect.Method.invoke(Native Method)
09-11 15:25:48.414 858 858 E System : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
09-11 15:25:48.414 858 858 E System : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
09-11 15:25:48.414 858 858 D SystemServerTiming: StartPackageManagerService took to complete: 682ms
09-11 15:25:48.414 858 858 E Zygote : System zygote died with exception
09-11 15:25:48.414 858 858 E Zygote : java.lang.RuntimeException: There must be exactly one installer; found [ResolveInfo{4f7a3fa com.android.packageinstaller/.InstallStart m=0x608000}, ResolveInfo{ec32dab com.google.android.packageinstaller/com.android.packageinstaller.InstallStart m=0x608000}]
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:3538)
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.pm.PackageManagerService.<init>(PackageManagerService.java:3189)
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.pm.PackageManagerService.main(PackageManagerService.java:2310)
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.SystemServer.startBootstrapServices(SystemServer.java:628)
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.SystemServer.run(SystemServer.java:429)
09-11 15:25:48.414 858 858 E Zygote : at com.android.server.SystemServer.main(SystemServer.java:294)
09-11 15:25:48.414 858 858 E Zygote : at java.lang.reflect.Method.invoke(Native Method)
09-11 15:25:48.414 858 858 E Zygote : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
09-11 15:25:48.414 858 858 E Zygote : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
09-11 15:25:48.414 858 858 D AndroidRuntime: Shutting down VM
--------- beginning of crash

对应PKMS代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private @NonNull String getRequiredInstallerLPr() {
final Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setDataAndType(Uri.fromFile(new File("foo.apk")), PACKAGE_MIME_TYPE);

final List<ResolveInfo> matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE,
MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE,
UserHandle.USER_SYSTEM);
if (matches.size() == 1) {
ResolveInfo resolveInfo = matches.get(0);
if (!resolveInfo.activityInfo.applicationInfo.isPrivilegedApp()) {
throw new RuntimeException("The installer must be a privileged app");
}
return matches.get(0).getComponentInfo().packageName;
} else {
throw new RuntimeException("There must be exactly one installer; found " + matches);
}
}

对应SystemServer代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
try {
traceBeginAndSlog("StartServices");
startBootstrapServices();
startCoreServices();
startOtherServices();
SystemServerInitThreadPool.shutdown();
} catch (Throwable ex) {
Slog.e("System", "******************************************");
Slog.e("System", "************ Failure starting system services", ex);
throw ex;
} finally {
traceEnd();
}

Powered by Hexo and Hexo-theme-hiker

Copyright © 2018 - 2022 得一 All Rights Reserved.

访客数 : | 访问量 :