Commit bb48dc99 by tonihei Committed by Toni

Close cursor in DownloadManager.

Not closing the cursor crashes the demo app when in run in StrictMode.

PiperOrigin-RevId: 240768493
parent b1a13f96
......@@ -601,8 +601,9 @@ public final class DownloadManager {
fileIOHandler.post(
() -> {
DownloadState[] loadedStates;
DownloadStateCursor cursor = null;
try {
DownloadStateCursor cursor =
cursor =
downloadIndex.getDownloadStates(
STATE_QUEUED,
STATE_STOPPED,
......@@ -618,6 +619,10 @@ public final class DownloadManager {
} catch (Throwable e) {
Log.e(TAG, "Download state loading failed.", e);
loadedStates = new DownloadState[0];
} finally {
if (cursor != null) {
cursor.close();
}
}
final DownloadState[] states = loadedStates;
handler.post(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment