()
| 1007 | } |
| 1008 | |
| 1009 | public String getCpuName() { |
| 1010 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) |
| 1011 | return Build.SOC_MANUFACTURER + " " + Build.SOC_MODEL; |
| 1012 | try { |
| 1013 | FileReader fr = new FileReader("/proc/cpuinfo"); |
| 1014 | BufferedReader br = new BufferedReader(fr); |
| 1015 | String line; |
| 1016 | String cpuName = null; |
| 1017 | |
| 1018 | while ((line = br.readLine()) != null) { |
| 1019 | if (line.contains("Processor") || line.contains("model name")) { |
| 1020 | // Extract the part after the colon and trim whitespace |
| 1021 | String[] parts = line.split(":", 2); |
| 1022 | if (parts.length > 1) { |
| 1023 | cpuName = parts[1].trim(); |
| 1024 | break; // Found the CPU name, no need to read further |
| 1025 | } |
| 1026 | } |
| 1027 | } |
| 1028 | br.close(); |
| 1029 | return capitalize(cpuName); |
| 1030 | } catch (IOException e) { |
| 1031 | return Build.UNKNOWN; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | public String getDeviceName() { |
| 1036 | String manufacturer = Build.MANUFACTURER; |
no test coverage detected