am 0913ce95: Merge "Potential fix for bug: 2564824 : Device runtime restart in BatteryService" into froyo

Merge commit '0913ce95c29371cb7b58e294a8d60262bc7f4329' into froyo-plus-aosp

* commit '0913ce95c29371cb7b58e294a8d60262bc7f4329':
  Potential fix for bug: 2564824 : Device runtime restart in BatteryService
This commit is contained in:
Amith Yamasani
2010-04-02 17:24:49 -07:00
committed by Android Git Automerger

View File

@ -895,6 +895,12 @@ public final class BatteryStatsImpl extends BatteryStats {
String[] nameStringArray = mProcWakelocksName; String[] nameStringArray = mProcWakelocksName;
long[] wlData = mProcWakelocksData; long[] wlData = mProcWakelocksData;
// Stomp out any bad characters since this is from a circular buffer
// A corruption is seen sometimes that results in the vm crashing
// This should prevent crashes and the line will probably fail to parse
for (int j = startIndex; j < endIndex; j++) {
if ((wlBuffer[j] & 0x80) != 0) wlBuffer[j] = (byte) '?';
}
boolean parsed = Process.parseProcLine(wlBuffer, startIndex, endIndex, boolean parsed = Process.parseProcLine(wlBuffer, startIndex, endIndex,
PROC_WAKELOCKS_FORMAT, nameStringArray, wlData, null); PROC_WAKELOCKS_FORMAT, nameStringArray, wlData, null);