sdm660-common: XiaomiParts: check if vibrator strength is supported before adding
Signed-off-by: Dušan Uverić <dusan.uveric9@gmail.com> Change-Id: I407d356316d8dd47da20f2c58184d0b4e2fbf633
This commit is contained in:
parent
3476f16be6
commit
87912a7d9c
1 changed files with 5 additions and 3 deletions
|
@ -32,6 +32,7 @@ import org.lineageos.settings.device.preferences.NotificationLedSeekBarPreferenc
|
|||
public class DeviceSettings extends PreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
public static final String CATEGORY_VIBRATOR = "vibration";
|
||||
public static final String PREF_VIBRATION_STRENGTH = "vibration_strength";
|
||||
public static final String VIBRATION_STRENGTH_PATH = "/sys/devices/virtual/timed_output/vibrator/vtg_level";
|
||||
|
||||
|
@ -73,9 +74,10 @@ public class DeviceSettings extends PreferenceFragment implements
|
|||
notifLedBrightness.setOnPreferenceChangeListener(this);
|
||||
} else { getPreferenceScreen().removePreference(findPreference(CATEGORY_NOTIF)); }
|
||||
|
||||
if (FileUtils.fileWritable(VIBRATION_STRENGTH_PATH)) {
|
||||
VibrationSeekBarPreference vibrationStrength = (VibrationSeekBarPreference) findPreference(PREF_VIBRATION_STRENGTH);
|
||||
vibrationStrength.setEnabled(FileUtils.fileWritable(VIBRATION_STRENGTH_PATH));
|
||||
vibrationStrength.setOnPreferenceChangeListener(this);
|
||||
} else { getPreferenceScreen().removePreference(findPreference(CATEGORY_VIBRATOR)); }
|
||||
|
||||
PreferenceCategory displayCategory = (PreferenceCategory) findPreference(CATEGORY_DISPLAY);
|
||||
if (isAppNotInstalled(DEVICE_DOZE_PACKAGE_NAME)) {
|
||||
|
|
Loading…
Reference in a new issue