Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01aeadc authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez
Browse files

Adding volume slider tracker configuration.

A customized SeekableSliderTrackerConfig object is supplied to the
vertical volume slider haptics. The purpose is to decrease the lower
bookend threshold and increase the upper booken threshold. With
this,bookend haptics will correspond to the lower and upper limits of
the volume stream controlled by the volume slider.

Test: atest SystemUITests:VolumeDialogImplTest
Test: manual. Short-press volume keys to reach uppper and lower bookends
  -> verify that haptics are delivered on the true upper and lower
  limits
Flag: ACONFIG com.android.systemui.haptic_volume_slider NEXTFOOD
Bug: 341664106
Change-Id: I861d6e4628b4123a34697180bf63508d7b9dcc22
parent 321860fa
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -118,6 +118,7 @@ import com.android.systemui.Dumpable;
import com.android.systemui.Prefs;
import com.android.systemui.Prefs;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.haptics.slider.HapticSliderViewBinder;
import com.android.systemui.haptics.slider.HapticSliderViewBinder;
import com.android.systemui.haptics.slider.SeekableSliderTrackerConfig;
import com.android.systemui.haptics.slider.SeekbarHapticPlugin;
import com.android.systemui.haptics.slider.SeekbarHapticPlugin;
import com.android.systemui.haptics.slider.SliderHapticFeedbackConfig;
import com.android.systemui.haptics.slider.SliderHapticFeedbackConfig;
import com.android.systemui.media.dialog.MediaOutputDialogManager;
import com.android.systemui.media.dialog.MediaOutputDialogManager;
@@ -2619,6 +2620,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                /* upperBookendScale= */ 1f,
                /* upperBookendScale= */ 1f,
                /* lowerBookendScale= */ 0.05f,
                /* lowerBookendScale= */ 0.05f,
                /* exponent= */ 1f / 0.89f);
                /* exponent= */ 1f / 0.89f);
        private static final SeekableSliderTrackerConfig sSliderTrackerConfig =
                new SeekableSliderTrackerConfig(
                        /* waitTimeMillis= */100,
                        /* jumpThreshold= */0.02f,
                        /* lowerBookendThreshold= */0.01f,
                        /* upperBookendThreshold= */0.99f
                );


        private View view;
        private View view;
        private TextView header;
        private TextView header;
@@ -2661,7 +2669,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
            mHapticPlugin = new SeekbarHapticPlugin(
            mHapticPlugin = new SeekbarHapticPlugin(
                vibratorHelper,
                vibratorHelper,
                systemClock,
                systemClock,
                sSliderHapticFeedbackConfig);
                sSliderHapticFeedbackConfig,
                sSliderTrackerConfig);
        }
        }