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

Commit 4851fade authored by Ahmad Khalil's avatar Ahmad Khalil Committed by Android (Google) Code Review
Browse files

Merge "Adding sample code to HG" into main

parents 0e80140e dfad46e7
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 {