Bug 639707: Add telemetry to detect how often we are getting restored by macOS vs. users manually launching the application. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D167448
This commit is contained in:
Stephen A Pohl 2023-02-02 22:18:33 +00:00
Родитель d5fbd770fa
Коммит d6e9fd0b10
3 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -6094,6 +6094,26 @@ startup:
record_in_processes:
- main
is_restored_by_macos:
bug_numbers:
- 639707
description: >
Recorded on every launch of a Firefox install on macOS, with a boolean
value indicating whether Firefox was restored by macOS or if it was
manually launched by a user.
expires: "116"
keyed: false
kind: boolean
notification_emails:
- spohl@mozilla.com
operating_systems:
- mac
products:
- 'firefox'
record_in_processes:
- 'main'
release_channel_collection: opt-out
script.preloader:
mainthread_recompile:
bug_numbers:

Просмотреть файл

@ -549,6 +549,12 @@ class nsCocoaUtils {
*/
static BOOL WasLaunchedAtLogin();
/**
* Should the application restore its state because it was launched by the OS
* at login?
*/
static BOOL ShouldRestoreStateDueToLaunchAtLoginImpl();
/**
* Array of promises waiting to be resolved due to a video capture request.
*/

Просмотреть файл

@ -36,6 +36,7 @@
#include "mozilla/Logging.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TextEvents.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPrefs_media.h"
@ -268,7 +269,7 @@ BOOL nsCocoaUtils::WasLaunchedAtLogin() {
return NO;
}
BOOL nsCocoaUtils::ShouldRestoreStateDueToLaunchAtLogin() {
BOOL nsCocoaUtils::ShouldRestoreStateDueToLaunchAtLoginImpl() {
// Check if we were launched by macOS as a result of having
// "Reopen windows..." selected during a restart.
if (!WasLaunchedAtLogin()) {
@ -294,6 +295,12 @@ BOOL nsCocoaUtils::ShouldRestoreStateDueToLaunchAtLogin() {
return NO;
}
BOOL nsCocoaUtils::ShouldRestoreStateDueToLaunchAtLogin() {
BOOL shouldRestore = ShouldRestoreStateDueToLaunchAtLoginImpl();
Telemetry::ScalarSet(Telemetry::ScalarID::STARTUP_IS_RESTORED_BY_MACOS, shouldRestore);
return shouldRestore;
}
void nsCocoaUtils::PrepareForNativeAppModalDialog() {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;