Search in sources :

Example 56 with VisibleForTesting

use of androidx.annotation.VisibleForTesting 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);
}
Also used : MetricsFeatureProvider(com.android.settingslib.core.instrumentation.MetricsFeatureProvider) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 57 with VisibleForTesting

use of androidx.annotation.VisibleForTesting 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);
}
Also used : MetricsFeatureProvider(com.android.settingslib.core.instrumentation.MetricsFeatureProvider) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 58 with VisibleForTesting

use of androidx.annotation.VisibleForTesting 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);
    }
}
Also used : MetricsFeatureProvider(com.android.settingslib.core.instrumentation.MetricsFeatureProvider) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 59 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppDataUsage method bindData.

@VisibleForTesting
void bindData(int position) {
    final long backgroundBytes, foregroundBytes;
    if (mUsageData == null || position >= mUsageData.size()) {
        backgroundBytes = foregroundBytes = 0;
        mCycle.setVisible(false);
    } else {
        mCycle.setVisible(true);
        final NetworkCycleDataForUid data = mUsageData.get(position);
        backgroundBytes = data.getBackgroudUsage();
        foregroundBytes = data.getForegroudUsage();
    }
    final long totalBytes = backgroundBytes + foregroundBytes;
    mTotalUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, totalBytes));
    mForegroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, foregroundBytes));
    mBackgroundUsage.setSummary(DataUsageUtils.formatDataUsage(mContext, backgroundBytes));
}
Also used : NetworkCycleDataForUid(com.android.settingslib.net.NetworkCycleDataForUid) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 60 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DataUsageSummaryPreference method launchWifiDataUsage.

@VisibleForTesting
static void launchWifiDataUsage(Context context) {
    final Bundle args = new Bundle(1);
    args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, NetworkTemplate.buildTemplateWifiWildcard());
    args.putInt(DataUsageList.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_WIFI);
    final SubSettingLauncher launcher = new SubSettingLauncher(context).setArguments(args).setDestination(DataUsageList.class.getName()).setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN);
    launcher.setTitleRes(R.string.wifi_data_usage);
    launcher.launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) VisibleForTesting(androidx.annotation.VisibleForTesting)

Aggregations

VisibleForTesting (androidx.annotation.VisibleForTesting)385 Intent (android.content.Intent)36 ArrayList (java.util.ArrayList)36 Context (android.content.Context)34 Bundle (android.os.Bundle)30 Uri (android.net.Uri)18 View (android.view.View)18 Preference (androidx.preference.Preference)18 TextView (android.widget.TextView)16 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)16 MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)16 SuppressLint (android.annotation.SuppressLint)15 Activity (android.app.Activity)14 RemoteException (android.os.RemoteException)14 SubscriptionInfo (android.telephony.SubscriptionInfo)12 ImageView (android.widget.ImageView)12 BluetoothDevice (android.bluetooth.BluetoothDevice)11 ComponentName (android.content.ComponentName)11 Drawable (android.graphics.drawable.Drawable)11 SharedPreferences (android.content.SharedPreferences)10