use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class PremiumSmsAccess method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(int smsState, String packageName) {
int category = SmsManager.PREMIUM_SMS_CONSENT_UNKNOWN;
switch(smsState) {
case SmsManager.PREMIUM_SMS_CONSENT_ASK_USER:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_ASK;
break;
case SmsManager.PREMIUM_SMS_CONSENT_NEVER_ALLOW:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_DENY;
break;
case SmsManager.PREMIUM_SMS_CONSENT_ALWAYS_ALLOW:
category = SettingsEnums.APP_SPECIAL_PERMISSION_PREMIUM_SMS_ALWAYS_ALLOW;
break;
}
if (category != SmsManager.PREMIUM_SMS_CONSENT_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 android_packages_apps_Settings by omnirom.
the class AnomalyDetectionJobService method onStartJob.
@Override
public boolean onStartJob(JobParameters params) {
synchronized (mLock) {
mIsJobCanceled = false;
}
ThreadUtils.postOnBackgroundThread(() -> {
final Context context = AnomalyDetectionJobService.this;
final BatteryDatabaseManager batteryDatabaseManager = BatteryDatabaseManager.getInstance(this);
final BatteryTipPolicy policy = new BatteryTipPolicy(this);
final BatteryUtils batteryUtils = BatteryUtils.getInstance(this);
final ContentResolver contentResolver = getContentResolver();
final UserManager userManager = getSystemService(UserManager.class);
final PowerAllowlistBackend powerAllowlistBackend = PowerAllowlistBackend.getInstance(context);
final PowerUsageFeatureProvider powerUsageFeatureProvider = FeatureFactory.getFactory(this).getPowerUsageFeatureProvider(this);
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(this).getMetricsFeatureProvider();
for (JobWorkItem item = dequeueWork(params); item != null; item = dequeueWork(params)) {
saveAnomalyToDatabase(context, userManager, batteryDatabaseManager, batteryUtils, policy, powerAllowlistBackend, contentResolver, powerUsageFeatureProvider, metricsFeatureProvider, item.getIntent().getExtras());
completeWork(params, item);
}
});
return true;
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class BluetoothDevicePreference method onClicked.
void onClicked() {
Context context = getContext();
int bondState = mCachedDevice.getBondState();
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
if (mCachedDevice.isConnected()) {
metricsFeatureProvider.action(context, SettingsEnums.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
askDisconnect();
} else if (bondState == BluetoothDevice.BOND_BONDED) {
metricsFeatureProvider.action(context, SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT);
mCachedDevice.connect();
} else if (bondState == BluetoothDevice.BOND_NONE) {
metricsFeatureProvider.action(context, SettingsEnums.ACTION_SETTINGS_BLUETOOTH_PAIR);
if (!mCachedDevice.hasHumanReadableName()) {
metricsFeatureProvider.action(context, SettingsEnums.ACTION_SETTINGS_BLUETOOTH_PAIR_DEVICES_WITHOUT_NAMES);
}
pair();
}
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class StorageDashboardFragment 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;
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.
the class DrawOverlayDetails method logSpecialPermissionChange.
@VisibleForTesting
void logSpecialPermissionChange(boolean newState, String packageName) {
int logCategory = newState ? SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_ALLOW : SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_DENY;
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
metricsFeatureProvider.action(metricsFeatureProvider.getAttribution(getActivity()), logCategory, getMetricsCategory(), packageName, 0);
}
Aggregations