Ravi Kumar Alamanda | 89a8142 | 2013-10-08 23:47:55 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. |
| 3 | * Not a contribution. |
| 4 | * |
| 5 | * Copyright (C) 2009 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | #include <sys/types.h> |
| 23 | #include <utils/Timers.h> |
| 24 | #include <utils/Errors.h> |
| 25 | #include <utils/KeyedVector.h> |
| 26 | #include <hardware_legacy/AudioPolicyManagerBase.h> |
| 27 | |
| 28 | |
| 29 | namespace android_audio_legacy { |
| 30 | |
| 31 | // ---------------------------------------------------------------------------- |
| 32 | |
| 33 | class AudioPolicyManager: public AudioPolicyManagerBase |
| 34 | { |
| 35 | |
| 36 | public: |
| 37 | AudioPolicyManager(AudioPolicyClientInterface *clientInterface) |
| 38 | : AudioPolicyManagerBase(clientInterface) {} |
| 39 | |
| 40 | virtual ~AudioPolicyManager() {} |
| 41 | |
| 42 | protected: |
| 43 | // return appropriate device for streams handled by the specified strategy according to current |
| 44 | // phone state, connected devices... |
| 45 | // if fromCache is true, the device is returned from mDeviceForStrategy[], |
| 46 | // otherwise it is determine by current state |
| 47 | // (device connected,phone state, force use, a2dp output...) |
| 48 | // This allows to: |
| 49 | // 1 speed up process when the state is stable (when starting or stopping an output) |
| 50 | // 2 access to either current device selection (fromCache == true) or |
| 51 | // "future" device selection (fromCache == false) when called from a context |
| 52 | // where conditions are changing (setDeviceConnectionState(), setPhoneState()...) AND |
| 53 | // before updateDevicesAndOutputs() is called. |
| 54 | virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy, |
| 55 | bool fromCache = true); |
| 56 | }; |
| 57 | }; |