Commit 7923cf69 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][WebSignin] Add three more metrics for web sign-in flow

This CL adds three more metrics for the web sign-in flow.

Bug: 1120334
Change-Id: Ie28d1046289b7221f3075e2b7cecf0b57252539d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418380
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809249}
parent 8e0b6f61
...@@ -21,6 +21,9 @@ import java.lang.annotation.RetentionPolicy; ...@@ -21,6 +21,9 @@ import java.lang.annotation.RetentionPolicy;
AccountConsistencyPromoAction.DISMISSED_BACK, AccountConsistencyPromoAction.DISMISSED_BACK,
AccountConsistencyPromoAction.ADD_ACCOUNT, AccountConsistencyPromoAction.ADD_ACCOUNT,
AccountConsistencyPromoAction.STARTED_INCOGNITO_SESSION, AccountConsistencyPromoAction.STARTED_INCOGNITO_SESSION,
AccountConsistencyPromoAction.SIGNED_IN_WITH_DEFAULT_ACCOUNT,
AccountConsistencyPromoAction.SIGNED_IN_WITH_NON_DEFAULT_ACCOUNT,
AccountConsistencyPromoAction.SHOWN,
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface AccountConsistencyPromoAction { public @interface AccountConsistencyPromoAction {
...@@ -46,5 +49,20 @@ public @interface AccountConsistencyPromoAction { ...@@ -46,5 +49,20 @@ public @interface AccountConsistencyPromoAction {
*/ */
int STARTED_INCOGNITO_SESSION = 3; int STARTED_INCOGNITO_SESSION = 3;
int MAX = 4; /**
* User has selected the default account and signed in with it.
*/
int SIGNED_IN_WITH_DEFAULT_ACCOUNT = 4;
/**
* User has selected one of the non default accounts and signed in with it.
*/
int SIGNED_IN_WITH_NON_DEFAULT_ACCOUNT = 5;
/**
* The promo was shown to user.
*/
int SHOWN = 6;
int MAX = 7;
} }
...@@ -45,6 +45,9 @@ public class AccountPickerBottomSheetCoordinator { ...@@ -45,6 +45,9 @@ public class AccountPickerBottomSheetCoordinator {
BottomSheetController bottomSheetController, BottomSheetController bottomSheetController,
AccountPickerDelegate accountPickerDelegate, AccountPickerDelegate accountPickerDelegate,
IncognitoInterstitialDelegate incognitoInterstitialDelegate) { IncognitoInterstitialDelegate incognitoInterstitialDelegate) {
AccountPickerDelegate.recordAccountConsistencyPromoAction(
AccountConsistencyPromoAction.SHOWN);
mAccountPickerBottomSheetMediator = mAccountPickerBottomSheetMediator =
new AccountPickerBottomSheetMediator(context, accountPickerDelegate); new AccountPickerBottomSheetMediator(context, accountPickerDelegate);
mView = new AccountPickerBottomSheetView(context, mAccountPickerBottomSheetMediator); mView = new AccountPickerBottomSheetView(context, mAccountPickerBottomSheetMediator);
......
...@@ -40,6 +40,7 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste ...@@ -40,6 +40,7 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste
private final AccountManagerFacade mAccountManagerFacade; private final AccountManagerFacade mAccountManagerFacade;
private final AccountsChangeObserver mAccountsChangeObserver = this::onAccountListUpdated; private final AccountsChangeObserver mAccountsChangeObserver = this::onAccountListUpdated;
private @Nullable String mSelectedAccountName; private @Nullable String mSelectedAccountName;
private @Nullable String mDefaultAccountName;
AccountPickerBottomSheetMediator(Context context, AccountPickerDelegate accountPickerDelegate) { AccountPickerBottomSheetMediator(Context context, AccountPickerDelegate accountPickerDelegate) {
mAccountPickerDelegate = accountPickerDelegate; mAccountPickerDelegate = accountPickerDelegate;
...@@ -137,24 +138,26 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste ...@@ -137,24 +138,26 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste
// we will go to the zero account screen. // we will go to the zero account screen.
mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, ViewState.NO_ACCOUNTS); mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, ViewState.NO_ACCOUNTS);
mSelectedAccountName = null; mSelectedAccountName = null;
mDefaultAccountName = null;
mModel.set(AccountPickerBottomSheetProperties.SELECTED_ACCOUNT_DATA, null); mModel.set(AccountPickerBottomSheetProperties.SELECTED_ACCOUNT_DATA, null);
return; return;
} }
mDefaultAccountName = accounts.get(0).name;
@ViewState @ViewState
int viewState = mModel.get(AccountPickerBottomSheetProperties.VIEW_STATE); int viewState = mModel.get(AccountPickerBottomSheetProperties.VIEW_STATE);
if (viewState == ViewState.NO_ACCOUNTS) { if (viewState == ViewState.NO_ACCOUNTS) {
// When a non-empty account list appears while it is currently zero-account screen, // When a non-empty account list appears while it is currently zero-account screen,
// we should change the screen to collapsed account list and set the selected account // we should change the screen to collapsed account list and set the selected account
// to the first account of the account list // to the first account of the account list
setSelectedAccountName(accounts.get(0).name); setSelectedAccountName(mDefaultAccountName);
mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE,
ViewState.COLLAPSED_ACCOUNT_LIST); ViewState.COLLAPSED_ACCOUNT_LIST);
} else if (viewState == ViewState.COLLAPSED_ACCOUNT_LIST } else if (viewState == ViewState.COLLAPSED_ACCOUNT_LIST
&& AccountUtils.findAccountByName(accounts, mSelectedAccountName) == null) { && AccountUtils.findAccountByName(accounts, mSelectedAccountName) == null) {
// When it is already collapsed account list, we update the selected account only // When it is already collapsed account list, we update the selected account only
// when the current selected account name is no longer in the new account list // when the current selected account name is no longer in the new account list
setSelectedAccountName(accounts.get(0).name); setSelectedAccountName(mDefaultAccountName);
} }
} }
...@@ -203,6 +206,10 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste ...@@ -203,6 +206,10 @@ class AccountPickerBottomSheetMediator implements AccountPickerCoordinator.Liste
private void signIn() { private void signIn() {
mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, ViewState.SIGNIN_IN_PROGRESS); mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, ViewState.SIGNIN_IN_PROGRESS);
AccountPickerDelegate.recordAccountConsistencyPromoAction(
TextUtils.equals(mSelectedAccountName, mDefaultAccountName)
? AccountConsistencyPromoAction.SIGNED_IN_WITH_DEFAULT_ACCOUNT
: AccountConsistencyPromoAction.SIGNED_IN_WITH_NON_DEFAULT_ACCOUNT);
new AsyncTask<String>() { new AsyncTask<String>() {
@Override @Override
protected String doInBackground() { protected String doInBackground() {
......
...@@ -961,6 +961,13 @@ Unknown properties are collapsed to zero. --> ...@@ -961,6 +961,13 @@ Unknown properties are collapsed to zero. -->
interstitial then confirmed opening the page in the incognito tab by tapping interstitial then confirmed opening the page in the incognito tab by tapping
|Continue| in the incognito interstitial. |Continue| in the incognito interstitial.
</int> </int>
<int value="4" label="SignedInWithDefaultAccount">
User has selected the default account and signed in with it.
</int>
<int value="5" label="SignedInWithNonDefaultAccount">
User has selected one of the non default accounta and signed in with it.
</int>
<int value="6" label="Shown">The promo was shown to user.</int>
</enum> </enum>
<enum name="AccountManagerAccountAdditionSource"> <enum name="AccountManagerAccountAdditionSource">
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