Log source with visibility change

- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-02-14 15:02:35 -08:00
parent 358eab0fff
commit c6ca314c0b
64 changed files with 347 additions and 215 deletions

View File

@@ -80,7 +80,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
@Override
public List<Preference> getPreferencesForCategory(Activity activity, Context context,
String key) {
int sourceMetricsCategory, String key) {
if (!isEnabled()) {
return null;
}
@@ -97,7 +97,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
final List<Preference> preferences = new ArrayList<>();
for (Tile tile : tiles) {
final Preference pref = new Preference(context);
bindPreferenceToTile(activity, pref, tile, null /* key */,
bindPreferenceToTile(activity, sourceMetricsCategory, pref, tile, null /* key */,
Preference.DEFAULT_ORDER /* baseOrder */);
preferences.add(pref);
}
@@ -109,11 +109,6 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
return mCategoryManager.getCategories(mContext);
}
@Override
public int getPriorityGroup(Preference preference) {
return preference.getOrder() / 100;
}
@Override
public String getDashboardKeyForTile(Tile tile) {
if (tile == null || tile.intent == null) {
@@ -129,8 +124,8 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
}
@Override
public void bindPreferenceToTile(Activity activity, Preference pref, Tile tile, String key,
int baseOrder) {
public void bindPreferenceToTile(Activity activity, int sourceMetricsCategory, Preference pref,
Tile tile, String key, int baseOrder) {
pref.setTitle(tile.title);
if (!TextUtils.isEmpty(key)) {
pref.setKey(key);
@@ -152,6 +147,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
pref.setFragment(clsName);
} else if (tile.intent != null) {
final Intent intent = new Intent(tile.intent);
intent.putExtra(SettingsActivity.EXTRA_SOURCE_METRICS_CATEGORY, sourceMetricsCategory);
if (action != null) {
intent.setAction(action);
}