Search in sources :

Example 41 with MetricsFeatureProvider

use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project android_packages_apps_Settings by omnirom.

the class SetNewPasswordActivity method logSetNewPasswordIntent.

private void logSetNewPasswordIntent() {
    final String callingAppPackageName = PasswordUtils.getCallingAppPackageName(getActivityToken());
    // use int min value to denote absence of EXTRA_PASSWORD_COMPLEXITY
    final int extraPasswordComplexity = getIntent().hasExtra(EXTRA_PASSWORD_COMPLEXITY) ? getIntent().getIntExtra(EXTRA_PASSWORD_COMPLEXITY, PASSWORD_COMPLEXITY_NONE) : Integer.MIN_VALUE;
    final boolean extraDevicePasswordRequirementOnly = getIntent().getBooleanExtra(EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY, false);
    // Use 30th bit to encode extraDevicePasswordRequirementOnly, since the top bit (31th bit)
    // encodes whether EXTRA_PASSWORD_COMPLEXITY has been absent.
    final int logValue = extraPasswordComplexity | (extraDevicePasswordRequirementOnly ? 1 << 30 : 0);
    // this activity is launched by either ACTION_SET_NEW_PASSWORD or
    // ACTION_SET_NEW_PARENT_PROFILE_PASSWORD
    final int action = ACTION_SET_NEW_PASSWORD.equals(mNewPasswordAction) ? SettingsEnums.ACTION_SET_NEW_PASSWORD : SettingsEnums.ACTION_SET_NEW_PARENT_PROFILE_PASSWORD;
    final MetricsFeatureProvider metricsProvider = FeatureFactory.getFactory(this).getMetricsFeatureProvider();
    metricsProvider.action(metricsProvider.getAttribution(this), action, SettingsEnums.SET_NEW_PASSWORD_ACTIVITY, callingAppPackageName, logValue);
}
Also used : MetricsFeatureProvider(com.android.settingslib.core.instrumentation.MetricsFeatureProvider)

Aggregations

MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)41 VisibleForTesting (androidx.annotation.VisibleForTesting)12 Context (android.content.Context)6 Test (org.junit.Test)4 PendingIntent (android.app.PendingIntent)3 SliceMetadata (androidx.slice.SliceMetadata)3 SliceAction (androidx.slice.core.SliceAction)3 JobWorkItem (android.app.job.JobWorkItem)2 ContentResolver (android.content.ContentResolver)2 Intent (android.content.Intent)2 UserHandle (android.os.UserHandle)2 UserManager (android.os.UserManager)2 ImageView (android.widget.ImageView)2 BatteryUtils (com.android.settings.fuelgauge.BatteryUtils)2 PowerUsageFeatureProvider (com.android.settings.fuelgauge.PowerUsageFeatureProvider)2 ContextualCardFeatureProvider (com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider)2 ArrayList (java.util.ArrayList)2 CardDatabaseHelper (com.android.settings.homepage.contextualcards.CardDatabaseHelper)1 PowerAllowlistBackend (com.android.settingslib.fuelgauge.PowerAllowlistBackend)1 PowerWhitelistBackend (com.android.settingslib.fuelgauge.PowerWhitelistBackend)1