Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Finish Android SDK 31 Upgrade #216

Merged
merged 4 commits into from
Aug 7, 2023
Merged

Conversation

ddohler
Copy link
Contributor

@ddohler ddohler commented Jul 26, 2023

Overview

We need to target at least Android SDK 31 in order to remain on the Play Store past August 31. The start of this work was completed in #210 but there were still some outstanding issues that needed to be addressed. This addresses some of them, but not all (see notes, below).

Demo

Screenshot from 2023-07-26 12-06-03

Notes

There were a number of issues identified in #209 . Here's a list of the resolutions of each one:

Some of the linting issues point to the deprecation of AsyncTask. Some quick Googling suggests there is no 1-to-1 replacement for this, so we should learn a bit more about fixing these would entail and if it's worth the effort to address this right now.

There are a lot of these spots and AsyncTask has just been deprecated, not removed, so we should punt until we're less time-crunched. I opened #213 for this.

We use features that are deprecated in Gradle v8, so we should decide whether those features are worth updating to upgrade our version of Gradle.

We should upgrade eventually but don't need to now because Gradle's maintenance support extends back one major version. In other words, Gradle 7 will only receive support until Gradle 9 is released, but if we're on Gradle 8 then we'll have support until Gradle 10. I opened #214 for this.

We have been seeing E/RecyclerView: No adapter attached; skipping layout and E/PlacesList: image view not found; not setting up scroll listener errors for the last couple of versions. Is there an easy fix for this or can it be fixed by a dependency upgrade?

I did some research on this and my best understanding is that this seems like it could be from calling setAdapter() inside of an asynchronous callback: https://stackoverflow.com/questions/29141729/recyclerview-no-adapter-attached-skipping-layout . It mostly doesn't seem to hurt anything (although I think it might cause some images to be blank when they scroll into view), and we're going to have to rework the asynchronous code soon anyway, so I think it's best to punt on this for the time being. I opened #215 to address this.

E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted errors appear on API level 28+ following issue #201. To replicate, go to the "places" map view, select an event from the map, or select filter on the map view. These errors appear to be related to the dialogue boxes and map.

I was able to replicate this, but the only discussion I was able to find online indicated that it happens when displaying a dialog over the map (which we do) and that the only solution is to avoid doing that, which would be more effort than we have time for. Luckily, it doesn't seem to harm anything so I think we can safely ignore this.

Google's pre-launch report from releasing the app to testing resulted in the following error java.lang.IllegalStateException: android.os.ServiceManager$ServiceNotFoundException: No service published for: search. We should figure out how to replicate and address this issue.

I wasn't able to replicate this but it seems like there's only one spot in the code that could throw this exception, so I wrapped it in a try/catch and hopefully that'll do the trick.

API level 31 added the ability to share approximate location instead of precise location. The app works if you only share approximate location, but you'll continue to see permissions pop ups and toast messages. We should try to find and fix whatever is checking again and again for precise location and update it to accept approximate location.

I changed the permission checking logic so that it works with either precise or approximate location.

One final note is that SDK is the minimum version to remain on the Play Store, but in order to publish updates we need to target at least SDK 33. We should start on the SDK 33 upgrade as soon as SDK 31 is published.

Testing Instructions

  • Follow the setup instructions in the README until you've got the app working in an emulator, except don't try to set up a debug API key for the Google Maps API -- just use the release key in the password manager.
  • Inside the emulator, set a GPS location that is within the Philly area but clearly different from City Hall.
  • On the first time launching the app, grant it Precise Location permissions and confirm that the map appears in the correct spot (the app sometimes caches the location so if it shows up at City Hall you may need to use the location button to force a refresh, but then it should work correctly).
  • Use the settings to remove all Location permissions from GoPhillyGo
  • Launch the app again, but this time use Approximate location, and confirm that the app behaves essentially the same way (though it'll probably jump to City Hall again if the approximate location is too far from Philly).

Closes #209

Copy link
Collaborator

@rachelekm rachelekm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to get this up and tested in Android Studio but this looks good with that caveat in mind! Your comments and notes were helpful moving through this and I think all these fixes/decisions make sense. Approving knowing there's a deadline to meet and Google Play has a testing environment we can use as well.

// ServiceManager.ServiceNotFoundException . It's not clear why this happens (most of
// the time it doesn't) or how we could reasonably recover, so if we ignore the error
// then the search will fail to initialize but the rest of the screen should continue to
// work.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helpful context here 👍

@ddohler
Copy link
Contributor Author

ddohler commented Aug 7, 2023

Thanks for reviewing @rachelekm !

@ddohler ddohler merged commit e7b7c89 into develop Aug 7, 2023
@ddohler ddohler deleted the feature/dpd/android-sdk-31 branch August 7, 2023 16:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix linting warnings and errors on SDK version 31
2 participants