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(#332): support Android 14 #349

Merged
merged 44 commits into from
Mar 15, 2024
Merged

feat(#332): support Android 14 #349

merged 44 commits into from
Mar 15, 2024

Conversation

jkuester
Copy link
Contributor

@jkuester jkuester commented Mar 8, 2024

Closes #332

Adds support for Android 14 while also uplifting the dependencies/plugins to take advantage of new tooling/linting targeted at the new Android versions.

The changes around the RECEIVER_NOT_EXPORTED flags are really the only implementation code changes that were required for Android 14 compatibility. However, to be able to use the ContextCompat.registerReceiver method for backwards compatibility, I needed to start uplifting some dependencies.

Instead to trying to do things piecemeal, I just bumped everything. The biggest lift was updating to the 8.x of the Android Gradle Plugin, but this is super valuable since it gives support for linting things that are specific to the newer versions of Android.

I have tried to call out inline all the motivations for the various changes I have made.

medic/cht-docs#1308

…run (trust but verify...)"

This reverts commit 1b1b42b.
This reverts commit 7ae69bd.
build.gradle Show resolved Hide resolved
implementation 'androidx.fragment:fragment:1.4.1'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.5.3'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.9.23')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting some conflicts between transitive dependencies in the org.jetbrains.kotlin org. This bom does not actually pull in additional dependencies, but just helps Gradle to resolve the conflicts: https://github.com/JetBrains/kotlin-wrappers?tab=readme-ov-file#using-in-your-projects

coverage.gradle Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of the dependency updates changed the directory structure a bit for where resources were getting stuck. So I had to tweak things in here to be aligned properly.

build.gradle Show resolved Hide resolved
@jkuester jkuester requested a review from m5r March 13, 2024 14:56
@jkuester jkuester marked this pull request as ready for review March 13, 2024 14:56
@jkuester jkuester mentioned this pull request Mar 13, 2024
2 tasks
@jkuester
Copy link
Contributor Author

jkuester commented Mar 13, 2024

I have manually validating app functionality across different Android versions following this test plan:

  • Android 14
  • Android 13
  • Android 9

Clean installation

  • Assemble Unbranded APK - make assemble
    • APKs saved in build/outputs/apk
  • Install APK - adb install build/outputs/apk/unbranded/release/cht-android-SNAPSHOT-unbranded-x86_64-release.apk
  • Open app and login to Gamma
  • Verify webapp runs successfully

Upgrade from existing cht-android version

  • Install previous gamma APK version
  • Login to Gamma
  • Install new gamma APK - adb install build/outputs/apk/medicmobilegamma/release/cht-android-SNAPSHOT-medicmobilegamma-x86_64-release.apk
  • Open app and verify user is still logged into Gamma

Location Permission

  • Open form - see the Location Permission prominent disclosure
  • Allow Location Permission
  • Submit form
  • Use Fauxton to confirm that the geolocation data is filled out in the report doc

SMS Permission

  • (Currently [broken](xml2sms functionality broken cht-core#8930) in cht-core. Can only be used with jkuester_xml2sms branch.)
  • Uncomment the SEND_SMS permission in the AndroidManifest.xml and assemble the app
  • In settings.js doc, Set a phone number in the settings object for the name gateway_number
    • "settings":{"gateway_number":"*the_phone_num*" ... }
  • In your form document (e.g. form:enketo_widgets), set "xml2sms": true
  • Submit form and verify that SMS prominent disclosure is presented.
    • Agree to prominent disclosure and Allow permission
  • Check Messages app on device and see outgoing message
  • Check device logs for Received sending report for message to confirm BroadcastReceiver functionality

Storage Permission

  • Push files to device: adb push README.md /storage/emulated/0/Download (make sure to have image/audio/video/file (e.g. PDF))
  • Does not need to ask in Android 14, but should be able to select files from phone in forms
  • User form such as enketo_widgets to select files and submit the form
  • Use Fauxton to confirm that the files were properly attached to report doc

Connection Error Warning

  • On the Android device, turn off Internet (wifi/data)
  • Do a fresh install of Unbranded app (no existing session)
  • Launch CHT app - select Gamma - See "No Internet Connection" warning
  • Re-enable internet
  • Tap "Retry" on the warning page and see the app load correctly

Copy link
Member

@m5r m5r left a comment

Choose a reason for hiding this comment

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

Also tested it on Android 5, working as usual 👍 ship it!

.github/workflows/build.yml Outdated Show resolved Hide resolved
@jkuester jkuester merged commit 544d0d2 into master Mar 15, 2024
6 checks passed
@jkuester jkuester deleted the 332_android_14 branch March 15, 2024 19:40
sugat009 pushed a commit that referenced this pull request Apr 3, 2024
@m5r m5r mentioned this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Android 14
2 participants