2012-07-20 09:10:44 +00:00
|
|
|
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2011-12-12 18:22:26 +00:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_system_b2g_audiomanager_h__
|
|
|
|
#define mozilla_dom_system_b2g_audiomanager_h__
|
|
|
|
|
2012-04-22 18:14:36 +00:00
|
|
|
#include "mozilla/Observer.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2011-12-12 18:22:26 +00:00
|
|
|
#include "nsIAudioManager.h"
|
2012-09-29 09:39:05 +00:00
|
|
|
#include "nsIObserver.h"
|
2012-12-13 01:45:10 +00:00
|
|
|
#include "AudioChannelAgent.h"
|
2013-05-16 04:00:02 +00:00
|
|
|
#include "android_audio/AudioSystem.h"
|
2011-12-12 18:22:26 +00:00
|
|
|
|
|
|
|
// {b2b51423-502d-4d77-89b3-7786b562b084}
|
|
|
|
#define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
|
|
|
|
{0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
|
|
|
|
#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
|
|
|
|
|
2012-12-13 01:45:10 +00:00
|
|
|
using namespace mozilla::dom;
|
2012-04-22 18:14:36 +00:00
|
|
|
|
2011-12-12 18:22:26 +00:00
|
|
|
namespace mozilla {
|
2012-04-22 18:14:36 +00:00
|
|
|
namespace hal {
|
|
|
|
class SwitchEvent;
|
|
|
|
typedef Observer<SwitchEvent> SwitchObserver;
|
|
|
|
} // namespace hal
|
|
|
|
|
2011-12-12 18:22:26 +00:00
|
|
|
namespace dom {
|
2012-03-14 22:43:26 +00:00
|
|
|
namespace gonk {
|
2013-07-18 05:22:36 +00:00
|
|
|
class RecoverTask;
|
2011-12-12 18:22:26 +00:00
|
|
|
class AudioManager : public nsIAudioManager
|
2012-09-29 09:39:05 +00:00
|
|
|
, public nsIObserver
|
2011-12-12 18:22:26 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIAUDIOMANAGER
|
2012-09-29 09:39:05 +00:00
|
|
|
NS_DECL_NSIOBSERVER
|
2011-12-12 18:22:26 +00:00
|
|
|
|
2012-04-22 18:14:36 +00:00
|
|
|
AudioManager();
|
|
|
|
~AudioManager();
|
2011-12-12 18:22:26 +00:00
|
|
|
|
2013-07-18 05:22:36 +00:00
|
|
|
// When audio backend is dead, recovery task needs to read all volume
|
|
|
|
// settings then set back into audio backend.
|
|
|
|
friend class RecoverTask;
|
|
|
|
|
2011-12-12 18:22:26 +00:00
|
|
|
protected:
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mPhoneState;
|
2013-05-16 04:00:02 +00:00
|
|
|
int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
|
2011-12-12 18:22:26 +00:00
|
|
|
|
2013-07-18 05:22:36 +00:00
|
|
|
android::status_t SetStreamVolumeIndex(int32_t aStream, int32_t aIndex);
|
|
|
|
android::status_t GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex);
|
|
|
|
|
2012-04-22 18:14:36 +00:00
|
|
|
private:
|
|
|
|
nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
|
2012-12-13 01:45:10 +00:00
|
|
|
nsCOMPtr<AudioChannelAgent> mPhoneAudioAgent;
|
2012-04-22 18:14:36 +00:00
|
|
|
};
|
2011-12-12 18:22:26 +00:00
|
|
|
|
2012-04-22 18:14:36 +00:00
|
|
|
} /* namespace gonk */
|
2011-12-12 18:22:26 +00:00
|
|
|
} /* namespace dom */
|
|
|
|
} /* namespace mozilla */
|
|
|
|
|
|
|
|
#endif // mozilla_dom_system_b2g_audiomanager_h__
|