diff --git a/CHANGELOG.md b/CHANGELOG.md index 7734db241b..ae780d9abc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 2f88c5fdd6..63beb449a5 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -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) @@ -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()) } /**