29d79adf4b
We discovered that AsyncTask.cancel() doesn't quite perform as expected; In particular, if you call cancel() during a particularly slow background worker, the result is discarded and onPostExecute() is never called. If the result is an open cursor, then we "leak" by not closing it. For AccountFolderList, which has a multi-step doInBackground(): 1. Check for isCancelled() during the long doInBackground() which will reduce the number of discarded cursors in the first place. 2. Check for isCancelled() at the end of the long doInBackground() and if true, close the result cursors and return null. 3. In the existing isCancelled() code in onPostExecute(), close the cursors. For other AsyncTasks (with simpler configurations): 1. Check for isCancelled() at the end of doInBackground() and if true, close the just-opened cursor and return null. See also Change-Id: Ie63a3197af563baa8bb0fe6f1ef9423e281cbf4c Bug: 3088870 Change-Id: I51b11bb5b23f209f8b61962500a063040484fd24 |
||
---|---|---|
assets | ||
docs | ||
images | ||
res | ||
src | ||
tests | ||
.classpath | ||
.project | ||
Android.mk | ||
AndroidManifest.xml | ||
CleanSpec.mk | ||
MODULE_LICENSE_APACHE2 | ||
NOTICE | ||
proguard.flags | ||
remove-exchange-support.sh |