blob: 767c45200d3ca5d7f195cbe55d2446d34a9cfe2d [file] [log] [blame]
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006-2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "AudioSystem"
18//#define LOG_NDEBUG 0
19
20#include <utils/Log.h>
Mathias Agopian75624082009-05-19 19:08:10 -070021#include <binder/IServiceManager.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080022#include <media/AudioSystem.h>
Eric Laurentc2f1f072009-07-17 12:17:14 -070023#include <media/IAudioPolicyService.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080024#include <math.h>
25
Dima Zavin64760242011-05-11 14:15:23 -070026#include <system/audio.h>
Dima Zavinfce7a472011-04-19 22:30:36 -070027
Eric Laurentc2f1f072009-07-17 12:17:14 -070028// ----------------------------------------------------------------------------
Eric Laurentc2f1f072009-07-17 12:17:14 -070029
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080030namespace android {
31
32// client singleton for AudioFlinger binder interface
33Mutex AudioSystem::gLock;
34sp<IAudioFlinger> AudioSystem::gAudioFlinger;
35sp<AudioSystem::AudioFlingerClient> AudioSystem::gAudioFlingerClient;
36audio_error_callback AudioSystem::gAudioErrorCallback = NULL;
37// Cached values
Glenn Kasten211eeaf2012-01-20 09:37:45 -080038
Eric Laurentc2f1f072009-07-17 12:17:14 -070039DefaultKeyedVector<audio_io_handle_t, AudioSystem::OutputDescriptor *> AudioSystem::gOutputs(0);
40
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -080041// Cached values for recording queries, all protected by gLock
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080042uint32_t AudioSystem::gPrevInSamplingRate = 16000;
Glenn Kasten58f30212012-01-12 12:27:51 -080043audio_format_t AudioSystem::gPrevInFormat = AUDIO_FORMAT_PCM_16_BIT;
Glenn Kastendd8104c2012-07-02 12:42:44 -070044audio_channel_mask_t AudioSystem::gPrevInChannelMask = AUDIO_CHANNEL_IN_MONO;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080045size_t AudioSystem::gInBuffSize = 0;
46
47
48// establish binder interface to AudioFlinger service
49const sp<IAudioFlinger>& AudioSystem::get_audio_flinger()
50{
51 Mutex::Autolock _l(gLock);
Glenn Kasten7fc9a6f2012-01-10 10:46:34 -080052 if (gAudioFlinger == 0) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080053 sp<IServiceManager> sm = defaultServiceManager();
54 sp<IBinder> binder;
55 do {
56 binder = sm->getService(String16("media.audio_flinger"));
57 if (binder != 0)
58 break;
Steve Block5ff1dd52012-01-05 23:22:43 +000059 ALOGW("AudioFlinger not published, waiting...");
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080060 usleep(500000); // 0.5 s
Glenn Kastene53b9ea2012-03-12 16:29:55 -070061 } while (true);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080062 if (gAudioFlingerClient == NULL) {
63 gAudioFlingerClient = new AudioFlingerClient();
64 } else {
65 if (gAudioErrorCallback) {
66 gAudioErrorCallback(NO_ERROR);
67 }
Glenn Kastene53b9ea2012-03-12 16:29:55 -070068 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080069 binder->linkToDeath(gAudioFlingerClient);
70 gAudioFlinger = interface_cast<IAudioFlinger>(binder);
71 gAudioFlinger->registerClient(gAudioFlingerClient);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080072 }
Steve Block29357bc2012-01-06 19:20:56 +000073 ALOGE_IF(gAudioFlinger==0, "no AudioFlinger!?");
Eric Laurentc2f1f072009-07-17 12:17:14 -070074
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080075 return gAudioFlinger;
76}
77
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080078status_t AudioSystem::muteMicrophone(bool state) {
79 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
80 if (af == 0) return PERMISSION_DENIED;
81 return af->setMicMute(state);
82}
83
84status_t AudioSystem::isMicrophoneMuted(bool* state) {
85 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
86 if (af == 0) return PERMISSION_DENIED;
87 *state = af->getMicMute();
88 return NO_ERROR;
89}
90
91status_t AudioSystem::setMasterVolume(float value)
92{
93 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
94 if (af == 0) return PERMISSION_DENIED;
95 af->setMasterVolume(value);
96 return NO_ERROR;
97}
98
99status_t AudioSystem::setMasterMute(bool mute)
100{
101 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
102 if (af == 0) return PERMISSION_DENIED;
103 af->setMasterMute(mute);
104 return NO_ERROR;
105}
106
107status_t AudioSystem::getMasterVolume(float* volume)
108{
109 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
110 if (af == 0) return PERMISSION_DENIED;
111 *volume = af->masterVolume();
112 return NO_ERROR;
113}
114
115status_t AudioSystem::getMasterMute(bool* mute)
116{
117 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
118 if (af == 0) return PERMISSION_DENIED;
119 *mute = af->masterMute();
120 return NO_ERROR;
121}
122
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800123status_t AudioSystem::setStreamVolume(audio_stream_type_t stream, float value,
124 audio_io_handle_t output)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800125{
Dima Zavinfce7a472011-04-19 22:30:36 -0700126 if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800127 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
128 if (af == 0) return PERMISSION_DENIED;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700129 af->setStreamVolume(stream, value, output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800130 return NO_ERROR;
131}
132
Glenn Kastenfff6d712012-01-12 16:38:12 -0800133status_t AudioSystem::setStreamMute(audio_stream_type_t stream, bool mute)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800134{
Dima Zavinfce7a472011-04-19 22:30:36 -0700135 if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800136 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
137 if (af == 0) return PERMISSION_DENIED;
138 af->setStreamMute(stream, mute);
139 return NO_ERROR;
140}
141
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800142status_t AudioSystem::getStreamVolume(audio_stream_type_t stream, float* volume,
143 audio_io_handle_t output)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800144{
Dima Zavinfce7a472011-04-19 22:30:36 -0700145 if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800146 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
147 if (af == 0) return PERMISSION_DENIED;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700148 *volume = af->streamVolume(stream, output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800149 return NO_ERROR;
150}
151
Glenn Kastenfff6d712012-01-12 16:38:12 -0800152status_t AudioSystem::getStreamMute(audio_stream_type_t stream, bool* mute)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800153{
Dima Zavinfce7a472011-04-19 22:30:36 -0700154 if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800155 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
156 if (af == 0) return PERMISSION_DENIED;
157 *mute = af->streamMute(stream);
158 return NO_ERROR;
159}
160
Glenn Kastenf78aee72012-01-04 11:00:47 -0800161status_t AudioSystem::setMode(audio_mode_t mode)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800162{
Glenn Kasten930f4ca2012-01-06 16:47:31 -0800163 if (uint32_t(mode) >= AUDIO_MODE_CNT) return BAD_VALUE;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800164 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
165 if (af == 0) return PERMISSION_DENIED;
166 return af->setMode(mode);
167}
168
Eric Laurentc2f1f072009-07-17 12:17:14 -0700169status_t AudioSystem::setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800170 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
171 if (af == 0) return PERMISSION_DENIED;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700172 return af->setParameters(ioHandle, keyValuePairs);
173}
174
175String8 AudioSystem::getParameters(audio_io_handle_t ioHandle, const String8& keys) {
176 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
177 String8 result = String8("");
178 if (af == 0) return result;
179
180 result = af->getParameters(ioHandle, keys);
181 return result;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800182}
183
184// convert volume steps to natural log scale
185
186// change this value to change volume scaling
187static const float dBPerStep = 0.5f;
188// shouldn't need to touch these
189static const float dBConvert = -dBPerStep * 2.302585093f / 20.0f;
190static const float dBConvertInverse = 1.0f / dBConvert;
191
192float AudioSystem::linearToLog(int volume)
193{
194 // float v = volume ? exp(float(100 - volume) * dBConvert) : 0;
Steve Blockb8a80522011-12-20 16:23:08 +0000195 // ALOGD("linearToLog(%d)=%f", volume, v);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800196 // return v;
197 return volume ? exp(float(100 - volume) * dBConvert) : 0;
198}
199
200int AudioSystem::logToLinear(float volume)
201{
202 // int v = volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0;
Steve Blockb8a80522011-12-20 16:23:08 +0000203 // ALOGD("logTolinear(%d)=%f", v, volume);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800204 // return v;
205 return volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0;
206}
207
Andreas Huberc8139852012-01-18 10:51:55 -0800208// DEPRECATED
209status_t AudioSystem::getOutputSamplingRate(int* samplingRate, int streamType) {
210 return getOutputSamplingRate(samplingRate, (audio_stream_type_t)streamType);
211}
212
Glenn Kastenfff6d712012-01-12 16:38:12 -0800213status_t AudioSystem::getOutputSamplingRate(int* samplingRate, audio_stream_type_t streamType)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800214{
Eric Laurentc2f1f072009-07-17 12:17:14 -0700215 audio_io_handle_t output;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800216
Dima Zavinfce7a472011-04-19 22:30:36 -0700217 if (streamType == AUDIO_STREAM_DEFAULT) {
218 streamType = AUDIO_STREAM_MUSIC;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700219 }
220
Glenn Kastenfff6d712012-01-12 16:38:12 -0800221 output = getOutput(streamType);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700222 if (output == 0) {
223 return PERMISSION_DENIED;
224 }
225
Eric Laurent1a9ed112012-03-20 18:36:01 -0700226 return getSamplingRate(output, streamType, samplingRate);
227}
228
229status_t AudioSystem::getSamplingRate(audio_io_handle_t output,
230 audio_stream_type_t streamType,
231 int* samplingRate)
232{
233 OutputDescriptor *outputDesc;
234
Eric Laurentc2f1f072009-07-17 12:17:14 -0700235 gLock.lock();
236 outputDesc = AudioSystem::gOutputs.valueFor(output);
Glenn Kastena0d68332012-01-27 16:47:15 -0800237 if (outputDesc == NULL) {
Steve Block3856b092011-10-20 11:56:00 +0100238 ALOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700239 gLock.unlock();
240 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
241 if (af == 0) return PERMISSION_DENIED;
242 *samplingRate = af->sampleRate(output);
243 } else {
Steve Block3856b092011-10-20 11:56:00 +0100244 ALOGV("getOutputSamplingRate() reading from output desc");
Eric Laurentc2f1f072009-07-17 12:17:14 -0700245 *samplingRate = outputDesc->samplingRate;
246 gLock.unlock();
247 }
248
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700249 ALOGV("getSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output,
250 *samplingRate);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700251
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800252 return NO_ERROR;
253}
254
Andreas Huberc8139852012-01-18 10:51:55 -0800255// DEPRECATED
256status_t AudioSystem::getOutputFrameCount(int* frameCount, int streamType) {
257 return getOutputFrameCount(frameCount, (audio_stream_type_t)streamType);
258}
259
Glenn Kastenfff6d712012-01-12 16:38:12 -0800260status_t AudioSystem::getOutputFrameCount(int* frameCount, audio_stream_type_t streamType)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800261{
Eric Laurentc2f1f072009-07-17 12:17:14 -0700262 audio_io_handle_t output;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800263
Dima Zavinfce7a472011-04-19 22:30:36 -0700264 if (streamType == AUDIO_STREAM_DEFAULT) {
265 streamType = AUDIO_STREAM_MUSIC;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700266 }
Eric Laurent48f7f5e2009-04-02 09:32:43 -0700267
Glenn Kastenfff6d712012-01-12 16:38:12 -0800268 output = getOutput(streamType);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700269 if (output == 0) {
270 return PERMISSION_DENIED;
271 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800272
Eric Laurent1a9ed112012-03-20 18:36:01 -0700273 return getFrameCount(output, streamType, frameCount);
274}
275
276status_t AudioSystem::getFrameCount(audio_io_handle_t output,
277 audio_stream_type_t streamType,
278 int* frameCount)
279{
280 OutputDescriptor *outputDesc;
281
Eric Laurentc2f1f072009-07-17 12:17:14 -0700282 gLock.lock();
283 outputDesc = AudioSystem::gOutputs.valueFor(output);
Glenn Kastena0d68332012-01-27 16:47:15 -0800284 if (outputDesc == NULL) {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700285 gLock.unlock();
286 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
287 if (af == 0) return PERMISSION_DENIED;
288 *frameCount = af->frameCount(output);
289 } else {
290 *frameCount = outputDesc->frameCount;
291 gLock.unlock();
292 }
293
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700294 ALOGV("getFrameCount() streamType %d, output %d, frameCount %d", streamType, output,
295 *frameCount);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700296
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800297 return NO_ERROR;
298}
299
Glenn Kastenfff6d712012-01-12 16:38:12 -0800300status_t AudioSystem::getOutputLatency(uint32_t* latency, audio_stream_type_t streamType)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800301{
Eric Laurentc2f1f072009-07-17 12:17:14 -0700302 audio_io_handle_t output;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800303
Dima Zavinfce7a472011-04-19 22:30:36 -0700304 if (streamType == AUDIO_STREAM_DEFAULT) {
305 streamType = AUDIO_STREAM_MUSIC;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700306 }
Eric Laurent48f7f5e2009-04-02 09:32:43 -0700307
Glenn Kastenfff6d712012-01-12 16:38:12 -0800308 output = getOutput(streamType);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700309 if (output == 0) {
310 return PERMISSION_DENIED;
311 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800312
Eric Laurent1a9ed112012-03-20 18:36:01 -0700313 return getLatency(output, streamType, latency);
314}
315
316status_t AudioSystem::getLatency(audio_io_handle_t output,
317 audio_stream_type_t streamType,
318 uint32_t* latency)
319{
320 OutputDescriptor *outputDesc;
321
Eric Laurentc2f1f072009-07-17 12:17:14 -0700322 gLock.lock();
323 outputDesc = AudioSystem::gOutputs.valueFor(output);
Glenn Kastena0d68332012-01-27 16:47:15 -0800324 if (outputDesc == NULL) {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700325 gLock.unlock();
326 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
327 if (af == 0) return PERMISSION_DENIED;
328 *latency = af->latency(output);
329 } else {
330 *latency = outputDesc->latency;
331 gLock.unlock();
332 }
333
Eric Laurent1a9ed112012-03-20 18:36:01 -0700334 ALOGV("getLatency() streamType %d, output %d, latency %d", streamType, output, *latency);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700335
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800336 return NO_ERROR;
337}
338
Glenn Kastendd8104c2012-07-02 12:42:44 -0700339status_t AudioSystem::getInputBufferSize(uint32_t sampleRate, audio_format_t format,
340 audio_channel_mask_t channelMask, size_t* buffSize)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800341{
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800342 gLock.lock();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800343 // Do we have a stale gInBufferSize or are we requesting the input buffer size for new values
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800344 size_t inBuffSize = gInBuffSize;
345 if ((inBuffSize == 0) || (sampleRate != gPrevInSamplingRate) || (format != gPrevInFormat)
Glenn Kastendd8104c2012-07-02 12:42:44 -0700346 || (channelMask != gPrevInChannelMask)) {
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800347 gLock.unlock();
348 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
349 if (af == 0) {
350 return PERMISSION_DENIED;
351 }
Glenn Kastendd8104c2012-07-02 12:42:44 -0700352 inBuffSize = af->getInputBufferSize(sampleRate, format, channelMask);
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800353 gLock.lock();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800354 // save the request params
355 gPrevInSamplingRate = sampleRate;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700356 gPrevInFormat = format;
Glenn Kastendd8104c2012-07-02 12:42:44 -0700357 gPrevInChannelMask = channelMask;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800358
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800359 gInBuffSize = inBuffSize;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700360 }
Glenn Kastenf8c1a6f2012-01-10 09:01:19 -0800361 gLock.unlock();
362 *buffSize = inBuffSize;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700363
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800364 return NO_ERROR;
365}
366
Eric Laurentf0ee6f42009-10-21 08:14:22 -0700367status_t AudioSystem::setVoiceVolume(float value)
368{
369 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
370 if (af == 0) return PERMISSION_DENIED;
371 return af->setVoiceVolume(value);
372}
373
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700374status_t AudioSystem::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames,
375 audio_stream_type_t stream)
Eric Laurent342e9cf2010-01-19 17:37:09 -0800376{
377 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
378 if (af == 0) return PERMISSION_DENIED;
379
Dima Zavinfce7a472011-04-19 22:30:36 -0700380 if (stream == AUDIO_STREAM_DEFAULT) {
381 stream = AUDIO_STREAM_MUSIC;
Eric Laurent342e9cf2010-01-19 17:37:09 -0800382 }
383
Glenn Kastenfff6d712012-01-12 16:38:12 -0800384 return af->getRenderPosition(halFrames, dspFrames, getOutput(stream));
Eric Laurent342e9cf2010-01-19 17:37:09 -0800385}
386
Eric Laurent05bca2f2010-02-26 02:47:27 -0800387unsigned int AudioSystem::getInputFramesLost(audio_io_handle_t ioHandle) {
388 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
389 unsigned int result = 0;
390 if (af == 0) return result;
Eric Laurentbe55a2d2010-03-11 14:47:00 -0800391 if (ioHandle == 0) return result;
Eric Laurent05bca2f2010-02-26 02:47:27 -0800392
393 result = af->getInputFramesLost(ioHandle);
394 return result;
395}
396
Eric Laurentbe916aa2010-06-01 23:49:17 -0700397int AudioSystem::newAudioSessionId() {
398 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
399 if (af == 0) return 0;
400 return af->newAudioSessionId();
401}
402
Marco Nelissen3a34bef2011-08-02 13:33:41 -0700403void AudioSystem::acquireAudioSessionId(int audioSession) {
404 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
405 if (af != 0) {
406 af->acquireAudioSessionId(audioSession);
407 }
408}
409
410void AudioSystem::releaseAudioSessionId(int audioSession) {
411 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
412 if (af != 0) {
413 af->releaseAudioSessionId(audioSession);
414 }
415}
416
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800417// ---------------------------------------------------------------------------
418
Eric Laurentc2f1f072009-07-17 12:17:14 -0700419void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800420 Mutex::Autolock _l(AudioSystem::gLock);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800421
Eric Laurentc2f1f072009-07-17 12:17:14 -0700422 AudioSystem::gAudioFlinger.clear();
Eric Laurent0ef583f2010-01-25 10:27:15 -0800423 // clear output handles and stream to output map caches
Eric Laurent0ef583f2010-01-25 10:27:15 -0800424 AudioSystem::gOutputs.clear();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800425
426 if (gAudioErrorCallback) {
427 gAudioErrorCallback(DEAD_OBJECT);
428 }
Steve Block5ff1dd52012-01-05 23:22:43 +0000429 ALOGW("AudioFlinger server died!");
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800430}
431
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800432void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, audio_io_handle_t ioHandle,
Glenn Kastenb81cc8c2012-03-01 09:14:51 -0800433 const void *param2) {
Steve Block3856b092011-10-20 11:56:00 +0100434 ALOGV("ioConfigChanged() event %d", event);
Glenn Kastenb81cc8c2012-03-01 09:14:51 -0800435 const OutputDescriptor *desc;
Glenn Kasten211eeaf2012-01-20 09:37:45 -0800436 audio_stream_type_t stream;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700437
Eric Laurentfa2877b2009-07-28 08:44:33 -0700438 if (ioHandle == 0) return;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700439
440 Mutex::Autolock _l(AudioSystem::gLock);
441
442 switch (event) {
443 case STREAM_CONFIG_CHANGED:
Eric Laurentc2f1f072009-07-17 12:17:14 -0700444 break;
445 case OUTPUT_OPENED: {
446 if (gOutputs.indexOfKey(ioHandle) >= 0) {
Steve Block3856b092011-10-20 11:56:00 +0100447 ALOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700448 break;
449 }
Glenn Kastena0d68332012-01-27 16:47:15 -0800450 if (param2 == NULL) break;
Glenn Kastenb81cc8c2012-03-01 09:14:51 -0800451 desc = (const OutputDescriptor *)param2;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700452
453 OutputDescriptor *outputDesc = new OutputDescriptor(*desc);
454 gOutputs.add(ioHandle, outputDesc);
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700455 ALOGV("ioConfigChanged() new output samplingRate %d, format %d channels %#x frameCount %d "
456 "latency %d",
457 outputDesc->samplingRate, outputDesc->format, outputDesc->channels,
458 outputDesc->frameCount, outputDesc->latency);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700459 } break;
460 case OUTPUT_CLOSED: {
461 if (gOutputs.indexOfKey(ioHandle) < 0) {
Steve Block5ff1dd52012-01-05 23:22:43 +0000462 ALOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700463 break;
464 }
Steve Block3856b092011-10-20 11:56:00 +0100465 ALOGV("ioConfigChanged() output %d closed", ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700466
467 gOutputs.removeItem(ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700468 } break;
469
470 case OUTPUT_CONFIG_CHANGED: {
471 int index = gOutputs.indexOfKey(ioHandle);
472 if (index < 0) {
Steve Block5ff1dd52012-01-05 23:22:43 +0000473 ALOGW("ioConfigChanged() modifying unknow output! %d", ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700474 break;
475 }
Glenn Kastena0d68332012-01-27 16:47:15 -0800476 if (param2 == NULL) break;
Glenn Kastenb81cc8c2012-03-01 09:14:51 -0800477 desc = (const OutputDescriptor *)param2;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700478
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700479 ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %#x "
480 "frameCount %d latency %d",
Eric Laurentc2f1f072009-07-17 12:17:14 -0700481 ioHandle, desc->samplingRate, desc->format,
482 desc->channels, desc->frameCount, desc->latency);
483 OutputDescriptor *outputDesc = gOutputs.valueAt(index);
484 delete outputDesc;
485 outputDesc = new OutputDescriptor(*desc);
486 gOutputs.replaceValueFor(ioHandle, outputDesc);
487 } break;
488 case INPUT_OPENED:
489 case INPUT_CLOSED:
490 case INPUT_CONFIG_CHANGED:
491 break;
492
493 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800494}
495
496void AudioSystem::setErrorCallback(audio_error_callback cb) {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700497 Mutex::Autolock _l(gLock);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800498 gAudioErrorCallback = cb;
499}
500
Glenn Kastenfff6d712012-01-12 16:38:12 -0800501bool AudioSystem::routedToA2dpOutput(audio_stream_type_t streamType) {
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700502 switch (streamType) {
Dima Zavinfce7a472011-04-19 22:30:36 -0700503 case AUDIO_STREAM_MUSIC:
504 case AUDIO_STREAM_VOICE_CALL:
505 case AUDIO_STREAM_BLUETOOTH_SCO:
506 case AUDIO_STREAM_SYSTEM:
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800507 return true;
508 default:
509 return false;
510 }
511}
512
513
Eric Laurentc2f1f072009-07-17 12:17:14 -0700514// client singleton for AudioPolicyService binder interface
515sp<IAudioPolicyService> AudioSystem::gAudioPolicyService;
516sp<AudioSystem::AudioPolicyServiceClient> AudioSystem::gAudioPolicyServiceClient;
517
518
Glenn Kasten18a6d902012-09-24 11:27:56 -0700519// establish binder interface to AudioPolicy service
Eric Laurentc2f1f072009-07-17 12:17:14 -0700520const sp<IAudioPolicyService>& AudioSystem::get_audio_policy_service()
521{
522 gLock.lock();
Glenn Kasten7fc9a6f2012-01-10 10:46:34 -0800523 if (gAudioPolicyService == 0) {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700524 sp<IServiceManager> sm = defaultServiceManager();
525 sp<IBinder> binder;
526 do {
527 binder = sm->getService(String16("media.audio_policy"));
528 if (binder != 0)
529 break;
Steve Block5ff1dd52012-01-05 23:22:43 +0000530 ALOGW("AudioPolicyService not published, waiting...");
Eric Laurentc2f1f072009-07-17 12:17:14 -0700531 usleep(500000); // 0.5 s
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700532 } while (true);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700533 if (gAudioPolicyServiceClient == NULL) {
534 gAudioPolicyServiceClient = new AudioPolicyServiceClient();
535 }
536 binder->linkToDeath(gAudioPolicyServiceClient);
537 gAudioPolicyService = interface_cast<IAudioPolicyService>(binder);
538 gLock.unlock();
539 } else {
540 gLock.unlock();
541 }
542 return gAudioPolicyService;
543}
544
Dima Zavinfce7a472011-04-19 22:30:36 -0700545status_t AudioSystem::setDeviceConnectionState(audio_devices_t device,
546 audio_policy_dev_state_t state,
547 const char *device_address)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700548{
549 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
Eric Laurent71b63e32011-09-02 14:20:56 -0700550 const char *address = "";
551
Eric Laurentc2f1f072009-07-17 12:17:14 -0700552 if (aps == 0) return PERMISSION_DENIED;
553
Eric Laurent71b63e32011-09-02 14:20:56 -0700554 if (device_address != NULL) {
555 address = device_address;
556 }
557
558 return aps->setDeviceConnectionState(device, state, address);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700559}
560
Dima Zavinfce7a472011-04-19 22:30:36 -0700561audio_policy_dev_state_t AudioSystem::getDeviceConnectionState(audio_devices_t device,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700562 const char *device_address)
563{
564 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
Dima Zavinfce7a472011-04-19 22:30:36 -0700565 if (aps == 0) return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700566
567 return aps->getDeviceConnectionState(device, device_address);
568}
569
Glenn Kastenf78aee72012-01-04 11:00:47 -0800570status_t AudioSystem::setPhoneState(audio_mode_t state)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700571{
Glenn Kasten347966c2012-01-18 14:58:32 -0800572 if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700573 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
574 if (aps == 0) return PERMISSION_DENIED;
575
576 return aps->setPhoneState(state);
577}
578
Dima Zavinfce7a472011-04-19 22:30:36 -0700579status_t AudioSystem::setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700580{
581 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
582 if (aps == 0) return PERMISSION_DENIED;
583 return aps->setForceUse(usage, config);
584}
585
Dima Zavinfce7a472011-04-19 22:30:36 -0700586audio_policy_forced_cfg_t AudioSystem::getForceUse(audio_policy_force_use_t usage)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700587{
588 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
Dima Zavinfce7a472011-04-19 22:30:36 -0700589 if (aps == 0) return AUDIO_POLICY_FORCE_NONE;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700590 return aps->getForceUse(usage);
591}
592
593
Dima Zavinfce7a472011-04-19 22:30:36 -0700594audio_io_handle_t AudioSystem::getOutput(audio_stream_type_t stream,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700595 uint32_t samplingRate,
Glenn Kasten58f30212012-01-12 12:27:51 -0800596 audio_format_t format,
Glenn Kasten254af182012-07-03 14:59:05 -0700597 audio_channel_mask_t channelMask,
Eric Laurent0ca3cf92012-04-18 09:24:29 -0700598 audio_output_flags_t flags)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700599{
Eric Laurent1a9ed112012-03-20 18:36:01 -0700600 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
601 if (aps == 0) return 0;
Glenn Kasten254af182012-07-03 14:59:05 -0700602 return aps->getOutput(stream, samplingRate, format, channelMask, flags);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700603}
604
Eric Laurentde070132010-07-13 04:45:46 -0700605status_t AudioSystem::startOutput(audio_io_handle_t output,
Dima Zavinfce7a472011-04-19 22:30:36 -0700606 audio_stream_type_t stream,
Eric Laurentde070132010-07-13 04:45:46 -0700607 int session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700608{
609 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
610 if (aps == 0) return PERMISSION_DENIED;
Eric Laurentde070132010-07-13 04:45:46 -0700611 return aps->startOutput(output, stream, session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700612}
613
Eric Laurentde070132010-07-13 04:45:46 -0700614status_t AudioSystem::stopOutput(audio_io_handle_t output,
Dima Zavinfce7a472011-04-19 22:30:36 -0700615 audio_stream_type_t stream,
Eric Laurentde070132010-07-13 04:45:46 -0700616 int session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700617{
618 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
619 if (aps == 0) return PERMISSION_DENIED;
Eric Laurentde070132010-07-13 04:45:46 -0700620 return aps->stopOutput(output, stream, session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700621}
622
623void AudioSystem::releaseOutput(audio_io_handle_t output)
624{
625 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
626 if (aps == 0) return;
627 aps->releaseOutput(output);
628}
629
Glenn Kasteneba51fb2012-01-23 13:58:49 -0800630audio_io_handle_t AudioSystem::getInput(audio_source_t inputSource,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700631 uint32_t samplingRate,
Glenn Kasten58f30212012-01-12 12:27:51 -0800632 audio_format_t format,
Glenn Kasten254af182012-07-03 14:59:05 -0700633 audio_channel_mask_t channelMask,
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700634 int sessionId)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700635{
636 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
Eric Laurentfa2877b2009-07-28 08:44:33 -0700637 if (aps == 0) return 0;
Glenn Kasten254af182012-07-03 14:59:05 -0700638 return aps->getInput(inputSource, samplingRate, format, channelMask, sessionId);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700639}
640
641status_t AudioSystem::startInput(audio_io_handle_t input)
642{
643 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
644 if (aps == 0) return PERMISSION_DENIED;
645 return aps->startInput(input);
646}
647
648status_t AudioSystem::stopInput(audio_io_handle_t input)
649{
650 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
651 if (aps == 0) return PERMISSION_DENIED;
652 return aps->stopInput(input);
653}
654
655void AudioSystem::releaseInput(audio_io_handle_t input)
656{
657 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
658 if (aps == 0) return;
659 aps->releaseInput(input);
660}
661
Dima Zavinfce7a472011-04-19 22:30:36 -0700662status_t AudioSystem::initStreamVolume(audio_stream_type_t stream,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700663 int indexMin,
664 int indexMax)
665{
666 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
667 if (aps == 0) return PERMISSION_DENIED;
668 return aps->initStreamVolume(stream, indexMin, indexMax);
669}
670
Eric Laurent83844cc2011-11-18 16:43:31 -0800671status_t AudioSystem::setStreamVolumeIndex(audio_stream_type_t stream,
672 int index,
673 audio_devices_t device)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700674{
675 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
676 if (aps == 0) return PERMISSION_DENIED;
Eric Laurent83844cc2011-11-18 16:43:31 -0800677 return aps->setStreamVolumeIndex(stream, index, device);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700678}
679
Eric Laurent83844cc2011-11-18 16:43:31 -0800680status_t AudioSystem::getStreamVolumeIndex(audio_stream_type_t stream,
681 int *index,
682 audio_devices_t device)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700683{
684 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
685 if (aps == 0) return PERMISSION_DENIED;
Eric Laurent83844cc2011-11-18 16:43:31 -0800686 return aps->getStreamVolumeIndex(stream, index, device);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700687}
688
Dima Zavinfce7a472011-04-19 22:30:36 -0700689uint32_t AudioSystem::getStrategyForStream(audio_stream_type_t stream)
Eric Laurentde070132010-07-13 04:45:46 -0700690{
691 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
692 if (aps == 0) return 0;
693 return aps->getStrategyForStream(stream);
694}
695
Eric Laurent63742522012-03-08 13:42:42 -0800696audio_devices_t AudioSystem::getDevicesForStream(audio_stream_type_t stream)
Glenn Kasten6b2718c2011-02-04 13:54:26 -0800697{
698 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
Eric Laurent63742522012-03-08 13:42:42 -0800699 if (aps == 0) return (audio_devices_t)0;
Glenn Kasten6b2718c2011-02-04 13:54:26 -0800700 return aps->getDevicesForStream(stream);
701}
702
Glenn Kasten58e5aa32012-06-20 14:08:14 -0700703audio_io_handle_t AudioSystem::getOutputForEffect(const effect_descriptor_t *desc)
Eric Laurentde070132010-07-13 04:45:46 -0700704{
705 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
706 if (aps == 0) return PERMISSION_DENIED;
707 return aps->getOutputForEffect(desc);
708}
709
Glenn Kasten58e5aa32012-06-20 14:08:14 -0700710status_t AudioSystem::registerEffect(const effect_descriptor_t *desc,
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700711 audio_io_handle_t io,
Eric Laurentde070132010-07-13 04:45:46 -0700712 uint32_t strategy,
713 int session,
714 int id)
715{
716 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
717 if (aps == 0) return PERMISSION_DENIED;
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700718 return aps->registerEffect(desc, io, strategy, session, id);
Eric Laurentde070132010-07-13 04:45:46 -0700719}
720
721status_t AudioSystem::unregisterEffect(int id)
722{
723 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
724 if (aps == 0) return PERMISSION_DENIED;
725 return aps->unregisterEffect(id);
726}
727
Eric Laurentdb7c0792011-08-10 10:37:50 -0700728status_t AudioSystem::setEffectEnabled(int id, bool enabled)
729{
730 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
731 if (aps == 0) return PERMISSION_DENIED;
732 return aps->setEffectEnabled(id, enabled);
733}
734
Glenn Kastenfff6d712012-01-12 16:38:12 -0800735status_t AudioSystem::isStreamActive(audio_stream_type_t stream, bool* state, uint32_t inPastMs)
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700736{
Eric Laurenteda6c362011-02-02 09:33:30 -0800737 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
738 if (aps == 0) return PERMISSION_DENIED;
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700739 if (state == NULL) return BAD_VALUE;
Eric Laurenteda6c362011-02-02 09:33:30 -0800740 *state = aps->isStreamActive(stream, inPastMs);
741 return NO_ERROR;
742}
743
Jean-Michel Trivid7086032012-10-10 12:11:16 -0700744status_t AudioSystem::isSourceActive(audio_source_t stream, bool* state)
745{
746 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
747 if (aps == 0) return PERMISSION_DENIED;
748 if (state == NULL) return BAD_VALUE;
749 *state = aps->isSourceActive(stream);
750 return NO_ERROR;
751}
752
Glenn Kastencc0f1cf2012-09-24 11:27:18 -0700753int32_t AudioSystem::getPrimaryOutputSamplingRate()
754{
755 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
756 if (af == 0) return 0;
757 return af->getPrimaryOutputSamplingRate();
758}
759
760int32_t AudioSystem::getPrimaryOutputFrameCount()
761{
762 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
763 if (af == 0) return 0;
764 return af->getPrimaryOutputFrameCount();
765}
Eric Laurenteda6c362011-02-02 09:33:30 -0800766
Eric Laurent9f6530f2011-08-30 10:18:54 -0700767void AudioSystem::clearAudioConfigCache()
768{
769 Mutex::Autolock _l(gLock);
Steve Block3856b092011-10-20 11:56:00 +0100770 ALOGV("clearAudioConfigCache()");
Eric Laurent9f6530f2011-08-30 10:18:54 -0700771 gOutputs.clear();
772}
773
Eric Laurentc2f1f072009-07-17 12:17:14 -0700774// ---------------------------------------------------------------------------
775
776void AudioSystem::AudioPolicyServiceClient::binderDied(const wp<IBinder>& who) {
777 Mutex::Autolock _l(AudioSystem::gLock);
778 AudioSystem::gAudioPolicyService.clear();
779
Steve Block5ff1dd52012-01-05 23:22:43 +0000780 ALOGW("AudioPolicyService server died!");
Eric Laurentc2f1f072009-07-17 12:17:14 -0700781}
782
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800783}; // namespace android