Revert "Add primary switch for vibration settings screen"

This reverts commit fd54fc34c6.

Reason for revert: b/215275738

Change-Id: I93612df6493a2a4184a98b3f049e23aa888095f2
This commit is contained in:
Tsung-Mao Fang
2022-01-19 03:40:40 +00:00
parent fd54fc34c6
commit 47875a5dff
14 changed files with 65 additions and 563 deletions

View File

@@ -19,7 +19,6 @@ package com.android.settings.accessibility;
import android.content.Context;
import android.os.Vibrator;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
@@ -71,22 +70,13 @@ public abstract class VibrationIntensityPreferenceController extends SliderPrefe
super.displayPreference(screen);
final SeekBarPreference preference = screen.findPreference(getPreferenceKey());
mSettingsContentObserver.onDisplayPreference(this, preference);
preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
// TODO: remove setContinuousUpdates and replace with a different way to play the haptic
// preview without relying on the setting being propagated to the service.
// TODO: remove this and replace with a different way to play the haptic preview without
// relying on the setting being propagated to the service.
preference.setContinuousUpdates(true);
preference.setMin(getMin());
preference.setMax(getMax());
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (preference != null) {
preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
}
}
@Override
public int getMin() {
return Vibrator.VIBRATION_INTENSITY_OFF;
@@ -99,19 +89,12 @@ public abstract class VibrationIntensityPreferenceController extends SliderPrefe
@Override
public int getSliderPosition() {
if (!mPreferenceConfig.isPreferenceEnabled()) {
return getMin();
}
final int position = mPreferenceConfig.readIntensity();
return Math.min(position, getMax());
}
@Override
public boolean setSliderPosition(int position) {
if (!mPreferenceConfig.isPreferenceEnabled()) {
// Ignore slider updates when the preference is disabled.
return false;
}
final int intensity = calculateVibrationIntensity(position);
final boolean success = mPreferenceConfig.updateIntensity(intensity);