use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EligibleCardChecker method call.
@Override
public ContextualCard call() throws Exception {
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 Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VrListenerSettings method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(boolean enable, String packageName) {
int logCategory = enable ? SettingsEnums.APP_SPECIAL_PERMISSION_VRHELPER_ALLOW : SettingsEnums.APP_SPECIAL_PERMISSION_VRHELPER_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 PictureInPictureDetails method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(boolean newState, String packageName) {
int logCategory = newState ? SettingsEnums.APP_PICTURE_IN_PICTURE_ALLOW : SettingsEnums.APP_PICTURE_IN_PICTURE_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 PremiumSmsAccess method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(int smsState, String packageName) {
int category = SmsUsageMonitor.PREMIUM_SMS_PERMISSION_UNKNOWN;
switch(smsState) {
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ASK_USER:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_ASK;
break;
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_NEVER_ALLOW:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_DENY;
break;
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ALWAYS_ALLOW:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_ALWAYS_ALLOW;
break;
}
if (category != SmsUsageMonitor.PREMIUM_SMS_PERMISSION_UNKNOWN) {
// TODO(117860032): Category is wrong. It should be defined in SettingsEnums.
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
metricsFeatureProvider.action(metricsFeatureProvider.getAttribution(getActivity()), category, getMetricsCategory(), packageName, smsState);
}
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceDeferredSetupCardRendererHelper method bindView.
void bindView(RecyclerView.ViewHolder holder, ContextualCard card, Slice slice) {
final DeferredSetupCardViewHolder view = (DeferredSetupCardViewHolder) 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.summary.setText(sliceMetadata.getSubtitle());
view.button.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);
});
}
Aggregations