summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-08-20 12:29:14 -0700
committerd34d <clark@cyngn.com>2015-10-27 18:23:59 -0700
commit25d58dfed52ca96e11cf879d7d9f99eb34e14037 (patch)
tree8051fe362c6edeb758eeb145d7dfcb8c5a15994e /core/java/android/content/pm
parente05ffea4ea55a4eb6b40436a864a570509eb33ac (diff)
downloadframeworks_base-25d58dfed52ca96e11cf879d7d9f99eb34e14037.zip
frameworks_base-25d58dfed52ca96e11cf879d7d9f99eb34e14037.tar.gz
frameworks_base-25d58dfed52ca96e11cf879d7d9f99eb34e14037.tar.bz2
Themes: Allow packages to be set as non-themeable
This patch allows for specific packages to be declared as non themeable. Packages that are non themeable will not have theme resources attached to their assets when their Resources object is created. This patch also removes isThemeable from CompatibilityInfo as this object did not correctly reflect that the package is not themeable. Change-Id: Id34c63ec0c3ef7c69df083da63559e0720ce0018
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/PackageParser.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 7653c39..b4af2c9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2582,8 +2582,9 @@ public class PackageParser {
final ApplicationInfo ai = owner.applicationInfo;
final String pkgName = owner.applicationInfo.packageName;
- // assume that this package is themeable unless explicitly set to false.
- ai.isThemeable = true;
+ String[] nonThemeablePackages =
+ res.getStringArray(com.android.internal.R.array.non_themeable_packages);
+ ai.isThemeable = isPackageThemeable(pkgName, nonThemeablePackages);
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestApplication);
@@ -4443,6 +4444,22 @@ public class PackageParser {
return true;
}
+ /**1
+ * Returns whether the specified package is themeable
+ * @param packageName Name of package to check
+ * @param nonThemeablePackages Array of packages that are declared as non-themeable
+ * @return True if the package is themeable, false otherwise
+ */
+ private static boolean isPackageThemeable(String packageName, String[] nonThemeablePackages) {
+ for (String pkg : nonThemeablePackages) {
+ if (packageName.startsWith(pkg)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
/**
* Representation of a full package parsed from APK files on disk. A package
* consists of a single base APK, and zero or more split APKs.