Пример #1
0
 @Override
 public void load(Module br) {
   Section section = br.findSection(Section.KERNEL_WAKELOCKS);
   if (section == null) {
     br.printErr(3, TAG + "Section not found: " + Section.KERNEL_WAKELOCKS + " (aborting plugin)");
     return;
   }
   String line = section.getLine(0);
   String columns[] = line.split("\t");
   boolean ok = true;
   if (columns.length < COLUMNS.length) {
     ok = false;
   }
   for (int i = 0; i < COLUMNS.length; i++) {
     if (!COLUMNS[i].equals(columns[i])) {
       ok = false;
     }
   }
   if (!ok) {
     br.printErr(
         3,
         TAG
             + "Data format changed in section "
             + Section.KERNEL_WAKELOCKS
             + " (aborting plugin)");
     return;
   }
   int cnt = section.getLineCount();
   for (int i = 1; i < cnt; i++) {
     line = section.getLine(i);
     columns = line.split("\t");
     if (columns.length < COLUMNS.length) {
       continue;
     }
     KernelWakelock lock = new KernelWakelock();
     lock.name = columns[0];
     if (lock.name.startsWith("\"") && lock.name.endsWith("\"")) {
       lock.name = lock.name.substring(1, lock.name.length() - 1);
     }
     lock.count = Long.parseLong(columns[1]);
     lock.expire_count = Long.parseLong(columns[2]);
     lock.wake_count = Long.parseLong(columns[3]);
     lock.active_since = Long.parseLong(columns[4]);
     lock.total_time = Long.parseLong(columns[5]);
     lock.sleep_time = Long.parseLong(columns[6]);
     lock.max_time = Long.parseLong(columns[7]);
     lock.last_change = Long.parseLong(columns[8]);
     mLocks.add(lock);
   }
   mLoaded = true;
 }