Skip to content

fix: [SDK-5303] treat null OEM PackageInfo as not installed - #2758

Merged
abdulraqeeb33 merged 1 commit into
mainfrom
ar/sdk-5303
Sep 21, 2026
Merged

abdulraqeeb33 merged 1 commit into
mainfrom
ar/sdk-5303

Conversation

@abdulraqeeb33

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Treat a null OEM PackageInfo as not installed so GMS/HMS detection does not NPE.

Details

Motivation

Fixes SDK-5303. Some OEM PackageManager.getPackageInfo implementations return null (or throw NPE) instead of NameNotFoundException. packageInstalledAndEnabled then crashed on info.applicationInfo.enabled. Daily watch 2026-09-21: 4 events / 4 installs, recorded as SDK fatals.

Scope

DeviceService.packageInstalledAndEnabled only. Missing or unreadable package is false. Play services present and enabled is unchanged. No public API change.

Testing

Unit testing

Added tests for null PackageInfo, null applicationInfo, and enabled package. DeviceServiceTests passed locally (:OneSignal:core:testDebugUnitTest).

Manual testing

Not practical on a stock Pixel. The NPE needs an OEM PackageManager that returns null. Covered by the mocked unit tests.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@abdulraqeeb33
abdulraqeeb33 requested a review from a team September 21, 2026 15:58
@github-actions

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

Diff Coverage Report (Changed Lines Only)

Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff).

Changed Files Coverage

  • DeviceService.kt: 2/3 touched executable lines (66.7%) (4 touched lines in diff)
    • 1 uncovered touched lines in this file

Overall (aggregate gate)

2/3 touched executable lines covered (66.7% — requires ≥ 80%)

Per-file detail (informational; gate is aggregate above):

  • DeviceService.kt: 66.7% (1 uncovered touched lines)

❌ Coverage Check Failed

Aggregate coverage on touched lines is 66.7% (minimum 80%).

📥 View workflow run

@nan-li nan-li left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there's Ci failing

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.

3 participants