Latest Fuselibs and UNO crash on Android if user selects "deny" in location sharing confirmation


#1

Tested on the latest Fuselibs and UNO (Uno 1.10.0-rc1-master-b79b2df (dev-build) macOS 10.13 x86_64 b79b2df) with Android 7 and 9. Just adding FuseJS/GeoLocation to a barebones app crashes if user selects “Deny”.

11-02 18:27:33.816  5315  5331 D DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@b9ed20e[LocationTest]
11-02 18:27:33.818  5315  5315 D Permissions: Permissions denied
11-02 18:27:33.819  5315  5315 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7 in tid 5315 (ps.locationtest), pid 5315 (ps.locationtest)
11-02 18:27:33.901   967   967 I /system/bin/tombstoned: received crash request for pid 5315
11-02 18:27:33.901  5380  5380 I crash_dump32: performing dump of process 5315 (target tid = 5315)
11-02 18:27:33.926  5380  5380 F DEBUG   : pid: 5315, tid: 5315, name: ps.locationtest  >>> com.apps.locationtest <<<
11-02 18:27:34.150   631   631 I Zygote  : Process 5315 exited due to signal (11)
11-02 18:27:34.153   886 10562 I ActivityManager: Process com.apps.locationtest (pid 5315) has died: fore TOP
11-02 18:27:34.154   886  1116 W libprocessgroup: kill(-5315, 9) failed: No such process
11-02 18:27:34.187   886  1130 W ActivityManager: setHasOverlayUi called on unknown pid: 5315
11-02 18:27:34.199   886  1116 W libprocessgroup: kill(-5315, 9) failed: No such process
11-02 18:27:34.199   886  1116 I libprocessgroup: Successfully killed process cgroup uid 10244 pid 5315 in 45ms
Process com.apps.locationtest terminated.

#2

I noticed that this crash does not happen only with GeoLocation but also with Camera module and takePicture. So basically there could be something wrong with Uno.Permissions…?


#3

I fixed this with outcommenting:
com.Bindings.ExternedBlockHost.permissionRequestFailed(_currentRequest.promise);
in: https://github.com/fuse-open/uno/blob/8582e76cd9de40a8568ca757837cdc64211c9403/lib/Uno.Permissions/Permissions.java
And building Uno again.

I’m pretty sure this is not the correct way to fix this, but for now the app doesn’t crash if the user denies access to a permission.


#4

Here’s my fix for Geo Location: https://github.com/fuse-open/fuselibs/pull/1245

Branch: https://github.com/rbtech/fuselibs/tree/Geo-Location

A small test app:

<App>
	<JavaScript>
		var Observable = require("FuseJS/Observable");
		var GeoLocation = require("FuseJS/GeoLocation");
		
		var isLocationEnabled = Observable(false);

		isLocationEnabled.value = GeoLocation.isLocationEnabled();
		

		var continuousLocation = GeoLocation.observe("changed");

		GeoLocation.on("error", function(fail) {
			console.log("GeoLocation error " + fail);
		});

		function startContinuousListener() {
			var intervalMs = 1000;
			var desiredAccuracyInMeters = 10;

			GeoLocation.startListening(intervalMs, desiredAccuracyInMeters);

		}

		function stopContinuousListener() {
			if (isLocationEnabled.value) {
				GeoLocation.stopListening();
			}
		}

		function checkIsLocationEnabled() {
			isLocationEnabled.value = GeoLocation.isLocationEnabled();
		}

		module.exports = {

			isLocationEnabled: isLocationEnabled,
			checkIsLocationEnabled: checkIsLocationEnabled,
			continuousLocation: continuousLocation,

			startContinuousListener: startContinuousListener,
			stopContinuousListener: stopContinuousListener
		};
	</JavaScript>

	<StackPanel Alignment="Center" Padding="40">

		<Text Alignment="Center" Margin="0,0,0,20">Is Location Enabled</Text>
		<Text Alignment="Center" Margin="0,0,0,20">{isLocationEnabled}</Text>
		<Button Text="Check is location enabled" Clicked="{checkIsLocationEnabled}" Margin="0,0,0,20" />

		<WhileTrue Value="{isLocationEnabled}">

			<Text Alignment="Center" Margin="0,0,0,20">Continuous</Text>
			<Text Value="Latitude: {continuousLocation.latitude}" Alignment="Center" Margin="0,0,0,10" />
			<Text Value="Longitude: {continuousLocation.longitude}" Alignment="Center" Margin="0,0,0,10" />
			<Text Value="Accuracy: {continuousLocation.accuracy}" Alignment="Center" Margin="0,0,0,10" />
			<Text Value="Altitude: {continuousLocation.altitude}" Alignment="Center" Margin="0,0,0,10" />
			<Text Value="Speed: {continuousLocation.speed}" Alignment="Center" Margin="0,0,0,20" />

			<Button Text="Start continuous listener" Clicked="{startContinuousListener}" Margin="0,0,0,20" />
			<Button Text="Stop continuous listener" Clicked="{stopContinuousListener}" />
		</WhileTrue>

		<WhileFalse Value="{isLocationEnabled}">
			
			<Button Text="Attempt Getting Location" Clicked="{startContinuousListener}" Margin="0,0,0,20" />

		</WhileFalse>

	</StackPanel>
</App>

There is one edge scenario for Android I wasn’t able to cater for:

  1. User opens app
  2. User accepts location
  3. User minimizes app
  4. User opens settings app
  5. User turns off location of app
  6. User switches back to app
  7. User denies location
  8. User switches back to settings app
  9. User turns on location of app
  10. User switches back to app
  11. User requests location (crash after few seconds)
  12. On reboot - User requests location (works :slight_smile:)

#5

Thank you aeq! I’ll test it out in the next update for our app.