Skip to content

feat: [SDK-5193] let an app opt out of subscription ID copy in its manifest - #2744

Merged
nan-li merged 2 commits into
mainfrom
nan/sdk-5193
Sep 11, 2026
Merged

feat: [SDK-5193] let an app opt out of subscription ID copy in its manifest#2744
nan-li merged 2 commits into
mainfrom
nan/sdk-5193

Conversation

@nan-li

@nan-li nan-li commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Lets an app turn off subscription ID copy with a manifest key.

Details

Motivation

The gesture in #2727 is on by default, and the only switch is OneSignal's remote kill switch. An app that doesn't want a clipboard write in production should be able to say so itself, in its own manifest, without a support ticket.

Ticket SDK-5193. Stacked on #2727, which this PR targets.

Scope

com.onesignal.subscriptionIdCopyDisabled set to true in the app's manifest meta-data

  • read in DeviceGestureDetector.start() through AndroidUtils.getManifestMetaBoolean, the same way com.onesignal.preferHMS is read.
  • With the key set the detector never registers its lifecycle handler, so nothing is counted, copied or recorded.
  • That is stricter than the remote kill switch, which still records disabled so we can count attempts; an app that opted out has said no.
  • One INFO line at start says the key was honoured, so a developer can confirm it took.

The key names the outcome, not the gesture, so the docs can call the feature one thing. No public API, so the wrapper SDKs expose it with no change.

Other

The docs page and release notes need to say the feature is on by default and name the key.

Testing

Unit testing

One new test in DeviceGestureDetectorTests mocks the manifest read the way DeviceServiceTests does and asserts no lifecycle handler, no clip, no event. 22 tests, Spotless and detekt pass.

Manual testing

Not run on a device. The read goes through the helper every other manifest switch uses.

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

@github-actions

github-actions Bot commented Sep 10, 2026

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

  • DeviceGestureDetector.kt: 3/3 touched executable lines (100.0%) (10 touched lines in diff)

Overall (aggregate gate)

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

📥 View workflow run

@nan-li
nan-li marked this pull request as ready for review September 10, 2026 23:46
@nan-li
nan-li requested a review from a team as a code owner September 10, 2026 23:46
Base automatically changed from nan/sdk-5088 to main September 11, 2026 17:13

@abdulraqeeb33 abdulraqeeb33 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.

The opt-out matches the ticket: com.onesignal.subscriptionIdCopyDisabled=true returns from start() before the lifecycle handler, so nothing is counted, copied, or recorded. That is stricter than the remote kill switch, as intended.

Two nits on how we pin and confirm the key (inline).

@abdulraqeeb33 abdulraqeeb33 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.

Approving with the two nits already on the diff. Neither blocks the opt-out.

…nifest

The gesture is on by default and, until now, only OneSignal could turn it
off, through the remote kill switch. An app that does not want a
clipboard write in production can now set the manifest meta-data
com.onesignal.subscriptionIdCopyDisabled to true, read the same way as
com.onesignal.preferHMS.

With the key set the detector never registers its lifecycle handler, so
nothing is counted, copied or recorded. That is deliberately stricter
than the remote kill switch, which still records disabled so attempts
can be counted: an app that opted out has said no. One INFO line at
start says the key was honored, so a typo in it is not silent.

No public API, so wrapper SDKs need no change to expose it.
The opt-out test stubbed the manifest read with the detector's own
constant, so a typo in com.onesignal.subscriptionIdCopyDisabled would
have left it green. The string is the whole contract an app has, so the
test now spells it out, the way DeviceServiceTests does for
com.onesignal.preferHMS. With a wrong key the stub misses, the real read
finds no meta-data, the handler gets added, and the test fails. Nothing
else reads the constant, so it is private now.

The start-up comment no longer claims the log line confirms the key,
since the default WARN level hides it. The level stays INFO, matching
the copy line and the iOS opt-out.

@fadi-george fadi-george 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.

Same as AR's nits

@nan-li

nan-li commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Same as AR's nits

thanks addressed

@nan-li
nan-li merged commit a6af5bc into main Sep 11, 2026
8 checks passed
@nan-li
nan-li deleted the nan/sdk-5193 branch September 11, 2026 20:34
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