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

Commit a1561e5e authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Addresses the API review feedback on HwAudioSource

Added `boolean HwAudioSource.isPlaying()`

Bug: 127464783
Test: m -j
Change-Id: Idb0e0772da009c2d9116275de9ef1b4a1bb4afc5
parent c20b41f5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3536,6 +3536,7 @@ package android.media {
  }
  public class HwAudioSource {
    method public boolean isPlaying();
    method public void start();
    method public void stop();
  }
+9 −0
Original line number Diff line number Diff line
@@ -129,12 +129,21 @@ public class HwAudioSource extends PlayerBase {
     * Starts the playback from {@link AudioDeviceInfo}.
     */
    public void start() {
        Preconditions.checkState(!isPlaying(), "HwAudioSource is currently playing");
        baseStart();
        mNativeHandle = AudioSystem.startAudioSource(
                mAudioDeviceInfo.getPort().activeConfig(),
                mAudioAttributes);
    }

    /**
     * Checks whether the HwAudioSource player is playing.
     * @return true if currently playing, false otherwise
     */
    public boolean isPlaying() {
        return mNativeHandle != 0;
    }

    /**
     * Stops the playback from {@link AudioDeviceInfo}.
     */