/* * Copyright (C) 2020 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. */ #ifndef ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_V2_0_AUDIOCONTROL_H #define ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_V2_0_AUDIOCONTROL_H #include #include #include #include #include using android::hardware::audio::common::V6_0::AudioUsage; namespace android::hardware::automotive::audiocontrol::V2_0::implementation { class AudioControl : public IAudioControl { public: // Methods from ::android::hardware::automotive::audiocontrol::V2_0::IAudioControl follow. Return> registerFocusListener(const sp& listener); Return onAudioFocusChange(hidl_bitfield usage, int zoneId, hidl_bitfield focusChange); Return setBalanceTowardRight(float value) override; Return setFadeTowardFront(float value) override; Return debug(const hidl_handle& fd, const hidl_vec& options) override; // Implementation details AudioControl(); private: sp mFocusListener; static bool checkArgumentsSize(int fd, const hidl_vec& options, size_t minSize); static bool checkCallerHasWritePermissions(int fd); static bool isValidValue(float value); static bool safelyParseInt(std::string s, int* out); void cmdDump(int fd, const hidl_vec& options); void cmdHelp(int fd) const; void cmdRequestFocus(int fd, const hidl_vec& options); void cmdAbandonFocus(int fd, const hidl_vec& options); void dump(int fd); }; } // namespace android::hardware::automotive::audiocontrol::V2_0::implementation #endif // ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_V2_0_AUDIOCONTROL_H