Merge branch 'plugin-toggle-settings' into 'plugin-toggles'

Add toggle settings for transport plugins

See merge request briar/briar!1211
This commit is contained in:
Torsten Grote
2020-01-23 15:09:19 +00:00
18 changed files with 521 additions and 202 deletions

View File

@@ -10,4 +10,7 @@ public interface BluetoothConstants {
String PROP_UUID = "uuid";
String PREF_BT_ENABLE = "enable";
// Reason code returned by Plugin#getReasonDisabled()
int REASON_NO_BT_ADAPTER = 2;
}

View File

@@ -35,12 +35,18 @@ public interface Plugin {
}
/**
* Reason code returned by {@link #getReasonDisabled()} ()} to indicate
* that the plugin is disabled because it has not been started or has been
* Reason code returned by {@link #getReasonDisabled()} to indicate that
* the plugin is disabled because it has not been started or has been
* stopped.
*/
int REASON_STARTING_STOPPING = 0;
/**
* Reason code returned by {@link #getReasonDisabled()} to indicate that
* the plugin has been disabled by the user.
*/
int REASON_USER = 1;
/**
* Returns the plugin's transport identifier.
*/
@@ -75,9 +81,9 @@ public interface Plugin {
* Returns an integer code indicating why the plugin is
* {@link State#DISABLED disabled}, or -1 if the plugin is not disabled.
* <p>
* The codes used are plugin-specific, except the generic code
* {@link #REASON_STARTING_STOPPING}, which may be used by
* any plugin.
* The codes used are plugin-specific, except the generic codes
* {@link #REASON_STARTING_STOPPING} and {@link #REASON_USER}, which may
* be used by any plugin.
*/
int getReasonDisabled();

View File

@@ -0,0 +1,6 @@
package org.briarproject.bramble.api.plugin;
public interface TcpConstants {
String PREF_TCP_ENABLE = "enable";
}

View File

@@ -13,6 +13,7 @@ public interface TorConstants {
int CONNECT_TO_PROXY_TIMEOUT = 5000; // Milliseconds
int EXTRA_SOCKET_TIMEOUT = 30000; // Milliseconds
String PREF_TOR_ENABLE = "enable";
String PREF_TOR_NETWORK = "network2";
String PREF_TOR_PORT = "port";
String PREF_TOR_MOBILE = "useMobileData";
@@ -23,7 +24,7 @@ public interface TorConstants {
int PREF_TOR_NETWORK_WITH_BRIDGES = 2;
int PREF_TOR_NETWORK_NEVER = 3;
int REASON_USER = 1;
// Reason codes returned by Plugin#getReasonDisabled()
int REASON_BATTERY = 2;
int REASON_MOBILE_DATA = 3;
int REASON_COUNTRY_BLOCKED = 4;