Search in sources :

Example 31 with VisibleForTesting

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

the class AccessibilityHearingAidPreferenceController method getConnectedHearingAidDevice.

@VisibleForTesting
CachedBluetoothDevice getConnectedHearingAidDevice() {
    if (!mHearingAidProfileSupported) {
        return null;
    }
    if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
        return null;
    }
    final List<BluetoothDevice> deviceList = mLocalBluetoothManager.getProfileManager().getHearingAidProfile().getConnectedDevices();
    final Iterator it = deviceList.iterator();
    while (it.hasNext()) {
        BluetoothDevice obj = (BluetoothDevice) it.next();
        if (!mLocalBluetoothManager.getCachedDeviceManager().isSubDevice(obj)) {
            return mLocalBluetoothManager.getCachedDeviceManager().findDevice(obj);
        }
    }
    return null;
}
Also used : BluetoothDevice(android.bluetooth.BluetoothDevice) CachedBluetoothDevice(com.android.settingslib.bluetooth.CachedBluetoothDevice) Iterator(java.util.Iterator) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 32 with VisibleForTesting

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

the class AccessibilitySettings method updateVibrationSummary.

@VisibleForTesting
void updateVibrationSummary(Preference pref) {
    final Context context = getContext();
    final Vibrator vibrator = context.getSystemService(Vibrator.class);
    int ringIntensity = Settings.System.getInt(context.getContentResolver(), Settings.System.RING_VIBRATION_INTENSITY, vibrator.getDefaultRingVibrationIntensity());
    if (Settings.System.getInt(context.getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, 0) == 0 && !isRampingRingerEnabled(context)) {
        ringIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
    }
    CharSequence ringIntensityString = VibrationIntensityPreferenceController.getIntensityString(context, ringIntensity);
    int notificationIntensity = Settings.System.getInt(context.getContentResolver(), Settings.System.NOTIFICATION_VIBRATION_INTENSITY, vibrator.getDefaultNotificationVibrationIntensity());
    CharSequence notificationIntensityString = VibrationIntensityPreferenceController.getIntensityString(context, notificationIntensity);
    int touchIntensity = Settings.System.getInt(context.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_INTENSITY, vibrator.getDefaultHapticFeedbackIntensity());
    if (Settings.System.getInt(context.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) == 0) {
        touchIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
    }
    CharSequence touchIntensityString = VibrationIntensityPreferenceController.getIntensityString(context, touchIntensity);
    if (mVibrationPreferenceScreen == null) {
        mVibrationPreferenceScreen = findPreference(VIBRATION_PREFERENCE_SCREEN);
    }
    if (ringIntensity == touchIntensity && ringIntensity == notificationIntensity) {
        mVibrationPreferenceScreen.setSummary(ringIntensityString);
    } else {
        mVibrationPreferenceScreen.setSummary(getString(R.string.accessibility_vibration_summary, ringIntensityString, notificationIntensityString, touchIntensityString));
    }
}
Also used : Context(android.content.Context) Vibrator(android.os.Vibrator) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 33 with VisibleForTesting

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

the class AccountDetailDashboardFragment method updateUi.

@VisibleForTesting
void updateUi() {
    final Context context = getContext();
    UserHandle userHandle = null;
    Bundle args = getArguments();
    if (args != null && args.containsKey(KEY_USER_HANDLE)) {
        userHandle = args.getParcelable(KEY_USER_HANDLE);
    }
    final AuthenticatorHelper helper = new AuthenticatorHelper(context, userHandle, null);
    final AccountTypePreferenceLoader accountTypePreferenceLoader = new AccountTypePreferenceLoader(this, helper, userHandle);
    PreferenceScreen prefs = accountTypePreferenceLoader.addPreferencesForType(mAccountType, getPreferenceScreen());
    if (prefs != null) {
        accountTypePreferenceLoader.updatePreferenceIntents(prefs, mAccountType, mAccount);
    }
}
Also used : Context(android.content.Context) AuthenticatorHelper(com.android.settingslib.accounts.AuthenticatorHelper) PreferenceScreen(androidx.preference.PreferenceScreen) Bundle(android.os.Bundle) UserHandle(android.os.UserHandle) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 34 with VisibleForTesting

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

the class AppInfoDashboardFragment method startListeningToPackageRemove.

@VisibleForTesting
void startListeningToPackageRemove() {
    if (mListeningToPackageRemove) {
        return;
    }
    mListeningToPackageRemove = true;
    final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_REMOVED);
    filter.addDataScheme("package");
    getContext().registerReceiver(mPackageRemovedReceiver, filter);
}
Also used : IntentFilter(android.content.IntentFilter) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 35 with VisibleForTesting

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

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