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

Commit dfad46e7 authored by Ahmad Khalil's avatar Ahmad Khalil
Browse files

Adding sample code to HG

We're adding a simple sample code on how to use the Haptic Generator in the class javadoc.

Bug: 395070772
Flag: EXEMPT updating javadocs
Test: N/A
Change-Id: I07d9a7f62357d3af284e1d204a6a27d81698e6d1
parent 934dd3a2
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -36,6 +36,20 @@ import java.util.UUID;
 * <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
 * <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling audio
 * effects.
 *
 * <pre>{@code
 * AudioManager audioManager = context.getSystemService(AudioManager.class);
 * player = MediaPlayer.create(
 *         context,
 *         audioUri,
 *         new AudioAttributes.Builder().setHapticChannelsMuted(false).build(),
 *         audioManager.generateAudioSessionId()
 * );
 * if (HapticGenerator.isAvailable()) {
 *     HapticGenerator.create(player.getAudioSessionId()).setEnabled(true);
 * }
 * player.start();
 * }</pre>
 */
public class HapticGenerator extends AudioEffect implements AutoCloseable {