Program: 180789
Project: 180789
Buggy source:
void handleRebuildList(){
  AppFilter filter;
  Comparator<AppEntry> comparator;
synchronized (mRebuildSync) {
    if (!mRebuildRequested) {
      return;
    }
    filter=mRebuildFilter;
    comparator=mRebuildComparator;
    mRebuildRequested=false;
    mRebuildFilter=null;
    mRebuildComparator=null;
  }
  Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
  if (filter != null) {
    filter.init();
  }
  List<ApplicationInfo> apps;
synchronized (mEntriesMap) {
    apps=new ArrayList<ApplicationInfo>(mApplications);
  }
  ArrayList<AppEntry> filteredApps=new ArrayList<AppEntry>();
  if (DEBUG)   Log.i(TAG,"String_Node_Str");
  for (int i=0; i < apps.size(); i++) {
    ApplicationInfo info=apps.get(i);
    if (filter == null || filter.filterApp(info)) {
synchronized (mEntriesMap) {
        AppEntry entry=getEntryLocked(info);
        entry.ensureLabel(mContext);
        if (DEBUG)         Log.i(TAG,"String_Node_Str" + info.packageName + "String_Node_Str"+ entry);
        filteredApps.add(entry);
      }
    }
  }
  Collections.sort(filteredApps,comparator);
synchronized (mRebuildSync) {
    if (!mRebuildRequested) {
      if (!mRebuildAsync) {
        mRebuildResult=filteredApps;
        mRebuildSync.notifyAll();
      }
 else {
        if (!mMainHandler.hasMessages(MainHandler.MSG_REBUILD_COMPLETE)) {
          Message msg=mMainHandler.obtainMessage(MainHandler.MSG_REBUILD_COMPLETE,filteredApps);
          mMainHandler.sendMessage(msg);
        }
      }
    }
  }
  Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
}

Fixed version (ground truth):
void handleRebuildList(){
  AppFilter filter;
  Comparator<AppEntry> comparator;
synchronized (mRebuildSync) {
    if (!mRebuildRequested) {
      return;
    }
    filter=mRebuildFilter;
    comparator=mRebuildComparator;
    mRebuildRequested=false;
    mRebuildFilter=null;
    mRebuildComparator=null;
  }
  Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
  if (filter != null) {
    filter.init();
  }
  List<ApplicationInfo> apps;
synchronized (mEntriesMap) {
    apps=new ArrayList<ApplicationInfo>(mApplications);
  }
  ArrayList<AppEntry> filteredApps=new ArrayList<AppEntry>();
  if (DEBUG)   Log.i(TAG,"String_Node_Str");
  for (int i=0; i < apps.size(); i++) {
    ApplicationInfo info=apps.get(i);
    if (filter == null || filter.filterApp(info)) {
synchronized (mEntriesMap) {
        if (DEBUG_LOCKING)         Log.v(TAG,"String_Node_Str");
        AppEntry entry=getEntryLocked(info);
        entry.ensureLabel(mContext);
        if (DEBUG)         Log.i(TAG,"String_Node_Str" + info.packageName + "String_Node_Str"+ entry);
        filteredApps.add(entry);
        if (DEBUG_LOCKING)         Log.v(TAG,"String_Node_Str");
      }
    }
  }
  Collections.sort(filteredApps,comparator);
synchronized (mRebuildSync) {
    if (!mRebuildRequested) {
      if (!mRebuildAsync) {
        mRebuildResult=filteredApps;
        mRebuildSync.notifyAll();
      }
 else {
        if (!mMainHandler.hasMessages(MainHandler.MSG_REBUILD_COMPLETE)) {
          Message msg=mMainHandler.obtainMessage(MainHandler.MSG_REBUILD_COMPLETE,filteredApps);
          mMainHandler.sendMessage(msg);
        }
      }
    }
  }
  Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
}