Skip to content
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

feat: Log GnssAntennInfo to JSON file #443

Merged
merged 17 commits into from
Oct 24, 2020
Merged

feat: Log GnssAntennInfo to JSON file #443

merged 17 commits into from
Oct 24, 2020

Conversation

barbeau
Copy link
Owner

@barbeau barbeau commented Oct 13, 2020

This PR implements logging of GnssAntennInfo to a JSON file.

Closes #419.

TODO:

  • Test on a real Android 11 device that supports this
  • Add missing closing ]
  • Test orientation changes with CSV file
  • Flush JSON file?
  • Test sharing current CSV file
  • Test sharing existing CSV file via browser
  • Add docs

Does anyone have an Android 11 device that would be willing to run a test build and see if this works? A Pixel 4a is the only Android 11 device I have access to and it doesn't support GnssAntennaInfo.

Test builds:

In the test build, you can check support by going to GPSTest "Settings->Logging and Output" and see if the "Antenna Info" is checkable or if it's grayed out.

After you check the box and return to the Status screen, the app should create a new JSON log file in the "gnss_log" folder on your device. If you could share that file, it would be awesome. And, if your device w/ Android 11 doesn't support the feature, please let me know.

@alexlopezc
Copy link

Tested Google Play version in Pixel 4 with Android 11 build RP1A.200720.009 and Antenna Info is not checkeable.

@Jakazuuu
Copy link

Tested with Google Play version on Pixel 5 with Android 11 build RD1A.200810.021.A1 and getting "cloud not open file" exception.

Solved the exception with adding android:requestLegacyExternalStorage="true" to the Application-Tag in AndroidManifest.xml

With that I got a nice looking JSON file with all data.
pixel5_antennaInfo.txt

@barbeau
Copy link
Owner Author

barbeau commented Oct 19, 2020

@Jakazuuu Ooo, nice! Thanks for testing! Good catch on the external storage issue, I just opened a bug here - #446.

JSON overall looks good, although it does look like it's missing a closing ]. I'll work on fixing that too.

@barbeau barbeau marked this pull request as ready for review October 19, 2020 16:40
@barbeau
Copy link
Owner Author

barbeau commented Oct 20, 2020

@Jakazuuu I've updated the above test build links with a few fixes, would you mind trying again and seeing if everything works as expected?

@Jakazuuu
Copy link

@barbeau Sure! I'll test it later the day and give you an update!

@Jakazuuu
Copy link

@barbeau I just tested the updated APK.

The issue with the storage is fixed.

Also the missing ] at the end of the JSON file is fixed when the file streams are correctly closed. When closing the app via "Return" I got a toast notification "Unable to close all file streams" and the corresponding JSON file is missing the ].

Another bug is, when checking more than one "File Output", I got a toast notification with "Logging to new file: %1$s, .json".

@barbeau
Copy link
Owner Author

barbeau commented Oct 21, 2020

Thanks @Jakazuuu!

Another bug is, when checking more than one "File Output", I got a toast notification with "Logging to new file: %1$s, .json".

Ah, good catch, I just posted a new test build that should fix this.

Also the missing ] at the end of the JSON file is fixed when the file streams are correctly closed.

What UI steps did you take when the file wasn't missing the ]?

When closing the app via "Return" I got a toast notification "Unable to close all file streams" and the corresponding JSON file is missing the ].

Do you mean when you close the app using the back button?

I added something that might fix this to the new test build, if you could try testing again.

The three main scenarios to test while logging CSV and JSON files would be:

  1. Kill the app with the back button. Files should be closed without error and when you start the app again it should log to new files.
  2. Tap the home button to background the app, then return to it. Depending on how aggressive Android in killing background Activities it may resume logging to the old files, or start logging to new files. But hopefully 🤞 no errors either way.
  3. Tap "Share" button in action bar, file share button, and choose email client, and hopefully both CSV and JSON files should be attached to email and logging should start again with new files after sharing is complete.

# Conflicts:
#	GPSTest/src/main/java/com/android/gpstest/io/FileLogger.java
@Jakazuuu
Copy link

Hi @barbeau, I tested the new build and everything is working now! Thank you very much.

I tested the three main scenarios with activated NMEA and AntennaInfo logging.

  1. Kill the app with the back button. Files should be closed without error and when you start the app again it should log to new files.

Clicking back, stops logging without an error. 👍

  1. Tap the home button to background the app, then return to it. Depending on how aggressive Android in killing background Activities it may resume logging to the old files, or start logging to new files. But hopefully 🤞 no errors either way.

Also, this one is working like intended. For my Pixel 5 its resume logging to the old files. 👍

  1. Tap "Share" button in action bar, file share button, and choose email client, and hopefully both CSV and JSON files should be attached to email and logging should start again with new files after sharing is complete.

Here the files are attached to the email and the logger starts with new files. 👍

Do you mean when you close the app using the back button?

Yes, that was exactly what I meant!

@barbeau
Copy link
Owner Author

barbeau commented Oct 23, 2020

Thanks @Jakazuuu, I appreciate you testing it!

@barbeau barbeau merged commit eef33e7 into master Oct 24, 2020
@barbeau barbeau deleted the log-gnss-antenna branch October 24, 2020 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for logging GnssAntennaInfo in raw measurements
3 participants