use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
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;
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class EligibleCardChecker method call.
@Override
public ContextualCard call() {
final long startTime = System.currentTimeMillis();
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
ContextualCard result;
if (isCardEligibleToDisplay(mCard)) {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_CONTEXTUAL_CARD_ELIGIBILITY, SettingsEnums.SETTINGS_HOMEPAGE, mCard.getTextSliceUri(), /* key */
1);
result = mCard;
} else {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_CONTEXTUAL_CARD_ELIGIBILITY, SettingsEnums.SETTINGS_HOMEPAGE, mCard.getTextSliceUri(), /* key */
0);
result = null;
}
// Log individual card loading time
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_CONTEXTUAL_CARD_LOAD, SettingsEnums.SETTINGS_HOMEPAGE, mCard.getTextSliceUri(), /* key */
(int) (System.currentTimeMillis() - startTime));
return result;
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class ConditionFooterContextualCardRenderer method bindView.
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard card) {
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
holder.itemView.setOnClickListener(v -> {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_SETTINGS_CONDITION_EXPAND, SettingsEnums.SETTINGS_HOMEPAGE, null, /* key */
0);
final ConditionContextualCardController controller = mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_FOOTER);
controller.setIsExpanded(false);
controller.onConditionsChanged();
});
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class ConditionHeaderContextualCardRenderer method bindView.
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard contextualCard) {
final ConditionHeaderContextualCard headerCard = (ConditionHeaderContextualCard) contextualCard;
final ConditionHeaderCardHolder view = (ConditionHeaderCardHolder) holder;
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
view.icons.removeAllViews();
headerCard.getConditionalCards().forEach(card -> {
final ImageView icon = (ImageView) LayoutInflater.from(mContext).inflate(R.layout.conditional_card_header_icon, view.icons, false);
icon.setImageDrawable(card.getIconDrawable());
view.icons.addView(icon);
});
view.itemView.setOnClickListener(v -> {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_SETTINGS_CONDITION_EXPAND, SettingsEnums.SETTINGS_HOMEPAGE, null, /* key */
1);
final ConditionContextualCardController controller = mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_HEADER);
controller.setIsExpanded(true);
controller.onConditionsChanged();
});
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class StorageCategoryFragment method onPreferenceClick.
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == mFreeUpSpacePreference) {
final Context context = getContext();
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
metricsFeatureProvider.logClickedPreference(preference, getMetricsCategory());
metricsFeatureProvider.action(context, SettingsEnums.STORAGE_FREE_UP_SPACE_NOW);
final Intent intent = new Intent(StorageManager.ACTION_MANAGE_STORAGE);
context.startActivityAsUser(intent, new UserHandle(mUserId));
return true;
}
return false;
}
Aggregations