1/* 2 * Copyright (C) 2015 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 "APM::AudioPolicyEngine/Usage" 18 19#include "Usage.h" 20 21namespace android 22{ 23namespace audio_policy 24{ 25 26status_t Element<audio_usage_t>::setIdentifier(audio_usage_t identifier) 27{ 28 if (identifier > AUDIO_USAGE_MAX) { 29 return BAD_VALUE; 30 } 31 mIdentifier = identifier; 32 ALOGD("%s: Usage %s has identifier 0x%X", __FUNCTION__, getName().c_str(), identifier); 33 return NO_ERROR; 34} 35 36template <> 37status_t Element<audio_usage_t>::set<routing_strategy>(routing_strategy strategy) 38{ 39 if (strategy >= NUM_STRATEGIES) { 40 return BAD_VALUE; 41 } 42 ALOGD("%s: %d for Usage %s", __FUNCTION__, strategy, getName().c_str()); 43 mApplicableStrategy = strategy; 44 return NO_ERROR; 45} 46 47template <> 48routing_strategy Element<audio_usage_t>::get<routing_strategy>() const 49{ 50 ALOGD("%s: %d for Usage %s", __FUNCTION__, mApplicableStrategy, getName().c_str()); 51 return mApplicableStrategy; 52} 53 54} // namespace audio_policy 55} // namespace android 56 57 58