Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
16 #ifndef mozilla_dom_system_b2g_audiomanager_h__
17 #define mozilla_dom_system_b2g_audiomanager_h__
19 #include "mozilla/Observer.h"
20 #include "nsAutoPtr.h"
21 #include "nsIAudioManager.h"
22 #include "nsIObserver.h"
23 #include "AudioChannelAgent.h"
24 #include "android_audio/AudioSystem.h"
26 // {b2b51423-502d-4d77-89b3-7786b562b084}
27 #define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
28 {0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
29 #define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
31 namespace mozilla {
32 namespace hal {
33 class SwitchEvent;
34 typedef Observer<SwitchEvent> SwitchObserver;
35 } // namespace hal
37 namespace dom {
38 namespace gonk {
39 class RecoverTask;
40 class AudioChannelVolInitCallback;
41 class AudioManager : public nsIAudioManager
42 , public nsIObserver
43 {
44 public:
45 NS_DECL_ISUPPORTS
46 NS_DECL_NSIAUDIOMANAGER
47 NS_DECL_NSIOBSERVER
49 AudioManager();
50 ~AudioManager();
52 // When audio backend is dead, recovery task needs to read all volume
53 // settings then set back into audio backend.
54 friend class RecoverTask;
55 friend class AudioChannelVolInitCallback;
57 protected:
58 int32_t mPhoneState;
59 int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
61 nsresult SetStreamVolumeIndex(int32_t aStream, int32_t aIndex);
62 nsresult GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex);
64 private:
65 nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
66 nsCOMPtr<nsIAudioChannelAgent> mPhoneAudioAgent;
67 #ifdef MOZ_B2G_RIL
68 bool mMuteCallToRIL;
69 // mIsMicMuted is only used for toggling mute call to RIL.
70 bool mIsMicMuted;
71 #endif
73 void HandleBluetoothStatusChanged(nsISupports* aSubject,
74 const char* aTopic,
75 const nsCString aAddress);
76 };
78 } /* namespace gonk */
79 } /* namespace dom */
80 } /* namespace mozilla */
82 #endif // mozilla_dom_system_b2g_audiomanager_h__