Merge "Run explicit GC to clear references to bitmaps earlier." into oc-dev am: fd6b3c6da3

am: 550d5da702

Change-Id: Ib31e7a0bf89db9fb347309fd14b44b0a3ca8cde2
This commit is contained in:
Winson Chung
2017-06-07 21:06:03 +00:00
committed by android-build-merger
2 changed files with 16 additions and 0 deletions

View File

@@ -519,6 +519,9 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.reset();
}
// Force a gc to attempt to clean up bitmap references more quickly (b/38258699)
Recents.getSystemServices().gc();
}
@Override

View File

@@ -361,6 +361,19 @@ public class SystemServicesProxy {
return sSystemServicesProxy;
}
/**
* 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
*/