1 /** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "platforms/unix/libpandabase/property.h" 17 18 #ifdef PANDA_TARGET_MOBILE 19 #include <sys/system_properties.h> 20 #endif // PANDA_TARGET_MOBILE 21 22 namespace panda::os::unix::property { 23 GetPropertyBuffer(const char * ark_prop,std::string & out)24bool GetPropertyBuffer([[maybe_unused]] const char *ark_prop, [[maybe_unused]] std::string &out) 25 { 26 #ifdef PANDA_TARGET_MOBILE 27 char buf[PROP_VALUE_MAX] = {}; 28 if (__system_property_get(ark_prop, buf) > 0) { 29 out = buf; 30 return true; 31 } 32 #endif // PANDA_TARGET_MOBILE 33 return false; 34 } 35 36 } // namespace panda::os::unix::property 37