[platform ui] IJPL-250522 Don't report the event on non-macOS machines

(cherry picked from commit d25703768046ea3715c4c78b187f19c5f9d6eab6)


(cherry picked from commit b9d098c63b582c85f8adc61880c1a5b9ee007789)

IJ-MR-214629

GitOrigin-RevId: 50a5369971ba03038c7b9db4c0cd265f09282600
This commit is contained in:
Aydar Mukhametzyanov
2026-07-22 18:41:07 +00:00
committed by intellij-monorepo-bot
parent 983615b712
commit 0fe57a189f
3 changed files with 12 additions and 5 deletions
@@ -110,7 +110,9 @@ class SystemRuntimeCollector : ApplicationUsagesCollector() {
result += OS_VM.metric(getOsVirtualization())
result += MACBOOK_NEO.metric(MacHardwareInfo.isMacbookNeo)
MacHardwareInfo.isMacbookNeo?.let {
result += MACBOOK_NEO.metric(it)
}
return result
}
@@ -3,10 +3,13 @@ package com.intellij.internal.statistic.collectors.fus.os
import com.intellij.ReviseWhenPortedToJDK
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
import com.intellij.util.system.LowLevelLocalMachineAccess
import com.intellij.util.system.OS
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
class SystemRuntimeCollectorTest : BareTestFixtureTestCase() {
@OptIn(LowLevelLocalMachineAccess::class)
@Test
fun smoke() {
val metrics = SystemRuntimeCollector().getMetrics().map { it.eventId to it.data.build() }
@@ -35,7 +38,9 @@ class SystemRuntimeCollectorTest : BareTestFixtureTestCase() {
assertThat(osVm["name"]).isNotNull.isNotIn("other", "unknown")
}
val neo = metric("hardware.macbook.neo")
assertThat(neo["value"]).isIn(true, false)
if (OS.CURRENT == OS.macOS) {
val neo = metric("hardware.macbook.neo")
assertThat(neo["value"]).isIn(true, false)
}
}
}
@@ -18,8 +18,8 @@ import org.jetbrains.annotations.ApiStatus
object MacHardwareInfo {
private const val MACBOOK_NEO_MODEL_ID = "Mac17,5"
/** `true` when running on a MacBook Neo (`hw.model` == `Mac17,5`); `false` on any other machine or OS. */
val isMacbookNeo: Boolean by lazy { modelIdentifier == MACBOOK_NEO_MODEL_ID }
/** `true` when running on a MacBook Neo (`hw.model` == `Mac17,5`); `null` on non-macOS machines. */
val isMacbookNeo: Boolean? by lazy { modelIdentifier?.let { it == MACBOOK_NEO_MODEL_ID } }
/** Hardware model identifier on macOS, e.g. `Mac17,5` or `MacBookPro14,3`; `null` on other OSes or when unavailable. */
private val modelIdentifier: String? by lazy {