From 2e277cd985d989e24555c6e7d907ffb00dd562b9 Mon Sep 17 00:00:00 2001 From: Denis Chilik Date: Thu, 25 Jun 2026 09:41:56 -0400 Subject: [PATCH] feat: add device-based consent to override MPID-scoped consent Enables Inspire-style flows where consent is collected before MPID changes at checkout, so kit forwarding rules and uploads keep the correct consent state. --- CHANGELOG.md | 145 ++++++++---------- .../main/java/com/mparticle/MParticle.java | 43 ++++++ .../java/com/mparticle/MParticleOptions.java | 36 +++++ .../identity/MParticleUserDelegate.java | 8 +- .../com/mparticle/internal/ConfigManager.java | 48 ++++++ .../com/mparticle/internal/MessageBatch.java | 2 +- .../com/mparticle/internal/Constants.kt | 2 + .../mparticle/external/ApiVisibilityTest.kt | 2 +- .../mparticle/internal/ConfigManagerTest.kt | 36 +++++ 9 files changed, 235 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e15999b7..f706e437a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,200 +1,179 @@ -## [5.79.2](https://github.com/mParticle/mparticle-android-sdk/compare/v5.79.1...v5.79.2) (2026-06-22) +## Unreleased + +### Added +- Add device-based consent APIs (`MParticle.getDeviceConsentState()`, `MParticle.setDeviceConsentState()`) and `MParticleOptions.Builder.deviceBasedConsentEnabled()` so consent can be stored and applied at the device level, overriding MPID-based consent for kit forwarding rules and event uploads. + +## [5.79.2](https://github.com/mParticle/mparticle-android-sdk/compare/v5.79.1...v5.79.2) (2026-06-22) ### Updates & Maintenance -* bump actions/checkout from 6.0.2 to 6.0.3 ([#720](https://github.com/mParticle/mparticle-android-sdk/issues/720)) ([d904edb](https://github.com/mParticle/mparticle-android-sdk/commit/d904edb0a944a2ce813e7dc31c026f0b2f7ccecb)) -* remove cross-platform-tests and semantic PR/branch checks ([#712](https://github.com/mParticle/mparticle-android-sdk/issues/712)) ([6cdacf2](https://github.com/mParticle/mparticle-android-sdk/commit/6cdacf2926e02e2359352dbcf12b4e4bb66236fa)) -* Update submodules ([976dd0d](https://github.com/mParticle/mparticle-android-sdk/commit/976dd0d13d6aa27f805a6b06a73d923f1a207e80)) +- bump actions/checkout from 6.0.2 to 6.0.3 ([#720](https://github.com/mParticle/mparticle-android-sdk/issues/720)) ([d904edb](https://github.com/mParticle/mparticle-android-sdk/commit/d904edb0a944a2ce813e7dc31c026f0b2f7ccecb)) +- remove cross-platform-tests and semantic PR/branch checks ([#712](https://github.com/mParticle/mparticle-android-sdk/issues/712)) ([6cdacf2](https://github.com/mParticle/mparticle-android-sdk/commit/6cdacf2926e02e2359352dbcf12b4e4bb66236fa)) +- Update submodules ([976dd0d](https://github.com/mParticle/mparticle-android-sdk/commit/976dd0d13d6aa27f805a6b06a73d923f1a207e80)) ## [5.79.1](https://github.com/mParticle/mparticle-android-sdk/compare/v5.79.0...v5.79.1) (2026-05-27) - ### Bug Fixes -* **ci:** pin isolated-kit gradle version to prevent 6.0.0-rc.1 pull ([#714](https://github.com/mParticle/mparticle-android-sdk/issues/714)) ([eff10ea](https://github.com/mParticle/mparticle-android-sdk/commit/eff10ead69167f0ea3df248b2bbed089397600cd)) - +- **ci:** pin isolated-kit gradle version to prevent 6.0.0-rc.1 pull ([#714](https://github.com/mParticle/mparticle-android-sdk/issues/714)) ([eff10ea](https://github.com/mParticle/mparticle-android-sdk/commit/eff10ead69167f0ea3df248b2bbed089397600cd)) ### Updates & Maintenance -* bump trunk-io/trunk-action from 1.2.4 to 1.3.1 ([#705](https://github.com/mParticle/mparticle-android-sdk/issues/705)) ([f4ceca7](https://github.com/mParticle/mparticle-android-sdk/commit/f4ceca7de2c2ba01ea87c98698ef7bb84991b4ab)) -* Update submodules ([e435979](https://github.com/mParticle/mparticle-android-sdk/commit/e435979e1e966ef2b318bb29135852f9d55df55a)) +- bump trunk-io/trunk-action from 1.2.4 to 1.3.1 ([#705](https://github.com/mParticle/mparticle-android-sdk/issues/705)) ([f4ceca7](https://github.com/mParticle/mparticle-android-sdk/commit/f4ceca7de2c2ba01ea87c98698ef7bb84991b4ab)) +- Update submodules ([e435979](https://github.com/mParticle/mparticle-android-sdk/commit/e435979e1e966ef2b318bb29135852f9d55df55a)) ## [5.79.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.5...v5.79.0) (2026-05-14) - ### Features -* add customBaseURL CNAME support to NetworkOptions ([#701](https://github.com/mParticle/mparticle-android-sdk/issues/701)) ([5285149](https://github.com/mParticle/mparticle-android-sdk/commit/5285149118b58cbd5cf4fb90cb58627deb7538b9)), closes [mparticle-apple-sdk#760](https://github.com/mParticle/mparticle-apple-sdk/issues/760) -* Add max persistence age override option [TRIAGE-608] ([#699](https://github.com/mParticle/mparticle-android-sdk/issues/699)) ([ca88322](https://github.com/mParticle/mparticle-android-sdk/commit/ca88322ac7ef8649ed111cf28afb81d99cdb271a)) - +- add customBaseURL CNAME support to NetworkOptions ([#701](https://github.com/mParticle/mparticle-android-sdk/issues/701)) ([5285149](https://github.com/mParticle/mparticle-android-sdk/commit/5285149118b58cbd5cf4fb90cb58627deb7538b9)), closes [mparticle-apple-sdk#760](https://github.com/mParticle/mparticle-apple-sdk/issues/760) +- Add max persistence age override option [TRIAGE-608] ([#699](https://github.com/mParticle/mparticle-android-sdk/issues/699)) ([ca88322](https://github.com/mParticle/mparticle-android-sdk/commit/ca88322ac7ef8649ed111cf28afb81d99cdb271a)) ### Bug Fixes -* increase MPLatch timeout from 5s to 30s ([#695](https://github.com/mParticle/mparticle-android-sdk/issues/695)) ([20f723f](https://github.com/mParticle/mparticle-android-sdk/commit/20f723f27cf296c879ceebc9d234edca039ab371)) - +- increase MPLatch timeout from 5s to 30s ([#695](https://github.com/mParticle/mparticle-android-sdk/issues/695)) ([20f723f](https://github.com/mParticle/mparticle-android-sdk/commit/20f723f27cf296c879ceebc9d234edca039ab371)) ### Updates & Maintenance -* Update submodules ([59a4a9a](https://github.com/mParticle/mparticle-android-sdk/commit/59a4a9a68e3addfaf5c4eea1afd396889721819d)) +- Update submodules ([59a4a9a](https://github.com/mParticle/mparticle-android-sdk/commit/59a4a9a68e3addfaf5c4eea1afd396889721819d)) ## [5.78.5](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.4...v5.78.5) (2026-03-25) - ### Updates & Maintenance -* Update submodules ([86d8d97](https://github.com/mParticle/mparticle-android-sdk/commit/86d8d9748a0c7a796dd0b0be6722f92acef301ea)) +- Update submodules ([86d8d97](https://github.com/mParticle/mparticle-android-sdk/commit/86d8d9748a0c7a796dd0b0be6722f92acef301ea)) ## [5.78.4](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.3...v5.78.4) (2026-03-23) - ### Updates & Maintenance -* Update submodules ([08dab75](https://github.com/mParticle/mparticle-android-sdk/commit/08dab75e3715733f6f5655fbf39fbce16a2e01a2)) +- Update submodules ([08dab75](https://github.com/mParticle/mparticle-android-sdk/commit/08dab75e3715733f6f5655fbf39fbce16a2e01a2)) ## [5.78.3](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.2...v5.78.3) (2026-03-11) - ### Updates & Maintenance -* bump actions/upload-artifact from 6 to 7 ([#649](https://github.com/mParticle/mparticle-android-sdk/issues/649)) ([0a188b1](https://github.com/mParticle/mparticle-android-sdk/commit/0a188b1f88efde471f8d6bff2aa8611b1b4bf956)) -* Update submodules ([cbb17d7](https://github.com/mParticle/mparticle-android-sdk/commit/cbb17d7e359d41d8d7577a9516cf7788c7288442)) +- bump actions/upload-artifact from 6 to 7 ([#649](https://github.com/mParticle/mparticle-android-sdk/issues/649)) ([0a188b1](https://github.com/mParticle/mparticle-android-sdk/commit/0a188b1f88efde471f8d6bff2aa8611b1b4bf956)) +- Update submodules ([cbb17d7](https://github.com/mParticle/mparticle-android-sdk/commit/cbb17d7e359d41d8d7577a9516cf7788c7288442)) ## [5.78.2](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.1...v5.78.2) (2026-02-27) - ### Bug Fixes -* ci - use Gradle properties for SDK version extraction in release ([63b39e7](https://github.com/mParticle/mparticle-android-sdk/commit/63b39e71ec952735ac26bf10dbe4f3968120e371)) +- ci - use Gradle properties for SDK version extraction in release ([63b39e7](https://github.com/mParticle/mparticle-android-sdk/commit/63b39e71ec952735ac26bf10dbe4f3968120e371)) ## [5.78.1](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.0...v5.78.1) (2026-02-27) - ### Updates & Maintenance -* Add AGENTS file ([#646](https://github.com/mParticle/mparticle-android-sdk/issues/646)) ([8e227fd](https://github.com/mParticle/mparticle-android-sdk/commit/8e227fd256d36bdcc92cfd58ecf81806e15d3c56)) -* add isolated kit support for urbanairship-kit ([#647](https://github.com/mParticle/mparticle-android-sdk/issues/647)) ([2b24344](https://github.com/mParticle/mparticle-android-sdk/commit/2b24344cb338e9704a4cce2bc204eb32c8213492)) -* Update submodules ([0200c4c](https://github.com/mParticle/mparticle-android-sdk/commit/0200c4c5b74f17ac55663651e80f6dfae84fe12d)) +- Add AGENTS file ([#646](https://github.com/mParticle/mparticle-android-sdk/issues/646)) ([8e227fd](https://github.com/mParticle/mparticle-android-sdk/commit/8e227fd256d36bdcc92cfd58ecf81806e15d3c56)) +- add isolated kit support for urbanairship-kit ([#647](https://github.com/mParticle/mparticle-android-sdk/issues/647)) ([2b24344](https://github.com/mParticle/mparticle-android-sdk/commit/2b24344cb338e9704a4cce2bc204eb32c8213492)) +- Update submodules ([0200c4c](https://github.com/mParticle/mparticle-android-sdk/commit/0200c4c5b74f17ac55663651e80f6dfae84fe12d)) ## [5.78.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.77.0...v5.78.0) (2026-02-12) - ### Features -* Add PlacementOptions support to Rokt integration ([#639](https://github.com/mParticle/mparticle-android-sdk/issues/639)) ([61cc472](https://github.com/mParticle/mparticle-android-sdk/commit/61cc472fc42c0871380345cc74ba57a4d949310c)) - +- Add PlacementOptions support to Rokt integration ([#639](https://github.com/mParticle/mparticle-android-sdk/issues/639)) ([61cc472](https://github.com/mParticle/mparticle-android-sdk/commit/61cc472fc42c0871380345cc74ba57a4d949310c)) ### Updates & Maintenance -* Update submodules ([91191f6](https://github.com/mParticle/mparticle-android-sdk/commit/91191f64db292fe6a58de2c8ba1cd786e0e0a509)) +- Update submodules ([91191f6](https://github.com/mParticle/mparticle-android-sdk/commit/91191f64db292fe6a58de2c8ba1cd786e0e0a509)) ## [5.77.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.76.1...v5.77.0) (2026-02-03) - ### Features -* Add support for Get / Set SessionId on Rokt ([#645](https://github.com/mParticle/mparticle-android-sdk/issues/645)) ([2956a05](https://github.com/mParticle/mparticle-android-sdk/commit/2956a0547f93914e89e34c70f22820f0a3ea26ba)) - +- Add support for Get / Set SessionId on Rokt ([#645](https://github.com/mParticle/mparticle-android-sdk/issues/645)) ([2956a05](https://github.com/mParticle/mparticle-android-sdk/commit/2956a0547f93914e89e34c70f22820f0a3ea26ba)) ### Bug Fixes -* Validate js-sdk-file input for Gradle 8 compatibility ([#644](https://github.com/mParticle/mparticle-android-sdk/issues/644)) ([2725387](https://github.com/mParticle/mparticle-android-sdk/commit/2725387df98c77dff9bf251fb528fc8241f4409c)) - +- Validate js-sdk-file input for Gradle 8 compatibility ([#644](https://github.com/mParticle/mparticle-android-sdk/issues/644)) ([2725387](https://github.com/mParticle/mparticle-android-sdk/commit/2725387df98c77dff9bf251fb528fc8241f4409c)) ### Updates & Maintenance -* Update submodules ([d5d503f](https://github.com/mParticle/mparticle-android-sdk/commit/d5d503fe8443222777d08bbe667696402753a8b8)) +- Update submodules ([d5d503f](https://github.com/mParticle/mparticle-android-sdk/commit/d5d503fe8443222777d08bbe667696402753a8b8)) ## [5.76.1](https://github.com/mParticle/mparticle-android-sdk/compare/v5.76.0...v5.76.1) (2026-01-29) - ### Updates & Maintenance -* bump actions/checkout from 6.0.1 to 6.0.2 ([#641](https://github.com/mParticle/mparticle-android-sdk/issues/641)) ([227b421](https://github.com/mParticle/mparticle-android-sdk/commit/227b4218fef761a82fe10ca0e0fdd5668b0f4979)) -* Update submodules ([e6dbcb8](https://github.com/mParticle/mparticle-android-sdk/commit/e6dbcb8f57d491d1e43457dca2f44b192ad5be29)) +- bump actions/checkout from 6.0.1 to 6.0.2 ([#641](https://github.com/mParticle/mparticle-android-sdk/issues/641)) ([227b421](https://github.com/mParticle/mparticle-android-sdk/commit/227b4218fef761a82fe10ca0e0fdd5668b0f4979)) +- Update submodules ([e6dbcb8](https://github.com/mParticle/mparticle-android-sdk/commit/e6dbcb8f57d491d1e43457dca2f44b192ad5be29)) ## [5.76.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.75.1...v5.76.0) (2026-01-27) - ### Features -* Add trunk rule to detect mParticle API keys ([#633](https://github.com/mParticle/mparticle-android-sdk/issues/633)) ([3f3c79f](https://github.com/mParticle/mparticle-android-sdk/commit/3f3c79faf8b6ee8bff407428c8f11839e75faa2e)) -* Update Android Gradle plugin to 8.1.0 ([#575](https://github.com/mParticle/mparticle-android-sdk/issues/575)) ([fc6a25d](https://github.com/mParticle/mparticle-android-sdk/commit/fc6a25d354d180fc2e7a59e2a80b57880c608891)) - +- Add trunk rule to detect mParticle API keys ([#633](https://github.com/mParticle/mparticle-android-sdk/issues/633)) ([3f3c79f](https://github.com/mParticle/mparticle-android-sdk/commit/3f3c79faf8b6ee8bff407428c8f11839e75faa2e)) +- Update Android Gradle plugin to 8.1.0 ([#575](https://github.com/mParticle/mparticle-android-sdk/issues/575)) ([fc6a25d](https://github.com/mParticle/mparticle-android-sdk/commit/fc6a25d354d180fc2e7a59e2a80b57880c608891)) ### Bug Fixes -* Align ktlint rules for kits with Android Studio defaults ([#640](https://github.com/mParticle/mparticle-android-sdk/issues/640)) ([e5484a0](https://github.com/mParticle/mparticle-android-sdk/commit/e5484a0fcafed11852c580c6f3cc5e27db0934fb)) -* migrate all generic logs to Logger class ([#630](https://github.com/mParticle/mparticle-android-sdk/issues/630)) ([9c9cb33](https://github.com/mParticle/mparticle-android-sdk/commit/9c9cb338424bf2f95038ed2456014f12bb7fe9b3)) -* Override ktlint rules for kits to avoid editorconfig conflicts ([#642](https://github.com/mParticle/mparticle-android-sdk/issues/642)) ([e31027a](https://github.com/mParticle/mparticle-android-sdk/commit/e31027a9fe70f483fd188a97641aa53fffeddbb3)) - +- Align ktlint rules for kits with Android Studio defaults ([#640](https://github.com/mParticle/mparticle-android-sdk/issues/640)) ([e5484a0](https://github.com/mParticle/mparticle-android-sdk/commit/e5484a0fcafed11852c580c6f3cc5e27db0934fb)) +- migrate all generic logs to Logger class ([#630](https://github.com/mParticle/mparticle-android-sdk/issues/630)) ([9c9cb33](https://github.com/mParticle/mparticle-android-sdk/commit/9c9cb338424bf2f95038ed2456014f12bb7fe9b3)) +- Override ktlint rules for kits to avoid editorconfig conflicts ([#642](https://github.com/mParticle/mparticle-android-sdk/issues/642)) ([e31027a](https://github.com/mParticle/mparticle-android-sdk/commit/e31027a9fe70f483fd188a97641aa53fffeddbb3)) ### Updates & Maintenance -* bump actions/cache from 4 to 5 ([#635](https://github.com/mParticle/mparticle-android-sdk/issues/635)) ([fb471fa](https://github.com/mParticle/mparticle-android-sdk/commit/fb471fa5ffec283a03fd629ee2758262a726582e)) -* bump actions/checkout from 5 to 6 ([#631](https://github.com/mParticle/mparticle-android-sdk/issues/631)) ([a0b2442](https://github.com/mParticle/mparticle-android-sdk/commit/a0b24424aaa43808a4fdac028d82cc4db8d40262)) -* bump actions/checkout from 5.0.0 to 6.0.1 ([#637](https://github.com/mParticle/mparticle-android-sdk/issues/637)) ([449a0b5](https://github.com/mParticle/mparticle-android-sdk/commit/449a0b5c22293bfe21336002cf2835eb81c8a1af)) -* bump actions/setup-java from 4 to 5 ([#625](https://github.com/mParticle/mparticle-android-sdk/issues/625)) ([46823b8](https://github.com/mParticle/mparticle-android-sdk/commit/46823b8d1174bdb5345483ab43407bbe82e34f88)) -* bump actions/upload-artifact from 5 to 6 ([#636](https://github.com/mParticle/mparticle-android-sdk/issues/636)) ([05f6133](https://github.com/mParticle/mparticle-android-sdk/commit/05f6133f5e69f1bc1d331fd4772e8f4134fec539)) -* Remove empty workflow file ([#634](https://github.com/mParticle/mparticle-android-sdk/issues/634)) ([0780abd](https://github.com/mParticle/mparticle-android-sdk/commit/0780abd0387a4b8281e0c8432180813719f080ad)) -* Update submodules ([d6bf37f](https://github.com/mParticle/mparticle-android-sdk/commit/d6bf37f7ad63f467efeb7c706c40841be48fbc5b)) +- bump actions/cache from 4 to 5 ([#635](https://github.com/mParticle/mparticle-android-sdk/issues/635)) ([fb471fa](https://github.com/mParticle/mparticle-android-sdk/commit/fb471fa5ffec283a03fd629ee2758262a726582e)) +- bump actions/checkout from 5 to 6 ([#631](https://github.com/mParticle/mparticle-android-sdk/issues/631)) ([a0b2442](https://github.com/mParticle/mparticle-android-sdk/commit/a0b24424aaa43808a4fdac028d82cc4db8d40262)) +- bump actions/checkout from 5.0.0 to 6.0.1 ([#637](https://github.com/mParticle/mparticle-android-sdk/issues/637)) ([449a0b5](https://github.com/mParticle/mparticle-android-sdk/commit/449a0b5c22293bfe21336002cf2835eb81c8a1af)) +- bump actions/setup-java from 4 to 5 ([#625](https://github.com/mParticle/mparticle-android-sdk/issues/625)) ([46823b8](https://github.com/mParticle/mparticle-android-sdk/commit/46823b8d1174bdb5345483ab43407bbe82e34f88)) +- bump actions/upload-artifact from 5 to 6 ([#636](https://github.com/mParticle/mparticle-android-sdk/issues/636)) ([05f6133](https://github.com/mParticle/mparticle-android-sdk/commit/05f6133f5e69f1bc1d331fd4772e8f4134fec539)) +- Remove empty workflow file ([#634](https://github.com/mParticle/mparticle-android-sdk/issues/634)) ([0780abd](https://github.com/mParticle/mparticle-android-sdk/commit/0780abd0387a4b8281e0c8432180813719f080ad)) +- Update submodules ([d6bf37f](https://github.com/mParticle/mparticle-android-sdk/commit/d6bf37f7ad63f467efeb7c706c40841be48fbc5b)) ## [5.75.1](https://github.com/mParticle/mparticle-android-sdk/compare/v5.75.0...v5.75.1) (2025-11-20) - ### Updates & Maintenance -* restore rokt-kit submodule ([#629](https://github.com/mParticle/mparticle-android-sdk/issues/629)) ([6bd0fba](https://github.com/mParticle/mparticle-android-sdk/commit/6bd0fbae72d1f587deb32fdda60612c0f90c6540)) +- restore rokt-kit submodule ([#629](https://github.com/mParticle/mparticle-android-sdk/issues/629)) ([6bd0fba](https://github.com/mParticle/mparticle-android-sdk/commit/6bd0fbae72d1f587deb32fdda60612c0f90c6540)) ## [5.75.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.74.3...v5.75.0) (2025-11-20) - ### Features -* Implement Trunk tool ([#604](https://github.com/mParticle/mparticle-android-sdk/issues/604)) ([d02a125](https://github.com/mParticle/mparticle-android-sdk/commit/d02a1252ef7d08513cbdb8e53cd759755be2ef5d)) - +- Implement Trunk tool ([#604](https://github.com/mParticle/mparticle-android-sdk/issues/604)) ([d02a125](https://github.com/mParticle/mparticle-android-sdk/commit/d02a1252ef7d08513cbdb8e53cd759755be2ef5d)) ### Updates & Maintenance -* add token to checkout step for regression branch pushes ([#627](https://github.com/mParticle/mparticle-android-sdk/issues/627)) ([afe965e](https://github.com/mParticle/mparticle-android-sdk/commit/afe965edd8ec1eda5ca1864e0df0dde535092567)) -* bump andymckay/cancel-action from 435124153eb37d6a62a29d053a7e449652f89d51 to a955d435292c0d409d104b57d8e78435a93a6ef1 ([#624](https://github.com/mParticle/mparticle-android-sdk/issues/624)) ([2f1644a](https://github.com/mParticle/mparticle-android-sdk/commit/2f1644a5a88053f60cb5696ff471fcfd9b1a4321)) -* bump reactivecircus/android-emulator-runner from 2.34.0 to 2.35.0 ([#626](https://github.com/mParticle/mparticle-android-sdk/issues/626)) ([8f4b392](https://github.com/mParticle/mparticle-android-sdk/commit/8f4b3927b63cd8dd80e6ae703f50ad49982de634)) -* update permissions to allow branch push and delete operations ([#628](https://github.com/mParticle/mparticle-android-sdk/issues/628)) ([d66079d](https://github.com/mParticle/mparticle-android-sdk/commit/d66079dc78ad8dbe8ab09415bf9a5af43528b4aa)) +- add token to checkout step for regression branch pushes ([#627](https://github.com/mParticle/mparticle-android-sdk/issues/627)) ([afe965e](https://github.com/mParticle/mparticle-android-sdk/commit/afe965edd8ec1eda5ca1864e0df0dde535092567)) +- bump andymckay/cancel-action from 435124153eb37d6a62a29d053a7e449652f89d51 to a955d435292c0d409d104b57d8e78435a93a6ef1 ([#624](https://github.com/mParticle/mparticle-android-sdk/issues/624)) ([2f1644a](https://github.com/mParticle/mparticle-android-sdk/commit/2f1644a5a88053f60cb5696ff471fcfd9b1a4321)) +- bump reactivecircus/android-emulator-runner from 2.34.0 to 2.35.0 ([#626](https://github.com/mParticle/mparticle-android-sdk/issues/626)) ([8f4b392](https://github.com/mParticle/mparticle-android-sdk/commit/8f4b3927b63cd8dd80e6ae703f50ad49982de634)) +- update permissions to allow branch push and delete operations ([#628](https://github.com/mParticle/mparticle-android-sdk/issues/628)) ([d66079d](https://github.com/mParticle/mparticle-android-sdk/commit/d66079dc78ad8dbe8ab09415bf9a5af43528b4aa)) ## [5.74.3](https://github.com/mParticle/mparticle-android-sdk/compare/v5.74.2...v5.74.3) (2025-11-04) - ### Updates & Maintenance -* Add step to ensure deployment visibility ([#611](https://github.com/mParticle/mparticle-android-sdk/issues/611)) ([9b5af9e](https://github.com/mParticle/mparticle-android-sdk/commit/9b5af9e2ddc761dfe8552d5801fe1bac38df2a8e)) -* bump actions/cache from 3 to 4 ([#622](https://github.com/mParticle/mparticle-android-sdk/issues/622)) ([7c46e93](https://github.com/mParticle/mparticle-android-sdk/commit/7c46e9320bc94f1ce72c9786fdcca0ddd89dd661)) -* bump actions/checkout from 3 to 5 ([#617](https://github.com/mParticle/mparticle-android-sdk/issues/617)) ([59fd344](https://github.com/mParticle/mparticle-android-sdk/commit/59fd34423643f25aea5b0e5aac35256d789e7c86)) -* bump actions/upload-artifact from 4 to 5 ([#614](https://github.com/mParticle/mparticle-android-sdk/issues/614)) ([d4f7882](https://github.com/mParticle/mparticle-android-sdk/commit/d4f788229a363fd150a9f43895d8e32425db0f64)) -* bump crazy-max/ghaction-import-gpg from 6.0.0 to 6.3.0 ([#615](https://github.com/mParticle/mparticle-android-sdk/issues/615)) ([8881009](https://github.com/mParticle/mparticle-android-sdk/commit/88810095bd87f945d8476c66999b54aead05c758)) -* bump reactivecircus/android-emulator-runner from 2.33.0 to 2.34.0 ([#623](https://github.com/mParticle/mparticle-android-sdk/issues/623)) ([15a16a8](https://github.com/mParticle/mparticle-android-sdk/commit/15a16a8275f29bb0f4e7a6239bed5d88d7c969f5)) -* Enable Dependabot for Github Actions ([#608](https://github.com/mParticle/mparticle-android-sdk/issues/608)) ([0174ff2](https://github.com/mParticle/mparticle-android-sdk/commit/0174ff2483636bd519f2f597aefc2d19f4db9d5c)) -* Remove target branch check ([#610](https://github.com/mParticle/mparticle-android-sdk/issues/610)) ([ac69641](https://github.com/mParticle/mparticle-android-sdk/commit/ac696417774da8c1f30593bc8c1b5d0e01f0c18a)) -* Update submodules ([ec57498](https://github.com/mParticle/mparticle-android-sdk/commit/ec57498a5fc007a2f99f3183046093452d8d461e)) +- Add step to ensure deployment visibility ([#611](https://github.com/mParticle/mparticle-android-sdk/issues/611)) ([9b5af9e](https://github.com/mParticle/mparticle-android-sdk/commit/9b5af9e2ddc761dfe8552d5801fe1bac38df2a8e)) +- bump actions/cache from 3 to 4 ([#622](https://github.com/mParticle/mparticle-android-sdk/issues/622)) ([7c46e93](https://github.com/mParticle/mparticle-android-sdk/commit/7c46e9320bc94f1ce72c9786fdcca0ddd89dd661)) +- bump actions/checkout from 3 to 5 ([#617](https://github.com/mParticle/mparticle-android-sdk/issues/617)) ([59fd344](https://github.com/mParticle/mparticle-android-sdk/commit/59fd34423643f25aea5b0e5aac35256d789e7c86)) +- bump actions/upload-artifact from 4 to 5 ([#614](https://github.com/mParticle/mparticle-android-sdk/issues/614)) ([d4f7882](https://github.com/mParticle/mparticle-android-sdk/commit/d4f788229a363fd150a9f43895d8e32425db0f64)) +- bump crazy-max/ghaction-import-gpg from 6.0.0 to 6.3.0 ([#615](https://github.com/mParticle/mparticle-android-sdk/issues/615)) ([8881009](https://github.com/mParticle/mparticle-android-sdk/commit/88810095bd87f945d8476c66999b54aead05c758)) +- bump reactivecircus/android-emulator-runner from 2.33.0 to 2.34.0 ([#623](https://github.com/mParticle/mparticle-android-sdk/issues/623)) ([15a16a8](https://github.com/mParticle/mparticle-android-sdk/commit/15a16a8275f29bb0f4e7a6239bed5d88d7c969f5)) +- Enable Dependabot for Github Actions ([#608](https://github.com/mParticle/mparticle-android-sdk/issues/608)) ([0174ff2](https://github.com/mParticle/mparticle-android-sdk/commit/0174ff2483636bd519f2f597aefc2d19f4db9d5c)) +- Remove target branch check ([#610](https://github.com/mParticle/mparticle-android-sdk/issues/610)) ([ac69641](https://github.com/mParticle/mparticle-android-sdk/commit/ac696417774da8c1f30593bc8c1b5d0e01f0c18a)) +- Update submodules ([ec57498](https://github.com/mParticle/mparticle-android-sdk/commit/ec57498a5fc007a2f99f3183046093452d8d461e)) ## [5.74.2](https://github.com/mParticle/mparticle-android-sdk/compare/v5.74.1...v5.74.2) (2025-10-28) - ### Updates & Maintenance -* Update submodules ([c0b4106](https://github.com/mParticle/mparticle-android-sdk/commit/c0b4106618780ee0e80bff12ce9a042c19da81dc)) +- Update submodules ([c0b4106](https://github.com/mParticle/mparticle-android-sdk/commit/c0b4106618780ee0e80bff12ce9a042c19da81dc)) ## [5.74.1](https://github.com/mParticle/mparticle-android-sdk/compare/v5.74.0...v5.74.1) (2025-10-21) - ### Bug Fixes -* Add proguard rules to prevent stripping of Rokt class ([#607](https://github.com/mParticle/mparticle-android-sdk/issues/607)) ([18ef17b](https://github.com/mParticle/mparticle-android-sdk/commit/18ef17bdf23e388f736814b5d9f579af3258229c)) - +- Add proguard rules to prevent stripping of Rokt class ([#607](https://github.com/mParticle/mparticle-android-sdk/issues/607)) ([18ef17b](https://github.com/mParticle/mparticle-android-sdk/commit/18ef17bdf23e388f736814b5d9f579af3258229c)) ### Updates & Maintenance -* Change release to use main branch ([#609](https://github.com/mParticle/mparticle-android-sdk/issues/609)) ([7d41cc3](https://github.com/mParticle/mparticle-android-sdk/commit/7d41cc3230ea4df8f6d4b639414e5afa66705828)) -* Update submodules ([e233046](https://github.com/mParticle/mparticle-android-sdk/commit/e233046a09d4de845d4cf4a7bf75d03dcb12aa3b)) +- Change release to use main branch ([#609](https://github.com/mParticle/mparticle-android-sdk/issues/609)) ([7d41cc3](https://github.com/mParticle/mparticle-android-sdk/commit/7d41cc3230ea4df8f6d4b639414e5afa66705828)) +- Update submodules ([e233046](https://github.com/mParticle/mparticle-android-sdk/commit/e233046a09d4de845d4cf4a7bf75d03dcb12aa3b)) ## [5.74.0](https://github.com/mParticle/mparticle-android-sdk/compare/v5.73.2...v5.74.0) (2025-09-23) diff --git a/android-core/src/main/java/com/mparticle/MParticle.java b/android-core/src/main/java/com/mparticle/MParticle.java index 26d07c2d4..a8c2f955f 100644 --- a/android-core/src/main/java/com/mparticle/MParticle.java +++ b/android-core/src/main/java/com/mparticle/MParticle.java @@ -20,6 +20,7 @@ import androidx.annotation.RequiresApi; import com.mparticle.commerce.CommerceEvent; +import com.mparticle.consent.ConsentState; import com.mparticle.identity.IdentityApi; import com.mparticle.identity.IdentityApiRequest; import com.mparticle.identity.IdentityApiResult; @@ -911,6 +912,48 @@ public void setOptOut(@NonNull Boolean optOutStatus) { } } + /** + * Query the device-level consent state. + *

+ * Device-level consent, when set, overrides MPID-based consent when applying consent forwarding + * rules and uploading events. + * + * @return the device-level consent state, or an empty state if none has been set + */ + @NonNull + public ConsentState getDeviceConsentState() { + return mConfigManager.getDeviceConsentState(); + } + + /** + * Set the device-level consent state. + *

+ * Device-level consent overrides MPID-based consent when applying consent forwarding rules + * and uploading events. Pass {@code null} to clear the device-level override and fall back to + * MPID-based consent. + * + * @param state the device-level consent state, or {@code null} to clear the override + */ + public void setDeviceConsentState(@Nullable ConsentState state) { + ConsentState oldState = mConfigManager.getEffectiveConsentState(mConfigManager.getMpid()); + mConfigManager.setDeviceConsentState(state); + ConsentState newState = mConfigManager.getEffectiveConsentState(mConfigManager.getMpid()); + mKitManager.onConsentStateUpdated(oldState, newState, mConfigManager.getMpid()); + } + + /** + * Query whether device-based consent is enabled. + *

+ * When enabled, {@link com.mparticle.identity.MParticleUser#setConsentState(ConsentState)} + * also persists consent at the device level. + * + * @return true if device-based consent is enabled + */ + @NonNull + public Boolean isDeviceBasedConsentEnabled() { + return mConfigManager.isDeviceBasedConsentEnabled(); + } + /** * Retrieve a URL to be loaded within a {@link WebView} to show the user a survey * or feedback form. diff --git a/android-core/src/main/java/com/mparticle/MParticleOptions.java b/android-core/src/main/java/com/mparticle/MParticleOptions.java index 3b4002224..2e068d8d2 100644 --- a/android-core/src/main/java/com/mparticle/MParticleOptions.java +++ b/android-core/src/main/java/com/mparticle/MParticleOptions.java @@ -38,6 +38,7 @@ public class MParticleOptions { private String mApiSecret; private IdentityApiRequest mIdentifyRequest; private Boolean mDevicePerformanceMetricsDisabled = false; + private Boolean mDeviceBasedConsentEnabled = false; private Boolean mAndroidIdEnabled = false; private Integer mUploadInterval = ConfigManager.DEFAULT_UPLOAD_INTERVAL; //seconds private Integer mSessionTimeout = ConfigManager.DEFAULT_SESSION_TIMEOUT_SECONDS; //seconds @@ -93,6 +94,9 @@ public MParticleOptions(@NonNull Builder builder) { if (builder.devicePerformanceMetricsDisabled != null) { this.mDevicePerformanceMetricsDisabled = builder.devicePerformanceMetricsDisabled; } + if (builder.deviceBasedConsentEnabled != null) { + this.mDeviceBasedConsentEnabled = builder.deviceBasedConsentEnabled; + } if (builder.androidIdEnabled != null) { this.mAndroidIdEnabled = builder.androidIdEnabled; } @@ -254,6 +258,20 @@ public Boolean isDevicePerformanceMetricsDisabled() { return mDevicePerformanceMetricsDisabled; } + /** + * Query whether device-based consent is enabled. + *

+ * When enabled, {@link com.mparticle.identity.MParticleUser#setConsentState(ConsentState)} + * will persist consent at the device level in addition to the current MPID. Device-level + * consent overrides MPID-based consent when applying consent forwarding rules and uploading events. + * + * @return true if device-based consent is enabled + */ + @NonNull + public Boolean isDeviceBasedConsentEnabled() { + return mDeviceBasedConsentEnabled; + } + /** * @return true if collection is disabled, false if it is enabled * @deprecated This method has been replaced as the behavior has been inverted - Android ID collection is now disabled by default. @@ -423,6 +441,7 @@ public static class Builder { private MParticle.Environment environment; private IdentityApiRequest identifyRequest; private Boolean devicePerformanceMetricsDisabled = null; + private Boolean deviceBasedConsentEnabled = null; private Boolean androidIdEnabled = null; private Integer uploadInterval = null; private Integer sessionTimeout = null; @@ -570,6 +589,23 @@ public Builder devicePerformanceMetricsDisabled(boolean disabled) { return this; } + /** + * Enable device-based consent. + *

+ * When enabled, consent set via {@link com.mparticle.identity.MParticleUser#setConsentState(ConsentState)} + * is stored at the device level and overrides MPID-based consent when applying consent forwarding + * rules and uploading events. This is useful when consent is collected before the user's MPID is known + * or when the MPID changes during a flow such as checkout. + * + * @param enabled true to enable device-based consent + * @return the instance of the builder, for chaining calls + */ + @NonNull + public Builder deviceBasedConsentEnabled(boolean enabled) { + this.deviceBasedConsentEnabled = enabled; + return this; + } + /** * @param disabled false to enable collection (true by default) * @return the instance of the builder, for chaining calls diff --git a/android-core/src/main/java/com/mparticle/identity/MParticleUserDelegate.java b/android-core/src/main/java/com/mparticle/identity/MParticleUserDelegate.java index 4f78591c5..f3d98a1e9 100644 --- a/android-core/src/main/java/com/mparticle/identity/MParticleUserDelegate.java +++ b/android-core/src/main/java/com/mparticle/identity/MParticleUserDelegate.java @@ -276,13 +276,17 @@ boolean setUser(Context context, long previousMpid, long newMpid, Map