:library:feature:privacy
Purpose
Owns the privacy and legal preference surface: policy links, the host destinations reached from it, and the strings that name them.
Owns
Feature event builders and their bounded keys in
ui/analytics; screens only report events.PrivacyScreen, the data-driven privacy and legal preference list, which opens each row's link or page, andPrivacyScreenContent, the stateless list with its loading and failure states.Its rows in the settings search, a
settingsSearchProviderbound asprivacy: permissions, ads and usage and diagnostics, each naming the page it opens instead of the privacy page.PrivacyViewModel,PrivacyUiState(whoseitemsis aLoadable),PrivacyEventandPrivacyItem.PrivacySettingsProvider, the host contract supplying the legal URLs.privacySettingsPage(), the registration ofPrivacySettingsRouteas a detail of the settings list.Being the page Android's permission manager and privacy dashboard open from the information icon beside the app.
PermissionUsageActivityin:library:apptoolkitshows it on its own, with the pages it links to, over the system's settings.Privacy, legal, ads, permissions, and usage-and-diagnostics strings.
Does not own
The ads, permissions, and usage-and-diagnostics pages, owned by
:library:integration:ads,:library:feature:permissionsand:library:feature:diagnostics. This list opens them by key.The settings list whose row opens this page, owned by
:library:feature:settings.Consent collection, owned by
:library:integration:consent.
Depends on
:library:core:commonand:library:core:uifor shared state, platform helpers, Compose and, through:library:core:ui, the keys and graph builder of:library:navigation.No other feature or integration module.
Used by
:library:apptoolkit, which callsprivacySettingsPage()fromtoolkitPages(), and:sample:core:apptoolkit, which binds a default provider.
Flow chart
flowchart TD
Page[privacySettingsPage: PrivacySettingsRoute] --> Screen[PrivacyScreen]
Screen --> VM[PrivacyViewModel]
VM --> Provider[PrivacySettingsProvider]
VM --> Mapper[PrivacyMappers to PrivacyItem list]
Mapper --> State[Loadable: Loading / Ready / Failed]
State --> Content[PrivacyScreenContent]
Content -->|row tapped| Click[PrivacyEvent.ItemClicked, reported]
Click --> VM
Content -->|link row| OpenUrl[onOpenUrl: device browser]
Content -->|page row| Navigate[navigator.navigate: Permissions / ads / diagnostics keys]Architectural decisions
The list is data-driven:
PrivacyViewModelmaps the host-suppliedPrivacySettingsProviderinto an ordered list ofPrivacyItemmodels with pre-computed card positions, so the composable stays declarative and the entries are testable without Compose.The page is on
core.ui.screen.PrivacyUiState.itemsis aLoadable: the rows areReadyonce built, and a provider that throws isLoadable.Failed, reported to telemetry, with a retry. The provider only returns URLs, so the ViewModel takes no dispatcher.Opening a URL needs a
Context, and opening a page needs the shell's navigator, soPrivacyScreendoes both from callbacks of the statelessPrivacyScreenContent:onOpenUrl,onOpenPermissions,onOpenAdsandonOpenUsageAndDiagnostics. The ViewModel does not navigate. A tap still reaches it asPrivacyEvent.ItemClicked, which it reports as theopenPrivacyItemoperation the dashboards already count.The permissions, ads and diagnostics rows open their Toolkit keys, so the provider supplies no callback for each, and an app replaces one of those pages by registering its key.
Provider URLs keep interface defaults from
AppLinks, so a host overrides only the links it actually changes.
Public contracts
PrivacySettingsProvider,PrivacyScreen,PrivacyViewModel,PrivacyUiState,PrivacyItem,PrivacyItemAction,PrivacyEvent,privacySettingsPage()andprivacyModule.PrivacyScreenContentis internal.
Internal implementations
Privacy item assembly with grouped card position calculation, and preference tap analytics.
Current risks
The permissions, ads and diagnostics rows are always listed. An app without one of those pages has to register its own page for the key, or the row opens nothing.