1 /* 2 * Copyright 2020 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 #pragma once 18 19 #include <optional> 20 #include <string> 21 22 #define DEBUGGABLE_SYS_PROP_NAME "ro.debuggable" 23 24 namespace bluetooth { 25 namespace os { 26 27 /* System Property to indicate if the dual mode audio feature is enabled */ 28 static const std::string kIsDualModeAudioEnabledProperty = 29 "persist.bluetooth.enable_dual_mode_audio"; 30 31 // Get |property| keyed system property from supported platform, return std::nullopt if the property does not exist 32 // or if the platform does not support system property 33 std::optional<std::string> GetSystemProperty(const std::string& property); 34 35 // Get |property| keyed system property as uint32_t from supported platform, return |default_value| if the property 36 // does not exist or if the platform does not support system property 37 uint32_t GetSystemPropertyUint32(const std::string& property, uint32_t default_value); 38 39 // Get |property| keyed system property as uint32_t from supported platform, return |default_value| 40 // if the property does not exist or if the platform does not support system property if property is 41 // found it will call stoul with |base| 42 uint32_t GetSystemPropertyUint32Base( 43 const std::string& property, uint32_t default_value, int base = 0); 44 45 // Get |property| keyed property as bool from supported platform, return 46 // |default_value| if the property does not exist or if the platform 47 // does not support system property 48 bool GetSystemPropertyBool(const std::string& property, bool default_value); 49 50 // Set |property| keyed system property to |value|, return true if the set was successful and false if the set failed 51 // Replace existing value if property already exists 52 bool SetSystemProperty(const std::string& property, const std::string& value); 53 54 // Clear system properties for host only return true on success 55 bool ClearSystemPropertiesForHost(); 56 57 // Check if the vendor image is using root canal simulated Bluetooth stack 58 bool IsRootCanalEnabled(); 59 60 // Get Android Vendor Image release version in numeric value (e.g. Android R is 11), return 0 if not on Android or 61 // version not available 62 int GetAndroidVendorReleaseVersion(); 63 64 } // namespace os 65 } // namespace bluetooth 66