Commit 9ef26f9f authored by khmel@google.com's avatar khmel@google.com Committed by Commit Bot

arc: Add Arc.StateByUserType metric.

BUG=855265
TEST=Manually

Change-Id: I77cf19b06ffd76de3a5f8cfda36ee0ea0fd34d62
Reviewed-on: https://chromium-review.googlesource.com/1111114Reviewed-by: default avatarJosh Horwich <jhorwich@chromium.org>
Reviewed-by: default avatarElijah Taylor <elijahtaylor@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Yury Khmel <khmel@google.com>
Cr-Commit-Position: refs/heads/master@{#573799}
parent 797fa90a
......@@ -8,6 +8,7 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
#include "chrome/browser/profiles/profile.h"
......@@ -30,10 +31,32 @@ std::string GetHistogramName(const std::string& base_name,
}
if (profile->IsChild())
return base_name + "Child";
if (IsActiveDirectoryUserForProfile(profile))
return base_name + "ActiveDirectory";
return base_name +
(policy_util::IsAccountManaged(profile) ? "Managed" : "Unmanaged");
}
ArcEnabledState ComputeEnabledState(bool enabled, const Profile* profile) {
if (!IsArcAllowedForProfile(profile)) {
return enabled ? ArcEnabledState::ENABLED_NOT_ALLOWED
: ArcEnabledState::DISABLED_NOT_ALLOWED;
}
if (!IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
return enabled ? ArcEnabledState::ENABLED_NOT_MANAGED
: ArcEnabledState::DISABLED_NOT_MANAGED;
}
if (IsArcPlayStoreEnabledForProfile(profile)) {
return enabled ? ArcEnabledState::ENABLED_MANAGED_ON
: ArcEnabledState::DISABLED_MANAGED_ON;
}
DCHECK(!enabled);
return ArcEnabledState::DISABLED_MANAGED_OFF;
}
} // namespace
void UpdateOptInActionUMA(OptInActionType type) {
......@@ -51,6 +74,12 @@ void UpdateEnabledStateUMA(bool enabled) {
UMA_STABILITY_HISTOGRAM_ENUMERATION("Arc.State", enabled ? 1 : 0, 2);
}
void UpdateEnabledStateByUserTypeUMA(bool enabled, const Profile* profile) {
base::UmaHistogramEnumeration(
GetHistogramName("Arc.StateByUserType.", profile),
ComputeEnabledState(enabled, profile), ArcEnabledState::SIZE);
}
void UpdateOptInFlowResultUMA(OptInFlowResult result) {
UMA_HISTOGRAM_ENUMERATION("Arc.OptInResult", static_cast<int>(result),
static_cast<int>(OptInFlowResult::SIZE));
......
......@@ -183,10 +183,39 @@ enum class OptInFlowResult : int {
SIZE,
};
enum class ArcEnabledState {
// ARC++ is enabled for non-managed case.
ENABLED_NOT_MANAGED = 0,
// ARC++ is disabled for non-managed case.
DISABLED_NOT_MANAGED = 1,
// ARC++ is enabled for managed case when ARC++ is forced on.
ENABLED_MANAGED_ON = 2,
// ARC++ is disabled for managed case when ARC++ is forced on. This can happen
// when user declines ToS even if ARC++ is forced on.
DISABLED_MANAGED_ON = 3,
// ARC++ is disabled for managed case when ARC++ is forced off.
DISABLED_MANAGED_OFF = 4,
// ARC++ is enabled in case ARC++ is not allowed for the device. This can
// happen for ARC++ kiosk mode.
ENABLED_NOT_ALLOWED = 5,
// ARC++ is disabled and ARC++ is not allowed for the device.
DISABLED_NOT_ALLOWED = 6,
// The size of this enum; keep last.
SIZE,
};
void UpdateOptInActionUMA(OptInActionType type);
void UpdateOptInCancelUMA(OptInCancelReason reason);
void UpdateOptInFlowResultUMA(OptInFlowResult result);
void UpdateEnabledStateUMA(bool enabled);
void UpdateEnabledStateByUserTypeUMA(bool enabled, const Profile* profile);
void UpdateProvisioningResultUMA(ProvisioningResult result,
const Profile* profile);
void UpdateProvisioningTiming(const base::TimeDelta& elapsed_time,
......
......@@ -24,10 +24,12 @@
#include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.h"
#include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/app_list/arc/arc_fast_app_reinstall_starter.h"
......@@ -596,16 +598,31 @@ void ArcSessionManager::CancelAuthCode() {
}
void ArcSessionManager::RecordArcState() {
// Only record Enabled state if ARC is allowed in the first place, so we do
// not split the ARC population by devices that cannot run ARC.
if (!IsAllowed())
return;
// Only record legacy enabled state if ARC is allowed in the first place, so
// we do not split the ARC population by devices that cannot run ARC.
if (IsAllowed()) {
UpdateEnabledStateUMA(enable_requested_);
UpdateEnabledStateByUserTypeUMA(enable_requested_, profile_);
ArcMetricsService* service =
ArcMetricsService::GetForBrowserContext(profile_);
service->RecordNativeBridgeUMA();
return;
}
const Profile* profile = ProfileManager::GetPrimaryUserProfile();
// Don't record UMA for the set of cases:
// * No primary profile is set at this moment.
// * Primary profile matches the built-in profile used for signing in or the
// lock screen.
// * Primary profile matches guest session.
// * Primary profile is in incognito mode.
if (!profile || chromeos::ProfileHelper::IsSigninProfile(profile) ||
chromeos::ProfileHelper::IsLockScreenAppProfile(profile) ||
profile->IsOffTheRecord() || profile->IsGuestSession()) {
return;
}
UpdateEnabledStateByUserTypeUMA(enable_requested_, profile);
}
void ArcSessionManager::RequestEnable() {
......
......@@ -1524,6 +1524,16 @@ uploading your change for review. These are checked by presubmit scripts.
<int value="3" label="Crashed"/>
</enum>
<enum name="ArcEnableState">
<int value="0" label="Enabled not managed"/>
<int value="1" label="Disabled not managed"/>
<int value="2" label="Managed on"/>
<int value="3" label="Managed on but disabled"/>
<int value="4" label="Managed off"/>
<int value="5" label="Not allowed but enabled"/>
<int value="6" label="Not allowed"/>
</enum>
<enum name="ArcIntentHandlerAction">
<summary>Defines Arc intent handler actions</summary>
<int value="0" label="Error"/>
......@@ -3505,6 +3505,17 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="Arc.StateByUserType" enum="ArcEnableState">
<!-- Name completed by histogram_suffixes name="ArcUserTypes" -->
<owner>elijahtaylor@google.com</owner>
<owner>shihuis@google.com</owner>
<owner>khmel@google.com</owner>
<summary>
Similar to &quot;Arc.State&quot; metric but has separation by user type.
</summary>
</histogram>
<histogram name="Arc.Supervision.Transition.Result"
enum="ArcSupervisionTransitionResult" expires_after="M71">
<owner>phongo@google.com</owner>
......@@ -114602,6 +114613,7 @@ uploading your change for review.
</histogram_suffixes>
<histogram_suffixes name="ArcUserTypes" separator=".">
<suffix name="ActiveDirectory" label="User with active directory account"/>
<suffix name="Child" label="User with child accounts."/>
<suffix name="DemoMode" label="Demo devices with a demo mode robot account."/>
<suffix name="Managed" label="User with forced Play Store feature"/>
......@@ -114614,6 +114626,7 @@ uploading your change for review.
<affected-histogram name="Arc.Provisioning.TimeDelta.Failure"/>
<affected-histogram name="Arc.Provisioning.TimeDelta.Success"/>
<affected-histogram name="Arc.Reauthorization.Result"/>
<affected-histogram name="Arc.StateByUserType"/>
</histogram_suffixes>
<histogram_suffixes name="AsyncDNSPref" separator="_">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment