File: hats_config.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (285 lines) | stat: -rw-r--r-- 13,677 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ash/hats/hats_config.h"

#include "base/time/time.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"

namespace ash {

namespace {
constexpr int kMinDaysThreshold = 0;  // HaTS Onboarding Experience is immediate
}  // namespace

HatsConfig::HatsConfig(const base::Feature& feature,
                       const base::TimeDelta& new_device_threshold,
                       const char* const is_selected_pref_name,
                       const char* const cycle_end_timestamp_pref_name)
    : feature(feature),
      new_device_threshold(new_device_threshold),
      is_selected_pref_name(is_selected_pref_name),
      cycle_end_timestamp_pref_name(cycle_end_timestamp_pref_name),
      survey_last_interaction_timestamp_pref_name(nullptr),
      threshold_time(base::TimeDelta()),
      prioritized(false) {
  DCHECK(new_device_threshold.InDaysFloored() >= kMinDaysThreshold);
}

HatsConfig::HatsConfig(
    const base::Feature& feature,
    const base::TimeDelta& new_device_threshold,
    const char* const is_selected_pref_name,
    const char* const cycle_end_timestamp_pref_name,
    const char* const survey_last_interaction_timestamp_pref_name,
    const base::TimeDelta& threshold_time)
    : feature(feature),
      new_device_threshold(new_device_threshold),
      is_selected_pref_name(is_selected_pref_name),
      cycle_end_timestamp_pref_name(cycle_end_timestamp_pref_name),
      survey_last_interaction_timestamp_pref_name(
          survey_last_interaction_timestamp_pref_name),
      threshold_time(threshold_time),
      prioritized(true) {
  DCHECK(new_device_threshold.InDaysFloored() >= kMinDaysThreshold);
}

// General Survey -- shown after login
const HatsConfig kHatsGeneralSurvey = {
    ::features::kHappinessTrackingSystem,  // feature
    base::Days(7),                         // new_device_threshold
    prefs::kHatsDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsSurveyCycleEndTimestamp,   // cycle_end_timestamp_pref_name
};

// ENT Survey -- shown after login, along with the General Survey
const HatsConfig kHatsEntSurvey = {
    ::features::kHappinessTrackingSystemEnt,  // feature
    base::Days(7),                            // new_device_threshold
    prefs::kHatsEntDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsEntSurveyCycleEndTs,          // cycle_end_timestamp_pref_name
};

// Stability Survey -- shown after login, along with the General Survey
const HatsConfig kHatsStabilitySurvey = {
    ::features::kHappinessTrackingSystemStability,  // feature
    base::Days(7),                                  // new_device_threshold
    prefs::kHatsStabilityDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsStabilitySurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Performance Survey -- shown after login, along with the General Survey
const HatsConfig kHatsPerformanceSurvey = {
    ::features::kHappinessTrackingSystemPerformance,  // feature
    base::Days(7),                                    // new_device_threshold
    prefs::kHatsPerformanceDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsPerformanceSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Onboarding Experience Survey -- shown after completing the Onboarding Dialog
const HatsConfig kHatsOnboardingSurvey = {
    ::features::kHappinessTrackingSystemOnboarding,  // feature
    base::Minutes(30),                               // new_device_threshold
    prefs::kHatsOnboardingDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsOnboardingSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// ARC++ Games Survey -- shown after a user played a top XX ARC++ game
const HatsConfig kHatsArcGamesSurvey = {
    ::features::kHappinessTrackingSystemArcGames,  // feature
    base::Days(7),                                 // new_device_threshold
    prefs::kHatsArcGamesDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsArcGamesSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Audio Survey -- shown after a user closed an audio stream living for more
// than 3 minutes
const HatsConfig kHatsAudioSurvey = {
    ::features::kHappinessTrackingSystemAudio,  // feature
    base::Days(90),                             // new_device_threshold
    prefs::kHatsAudioDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsAudioSurveyCycleEndTs,          // cycle_end_timestamp_pref_name
};

const HatsConfig kHatsAudioOutputProcSurvey = {
    ::features::kHappinessTrackingSystemAudioOutputProc,  // feature
    base::Days(7),                                // new_device_threshold
    prefs::kHatsAudioOutputProcDeviceIsSelected,  // is_selected_pref_name
    prefs::
        kHatsAudioOutputProcSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Bluetooth Audio Survey -- shown after the user closed an audio stream
// sent to a Bluetooth device after listening for more than one minute.
const HatsConfig kHatsBluetoothAudioSurvey = {
    ::features::kHappinessTrackingSystemBluetoothAudio,  // feature
    base::Days(90),                                      // new_device_threshold
    prefs::kHatsBluetoothAudioDeviceIsSelected,  // is_selected_pref_name
    prefs::
        kHatsBluetoothAudioSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};
// Personalization Avatar Survey -- shown 60 seconds after a user closes the
// Avatar selection page of either OS Settings or Personalization Hub, depending
// on whether PersonalizationHub feature is enabled.
const HatsConfig kHatsPersonalizationAvatarSurvey = {
    ::features::kHappinessTrackingPersonalizationAvatar,  // feature
    base::Days(1),                                      // new_device_threshold
    prefs::kHatsPersonalizationAvatarSurveyIsSelected,  // is_selected_pref_name
    prefs::
        kHatsPersonalizationAvatarSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Personalization Screensaver Survey -- shown 60 seconds after a user closes
// the Screensaver settings page of either OS Settings or Personalization Hub,
// depending on whether PersonalizationHub feature is enabled.
const HatsConfig kHatsPersonalizationScreensaverSurvey = {
    ::features::kHappinessTrackingPersonalizationScreensaver,  // feature
    base::Days(1),  // new_device_threshold
    prefs::
        kHatsPersonalizationScreensaverSurveyIsSelected,  // is_selected_pref_name
    prefs::
        kHatsPersonalizationScreensaverSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Personalization Wallpaper Survey -- shown 60 seconds after a user closes the
// Wallpaper subpage of the Personalization App.
const HatsConfig kHatsPersonalizationWallpaperSurvey = {
    ::features::kHappinessTrackingPersonalizationWallpaper,  // feature
    base::Days(1),  // new_device_threshold
    prefs::
        kHatsPersonalizationWallpaperSurveyIsSelected,  // is_selected_pref_name
    prefs::
        kHatsPersonalizationWallpaperSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// MediaApp PDF Editing experience survey -- shown after a user clicks `Save`
// after editing a PDF in the MediaApp (Gallery), and the save is complete.
const HatsConfig kHatsMediaAppPdfSurvey = {
    ::features::kHappinessTrackingMediaAppPdf,  // feature
    base::Days(7),                              // new_device_threshold
    prefs::kHatsMediaAppPdfIsSelected,          // hatsIsSelectedPrefName
    prefs::kHatsMediaAppPdfCycleEndTs,          // hatsCycleEndTimestampPrefName
};

// Camera App Survey -- shown after an user captured a photo/video or left the
// app with session > 15 seconds.
const HatsConfig kHatsCameraAppSurvey = {
    ::features::kHappinessTrackingSystemCameraApp,  // feature
    base::Days(90),                                 // new_device_threshold
    prefs::kHatsCameraAppDeviceIsSelected,          // is_selected_pref_name
    prefs::kHatsCameraAppSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Chromebook Video/Image Editing/Viewing experience survey -- shown after a
// user opens and then subsequently closes the Google Photos Android App.
const HatsConfig kHatsPhotosExperienceSurvey = {
    ::features::kHappinessTrackingPhotosExperience,  // feature
    base::Days(7),                                   // new_device_threshold
    prefs::kHatsPhotosExperienceIsSelected,          // hatsIsSelectedPrefName
    prefs::kHatsPhotosExperienceCycleEndTs,  // hatsCycleEndTimestampPrefName
};

// General Camera Survey -- shown after camera is closed after being open for
// at least 3 minutes by using any app (e.g. Chrome or Android app).
const HatsConfig kHatsGeneralCameraSurvey = {
    ::features::kHappinessTrackingGeneralCamera,  // feature
    base::Days(90),                               // new_device_threshold
    prefs::kHatsGeneralCameraIsSelected,          // is_selected_pref_name
    prefs::kHatsGeneralCameraSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Prioritized General Camera Survey -- shown after camera is closed after being
// open for at least 15 seconds by using any app (e.g. Chrome or Android app).
const HatsConfig kHatsGeneralCameraPrioritizedSurvey = {
    // feature
    ::features::kHappinessTrackingGeneralCameraPrioritized,
    // new_device_threshold
    base::Days(7),
    // is_selected_pref_name
    prefs::kHatsGeneralCameraPrioritizedIsSelected,
    // cycle_end_timestamp_pref_name
    prefs::kHatsGeneralCameraPrioritizedSurveyCycleEndTs,
    // survey_last_interaction_timestamp_pref_name
    prefs::kHatsGeneralCameraPrioritizedLastInteractionTimestamp,
    // threshold_time
    base::Days(120),
};

// Bluetooth revamp experience survey -- shown 5 mins after interacting with new
// Bluetooth UI surfaces.
const HatsConfig kHatsBluetoothRevampSurvey = {
    ::features::kHappinessTrackingSystemBluetoothRevamp,  // feature
    base::Days(1),                          // new_device_threshold
    prefs::kHatsBluetoothRevampIsSelected,  // is_selected_pref_name
    prefs::kHatsBluetoothRevampCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Battery life experience survey -- shown after login.
const HatsConfig kHatsBatteryLifeSurvey = {
    ::features::kHappinessTrackingSystemBatteryLife,  // feature
    base::Days(7),                                    // new_device_threshold
    prefs::kHatsBatteryLifeIsSelected,                // is_selected_pref_name
    prefs::kHatsBatteryLifeCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Peripherals experience survey -- shown after login.
const HatsConfig kHatsPeripheralsSurvey = {
    ::features::kHappinessTrackingSystemPeripherals,  // feature
    base::Days(7),                                    // new_device_threshold
    prefs::kHatsPeripheralsIsSelected,                // is_selected_pref_name
    prefs::kHatsPeripheralsCycleEndTs,  // cycle_end_timestamp_pref_name
};

// OS Settings Survey -- shown [5-30] seconds after a user removes focus from
// Settings or closes the Settings app, if user has used Search, it will add it
// as a Product Specific Data (PSD).
const HatsConfig kHatsOsSettingsSearchSurvey = {
    ::features::kHappinessTrackingOsSettingsSearch,  // feature
    base::Days(1),                                   // new_device_threshold
    prefs::kHatsOsSettingsSearchSurveyIsSelected,    // is_selected_pref_name
    prefs::
        kHatsOsSettingsSearchSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Borealis games survey -- Shown after a Steam game exits.
const HatsConfig kHatsBorealisGamesSurvey = {
    ::features::kHappinessTrackingBorealisGames,  // feature
    base::Days(1),                                // new_device_threshold
    prefs::kHatsBorealisGamesSurveyIsSelected,    // is_selected_pref_name
    prefs::kHatsBorealisGamesSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
    prefs::kHatsBorealisGamesLastInteractionTimestamp,
    // survey_last_interaction_timestamp_pref_name
    base::Days(7),  // threshold_time
};

// Launcher survey -- Shown after a user opens the launcher for the first time.
// This survey is enabled for 25% of users.
const HatsConfig kHatsLauncherAppsFindingSurvey = {
    ::features::kHappinessTrackingLauncherAppsFinding,  // feature
    base::Hours(2),                                     // new_device_threshold
    prefs::kHatsLauncherAppsSurveyIsSelected,           // is_selected_pref_name
    prefs::kHatsLauncherAppsSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Launcher survey -- Shown after a user opens the launcher for the first time.
// This survey is enabled for 75% of users.
const HatsConfig kHatsLauncherAppsNeedingSurvey = {
    ::features::kHappinessTrackingLauncherAppsNeeding,  // feature
    base::Hours(2),                                     // new_device_threshold
    prefs::kHatsLauncherAppsSurveyIsSelected,           // is_selected_pref_name
    prefs::kHatsLauncherAppsSurveyCycleEndTs,  // cycle_end_timestamp_pref_name
};

// Office integration survey -- Shown after the user opens an Office file:
// For MS365 and Docs/Sheets/Slides, shown when the app is inactive or closed.
// For QuickOffice, shown 1 minute after launch.
const HatsConfig kHatsOfficeSurvey = {
    ::features::kHappinessTrackingOffice,  // feature
    base::Days(1),                         // new_device_threshold
    prefs::kHatsOfficeSurveyIsSelected,    // is_selected_pref_name
    prefs::kHatsOfficeSurveyCycleEndTs,    // cycle_end_timestamp_pref_name
};

}  // namespace ash