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

Commit 37fac86b authored by jiabin's avatar jiabin
Browse files

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
parent fa5c2e7b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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);