Path: blob/main_old/src/gpu_info_util/SystemInfo_android.cpp
1693 views
//1// Copyright 2018 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// SystemInfo_android.cpp: implementation of the Android-specific parts of SystemInfo.h78#include "gpu_info_util/SystemInfo_internal.h"910#include <sys/system_properties.h>11#include <cstring>12#include <fstream>13#include <string>1415#include "common/angleutils.h"16#include "common/debug.h"1718namespace angle19{20namespace21{22bool GetAndroidSystemProperty(const std::string &propertyName, std::string *value)23{24// PROP_VALUE_MAX from <sys/system_properties.h>25std::vector<char> propertyBuf(PROP_VALUE_MAX);26int len = __system_property_get(propertyName.c_str(), propertyBuf.data());27if (len <= 0)28{29return false;30}31*value = std::string(propertyBuf.data());32return true;33}34} // namespace3536bool GetSystemInfo(SystemInfo *info)37{38bool isFullyPopulated = true;3940isFullyPopulated =41GetAndroidSystemProperty("ro.product.manufacturer", &info->machineManufacturer) &&42isFullyPopulated;43isFullyPopulated =44GetAndroidSystemProperty("ro.product.model", &info->machineModelName) && isFullyPopulated;4546std::string androidSdkLevel;47isFullyPopulated =48GetAndroidSystemProperty("ro.build.version.sdk", &androidSdkLevel) && isFullyPopulated;49info->androidSdkLevel = std::stoi(androidSdkLevel);5051return GetSystemInfoVulkan(info) && isFullyPopulated;52}5354} // namespace angle555657