nus-yam/ex-repair huggingface dataset:
Program: 22456
Project: 22456
Buggy source:
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr);
  }
  Runtime.getRuntime().gc();
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}

Fixed version (ground truth):
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr,new IIntentReceiver.Stub(){
      public void performReceive(      Intent intent,      int resultCode,      String data,      Bundle extras,      boolean ordered,      boolean sticky) throws RemoteException {
        Runtime.getRuntime().gc();
      }
    }
);
  }
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}
Program: 22458
Project: 22458
Buggy source:
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,null,0,null,null,null,false,false);
    }
 catch (    RemoteException ex) {
    }
  }
}

Fixed version (ground truth):
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras,IIntentReceiver finishedReceiver){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,finishedReceiver,0,null,null,null,finishedReceiver != null,false);
    }
 catch (    RemoteException ex) {
    }
  }
}
Program: 22459
Project: 22459
Buggy source:
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras);
}

Fixed version (ground truth):
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras,null);
}
Program: 22461
Project: 22461
Buggy source:
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras);
  }
}

Fixed version (ground truth):
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras,null);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras,null);
  }
}
Program: 22463
Project: 22463
Buggy source:
private void sendResourcesChangedBroadcast(boolean mediaStatus,ArrayList<String> pkgList,int uidArr[]){
  int size=pkgList.size();
  if (size > 0) {
    Bundle extras=new Bundle();
    extras.putStringArray(Intent.EXTRA_CHANGED_PACKAGE_LIST,pkgList.toArray(new String[size]));
    if (uidArr != null) {
      extras.putIntArray(Intent.EXTRA_CHANGED_UID_LIST,uidArr);
    }
    String action=mediaStatus ? Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE : Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE;
    sendPackageBroadcast(action,null,extras);
  }
}

Fixed version (ground truth):
private void sendResourcesChangedBroadcast(boolean mediaStatus,ArrayList<String> pkgList,int uidArr[],IIntentReceiver finishedReceiver){
  int size=pkgList.size();
  if (size > 0) {
    Bundle extras=new Bundle();
    extras.putStringArray(Intent.EXTRA_CHANGED_PACKAGE_LIST,pkgList.toArray(new String[size]));
    if (uidArr != null) {
      extras.putIntArray(Intent.EXTRA_CHANGED_UID_LIST,uidArr);
    }
    String action=mediaStatus ? Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE : Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE;
    sendPackageBroadcast(action,null,extras,finishedReceiver);
  }
}
Program: 22467
Project: 22467
Buggy source:
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr);
  }
  Runtime.getRuntime().gc();
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}

Fixed version (ground truth):
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr,new IIntentReceiver.Stub(){
      public void performReceive(      Intent intent,      int resultCode,      String data,      Bundle extras,      boolean ordered,      boolean sticky) throws RemoteException {
        Runtime.getRuntime().gc();
      }
    }
);
  }
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}
Program: 22469
Project: 22469
Buggy source:
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,null,0,null,null,null,false,false);
    }
 catch (    RemoteException ex) {
    }
  }
}

Fixed version (ground truth):
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras,IIntentReceiver finishedReceiver){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,finishedReceiver,0,null,null,null,finishedReceiver != null,false);
    }
 catch (    RemoteException ex) {
    }
  }
}
Program: 22470
Project: 22470
Buggy source:
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras);
}

Fixed version (ground truth):
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras,null);
}
Program: 22472
Project: 22472
Buggy source:
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras);
  }
}

Fixed version (ground truth):
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras,null);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras,null);
  }
}
Program: 22474
Project: 22474
Buggy source:
private void sendResourcesChangedBroadcast(boolean mediaStatus,ArrayList<String> pkgList,int uidArr[]){
  int size=pkgList.size();
  if (size > 0) {
    Bundle extras=new Bundle();
    extras.putStringArray(Intent.EXTRA_CHANGED_PACKAGE_LIST,pkgList.toArray(new String[size]));
    if (uidArr != null) {
      extras.putIntArray(Intent.EXTRA_CHANGED_UID_LIST,uidArr);
    }
    String action=mediaStatus ? Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE : Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE;
    sendPackageBroadcast(action,null,extras);
  }
}

Fixed version (ground truth):
private void sendResourcesChangedBroadcast(boolean mediaStatus,ArrayList<String> pkgList,int uidArr[],IIntentReceiver finishedReceiver){
  int size=pkgList.size();
  if (size > 0) {
    Bundle extras=new Bundle();
    extras.putStringArray(Intent.EXTRA_CHANGED_PACKAGE_LIST,pkgList.toArray(new String[size]));
    if (uidArr != null) {
      extras.putIntArray(Intent.EXTRA_CHANGED_UID_LIST,uidArr);
    }
    String action=mediaStatus ? Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE : Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE;
    sendPackageBroadcast(action,null,extras,finishedReceiver);
  }
}
Program: 22478
Project: 22478
Buggy source:
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr);
  }
  Runtime.getRuntime().gc();
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}

Fixed version (ground truth):
private void unloadMediaPackages(HashMap<SdInstallArgs,String> processCids,int uidArr[]){
  if (DEBUG_SD_INSTALL)   Log.i(TAG,"String_Node_Str");
  ArrayList<String> pkgList=new ArrayList<String>();
  ArrayList<SdInstallArgs> failedList=new ArrayList<SdInstallArgs>();
  Set<SdInstallArgs> keys=processCids.keySet();
  for (  SdInstallArgs args : keys) {
    String cid=args.cid;
    String pkgName=args.getPackageName();
    if (DEBUG_SD_INSTALL)     Log.i(TAG,"String_Node_Str" + pkgName);
    PackageRemovedInfo outInfo=new PackageRemovedInfo();
synchronized (mInstallLock) {
      boolean res=deletePackageLI(pkgName,false,PackageManager.DONT_DELETE_DATA,outInfo);
      if (res) {
        pkgList.add(pkgName);
      }
 else {
        Slog.e(TAG,"String_Node_Str" + pkgName);
        failedList.add(args);
      }
    }
  }
  if (pkgList.size() > 0) {
    sendResourcesChangedBroadcast(false,pkgList,uidArr,new IIntentReceiver.Stub(){
      public void performReceive(      Intent intent,      int resultCode,      String data,      Bundle extras,      boolean ordered,      boolean sticky) throws RemoteException {
        Runtime.getRuntime().gc();
      }
    }
);
  }
  for (  SdInstallArgs args : keys) {
synchronized (mInstallLock) {
      args.doPostDeleteLI(false);
    }
  }
}
Program: 22480
Project: 22480
Buggy source:
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,null,0,null,null,null,false,false);
    }
 catch (    RemoteException ex) {
    }
  }
}

Fixed version (ground truth):
private static final void sendPackageBroadcast(String action,String pkg,Bundle extras,IIntentReceiver finishedReceiver){
  IActivityManager am=ActivityManagerNative.getDefault();
  if (am != null) {
    try {
      final Intent intent=new Intent(action,pkg != null ? Uri.fromParts("String_Node_Str",pkg,null) : null);
      if (extras != null) {
        intent.putExtras(extras);
      }
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      am.broadcastIntent(null,intent,null,finishedReceiver,0,null,null,null,finishedReceiver != null,false);
    }
 catch (    RemoteException ex) {
    }
  }
}
Program: 22481
Project: 22481
Buggy source:
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras);
}

Fixed version (ground truth):
private void sendPackageChangedBroadcast(String packageName,boolean killFlag,ArrayList<String> componentNames,int packageUid){
  if (false)   Log.v(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ componentNames);
  Bundle extras=new Bundle(4);
  extras.putString(Intent.EXTRA_CHANGED_COMPONENT_NAME,componentNames.get(0));
  String nameList[]=new String[componentNames.size()];
  componentNames.toArray(nameList);
  extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST,nameList);
  extras.putBoolean(Intent.EXTRA_DONT_KILL_APP,killFlag);
  extras.putInt(Intent.EXTRA_UID,packageUid);
  sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,packageName,extras,null);
}
Program: 22483
Project: 22483
Buggy source:
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras);
  }
}

Fixed version (ground truth):
void sendBroadcast(boolean fullRemove,boolean replacing){
  Bundle extras=new Bundle(1);
  extras.putInt(Intent.EXTRA_UID,removedUid >= 0 ? removedUid : uid);
  extras.putBoolean(Intent.EXTRA_DATA_REMOVED,fullRemove);
  if (replacing) {
    extras.putBoolean(Intent.EXTRA_REPLACING,true);
  }
  if (removedPackage != null) {
    sendPackageBroadcast(Intent.ACTION_PACKAGE_REMOVED,removedPackage,extras,null);
  }
  if (removedUid >= 0) {
    sendPackageBroadcast(Intent.ACTION_UID_REMOVED,null,extras,null);
  }
}
Program: 22485
Project: 22485
Buggy source:
private static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}

Fixed version (ground truth):
static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}
Program: 22486
Project: 22486
Buggy source:
private static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}

Fixed version (ground truth):
static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}
Program: 22487
Project: 22487
Buggy source:
private static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}

Fixed version (ground truth):
static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}
Program: 22488
Project: 22488
Buggy source:
private static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}

Fixed version (ground truth):
static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}
Program: 22489
Project: 22489
Buggy source:
private static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}

Fixed version (ground truth):
static final void dumpApplicationMemoryUsage(FileDescriptor fd,PrintWriter pw,List list,String prefix,String[] args){
  final boolean isCheckinRequest=scanArgs(args,"String_Node_Str");
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  if (isCheckinRequest) {
    pw.println(uptime + "String_Node_Str" + realtime);
    pw.flush();
  }
 else {
    pw.println("String_Node_Str");
    pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  }
  for (int i=list.size() - 1; i >= 0; i--) {
    ProcessRecord r=(ProcessRecord)list.get(i);
    if (r.thread != null) {
      if (!isCheckinRequest) {
        pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
        pw.flush();
      }
      try {
        r.thread.asBinder().dump(fd,args);
      }
 catch (      RemoteException e) {
        if (!isCheckinRequest) {
          pw.println("String_Node_Str");
          pw.flush();
        }
      }
    }
  }
}
Program: 22490
Project: 22490
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAccounts) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAccounts) {
      writeStatisticsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAuthorities) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAuthorities) {
      writeStatisticsLocked();
    }
  }
}
Program: 22491
Project: 22491
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAccounts) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAccounts) {
      writeStatisticsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAuthorities) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAuthorities) {
      writeStatisticsLocked();
    }
  }
}
Program: 22493
Project: 22493
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAccounts) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAccounts) {
      writeStatisticsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAuthorities) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAuthorities) {
      writeStatisticsLocked();
    }
  }
}
Program: 22494
Project: 22494
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAccounts) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAccounts) {
      writeStatisticsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAuthorities) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAuthorities) {
      writeStatisticsLocked();
    }
  }
}
Program: 22495
Project: 22495
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAccounts) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAccounts) {
      writeStatisticsLocked();
    }
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (msg.what == MSG_WRITE_STATUS) {
synchronized (mAuthorities) {
      writeStatusLocked();
    }
  }
 else   if (msg.what == MSG_WRITE_STATISTICS) {
synchronized (mAuthorities) {
      writeStatisticsLocked();
    }
  }
}
Program: 22525
Project: 22525
Buggy source:
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw()) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

Fixed version (ground truth):
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw() || !wtoken.mPolicyVisibilityAfterAnim) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}
Program: 22526
Project: 22526
Buggy source:
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}

Fixed version (ground truth):
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  if (updateOrientationFromAppTokensLocked()) {
    mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}
Program: 22528
Project: 22528
Buggy source:
boolean updateOrientationFromAppTokensLocked(){
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
boolean updateOrientationFromAppTokensLocked(){
  if (mDisplayFrozen) {
    return false;
  }
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 22530
Project: 22530
Buggy source:
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw()) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

Fixed version (ground truth):
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw() || !wtoken.mPolicyVisibilityAfterAnim) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}
Program: 22531
Project: 22531
Buggy source:
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}

Fixed version (ground truth):
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  if (updateOrientationFromAppTokensLocked()) {
    mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}
Program: 22533
Project: 22533
Buggy source:
boolean updateOrientationFromAppTokensLocked(){
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
boolean updateOrientationFromAppTokensLocked(){
  if (mDisplayFrozen) {
    return false;
  }
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 22536
Project: 22536
Buggy source:
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw()) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}

Fixed version (ground truth):
public int getOrientationFromWindowsLocked(){
  int pos=mWindows.size() - 1;
  while (pos >= 0) {
    WindowState wtoken=(WindowState)mWindows.get(pos);
    pos--;
    if (wtoken.mAppToken != null) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    }
    if (!wtoken.isVisibleLw() || !wtoken.mPolicyVisibilityAfterAnim) {
      continue;
    }
    int req=wtoken.mAttrs.screenOrientation;
    if ((req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) || (req == ActivityInfo.SCREEN_ORIENTATION_BEHIND)) {
      continue;
    }
 else {
      return req;
    }
  }
  return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}
Program: 22537
Project: 22537
Buggy source:
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}

Fixed version (ground truth):
private void stopFreezingDisplayLocked(){
  if (!mDisplayFrozen) {
    return;
  }
  if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen) {
    return;
  }
  mDisplayFrozen=false;
  mH.removeMessages(H.APP_FREEZE_TIMEOUT);
  if (PROFILE_ORIENTATION) {
    Debug.stopMethodTracing();
  }
  Surface.unfreezeDisplay(0);
synchronized (mKeyWaiter) {
    mKeyWaiter.mWasFrozen=true;
    mKeyWaiter.notifyAll();
  }
  if (updateOrientationFromAppTokensLocked()) {
    mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
  }
  mH.removeMessages(H.FORCE_GC);
  mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),2000);
  mScreenFrozenLock.release();
}
Program: 22539
Project: 22539
Buggy source:
boolean updateOrientationFromAppTokensLocked(){
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
boolean updateOrientationFromAppTokensLocked(){
  if (mDisplayFrozen) {
    return false;
  }
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
      if (setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE)) {
        changed=true;
      }
    }
    return changed;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 22542
Project: 22542
Buggy source:
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && event.isTracking() && !event.isCanceled()) {
      mMenu.close(true);
      dialog.dismiss();
      return true;
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}

Fixed version (ground truth):
public boolean onKey(DialogInterface dialog,int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK) {
    if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null) {
            ds.startTracking(event,this);
            return true;
          }
        }
      }
    }
 else     if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) {
      Window win=mDialog.getWindow();
      if (win != null) {
        View decor=win.getDecorView();
        if (decor != null) {
          KeyEvent.DispatcherState ds=decor.getKeyDispatcherState();
          if (ds != null && ds.isTracking(event)) {
            mMenu.close(true);
            dialog.dismiss();
            return true;
          }
        }
      }
    }
  }
  return mMenu.performShortcut(keyCode,event,0);
}