diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-09-18 14:56:34 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-09-18 14:56:34 -0700 |
commit | 8057133d49ab3243de54333012ce5ee8fece5381 (patch) | |
tree | e9c28572a36528ea27a145f771ac74fead49a14c /core | |
parent | 6832f39416cbe2cc9655af4eabefe39c5d272254 (diff) | |
download | frameworks_base-8057133d49ab3243de54333012ce5ee8fece5381.zip frameworks_base-8057133d49ab3243de54333012ce5ee8fece5381.tar.gz frameworks_base-8057133d49ab3243de54333012ce5ee8fece5381.tar.bz2 |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/os/KernelCpuSpeedReader.java | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/os/KernelUidCpuTimeReader.java | 2 |
2 files changed, 2 insertions, 2 deletions
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 @@ public class KernelCpuSpeedReader { 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 @@ public class KernelUidCpuTimeReader { 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; } |