Skip to content

fix: disable RNodeCompanionService on pre-API 31 devices#471

Merged
torlando-tech merged 1 commit intomainfrom
fix/companion-service-api-guard
Feb 15, 2026
Merged

fix: disable RNodeCompanionService on pre-API 31 devices#471
torlando-tech merged 1 commit intomainfrom
fix/companion-service-api-guard

Conversation

@torlando-tech
Copy link
Copy Markdown
Owner

Summary

  • Fixes crash on Samsung Galaxy S8 (API 26-28) caused by CompanionDeviceService class verification at startup
  • Uses resource-qualified android:enabled attribute to gate RNodeCompanionService — disabled by default (values/), enabled on API 31+ (values-v31/)
  • No behavior change on API 31+ devices; companion device functionality remains intact

Context

RNodeCompanionService extends CompanionDeviceService (added in API 31), but the app's minSdk is 24. Samsung devices perform aggressive class verification on all manifest-declared components, crashing when the superclass doesn't exist — even though the runtime code path is already guarded with API checks.

Test plan

  • Build succeeds (assembleNoSentryDebug)
  • Merged manifest includes android:enabled="@bool/enable_companion_service"
  • Verify app launches without crash on API 26-28 device/emulator
  • Verify RNode companion pairing still works on API 31+ device

🤖 Generated with Claude Code

CompanionDeviceService (API 31) superclass causes class verification
crash on Samsung S8 (API 26-28) even though runtime code is guarded.
Use resource-qualified android:enabled to gate the service at the
manifest level so it's never loaded on older devices.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 15, 2026

Greptile Summary

Fixes a startup crash on pre-API 31 devices (e.g., Samsung Galaxy S8 on API 26-28) caused by class verification of RNodeCompanionService, which extends CompanionDeviceService — a class that only exists on API 31+. The fix uses Android's resource-qualified android:enabled attribute pattern to disable the service component by default (values/enable_companion_service = false) and enable it only on API 31+ (values-v31/enable_companion_service = true).

  • The manifest now references @bool/enable_companion_service for the service's android:enabled attribute
  • Two new resource files provide the API-level-qualified boolean values
  • No behavior change on API 31+ devices; existing registerExistingCompanionDevices() in ColumbaApplication is already guarded by API 33+ checks
  • This is a well-established Android pattern for preventing class verification of manifest-declared components on older API levels

Confidence Score: 5/5

  • This PR is safe to merge — it uses a standard Android pattern with no risk to API 31+ behavior.
  • The change is minimal, uses a well-established Android resource-qualification pattern, and all existing code paths that interact with RNodeCompanionService are already guarded by appropriate API level checks (API 33+ in ColumbaApplication, @RequiresApi(S) on the service class itself). No logic changes, no new code paths, no risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
app/src/main/AndroidManifest.xml Added android:enabled="@bool/enable_companion_service" to RNodeCompanionService declaration, gating the service component via a resource-qualified boolean. Correct placement and syntax.
app/src/main/res/values/companion_service.xml New resource file defining enable_companion_service as false for the default (pre-API 31) resource qualifier. Disables the service on devices where CompanionDeviceService does not exist.
app/src/main/res/values-v31/companion_service.xml New resource file overriding enable_companion_service to true on API 31+, where CompanionDeviceService is available. Ensures full companion device functionality on supported devices.

Flowchart

flowchart TD
    A[App Startup] --> B{Device API Level?}
    B -->|API < 31| C["values/companion_service.xml\nenable_companion_service = false"]
    B -->|API >= 31| D["values-v31/companion_service.xml\nenable_companion_service = true"]
    C --> E["RNodeCompanionService\nandroid:enabled = false"]
    D --> F["RNodeCompanionService\nandroid:enabled = true"]
    E --> G["Service skipped by system\nNo class verification crash"]
    F --> H["Service available for\nCompanion Device binding"]
    H --> I["System binds service when\nassociated RNode appears"]
Loading

Last reviewed commit: 5ac5afb

@torlando-tech
Copy link
Copy Markdown
Owner Author

@brothercorvo this should fix your samsung S8 issue

@torlando-tech torlando-tech merged commit 6e979bf into main Feb 15, 2026
11 checks passed
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.

1 participant