diff options
author | Magnus Hallqvist <magnus.hallqvist@sonyericsson.com> | 2011-04-11 09:58:07 +0200 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2011-05-21 05:23:29 -0400 |
commit | 5f02f8adad5ac840ee21d8260c56f28f52c998b9 (patch) | |
tree | becd4dfdfe73a4fea2f92bf8849a4a0237f5b5fd /ui/AndroidManifest.xml | |
parent | 694567c2ce3c5d0e4e86f41b2380ddabd2de9795 (diff) | |
download | android_packages_providers_DownloadProvider-5f02f8adad5ac840ee21d8260c56f28f52c998b9.tar.gz android_packages_providers_DownloadProvider-5f02f8adad5ac840ee21d8260c56f28f52c998b9.tar.bz2 android_packages_providers_DownloadProvider-5f02f8adad5ac840ee21d8260c56f28f52c998b9.zip |
Downloading of a file has a small chance of failing randomly.
Due to timing issues a download could be cancelled. This happens when the
downloading state machine gets in the wrong state. There are two variables
in the state machine which gets out of sync with each other: status and
mHasActiveThread.
The DownloadService thread reads several downloads from the database
and starts to process them. For each applicable download a DowloadThread
is started. For that download mHasActiveThread is set to true and the
download is started. When the download is finished the correct status
is written to the database and mHasActiveThread is set to false.
The problem is that mHasActiveThread changes value instantly in
DownloadService but the status for all downloads are read from the
database at certain times. If the DownloadThread changes the value of
mHasActiveThread before that download has been processed in the
DownloadService thread the value of mHasActiveThread will be up to date
but the status value will be out of sync.
The download will then be restarted even if it is already completed. The
DownloadService will interpred the download as a resume but the server will
handle it as a new download. The downloading statemachine will then be
confused and terminate the download.
This is fixed by synching the changing of status and mHasActiveThread between
DownloadService and DownloadThread. The database information in DowloadService
will also be re-read when it is not up to date.
Change-Id: I8bb28b42b434b424187c918dfded4fdf3baa055b
Diffstat (limited to 'ui/AndroidManifest.xml')
0 files changed, 0 insertions, 0 deletions