Program: 81184
Project: 81184
Buggy source:
private static void processBatteryIntent(final Context context,Intent intent){
  boolean newData=false;
  if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
    if (!screenOff)     newData=true;
    screenOff=true;
  }
 else   if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) {
    if (screenOff)     newData=true;
    screenOff=false;
  }
 else   if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    BatteryLevel newLevel=BatteryLevel.parse(intent.getExtras());
    if (newLevel == null)     return;
    if (newLevel.isDifferent(level))     newData=true;
    if ((level == null || level.get_status() == BatteryManager.BATTERY_STATUS_CHARGING) && newLevel.get_status() != BatteryManager.BATTERY_STATUS_CHARGING)     lastCharged=new Date();
    if (newLevel.is_dockFriendly() && level != null && level.get_dock_status() >= Constants.DOCK_STATE_CHARGING && newLevel.get_dock_status() < Constants.DOCK_STATE_CHARGING)     dockLastConnected=new Date();
    if (newLevel.get_dock_level() != null)     lastDockLevel=newLevel.get_dock_level();
    level=newLevel;
  }
  if (!newData || level == null)   return;
  new Thread(new Runnable(){
    @Override public void run(){
      BatteryLevelAdapter.Entry entry=new BatteryLevelAdapter.Entry(level.get_status(),level.get_level(),level.get_dock_status(),level.get_dock_level(),screenOff);
      BatteryLevelAdapter adapter=new BatteryLevelAdapter(context);
      adapter.open();
      adapter.insertEntry(entry);
      adapter.close();
      if (level.is_dockConnected())       mNotificationManager.update(level.get_dock_level());
 else       mNotificationManager.hide();
      WidgetUpdater.updateAllWidgets(context,level,null);
    }
  }
).start();
}

Fixed version (ground truth):
private static void processBatteryIntent(final Context context,Intent intent){
  boolean newData=false;
  if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
    if (!screenOff)     newData=true;
    screenOff=true;
  }
 else   if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) {
    if (screenOff)     newData=true;
    screenOff=false;
  }
 else   if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
    BatteryLevel newLevel=BatteryLevel.parse(intent.getExtras());
    if (newLevel == null)     return;
    if (newLevel.isDifferent(level))     newData=true;
    if ((level == null || level.get_status() == BatteryManager.BATTERY_STATUS_CHARGING) && newLevel.get_status() != BatteryManager.BATTERY_STATUS_CHARGING)     lastCharged=new Date();
    if (newLevel.is_dockFriendly() && level != null && level.get_dock_status() >= Constants.DOCK_STATE_CHARGING && newLevel.get_dock_status() < Constants.DOCK_STATE_CHARGING)     dockLastConnected=new Date();
    if (newLevel.get_dock_level() != null)     lastDockLevel=newLevel.get_dock_level();
    level=newLevel;
  }
  if (!newData || level == null)   return;
  new Thread(new Runnable(){
    @Override public void run(){
      BatteryLevelAdapter.Entry entry=new BatteryLevelAdapter.Entry(level.get_status(),level.get_level(),level.get_dock_status(),level.get_dock_level(),screenOff);
      BatteryLevelAdapter adapter=new BatteryLevelAdapter(context);
      adapter.open();
      adapter.insertEntry(entry);
      adapter.close();
      if (level.is_dockConnected())       mNotificationManager.update(level.get_dock_level());
 else       mNotificationManager.hide();
      WidgetUpdater.updateAllWidgets(context,level,null);
    }
  }
).run();
}