diff options
| author | 2022-03-16 18:39:47 -0700 | |
|---|---|---|
| committer | 2022-03-16 18:48:24 -0700 | |
| commit | beac78f2521c520e8fd555642effaee7e8a31d1e (patch) | |
| tree | 1ea022f37d11a5882c7c294bc7728f9f640f6a9b | |
| parent | ec74b17af9245145f7b6c859f584290d720b0874 (diff) | |
Spatializer: output listener fires upon registration
Address API council feedback to have the output change listener
report the current output upon registration.
Bug: 203004903
Test: atest SpatializerTest
Change-Id: I858a5efef91ad113d02af6734b7b625460f29634
| -rw-r--r-- | media/java/android/media/Spatializer.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/media/java/android/media/Spatializer.java b/media/java/android/media/Spatializer.java index be0ef37345ed..3376943cd583 100644 --- a/media/java/android/media/Spatializer.java +++ b/media/java/android/media/Spatializer.java @@ -827,8 +827,12 @@ public class Spatializer { /** * @hide - * Returns the id of the output stream used for the spatializer effect playback + * Returns the id of the output stream used for the spatializer effect playback. + * This getter or associated listener {@link OnSpatializerOutputChangedListener} can be used for + * handling spatializer output-specific configurations (e.g. disabling speaker post-processing + * to avoid double-processing of the spatialized path). * @return id of the output stream, or 0 if no spatializer playback is active + * @see #setOnSpatializerOutputChangedListener(Executor, OnSpatializerOutputChangedListener) */ @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS) @RequiresPermission(android.Manifest.permission.MODIFY_DEFAULT_AUDIO_EFFECTS) @@ -865,6 +869,8 @@ public class Spatializer { mOutputDispatcher = new SpatializerOutputDispatcherStub(); try { mAm.getService().registerSpatializerOutputCallback(mOutputDispatcher); + // immediately report the current output + mOutputDispatcher.dispatchSpatializerOutputChanged(getOutput()); } catch (RemoteException e) { mOutputListener = null; mOutputDispatcher = null; |