From 14d8412455894f7123fa12faa478fa396907fd2a Mon Sep 17 00:00:00 2001 From: Alexey Kuzmin Date: Fri, 17 May 2019 16:51:18 +0100 Subject: [PATCH] Add a clarifying comment Bug: 130332550 Test: no test Change-Id: If6dea9b5deab35f8c2da1019c17be80bbf1c5fd8 --- .../accessibility/VibrationPreferenceFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/com/android/settings/accessibility/VibrationPreferenceFragment.java b/src/com/android/settings/accessibility/VibrationPreferenceFragment.java index c23a25a5ff2..deaef469c42 100644 --- a/src/com/android/settings/accessibility/VibrationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/VibrationPreferenceFragment.java @@ -129,6 +129,13 @@ public abstract class VibrationPreferenceFragment extends RadioButtonPickerFragm Settings.System.putInt(getContext().getContentResolver(), getVibrationIntensitySetting(), candidate.getIntensity()); } else { + // We can't play preview effect here for all cases because that causes a data race + // (VibratorService may access intensity settings before these settings are updated). + // But we can't just play it in intensity settings update observer, because the + // intensity settings are not changed if we turn the vibration off, then on. + // + // In this case we sould play the preview here. + // To be refactored in b/132952771 playVibrationPreview(); } }