From 65b345fa22b878e141b8fd8ece9c208df00fa40f Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 27 Jul 2011 18:51:50 -0700 Subject: Reclaim more memory, more often. Yay. Change-Id: I04557ad575c307a55088549f48f0e9ad994b7275 --- core/java/android/app/ActivityThread.java | 120 ++++++++++++++++-------------- 1 file changed, 64 insertions(+), 56 deletions(-) (limited to 'core/java/android/app') diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 9bbbd6c..1e93f88 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -123,7 +123,6 @@ public final class ActivityThread { /** @hide */ public static final String TAG = "ActivityThread"; private static final android.graphics.Bitmap.Config THUMBNAIL_FORMAT = Bitmap.Config.RGB_565; - private static final boolean DEBUG = false; static final boolean localLOGV = false; static final boolean DEBUG_MESSAGES = false; /** @hide */ @@ -163,7 +162,7 @@ public final class ActivityThread { = new ArrayList(); // set of instantiated backup agents, keyed by package name final HashMap mBackupAgents = new HashMap(); - static final ThreadLocal sThreadLocal = new ThreadLocal(); + static final ThreadLocal sThreadLocal = new ThreadLocal(); Instrumentation mInstrumentation; String mInstrumentationAppDir = null; String mInstrumentationAppPackage = null; @@ -410,9 +409,9 @@ public final class ActivityThread { CompatibilityInfo info; } - native private void dumpGraphicsInfo(FileDescriptor fd); + private native void dumpGraphicsInfo(FileDescriptor fd); - private final class ApplicationThread extends ApplicationThreadNative { + private class ApplicationThread extends ApplicationThreadNative { private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s"; private static final String ONE_COUNT_COLUMN = "%21s %8d"; private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d"; @@ -734,13 +733,13 @@ public final class ActivityThread { FileOutputStream fout = new FileOutputStream(fd); PrintWriter pw = new PrintWriter(fout); try { - return dumpMemInfo(fd, pw, args); + return dumpMemInfo(pw, args); } finally { pw.flush(); } } - private Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, PrintWriter pw, String[] args) { + private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, String[] args) { long nativeMax = Debug.getNativeHeapSize() / 1024; long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024; long nativeFree = Debug.getNativeHeapFreeSize() / 1024; @@ -754,7 +753,7 @@ public final class ActivityThread { long dalvikFree = runtime.freeMemory() / 1024; long dalvikAllocated = dalvikMax - dalvikFree; long viewInstanceCount = ViewDebug.getViewInstanceCount(); - long viewRootInstanceCount = ViewDebug.getViewAncestorInstanceCount(); + long viewRootInstanceCount = ViewDebug.getViewRootImplCount(); long appContextInstanceCount = Debug.countInstancesOfClass(ContextImpl.class); long activityInstanceCount = Debug.countInstancesOfClass(Activity.class); int globalAssetCount = AssetManager.getGlobalAssetCount(); @@ -868,7 +867,7 @@ public final class ActivityThread { int otherPrivateDirty = memInfo.otherPrivateDirty; for (int i=0; i intents) { final int N = intents.size(); for (int i=0; i results) { + private void deliverResults(ActivityClientRecord r, List results) { final int N = results.size(); for (int i=0; i providers) { final ArrayList results = new ArrayList(); @@ -3825,7 +3831,7 @@ public final class ActivityThread { } } - private final IContentProvider getExistingProvider(Context context, String name) { + private IContentProvider getExistingProvider(Context context, String name) { synchronized(mProviderMap) { final ProviderClientRecord pr = mProviderMap.get(name); if (pr != null) { @@ -3835,7 +3841,7 @@ public final class ActivityThread { } } - private final IContentProvider getProvider(Context context, String name) { + private IContentProvider getProvider(Context context, String name) { IContentProvider existing = getExistingProvider(context, name); if (existing != null) { return existing; @@ -4007,7 +4013,7 @@ public final class ActivityThread { } } - private final IContentProvider installProvider(Context context, + private IContentProvider installProvider(Context context, IContentProvider provider, ProviderInfo info, boolean noisy) { ContentProvider localProvider = null; if (provider == null) { @@ -4027,6 +4033,7 @@ public final class ActivityThread { c = context.createPackageContext(ai.packageName, Context.CONTEXT_INCLUDE_CODE); } catch (PackageManager.NameNotFoundException e) { + // Ignore } } if (c == null) { @@ -4086,7 +4093,7 @@ public final class ActivityThread { return provider; } - private final void attach(boolean system) { + private void attach(boolean system) { sThreadLocal.set(this); mSystemThread = system; if (!system) { @@ -4101,6 +4108,7 @@ public final class ActivityThread { try { mgr.attachApplication(mAppThread); } catch (RemoteException ex) { + // Ignore } } else { // Don't set application object here -- if the system crashes, @@ -4166,7 +4174,7 @@ public final class ActivityThread { } } - public static final void main(String[] args) { + public static void main(String[] args) { SamplingProfilerIntegration.start(); // CloseGuard defaults to true and can be quite spammy. We -- cgit v1.1