* Disable compatibility mode for all cases.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 0d00f21..28a77a5 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -399,7 +399,8 @@
* @hide
*/
public void disableCompatibilityMode() {
- flags |= FLAG_SUPPORTS_LARGE_SCREENS;
+ flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
+ FLAG_SUPPORTS_SMALL_SCREENS);
supportsDensities = ANY_DENSITIES_ARRAY;
}
}
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index cebb696..39c27aa9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -92,6 +92,8 @@
private static final Object mSync = new Object();
private static WeakReference<byte[]> mReadBuffer;
+ private static boolean sCompatibilityModeEnabled = true;
+
static class ParsePackageItemArgs {
final Package owner;
final String[] outError;
@@ -2629,6 +2631,11 @@
public static ApplicationInfo generateApplicationInfo(Package p, int flags) {
if (p == null) return null;
if (!copyNeeded(flags, p, null)) {
+ // CompatibilityMode is global state. It's safe to modify the instance
+ // of the package.
+ if (!sCompatibilityModeEnabled) {
+ p.applicationInfo.disableCompatibilityMode();
+ }
return p.applicationInfo;
}
@@ -2643,6 +2650,9 @@
if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0) {
ai.supportsDensities = p.supportsDensities;
}
+ if (!sCompatibilityModeEnabled) {
+ ai.disableCompatibilityMode();
+ }
return ai;
}
@@ -2827,4 +2837,11 @@
+ " " + service.info.name + "}";
}
}
+
+ /**
+ * @hide
+ */
+ public static void setCompatibilityModeEnabled(boolean compatibilityModeEnabled) {
+ sCompatibilityModeEnabled = compatibilityModeEnabled;
+ }
}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index d8dafb6..143c7d5 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -262,7 +262,6 @@
final ResolveInfo mResolveInfo = new ResolveInfo();
ComponentName mResolveComponentName;
PackageParser.Package mPlatformPackage;
- private boolean mCompatibilityModeEnabled = true;
public static final IPackageManager main(Context context, boolean factoryTest) {
PackageManagerService m = new PackageManagerService(context, factoryTest);
@@ -765,7 +764,7 @@
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
if (Config.LOGV) Log.v(
- TAG, "getApplicationInfo " + packageName
+ TAG, "getPackageInfo " + packageName
+ ": " + p);
if (p != null) {
return generatePackageInfo(p, flags);
@@ -796,7 +795,7 @@
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
if (Config.LOGV) Log.v(
- TAG, "getApplicationInfo " + packageName
+ TAG, "getPackageGids" + packageName
+ ": " + p);
if (p != null) {
final PackageSetting ps = (PackageSetting)p.mExtras;
@@ -894,11 +893,7 @@
+ ": " + p);
if (p != null) {
// Note: isEnabledLP() does not apply here - always return info
- ApplicationInfo appInfo = PackageParser.generateApplicationInfo(p, flags);
- if (!mCompatibilityModeEnabled) {
- appInfo.disableCompatibilityMode();
- }
- return appInfo;
+ return PackageParser.generateApplicationInfo(p, flags);
}
if ("android".equals(packageName)||"system".equals(packageName)) {
return mAndroidApplication;
@@ -4817,11 +4812,12 @@
mSystemReady = true;
// Read the compatibilty setting when the system is ready.
- mCompatibilityModeEnabled = android.provider.Settings.System.getInt(
+ boolean compatibilityModeEnabled = android.provider.Settings.System.getInt(
mContext.getContentResolver(),
android.provider.Settings.System.COMPATIBILITY_MODE, 1) == 1;
+ PackageParser.setCompatibilityModeEnabled(compatibilityModeEnabled);
if (DEBUG_SETTINGS) {
- Log.d(TAG, "compatibility mode:" + mCompatibilityModeEnabled);
+ Log.d(TAG, "compatibility mode:" + compatibilityModeEnabled);
}
}