commit | fd6b3c6da364bdc951a9c210314656e0ba8baa84 | [log] [tgz] |
---|---|---|
author | TreeHugger Robot <treehugger-gerrit@google.com> | Wed Jun 07 20:46:15 2017 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Wed Jun 07 20:46:20 2017 +0000 |
tree | 02d95c8fd03fc7e2dea3079667e8172acaff5799 | |
parent | 8d5b58a6609ddf1a007a2cf41fa1830b521e486a [diff] | |
parent | 69a9c170b39cf26293a5b6d80e9aeed47b17b385 [diff] |
Merge "Run explicit GC to clear references to bitmaps earlier." into oc-dev
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) {