Program: 80560
Project: 80560
Buggy source:
static void updateAppWidget(Context context,AppWidgetManager appWidgetManager,int appWidgetId,Bundle options){
  Tools.HangarLog("String_Node_Str");
  prefs=new PrefsGet(context.getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE));
  SharedPreferences mPrefs=prefs.prefsGet();
  int statsLayout;
  int itemHeight;
  if (mPrefs.getBoolean(Settings.DIVIDER_PREFERENCE,Settings.DIVIDER_DEFAULT)) {
    statsLayout=R.layout.stats_widget;
    itemHeight=36;
  }
 else {
    statsLayout=R.layout.stats_widget_no_dividers;
    itemHeight=35;
  }
  boolean appsNoByWidgetSize=mPrefs.getBoolean(Settings.APPS_BY_WIDGET_SIZE_PREFERENCE,Settings.APPS_BY_WIDGET_SIZE_DEFAULT);
  boolean roundedCorners=mPrefs.getBoolean(Settings.ROUNDED_CORNERS_PREFERENCE,Settings.ROUNDED_CORNERS_DEFAULT);
  int appsNo;
  int appsNoLs;
  Tools.HangarLog("String_Node_Str" + options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
  Tools.HangarLog("String_Node_Str" + options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT));
  appsNo=(int)Math.floor((options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT) - 14) / itemHeight);
  appsNoLs=(int)Math.floor((options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT) - 14) / itemHeight);
  if (appsNoByWidgetSize && appsNo > 0) {
    Tools.HangarLog("String_Node_Str" + appsNo);
  }
 else {
    appsNo=Integer.parseInt(mPrefs.getString(Settings.STATS_WIDGET_APPSNO_PREFERENCE,Integer.toString(Settings.STATS_WIDGET_APPSNO_DEFAULT)));
  }
  if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    if (appsNoByWidgetSize && appsNoLs > 0) {
      appsNo=appsNoLs;
      Tools.HangarLog("String_Node_Str" + appsNo);
    }
 else {
      appsNo=Integer.parseInt(mPrefs.getString(Settings.STATS_WIDGET_APPSNO_LS_PREFERENCE,Integer.toString(Settings.STATS_WIDGET_APPSNO_LS_DEFAULT)));
    }
    Tools.HangarLog("String_Node_Str");
  }
  int getColor=mPrefs.getInt(Settings.BACKGROUND_COLOR_PREFERENCE,Settings.BACKGROUND_COLOR_DEFAULT);
  RemoteViews views=new RemoteViews(context.getPackageName(),statsLayout);
  int mGravity=Integer.parseInt(mPrefs.getString(Settings.ALIGNMENT_PREFERENCE,Integer.toString(Settings.ALIGNMENT_DEFAULT)));
  views.setInt(R.id.taskRoot,"String_Node_Str",mGravity);
  views.removeAllViews(R.id.taskRoot);
  PackageManager pkgm=context.getPackageManager();
  String packageName=context.getPackageName();
  Intent intent;
  TasksDataSource db=TasksDataSource.getInstance(context);
  db.open();
  int highestSeconds=db.getHighestSeconds();
  List<TasksModel> tasks=db.getAllTasks();
  db.close();
  Collections.sort(tasks,new Tools.TasksModelComparator("String_Node_Str"));
  IconHelper ih=new IconHelper(context);
  int count=0;
  for (  TasksModel task : tasks) {
    RemoteViews row=new RemoteViews(context.getPackageName(),R.layout.stats_widget_row);
    int topPadding=0;
    int bottomPadding=0;
    if (count == 0) {
      topPadding=Tools.dpToPx(context,6);
      Tools.setViewBackgroundColor(row,getColor,(roundedCorners) ? R.drawable.rounded_bg_top : R.drawable.empty_bg);
    }
    if (count == (appsNo - 1)) {
      bottomPadding=Tools.dpToPx(context,6);
      Tools.setViewBackgroundColor(row,getColor,(roundedCorners) ? R.drawable.rounded_bg_bottom : R.drawable.empty_bg);
    }
    if (count > 0 && count < (appsNo - 1)) {
      Tools.setViewBackgroundColor(row,getColor,R.drawable.empty_bg);
    }
    row.setViewPadding(R.id.clickCont,0,topPadding,0,bottomPadding);
    int clickID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int iconID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int labelID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int imgID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int statsID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    if (task.getBlacklisted()) {
      continue;
    }
    if (count >= appsNo) {
      Tools.HangarLog("String_Node_Str" + count + "String_Node_Str"+ appsNo);
      break;
    }
    Bitmap cachedIcon;
    ComponentName componentTask=ComponentName.unflattenFromString(task.getPackageName() + "String_Node_Str" + task.getClassName());
    cachedIcon=ih.cachedIconHelper(componentTask);
    if (cachedIcon == null)     continue;
    count++;
    row.setImageViewBitmap(iconID,cachedIcon);
    row.setTextViewText(labelID,task.getName());
    float secondsRatio=(float)task.getSeconds() / highestSeconds;
    int barColor;
    int secondsColor=(Math.round(secondsRatio * 100));
    if (secondsColor >= 80) {
      barColor=0xFF34B5E2;
    }
 else     if (secondsColor >= 60) {
      barColor=0xFFAA66CC;
    }
 else     if (secondsColor >= 40) {
      barColor=0xFF74C353;
    }
 else     if (secondsColor >= 20) {
      barColor=0xFFFFBB33;
    }
 else {
      barColor=0xFFFF4444;
    }
    int[] colors=new int[]{barColor,Tools.dpToPx(context,secondsColor - 1),0x00000000,Tools.dpToPx(mContext,100 - secondsColor)};
    Drawable sd=new BarDrawable(colors);
    Bitmap bmpIcon2=drawableToBitmap(sd);
    row.setImageViewBitmap(imgID,bmpIcon2);
    int[] statsTime=new Settings().splitToComponentTimes(task.getSeconds());
    String statsString=((statsTime[0] > 0) ? statsTime[0] + "String_Node_Str" : "String_Node_Str") + ((statsTime[1] > 0) ? statsTime[1] + "String_Node_Str" : "String_Node_Str") + ((statsTime[2] > 0) ? statsTime[2] + "String_Node_Str" : "String_Node_Str");
    row.setTextViewText(statsID,statsString);
    try {
      intent=pkgm.getLaunchIntentForPackage(task.getPackageName());
      if (intent == null) {
        count--;
        throw new PackageManager.NameNotFoundException();
      }
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
      intent.setAction(Intent.ACTION_MAIN);
      PendingIntent activity=PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
      row.setOnClickPendingIntent(clickID,activity);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    views.addView(R.id.taskRoot,row);
  }
  appWidgetManager.updateAppWidget(appWidgetId,views);
}

Fixed version (ground truth):
void updateAppWidget(Context context,AppWidgetManager appWidgetManager,int appWidgetId,Bundle options){
  Tools.HangarLog("String_Node_Str");
  PrefsGet prefs=new PrefsGet(context.getSharedPreferences("String_Node_Str",Context.MODE_PRIVATE));
  SharedPreferences mPrefs=prefs.prefsGet();
  int statsLayout;
  int itemHeight;
  if (mPrefs.getBoolean(Settings.DIVIDER_PREFERENCE,Settings.DIVIDER_DEFAULT)) {
    statsLayout=R.layout.stats_widget;
    itemHeight=36;
  }
 else {
    statsLayout=R.layout.stats_widget_no_dividers;
    itemHeight=35;
  }
  boolean appsNoByWidgetSize=mPrefs.getBoolean(Settings.APPS_BY_WIDGET_SIZE_PREFERENCE,Settings.APPS_BY_WIDGET_SIZE_DEFAULT);
  boolean roundedCorners=mPrefs.getBoolean(Settings.ROUNDED_CORNERS_PREFERENCE,Settings.ROUNDED_CORNERS_DEFAULT);
  int appsNo;
  int appsNoLs;
  Tools.HangarLog("String_Node_Str" + options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT));
  Tools.HangarLog("String_Node_Str" + options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT));
  appsNo=(int)Math.floor((options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT) - 14) / itemHeight);
  appsNoLs=(int)Math.floor((options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT) - 14) / itemHeight);
  if (appsNoByWidgetSize && appsNo > 0) {
    Tools.HangarLog("String_Node_Str" + appsNo);
  }
 else {
    appsNo=Integer.parseInt(mPrefs.getString(Settings.STATS_WIDGET_APPSNO_PREFERENCE,Integer.toString(Settings.STATS_WIDGET_APPSNO_DEFAULT)));
  }
  if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    if (appsNoByWidgetSize && appsNoLs > 0) {
      appsNo=appsNoLs;
      Tools.HangarLog("String_Node_Str" + appsNo);
    }
 else {
      appsNo=Integer.parseInt(mPrefs.getString(Settings.STATS_WIDGET_APPSNO_LS_PREFERENCE,Integer.toString(Settings.STATS_WIDGET_APPSNO_LS_DEFAULT)));
    }
    Tools.HangarLog("String_Node_Str");
  }
  int getColor=mPrefs.getInt(Settings.BACKGROUND_COLOR_PREFERENCE,Settings.BACKGROUND_COLOR_DEFAULT);
  RemoteViews views=new RemoteViews(context.getPackageName(),statsLayout);
  int mGravity=Integer.parseInt(mPrefs.getString(Settings.ALIGNMENT_PREFERENCE,Integer.toString(Settings.ALIGNMENT_DEFAULT)));
  views.setInt(R.id.taskRoot,"String_Node_Str",mGravity);
  views.removeAllViews(R.id.taskRoot);
  PackageManager pkgm=context.getPackageManager();
  String packageName=context.getPackageName();
  Intent intent;
  TasksDataSource db=TasksDataSource.getInstance(context);
  db.open();
  int highestSeconds=db.getHighestSeconds();
  List<TasksModel> tasks=db.getAllTasks();
  db.close();
  Collections.sort(tasks,new Tools.TasksModelComparator("String_Node_Str"));
  IconHelper ih=new IconHelper(context);
  int count=0;
  for (  TasksModel task : tasks) {
    RemoteViews row=new RemoteViews(context.getPackageName(),R.layout.stats_widget_row);
    int topPadding=0;
    int bottomPadding=0;
    if (count == 0) {
      topPadding=Tools.dpToPx(context,6);
      Tools.setViewBackgroundColor(row,getColor,(roundedCorners) ? R.drawable.rounded_bg_top : R.drawable.empty_bg);
    }
    if (count == (appsNo - 1)) {
      bottomPadding=Tools.dpToPx(context,6);
      Tools.setViewBackgroundColor(row,getColor,(roundedCorners) ? R.drawable.rounded_bg_bottom : R.drawable.empty_bg);
    }
    if (count > 0 && count < (appsNo - 1)) {
      Tools.setViewBackgroundColor(row,getColor,R.drawable.empty_bg);
    }
    row.setViewPadding(R.id.clickCont,0,topPadding,0,bottomPadding);
    int clickID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int iconID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int labelID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int imgID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    int statsID=context.getResources().getIdentifier("String_Node_Str","String_Node_Str",packageName);
    if (task.getBlacklisted()) {
      continue;
    }
    if (count >= appsNo) {
      Tools.HangarLog("String_Node_Str" + count + "String_Node_Str"+ appsNo);
      break;
    }
    Bitmap cachedIcon;
    ComponentName componentTask=ComponentName.unflattenFromString(task.getPackageName() + "String_Node_Str" + task.getClassName());
    cachedIcon=ih.cachedIconHelper(componentTask);
    if (cachedIcon == null)     continue;
    count++;
    row.setImageViewBitmap(iconID,cachedIcon);
    row.setTextViewText(labelID,task.getName());
    float secondsRatio=(float)task.getSeconds() / highestSeconds;
    int barColor;
    int secondsColor=(Math.round(secondsRatio * 100));
    if (secondsColor >= 80) {
      barColor=0xFF34B5E2;
    }
 else     if (secondsColor >= 60) {
      barColor=0xFFAA66CC;
    }
 else     if (secondsColor >= 40) {
      barColor=0xFF74C353;
    }
 else     if (secondsColor >= 20) {
      barColor=0xFFFFBB33;
    }
 else {
      barColor=0xFFFF4444;
    }
    int[] colors=new int[]{barColor,Tools.dpToPx(context,secondsColor - 1),0x00000000,Tools.dpToPx(context,100 - secondsColor)};
    Drawable sd=new BarDrawable(colors);
    Bitmap bmpIcon2=drawableToBitmap(context,sd);
    row.setImageViewBitmap(imgID,bmpIcon2);
    int[] statsTime=new Settings().splitToComponentTimes(task.getSeconds());
    String statsString=((statsTime[0] > 0) ? statsTime[0] + "String_Node_Str" : "String_Node_Str") + ((statsTime[1] > 0) ? statsTime[1] + "String_Node_Str" : "String_Node_Str") + ((statsTime[2] > 0) ? statsTime[2] + "String_Node_Str" : "String_Node_Str");
    row.setTextViewText(statsID,statsString);
    try {
      intent=pkgm.getLaunchIntentForPackage(task.getPackageName());
      if (intent == null) {
        count--;
        throw new PackageManager.NameNotFoundException();
      }
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
      intent.setAction(Intent.ACTION_MAIN);
      PendingIntent activity=PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
      row.setOnClickPendingIntent(clickID,activity);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    views.addView(R.id.taskRoot,row);
  }
  appWidgetManager.updateAppWidget(appWidgetId,views);
}