1 /* 2 * Copyright (C) 2017 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 #ifndef CHRE_PLATFORM_SLPI_PLATFORM_AUDIO_BASE_H_ 18 #define CHRE_PLATFORM_SLPI_PLATFORM_AUDIO_BASE_H_ 19 20 #include "chre/pal/audio.h" 21 #include "chre/platform/shared/platform_pal.h" 22 23 namespace chre { 24 25 /** 26 * The base PlatformAudio class for the SLPI to inject platform specific 27 * functionality from. 28 */ 29 class PlatformAudioBase : public PlatformPal { 30 public: 31 /** 32 * Invoked whenever the host goes awake. This is used to implement the 33 * deferred audio disable operation. This is called on the CHRE thread. 34 */ 35 void onHostAwake(); 36 37 protected: 38 //! The instance of callbacks that are provided to the CHRE PAL. 39 static const chrePalAudioCallbacks sAudioCallbacks; 40 41 //! The instance of the CHRE PAL API for audio. This will be set to nullptr 42 //! if the platform does not supply an implementation. 43 const chrePalAudioApi *mAudioApi; 44 45 //! The number of open audio clients. This is incremented/decremented by the 46 //! setHandleEnabled platform API. 47 uint32_t mNumAudioClients = 0; 48 49 //! The current state of the audio feature enabled on the host. 50 bool mCurrentAudioEnabled = false; 51 52 //! The target state of the audio feature enabled on the host. This is used to 53 //! support deferred disabling when the next AP wake occurs. 54 bool mTargetAudioEnabled = false; 55 }; 56 57 } // namespace chre 58 59 #endif // CHRE_PLATFORM_SLPI_PLATFORM_AUDIO_BASE_H_ 60