(GB MR) bug:3144642 temporary small fix in GB MR and real fix in HC
Real fix is in Change-Id: Ifea1544737023008eff44aef9acd976902a0c143
In the database, sometimes _data column in downloads is set to null
and sometimes to empty string. this is inconsistent
and causes bugs such as bug:3144642.
This bug is caused by line# 793 in DownloadThread.
state.mFileName is null sometimes and empty string sometimes - because
the correspodning field is set inconsistentlt in downloads.db
_data column.
in GB MR, apply a bandaid because real fix could be too risky for
GB.
Change-Id: I115b3ba6cfe0262269dbbc4c336b9e1d63c618e4
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index 2995bfb..d783fea 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -26,6 +26,7 @@
import android.os.Process;
import android.provider.Downloads;
import android.provider.DrmStore;
+import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -790,7 +791,7 @@
*/
private void setupDestinationFile(State state, InnerState innerState)
throws StopRequest {
- if (state.mFilename != null) { // only true if we've already run a thread for this download
+ if (TextUtils.isEmpty(state.mFilename)) { // only true if we've already run a thread for this download
if (!Helpers.isFilenameValid(state.mFilename)) {
// this should never happen
throw new StopRequest(Downloads.Impl.STATUS_FILE_ERROR,