Update doc for HapticGenerator.

The controlling of which audio channel to be used for generating haptic
data is not yet provided.

Add doc for HapticGenerator#isAvailable.

Bug: 178196051
Test: make
Change-Id: I4717c5225f5a3701523b94ccc88f4f7aea9dd49b
This commit is contained in:
jiabin
2021-01-22 17:22:10 +00:00
parent fa5c2e7b40
commit 37fac86bc8

View File

@@ -30,8 +30,7 @@ import java.util.UUID;
* device supporting audio-coupled-haptic playback. Call {@link HapticGenerator#isAvailable()} to
* check if the device supports this effect.
* <p>An application can create a HapticGenerator object to initiate and control this audio effect
* in the audio framework. An application can set which audio channel to be used to generate
* haptic data.
* in the audio framework.
* <p>To attach the HapticGenerator to a particular AudioTrack or MediaPlayer, specify the audio
* session ID of this AudioTrack or MediaPlayer when constructing the HapticGenerator.
* <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
@@ -47,6 +46,9 @@ public class HapticGenerator extends AudioEffect implements AutoCloseable {
// haptic data based on the raw audio data.
private AudioEffect mVolumeControlEffect;
/**
* @return true if the HapticGenerator is available on the device.
*/
public static boolean isAvailable() {
return AudioManager.isHapticPlaybackSupported()
&& AudioEffect.isEffectTypeAvailable(AudioEffect.EFFECT_TYPE_HAPTIC_GENERATOR);