Merge change 8036 into donut
* changes: * Disable compatibility mode for all cases.
This commit is contained in:
@@ -399,7 +399,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ public class PackageParser {
|
||||
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 class PackageParser {
|
||||
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 @@ public class PackageParser {
|
||||
if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0) {
|
||||
ai.supportsDensities = p.supportsDensities;
|
||||
}
|
||||
if (!sCompatibilityModeEnabled) {
|
||||
ai.disableCompatibilityMode();
|
||||
}
|
||||
return ai;
|
||||
}
|
||||
|
||||
@@ -2827,4 +2837,11 @@ public class PackageParser {
|
||||
+ " " + service.info.name + "}";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static void setCompatibilityModeEnabled(boolean compatibilityModeEnabled) {
|
||||
sCompatibilityModeEnabled = compatibilityModeEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,6 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
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 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
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 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
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 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
+ ": " + 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 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user