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

Fix #5250 : Add support for logging device DPI events #5270

Merged
merged 8 commits into from
Jan 30, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.oppia.android.util.logging

import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import org.oppia.android.app.model.AppLanguageSelection
Expand Down Expand Up @@ -129,6 +130,9 @@ class EventBundleCreator @Inject constructor(
private val appVersionCode by lazy { context.getVersionCode() }
private val appVersionName by lazy { context.getVersionName() }
private val eventCount by lazy { AtomicInteger() }
private val screenDensity by lazy {
Configuration().densityDpi
}

/**
* Fills the specified [bundle] with a logging-ready representation of [eventLog] and returns a
Expand All @@ -150,6 +154,9 @@ class EventBundleCreator @Inject constructor(
bundle.putString(
"oppia_audio_lang", eventLog.audioTranslationLanguageSelection.toAnalyticsText()
)
bundle.putInt(
"screen_density", screenDensity
)
return eventLog.context.convertToActivityContext().also { eventContext ->
// Only allow user IDs to be logged when the learner study feature is enabled.
eventContext.storeValue(
Expand Down
Loading
Loading