nus-yam/ex-repair huggingface dataset:
Program: 193633
Project: 193633
Buggy source:
boolean isDragResizing(){
  final Task task=mAppToken != null ? getTask() : null;
  return mService.mTaskPositioner != null && mService.mTaskPositioner.isTaskResizing(task);
}

Fixed version (ground truth):
boolean isDragResizing(){
  final Task task=getTask();
  return mService.mTaskPositioner != null && mService.mTaskPositioner.isTaskResizing(task);
}
Program: 193634
Project: 193634
Buggy source:
TaskStack getStack(){
  Task task=getTask();
  if (task != null) {
    if (task.mStack != null) {
      return task.mStack;
    }
  }
  return mDisplayContent.getHomeStack();
}

Fixed version (ground truth):
TaskStack getStack(){
  Task task=getTask();
  if (task != null) {
    if (task.mStack != null) {
      return task.mStack;
    }
  }
  return null;
}
Program: 193635
Project: 193635
Buggy source:
Task getTask(){
  AppWindowToken wtoken=mAppToken == null ? mService.mFocusedApp : mAppToken;
  if (wtoken == null) {
    return null;
  }
  final Task task=wtoken.mTask;
  return task;
}

Fixed version (ground truth):
Task getTask(){
  return mAppToken != null ? mAppToken.mTask : null;
}
Program: 193637
Project: 193637
Buggy source:
/** 
 * Returns true if the stack is considered visible. 
 */
private boolean isStackVisibleLocked(){
  if (!isAttached()) {
    return false;
  }
  if (mStackSupervisor.isFrontStack(this)) {
    return true;
  }
  final int stackIndex=mStacks.indexOf(this);
  if (stackIndex == mStacks.size() - 1) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
    return false;
  }
  if (isHiddenByDockedStack()) {
    return false;
  }
  for (int i=stackIndex + 1; i < mStacks.size(); i++) {
    final ActivityStack stack=mStacks.get(i);
    final ArrayList<TaskRecord> tasks=stack.getAllTasks();
    if (!stack.mFullscreen && !stack.hasFullscreenTask()) {
      continue;
    }
    if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID || stack.mStackId == HOME_STACK_ID) {
      return false;
    }
    for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
      final TaskRecord task=tasks.get(taskNdx);
      if (!task.mFullscreen) {
        continue;
      }
      final ArrayList<ActivityRecord> activities=task.mActivities;
      for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
        final ActivityRecord r=activities.get(activityNdx);
        if (!r.finishing && r.visible && (r.fullscreen || (!isHomeStack() && r.frontOfTask && task.isOverHomeStack()))) {
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns true if the stack is considered visible. 
 */
private boolean isStackVisibleLocked(){
  if (!isAttached()) {
    return false;
  }
  if (mStackSupervisor.isFrontStack(this)) {
    return true;
  }
  final int stackIndex=mStacks.indexOf(this);
  if (stackIndex == mStacks.size() - 1) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
    return false;
  }
  final ActivityStack focusedStack=mStackSupervisor.getFocusedStack();
  final int focusedStackId=focusedStack.mStackId;
  if (mStackId == DOCKED_STACK_ID) {
    if (focusedStackId != HOME_STACK_ID) {
      return true;
    }
    ActivityRecord topHomeActivity=focusedStack.topRunningActivityLocked(null);
    return topHomeActivity == null || !topHomeActivity.isHomeActivity();
  }
  if (focusedStackId == DOCKED_STACK_ID && stackIndex == (mStacks.indexOf(focusedStack) - 1)) {
    return true;
  }
  if (mStackId == HOME_STACK_ID && focusedStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
    return hasTranslucentActivity(focusedStack);
  }
  if (mStackId >= FIRST_STATIC_STACK_ID && mStackId <= LAST_STATIC_STACK_ID) {
    return false;
  }
  for (int i=stackIndex + 1; i < mStacks.size(); i++) {
    final ActivityStack stack=mStacks.get(i);
    if (!stack.mFullscreen && !stack.hasFullscreenTask()) {
      continue;
    }
    if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID || stack.mStackId == HOME_STACK_ID || stack.mStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
      return false;
    }
    if (!hasTranslucentActivity(stack)) {
      return false;
    }
  }
  return true;
}
Program: 193638
Project: 193638
Buggy source:
/** 
 * Paroled here means temporary pardon from being inactive 
 */
void setAppIdleParoled(boolean paroled){
synchronized (mLock) {
    if (mAppIdleParoled != paroled) {
      mAppIdleParoled=paroled;
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + mAppIdleParoled);
      if (paroled) {
        mLastAppIdleParoledTime=checkAndGetTimeLocked();
        postNextParoleTimeout();
      }
      postParoleStateChanged();
    }
  }
}

Fixed version (ground truth):
/** 
 * Paroled here means temporary pardon from being inactive 
 */
void setAppIdleParoled(boolean paroled){
synchronized (mLock) {
    if (mAppIdleParoled != paroled) {
      mAppIdleParoled=paroled;
      if (DEBUG)       Slog.d(TAG,"String_Node_Str" + mAppIdleParoled);
      if (paroled) {
        postParoleEndTimeout();
      }
 else {
        mLastAppIdleParoledTime=checkAndGetTimeLocked();
        postNextParoleTimeout();
      }
      postParoleStateChanged();
    }
  }
}
Program: 193639
Project: 193639
Buggy source:
/** 
 * Check if it's been a while since last parole and let idle apps do some work 
 */
void checkParoleTimeout(){
synchronized (mLock) {
    if (!mAppIdleParoled) {
      final long timeSinceLastParole=checkAndGetTimeLocked() - mLastAppIdleParoledTime;
      if (timeSinceLastParole > mAppIdleParoleIntervalMillis) {
        if (DEBUG)         Slog.d(TAG,"String_Node_Str");
        setAppIdleParoled(true);
        postParoleEndTimeout();
      }
 else {
        if (DEBUG)         Slog.d(TAG,"String_Node_Str");
        postNextParoleTimeout();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Check if it's been a while since last parole and let idle apps do some work 
 */
void checkParoleTimeout(){
synchronized (mLock) {
    if (!mAppIdleParoled) {
      final long timeSinceLastParole=checkAndGetTimeLocked() - mLastAppIdleParoledTime;
      if (timeSinceLastParole > mAppIdleParoleIntervalMillis) {
        if (DEBUG)         Slog.d(TAG,"String_Node_Str");
        setAppIdleParoled(true);
      }
 else {
        if (DEBUG)         Slog.d(TAG,"String_Node_Str");
        postNextParoleTimeout();
      }
    }
  }
}
Program: 193640
Project: 193640
Buggy source:
void onDeviceIdleModeChanged(){
  final boolean deviceIdle=mPowerManager.isDeviceIdleMode();
  if (DEBUG)   Slog.i(TAG,"String_Node_Str" + deviceIdle);
synchronized (mLock) {
    final long timeSinceLastParole=checkAndGetTimeLocked() - mLastAppIdleParoledTime;
    if (!deviceIdle && timeSinceLastParole >= mAppIdleParoleIntervalMillis) {
      if (DEBUG)       Slog.i(TAG,"String_Node_Str");
      postNextParoleTimeout();
      setAppIdleParoled(true);
    }
 else     if (deviceIdle) {
      if (DEBUG)       Slog.i(TAG,"String_Node_Str");
      setAppIdleParoled(false);
    }
  }
}

Fixed version (ground truth):
void onDeviceIdleModeChanged(){
  final boolean deviceIdle=mPowerManager.isDeviceIdleMode();
  if (DEBUG)   Slog.i(TAG,"String_Node_Str" + deviceIdle);
synchronized (mLock) {
    final long timeSinceLastParole=checkAndGetTimeLocked() - mLastAppIdleParoledTime;
    if (!deviceIdle && timeSinceLastParole >= mAppIdleParoleIntervalMillis) {
      if (DEBUG)       Slog.i(TAG,"String_Node_Str");
      setAppIdleParoled(true);
    }
 else     if (deviceIdle) {
      if (DEBUG)       Slog.i(TAG,"String_Node_Str");
      setAppIdleParoled(false);
    }
  }
}
Program: 193644
Project: 193644
Buggy source:
/** 
 * The Device owner can only be set by adb or an app with the MANAGE_PROFILE_AND_DEVICE_OWNERS permission. The device owner can only be set before the setup phase of the primary user has completed, except for adb if no accounts or additional users are present on the device.
 */
private void enforceCanSetDeviceOwner(int userId){
  if (mOwners.hasDeviceOwner()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  int callingUid=Binder.getCallingUid();
  if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) {
    if (!hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      return;
    }
    if (!UserManager.isSplitSystemUser()) {
      if (mUserManager.getUserCount() > 1) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
      if (AccountManager.get(mContext).getAccounts().length > 0) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
    }
    return;
  }
 else {
  }
  if (mUserManager.isUserRunning(new UserHandle(userId))) {
    throw new IllegalStateException("String_Node_Str" + userId);
  }
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS,null);
  if (!UserManager.isSplitSystemUser()) {
    if (hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * The Device owner can only be set by adb or an app with the MANAGE_PROFILE_AND_DEVICE_OWNERS permission. The device owner can only be set before the setup phase of the primary user has completed, except for adb if no accounts or additional users are present on the device.
 */
private void enforceCanSetDeviceOwner(int userId){
  if (mOwners.hasDeviceOwner()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  int callingUid=Binder.getCallingUid();
  if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) {
    if (!hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      return;
    }
    if (!UserManager.isSplitSystemUser()) {
      if (mUserManager.getUserCount() > 1) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
      if (AccountManager.get(mContext).getAccounts().length > 0) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
    }
    return;
  }
  if (!mUserManager.isUserRunning(new UserHandle(userId))) {
    throw new IllegalStateException("String_Node_Str" + userId);
  }
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS,null);
  if (!UserManager.isSplitSystemUser()) {
    if (hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
  }
}
Program: 193645
Project: 193645
Buggy source:
/** 
 * The Device owner can only be set by adb or an app with the MANAGE_PROFILE_AND_DEVICE_OWNERS permission. The device owner can only be set before the setup phase of the primary user has completed, except for adb if no accounts or additional users are present on the device.
 */
private void enforceCanSetDeviceOwner(int userId){
  if (mOwners.hasDeviceOwner()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  int callingUid=Binder.getCallingUid();
  if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) {
    if (!hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      return;
    }
    if (!UserManager.isSplitSystemUser()) {
      if (mUserManager.getUserCount() > 1) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
      if (AccountManager.get(mContext).getAccounts().length > 0) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
    }
    return;
  }
 else {
  }
  if (mUserManager.isUserRunning(new UserHandle(userId))) {
    throw new IllegalStateException("String_Node_Str" + userId);
  }
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS,null);
  if (!UserManager.isSplitSystemUser()) {
    if (hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * The Device owner can only be set by adb or an app with the MANAGE_PROFILE_AND_DEVICE_OWNERS permission. The device owner can only be set before the setup phase of the primary user has completed, except for adb if no accounts or additional users are present on the device.
 */
private void enforceCanSetDeviceOwner(int userId){
  if (mOwners.hasDeviceOwner()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  int callingUid=Binder.getCallingUid();
  if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) {
    if (!hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      return;
    }
    if (!UserManager.isSplitSystemUser()) {
      if (mUserManager.getUserCount() > 1) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
      if (AccountManager.get(mContext).getAccounts().length > 0) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
      }
    }
    return;
  }
  if (!mUserManager.isUserRunning(new UserHandle(userId))) {
    throw new IllegalStateException("String_Node_Str" + userId);
  }
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS,null);
  if (!UserManager.isSplitSystemUser()) {
    if (hasUserSetupCompleted(UserHandle.USER_OWNER)) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
    }
  }
}
Program: 193647
Project: 193647
Buggy source:
protected KeepalivePacketData(InetAddress srcAddress,int srcPort,InetAddress dstAddress,int dstPort,byte[] data) throws InvalidPacketException {
  this.srcAddress=srcAddress;
  this.dstAddress=dstAddress;
  this.srcPort=srcPort;
  this.dstPort=dstPort;
  this.data=data;
  if (srcAddress == null || dstAddress == null || !srcAddress.getClass().getName().equals(dstAddress.getClass().getName())) {
  }
  if (this.dstAddress instanceof Inet4Address) {
    this.protocol=OsConstants.ETH_P_IP;
  }
 else   if (this.dstAddress instanceof Inet6Address) {
    this.protocol=OsConstants.ETH_P_IPV6;
  }
 else {
    throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
  }
  if (!IpUtils.isValidUdpOrTcpPort(srcPort) || !IpUtils.isValidUdpOrTcpPort(dstPort)) {
    throw new InvalidPacketException(ERROR_INVALID_PORT);
  }
}

Fixed version (ground truth):
protected KeepalivePacketData(InetAddress srcAddress,int srcPort,InetAddress dstAddress,int dstPort,byte[] data) throws InvalidPacketException {
  this.srcAddress=srcAddress;
  this.dstAddress=dstAddress;
  this.srcPort=srcPort;
  this.dstPort=dstPort;
  this.data=data;
  if (srcAddress == null || dstAddress == null || !srcAddress.getClass().getName().equals(dstAddress.getClass().getName())) {
    throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
  }
  if (this.dstAddress instanceof Inet4Address) {
    this.protocol=OsConstants.ETH_P_IP;
  }
 else   if (this.dstAddress instanceof Inet6Address) {
    this.protocol=OsConstants.ETH_P_IPV6;
  }
 else {
    throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
  }
  if (!IpUtils.isValidUdpOrTcpPort(srcPort) || !IpUtils.isValidUdpOrTcpPort(dstPort)) {
    throw new InvalidPacketException(ERROR_INVALID_PORT);
  }
}
Program: 193648
Project: 193648
Buggy source:
/** 
 * Creates an IPsec NAT-T keepalive packet with the specified parameters.
 */
public static KeepalivePacketData nattKeepalivePacket(InetAddress srcAddress,int srcPort,InetAddress dstAddress,int dstPort) throws InvalidPacketException {
  if (!(srcAddress instanceof Inet4Address)) {
    throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
  }
  if (dstPort != NATT_PORT) {
    throw new InvalidPacketException(ERROR_INVALID_PORT);
  }
  int length=IPV4_HEADER_LENGTH + UDP_HEADER_LENGTH + 1;
  ByteBuffer buf=ByteBuffer.allocate(length);
  buf.order(ByteOrder.BIG_ENDIAN);
  buf.putShort((short)0x4500);
  buf.putShort((short)length);
  buf.putInt(0);
  buf.put((byte)64);
  buf.put((byte)OsConstants.IPPROTO_UDP);
  int ipChecksumOffset=buf.position();
  buf.putShort((short)0);
  buf.put(srcAddress.getAddress());
  buf.put(dstAddress.getAddress());
  buf.putShort((short)srcPort);
  buf.putShort((short)dstPort);
  buf.putShort((short)(length - 20));
  int udpChecksumOffset=buf.position();
  buf.putShort((short)0);
  buf.put((byte)0xff);
  buf.putShort(ipChecksumOffset,IpUtils.ipChecksum(buf,0));
  buf.putShort(udpChecksumOffset,IpUtils.udpChecksum(buf,0,IPV4_HEADER_LENGTH));
  return new KeepalivePacketData(srcAddress,srcPort,dstAddress,dstPort,buf.array());
}

Fixed version (ground truth):
/** 
 * Creates an IPsec NAT-T keepalive packet with the specified parameters.
 */
public static KeepalivePacketData nattKeepalivePacket(InetAddress srcAddress,int srcPort,InetAddress dstAddress,int dstPort) throws InvalidPacketException {
  if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) {
    throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
  }
  if (dstPort != NATT_PORT) {
    throw new InvalidPacketException(ERROR_INVALID_PORT);
  }
  int length=IPV4_HEADER_LENGTH + UDP_HEADER_LENGTH + 1;
  ByteBuffer buf=ByteBuffer.allocate(length);
  buf.order(ByteOrder.BIG_ENDIAN);
  buf.putShort((short)0x4500);
  buf.putShort((short)length);
  buf.putInt(0);
  buf.put((byte)64);
  buf.put((byte)OsConstants.IPPROTO_UDP);
  int ipChecksumOffset=buf.position();
  buf.putShort((short)0);
  buf.put(srcAddress.getAddress());
  buf.put(dstAddress.getAddress());
  buf.putShort((short)srcPort);
  buf.putShort((short)dstPort);
  buf.putShort((short)(length - 20));
  int udpChecksumOffset=buf.position();
  buf.putShort((short)0);
  buf.put((byte)0xff);
  buf.putShort(ipChecksumOffset,IpUtils.ipChecksum(buf,0));
  buf.putShort(udpChecksumOffset,IpUtils.udpChecksum(buf,0,IPV4_HEADER_LENGTH));
  return new KeepalivePacketData(srcAddress,srcPort,dstAddress,dstPort,buf.array());
}
Program: 193649
Project: 193649
Buggy source:
public void startNattKeepalive(NetworkAgentInfo nai,int intervalSeconds,Messenger messenger,IBinder binder,String srcAddrString,int srcPort,String dstAddrString,int dstPort){
  InetAddress srcAddress, dstAddress;
  try {
    srcAddress=NetworkUtils.numericToInetAddress(srcAddrString);
    dstAddress=NetworkUtils.numericToInetAddress(dstAddrString);
  }
 catch (  IllegalArgumentException e) {
    notifyMessenger(messenger,NO_KEEPALIVE,ERROR_INVALID_IP_ADDRESS);
    return;
  }
  KeepalivePacketData packet;
  try {
    packet=KeepalivePacketData.nattKeepalivePacket(srcAddress,srcPort,dstAddress,NATT_PORT);
  }
 catch (  KeepalivePacketData.InvalidPacketException e) {
    notifyMessenger(messenger,NO_KEEPALIVE,e.error);
    return;
  }
  KeepaliveInfo ki=new KeepaliveInfo(messenger,binder,nai,packet,intervalSeconds);
  Log.d(TAG,"String_Node_Str" + ki.toString());
  mConnectivityServiceHandler.obtainMessage(NetworkAgent.CMD_START_PACKET_KEEPALIVE,ki).sendToTarget();
}

Fixed version (ground truth):
public void startNattKeepalive(NetworkAgentInfo nai,int intervalSeconds,Messenger messenger,IBinder binder,String srcAddrString,int srcPort,String dstAddrString,int dstPort){
  if (nai == null) {
    notifyMessenger(messenger,NO_KEEPALIVE,ERROR_INVALID_NETWORK);
    return;
  }
  InetAddress srcAddress, dstAddress;
  try {
    srcAddress=NetworkUtils.numericToInetAddress(srcAddrString);
    dstAddress=NetworkUtils.numericToInetAddress(dstAddrString);
  }
 catch (  IllegalArgumentException e) {
    notifyMessenger(messenger,NO_KEEPALIVE,ERROR_INVALID_IP_ADDRESS);
    return;
  }
  KeepalivePacketData packet;
  try {
    packet=KeepalivePacketData.nattKeepalivePacket(srcAddress,srcPort,dstAddress,NATT_PORT);
  }
 catch (  KeepalivePacketData.InvalidPacketException e) {
    notifyMessenger(messenger,NO_KEEPALIVE,e.error);
    return;
  }
  KeepaliveInfo ki=new KeepaliveInfo(messenger,binder,nai,packet,intervalSeconds);
  Log.d(TAG,"String_Node_Str" + ki.toString());
  mConnectivityServiceHandler.obtainMessage(NetworkAgent.CMD_START_PACKET_KEEPALIVE,ki).sendToTarget();
}
Program: 193650
Project: 193650
Buggy source:
public void handleStopKeepalive(NetworkAgentInfo nai,int slot,int reason){
  HashMap<Integer,KeepaliveInfo> networkKeepalives=mKeepalives.get(nai);
  if (networkKeepalives == null) {
    Log.e(TAG,"String_Node_Str" + nai.name());
    return;
  }
  KeepaliveInfo ki=networkKeepalives.get(slot);
  if (ki == null) {
    Log.e(TAG,"String_Node_Str" + slot + "String_Node_Str"+ nai.name());
    return;
  }
  ki.stop(reason);
  networkKeepalives.remove(slot);
  if (networkKeepalives.isEmpty()) {
    mKeepalives.remove(nai);
  }
}

Fixed version (ground truth):
public void handleStopKeepalive(NetworkAgentInfo nai,int slot,int reason){
  String networkName=(nai == null) ? "String_Node_Str" : nai.name();
  HashMap<Integer,KeepaliveInfo> networkKeepalives=mKeepalives.get(nai);
  if (networkKeepalives == null) {
    Log.e(TAG,"String_Node_Str" + networkName);
    return;
  }
  KeepaliveInfo ki=networkKeepalives.get(slot);
  if (ki == null) {
    Log.e(TAG,"String_Node_Str" + slot + "String_Node_Str"+ networkName);
    return;
  }
  ki.stop(reason);
  networkKeepalives.remove(slot);
  if (networkKeepalives.isEmpty()) {
    mKeepalives.remove(nai);
  }
}
Program: 193651
Project: 193651
Buggy source:
private int findFirstFreeSlot(NetworkAgentInfo nai){
  HashMap networkKeepalives=mKeepalives.get(nai);
  if (networkKeepalives == null) {
    networkKeepalives=new HashMap<Integer,KeepaliveInfo>();
    mKeepalives.put(nai,networkKeepalives);
  }
  int slot;
  for (slot=0; slot < networkKeepalives.size(); slot++) {
    if (networkKeepalives.get(slot) == null) {
      return slot;
    }
  }
  if (slot == 0)   slot=1;
  return slot;
}

Fixed version (ground truth):
private int findFirstFreeSlot(NetworkAgentInfo nai){
  HashMap networkKeepalives=mKeepalives.get(nai);
  if (networkKeepalives == null) {
    networkKeepalives=new HashMap<Integer,KeepaliveInfo>();
    mKeepalives.put(nai,networkKeepalives);
  }
  int slot;
  for (slot=1; slot <= networkKeepalives.size(); slot++) {
    if (networkKeepalives.get(slot) == null) {
      return slot;
    }
  }
  return slot;
}
Program: 193654
Project: 193654
Buggy source:
/** 
 * Copies a the given documents to the given location.
 * @param srcInfo DocumentInfos for the documents to copy.
 * @param dstDirInfo The destination directory.
 * @throws RemoteException
 */
private void copy(DocumentInfo srcInfo,DocumentInfo dstDirInfo,int mode) throws RemoteException {
  final Uri dstUri=DocumentsContract.createDocument(mDstClient,dstDirInfo.derivedUri,srcInfo.mimeType,srcInfo.displayName);
  if (dstUri == null) {
    Log.e(TAG,"String_Node_Str" + srcInfo.displayName);
    mFailedFiles.add(srcInfo);
    return;
  }
  if (Document.MIME_TYPE_DIR.equals(srcInfo.mimeType)) {
    copyDirectoryHelper(srcInfo.derivedUri,dstUri,mode);
  }
 else {
    copyFileHelper(srcInfo.derivedUri,dstUri,mode);
  }
}

Fixed version (ground truth):
/** 
 * Copies a the given documents to the given location.
 * @param srcInfo DocumentInfos for the documents to copy.
 * @param dstDirInfo The destination directory.
 * @throws RemoteException
 */
private void copy(DocumentInfo srcInfo,DocumentInfo dstDirInfo,int mode) throws RemoteException {
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + srcInfo.displayName + "String_Node_Str"+ srcInfo.derivedUri+ "String_Node_Str"+ "String_Node_Str"+ dstDirInfo.displayName+ "String_Node_Str"+ dstDirInfo.derivedUri+ "String_Node_Str");
  final Uri dstUri=DocumentsContract.createDocument(mDstClient,dstDirInfo.derivedUri,srcInfo.mimeType,srcInfo.displayName);
  if (dstUri == null) {
    Log.e(TAG,"String_Node_Str" + srcInfo.displayName);
    mFailedFiles.add(srcInfo);
    return;
  }
  if (Document.MIME_TYPE_DIR.equals(srcInfo.mimeType)) {
    copyDirectoryHelper(srcInfo.derivedUri,dstUri,mode);
  }
 else {
    copyFileHelper(srcInfo.derivedUri,dstUri,mode);
  }
}
Program: 193657
Project: 193657
Buggy source:
/** 
 * Copies a the given documents to the given location.
 * @param srcInfo DocumentInfos for the documents to copy.
 * @param dstDirInfo The destination directory.
 * @throws RemoteException
 */
private void copy(DocumentInfo srcInfo,DocumentInfo dstDirInfo,int mode) throws RemoteException {
  final Uri dstUri=DocumentsContract.createDocument(mDstClient,dstDirInfo.derivedUri,srcInfo.mimeType,srcInfo.displayName);
  if (dstUri == null) {
    Log.e(TAG,"String_Node_Str" + srcInfo.displayName);
    mFailedFiles.add(srcInfo);
    return;
  }
  if (Document.MIME_TYPE_DIR.equals(srcInfo.mimeType)) {
    copyDirectoryHelper(srcInfo.derivedUri,dstUri,mode);
  }
 else {
    copyFileHelper(srcInfo.derivedUri,dstUri,mode);
  }
}

Fixed version (ground truth):
/** 
 * Copies a the given documents to the given location.
 * @param srcInfo DocumentInfos for the documents to copy.
 * @param dstDirInfo The destination directory.
 * @throws RemoteException
 */
private void copy(DocumentInfo srcInfo,DocumentInfo dstDirInfo,int mode) throws RemoteException {
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + srcInfo.displayName + "String_Node_Str"+ srcInfo.derivedUri+ "String_Node_Str"+ "String_Node_Str"+ dstDirInfo.displayName+ "String_Node_Str"+ dstDirInfo.derivedUri+ "String_Node_Str");
  final Uri dstUri=DocumentsContract.createDocument(mDstClient,dstDirInfo.derivedUri,srcInfo.mimeType,srcInfo.displayName);
  if (dstUri == null) {
    Log.e(TAG,"String_Node_Str" + srcInfo.displayName);
    mFailedFiles.add(srcInfo);
    return;
  }
  if (Document.MIME_TYPE_DIR.equals(srcInfo.mimeType)) {
    copyDirectoryHelper(srcInfo.derivedUri,dstUri,mode);
  }
 else {
    copyFileHelper(srcInfo.derivedUri,dstUri,mode);
  }
}
Program: 193659
Project: 193659
Buggy source:
void readFromFileLocked(){
  if (!mFile.exists()) {
    return;
  }
  final AtomicFile f=new AtomicFile(mFile);
  InputStream input=null;
  try {
    input=f.openRead();
    final XmlPullParser parser=Xml.newPullParser();
    parser.setInput(input,StandardCharsets.UTF_8.name());
    int type;
    int depth=0;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT) {
switch (type) {
case XmlPullParser.START_TAG:
        depth++;
      break;
case XmlPullParser.END_TAG:
    depth--;
default :
  continue;
}
final String tag=parser.getName();
if (depth == 1) {
if (!TAG_ROOT.equals(tag)) {
  Slog.e(TAG,"String_Node_Str" + tag);
  return;
}
}
if (!readInner(parser,depth,tag)) {
return;
}
}
}
 catch (XmlPullParserException|IOException e) {
Slog.e(TAG,"String_Node_Str",e);
}
 finally {
IoUtils.closeQuietly(input);
}
}

Fixed version (ground truth):
void readFromFileLocked(){
  if (!mFile.exists()) {
    return;
  }
  final AtomicFile f=new AtomicFile(mFile);
  InputStream input=null;
  try {
    input=f.openRead();
    final XmlPullParser parser=Xml.newPullParser();
    parser.setInput(input,StandardCharsets.UTF_8.name());
    int type;
    int depth=0;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT) {
switch (type) {
case XmlPullParser.START_TAG:
        depth++;
      break;
case XmlPullParser.END_TAG:
    depth--;
default :
  continue;
}
final String tag=parser.getName();
if (depth == 1) {
if (!TAG_ROOT.equals(tag)) {
  Slog.e(TAG,"String_Node_Str" + tag);
  return;
}
continue;
}
if (!readInner(parser,depth,tag)) {
return;
}
}
}
 catch (XmlPullParserException|IOException e) {
Slog.e(TAG,"String_Node_Str",e);
}
 finally {
IoUtils.closeQuietly(input);
}
}
Program: 193661
Project: 193661
Buggy source:
void readFromFileLocked(){
  if (!mFile.exists()) {
    return;
  }
  final AtomicFile f=new AtomicFile(mFile);
  InputStream input=null;
  try {
    input=f.openRead();
    final XmlPullParser parser=Xml.newPullParser();
    parser.setInput(input,StandardCharsets.UTF_8.name());
    int type;
    int depth=0;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT) {
switch (type) {
case XmlPullParser.START_TAG:
        depth++;
      break;
case XmlPullParser.END_TAG:
    depth--;
default :
  continue;
}
final String tag=parser.getName();
if (depth == 1) {
if (!TAG_ROOT.equals(tag)) {
  Slog.e(TAG,"String_Node_Str" + tag);
  return;
}
}
if (!readInner(parser,depth,tag)) {
return;
}
}
}
 catch (XmlPullParserException|IOException e) {
Slog.e(TAG,"String_Node_Str",e);
}
 finally {
IoUtils.closeQuietly(input);
}
}

Fixed version (ground truth):
void readFromFileLocked(){
  if (!mFile.exists()) {
    return;
  }
  final AtomicFile f=new AtomicFile(mFile);
  InputStream input=null;
  try {
    input=f.openRead();
    final XmlPullParser parser=Xml.newPullParser();
    parser.setInput(input,StandardCharsets.UTF_8.name());
    int type;
    int depth=0;
    while ((type=parser.next()) != XmlPullParser.END_DOCUMENT) {
switch (type) {
case XmlPullParser.START_TAG:
        depth++;
      break;
case XmlPullParser.END_TAG:
    depth--;
default :
  continue;
}
final String tag=parser.getName();
if (depth == 1) {
if (!TAG_ROOT.equals(tag)) {
  Slog.e(TAG,"String_Node_Str" + tag);
  return;
}
continue;
}
if (!readInner(parser,depth,tag)) {
return;
}
}
}
 catch (XmlPullParserException|IOException e) {
Slog.e(TAG,"String_Node_Str",e);
}
 finally {
IoUtils.closeQuietly(input);
}
}
Program: 193667
Project: 193667
Buggy source:
public <T extends BandManagerHelper & BandModelHelper>BandSelectManager(T helper){
  mHelper=helper;
  mModel=new BandSelectModel(helper);
  mModel.addOnSelectionChangedListener(this);
}

Fixed version (ground truth):
public <T extends BandManagerHelper & BandModelHelper>BandSelectManager(T helper){
  mHelper=helper;
  mHelper.addOnScrollListener(this);
  mModel=new BandSelectModel(helper);
  mModel.addOnSelectionChangedListener(this);
}
Program: 193668
Project: 193668
Buggy source:
@Override public void run(){
  int pixelsPastView=0;
  if (mPointer.y <= 0) {
    pixelsPastView=mPointer.y - 1;
  }
 else   if (mPointer.y >= mHelper.getHeight() - 1) {
    pixelsPastView=mPointer.y - mHelper.getHeight() + 1;
  }
  if (!mIsActive || pixelsPastView == 0) {
    mScrollStartTime=NOT_SET;
    return;
  }
  if (mScrollStartTime == NOT_SET) {
    mScrollStartTime=System.currentTimeMillis();
  }
  final int numPixels=computeScrollDistance(pixelsPastView,System.currentTimeMillis() - mScrollStartTime);
  mHelper.scrollBy(numPixels);
  mOrigin.y-=numPixels;
  resizeBandSelectRectangle();
  mHelper.removeCallback(mViewScroller);
  mHelper.postRunnable(this);
}

Fixed version (ground truth):
@Override public void run(){
  int pixelsPastView=0;
  if (mPointer.y <= 0) {
    pixelsPastView=mPointer.y - 1;
  }
 else   if (mPointer.y >= mHelper.getHeight() - 1) {
    pixelsPastView=mPointer.y - mHelper.getHeight() + 1;
  }
  if (!mIsActive || pixelsPastView == 0) {
    mScrollStartTime=NOT_SET;
    return;
  }
  if (mScrollStartTime == NOT_SET) {
    mScrollStartTime=System.currentTimeMillis();
  }
  final int numPixels=computeScrollDistance(pixelsPastView,System.currentTimeMillis() - mScrollStartTime);
  mHelper.scrollBy(numPixels);
  mHelper.removeCallback(mViewScroller);
  mHelper.postRunnable(this);
}
Program: 193669
Project: 193669
Buggy source:
public <T extends BandManagerHelper & BandModelHelper>BandSelectManager(T helper){
  mHelper=helper;
  mModel=new BandSelectModel(helper);
  mModel.addOnSelectionChangedListener(this);
}

Fixed version (ground truth):
public <T extends BandManagerHelper & BandModelHelper>BandSelectManager(T helper){
  mHelper=helper;
  mHelper.addOnScrollListener(this);
  mModel=new BandSelectModel(helper);
  mModel.addOnSelectionChangedListener(this);
}
Program: 193670
Project: 193670
Buggy source:
@Override public void run(){
  int pixelsPastView=0;
  if (mPointer.y <= 0) {
    pixelsPastView=mPointer.y - 1;
  }
 else   if (mPointer.y >= mHelper.getHeight() - 1) {
    pixelsPastView=mPointer.y - mHelper.getHeight() + 1;
  }
  if (!mIsActive || pixelsPastView == 0) {
    mScrollStartTime=NOT_SET;
    return;
  }
  if (mScrollStartTime == NOT_SET) {
    mScrollStartTime=System.currentTimeMillis();
  }
  final int numPixels=computeScrollDistance(pixelsPastView,System.currentTimeMillis() - mScrollStartTime);
  mHelper.scrollBy(numPixels);
  mOrigin.y-=numPixels;
  resizeBandSelectRectangle();
  mHelper.removeCallback(mViewScroller);
  mHelper.postRunnable(this);
}

Fixed version (ground truth):
@Override public void run(){
  int pixelsPastView=0;
  if (mPointer.y <= 0) {
    pixelsPastView=mPointer.y - 1;
  }
 else   if (mPointer.y >= mHelper.getHeight() - 1) {
    pixelsPastView=mPointer.y - mHelper.getHeight() + 1;
  }
  if (!mIsActive || pixelsPastView == 0) {
    mScrollStartTime=NOT_SET;
    return;
  }
  if (mScrollStartTime == NOT_SET) {
    mScrollStartTime=System.currentTimeMillis();
  }
  final int numPixels=computeScrollDistance(pixelsPastView,System.currentTimeMillis() - mScrollStartTime);
  mHelper.scrollBy(numPixels);
  mHelper.removeCallback(mViewScroller);
  mHelper.postRunnable(this);
}
Program: 193671
Project: 193671
Buggy source:
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}

Fixed version (ground truth):
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}
Program: 193672
Project: 193672
Buggy source:
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}

Fixed version (ground truth):
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}
Program: 193673
Project: 193673
Buggy source:
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}

Fixed version (ground truth):
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}
Program: 193674
Project: 193674
Buggy source:
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}

Fixed version (ground truth):
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}
Program: 193675
Project: 193675
Buggy source:
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}

Fixed version (ground truth):
/** 
 * Initializes and acquires the scene, creating various Android objects such as context, inflater, and parser.
 * @param timeout the time to wait if another rendering is happening.
 * @return whether the scene was prepared
 * @see #acquire(long)
 * @see #release()
 */
public Result init(long timeout){
  Result result=acquireLock(timeout);
  if (result != null) {
    return result;
  }
  HardwareConfig hardwareConfig=mParams.getHardwareConfig();
  DisplayMetrics metrics=new DisplayMetrics();
  metrics.densityDpi=metrics.noncompatDensityDpi=hardwareConfig.getDensity().getDpiValue();
  metrics.density=metrics.noncompatDensity=metrics.densityDpi / (float)DisplayMetrics.DENSITY_DEFAULT;
  metrics.scaledDensity=metrics.noncompatScaledDensity=metrics.density;
  metrics.widthPixels=metrics.noncompatWidthPixels=hardwareConfig.getScreenWidth();
  metrics.heightPixels=metrics.noncompatHeightPixels=hardwareConfig.getScreenHeight();
  metrics.xdpi=metrics.noncompatXdpi=hardwareConfig.getXdpi();
  metrics.ydpi=metrics.noncompatYdpi=hardwareConfig.getYdpi();
  RenderResources resources=mParams.getResources();
  mContext=new BridgeContext(mParams.getProjectKey(),metrics,resources,mParams.getAssets(),mParams.getLayoutlibCallback(),getConfiguration(),mParams.getTargetSdkVersion(),mParams.isRtlSupported());
  setUp();
  return SUCCESS.createResult();
}
Program: 193676
Project: 193676
Buggy source:
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}

Fixed version (ground truth):
/** 
 * Sets up the session for rendering. <p/> The counterpart is   {@link #tearDown()}.
 */
private void setUp(){
  ParserFactory.setParserFactory(mParams.getLayoutlibCallback().getParserFactory());
  mContext.initResources();
  sCurrentContext=mContext;
  InputMethodManager.getInstance();
  LayoutLog currentLog=mParams.getLog();
  Bridge.setLog(currentLog);
  mContext.getRenderResources().setFrameworkResourceIdProvider(this);
  mContext.getRenderResources().setLogger(currentLog);
}
Program: 193677
Project: 193677
Buggy source:
@Override public void onFingerprintAuthenticated(int userId){
  boolean wasDeviceInteractive=mUpdateMonitor.isDeviceInteractive();
  mMode=calculateMode();
  if (!wasDeviceInteractive) {
    if (DEBUG_FP_WAKELOCK) {
      Log.i(TAG,"String_Node_Str");
    }
    mPowerManager.wakeUp(SystemClock.uptimeMillis());
  }
  releaseFingerprintWakeLock();
switch (mMode) {
case MODE_DISMISS_BOUNCER:
    mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(false);
  break;
case MODE_UNLOCK:
case MODE_SHOW_BOUNCER:
if (!wasDeviceInteractive) {
  mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
}
mStatusBarKeyguardViewManager.animateCollapsePanels(FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
break;
case MODE_WAKE_AND_UNLOCK:
case MODE_WAKE_AND_UNLOCK_PULSING:
mDozeScrimController.abortPulsing();
mKeyguardViewMediator.onWakeAndUnlocking();
mScrimController.setWakeAndUnlocking();
if (mPhoneStatusBar.getNavigationBarView() != null) {
mPhoneStatusBar.getNavigationBarView().setWakeAndUnlocking(true);
}
break;
case MODE_ONLY_WAKE:
case MODE_NONE:
break;
}
if (mMode != MODE_WAKE_AND_UNLOCK_PULSING) {
mStatusBarWindowManager.setForceDozeBrightness(false);
}
mPhoneStatusBar.notifyFpAuthModeChanged();
}

Fixed version (ground truth):
@Override public void onFingerprintAuthenticated(int userId){
  boolean wasDeviceInteractive=mUpdateMonitor.isDeviceInteractive();
  mMode=calculateMode();
  if (!wasDeviceInteractive) {
    if (DEBUG_FP_WAKELOCK) {
      Log.i(TAG,"String_Node_Str");
    }
    mPowerManager.wakeUp(SystemClock.uptimeMillis());
  }
  releaseFingerprintWakeLock();
switch (mMode) {
case MODE_DISMISS_BOUNCER:
    mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(false);
  break;
case MODE_UNLOCK:
case MODE_SHOW_BOUNCER:
if (!wasDeviceInteractive) {
  mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
}
mStatusBarKeyguardViewManager.animateCollapsePanels(FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
break;
case MODE_WAKE_AND_UNLOCK_PULSING:
mPhoneStatusBar.updateMediaMetaData(false);
case MODE_WAKE_AND_UNLOCK:
mStatusBarWindowManager.setStatusBarFocusable(false);
mDozeScrimController.abortPulsing();
mKeyguardViewMediator.onWakeAndUnlocking();
mScrimController.setWakeAndUnlocking();
if (mPhoneStatusBar.getNavigationBarView() != null) {
mPhoneStatusBar.getNavigationBarView().setWakeAndUnlocking(true);
}
break;
case MODE_ONLY_WAKE:
case MODE_NONE:
break;
}
if (mMode != MODE_WAKE_AND_UNLOCK_PULSING) {
mStatusBarWindowManager.setForceDozeBrightness(false);
}
mPhoneStatusBar.notifyFpAuthModeChanged();
}
Program: 193680
Project: 193680
Buggy source:
@Override public void appTransitionStarting(long startTime,long duration){
  if (!mKeyguardFadingAway) {
    mIconController.appTransitionStarting(startTime,duration);
  }
  if (mIconPolicy != null) {
    mIconPolicy.appTransitionStarting(startTime,duration);
  }
}

Fixed version (ground truth):
@Override public void appTransitionStarting(long startTime,long duration){
  if (!mKeyguardFadingAway && duration > 0) {
    mIconController.appTransitionStarting(startTime,duration);
  }
  if (mIconPolicy != null) {
    mIconPolicy.appTransitionStarting(startTime,duration);
  }
}
Program: 193681
Project: 193681
Buggy source:
public void setIconsDark(boolean dark){
  if (mTransitionPending) {
    deferIconTintChange(dark ? 1.0f : 0.0f);
  }
 else   if (mTransitionDeferring) {
    animateIconTint(dark ? 1.0f : 0.0f,Math.max(0,mTransitionDeferringStartTime - SystemClock.uptimeMillis()),mTransitionDeferringDuration);
  }
 else {
    animateIconTint(dark ? 1.0f : 0.0f,0,DEFAULT_TINT_ANIMATION_DURATION);
  }
}

Fixed version (ground truth):
public void setIconsDark(boolean dark,boolean animate){
  if (!animate) {
    setIconTintInternal(dark ? 1.0f : 0.0f);
  }
 else   if (mTransitionPending) {
    deferIconTintChange(dark ? 1.0f : 0.0f);
  }
 else   if (mTransitionDeferring) {
    animateIconTint(dark ? 1.0f : 0.0f,Math.max(0,mTransitionDeferringStartTime - SystemClock.uptimeMillis()),mTransitionDeferringDuration);
  }
 else {
    animateIconTint(dark ? 1.0f : 0.0f,0,DEFAULT_TINT_ANIMATION_DURATION);
  }
}