am 77fa24a5: Merge change 26136 into eclair
Merge commit '77fa24a5ef3ee3bc108d4bf3c77b7b4c7d0d5451' into eclair-plus-aosp * commit '77fa24a5ef3ee3bc108d4bf3c77b7b4c7d0d5451': Fix NPE crash-loop when cpufreq not available in the kernel.
This commit is contained in:
@@ -509,6 +509,8 @@ public class ProcessStats {
|
|||||||
}
|
}
|
||||||
int speed = 0;
|
int speed = 0;
|
||||||
String file = readFile("/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state", '\0');
|
String file = readFile("/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state", '\0');
|
||||||
|
// Note: file may be null on kernels without cpufreq (i.e. the emulator's)
|
||||||
|
if (file != null) {
|
||||||
StringTokenizer st = new StringTokenizer(file, "\n ");
|
StringTokenizer st = new StringTokenizer(file, "\n ");
|
||||||
while (st.hasMoreElements()) {
|
while (st.hasMoreElements()) {
|
||||||
String token = st.nextToken();
|
String token = st.nextToken();
|
||||||
@@ -528,6 +530,7 @@ public class ProcessStats {
|
|||||||
Log.i(TAG, "Unable to parse time_in_state");
|
Log.i(TAG, "Unable to parse time_in_state");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (out == null) {
|
if (out == null) {
|
||||||
out = new long[speed];
|
out = new long[speed];
|
||||||
mCpuSpeeds = new long[speed];
|
mCpuSpeeds = new long[speed];
|
||||||
|
|||||||
Reference in New Issue
Block a user