allow Bluetooth swap to work when there is no available internet

#1393
This commit is contained in:
Hans-Christoph Steiner 2018-04-10 22:48:53 +02:00
parent 615e559ce1
commit 9cb53e93d0
2 changed files with 7 additions and 2 deletions

View File

@ -47,6 +47,7 @@ import org.fdroid.fdroid.data.Repo;
import org.fdroid.fdroid.data.RepoProvider;
import org.fdroid.fdroid.data.Schema;
import org.fdroid.fdroid.installer.InstallManagerService;
import org.fdroid.fdroid.net.BluetoothDownloader;
import org.fdroid.fdroid.net.ConnectivityMonitorService;
import org.fdroid.fdroid.views.main.MainActivity;
@ -332,7 +333,7 @@ public class UpdateService extends IntentService {
boolean forcedUpdate = false;
String address = null;
if (intent != null) {
address = intent.getStringExtra(EXTRA_ADDRESS);
address = intent.getStringExtra(EXTRA_ADDRESS); // TODO switch to Intent.setData()
manualUpdate = intent.getBooleanExtra(EXTRA_MANUAL_UPDATE, false);
forcedUpdate = intent.getBooleanExtra(EXTRA_FORCED_UPDATE, false);
}
@ -340,7 +341,9 @@ public class UpdateService extends IntentService {
try {
// See if it's time to actually do anything yet...
int netState = ConnectivityMonitorService.getNetworkState(this);
if (netState == ConnectivityMonitorService.FLAG_NET_UNAVAILABLE) {
if (address != null && address.startsWith(BluetoothDownloader.SCHEME)) {
Utils.debugLog(TAG, "skipping internet check, this is bluetooth");
} else if (netState == ConnectivityMonitorService.FLAG_NET_UNAVAILABLE) {
Utils.debugLog(TAG, "No internet, cannot update");
if (manualUpdate) {
sendNoInternetToast();

View File

@ -24,6 +24,8 @@ public class BluetoothDownloader extends Downloader {
private static final String TAG = "BluetoothDownloader";
public static final String SCHEME = "bluetooth";
private final BluetoothConnection connection;
private FileDetails fileDetails;
private final String sourcePath;