commit | 9ce20c2e7de8e12d17ab95026db98a3f9f02885f | [log] [tgz] |
---|---|---|
author | Winson Chung <winsonc@google.com> | Tue Jun 06 14:01:29 2017 -0700 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Thu Jun 08 00:28:48 2017 +0000 |
tree | b1f8be6b1145f37b5b54a6b1d9421a080da5eb9d | |
parent | fec561527ebd9a5d51c9d7c3f3433942f6ec9643 [diff] |
Run explicit GC to clear references to bitmaps earlier. Bug: 38258699 Test: Open Recents, dump meminfo, close Recents, wait, dump meminfo Change-Id: Ibdcf94aee4fac9abcde64e30ae1f13cbb551fec0 (cherry picked from commit 69a9c170b39cf26293a5b6d80e9aeed47b17b385)
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 7697061..ba3bcc7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -514,6 +514,9 @@ RecentsActivityLaunchState launchState = config.getLaunchState(); launchState.reset(); } + + // Force a gc to attempt to clean up bitmap references more quickly (b/38258699) + Recents.getSystemServices().gc(); } @Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index cbfa0e5..1f13830 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -362,6 +362,19 @@ } /** + * Requests a gc() from the background thread. + */ + public void gc() { + BackgroundThread.getHandler().post(new Runnable() { + @Override + public void run() { + System.gc(); + System.runFinalization(); + } + }); + } + + /** * @return whether the provided {@param className} is blacklisted */ public boolean isBlackListedActivity(String className) {