| /* |
| * Copyright (C) 2014 The Android Open Source Project |
| * |
| * 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. |
| */ |
| |
| package android.media.cts; |
| |
| import android.content.pm.PackageManager; |
| import android.media.audiofx.AudioEffect; |
| import android.os.Looper; |
| import android.test.AndroidTestCase; |
| |
| public class PostProcTestBase extends AndroidTestCase { |
| protected int mSession = -1; |
| protected boolean mHasControl = false; |
| protected boolean mIsEnabled = false; |
| protected boolean mInitialized = false; |
| protected Looper mLooper = null; |
| protected final Object mLock = new Object(); |
| protected int mChangedParameter = -1; |
| |
| protected boolean hasAudioOutput() { |
| return getContext().getPackageManager().hasSystemFeature( |
| PackageManager.FEATURE_AUDIO_OUTPUT); |
| } |
| |
| protected boolean isBassBoostAvailable() { |
| if (!hasAudioOutput()) { |
| return false; |
| } |
| return AudioEffect.isEffectTypeAvailable(AudioEffect.EFFECT_TYPE_BASS_BOOST); |
| } |
| |
| protected boolean isVirtualizerAvailable() { |
| if (!hasAudioOutput()) { |
| return false; |
| } |
| return AudioEffect.isEffectTypeAvailable(AudioEffect.EFFECT_TYPE_VIRTUALIZER); |
| } |
| |
| protected boolean isPresetReverbAvailable() { |
| if (!hasAudioOutput()) { |
| return false; |
| } |
| return AudioEffect.isEffectTypeAvailable(AudioEffect.EFFECT_TYPE_PRESET_REVERB); |
| } |
| |
| protected boolean isEnvReverbAvailable() { |
| if (!hasAudioOutput()) { |
| return false; |
| } |
| return AudioEffect.isEffectTypeAvailable(AudioEffect.EFFECT_TYPE_ENV_REVERB); |
| } |
| } |