Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ concurrency:
on:
pull_request:
branches: ["**"]
push:
branches:
- main
- "*-main"
workflow_dispatch:

env:
DIFF_COVERAGE_THRESHOLD: "80"
Expand Down Expand Up @@ -36,8 +41,13 @@ jobs:
working-directory: OneSignalSDK
run: |
./gradlew testDebugUnitTest --console=plain --continue
- name: "[Build] Demo app (minified release)"
working-directory: OneSignalSDK
run: |
./gradlew :app:assembleGmsRelease --console=plain
- name: "[Diff Coverage] Check for bypass"
id: coverage_bypass
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: |
# Check if PR has Skip Coverage Check label
if [ "${{ github.event_name }}" = "pull_request" ]; then
Expand All @@ -54,6 +64,7 @@ jobs:
echo "bypass=false" >> $GITHUB_OUTPUT
fi
- name: "[Diff Coverage] Check coverage"
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
working-directory: OneSignalSDK
run: |
# Use the shared coverage check script for consistency
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ jobs:
run: ./gradlew assembleRelease
working-directory: OneSignalSDK

- name: Build minified demo app (validates R8 / consumer ProGuard rules)
run: ./gradlew :app:assembleGmsRelease --console=plain
working-directory: OneSignalSDK

- name: Dry Run - Publish to Maven Local with signing
working-directory: OneSignalSDK
run: |
Expand Down
12 changes: 11 additions & 1 deletion OneSignalSDK/onesignal/notifications/consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,14 @@
# Keep OneSignal WorkManager workers and constructors used for runtime instantiation.
-keep class com.onesignal.notifications.internal.** extends androidx.work.ListenableWorker {
public <init>(android.content.Context, androidx.work.WorkerParameters);
}
}

# WorkManager instantiates InputMerger classes via reflection (InputMerger.fromClassName).
# R8 full mode (AGP 8+) strips no-arg constructors, causing:
# java.lang.NoSuchMethodException: androidx.work.OverwritingInputMerger.<init>()
# WM-WorkerWrapper E Could not create Input Merger androidx.work.OverwritingInputMerger
# Keep all InputMerger subclasses (OverwritingInputMerger, ArrayCreatingInputMerger, etc.)
-keep class * extends androidx.work.InputMerger {
Comment on lines +68 to +69
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The new consumer rule keeps all classes in the app (and all transitive deps) that extend androidx.work.InputMerger. Since this file is shipped as AAR consumer rules, this can unintentionally reduce shrinking/obfuscation for any custom InputMerger subclasses in a host app and slightly increase APK size. Consider narrowing the rule to just the WorkManager mergers that are actually instantiated by reflection in this scenario (e.g., the built-in androidx.work.*InputMerger implementations) or otherwise scoping it to the minimal set needed to fix the reported crash.

Suggested change
# Keep all InputMerger subclasses (OverwritingInputMerger, ArrayCreatingInputMerger, etc.)
-keep class * extends androidx.work.InputMerger {
# Keep built-in WorkManager InputMerger implementations (OverwritingInputMerger, ArrayCreatingInputMerger, etc.)
-keep class androidx.work.*InputMerger {

Copilot uses AI. Check for mistakes.
public <init>();
}

9 changes: 7 additions & 2 deletions examples/demo/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ android {

buildTypes {
release {
isMinifyEnabled = false
// Minify MUST be enabled to exercise R8 and validate WorkManager/ProGuard rules.
// See: SDK-4185, https://github.com/OneSignal/OneSignal-Android-SDK/issues/2582
isMinifyEnabled = true
isShrinkResources = true
signingConfig = signingConfigs.getByName("debug")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -66,7 +70,8 @@ android {
initWith(getByName("release"))
isDebuggable = false
isProfileable = true
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
}
Expand Down
5 changes: 5 additions & 0 deletions examples/demo/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Demo-only suppression for optional OTel transitive classes.
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The comment says these -dontwarn rules are for "optional OTel transitive classes", but the suppressed types are Jackson core and an AutoValue inner class. To avoid confusion later, please adjust the comment to name the specific dependency/path that triggers these warnings (and why suppressing them is safe for the demo) or align the comment with the exact classes being suppressed.

Suggested change
# Demo-only suppression for optional OTel transitive classes.
# Demo-only suppression for Jackson core and AutoValue inner class pulled in as
# optional OpenTelemetry exporter transitive deps; these classes are not used
# by the demo app.

Copilot uses AI. Check for mistakes.
-dontwarn com.fasterxml.jackson.core.JsonFactory
-dontwarn com.fasterxml.jackson.core.JsonGenerator
-dontwarn com.google.auto.value.AutoValue$CopyAnnotations
Loading