-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add allow-mock-accuracy
for non-default geopoint
and geoshape
/geotrace
#4857
Conversation
cfecc58
to
7cbad4b
Compare
allow-mock-accuracy
for geopoint
with maps
and placement-map
appearancesallow-mock-accuracy
for non-default geopoint
and geoshape
/geotrace
eea0b73
to
1d0afa7
Compare
collect_app/src/main/java/org/odk/collect/android/activities/FormMapActivity.java
Show resolved
Hide resolved
@@ -70,8 +68,16 @@ | |||
public static final String LOCATION_STATUS_VISIBILITY_KEY = "location_status_visibility"; | |||
public static final String LOCATION_INFO_VISIBILITY_KEY = "location_info_visibility"; | |||
|
|||
public static final String EXTRA_LOCATION = "gp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you didn't move this one to geo/Constants.kt
too like EXTRA_READ_ONLY
and EXTRA_DRAGGABLE_ONLY
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is only relevant to GeoPointMapActivity
. I tried to keep it so Constants
was only defining the shared ones.
tools:replace="android:theme"/> | ||
<activity android:name=".activities.GeoPointMapActivity" /> | ||
<activity android:name=".activities.GeoPolyActivity" /> | ||
tools:replace="android:theme" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's need so that the build tools now which android:theme
to use. Otherwise, there is a conflict between the geo
and the collect_app
manifests.
internal object GeoActivityUtils { | ||
|
||
@JvmStatic | ||
fun requireLocationPermissions(activity: Activity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we check this in the Activity
and in ActivityGeoDataRequester
. However, I don't want to get into untangling the interaction with WaitingForDataRegistry
here to make sure that it's safe to just check this in the Activity
.
/** | ||
* Should use {@link org.odk.collect.android.externaldata.ExternalAppsUtils} instead | ||
*/ | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to add the work/risk of replacing current usages of ANSWER_KEY
in this PR but also wanted to make it clear we have a better option now.
These could eventually move to their own `maps` module but moving the map fragment implementations would be very cumbersome and is probably worth doing a single dedicated piece of work.
…ment with faked location client
We'll need to handle Mapbox in a different way as it doesn't use the same location abstraction
@seadowg I can see a problem with the display of Google Maps when using all Geo widgets (point, trace, shape) on all of my devices. It loads properly for display points on map. Issue does not occur for Mapbox and OSM. See gif: The issue does not occur on master. |
@kkrawczyk123 I'll look into that |
For some reason this needs to be a singleton or Google Maps ends up just being blank. Not sure why yet.
@kkrawczyk123 fixed! @grzesiek2010 it looks like the |
@seadowg I have tried that form https://test.getodk.cloud/#/projects/308/forms/external_device_geopoint/versions with Fake GPS app and my understanding is that fake location should be used only in the first question where mock accuracy=true but I can see that it is used also in the second question where mock accuracy=false. Is it an issue or did I misunderstand something? |
@kkrawczyk123 the fake location will still be used, but its accuracy should be zero when |
@seadowg I can see accuracy 0 for both when allow-mock-accuracy is true and false: I assumed that there should be a difference but maybe I am wrong. |
@kkrawczyk123 is this for all the geo widgets or just one of them? I'll check this out my side as well as it sounds like something it wrong. |
@kkrawczyk123 I'm seeing the correct behaviour using mock the GPS Connector app in simulation mode for geopoint (and maps appearances) and geotrace - I get points with 0 accuracy when Are you potentially testing with manual placement (moving the map to somewhere and then placing a point)? This always results in zero accuracy as the location doesn't come from gps. |
@seadowg I agree that accuracy difference is visible between both questions for geopoint with map view, geotrace and geoshape widgets but my question was about geopoint without map view - exact form that was attached in PR. |
@kkrawczyk123 yeah I'm using that as well and still getting accuracy in the "Location (allows mock)" question. Is that happening every time? And it doesn't happen for the other geo widgets? What app are you using to fake the location? I'm wondering if the app is maybe giving you zero accuracy - I just got a |
@seadowg I can see accuracy 0 for both questions. It is happening every time for me. @mmarciniak90 Are you seeing the same thing on your devices? I am using the same app "Fake GPS" for that widget and others and there is a difference as I mentioned above it works for widgets with map view. I have set accuracy in the app to be different than 0 - I have 1 on one device and 20 on another and the same results - accuracy 0 for questions with and without allow-mock accuracy when filling a form. |
@kkrawczyk123 could link me to the exact app? |
@kkrawczyk123 I get accuracy with that app. Changing its "Accuracy" setting is reflected in Collect as well (although never exactly for some reason, but that could be the app). |
Unfortunately, I have the same result. I also use the same app to generate fake GPS. |
@seadowg That's weird. What app have you been using before? We could try with it |
Ok turns out I'd got myself confused about the release state of the |
257b258
to
f0298d7
Compare
Finally tested with success! Verified cases:
regression checks on:
|
Tested with success on Android 8.1, 9.0, 10.0 |
Closes #4768
Blocked by #4842Every kind of geo/location widget should now support
allow-mock-accuracy
. Again, the refactor here (moving the geo code togeo
) is nice and gradual so going through commit by commit is a good idea.What has been done to verify that this works as intended?
New tests.
Why is this the best possible solution? Were any other approaches considered?
This takes the same approach as the last PR so not a lot to discuss here. This time most of the work is focused on moving
GeoPointMapActivity
and then adding support for theallow-mock-accuracy
param in the same way we did forGeoPointActivity
.It's feeling to me like there's probably a
maps
module to be extracted at some point that contains theMapFragment
,MapPoint
and the providers/implementations (or possibly multiple modules for different implementations). That feels like an extra step we could take next time we're playing around in this area however.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Good to check the map appearances of
geopoint
with the different map providers - Mapbox should require special attention because it uses a different code path for grabbing the device's location.geoshape
andgeotrace
need checked as well.Do we need any specific form for testing your changes? If so, please attach one.
The form used in the previous PR is a good starting point. Testing the specific support in this PR can be done by adding the map appearances to the form.
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.