use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class SliceHalfCardRendererHelper method bindView.
void bindView(RecyclerView.ViewHolder holder, ContextualCard card, Slice slice) {
final HalfCardViewHolder view = (HalfCardViewHolder) holder;
final SliceMetadata sliceMetadata = SliceMetadata.from(mContext, slice);
final SliceAction primaryAction = sliceMetadata.getPrimaryAction();
view.icon.setImageDrawable(primaryAction.getIcon().loadDrawable(mContext));
view.title.setText(primaryAction.getTitle());
view.content.setOnClickListener(v -> {
try {
primaryAction.getAction().send();
} catch (PendingIntent.CanceledException e) {
Log.w(TAG, "Failed to start intent " + primaryAction.getTitle());
}
final String log = ContextualCardLogUtils.buildCardClickLog(card, 0, /* row */
EventInfo.ACTION_TYPE_CONTENT, view.getAdapterPosition());
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_CLICK, log);
});
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class SliceContextualCardController method onDismissed.
@Override
public void onDismissed(ContextualCard card) {
ThreadUtils.postOnBackgroundThread(() -> {
final ContextualCardFeatureProvider cardFeatureProvider = FeatureFactory.getFactory(mContext).getContextualCardFeatureProvider(mContext);
cardFeatureProvider.markCardAsDismissed(mContext, card.getName());
});
showFeedbackDialog(card);
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_DISMISS, ContextualCardLogUtils.buildCardDismissLog(card));
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class SliceFullCardRendererHelper method bindView.
void bindView(RecyclerView.ViewHolder holder, ContextualCard card, Slice slice) {
final SliceViewHolder cardHolder = (SliceViewHolder) holder;
cardHolder.sliceView.setScrollable(false);
cardHolder.sliceView.setTag(card.getSliceUri());
cardHolder.sliceView.setMode(SliceView.MODE_LARGE);
cardHolder.sliceView.setSlice(slice);
// Set this listener so we can log the interaction users make on the slice
cardHolder.sliceView.setOnSliceActionListener((eventInfo, sliceItem) -> {
final String log = ContextualCardLogUtils.buildCardClickLog(card, eventInfo.rowIndex, eventInfo.actionType, cardHolder.getAdapterPosition());
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_CLICK, log);
});
// Customize slice view for Settings
cardHolder.sliceView.setShowTitleItems(true);
if (card.isLargeCard()) {
cardHolder.sliceView.setShowHeaderDivider(true);
cardHolder.sliceView.setShowActionDividers(true);
}
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
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).isSameInstanceAs(feature2);
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
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);
}
Aggregations