diff --git a/api/current.xml b/api/current.xml
index 9f79118728452..9248ccb4044e1 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2297,6 +2297,17 @@
visibility="public"
>
+
+
-
-
+
+
-
-
-
-
CREATOR
@@ -377,7 +368,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
manageSpaceActivityName = source.readString();
backupAgentName = source.readString();
descriptionRes = source.readInt();
- supportsDensities = source.createIntArray();
}
/**
@@ -408,7 +398,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*/
public void disableCompatibilityMode() {
flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
- FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS);
- supportsDensities = ANY_DENSITIES_ARRAY;
+ FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
+ FLAG_SUPPORTS_SCREEN_DENSITIES);
}
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 3250a8771e2cb..bca171591dd3a 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -164,12 +164,6 @@ public abstract class PackageManager {
*/
public static final int GET_CONFIGURATIONS = 0x00004000;
- /**
- * {@link ApplicationInfo} flag: return the
- * {@link ApplicationInfo#supportsDensities} that the package supports.
- */
- public static final int GET_SUPPORTS_DENSITIES = 0x00008000;
-
/**
* Resolution and querying flag: if set, only filters that support the
* {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 93ba9599be061..33f4b52e2f94a 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -675,6 +675,7 @@ public class PackageParser {
int supportsNormalScreens = 1;
int supportsLargeScreens = 1;
int resizeable = 1;
+ int anyDensity = 1;
int outerDepth = parser.getDepth();
while ((type=parser.next()) != parser.END_DOCUMENT
@@ -854,21 +855,6 @@ public class PackageParser {
XmlUtils.skipCurrentTag(parser);
- } else if (tagName.equals("supports-density")) {
- sa = res.obtainAttributes(attrs,
- com.android.internal.R.styleable.AndroidManifestSupportsDensity);
-
- int density = sa.getInteger(
- com.android.internal.R.styleable.AndroidManifestSupportsDensity_density, -1);
-
- sa.recycle();
-
- if (density != -1 && !pkg.supportsDensityList.contains(density)) {
- pkg.supportsDensityList.add(density);
- }
-
- XmlUtils.skipCurrentTag(parser);
-
} else if (tagName.equals("supports-screens")) {
sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestSupportsScreens);
@@ -887,6 +873,9 @@ public class PackageParser {
resizeable = sa.getInteger(
com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,
supportsLargeScreens);
+ anyDensity = sa.getInteger(
+ com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,
+ anyDensity);
sa.recycle();
@@ -962,7 +951,7 @@ public class PackageParser {
if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS;
}
if (supportsNormalScreens != 0) {
@@ -970,32 +959,19 @@ public class PackageParser {
}
if (supportsLargeScreens < 0 || (supportsLargeScreens > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
}
if (resizeable < 0 || (resizeable > 0
&& pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
+ >= android.os.Build.VERSION_CODES.DONUT)) {
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS;
}
- int densities[] = null;
- int size = pkg.supportsDensityList.size();
- if (size > 0) {
- densities = pkg.supportsDensities = new int[size];
- List densityList = pkg.supportsDensityList;
- for (int i = 0; i < size; i++) {
- densities[i] = densityList.get(i);
- }
+ if (anyDensity < 0 || (anyDensity > 0
+ && pkg.applicationInfo.targetSdkVersion
+ >= android.os.Build.VERSION_CODES.DONUT)) {
+ pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
}
- /**
- * TODO: enable this before code freeze. b/1967935
- * *
- if ((densities == null || densities.length == 0)
- && (pkg.applicationInfo.targetSdkVersion
- >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
- pkg.supportsDensities = ApplicationInfo.ANY_DENSITIES_ARRAY;
- }
- */
return pkg;
}
@@ -2446,9 +2422,6 @@ public class PackageParser {
// We store the application meta-data independently to avoid multiple unwanted references
public Bundle mAppMetaData = null;
- public final ArrayList supportsDensityList = new ArrayList();
- public int[] supportsDensities = null;
-
// If this is a 3rd party app, this is the path of the zip file.
public String mPath;
@@ -2630,10 +2603,6 @@ public class PackageParser {
&& p.usesLibraryFiles != null) {
return true;
}
- if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0
- && p.supportsDensities != null) {
- return true;
- }
return false;
}
@@ -2656,9 +2625,6 @@ public class PackageParser {
if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
ai.sharedLibraryFiles = p.usesLibraryFiles;
}
- if ((flags & PackageManager.GET_SUPPORTS_DENSITIES) != 0) {
- ai.supportsDensities = p.supportsDensities;
- }
if (!sCompatibilityModeEnabled) {
ai.disableCompatibilityMode();
}
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 517551ec8e149..e2abfd175a05b 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -131,41 +131,15 @@ public class CompatibilityInfo {
mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE;
}
- float packageDensityScale = -1.0f;
- int packageDensity = 0;
- if (appInfo.supportsDensities != null) {
- int minDiff = Integer.MAX_VALUE;
- for (int density : appInfo.supportsDensities) {
- if (density == ApplicationInfo.ANY_DENSITY) {
- packageDensity = DisplayMetrics.DENSITY_DEVICE;
- packageDensityScale = 1.0f;
- break;
- }
- int tmpDiff = Math.abs(DisplayMetrics.DENSITY_DEVICE - density);
- if (tmpDiff == 0) {
- packageDensity = DisplayMetrics.DENSITY_DEVICE;
- packageDensityScale = 1.0f;
- break;
- }
- // prefer higher density (appScale>1.0), unless that's only option.
- if (tmpDiff < minDiff && packageDensityScale < 1.0f) {
- packageDensity = density;
- packageDensityScale = DisplayMetrics.DENSITY_DEVICE / (float) density;
- minDiff = tmpDiff;
- }
- }
- }
- if (packageDensityScale > 0.0f) {
- applicationDensity = packageDensity;
- applicationScale = packageDensityScale;
+ if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
+ applicationDensity = DisplayMetrics.DENSITY_DEVICE;
+ applicationScale = 1.0f;
+ applicationInvertedScale = 1.0f;
} else {
applicationDensity = DisplayMetrics.DENSITY_DEFAULT;
- applicationScale =
- DisplayMetrics.DENSITY_DEVICE / (float) DisplayMetrics.DENSITY_DEFAULT;
- }
-
- applicationInvertedScale = 1.0f / applicationScale;
- if (applicationScale != 1.0f) {
+ applicationScale = DisplayMetrics.DENSITY_DEVICE
+ / (float) DisplayMetrics.DENSITY_DEFAULT;
+ applicationInvertedScale = 1.0f / applicationScale;
mCompatibilityFlags |= SCALING_REQUIRED;
}
}
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 75568e14507f1..48b565f598781 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -827,28 +827,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+