summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2013-09-01 16:24:14 +0700
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-09-01 16:25:24 +0100
commitf9e4ad62d692f5b0afc1be62080012f93a73a386 (patch)
treeea472be03d768116d00915545a27f2505c669c48 /services
parent39e05c74197bf54ba89f025ae98bfa16387234f6 (diff)
downloadframeworks_base-f9e4ad62d692f5b0afc1be62080012f93a73a386.zip
frameworks_base-f9e4ad62d692f5b0afc1be62080012f93a73a386.tar.gz
frameworks_base-f9e4ad62d692f5b0afc1be62080012f93a73a386.tar.bz2
PackageManager: allow build-time disabling of components
Allow components to be specified as disabled at build time (applied on boot). This allows stock OTA components to be marked as disabled in CM builds. Change-Id: I6e4499cc40a779792a5ea97a10137399dad7d69f
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java15
1 files changed, 15 insertions, 0 deletions
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();