Add method for getting reason why plugin is disabled.

This commit is contained in:
akwizgran
2020-01-16 11:05:36 +00:00
parent d084f6dd8d
commit b6a73f2c98
6 changed files with 163 additions and 54 deletions

View File

@@ -34,6 +34,13 @@ public interface Plugin {
INACTIVE
}
/**
* 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;
/**
* Returns the plugin's transport identifier.
*/
@@ -64,6 +71,16 @@ public interface Plugin {
*/
State getState();
/**
* 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.
*/
int getReasonDisabled();
/**
* Returns true if the plugin should be polled periodically to attempt to
* establish connections.

View File

@@ -23,4 +23,8 @@ public interface TorConstants {
int PREF_TOR_NETWORK_WITH_BRIDGES = 2;
int PREF_TOR_NETWORK_NEVER = 3;
int REASON_USER = 1;
int REASON_BATTERY = 2;
int REASON_MOBILE_DATA = 3;
int REASON_COUNTRY_BLOCKED = 4;
}