Transport icons use inconsistent information to determine plugin state
The transport icons in the nav drawer use two sources of information to determine which transports are active: Plugin#isRunning()
and TransportEnabled/DisabledEvents. But these sources can be inconsistent. For example, BluetoothPlugin#isRunning()
returns true if the adapter is enabled, regardless of whether contact connections are enabled, but the plugin doesn't broadcast TransportEnabledEvents unless contact connections are enabled. This leads to the following bug:
- Start Briar with default settings and the Bluetooth adapter enabled
- The Bluetooth icon is active because isRunning() returns true
- Disable the Bluetooth adapter
- The Bluetooth icon is inactive because a TransportDisabledEvent was broadcast
- Re-enable the Bluetooth adapter
- The Bluetooth icon remains inactive because no TransportEnabledEvent was broadcast
Arguably the real issue here is that plugins (or the manager) should provide an isEnabled() method that follows the enabled/disabled events. This could easily be implemented in the manager, and could also be used to suppress redundant enabled/disabled events, such as those broadcast when toggling the Bluetooth adapter state without contact connections enabled.
Related to discussion of plugin states on #185 (closed).