• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.volume.haptics.ui
18 
19 import com.android.systemui.haptics.slider.SeekableSliderTrackerConfig
20 import com.android.systemui.haptics.slider.SliderHapticFeedbackConfig
21 import com.android.systemui.haptics.slider.SliderHapticFeedbackFilter
22 
23 object VolumeHapticsConfigsProvider {
24 
sliderHapticFeedbackConfignull25     fun sliderHapticFeedbackConfig(
26         valueRange: ClosedFloatingPointRange<Float>,
27         filter: SliderHapticFeedbackFilter = SliderHapticFeedbackFilter(),
28     ): SliderHapticFeedbackConfig {
29         val sliderStepSize = 1f / (valueRange.endInclusive - valueRange.start)
30         return SliderHapticFeedbackConfig(
31             lowerBookendScale = 0.2f,
32             progressBasedDragMinScale = 0.2f,
33             progressBasedDragMaxScale = 0.5f,
34             deltaProgressForDragThreshold = 0f,
35             additionalVelocityMaxBump = 0.2f,
36             maxVelocityToScale = 0.1f, /* slider progress(from 0 to 1) per sec */
37             sliderStepSize = sliderStepSize,
38             filter = filter,
39         )
40     }
41 
42     val seekableSliderTrackerConfig =
43         SeekableSliderTrackerConfig(lowerBookendThreshold = 0f, upperBookendThreshold = 1f)
44 }
45