use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DashboardFragmentTest method onExpandButtonClick_shouldLogAdvancedButtonExpand.
@Test
public void onExpandButtonClick_shouldLogAdvancedButtonExpand() {
final MetricsFeatureProvider metricsFeatureProvider = mFakeFeatureFactory.getMetricsFeatureProvider();
mTestFragment.onExpandButtonClick();
verify(metricsFeatureProvider).action(SettingsEnums.PAGE_UNKNOWN, MetricsEvent.ACTION_SETTINGS_ADVANCED_BUTTON_EXPAND, DASHBOARD_CONTAINER, null, 0);
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MetricsFeatureProviderTest method getFactory_shouldReuseCachedInstance.
@Test
public void getFactory_shouldReuseCachedInstance() {
MetricsFeatureProvider feature1 = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
MetricsFeatureProvider feature2 = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
assertThat(feature1).isSameAs(feature2);
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsageAccessDetails method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(boolean newState, String packageName) {
int logCategory = newState ? SettingsEnums.APP_SPECIAL_PERMISSION_USAGE_VIEW_ALLOW : SettingsEnums.APP_SPECIAL_PERMISSION_USAGE_VIEW_DENY;
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
metricsFeatureProvider.action(metricsFeatureProvider.getAttribution(getActivity()), logCategory, getMetricsCategory(), packageName, 0);
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualCardLoader method getDisplayableCards.
// Get final displayed cards and log what cards will be displayed/hidden
@VisibleForTesting
List<ContextualCard> getDisplayableCards(List<ContextualCard> candidates) {
final List<ContextualCard> eligibleCards = filterEligibleCards(candidates);
final List<ContextualCard> visibleCards = new ArrayList<>();
final List<ContextualCard> hiddenCards = new ArrayList<>();
final int size = eligibleCards.size();
for (int i = 0; i < size; i++) {
if (i < DEFAULT_CARD_COUNT) {
visibleCards.add(eligibleCards.get(i));
} else {
hiddenCards.add(eligibleCards.get(i));
}
}
if (!CardContentProvider.DELETE_CARD_URI.equals(mNotifyUri)) {
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_NOT_SHOW, ContextualCardLogUtils.buildCardListLog(hiddenCards));
}
return visibleCards;
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualCardManager method onFinishCardLoading.
@Override
public void onFinishCardLoading(List<ContextualCard> cards) {
final long loadTime = System.currentTimeMillis() - mStartTime;
Log.d(TAG, "Total loading time = " + loadTime);
final List<ContextualCard> cardsToKeep = getCardsToKeep(cards);
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
// navigate back to the homepage, screen rotate or after card dismissal
if (!mIsFirstLaunch) {
onContextualCardUpdated(cardsToKeep.stream().collect(groupingBy(ContextualCard::getCardType)));
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_SHOW, ContextualCardLogUtils.buildCardListLog(cardsToKeep));
return;
}
final long timeoutLimit = getCardLoaderTimeout();
if (loadTime <= timeoutLimit) {
onContextualCardUpdated(cards.stream().collect(groupingBy(ContextualCard::getCardType)));
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_SHOW, ContextualCardLogUtils.buildCardListLog(cards));
} else {
// log timeout occurrence
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_CONTEXTUAL_CARD_LOAD_TIMEOUT, SettingsEnums.SETTINGS_HOMEPAGE, null, /* key */
(int) loadTime);
}
// only log homepage display upon a fresh launch
final long totalTime = System.currentTimeMillis() - mStartTime;
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_HOME_SHOW, (int) totalTime);
mIsFirstLaunch = false;
}
Aggregations