PackageManagerService是Android系统核心服务之一,在Android中的非常重要,主要负责的功能如下:
1.解析 AndroidManifest.xml,主要包括AndroidManifest中节点信息的解析和target-name的分析和提炼
2.扫描本地文件,主要针对apk,主要是系统应用、本地安装应用等等。这部分会在下面仔细讲解。
3.管理本地apk,主要包括安装、删除等等。
PackageManagerService简称为PKMS。可以参考这个大佬的博客 https://blog.youkuaiyun.com/yiranfeng/article/details/103941371
在pkms中加载修改如下:
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 56b378b..e7d4ebf 100755
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1022,6 +1022,9 @@
private PerUidReadTimeouts[] mPerUidReadTimeoutsCache;
private static final PerUidReadTimeouts[] EMPTY_PER_UID_READ_TIMEOUTS_ARRAY = {};
+ // Feature: OneImage for wifi. [BEGIN]
+ final private ArrayList<String> mOneSoftwareExcludedApps = new ArrayList<String>();
+ // Feature: OneImage for wifi. [END]
/**
* Unit tests will instantiate, extend and/or mock to mock dependencies / behaviors.
@@ -7598,7 +7601,10 @@
if (!mOnlyCore && mFirstBoot) {
requestCopyPreoptedFiles(mInjector);
}
-
+ // Feature: OneImage for wifi. [BEGIN]
+ // Load one software excluded app list
+ loadOneSoftwareExcludedApplist();//加载客户要求过滤的不安装的apk
+ // Feature: OneImage for wifi. [END]
String customResolverActivityName = Resources.getSystem().getString(
R.string.config_customResolverActivity);
if (!TextUtils.isEmpty(customResolverActivityName)) {
@@ -12081,7 +12087,14 @@
if (!isPackage) {
// Ignore entries which are not packages
continue;
}
+ // Feature: OneImage for wifi. [BEGIN]
+ // Exclude app list from one software configure
+ if (isOneSoftwareExcludedApp(file.getName())) { //系统跳过不需要加载的apk
+ Log.d(TAG, " ===== ok One Software Excluded:" + file.getName());
+ continue;
+ }
&#