Skip to content
Snippets Groups Projects
Commit 1939ee37 authored by Shunkai Yao's avatar Shunkai Yao Committed by Mikhail Naganov
Browse files

AudioService: check for AIDL service availbility

Bug: 264712385
Test: atest CtsMediaAudioTestCases:android.media.audio.cts.AudioManagerTest
Change-Id: Ifdb4aa136314cedf975cbd9f3e5e0c46d593033d
parent 51748c97
No related branches found
No related tags found
No related merge requests found
......@@ -12053,12 +12053,16 @@ public class AudioService extends IAudioService.Stub
public @Nullable AudioHalVersionInfo getHalVersion() {
for (AudioHalVersionInfo version : AudioHalVersionInfo.VERSIONS) {
try {
// TODO: check AIDL service.
String versionStr = version.getMajorVersion() + "." + version.getMinorVersion();
HwBinder.getService(
String.format("android.hardware.audio@%s::IDevicesFactory", versionStr),
"default");
return version;
final String aidlStr = "android.hardware.audio.core.IModule/default";
final String hidlStr = String.format("android.hardware.audio@%s::IDevicesFactory",
versionStr);
if (null != ServiceManager.checkService(aidlStr)) {
return version;
} else {
HwBinder.getService(hidlStr, "default");
return version;
}
} catch (NoSuchElementException e) {
// Ignore, the specified HAL interface is not found.
} catch (RemoteException re) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment