Expose the dynamic routing enabled flag to CTS test
CarAudioManager behaves differently depends on whether the
dynamic routing flag is turned on of not. Therefore, a new @TestApi is
added to CarAudioManager for testing purpose.
Bug: 120627682
Test: atest android.car.cts.CarAudioManagerTest
Change-Id: I3701c738565213def895bb0307d82ab7405e7c0d
diff --git a/car-lib/api/test-current.txt b/car-lib/api/test-current.txt
index c5c41b6..ca87f9a 100644
--- a/car-lib/api/test-current.txt
+++ b/car-lib/api/test-current.txt
@@ -6,3 +6,11 @@
}
+package android.car.media {
+
+ public final class CarAudioManager {
+ method public boolean isDynamicRoutingEnabled() throws android.car.CarNotConnectedException;
+ }
+
+}
+
diff --git a/car-lib/src/android/car/media/CarAudioManager.java b/car-lib/src/android/car/media/CarAudioManager.java
index 4aa1ebf..e3eda4a 100644
--- a/car-lib/src/android/car/media/CarAudioManager.java
+++ b/car-lib/src/android/car/media/CarAudioManager.java
@@ -16,6 +16,7 @@
package android.car.media;
import android.annotation.NonNull;
+import android.annotation.TestApi;
import android.car.CarLibLog;
import android.car.CarManagerBase;
import android.car.CarNotConnectedException;
@@ -73,6 +74,20 @@
};
/**
+ * @return Whether dynamic routing is enabled or not.
+ * @hide
+ */
+ @TestApi
+ public boolean isDynamicRoutingEnabled() throws CarNotConnectedException {
+ try {
+ return mService.isDynamicRoutingEnabled();
+ } catch (RemoteException e) {
+ Log.e(CarLibLog.TAG_CAR, "isDynamicRoutingEnabled failed", e);
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ /**
* Sets the volume index for a volume group in primary zone.
*
* @see {@link #setGroupVolume(int, int, int, int)}
diff --git a/car-lib/src/android/car/media/ICarAudio.aidl b/car-lib/src/android/car/media/ICarAudio.aidl
index c343c42..178f75a 100644
--- a/car-lib/src/android/car/media/ICarAudio.aidl
+++ b/car-lib/src/android/car/media/ICarAudio.aidl
@@ -25,6 +25,8 @@
* @hide
*/
interface ICarAudio {
+ boolean isDynamicRoutingEnabled();
+
void setGroupVolume(int zoneId, int groupId, int index, int flags);
int getGroupMaxVolume(int zoneId, int groupId);
int getGroupMinVolume(int zoneId, int groupId);
diff --git a/service/src/com/android/car/audio/CarAudioService.java b/service/src/com/android/car/audio/CarAudioService.java
index 324c5ac..3c5434d 100644
--- a/service/src/com/android/car/audio/CarAudioService.java
+++ b/service/src/com/android/car/audio/CarAudioService.java
@@ -266,6 +266,11 @@
}
}
+ @Override
+ public boolean isDynamicRoutingEnabled() {
+ return mUseDynamicRouting;
+ }
+
/**
* @see {@link android.car.media.CarAudioManager#setGroupVolume(int, int, int, int)}
*/