diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2014-06-24 16:07:56 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-06-24 16:07:56 +0200 |
commit | 04994e322b88df30ce711c59f2a2975c2aae5612 (patch) | |
tree | b025cb8f46c86ca27ea82f8a408d87129127e229 | |
parent | 7447187f8debeb920ec37c18286226a2d24a0edb (diff) | |
download | packages_apps_settings-04994e322b88df30ce711c59f2a2975c2aae5612.zip packages_apps_settings-04994e322b88df30ce711c59f2a2975c2aae5612.tar.gz packages_apps_settings-04994e322b88df30ce711c59f2a2975c2aae5612.tar.bz2 |
Proper CPU info parsingreplicant-4.2-0003replicant-4.2-0002
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | src/com/android/settings/DeviceInfoSettings.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java index 23fa672..91be9a4 100644 --- a/src/com/android/settings/DeviceInfoSettings.java +++ b/src/com/android/settings/DeviceInfoSettings.java @@ -416,15 +416,24 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { private String getCPUInfo() { String result = null; + String line = null; + BufferedReader reader = null; try { /* The expected /proc/cpuinfo output is as follows: * Processor : ARMv7 Processor rev 2 (v7l) * BogoMIPS : 272.62 */ - String firstLine = readLine(FILENAME_PROC_CPUINFO); - if (firstLine != null) { - result = firstLine.split(":")[1].trim(); + + reader = new BufferedReader(new FileReader(FILENAME_PROC_CPUINFO), 256); + + try { + while ((line = reader.readLine()) != null) { + if (line.split(":")[0].trim().equals("model name") || line.split(":")[0].trim().equals("Processor")) + result = line.split(":")[1].trim(); + } + } finally { + reader.close(); } } catch (IOException e) {} |