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

chore(android): add cpu architecture as an attribute for all events #1135

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal object Attribute {
const val DEVICE_HEIGHT_PX_KEY = "device_height_px"
const val DEVICE_DENSITY_KEY = "device_density"
const val DEVICE_LOCALE_KEY = "device_locale"
const val DEVICE_CPU_ARCH = "device_cpu_arch"
const val OS_NAME_KEY = "os_name"
const val OS_VERSION_KEY = "os_version"
const val PLATFORM_KEY = "platform"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ internal class DeviceAttributeProcessor(
Attribute.OS_NAME_KEY to "android",
Attribute.OS_VERSION_KEY to Build.VERSION.SDK_INT.toString(),
Attribute.PLATFORM_KEY to "android",
Attribute.DEVICE_CPU_ARCH to getCpuArchitecture(),
)
}

private fun getCpuArchitecture(): String? {
return try {
System.getProperty("os.arch")
} catch (e: Exception) {
logger.log(LogLevel.Error, "Error getting CPU architecture", e)
null
}
}

// Using heuristics from:
// https://android-developers.googleblog.com/2023/06/detecting-if-device-is-foldable-tablet.html
private fun getDeviceType(): String? {
Expand Down
Loading