Skip to content

Conversation

@wzieba
Copy link
Contributor

@wzieba wzieba commented Jul 17, 2024

Description

This PR updates Android Gradle Plugin to 8.5.0, mostly needed to address security vulnerabilities.

Testing information

  1. Install the app in releaseVanilla variant as there are changes related to R8.
  2. Smoke test the app, focus on testing paths from every module, including iap and cardreader

Dependencies

wzieba added 3 commits July 17, 2024 14:33
Starting from Gradle 8.4, shrinking at library level is now respected. Library modules will be now shrinked in isolation, removing code that might be used by other modules. The solution is to not shrink each library module (no need as we don't publish them in isolation) and shrink only app modules.
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 17, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit1e9c0ff
Direct Downloadwoocommerce-wear-prototype-build-pr12042-1e9c0ff.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 17, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit1e9c0ff
Direct Downloadwoocommerce-prototype-build-pr12042-1e9c0ff.apk

wzieba added 2 commits July 23, 2024 11:29
To address `NotificationPermission` lint error. Actually, this permission is not needed at this moment, as the wear module doesn't use org.wordpress.android.util.AutoForeground or classes that overrides from it so it seems to be a false positive from lint.

I don't want to suppress this issue though, as we might use AutoForeground in the future, and the POST_NOTIFICATIONS will be necessary then.
- unwrap `String#format(Context#getString` calls. Having two formats is unnecessary and can be confusing
- update format arguments to reflect type declared in strings.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More context on this:
Screenshot 2024-07-23 at 11 26 04

I think it's a false positive: the WooCommerce-Wear doesn't use AutoForeground or any service that is inheriting from it.

I've experimented with removing org.wordpress:utils dependency from WooCommerce-Wear module and running lint was resulting with no errors.

To make sure there are no new services, I've compared manifests of WooCommerce-Wear with and without org.wordpress:utils. The diff is:
Screenshot 2024-07-23 at 11 25 15

which is not relevant to POST_NOTIFICATIONS.

My conclusion: Android linter detects AutoForeground service in dependencies of the WooCommerce-Wear module and throws this lint error, not minding that we don't actually use the service.

I decided to add this permission anyway, as it's already present in WooCommerce module and I didn't want to suppress this warning, in case that we'll indeed need posting a notification from the wear app.

Copy link
Contributor Author

@wzieba wzieba Jul 24, 2024

Choose a reason for hiding this comment

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

Only now I realised that we already request POST_NOTIFICATIONS in a few places in the app

@RequiresApi(VERSION_CODES.TIRAMISU)
fun requestNotificationsPermission(launcher: ActivityResultLauncher<String>) {
launcher.launch(POST_NOTIFICATIONS)
}

so adding this POST_NOTIFICATION in manifest is more of a correctness (as signilised by lint warning)

edit: yes, we use but in WooCommerce module, not WooCommerce-Wear

@wzieba wzieba added status: do not merge Dependent on another PR, ready for review but not ready for merge. category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. labels Jul 23, 2024
@wzieba wzieba added this to the 19.7 milestone Jul 23, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.04%. Comparing base (e7e9368) to head (13eba9a).
Report is 612 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12042      +/-   ##
============================================
+ Coverage     39.99%   40.04%   +0.05%     
+ Complexity     5525     5505      -20     
============================================
  Files          1200     1200              
  Lines         68416    68295     -121     
  Branches       9577     9369     -208     
============================================
- Hits          27364    27350      -14     
+ Misses        38492    38445      -47     
+ Partials       2560     2500      -60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wzieba
Copy link
Contributor Author

wzieba commented Jul 23, 2024

hi @kidinov 👋 can I request your assistance in smoke testing iap and cardreader modules?

@wzieba wzieba marked this pull request as ready for review July 23, 2024 13:01
@wzieba wzieba requested review from ParaskP7 and kidinov July 23, 2024 13:01
Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @wzieba !

I have reviewed and tested this PR as per the instructions, everything works as expected, good job! 🌟


I have left a single suggestion (💡) comment for you to consider. I am NOT going to approve this PR (for now), leaving the final approval to @kidinov instead (context). No matter, everything worked as expected for me so I can tentatively approve as well if you need me to (just let me know).


EXTRAS

  1. Warning (⚠️): When this PR get merged into trunk dev will need to use AS Koala. AGP 8.5.0 is incompatible with previous versions of AS and thus devs wouldn't be able to (for example) sync the project otherwise (see Android Studio & AGP compatibility options).

@wzieba wzieba modified the milestones: 19.7, 19.8 Jul 24, 2024
@wzieba wzieba changed the title Bump AGP to 8.5.0 Bump AGP to 8.5.1 Jul 24, 2024
@kidinov kidinov removed their request for review July 25, 2024 08:24
@wzieba
Copy link
Contributor Author

wzieba commented Jul 25, 2024

hi @malinajirka ! 👋 can I have your assistance regarding smoke testing iap and cardreader modules? The changes introduced with AGP 8.4.0 are related to obfuscating library modules, so I'd like to make sure we don't introduce regression.

I don't have a store with the correct setup, so I think it'll be more efficient if someone from Woo could test it.

@wzieba wzieba requested a review from malinajirka July 25, 2024 09:02
Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Hi @wzieba 👋

👋 can I have your assistance regarding smoke testing iap and cardreader modules? The changes introduced with AGP 8.4.0 are related to obfuscating library modules, so I'd like to make sure we don't introduce regression.

I've tested the card reader flows and I haven't noticed any regression.

With the removal of Site Creation in the app, the IAP flows are not used at the moment.

@wzieba
Copy link
Contributor Author

wzieba commented Jul 25, 2024

Gotcha, thank you @malinajirka ! 🙌

@wzieba wzieba changed the title Bump AGP to 8.5.1 Bump AGP to 8.5.1 Jul 26, 2024
@wzieba wzieba modified the milestones: 19.8, 19.9 Jul 30, 2024
@wzieba wzieba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Aug 6, 2024
@wzieba wzieba enabled auto-merge August 6, 2024 14:52
@wpmobilebot
Copy link
Collaborator

Found 1 violations:

The PR caused the following dependency changes:

expand

-+--- androidx.databinding:viewbinding:8.1.0
++--- androidx.databinding:viewbinding:8.5.1
 +--- project :libs:cardreader
 |    \--- com.stripe:stripeterminal-localmobile:3.1.1
-|         \--- androidx.databinding:viewbinding:7.4.2 -> 8.1.0 (*)
+|         \--- androidx.databinding:viewbinding:7.4.2 -> 8.5.1 (*)
 \--- org.wordpress:mediapicker:0.3.1
-     \--- androidx.databinding:viewbinding:8.1.0 (*)
+     \--- androidx.databinding:viewbinding:8.1.0 -> 8.5.1 (*)

Please review and act accordingly

@wzieba wzieba merged commit ff2261b into trunk Aug 6, 2024
@wzieba wzieba deleted the agp_8_5_0 branch August 6, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants