From f10499982132b5770bb9391f8786b1d6d5317425 Mon Sep 17 00:00:00 2001 From: Fatih Date: Wed, 18 Sep 2024 01:00:26 +0000 Subject: [PATCH] Bug 1919090: Flatten media devices. r=tjr Differential Revision: https://phabricator.services.mozilla.com/D222343 --- .../resistfingerprinting/metrics.yaml | 92 +++++++++++++++++-- .../nsUserCharacteristics.cpp | 14 +-- 2 files changed, 91 insertions(+), 15 deletions(-) diff --git a/toolkit/components/resistfingerprinting/metrics.yaml b/toolkit/components/resistfingerprinting/metrics.yaml index 4ec081758b14..88270003243b 100644 --- a/toolkit/components/resistfingerprinting/metrics.yaml +++ b/toolkit/components/resistfingerprinting/metrics.yaml @@ -2007,11 +2007,11 @@ characteristics: data_sensitivity: - technical - media_devices: - type: text + camera_count: + type: quantity + unit: int description: > - A JSON object containing the number of audio input/output, video input and - the number of unique group ids. + Number of cameras available on the device. lifetime: application send_in_pings: - user-characteristics @@ -2019,14 +2019,88 @@ characteristics: - tom@mozilla.com bugs: - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1896736 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090 data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1896736#c4 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c2 expires: never data_sensitivity: - # Text metrics are _required_ to be web_activity or highly_sensitive, so even though this - # is more like 'technical' (per the Data Review), I'm marking highly sensitive. - - highly_sensitive + - technical + + microphone_count: + type: quantity + unit: int + description: > + Number of microphones available on the device. + lifetime: application + send_in_pings: + - user-characteristics + notification_emails: + - tom@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c2 + expires: never + data_sensitivity: + - technical + + speaker_count: + type: quantity + unit: int + description: > + Number of speakers available on the device. + lifetime: application + send_in_pings: + - user-characteristics + notification_emails: + - tom@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c2 + expires: never + data_sensitivity: + - technical + + group_count: + type: quantity + unit: int + description: > + Number of device groups reported by the device. + lifetime: application + send_in_pings: + - user-characteristics + notification_emails: + - tom@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c2 + expires: never + data_sensitivity: + - technical + + group_count_wo_speakers: + type: quantity + unit: int + description: > + Number of device groups without speakers reported by the device. + lifetime: application + send_in_pings: + - user-characteristics + notification_emails: + - tom@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c2 + expires: never + data_sensitivity: + - technical audio_frames: type: quantity diff --git a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp index 5c2253c170d8..2446b9d7cb73 100644 --- a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp +++ b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp @@ -461,12 +461,14 @@ RefPtr PopulateMediaDevices() { } } - nsCString json; - json.AppendPrintf( - R"({"cameraCount": %u, "microphoneCount": %u, "speakerCount": %u, "groupCount": %zu, "groupCountWoSpeakers": %zu})", - cameraCount, microphoneCount, speakerCount, groupIds.size(), - groupIdsWoSpeakers.size()); - glean::characteristics::media_devices.Set(json); + glean::characteristics::camera_count.Set(cameraCount); + glean::characteristics::microphone_count.Set(microphoneCount); + glean::characteristics::speaker_count.Set(speakerCount); + glean::characteristics::group_count.Set( + static_cast(groupIds.size())); + glean::characteristics::group_count_wo_speakers.Set( + static_cast(groupIdsWoSpeakers.size())); + populatePromise->Resolve(void_t(), __func__); }, [=](RefPtr&& reason) {