-
Notifications
You must be signed in to change notification settings - Fork 126
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
Bug 1638877: Fix schema validation errors. #996
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ package mozilla.telemetry.glean | |
import android.app.ActivityManager | ||
import android.util.Log | ||
import android.content.Context | ||
import android.content.pm.PackageInfo | ||
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import android.os.Process | ||
|
@@ -164,6 +165,14 @@ open class GleanInternalAPI internal constructor () { | |
return@executeTask | ||
} | ||
|
||
// Get the current value of the dirty flag so we know whether to | ||
// send a dirty startup baseline ping below. Immediately set it to | ||
// `false` so that dirty startup pings won't be sent if Glean | ||
// initialization does not complete successfully. It is set to `true` | ||
// again in the ON_START lifecycle event. | ||
val isDirtyFlagSet = LibGleanFFI.INSTANCE.glean_is_dirty_flag_set().toBoolean() | ||
LibGleanFFI.INSTANCE.glean_set_dirty_flag(false.toByte()) | ||
|
||
// If any pings were registered before initializing, do so now. | ||
// We're not clearing this queue in case Glean is reset by tests. | ||
synchronized(this@GleanInternalAPI) { | ||
|
@@ -197,11 +206,8 @@ open class GleanInternalAPI internal constructor () { | |
// Check if the "dirty flag" is set. That means the product was probably | ||
// force-closed. If that's the case, submit a 'baseline' ping with the | ||
// reason "dirty_startup". We only do that from the second run. | ||
if (!isFirstRun && LibGleanFFI.INSTANCE.glean_is_dirty_flag_set().toBoolean()) { | ||
if (!isFirstRun && isDirtyFlagSet) { | ||
submitPingByNameSync("baseline", "dirty_startup") | ||
// Note: while in theory we should set the "dirty flag" to true | ||
// here, in practice it's not needed: if it hits this branch, it | ||
// means the value was `true` and nothing needs to be done. | ||
} | ||
|
||
// From the second time we run, after all startup pings are generated, | ||
|
@@ -444,23 +450,30 @@ open class GleanInternalAPI internal constructor () { | |
GleanInternalMetrics.appChannel.setSync(it) | ||
} | ||
|
||
val packageInfo: PackageInfo | ||
|
||
try { | ||
val packageInfo = applicationContext.packageManager.getPackageInfo( | ||
packageInfo = applicationContext.packageManager.getPackageInfo( | ||
applicationContext.packageName, 0 | ||
) | ||
@Suppress("DEPRECATION") | ||
GleanInternalMetrics.appBuild.setSync(packageInfo.versionCode.toString()) | ||
|
||
GleanInternalMetrics.appDisplayVersion.setSync( | ||
packageInfo.versionName?.let { it } ?: "Unknown" | ||
) | ||
} catch (e: PackageManager.NameNotFoundException) { | ||
Log.e( | ||
LOG_TAG, | ||
"Could not get own package info, unable to report build id and display version" | ||
) | ||
throw AssertionError("Could not get own package info, aborting init") | ||
|
||
GleanInternalMetrics.appBuild.setSync("inaccessible") | ||
GleanInternalMetrics.appDisplayVersion.setSync("inaccessible") | ||
Comment on lines
+465
to
+466
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: would you kindly document these values in the |
||
|
||
return | ||
} | ||
|
||
@Suppress("DEPRECATION") | ||
GleanInternalMetrics.appBuild.setSync(packageInfo.versionCode.toString()) | ||
|
||
GleanInternalMetrics.appDisplayVersion.setSync( | ||
packageInfo.versionName?.let { it } ?: "Unknown" | ||
) | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick!