Update panel logging to include all hide page cases

The old logging only include see_more, done, and clicked_out when hiding
the panel page.  We were missing many cases that user might use back
button, app switch button to close the page.

Update the hide page keys to change the clicked_out to others to
include all the other cases which hide the page.

Test: Manual verification
Test: atest PanelFragmentTest SettingsPanelActivityTest
Fixes: 130169553
Change-Id: Icede9a8dcb84565cba183963c9fb554507631c98
This commit is contained in:
lindatseng
2019-04-12 10:42:09 -07:00
parent 963ebf576a
commit 79957c3217
5 changed files with 34 additions and 32 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.panel;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -50,6 +51,7 @@ public class PanelFragment extends Fragment {
private PanelContent mPanel;
private MetricsFeatureProvider mMetricsProvider;
private String mPanelClosedKey;
@VisibleForTesting
PanelSlicesAdapter mAdapter;
@@ -111,15 +113,26 @@ public class PanelFragment extends Fragment {
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (TextUtils.isEmpty(mPanelClosedKey)) {
mPanelClosedKey = PanelClosedKeys.KEY_OTHERS;
}
mMetricsProvider.action(
0 /* attribution */,
SettingsEnums.PAGE_HIDE,
mPanel.getMetricsCategory(),
mPanelClosedKey,
0 /* value */);
}
@VisibleForTesting
View.OnClickListener getSeeMoreListener() {
return (v) -> {
mMetricsProvider.action(
0 /* attribution */,
SettingsEnums.PAGE_HIDE ,
mPanel.getMetricsCategory(),
PanelClosedKeys.KEY_SEE_MORE,
0 /* value */);
mPanelClosedKey = PanelClosedKeys.KEY_SEE_MORE;
final FragmentActivity activity = getActivity();
activity.startActivityForResult(mPanel.getSeeMoreIntent(), 0);
activity.finish();
@@ -129,12 +142,7 @@ public class PanelFragment extends Fragment {
@VisibleForTesting
View.OnClickListener getCloseListener() {
return (v) -> {
mMetricsProvider.action(
0 /* attribution */,
SettingsEnums.PAGE_HIDE,
mPanel.getMetricsCategory(),
PanelClosedKeys.KEY_DONE,
0 /* value */);
mPanelClosedKey = PanelClosedKeys.KEY_DONE;
getActivity().finish();
};
}