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
This commit is contained in:
Adam Lesinski
2015-09-18 14:56:34 -07:00
parent 6832f39416
commit 8057133d49
2 changed files with 2 additions and 2 deletions

View File

@@ -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());

View File

@@ -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;
}