diff options
-rw-r--r-- | core/res/res/values/config.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 3 | ||||
-rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 15 |
3 files changed, 22 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 20b1a56..f12b54c 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1150,4 +1150,8 @@ <!-- True if the pie service should be started at system start. This is must be true to support pie controls. --> <bool name="config_allowPieService">true</bool> + + <!-- The list of components which should be automatically disabled. --> + <string-array name="config_disabledComponents" translatable="false"> + </string-array> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ef66ddd..2a05c40 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2014,4 +2014,7 @@ <java-symbol type="string" name="privacy_guard_notification" /> <java-symbol type="string" name="privacy_guard_notification_detail" /> <java-symbol type="drawable" name="stat_notify_privacy_guard" /> + + <!-- Package Manager --> + <java-symbol type="array" name="config_disabledComponents" /> </resources> diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 0c09a7e..41e68f8 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -1323,6 +1323,21 @@ public class PackageManagerService extends IPackageManager.Stub { ? (UPDATE_PERMISSIONS_REPLACE_PKG|UPDATE_PERMISSIONS_REPLACE_ALL) : 0)); + // Disable components marked for disabling at build-time + for (String name : mContext.getResources().getStringArray( + com.android.internal.R.array.config_disabledComponents)) { + ComponentName cn = ComponentName.unflattenFromString(name); + Slog.v(TAG, "Disabling " + name); + String className = cn.getClassName(); + PackageSetting pkgSetting = mSettings.mPackages.get(cn.getPackageName()); + if (pkgSetting == null || pkgSetting.pkg == null + || !pkgSetting.pkg.hasComponentClassName(className)) { + Slog.w(TAG, "Unable to disable " + name); + continue; + } + pkgSetting.disableComponentLPw(className, UserHandle.USER_OWNER); + } + // can downgrade to reader mSettings.writeLPr(); |