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;
}
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));
}
}
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);
}
}
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);
}
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);
}
Aggregations