Skip to content

Conversation

@bboothe-branch
Copy link

@bboothe-branch bboothe-branch commented Sep 25, 2025

Reference

EMT 2431 -- Google Play Billing Library Modularization.

Description

Added in the main structure of the potential update for Android Billing Library using Reflection

Testing Instructions

  • Download and run test app.
  • Test in-app purchase

Risk Assessment [HIGH || MEDIUM || LOW]

High Risk as this may break android billing entirely if not done correctly.

  • I, the PR creator, have tested — integration, unit, or otherwise — this code.

Reviewer Checklist (To be checked off by the reviewer only)

  • JIRA Ticket is referenced in PR title.
  • Correctness & Style
    • Conforms to AOSP Style Guides
    • Mission critical pieces are documented in code and out of code as needed.
  • Unit Tests reviewed and test issue sufficiently.
  • Functionality was reviewed in QA independently by another engineer on the team.

cc @BranchMetrics/saas-sdk-devs for visibility.

@matter-code-review
Copy link
Contributor

matter-code-review bot commented Sep 25, 2025

Code Quality bug fix

Reference

SDK-2431 -- Emt 2431 - Draft PR.

Description

Summary By MatterAI MatterAI logo

🔄 What Changed

This pull request executes the complete removal of the legacy BranchGooglePlayBillingV6 module. This includes the deletion of all source code, build configurations (build.gradle.kts), ProGuard rules, and Android instrumentation tests. This change follows the previous integration of the Google Play Billing V8 implementation, effectively purging the deprecated V6 logic from the codebase.

🔍 Impact of the Change

By removing the legacy V6 module, the project's technical debt is significantly reduced, and the build graph is simplified. This ensures that the SDK exclusively uses the newer Billing V8/V7 paths, preventing accidental usage of deprecated APIs. Note: The previously identified issues in the V8 implementation (empty listeners and instance creation bugs) still require attention as they are not addressed by this cleanup PR.

📁 Total Files Changed

Click to Expand
File ChangeLog
Module Config BranchGooglePlayBillingV6/build.gradle.kts Removed module-level build configuration and dependencies.
Legacy Logic BranchGooglePlayBillingV6/src/main/java/.../BillingV6Implementation.kt Deleted the legacy Billing V6 implementation class.
Manifest Removal BranchGooglePlayBillingV6/src/main/AndroidManifest.xml Removed the Android manifest for the V6 library module.
Test Cleanup BranchGooglePlayBillingV6/src/androidTest/.../ExampleInstrumentedTest.kt Deleted instrumentation tests for the V6 module.
Unit Tests BranchGooglePlayBillingV6/src/test/.../ExampleUnitTest.kt Removed local unit tests for the V6 module.
ProGuard Rules BranchGooglePlayBillingV6/proguard-rules.pro Deleted module-specific obfuscation rules.

🧪 Test Added/Recommended

Added

N/A (This PR focuses on code removal).

Recommended

  • Integration Test: Verify that the main SDK still compiles and functions correctly without the :BranchGooglePlayBillingV6 dependency.
  • Build Validation: Ensure settings.gradle.kts has been updated to stop including the deleted module.

🔒Security Vulnerabilities

N/A

Testing Instructions

Perform a clean build of the project and verify that no references to the BranchGooglePlayBillingV6 module remain in the final artifacts.

Risk Assessment [LOW]

This is a structural cleanup. The risk is low as long as the module is no longer referenced by other project components.

  • I, the PR creator, have tested — integration, unit, or otherwise — this code.

Reviewer Checklist (To be checked off by the reviewer only)

  • JIRA Ticket is referenced in PR title.
  • Correctness & Style
    • Conforms to AOSP Style Guides
    • Mission critical pieces are documented in code and out of code as needed.
  • Unit Tests reviewed and test issue sufficiently.
  • Functionality was reviewed in QA independently by another engineer on the team.

cc @BranchMetrics/saas-sdk-devs for visibility.

⏳ Estimated code review effort

LOW (~5 minutes)

Tip

Quality Recommendations

  1. Ensure the module is removed from the root settings.gradle.kts file to avoid build sync errors.

  2. Verify that no other internal modules have a 'project(:BranchGooglePlayBillingV6)' dependency in their build files.

♫ Tanka Poem

Old paths now erased, 🧪
Legacy code swept away, 🧹
Clean builds lie ahead,
V8 stands alone and strong,
Science claims this victory. 🧬

Sequence Diagram

sequenceDiagram
    participant Project as Android Project
    participant V6 as BranchGooglePlayBillingV6
    participant V8 as BranchGooglePlayBillingV8

    Note over V6: Module Deleted
    Project->>Project: Update settings.gradle.kts
    Project->>V8: Route all Billing requests
    Note right of V8: V8 handles logic
    Project-->>V6: [No longer exists]
Loading

@matter-code-review
Copy link
Contributor

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

@@ -0,0 +1,40 @@
plugins {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these gradle files necessary to get the library version?

Copy link
Contributor

@gdeluna-branch gdeluna-branch Sep 26, 2025

Choose a reason for hiding this comment

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

You should be able to do this with
String billingClientVersion = com.android.billingclient.BuildConfig.VERSION_NAME;
in Java (or Kotlin) instead

Copy link
Author

Choose a reason for hiding this comment

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

You mean having that line in the main gradle file instead? So I'll remove the product flavors.

Doe that replace this? :compileOnly("com.android.billingclient:billing:6.0.1")

isRequired = isReleaseBuild()
}

flavorDimensions.add("billing")
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep things simple and just check the buildconfig version string and conditionally execute the right library implementation.

Copy link
Author

Choose a reason for hiding this comment

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

Got it. Removing flavor dimensions

@@ -1,5 +1,7 @@
include(":Branch-SDK")
include(":Branch-SDK-TestBed")
include (":BillingGooglePlayModules:BillingV6V7", ":BillingGooglePlayModules:BillingV8")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, revert this

Copy link
Author

Choose a reason for hiding this comment

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

Removed this as well

public class BillingGooglePlayReflection {
public static BillingGooglePlayInterface getBillingLibraryVersion() {
try {
// Check for a class added in version 8.0 or higher
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be hopefully be simplified with my suggestion. Just parse the major version

Copy link
Author

Choose a reason for hiding this comment

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

There isn't a specific method to grab the version so the checks look for what's available in the version that is being used.

Copy link
Author

Choose a reason for hiding this comment

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

Just realizing that was for the reflection section. Replacing it!

@matter-code-review
Copy link
Contributor

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3


public class BillingGooglePlayReflection {
public static BillingGooglePlayInterface getBillingLibraryVersion() {
String billingClient = com.android.billingclient.BuildConfig.VERSION_NAME;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the variable name a bit more relevant like billingClientVersion

Copy link
Author

Choose a reason for hiding this comment

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

Renamed to billingClientVersionString


try {
int majorIndex = billingClient.indexOf(".");
String majorVersion = billingClient.substring(0, majorIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth making this version extraction bit into a utility function since this could be used in other places as well.

Copy link
Author

Choose a reason for hiding this comment

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

Created function called dependencyMajorVersionFinder and added it to DependencyUtils.kt

Function takes in a string with the depenency name and pulls out the major version number.

Kept the Version Name extract itself in the BillingGooglePlayReflection class so that the function can take in any method of calling the version name depending on what the class offers.

}

} catch (Exception e) {
System.err.println("Error parsing billing client version: " + e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

Use BranchLogger.e instead of System.err.println

Copy link
Author

Choose a reason for hiding this comment

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

Changed to BranchLogger.e

toolVersion = "0.8.10"
}

//configurations.all {
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this

Copy link
Author

Choose a reason for hiding this comment

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

Deleted

@matter-code-review
Copy link
Contributor

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

1 similar comment
@matter-code-review
Copy link
Contributor

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

@bboothe-branch
Copy link
Author

Hey @gdeluna-branch I updated all of your comments and also added the V8 logic. Is there a better way to reference them in the BillingGooglePlayReflection.java file? Also, I'm hesitant to delete the BillingGooglePlay.kt file until everything is done and working.

Also still need to build the gradle to reference each version properly.

@bboothe-branch bboothe-branch force-pushed the bboothe-branch/EMT-2431 branch from dfcdcf2 to c4e85a7 Compare December 19, 2025 21:18
@matter-code-review
Copy link
Contributor

Important

PR Review Skipped

PR review skipped as per the configuration setting. Run a manually review by commenting /matter review

💡Tips to use MatterAI

Command List

  • /matter summary: Generate AI Summary for the PR
  • /matter review: Generate AI Reviews for the latest commit in the PR
  • /matter review-full: Generate AI Reviews for the complete PR
  • /matter release-notes: Generate AI release-notes for the PR
  • /matter : Chat with your PR with MatterAI Agent
  • /matter remember : Generate AI memories for the PR
  • /matter explain: Get an explanation of the PR
  • /matter help: Show the list of available commands and documentation
  • Need help? Join our Discord server: https://discord.gg/fJU5DvanU3

@bboothe-branch bboothe-branch changed the title Emt 2431 - Draft PR [Draft][EMT-2431] - Google Play Billing Library Modularization Dec 19, 2025
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.

2 participants