1 /* 2 * Copyright (C) 2021 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 #include "chre_api/chre/user_settings.h" 18 19 #include "chre/core/event_loop_manager.h" 20 #include "chre/core/settings.h" 21 #include "chre/util/macros.h" 22 23 using chre::EventLoopManager; 24 using chre::Nanoapp; 25 using chre::Setting; 26 using chre::SettingState; 27 chreUserSettingGetState(uint8_t setting)28DLL_EXPORT int8_t chreUserSettingGetState(uint8_t setting) { 29 return chre::EventLoopManagerSingleton::get() 30 ->getSettingManager() 31 .getSettingStateAsInt8(setting); 32 } 33 chreUserSettingConfigureEvents(uint8_t setting,bool enable)34DLL_EXPORT void chreUserSettingConfigureEvents(uint8_t setting, bool enable) { 35 if (setting < static_cast<uint8_t>(Setting::SETTING_MAX)) { 36 Nanoapp *nanoapp = EventLoopManager::validateChreApiCall(__func__); 37 nanoapp->configureUserSettingEvent(setting, enable); 38 } 39 } 40