Merge changes Ia0217951,Ie8293036,Ic359e977,I9d939d17
* changes:
audiopolicy: Refactor AudioPolicyManager::updateCallRouting
audiopolicy: Remove ; after namespace bracket
audiopolicy: Use C++11 atomics, factor out handle generation
audiopolicy: Make fields of HwModule private
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index 1a32433..f2cb25f 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -355,6 +355,6 @@
extern "C" void destroyAudioPolicyManager(AudioPolicyInterface *interface);
-}; // namespace android
+} // namespace android
#endif // ANDROID_AUDIOPOLICY_INTERFACE_H
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioCollections.h b/services/audiopolicy/common/managerdefinitions/include/AudioCollections.h
index 8f00d22..f86e75a 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioCollections.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioCollections.h
@@ -41,4 +41,4 @@
status_t dump(int fd, int spaces) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioGain.h b/services/audiopolicy/common/managerdefinitions/include/AudioGain.h
index cea5c0b..4ac508f 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioGain.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioGain.h
@@ -66,4 +66,4 @@
bool mUseInChannelMask;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
index d9cd121..65270b6 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
@@ -121,4 +121,4 @@
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
index 0be8fc1..f4cbdd9 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
@@ -214,4 +214,4 @@
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h b/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
index 385f257..c1c3f3c 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
@@ -16,6 +16,7 @@
#pragma once
+#include "HandleGenerator.h"
#include <system/audio.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
@@ -24,7 +25,7 @@
namespace android {
-class AudioPatch : public RefBase
+class AudioPatch : public RefBase, private HandleGenerator<audio_patch_handle_t>
{
public:
AudioPatch(const struct audio_patch *patch, uid_t uid);
@@ -35,9 +36,6 @@
struct audio_patch mPatch;
uid_t mUid;
audio_patch_handle_t mAfPatchHandle;
-
-private:
- static volatile int32_t mNextUniqueId;
};
class AudioPatchCollection : public DefaultKeyedVector<audio_patch_handle_t, sp<AudioPatch> >
@@ -52,4 +50,4 @@
status_t dump(int fd) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
index f2756b5..92d98a8 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
@@ -112,7 +112,7 @@
mAvailableOutputDevices.add(mDefaultOutputDevices);
mAvailableInputDevices.add(defaultInputDevice);
- module = new HwModule("primary");
+ module = new HwModule(AUDIO_HARDWARE_MODULE_ID_PRIMARY);
sp<OutputProfile> outProfile;
outProfile = new OutputProfile(String8("primary"));
@@ -121,7 +121,7 @@
new AudioProfile(AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_STEREO, 44100));
outProfile->addSupportedDevice(mDefaultOutputDevices);
outProfile->setFlags(AUDIO_OUTPUT_FLAG_PRIMARY);
- module->mOutputProfiles.add(outProfile);
+ module->addOutputProfile(outProfile);
sp<InputProfile> inProfile;
inProfile = new InputProfile(String8("primary"));
@@ -129,7 +129,7 @@
inProfile->addAudioProfile(
new AudioProfile(AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_MONO, 8000));
inProfile->addSupportedDevice(defaultInputDevice);
- module->mInputProfiles.add(inProfile);
+ module->addInputProfile(inProfile);
mHwModules.add(module);
}
@@ -143,4 +143,4 @@
bool &mIsSpeakerDrcEnabled;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
index 0bacef7..8fc6fe9 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
@@ -83,4 +83,4 @@
status_t dump(int fd) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPort.h b/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
index 4f79ed2..d520937 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
@@ -18,6 +18,7 @@
#include "AudioCollections.h"
#include "AudioProfile.h"
+#include "HandleGenerator.h"
#include <utils/String8.h>
#include <utils/Vector.h>
#include <utils/RefBase.h>
@@ -32,7 +33,7 @@
class AudioRoute;
typedef Vector<sp<AudioGain> > AudioGainCollection;
-class AudioPort : public virtual RefBase
+class AudioPort : public virtual RefBase, private HandleGenerator<audio_port_handle_t>
{
public:
AudioPort(const String8& name, audio_port_type_t type, audio_port_role_t role) :
@@ -152,7 +153,6 @@
uint32_t mFlags; // attribute flags mask (e.g primary output, direct output...).
AudioProfileVector mProfiles; // AudioProfiles supported by this port (format, Rates, Channels)
AudioRouteVector mRoutes; // Routes involving this port
- static volatile int32_t mNextUniqueId;
};
class AudioPortConfig : public virtual RefBase
@@ -176,4 +176,4 @@
struct audio_gain_config mGain;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioProfile.h b/services/audiopolicy/common/managerdefinitions/include/AudioProfile.h
index 404e27d..8741c66 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioProfile.h
@@ -349,4 +349,4 @@
bool operator == (const AudioProfile &left, const AudioProfile &right);
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
index df54f48..6b24fde 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
@@ -55,4 +55,4 @@
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioSession.h b/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
index cedf22d..0d19373 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioSession.h
@@ -102,4 +102,4 @@
status_t dump(int fd, int spaces) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioSourceDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioSourceDescriptor.h
index 7e1e24d..0d90f42 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioSourceDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioSourceDescriptor.h
@@ -56,4 +56,4 @@
status_t dump(int fd) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/ConfigParsingUtils.h b/services/audiopolicy/common/managerdefinitions/include/ConfigParsingUtils.h
index ee95ceb..a007854 100644
--- a/services/audiopolicy/common/managerdefinitions/include/ConfigParsingUtils.h
+++ b/services/audiopolicy/common/managerdefinitions/include/ConfigParsingUtils.h
@@ -56,4 +56,4 @@
static status_t loadHwModule(cnode *root, sp<HwModule> &module, AudioPolicyConfig &config);
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
index 1a644d7..92a4c3e 100644
--- a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
@@ -91,4 +91,4 @@
audio_devices_t mDeviceTypes;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h
index 9ea0aea..04831c6 100644
--- a/services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/EffectDescriptor.h
@@ -69,4 +69,4 @@
static const uint32_t MAX_EFFECTS_MEMORY = 512;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/Gains.h b/services/audiopolicy/common/managerdefinitions/include/Gains.h
index 34afc8c..8332af9 100644
--- a/services/audiopolicy/common/managerdefinitions/include/Gains.h
+++ b/services/audiopolicy/common/managerdefinitions/include/Gains.h
@@ -56,4 +56,4 @@
static const VolumeCurvePoint *sVolumeProfiles[AUDIO_STREAM_CNT][DEVICE_CATEGORY_CNT];
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/HandleGenerator.h b/services/audiopolicy/common/managerdefinitions/include/HandleGenerator.h
new file mode 100644
index 0000000..737a2e0
--- /dev/null
+++ b/services/audiopolicy/common/managerdefinitions/include/HandleGenerator.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <atomic>
+#include <limits>
+
+namespace android {
+
+template<typename T>
+class HandleGenerator {
+ protected:
+ static T getNextHandle();
+};
+
+template<typename T>
+T HandleGenerator<T>::getNextHandle() {
+ static std::atomic<uint32_t> mNextUniqueId(1);
+ uint32_t id = mNextUniqueId++;
+ while (id > std::numeric_limits<T>::max()) {
+ id -= std::numeric_limits<T>::max();
+ }
+ return static_cast<T>(id);
+}
+
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/HwModule.h b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
index 29b6b9c..cb9f49e 100644
--- a/services/audiopolicy/common/managerdefinitions/include/HwModule.h
+++ b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
@@ -44,12 +44,10 @@
const char *getName() const { return mName.string(); }
-
const DeviceVector &getDeclaredDevices() const { return mDeclaredDevices; }
void setDeclaredDevices(const DeviceVector &devices);
const InputProfileCollection &getInputProfiles() const { return mInputProfiles; }
-
const OutputProfileCollection &getOutputProfiles() const { return mOutputProfiles; }
void setProfiles(const IOProfileCollection &profiles);
@@ -76,6 +74,7 @@
status_t removeInputProfile(const String8& name);
audio_module_handle_t getHandle() const { return mHandle; }
+ void setHandle(audio_module_handle_t handle);
sp<AudioPort> findPortByTagName(const String8 &tagName) const
{
@@ -85,14 +84,13 @@
// TODO remove from here (split serialization)
void dump(int fd);
+private:
+ void refreshSupportedDevices();
+
const String8 mName; // base name of the audio HW module (primary, a2dp ...)
audio_module_handle_t mHandle;
OutputProfileCollection mOutputProfiles; // output profiles exposed by this module
InputProfileCollection mInputProfiles; // input profiles exposed by this module
-
-private:
- void refreshSupportedDevices();
-
uint32_t mHalVersion; // audio HAL API version
DeviceVector mDeclaredDevices; // devices declared in audio_policy configuration file.
AudioRouteVector mRoutes;
@@ -114,4 +112,4 @@
status_t dump(int fd) const;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
index ec04ef7..5545f0a 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
@@ -119,4 +119,4 @@
explicit OutputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SOURCE) {}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/IVolumeCurvesCollection.h b/services/audiopolicy/common/managerdefinitions/include/IVolumeCurvesCollection.h
index a3de686..7b35f66 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IVolumeCurvesCollection.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IVolumeCurvesCollection.h
@@ -51,4 +51,4 @@
virtual ~IVolumeCurvesCollection() {}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/Serializer.h b/services/audiopolicy/common/managerdefinitions/include/Serializer.h
index 078b582..597871d 100644
--- a/services/audiopolicy/common/managerdefinitions/include/Serializer.h
+++ b/services/audiopolicy/common/managerdefinitions/include/Serializer.h
@@ -234,4 +234,4 @@
// Children are: ModulesTraits, VolumeTraits
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h b/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
index 75bfd9d..fc2c273 100644
--- a/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
+++ b/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
@@ -115,4 +115,4 @@
const session_route_map_type_t mMapType;
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/SoundTriggerSession.h b/services/audiopolicy/common/managerdefinitions/include/SoundTriggerSession.h
index 420e6d7..f895599 100644
--- a/services/audiopolicy/common/managerdefinitions/include/SoundTriggerSession.h
+++ b/services/audiopolicy/common/managerdefinitions/include/SoundTriggerSession.h
@@ -30,4 +30,4 @@
status_t acquireSession(audio_session_t session, audio_io_handle_t ioHandle);
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
index 8822927..50b1037 100644
--- a/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
@@ -107,4 +107,4 @@
void setVolumeIndexMax(audio_stream_type_t stream,int volIndexMax);
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/TypeConverter.h b/services/audiopolicy/common/managerdefinitions/include/TypeConverter.h
index fc95eb9..63c19d1 100644
--- a/services/audiopolicy/common/managerdefinitions/include/TypeConverter.h
+++ b/services/audiopolicy/common/managerdefinitions/include/TypeConverter.h
@@ -58,4 +58,4 @@
template <>
const RuleTypeConverter::Table RuleTypeConverter::mTable[];
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h b/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h
index e7fcefc..db25ed8 100644
--- a/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h
+++ b/services/audiopolicy/common/managerdefinitions/include/VolumeCurve.h
@@ -230,4 +230,4 @@
}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioCollections.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioCollections.cpp
index 4316307..ca67b87 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioCollections.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioCollections.cpp
@@ -53,4 +53,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioGain.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioGain.cpp
index e454941..193d4a6 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioGain.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioGain.cpp
@@ -126,4 +126,4 @@
write(fd, result.string(), result.size());
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
index 32606ea..a9fe48d 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
@@ -22,15 +22,12 @@
#include "TypeConverter.h"
#include <log/log.h>
-#include <cutils/atomic.h>
#include <utils/String8.h>
namespace android {
-int32_t volatile AudioPatch::mNextUniqueId = 1;
-
AudioPatch::AudioPatch(const struct audio_patch *patch, uid_t uid) :
- mHandle(static_cast<audio_patch_handle_t>(android_atomic_inc(&mNextUniqueId))),
+ mHandle(HandleGenerator<audio_patch_handle_t>::getNextHandle()),
mPatch(*patch),
mUid(uid),
mAfPatchHandle(AUDIO_PATCH_HANDLE_NONE)
@@ -176,4 +173,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
index 53e694b..d6ea698 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
@@ -21,7 +21,6 @@
#include "HwModule.h"
#include "AudioGain.h"
#include <policy.h>
-#include <cutils/atomic.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@@ -29,8 +28,6 @@
namespace android {
-int32_t volatile AudioPort::mNextUniqueId = 1;
-
// --- AudioPort class implementation
void AudioPort::attach(const sp<HwModule>& module)
{
@@ -40,31 +37,22 @@
// Note that is a different namespace than AudioFlinger unique IDs
audio_port_handle_t AudioPort::getNextUniqueId()
{
- return static_cast<audio_port_handle_t>(android_atomic_inc(&mNextUniqueId));
+ return getNextHandle();
}
audio_module_handle_t AudioPort::getModuleHandle() const
{
- if (mModule == 0) {
- return AUDIO_MODULE_HANDLE_NONE;
- }
- return mModule->mHandle;
+ return mModule != 0 ? mModule->getHandle() : AUDIO_MODULE_HANDLE_NONE;
}
uint32_t AudioPort::getModuleVersionMajor() const
{
- if (mModule == 0) {
- return 0;
- }
- return mModule->getHalVersionMajor();
+ return mModule != 0 ? mModule->getHalVersionMajor() : 0;
}
const char *AudioPort::getModuleName() const
{
- if (mModule == 0) {
- return "invalid module";
- }
- return mModule->getName();
+ return mModule != 0 ? mModule->getName() : "invalid module";
}
void AudioPort::toAudioPort(struct audio_port *port) const
@@ -477,4 +465,4 @@
}
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioProfile.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioProfile.cpp
index 7657c4d..fd6fc1c 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioProfile.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioProfile.cpp
@@ -287,4 +287,4 @@
return AudioPort::compareFormats((*profile1)->getFormat(), (*profile2)->getFormat());
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
index 5b57d3d..7cda46b 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
@@ -290,4 +290,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/ConfigParsingUtils.cpp b/services/audiopolicy/common/managerdefinitions/src/ConfigParsingUtils.cpp
index e5888e2..1e105f5 100644
--- a/services/audiopolicy/common/managerdefinitions/src/ConfigParsingUtils.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/ConfigParsingUtils.cpp
@@ -416,4 +416,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
index fdeea29..3b1e751 100644
--- a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
@@ -245,7 +245,8 @@
// without the test?
// This has been demonstrated to NOT be true (at start up)
// ALOG_ASSERT(mModule != NULL);
- dstConfig->ext.device.hw_module = mModule != 0 ? mModule->mHandle : AUDIO_MODULE_HANDLE_NONE;
+ dstConfig->ext.device.hw_module =
+ mModule != 0 ? mModule->getHandle() : AUDIO_MODULE_HANDLE_NONE;
strncpy(dstConfig->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
}
@@ -256,7 +257,7 @@
port->id = mId;
toAudioPortConfig(&port->active_config);
port->ext.device.type = mDeviceType;
- port->ext.device.hw_module = mModule->mHandle;
+ port->ext.device.hw_module = mModule->getHandle();
strncpy(port->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
}
@@ -309,4 +310,4 @@
AudioPort::log(" ");
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/Gains.cpp b/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
index e3fc9a8..b2dafdd 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Gains.cpp
@@ -235,4 +235,4 @@
return decibels;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
index b4feb4d..aef7dbe 100644
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
@@ -212,6 +212,12 @@
}
}
+void HwModule::setHandle(audio_module_handle_t handle) {
+ ALOGW_IF(mHandle != AUDIO_MODULE_HANDLE_NONE,
+ "HwModule handle is changing from %d to %d", mHandle, handle);
+ mHandle = handle;
+}
+
void HwModule::dump(int fd)
{
const size_t SIZE = 256;
@@ -258,8 +264,8 @@
sp <HwModule> HwModuleCollection::getModuleForDevice(audio_devices_t device) const
{
for (const auto& module : *this) {
- IOProfileCollection& profiles = audio_is_output_device(device) ?
- module->mOutputProfiles : module->mInputProfiles;
+ const auto& profiles = audio_is_output_device(device) ?
+ module->getOutputProfiles() : module->getInputProfiles();
for (const auto& profile : profiles) {
if (profile->supportDevice(device)) {
return module;
diff --git a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
index 74ef4ec..4f730d5 100644
--- a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
@@ -129,4 +129,4 @@
// @TODO: forward log to AudioPort
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 0908ffc..4805c3f 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -638,4 +638,4 @@
return android::OK;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
index b3019e1..65649fb 100644
--- a/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
@@ -223,4 +223,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp b/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
index 0362037..7273d0d 100644
--- a/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/TypeConverter.cpp
@@ -65,4 +65,4 @@
template class TypeConverter<RouteFlagTraits>;
template class TypeConverter<RuleTraits>;
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp b/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
index 14caf7c..ec861c1 100644
--- a/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/VolumeCurve.cpp
@@ -138,4 +138,4 @@
return NO_ERROR;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/engine/interface/AudioPolicyManagerInterface.h b/services/audiopolicy/engine/interface/AudioPolicyManagerInterface.h
index 567ff9e..04594f5 100644
--- a/services/audiopolicy/engine/interface/AudioPolicyManagerInterface.h
+++ b/services/audiopolicy/engine/interface/AudioPolicyManagerInterface.h
@@ -137,4 +137,4 @@
virtual ~AudioPolicyManagerInterface() {}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/engine/interface/AudioPolicyManagerObserver.h b/services/audiopolicy/engine/interface/AudioPolicyManagerObserver.h
index 846fa48..b7902cf 100644
--- a/services/audiopolicy/engine/interface/AudioPolicyManagerObserver.h
+++ b/services/audiopolicy/engine/interface/AudioPolicyManagerObserver.h
@@ -59,4 +59,4 @@
virtual ~AudioPolicyManagerObserver() {}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/engineconfigurable/include/AudioPolicyEngineInstance.h b/services/audiopolicy/engineconfigurable/include/AudioPolicyEngineInstance.h
index 6c4be2c..a597e87 100644
--- a/services/audiopolicy/engineconfigurable/include/AudioPolicyEngineInstance.h
+++ b/services/audiopolicy/engineconfigurable/include/AudioPolicyEngineInstance.h
@@ -76,6 +76,6 @@
template <>
AudioPolicyPluginInterface *EngineInstance::queryInterface() const;
-}; // namespace audio_policy
+} // namespace audio_policy
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h b/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
index 759d0c9..2e29a9b 100644
--- a/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
+++ b/services/audiopolicy/engineconfigurable/interface/AudioPolicyPluginInterface.h
@@ -143,4 +143,4 @@
virtual ~AudioPolicyPluginInterface() {}
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.h b/services/audiopolicy/engineconfigurable/src/Engine.h
index bc5e035..328d23d 100644
--- a/services/audiopolicy/engineconfigurable/src/Engine.h
+++ b/services/audiopolicy/engineconfigurable/src/Engine.h
@@ -194,7 +194,7 @@
AudioPolicyManagerObserver *mApmObserver;
};
-}; // namespace audio_policy
+} // namespace audio_policy
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/manager/AudioPolicyFactory.cpp b/services/audiopolicy/manager/AudioPolicyFactory.cpp
index 9910a1f..3efa1b0 100644
--- a/services/audiopolicy/manager/AudioPolicyFactory.cpp
+++ b/services/audiopolicy/manager/AudioPolicyFactory.cpp
@@ -29,4 +29,4 @@
delete interface;
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 7366378..ad24439 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -32,7 +32,6 @@
#include <AudioPolicyManagerInterface.h>
#include <AudioPolicyEngineInstance.h>
-#include <cutils/atomic.h>
#include <cutils/properties.h>
#include <utils/Log.h>
#include <media/AudioParameter.h>
@@ -387,9 +386,6 @@
uint32_t AudioPolicyManager::updateCallRouting(audio_devices_t rxDevice, uint32_t delayMs)
{
bool createTxPatch = false;
- status_t status;
- audio_patch_handle_t afPatchHandle;
- DeviceVector deviceList;
uint32_t muteWaitMs = 0;
if(!hasPrimaryOutput() || mPrimaryOutput->device() == AUDIO_DEVICE_OUT_STUB) {
@@ -421,80 +417,48 @@
createTxPatch = true;
}
} else { // create RX path audio patch
- struct audio_patch patch;
-
- patch.num_sources = 1;
- patch.num_sinks = 1;
- deviceList = mAvailableOutputDevices.getDevicesFromType(rxDevice);
- ALOG_ASSERT(!deviceList.isEmpty(),
- "updateCallRouting() selected device not in output device list");
- sp<DeviceDescriptor> rxSinkDeviceDesc = deviceList.itemAt(0);
- deviceList = mAvailableInputDevices.getDevicesFromType(AUDIO_DEVICE_IN_TELEPHONY_RX);
- ALOG_ASSERT(!deviceList.isEmpty(),
- "updateCallRouting() no telephony RX device");
- sp<DeviceDescriptor> rxSourceDeviceDesc = deviceList.itemAt(0);
-
- rxSourceDeviceDesc->toAudioPortConfig(&patch.sources[0]);
- rxSinkDeviceDesc->toAudioPortConfig(&patch.sinks[0]);
-
- // request to reuse existing output stream if one is already opened to reach the RX device
- SortedVector<audio_io_handle_t> outputs =
- getOutputsForDevice(rxDevice, mOutputs);
- audio_io_handle_t output = selectOutput(outputs,
- AUDIO_OUTPUT_FLAG_NONE,
- AUDIO_FORMAT_INVALID);
- if (output != AUDIO_IO_HANDLE_NONE) {
- sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
- ALOG_ASSERT(!outputDesc->isDuplicated(),
- "updateCallRouting() RX device output is duplicated");
- outputDesc->toAudioPortConfig(&patch.sources[1]);
- patch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
- patch.num_sources = 2;
- }
-
- afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
- status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, delayMs);
- ALOGW_IF(status != NO_ERROR, "updateCallRouting() error %d creating RX audio patch",
- status);
- if (status == NO_ERROR) {
- mCallRxPatch = new AudioPatch(&patch, mUidCached);
- mCallRxPatch->mAfPatchHandle = afPatchHandle;
- mCallRxPatch->mUid = mUidCached;
- }
+ mCallRxPatch = createTelephonyPatch(true /*isRx*/, rxDevice, delayMs);
createTxPatch = true;
}
if (createTxPatch) { // create TX path audio patch
- struct audio_patch patch;
+ mCallTxPatch = createTelephonyPatch(false /*isRx*/, txDevice, delayMs);
+ }
- patch.num_sources = 1;
- patch.num_sinks = 1;
- deviceList = mAvailableInputDevices.getDevicesFromType(txDevice);
- ALOG_ASSERT(!deviceList.isEmpty(),
- "updateCallRouting() selected device not in input device list");
- sp<DeviceDescriptor> txSourceDeviceDesc = deviceList.itemAt(0);
- txSourceDeviceDesc->toAudioPortConfig(&patch.sources[0]);
- deviceList = mAvailableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_TELEPHONY_TX);
- ALOG_ASSERT(!deviceList.isEmpty(),
- "updateCallRouting() no telephony TX device");
- sp<DeviceDescriptor> txSinkDeviceDesc = deviceList.itemAt(0);
- txSinkDeviceDesc->toAudioPortConfig(&patch.sinks[0]);
+ return muteWaitMs;
+}
- SortedVector<audio_io_handle_t> outputs =
- getOutputsForDevice(AUDIO_DEVICE_OUT_TELEPHONY_TX, mOutputs);
- audio_io_handle_t output = selectOutput(outputs,
- AUDIO_OUTPUT_FLAG_NONE,
- AUDIO_FORMAT_INVALID);
- // request to reuse existing output stream if one is already opened to reach the TX
- // path output device
- if (output != AUDIO_IO_HANDLE_NONE) {
- sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
- ALOG_ASSERT(!outputDesc->isDuplicated(),
- "updateCallRouting() RX device output is duplicated");
- outputDesc->toAudioPortConfig(&patch.sources[1]);
- patch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
- patch.num_sources = 2;
- }
+sp<AudioPatch> AudioPolicyManager::createTelephonyPatch(
+ bool isRx, audio_devices_t device, uint32_t delayMs) {
+ struct audio_patch patch;
+ patch.num_sources = 1;
+ patch.num_sinks = 1;
+ sp<DeviceDescriptor> txSourceDeviceDesc;
+ if (isRx) {
+ fillAudioPortConfigForDevice(mAvailableOutputDevices, device, &patch.sinks[0]);
+ fillAudioPortConfigForDevice(
+ mAvailableInputDevices, AUDIO_DEVICE_IN_TELEPHONY_RX, &patch.sources[0]);
+ } else {
+ txSourceDeviceDesc = fillAudioPortConfigForDevice(
+ mAvailableInputDevices, device, &patch.sources[0]);
+ fillAudioPortConfigForDevice(
+ mAvailableOutputDevices, AUDIO_DEVICE_OUT_TELEPHONY_TX, &patch.sinks[0]);
+ }
+
+ audio_devices_t outputDevice = isRx ? device : AUDIO_DEVICE_OUT_TELEPHONY_TX;
+ SortedVector<audio_io_handle_t> outputs = getOutputsForDevice(outputDevice, mOutputs);
+ audio_io_handle_t output = selectOutput(outputs, AUDIO_OUTPUT_FLAG_NONE, AUDIO_FORMAT_INVALID);
+ // request to reuse existing output stream if one is already opened to reach the target device
+ if (output != AUDIO_IO_HANDLE_NONE) {
+ sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
+ ALOG_ASSERT(!outputDesc->isDuplicated(),
+ "%s() %#x device output %d is duplicated", __func__, outputDevice, output);
+ outputDesc->toAudioPortConfig(&patch.sources[1]);
+ patch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
+ patch.num_sources = 2;
+ }
+
+ if (!isRx) {
// terminate active capture if on the same HW module as the call TX source device
// FIXME: would be better to refine to only inputs whose profile connects to the
// call TX device but this information is not in the audio patch and logic here must be
@@ -510,19 +474,29 @@
}
}
}
-
- afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
- status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, delayMs);
- ALOGW_IF(status != NO_ERROR, "setPhoneState() error %d creating TX audio patch",
- status);
- if (status == NO_ERROR) {
- mCallTxPatch = new AudioPatch(&patch, mUidCached);
- mCallTxPatch->mAfPatchHandle = afPatchHandle;
- mCallTxPatch->mUid = mUidCached;
- }
}
- return muteWaitMs;
+ audio_patch_handle_t afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
+ status_t status = mpClientInterface->createAudioPatch(&patch, &afPatchHandle, delayMs);
+ ALOGW_IF(status != NO_ERROR,
+ "%s() error %d creating %s audio patch", __func__, status, isRx ? "RX" : "TX");
+ sp<AudioPatch> audioPatch;
+ if (status == NO_ERROR) {
+ audioPatch = new AudioPatch(&patch, mUidCached);
+ audioPatch->mAfPatchHandle = afPatchHandle;
+ audioPatch->mUid = mUidCached;
+ }
+ return audioPatch;
+}
+
+sp<DeviceDescriptor> AudioPolicyManager::fillAudioPortConfigForDevice(
+ const DeviceVector& devices, audio_devices_t device, audio_port_config *config) {
+ DeviceVector deviceList = devices.getDevicesFromType(device);
+ ALOG_ASSERT(!deviceList.isEmpty(),
+ "%s() selected device type %#x is not in devices list", __func__, device);
+ sp<DeviceDescriptor> deviceDesc = deviceList.itemAt(0);
+ deviceDesc->toAudioPortConfig(config);
+ return deviceDesc;
}
void AudioPolicyManager::setPhoneState(audio_mode_t state)
@@ -718,7 +692,7 @@
sp<IOProfile> profile;
for (const auto& hwModule : mHwModules) {
- for (const auto& curProfile : hwModule->mOutputProfiles) {
+ for (const auto& curProfile : hwModule->getOutputProfiles()) {
if (!curProfile->isCompatibleProfile(device, String8(""),
samplingRate, NULL /*updatedSamplingRate*/,
format, NULL /*updatedFormat*/,
@@ -3437,7 +3411,7 @@
// ----------------------------------------------------------------------------
uint32_t AudioPolicyManager::nextAudioPortGeneration()
{
- return android_atomic_inc(&mAudioPortGeneration);
+ return mAudioPortGeneration++;
}
#ifdef USE_XML_AUDIO_POLICY_CONF
@@ -3529,7 +3503,7 @@
audio_devices_t outputDeviceTypes = mAvailableOutputDevices.types();
audio_devices_t inputDeviceTypes = mAvailableInputDevices.types() & ~AUDIO_DEVICE_BIT_IN;
for (const auto& hwModule : mHwModulesAll) {
- hwModule->mHandle = mpClientInterface->loadHwModule(hwModule->getName());
+ hwModule->setHandle(mpClientInterface->loadHwModule(hwModule->getName()));
if (hwModule->getHandle() == AUDIO_MODULE_HANDLE_NONE) {
ALOGW("could not open HW module %s", hwModule->getName());
continue;
@@ -3539,7 +3513,7 @@
// except for direct output streams that are only opened when they are actually
// required by an app.
// This also validates mAvailableOutputDevices list
- for (const auto& outProfile : hwModule->mOutputProfiles) {
+ for (const auto& outProfile : hwModule->getOutputProfiles()) {
if (!outProfile->hasSupportedDevices()) {
ALOGW("Output profile contains no device on module %s", hwModule->getName());
continue;
@@ -3599,7 +3573,7 @@
}
// open input streams needed to access attached devices to validate
// mAvailableInputDevices list
- for (const auto& inProfile : hwModule->mInputProfiles) {
+ for (const auto& inProfile : hwModule->getInputProfiles()) {
if (!inProfile->hasSupportedDevices()) {
ALOGW("Input profile contains no device on module %s", hwModule->getName());
continue;
@@ -3761,8 +3735,8 @@
// then look for output profiles that can be routed to this device
SortedVector< sp<IOProfile> > profiles;
for (const auto& hwModule : mHwModules) {
- for (size_t j = 0; j < hwModule->mOutputProfiles.size(); j++) {
- sp<IOProfile> profile = hwModule->mOutputProfiles[j];
+ for (size_t j = 0; j < hwModule->getOutputProfiles().size(); j++) {
+ sp<IOProfile> profile = hwModule->getOutputProfiles()[j];
if (profile->supportDevice(device)) {
if (!device_distinguishes_on_address(device) ||
profile->supportDeviceAddress(address)) {
@@ -3933,8 +3907,8 @@
}
// Clear any profiles associated with the disconnected device.
for (const auto& hwModule : mHwModules) {
- for (size_t j = 0; j < hwModule->mOutputProfiles.size(); j++) {
- sp<IOProfile> profile = hwModule->mOutputProfiles[j];
+ for (size_t j = 0; j < hwModule->getOutputProfiles().size(); j++) {
+ sp<IOProfile> profile = hwModule->getOutputProfiles()[j];
if (profile->supportDevice(device)) {
ALOGV("checkOutputsForDevice(): "
"clearing direct output profile %zu on module %s",
@@ -3974,9 +3948,9 @@
SortedVector< sp<IOProfile> > profiles;
for (const auto& hwModule : mHwModules) {
for (size_t profile_index = 0;
- profile_index < hwModule->mInputProfiles.size();
+ profile_index < hwModule->getInputProfiles().size();
profile_index++) {
- sp<IOProfile> profile = hwModule->mInputProfiles[profile_index];
+ sp<IOProfile> profile = hwModule->getInputProfiles()[profile_index];
if (profile->supportDevice(device)) {
if (!device_distinguishes_on_address(device) ||
@@ -4072,9 +4046,9 @@
// Clear any profiles associated with the disconnected device.
for (const auto& hwModule : mHwModules) {
for (size_t profile_index = 0;
- profile_index < hwModule->mInputProfiles.size();
+ profile_index < hwModule->getInputProfiles().size();
profile_index++) {
- sp<IOProfile> profile = hwModule->mInputProfiles[profile_index];
+ sp<IOProfile> profile = hwModule->getInputProfiles()[profile_index];
if (profile->supportDevice(device)) {
ALOGV("checkInputsForDevice(): clearing direct input profile %zu on module %s",
profile_index, hwModule->getName());
@@ -4916,7 +4890,7 @@
// the best matching profile, not the first one.
for (const auto& hwModule : mHwModules) {
- for (const auto& profile : hwModule->mInputProfiles) {
+ for (const auto& profile : hwModule->getInputProfiles()) {
// profile->log();
if (profile->isCompatibleProfile(device, address, samplingRate,
&samplingRate /*updatedSamplingRate*/,
@@ -5566,4 +5540,4 @@
}
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index b61bc2d..6038e33 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -16,6 +16,8 @@
#pragma once
+#include <atomic>
+
#include <stdint.h>
#include <sys/types.h>
#include <cutils/config_utils.h>
@@ -468,6 +470,9 @@
}
uint32_t updateCallRouting(audio_devices_t rxDevice, uint32_t delayMs = 0);
+ sp<AudioPatch> createTelephonyPatch(bool isRx, audio_devices_t device, uint32_t delayMs);
+ sp<DeviceDescriptor> fillAudioPortConfigForDevice(
+ const DeviceVector& devices, audio_devices_t device, audio_port_config *config);
// if argument "device" is different from AUDIO_DEVICE_NONE, startSource() will force
// the re-evaluation of the output device.
@@ -534,7 +539,7 @@
HwModuleCollection mHwModulesAll; // normally not needed, used during construction and for
// dumps
- volatile int32_t mAudioPortGeneration;
+ std::atomic<uint32_t> mAudioPortGeneration;
AudioPatchCollection mAudioPatches;
diff --git a/services/audiopolicy/service/AudioPolicyClientImpl.cpp b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
index 31c9575..b064f8c 100644
--- a/services/audiopolicy/service/AudioPolicyClientImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
@@ -233,4 +233,4 @@
return AudioSystem::newAudioUniqueId(use);
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyEffects.cpp b/services/audiopolicy/service/AudioPolicyEffects.cpp
index 84b1073..7fe363d 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.cpp
+++ b/services/audiopolicy/service/AudioPolicyEffects.cpp
@@ -744,4 +744,4 @@
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h
index 59d5d14..623180e 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.h
+++ b/services/audiopolicy/service/AudioPolicyEffects.h
@@ -192,6 +192,6 @@
KeyedVector< audio_session_t, EffectVector* > mOutputSessions;
};
-}; // namespace android
+} // namespace android
#endif // ANDROID_AUDIOPOLICYEFFECTS_H
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 1ee5ccf..7dd6d70 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -778,4 +778,4 @@
}
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 7af2e74..af0c823 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -1146,4 +1146,4 @@
int aps_set_voice_volume(void *service, float volume, int delay_ms);
};
-}; // namespace android
+} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index 268697e..833a230 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -577,6 +577,6 @@
audio_mode_t mPhoneState;
};
-}; // namespace android
+} // namespace android
#endif // ANDROID_AUDIOPOLICYSERVICE_H