New polling logic for Bluetooth. #251

The polling interval increases exponentially each time polling is unsuccessful, up to a maximum of 60 minutes. The interval is reset to 2 minutes whenever a connection is made and whenever Bluetooth is re-enabled.
This commit is contained in:
akwizgran
2016-02-12 15:40:01 +00:00
parent a774b3419a
commit c081c08ff5
16 changed files with 216 additions and 133 deletions

View File

@@ -8,6 +8,7 @@ import com.google.inject.Provides;
import org.briarproject.api.android.AndroidExecutor;
import org.briarproject.api.event.EventBus;
import org.briarproject.api.lifecycle.IoExecutor;
import org.briarproject.api.plugins.BackoffFactory;
import org.briarproject.api.plugins.duplex.DuplexPluginConfig;
import org.briarproject.api.plugins.duplex.DuplexPluginFactory;
import org.briarproject.api.plugins.simplex.SimplexPluginConfig;
@@ -37,11 +38,11 @@ public class AndroidPluginsModule extends PluginsModule {
@Provides
DuplexPluginConfig getDuplexPluginConfig(@IoExecutor Executor ioExecutor,
AndroidExecutor androidExecutor, Application app,
SecureRandom random, LocationUtils locationUtils,
EventBus eventBus) {
SecureRandom random, BackoffFactory backoffFactory,
LocationUtils locationUtils, EventBus eventBus) {
Context appContext = app.getApplicationContext();
DuplexPluginFactory bluetooth = new DroidtoothPluginFactory(ioExecutor,
androidExecutor, appContext, random);
androidExecutor, appContext, random, backoffFactory);
DuplexPluginFactory tor = new TorPluginFactory(ioExecutor, appContext,
locationUtils, eventBus);
DuplexPluginFactory lan = new AndroidLanTcpPluginFactory(ioExecutor,