xref: /aosp_15_r20/external/angle/src/gpu_info_util/SystemInfo_android.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // SystemInfo_android.cpp: implementation of the Android-specific parts of SystemInfo.h
8 
9 #include "gpu_info_util/SystemInfo_internal.h"
10 
11 #include <cstdlib>
12 #include <cstring>
13 #include <fstream>
14 #include <string>
15 
16 #include "common/android_util.h"
17 #include "common/angleutils.h"
18 #include "common/debug.h"
19 
20 namespace angle
21 {
22 
GetSystemInfo(SystemInfo * info)23 bool GetSystemInfo(SystemInfo *info)
24 {
25     bool isFullyPopulated = true;
26 
27     isFullyPopulated = android::GetSystemProperty(android::kManufacturerSystemPropertyName,
28                                                   &info->machineManufacturer) &&
29                        isFullyPopulated;
30     isFullyPopulated =
31         android::GetSystemProperty(android::kModelSystemPropertyName, &info->machineModelName) &&
32         isFullyPopulated;
33 
34     std::string androidSdkLevel;
35     if (android::GetSystemProperty(android::kSDKSystemPropertyName, &androidSdkLevel))
36     {
37         info->androidSdkLevel = std::atoi(androidSdkLevel.c_str());
38     }
39     else
40     {
41         isFullyPopulated = false;
42     }
43 
44     return GetSystemInfoVulkan(info) && isFullyPopulated;
45 }
46 
47 }  // namespace angle
48