Skip to content
Snippets Groups Projects
Verified Commit 8935ec2c authored by akwizgran's avatar akwizgran
Browse files

Don't wait for state change if BT is already discoverable.

parent bd00fb1c
No related branches found
No related tags found
No related merge requests found
...@@ -177,9 +177,16 @@ public abstract class KeyAgreementActivity extends BriarActivity implements ...@@ -177,9 +177,16 @@ public abstract class KeyAgreementActivity extends BriarActivity implements
@Override @Override
public void onActivityResult(int request, int result, Intent data) { public void onActivityResult(int request, int result, Intent data) {
if (request == REQUEST_BLUETOOTH_DISCOVERABLE) { if (request == REQUEST_BLUETOOTH_DISCOVERABLE) {
// If the request was granted we'll catch the state change event if (result == RESULT_CANCELED) {
if (result == RESULT_CANCELED)
setBluetoothState(BluetoothState.REFUSED); setBluetoothState(BluetoothState.REFUSED);
} else {
// If Bluetooth is already discoverable, show the QR code -
// otherwise wait for the state or scan mode to change
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
if (bt == null) throw new AssertionError();
if (bt.getScanMode() == SCAN_MODE_CONNECTABLE_DISCOVERABLE)
setBluetoothState(BluetoothState.DISCOVERABLE);
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment