VibratorFrequencyProfile


class VibratorFrequencyProfile
kotlin.Any
   ↳ android.os.vibrator.VibratorFrequencyProfile

Describes the output of a android.os.Vibrator for different vibration frequencies.

The profile contains the vibrator's frequency range (minimum/maximum) and maximum acceleration, enabling retrieval of supported acceleration levels for specific frequencies, if the device supports independent frequency control.

It also describes the max output acceleration (Gs), of a vibration at different supported frequencies (Hz).

Vibrators without independent frequency control do not have a frequency profile.

Summary

Public methods
SparseArray<Float!>

Returns a SparseArray representing the vibrator's output acceleration capabilities across different frequencies.

Range<Float!>?
getFrequencyRange(minOutputAccelerationGs: Float)

Returns the frequency range (in Hz) where the vibrator can sustain at least the given minimum output acceleration (Gs).

Float

Gets the maximum frequency supported by the vibrator.

Float

Returns the maximum output acceleration (in Gs) supported by the vibrator.

Float

Gets the minimum frequency supported by the vibrator.

Float

Returns the output acceleration (in Gs) for the given frequency (Hz).

Public methods

getFrequenciesOutputAcceleration

fun getFrequenciesOutputAcceleration(): SparseArray<Float!>

Returns a SparseArray representing the vibrator's output acceleration capabilities across different frequencies. This map defines the maximum acceleration the vibrator can achieve at each supported frequency.

The map's keys are frequencies in Hz, and the corresponding values are the maximum achievable output accelerations in Gs.

Return
SparseArray<Float!> A map of frequencies (Hz) to maximum accelerations (Gs). This value cannot be null.

getFrequencyRange

fun getFrequencyRange(minOutputAccelerationGs: Float): Range<Float!>?

Returns the frequency range (in Hz) where the vibrator can sustain at least the given minimum output acceleration (Gs).

Parameters
minOutputAccelerationGs Float: The minimum desired output acceleration in Gs.
Return
Range<Float!>? A Range object representing the frequency range where the vibrator can sustain at least the given minimum acceleration, or null if the minimum output acceleration cannot be achieved.

getMaxFrequencyHz

fun getMaxFrequencyHz(): Float

Gets the maximum frequency supported by the vibrator.

Return
Float the maximum frequency supported by the vibrator, in hertz.

getMaxOutputAccelerationGs

fun getMaxOutputAccelerationGs(): Float

Returns the maximum output acceleration (in Gs) supported by the vibrator. This value represents the highest acceleration the vibrator can achieve across its entire frequency range.

Return
Float The maximum output acceleration in Gs.

getMinFrequencyHz

fun getMinFrequencyHz(): Float

Gets the minimum frequency supported by the vibrator.

Return
Float the minimum frequency supported by the vibrator, in hertz.

getOutputAccelerationGs

fun getOutputAccelerationGs(frequencyHz: Float): Float

Returns the output acceleration (in Gs) for the given frequency (Hz). This method provides the actual acceleration the vibrator will produce when operating at the specified frequency, using linear interpolation over the getFrequenciesOutputAcceleration().

Parameters
frequencyHz Float: The frequency in Hz.
Return
Float The output acceleration in Gs for the given frequency.