Use routed devices throughout the audio framework
After you open an audio stream, you can call getRoutedDevice() to
get which output device is actually used.
However, if you play an ALARM with a headset attached, audio comes
out of both the speaker and the headset. This is not properly reflected
with our current APIs.
Throughout the audio framework, we should use DeviceIdVector instead
of a single device when getRoutedDevice(s) are called.
This change touches many files because onAudioDeviceUpdate() has many
callers.
BYPASS_LARGE_CHANGE_WARNING
Bug: 367816690
Test: atest AAudioTests
Test: atest audiorecord_tests
Test: atest audiosystem_tests
Test: atest audiotrack_tests
Test: adb shell /data/fuzz/arm64/libaaudio_fuzzer/libaaudio_fuzzer
Test: adb shell /data/fuzz/arm64/mediaplayer_fuzzer/mediaplayer_fuzzer
Test: adb shell /data/fuzz/arm64/mediarecorder_fuzzer/mediarecorder_fuzzer
Test: OboeTester Test Output with Alarm and USB
Flag: EXEMPT refactor
Change-Id: I5e32ac5d1c24229e60112ef00d82af41d8eff6e7
diff --git a/services/oboeservice/AAudioEndpointManager.cpp b/services/oboeservice/AAudioEndpointManager.cpp
index b5ee2f2..243f1f1 100644
--- a/services/oboeservice/AAudioEndpointManager.cpp
+++ b/services/oboeservice/AAudioEndpointManager.cpp
@@ -119,8 +119,9 @@
}
}
- ALOGV("findExclusiveEndpoint_l(), found %p for device = %d, sessionId = %d",
- endpoint.get(), configuration.getDeviceId(), configuration.getSessionId());
+ ALOGV("findExclusiveEndpoint_l(), found %p for devices = %s, sessionId = %d",
+ endpoint.get(), toString(configuration.getDeviceIds()).c_str(),
+ configuration.getSessionId());
return endpoint;
}
@@ -137,8 +138,9 @@
}
}
- ALOGV("findSharedEndpoint_l(), found %p for device = %d, sessionId = %d",
- endpoint.get(), configuration.getDeviceId(), configuration.getSessionId());
+ ALOGV("findSharedEndpoint_l(), found %p for devices = %s, sessionId = %d",
+ endpoint.get(), toString(configuration.getDeviceIds()).c_str(),
+ configuration.getSessionId());
return endpoint;
}
@@ -192,8 +194,8 @@
} else {
const sp<AAudioServiceEndpointMMAP> endpointMMap =
new AAudioServiceEndpointMMAP(aaudioService);
- ALOGV("%s(), no match so try to open MMAP %p for dev %d",
- __func__, endpointMMap.get(), configuration.getDeviceId());
+ ALOGV("%s(), no match so try to open MMAP %p for devices %s",
+ __func__, endpointMMap.get(), toString(configuration.getDeviceIds()).c_str());
endpoint = endpointMMap;
const aaudio_result_t result = endpoint->open(request);
@@ -250,8 +252,9 @@
mSharedOpenCount++;
}
}
- ALOGV("%s(), created endpoint %p, requested device = %d, dir = %d",
- __func__, endpoint.get(), configuration.getDeviceId(), (int)direction);
+ ALOGV("%s(), created endpoint %p, requested device = %s, dir = %d",
+ __func__, endpoint.get(), android::toString(configuration.getDeviceIds()).c_str(),
+ (int)direction);
IPCThreadState::self()->restoreCallingIdentity(token);
}
@@ -289,8 +292,9 @@
serviceEndpoint->close();
mExclusiveCloseCount++;
- ALOGV("%s() %p for device %d",
- __func__, serviceEndpoint.get(), serviceEndpoint->getDeviceId());
+ ALOGV("%s() %p for devices %s",
+ __func__, serviceEndpoint.get(),
+ android::toString(serviceEndpoint->getDeviceIds()).c_str());
}
}
@@ -313,7 +317,8 @@
serviceEndpoint->close();
mSharedCloseCount++;
- ALOGV("%s(%p) closed for device %d",
- __func__, serviceEndpoint.get(), serviceEndpoint->getDeviceId());
+ ALOGV("%s(%p) closed for device %s",
+ __func__, serviceEndpoint.get(),
+ android::toString(serviceEndpoint->getDeviceIds()).c_str());
}
}