-
Synchronize initialization of DefaultDownloadIndex · 04250031
There is a race condition when initializing the downloads database. The constructor of the DownloadManager kicks-off the database initialization in its internal thread, but at the same time an app can try to access the database directly through the manager's download index, e.g. doing DonwloadManager manager = new ... manager.getDownloadIndex().getDownload("id"); might enter DefaultDownloadIndex.ensureInitialized() from two threads. When upgrading the downloads table from version 2 to version 3, the first thread that enters the database transaction in ensureInitialized() will drop and recreate the table using the v3 schema. Then, the second thread will attempt to read from the newly created table using the v2 schema, which will fail. This race condition was not introduced in 2.12 but was there already. However, prior to 2.12, the code only dropped and re-created and the table and did not attempt to read any data. Hence, if the race condition happened, the code would drop and create the table twice, but no error would occur. Issue: #8420 #minor-release PiperOrigin-RevId: 350745463christosts committed
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| java/com/google/android/exoplayer2 | Loading commit data... | |
| javadoc/com/google/android/exoplayer2/doc-files | Loading commit data... | |
| AndroidManifest.xml | Loading commit data... |