summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-01-16 12:45:07 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-16 12:45:07 -0800
commitc237bb2776facbfd3325ef23865fd7f6ced67f17 (patch)
tree7eeb2a5d5cc1f14331af68e491c635a6d4f3c5a7 /core/java
parent598913a6ba733da911a547e29fb21c6fea3aef3d (diff)
parent3b81bc18bb661c02ad8074c39dab16644c1e65d0 (diff)
Merge "Add manifest API to request a large heap." into honeycomb
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityManager.java3
-rw-r--r--core/java/android/app/ActivityThread.java7
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java16
-rw-r--r--core/java/android/content/pm/PackageParser.java15
-rwxr-xr-xcore/java/android/content/res/Resources.java8
-rw-r--r--core/java/android/os/Build.java9
6 files changed, 36 insertions, 22 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 44db50fa974b..4eae14bce98c 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -77,6 +77,9 @@ public class ActivityManager {
* This may be the same size as {@link #getMemoryClass()} on memory
* constrained devices, or it may be significantly larger on devices with
* a large amount of available RAM.
+ *
+ * <p>The is the size of the application's Dalvik heap if it has
+ * specified <code>android:largeHeap="true"</code> in its manifest.
*/
public int getLargeMemoryClass() {
return staticGetLargeMemoryClass();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index cc94aa08c2d7..db046ef73597 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -45,7 +45,6 @@ import android.graphics.Canvas;
import android.net.IConnectivityManager;
import android.net.Proxy;
import android.net.ProxyProperties;
-import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
@@ -3463,6 +3462,10 @@ public final class ActivityThread {
mInstrumentation = new Instrumentation();
}
+ if ((data.appInfo.flags&ApplicationInfo.FLAG_LARGE_HEAP) != 0) {
+ // XXX bump up Dalvik's heap.
+ }
+
// If the app is being launched for full backup or restore, bring it up in
// a restricted environment with the base application class.
Application app = data.info.makeApplication(data.restrictedBackupMode, null);
@@ -3471,7 +3474,7 @@ public final class ActivityThread {
List<ProviderInfo> providers = data.providers;
if (providers != null) {
installContentProviders(app, providers);
- // For process that contain content providers, we want to
+ // For process that contains content providers, we want to
// ensure that the JIT is enabled "at some point".
mH.sendEmptyMessageDelayed(H.ENABLE_JIT, 10*1000);
}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index bb0ed6af77da..17131d213f70 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -270,14 +270,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
/**
- * Value for {@link #flags}: this is true if the application has set
- * its android:neverEncrypt to true, false otherwise. It is used to specify
- * that this package specifically "opts-out" of a secured file system solution,
- * and will always store its data in-the-clear.
- *
- * {@hide}
+ * Value for {@link #flags}: true when the application has requested a
+ * large heap for its processes. Corresponds to
+ * {@link android.R.styleable#AndroidManifestApplication_largeHeap
+ * android:largeHeap}.
*/
- public static final int FLAG_NEVER_ENCRYPT = 1<<30;
+ public static final int FLAG_LARGE_HEAP = 1<<20;
/**
* Value for {@link #flags}: Set to true if the application has been
@@ -285,7 +283,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*
* {@hide}
*/
- public static final int FLAG_FORWARD_LOCK = 1<<29;
+ public static final int FLAG_FORWARD_LOCK = 1<<30;
/**
* Value for {@link #flags}: set to <code>true</code> if the application
@@ -298,7 +296,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
*
* {@hide}
*/
- public static final int FLAG_CANT_SAVE_STATE = 1<<27;
+ public static final int FLAG_CANT_SAVE_STATE = 1<<29;
/**
* Flags associated with the application. Any combination of
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index b2937babef0b..7676258b4659 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -389,11 +389,15 @@ public class PackageParser {
XmlResourceParser parser = null;
AssetManager assmgr = null;
+ Resources res = null;
boolean assetError = true;
try {
assmgr = new AssetManager();
int cookie = assmgr.addAssetPath(mArchiveSourcePath);
- if(cookie != 0) {
+ if (cookie != 0) {
+ res = new Resources(assmgr, metrics, null);
+ assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ Build.VERSION.RESOURCES_SDK_INT);
parser = assmgr.openXmlResourceParser(cookie, "AndroidManifest.xml");
assetError = false;
} else {
@@ -403,7 +407,7 @@ public class PackageParser {
Log.w(TAG, "Unable to read AndroidManifest.xml of "
+ mArchiveSourcePath, e);
}
- if(assetError) {
+ if (assetError) {
if (assmgr != null) assmgr.close();
mParseError = PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
return null;
@@ -413,7 +417,6 @@ public class PackageParser {
Exception errorException = null;
try {
// XXXX todo: need to figure out correct configuration.
- Resources res = new Resources(assmgr, metrics, null);
pkg = parsePackage(res, parser, flags, errorText);
} catch (Exception e) {
errorException = e;
@@ -593,6 +596,8 @@ public class PackageParser {
AssetManager assmgr = null;
try {
assmgr = new AssetManager();
+ assmgr.setConfiguration(0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ Build.VERSION.RESOURCES_SDK_INT);
int cookie = assmgr.addAssetPath(packageFilePath);
parser = assmgr.openXmlResourceParser(cookie, "AndroidManifest.xml");
} catch (Exception e) {
@@ -1574,9 +1579,9 @@ public class PackageParser {
}
if (sa.getBoolean(
- com.android.internal.R.styleable.AndroidManifestApplication_neverEncrypt,
+ com.android.internal.R.styleable.AndroidManifestApplication_largeHeap,
false)) {
- ai.flags |= ApplicationInfo.FLAG_NEVER_ENCRYPT;
+ ai.flags |= ApplicationInfo.FLAG_LARGE_HEAP;
}
String str;
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index b40a22648be1..29bb004cf0ac 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -56,10 +56,6 @@ public class Resources {
private static final int ID_OTHER = 0x01000004;
- // Use the current SDK version code. If we are a development build,
- // also allow the previous SDK version + 1.
- private static final int sSdkVersion = Build.VERSION.SDK_INT
- + ("REL".equals(Build.VERSION.CODENAME) ? 0 : 1);
private static final Object mSync = new Object();
private static Resources mSystem = null;
@@ -1427,14 +1423,14 @@ public class Resources {
mConfiguration.touchscreen,
(int)(mMetrics.density*160), mConfiguration.keyboard,
keyboardHidden, mConfiguration.navigation, width, height,
- mConfiguration.screenLayout, mConfiguration.uiMode, sSdkVersion);
+ mConfiguration.screenLayout, mConfiguration.uiMode,
+ Build.VERSION.RESOURCES_SDK_INT);
clearDrawableCache(mDrawableCache, configChanges);
clearDrawableCache(mColorDrawableCache, configChanges);
mColorStateListCache.clear();
-
flushLayoutCache();
}
synchronized (mSync) {
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 6e50e97ae996..af7b28b416e2 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -100,6 +100,15 @@ public class Build {
* a release build.
*/
public static final String CODENAME = getString("ro.build.version.codename");
+
+ /**
+ * The SDK version to use when accessing resources.
+ * Use the current SDK version code. If we are a development build,
+ * also allow the previous SDK version + 1.
+ * @hide
+ */
+ public static final int RESOURCES_SDK_INT = SDK_INT
+ + ("REL".equals(CODENAME) ? 0 : 1);
}
/**