Bug 59831 - Java.Lang.SecurityException Setting IsShowingUser = "true" without permission
Summary: Java.Lang.SecurityException Setting IsShowingUser = "true" without permission
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-28 19:55 UTC by Chase Florell
Modified: 2017-09-29 16:50 UTC (History)
2 users (show)

Tags: permissions, map, isshowinguser, access_fine_location, access_coarse_location, ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 59831 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Chase Florell 2017-09-28 19:55:57 UTC
If a user does *not* grant location permission to our app, when they navigate to a map that sets `IsShowingUser="true";`, the app will crash immediately with `Java.Lang.SecurityException`.

```
<Map IsShowingUser="True" />
```

09-28 12:42:20.596 I/MonoDroid( 7368): Java.Lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
09-28 12:42:20.596 I/MonoDroid( 7368):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <e499a5498b1b48379b88fe5ed629079f>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <2e14bb2dd93a405e81838369ed72695b>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at Android.Gms.Maps.GoogleMap.set_MyLocationEnabled (System.Boolean value) [0x0004a] in <cede2ee4138a48bb98b62dcaee115663>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at Xamarin.Forms.Maps.Android.MapRenderer.Android.Gms.Maps.IOnMapReadyCallback.OnMapReady (Android.Gms.Maps.GoogleMap map) [0x0007f] in <39c694c022be4f7b8a39897d372b2d00>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at Android.Gms.Maps.IOnMapReadyCallbackInvoker.n_OnMapReady_Lcom_google_android_gms_maps_GoogleMap_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_googleMap) [0x00011] in <cede2ee4138a48bb98b62dcaee115663>:0 
09-28 12:42:20.596 I/MonoDroid( 7368):   at (wrapper dynamic-method) System.Object:8f59fb55-4110-4fb6-848d-65bf2fe30c16 (intptr,intptr,intptr)
09-28 12:42:20.596 I/MonoDroid( 7368):   --- End of managed Java.Lang.SecurityException stack trace ---
09-28 12:42:20.596 I/MonoDroid( 7368): java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.maps.api.android.lib6.impl.ba.c(:com.google.android.gms.DynamiteModulesB@11517940:689)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.internal.k.onTransact(:com.google.android.gms.DynamiteModulesB@11517940:141)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.os.Binder.transact(Binder.java:604)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.setMyLocationEnabled(Unknown Source:25)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source:2)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at md5d956392b2b421ac2c9ccfc063253dcd9.MapRenderer.n_onMapReady(Native Method)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at md5d956392b2b421ac2c9ccfc063253dcd9.MapRenderer.onMapReady(MapRenderer.java:65)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.MapView$zza$1.zza(Unknown Source:7)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.internal.zzo$zza.onTransact(Unknown Source:28)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.os.Binder.transact(Binder.java:604)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at gl.b(:com.google.android.gms.DynamiteModulesB@11517940:20)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.android.gms.maps.internal.bf.a(:com.google.android.gms.DynamiteModulesB@11517940:5)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.google.maps.api.android.lib6.impl.bc.run(:com.google.android.gms.DynamiteModulesB@11517940:5)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.os.Handler.handleCallback(Handler.java:789)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.os.Handler.dispatchMessage(Handler.java:98)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.os.Looper.loop(Looper.java:164)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at android.app.ActivityThread.main(ActivityThread.java:6541)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at java.lang.reflect.Method.invoke(Native Method)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
09-28 12:42:20.596 I/MonoDroid( 7368): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
09-28 12:42:20.596 I/MonoDroid( 7368):
Comment 1 Chase Florell 2017-09-28 20:19:50 UTC
I do believe the issue around this is that there is no permissions check around this line

https://github.com/xamarin/Xamarin.Forms/blob/2.4.0/Xamarin.Forms.Maps.Android/MapRenderer.cs#L149

Now we can do the check ourselves before setting the value to 'true', but it defeats the purpose of being able to directly set the property.

<Map IsShowingUser="true" />
Comment 2 Paul DiPietro [MSFT] 2017-09-29 16:50:02 UTC
I'll set this to confirmed for now, as I'd imagine it's a reasonable thing to run a check against on the Forms end.