android/usb: show download page again after USB permission granted

If the user hadn't granted USB permissions, yet, we asynchronously get informed
once they did that. This ensures that the user gets taken back to the download
page once they approve.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-14 18:07:24 -07:00
parent 4cd453dc92
commit 1495aa2dbf

View file

@ -109,17 +109,17 @@ public class SubsurfaceMobileActivity extends QtActivity
} // processIntent
private final BroadcastReceiver usbReceiver = new BroadcastReceiver() {
private final BroadcastReceiver usbReceiver = new BroadcastReceiver()
{
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("org.subsurfacedivelog.mobile.USB_PERMISSION".equals(action)) {
synchronized (this) {
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
Log.d(TAG, "USB device permission granted");
// Stub: press the download button here :)
}
else {
Log.d(TAG, "USB device permission granted");
setUsbDevice(null);
} else {
Log.d(TAG, "USB device permission denied");
}
}
}