Bug 609366 - Switching from 3G to Wifi stops the nightly update download and then restarting Fennec shows you the package installer for the partial package. r=blassey a=blocking-fennec

--HG--
extra : rebase_source : 167d17245b3bd27ddb6cf729b444723c44a7cb41
This commit is contained in:
Alex Pakhotin 2010-11-18 14:13:31 -08:00
Родитель 704ce98231
Коммит 31fc40465f
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -499,6 +499,10 @@ abstract public class GeckoApp
String updateDir = Environment.getExternalStorageDirectory().getPath() + "/downloads/updates/0/"; String updateDir = Environment.getExternalStorageDirectory().getPath() + "/downloads/updates/0/";
File updateFile = new File(updateDir + "update.apk"); File updateFile = new File(updateDir + "update.apk");
File statusFile = new File(updateDir + "update.status");
if (!statusFile.exists() || !readUpdateStatus(statusFile).equals("pending"))
return;
if (!updateFile.exists()) if (!updateFile.exists())
return; return;
@ -526,7 +530,6 @@ abstract public class GeckoApp
// Update the status file // Update the status file
String status = statusCode == 0 ? "succeeded\n" : "failed: "+ statusCode + "\n"; String status = statusCode == 0 ? "succeeded\n" : "failed: "+ statusCode + "\n";
File statusFile = new File(updateDir + "update.status");
OutputStream outStream; OutputStream outStream;
try { try {
byte[] buf = status.getBytes("UTF-8"); byte[] buf = status.getBytes("UTF-8");
@ -541,6 +544,18 @@ abstract public class GeckoApp
System.exit(0); System.exit(0);
} }
private String readUpdateStatus(File statusFile) {
String status = "";
try {
BufferedReader reader = new BufferedReader(new FileReader(statusFile));
status = reader.readLine();
reader.close();
} catch (Exception e) {
Log.i("GeckoAppJava", e.toString());
}
return status;
}
static final int FILE_PICKER_REQUEST = 1; static final int FILE_PICKER_REQUEST = 1;
private SynchronousQueue<String> mFilePickerResult = new SynchronousQueue(); private SynchronousQueue<String> mFilePickerResult = new SynchronousQueue();