mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Remove workaround for Android issue #190966.
This commit is contained in:
@@ -81,18 +81,6 @@ public class AddNearbyContactActivity extends BriarActivity
|
||||
.observe(this, this::onAddContactStateChanged);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
viewModel.setIsActivityResumed(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
viewModel.setIsActivityResumed(false);
|
||||
}
|
||||
|
||||
private void onBluetoothDiscoverableResult(boolean discoverable) {
|
||||
if (discoverable) {
|
||||
LOG.info("Bluetooth discoverability was accepted");
|
||||
|
||||
@@ -182,12 +182,6 @@ class AddNearbyContactPermissionManager {
|
||||
locationPermission = Permission.PERMANENTLY_DENIED;
|
||||
}
|
||||
}
|
||||
// If a permission dialog has been shown, showing the QR code fragment
|
||||
// on this call path would cause a crash due to
|
||||
// https://code.google.com/p/android/issues/detail?id=190966.
|
||||
// In that case the isResumed flag prevents the fragment from being
|
||||
// shown here, and showQrCodeFragmentIfAllowed() will be called again
|
||||
// from onPostResume().
|
||||
if (checkPermissions()) onPermissionsGranted.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,6 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
private BluetoothDecision bluetoothDecision = BluetoothDecision.UNKNOWN;
|
||||
|
||||
private boolean wasContinueClicked = false;
|
||||
private boolean isActivityResumed = false;
|
||||
|
||||
/**
|
||||
* Records whether we've enabled the wifi plugin so we don't enable it more
|
||||
@@ -369,8 +368,7 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
boolean permissionsGranted = areEssentialPermissionsGranted(
|
||||
getApplication(), isBluetoothSupported());
|
||||
boolean locationEnabled = isLocationEnabled(getApplication());
|
||||
if (isActivityResumed && wasContinueClicked && permissionsGranted &&
|
||||
locationEnabled) {
|
||||
if (wasContinueClicked && permissionsGranted && locationEnabled) {
|
||||
if (isWifiReady() && isBluetoothReady()) {
|
||||
LOG.info("Wifi and Bluetooth are ready");
|
||||
startAddingContact();
|
||||
@@ -489,21 +487,6 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true in onPostResume() and false in onPause(). This prevents the
|
||||
* QR code fragment from being shown if onRequestPermissionsResult() is
|
||||
* called while the activity is paused, which could cause a crash due to
|
||||
* https://issuetracker.google.com/issues/37067655.
|
||||
* TODO check if this is still happening with new permission requesting
|
||||
*/
|
||||
@UiThread
|
||||
void setIsActivityResumed(boolean resumed) {
|
||||
isActivityResumed = resumed;
|
||||
// Workaround for
|
||||
// https://code.google.com/p/android/issues/detail?id=190966
|
||||
showQrCodeFragmentIfAllowed();
|
||||
}
|
||||
|
||||
@UiThread
|
||||
void setBluetoothDecision(BluetoothDecision decision) {
|
||||
bluetoothDecision = decision;
|
||||
|
||||
Reference in New Issue
Block a user