:library:core:common
Purpose
Holds low-level contracts, domain result types, host configuration, dispatchers, constants, and Android utility abstractions shared across the toolkit.
Owns
AdsSettingsRepositoryandOnboardingRepository, SDK-neutral contracts consumed across modules.BuildInfoRepositoryand itsDefaultBuildInfoRepository, backed by the host build configuration.InstalledAppsRepositoryand its system-backed default own single/batch installation checks,AppInstallInfowith sharedAppVersionMetadata, launcher intents, and API 33+ launch tokens. Every lookup is main-safe; the repository owns the IO switch and keeps cancellation intact.AdMobAppIdDataSourceandManifestAdMobAppIdDataSourceindata/local: the shared host manifest contract and its cached, main-safe platform implementation.Analytics and billing value models, and the application-facing theme preference model.
ClipboardRepositoryand its system-backedDefaultClipboardRepository, so a ViewModel copies text without holding aContext. It also says whether the system confirms copies itself.The failures the data layer throws:
NetworkExceptionandStorageException, each with areason. Translating into them belongs to:library:core:networkand:library:core:datastore, and the text a screen shows for them to:library:core:ui.The vendor-neutral telemetry contracts in
core.common.telemetry, split by responsibility:AnalyticsReporter(GA4 events, screen views, user properties),DiagnosticsReporter(breadcrumbs and non-fatal reports) andTelemetryCollection(the consent-driven collection switches).TelemetryRepositoryis all three, for the UI layer;telemetryModulebinds the three to the app's oneTelemetryRepository. The analytics models are intelemetry.models, withTrackedScreen, the stable name and class of a screen thatScreenHostreports.BillingCore, dispatcher, build-info, app-info, permissions, and ad-SDK contracts.Host DI configuration (
AppToolkitHostBuildConfig, qualifiers, and constants).Small platform and Kotlin extensions used across modules. An extension or constant that one module uses lives in that module instead: FAQ, changelog, issue reporter, billing, ads and review each own theirs.
The Play Integrity license-check manifest permission required by the shared App Check setup.
The
App Nameplaceholders forapp_nameandapp_full_name, plus the default copyright resource used by toolkit UI. A host replaces the name resources with its application identity.
Does not own
DataStore implementations, owned by
:library:core:datastore.HTTP clients and network error mapping, owned by
:library:core:network.Compose state and components, owned by
:library:core:ui.Firebase and Billing SDK implementations, owned by their integration modules.
Depends on
No internal Gradle modules. This is the bottom shared runtime dependency for most toolkit modules.
Used by
:sampleand:library:apptoolkitfor host and toolkit contracts.:library:core:datastore,:library:core:network,:library:core:ui, and:library:core:designsystem.:library:feature:about,:library:feature:faq,:library:feature:issuereporter,:library:feature:onboarding,:library:feature:permissions,:library:feature:settings,:library:feature:startup, and:library:feature:support.:library:integration:ads,:library:integration:billing,:library:integration:consent,:library:integration:firebase,:library:integration:review, and:library:integration:update.
:library:navigation also depends on this module for shared sizing constants. The implicit :library:core parent has no dependencies.
Flow chart
flowchart TD
Host[Host application] --> Config[AppToolkitHostBuildConfig]
Android[Android platform] --> Helpers[App / permission / text helpers]
Config --> Contracts[SDK-neutral contracts and qualifiers]
Helpers --> Contracts
Dispatchers[DispatcherProvider] --> Consumers[Core, feature, integration, and navigation modules]
Contracts --> Consumers
Models[Theme / analytics / billing values] --> Consumers
Consumers --> Implementations[Datastore, Firebase, Billing, UI implementations]
Implementations -. implement .-> ContractsArchitectural decisions
Analytics belong to the UI layer; diagnostics belong everywhere. Code under
data/anddomain/takesDiagnosticsReporter, andTelemetryCollectionwhere it applies consent, neverAnalyticsReporterorTelemetryRepository. A repository returns its outcome, and the screen or ViewModel that asked reports the product event. Breadcrumbs and non-fatal reports stay in repositories, because a background failure that never reaches a screen still has to be seen.checkModuleBoundariesenforces this, with:library:integration:firebaseas the one module allowed to name analytics from its data layer, because it implements them.commonis the lowest shared production boundary, so it defines narrow SDK-neutral contracts while concrete Firebase, Billing, persistence, and UI implementations live above it.Android helpers remain behind small interfaces when tests or host substitution need a boundary; pure constants and extensions stay concrete.
Shared models are added only when two layers genuinely exchange the same value. Persistence and presentation-specific representations remain in their owning modules.
The manifest AdMob ID is the only ads identity source; a library fallback would silently bind a host to the wrong publisher account.
Package version metadata
AppVersionMetadata and PackageManager.getVersionMetadata expose nullable version names and long version codes without a UI model. Issue Reporter and the sample installed-app source share this lookup. Unavailable, hidden, or unreadable packages return null. getVersionMetadata is a blocking PackageManager call, so data-layer callers switch to dispatchers.io around it.
Public contracts
TelemetryRepository,AnalyticsReporter,DiagnosticsReporter,TelemetryCollection,telemetryModule,BillingCore,DispatcherProvider, and provider/helper interfaces.AppToolkitHostBuildConfig, DI qualifiers, common result/value models, and stable constants.core.common.data.models.theme.ThemePreferencesState, the immutable application-facing representation shared by persistence and theme UI.
Internal implementations
StandardDispatchers,AppToolkitApplication, small Android adapters, extensions, and crash guards.
Current risks
The module has a broad surface spanning domain values, Android helpers, DI metadata, ads, billing, and Firebase contracts. That breadth makes it easy for unrelated concerns to accumulate in the lowest-level dependency.
Migration notes
The commented DataStore dependency in the Gradle file records that common -> datastore was removed to break a circular dependency. Keep persistence implementations above the contracts defined here.
Host AdMob ID and UMP crash guard
The toolkit once shipped a demo R.string.ad_mob_app_id. A host using a differently named resource did not override it, so consent and Mobile Ads initialization could silently target the demo publisher account. The current contract deliberately prevents that regression:
com.google.android.gms.ads.APPLICATION_IDin the host application's manifest is the single source of truth. The referenced resource may have any name.ManifestAdMobAppIdDataSourcereads application metadata throughPackageManager, accepts onlyca-app-pub-[0-9]{16}~[0-9]{10}, and returnsnullfor missing or malformed values.There must be no library fallback AdMob application ID. The sample/demo ID belongs only to the sample application.
Hosts should let the
:library:integration:adsAppOpenAdControllerinitialize Mobile Ads; separate initialization with another ID can recreate the mismatch.
UMP 4.0.0 can also throw NoSuchElementException from Scanner.next() on its executor when a metrics error response has an empty body. ConsentSdkCrashGuard is installed by AppToolkitApplication immediately after Firebase initialization so it wraps the Crashlytics handler. It suppresses only a non-main-thread NoSuchElementException whose stack contains both java.util.Scanner and com.google.android.gms.internal.consent_sdk; every other throwable is delegated unchanged. The suppressed telemetry failure is recorded through DiagnosticsReporter.recordNonFatal.
Hosts may opt out by overriding installsConsentSdkCrashGuard with false. Do not broaden the guard predicate, and do not remove the guard until the affected UMP artifact behavior is verified as fixed. AdMobAppIdDataSourceTest and ConsentSdkCrashGuardTest protect these contracts.
Data API migration
BuildInfoProvider is replaced by data.repositories.BuildInfoRepository; its properties still represent the host's fixed build values, with no platform I/O. The Toolkit graph supplies the default.
AdMobAppIdProvider and its manifest implementation are replaced by data.local.AdMobAppIdDataSource and ManifestAdMobAppIdDataSource. Reading the ID is now suspending so the source can own the IO switch. Hosts providing a replacement update their binding directly.
AppInfoHelper is removed. Use InstalledAppsRepository for data queries and core UI's AppLauncher when launching with the Toolkit's failure feedback.