Bug 1868886: Fix Nightly Font Telemetry

Unfortunately, the data we got back was flawed; and I hadn't noticed:
the device information was present, but the font data was just populating
the errors array instead of the fonts array. The FileInputStream on
live devices doesn't support reset, so it's been replaced with two separate
FileInputStreams.

Also bump the integer to cause another resubmission from Nightly users,
and include the submission integer.
fenix/122.0
Tom Ritter 7 months ago committed by mergify[bot]
parent 992f2c565d
commit dde52ac977

@ -13,7 +13,7 @@ class FontParserTest {
Changing the below constant causes _all_ Nightly users to send a (large) Telemetry event containing
their font information. Do not change this value unless you explicitly intend this.
*/
assertEquals(2, FontEnumerationWorker.kDesiredSubmissions)
assertEquals(3, FontEnumerationWorker.kDesiredSubmissions)
}
@Test

@ -89,6 +89,7 @@ class FontEnumerationWorker(
val submission = JSONObject()
run {
submission.put("submission", kDesiredSubmissions)
submission.put("brand", Build.BRAND)
submission.put("device", Build.DEVICE)
submission.put("hardware", Build.HARDWARE)
@ -206,6 +207,6 @@ class FontEnumerationWorker(
* we wish to perform another data collection effort on the Nightly
* population.
*/
const val kDesiredSubmissions: Int = 2
const val kDesiredSubmissions: Int = 3
}
}

@ -59,10 +59,18 @@ data class FontMetric(
*/
object FontParser {
/**
* Parse a font file and return a FontMetric object describing it
* Parse a font file and return a FontMetric object describing it.
* These functions are very similar, because this one is used in
* real devices, the other in unit tests. Outside tests, the
* FileInputStream does not support the reset() method
*/
fun parse(path: String): FontMetric {
return parse(path, FileInputStream(path))
val hash = calculateFileHash(FileInputStream(path))
val fontDetails = FontMetric(path, hash)
readFontFile(FileInputStream(path), fontDetails)
return fontDetails
}
/**

Loading…
Cancel
Save