1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROMEOS_COMPONENTS_PROXIMITY_AUTH_SMART_LOCK_METRICS_RECORDER_H_ 6 #define CHROMEOS_COMPONENTS_PROXIMITY_AUTH_SMART_LOCK_METRICS_RECORDER_H_ 7 8 class SmartLockMetricsRecorder { 9 public: 10 SmartLockMetricsRecorder(); 11 ~SmartLockMetricsRecorder(); 12 13 // This enum is tied directly to a UMA enum defined in 14 // //tools/metrics/histograms/enums.xml, and should always reflect it (do not 15 // change one without changing the other). Entries should be never modified 16 // or deleted. Only additions possible. 17 enum class SmartLockGetRemoteStatusResultFailureReason { 18 kTimedOutBluetoothDisabled = 0, 19 kTimedOutCouldNotEstablishAuthenticatedChannel = 1, 20 kTimedOutDidNotReceiveRemoteStatusUpdate = 2, 21 kUserEnteredPasswordWhileBluetoothDisabled = 3, 22 kUserEnteredPasswordWhileConnecting = 4, 23 kAuthenticatedChannelDropped = 5, 24 kMaxValue = kAuthenticatedChannelDropped 25 }; 26 27 // This enum is tied directly to a UMA enum defined in 28 // //tools/metrics/histograms/enums.xml, and should always reflect it (do not 29 // change one without changing the other). Entries should be never modified 30 // or deleted. Only additions possible. 31 enum class SmartLockAuthResultFailureReason { 32 kUnlockNotAllowed = 0, 33 kDeprecatedAlreadyAttemptingAuth = 1, 34 kEmptyUserAccount = 2, 35 kInvalidAccoundId = 3, 36 kAuthAttemptCannotStart = 4, 37 kNoPendingOrActiveHost = 5, 38 kAuthenticatedChannelDropped = 6, 39 kFailedToSendUnlockRequest = 7, 40 kFailedToDecryptSignInChallenge = 8, 41 kFailedtoNotifyHostDeviceThatSmartLockWasUsed = 9, 42 kAuthAttemptTimedOut = 10, 43 kUnlockEventSentButNotAttemptingAuth = 11, 44 kUnlockRequestSentButNotAttemptingAuth = 12, 45 kLoginDisplayHostDoesNotExist = 13, 46 kUserControllerSignInFailure = 14, 47 kMaxValue = kUserControllerSignInFailure 48 }; 49 50 enum class SmartLockAuthMethodChoice { 51 kSmartLock = 0, 52 kOther = 1, 53 kMaxValue = kOther 54 }; 55 56 enum class SmartLockAuthEventPasswordState { 57 kUnknownState = 0, 58 kNoPairing = 1, 59 kPairingChanged = 2, 60 kUserHardlock = 3, 61 kServiceNotActive = 4, 62 kNoBluetooth = 5, 63 kBluetoothConnecting = 6, 64 kCouldNotConnectToPhone = 7, 65 kNotAuthenticated = 8, 66 kPhoneLocked = 9, 67 kRssiTooLow = 10, 68 kAuthenticatedPhone = 11, 69 kLoginFailed = 12, 70 kPairingAdded = 13, 71 kNoScreenlockStateHandler = 14, 72 kPhoneLockedAndRssiTooLow = 15, 73 kForcedReauth = 16, 74 kLoginWithSmartLockDisabled = 17, 75 kPhoneNotLockable = 18, 76 kPrimaryUserAbsent = 19, 77 kMaxValue = kPrimaryUserAbsent 78 }; 79 80 static void RecordSmartLockUnlockAuthMethodChoice( 81 SmartLockAuthMethodChoice auth_method_choice); 82 static void RecordSmartLockSignInAuthMethodChoice( 83 SmartLockAuthMethodChoice auth_method_choice); 84 85 static void RecordAuthResultUnlockSuccess(bool success = true); 86 static void RecordAuthResultUnlockFailure( 87 SmartLockAuthResultFailureReason failure_reason); 88 89 static void RecordAuthResultSignInSuccess(bool success = true); 90 static void RecordAuthResultSignInFailure( 91 SmartLockAuthResultFailureReason failure_reason); 92 93 static void RecordAuthMethodChoiceUnlockPasswordState( 94 SmartLockAuthEventPasswordState password_state); 95 static void RecordAuthMethodChoiceSignInPasswordState( 96 SmartLockAuthEventPasswordState password_state); 97 }; 98 99 #endif // CHROMEOS_COMPONENTS_PROXIMITY_AUTH_SMART_LOCK_METRICS_RECORDER_H_ 100