Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin: Set required client_info fields first #1633

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Rust
* Don't return a result from `submit_ping`. The boolean return value indicates whether a ping was submitted ([#1613](https://github.com/mozilla/glean/pull/1613))
* **Breaking Change**: Glean now schedules "metrics" pings, accepting a new Configuration parameter. ([#1599](https://github.com/mozilla/glean/pull/1599))
* Android
* Set required fields for `client_info` before optional ones ([#1633](https://github.com/mozilla/glean/pull/1633))

# v37.0.0 (2021-04-30)

Expand Down
28 changes: 16 additions & 12 deletions glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,8 @@ open class GleanInternalAPI internal constructor () {
// Please note that the following metrics must be set synchronously, so
// that they are guaranteed to be available with the first ping that is
// generated. We use an internal only API to do that.
// https://developer.android.com/reference/android/os/Build.VERSION
GleanInternalMetrics.androidSdkVersion.setSync(Build.VERSION.SDK_INT.toString())
GleanInternalMetrics.osVersion.setSync(Build.VERSION.RELEASE)
// https://developer.android.com/reference/android/os/Build
GleanInternalMetrics.deviceManufacturer.setSync(Build.MANUFACTURER)
GleanInternalMetrics.deviceModel.setSync(Build.MODEL)
GleanInternalMetrics.architecture.setSync(Build.SUPPORTED_ABIS[0])
GleanInternalMetrics.locale.setSync(getLocaleTag())

configuration.channel?.let {
GleanInternalMetrics.appChannel.setSync(it)
}

// Set required information first.
buildInfo?.let {
GleanInternalMetrics.appBuild.setSync(it.versionCode)
GleanInternalMetrics.appDisplayVersion.setSync(it.versionName)
Expand Down Expand Up @@ -604,6 +593,21 @@ open class GleanInternalAPI internal constructor () {
packageInfo.versionName?.let { it } ?: "Unknown"
)
}

GleanInternalMetrics.architecture.setSync(Build.SUPPORTED_ABIS[0])
GleanInternalMetrics.osVersion.setSync(Build.VERSION.RELEASE)

// Optional data is set last.

configuration.channel?.let {
GleanInternalMetrics.appChannel.setSync(it)
}
// https://developer.android.com/reference/android/os/Build.VERSION
GleanInternalMetrics.androidSdkVersion.setSync(Build.VERSION.SDK_INT.toString())
// https://developer.android.com/reference/android/os/Build
GleanInternalMetrics.deviceManufacturer.setSync(Build.MANUFACTURER)
GleanInternalMetrics.deviceModel.setSync(Build.MODEL)
GleanInternalMetrics.locale.setSync(getLocaleTag())
}

/**
Expand Down