commit | 8057133d49ab3243de54333012ce5ee8fece5381 | [log] [tgz] |
---|---|---|
author | Adam Lesinski <adamlesinski@google.com> | Fri Sep 18 14:56:34 2015 -0700 |
committer | Adam Lesinski <adamlesinski@google.com> | Fri Sep 18 14:56:34 2015 -0700 |
tree | e9c28572a36528ea27a145f771ac74fead49a14c | |
parent | 6832f39416cbe2cc9655af4eabefe39c5d272254 [diff] |
Fix crash when no power_profile is specified Always connected devices don't have power_profiles, so handle the case where the default cpu speed count of 1 is used on a device with more cpu speeds. Bug:23776983 Change-Id: Ifdddad2f28eea5b730833622a6b6043b3086efd2
diff --git a/core/java/com/android/internal/os/KernelCpuSpeedReader.java b/core/java/com/android/internal/os/KernelCpuSpeedReader.java index e16ae0b..5b776ac 100644 --- a/core/java/com/android/internal/os/KernelCpuSpeedReader.java +++ b/core/java/com/android/internal/os/KernelCpuSpeedReader.java
@@ -58,7 +58,7 @@ TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(' '); String line; int speedIndex = 0; - while ((line = reader.readLine()) != null) { + while (speedIndex < mLastSpeedTimes.length && (line = reader.readLine()) != null) { splitter.setString(line); Long.parseLong(splitter.next());
diff --git a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java index 0df78ed..5d3043c 100644 --- a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java +++ b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
@@ -137,7 +137,7 @@ mLastPowerMaUs.put(uid, powerMaUs); } } catch (IOException e) { - Slog.e(TAG, "Failed to read uid_cputime", e); + Slog.e(TAG, "Failed to read uid_cputime: " + e.getMessage()); } mLastTimeReadUs = nowUs; }