nus-yam/ex-repair huggingface dataset:
Program: 182102
Project: 182102
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MESSAGE_ENABLE_WIFI:
    if (mWifiWatchdogService == null) {
      mWifiWatchdogService=new WifiWatchdogService(mContext,mWifiStateTracker);
    }
  setWifiEnabledBlocking(true,msg.arg1 == 1,msg.arg2);
sWakeLock.release();
break;
case MESSAGE_START_WIFI:
mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0);
mWifiStateTracker.restart();
sWakeLock.release();
break;
case MESSAGE_UPDATE_STATE:
doUpdateWifiState();
break;
case MESSAGE_DISABLE_WIFI:
setWifiEnabledBlocking(false,msg.arg1 == 1,msg.arg2);
if (mWifiWatchdogService != null) {
mWifiWatchdogService.quit();
mWifiWatchdogService=null;
}
sWakeLock.release();
break;
case MESSAGE_STOP_WIFI:
mWifiStateTracker.disconnectAndStop();
break;
case MESSAGE_RELEASE_WAKELOCK:
synchronized (sDriverStopWakeLock) {
if (sDriverStopWakeLock.isHeld()) {
sDriverStopWakeLock.release();
}
}
break;
case MESSAGE_START_ACCESS_POINT:
setWifiApEnabledBlocking(true,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
case MESSAGE_STOP_ACCESS_POINT:
setWifiApEnabledBlocking(false,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MESSAGE_ENABLE_WIFI:
    if (mWifiWatchdogService == null) {
      mWifiWatchdogService=new WifiWatchdogService(mContext,mWifiStateTracker);
    }
  setWifiEnabledBlocking(true,msg.arg1 == 1,msg.arg2);
sWakeLock.release();
break;
case MESSAGE_START_WIFI:
mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0);
mWifiStateTracker.restart();
sWakeLock.release();
break;
case MESSAGE_UPDATE_STATE:
doUpdateWifiState();
break;
case MESSAGE_DISABLE_WIFI:
setWifiEnabledBlocking(false,msg.arg1 == 1,msg.arg2);
if (mWifiWatchdogService != null) {
mWifiWatchdogService.quit();
mWifiWatchdogService=null;
}
sWakeLock.release();
break;
case MESSAGE_STOP_WIFI:
mWifiStateTracker.disconnectAndStop();
break;
case MESSAGE_RELEASE_WAKELOCK:
sDriverStopWakeLock.release();
break;
case MESSAGE_START_ACCESS_POINT:
setWifiApEnabledBlocking(true,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
case MESSAGE_STOP_ACCESS_POINT:
setWifiApEnabledBlocking(false,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
}
}
Program: 182103
Project: 182103
Buggy source:
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return stopDriver();
    }
 else {
      return disconnect();
    }
  }
 else {
    releaseWakeLock();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return stopDriver();
    }
 else {
      return disconnect();
    }
  }
  return true;
}
Program: 182104
Project: 182104
Buggy source:
private synchronized boolean isDriverStopped(){
  return mRunState == RUN_STATE_STOPPED || mRunState == RUN_STATE_STOPPING;
}

Fixed version (ground truth):
/** 
 * TODO: mRunState is not synchronized in some places address this as part of re-architect. TODO: We are exposing an additional public synchronized call for a wakelock optimization in WifiService. Remove it when we handle the wakelock in ConnectivityService.
 */
public synchronized boolean isDriverStopped(){
  return mRunState == RUN_STATE_STOPPED || mRunState == RUN_STATE_STOPPING;
}
Program: 182105
Project: 182105
Buggy source:
@Override public void releaseWakeLock(){
  if (mReleaseWakeLockCallback != null) {
    mReleaseWakeLockCallback.run();
  }
}

Fixed version (ground truth):
/** 
 * We release the wakelock in WifiService using a timer. TODO: Releasing wakelock using both timer and a call from ConnectivityService requires a rethink. We had problems where WifiService could keep a wakelock forever if we delete messages in the asynchronous call from ConnectivityService
 */
@Override public void releaseWakeLock(){
}
Program: 182107
Project: 182107
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurfaceShown=true;
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 182109
Project: 182109
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
  mDimShown=true;
  try {
    mDimSurface.setPosition(0,0);
    mDimSurface.setSize(dw,dh);
    mDimSurface.show();
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 182110
Project: 182110
Buggy source:
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}

Fixed version (ground truth):
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    mSurfaceShown=false;
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}
Program: 182114
Project: 182114
Buggy source:
private void doUpdateWifiState(){
  boolean wifiEnabled=getPersistedWifiEnabled();
  boolean airplaneMode=isAirplaneModeOn() && !mAirplaneModeOverwridden;
  boolean lockHeld=mLocks.hasLocks();
  int strongestLockMode;
  boolean wifiShouldBeEnabled=wifiEnabled && !airplaneMode;
  boolean wifiShouldBeStarted=!mDeviceIdle || lockHeld;
  if (mDeviceIdle && lockHeld) {
    strongestLockMode=mLocks.getStrongestLockMode();
  }
 else {
    strongestLockMode=WifiManager.WIFI_MODE_FULL;
  }
synchronized (mWifiHandler) {
    if ((mWifiStateTracker.getWifiState() == WIFI_STATE_ENABLING) && !airplaneMode) {
      return;
    }
    if (wifiShouldBeEnabled) {
      if (wifiShouldBeStarted) {
        sWakeLock.acquire();
        sendEnableMessage(true,false,mLastEnableUid);
        sWakeLock.acquire();
        sendStartMessage(strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
      }
 else {
        int wakeLockTimeout=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,DEFAULT_WAKELOCK_TIMEOUT);
        sDriverStopWakeLock.acquire();
        mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI);
        mWifiHandler.sendEmptyMessageDelayed(MESSAGE_RELEASE_WAKELOCK,wakeLockTimeout);
      }
    }
 else {
      sWakeLock.acquire();
      sendEnableMessage(false,false,mLastEnableUid);
    }
  }
}

Fixed version (ground truth):
private void doUpdateWifiState(){
  boolean wifiEnabled=getPersistedWifiEnabled();
  boolean airplaneMode=isAirplaneModeOn() && !mAirplaneModeOverwridden;
  boolean lockHeld=mLocks.hasLocks();
  int strongestLockMode;
  boolean wifiShouldBeEnabled=wifiEnabled && !airplaneMode;
  boolean wifiShouldBeStarted=!mDeviceIdle || lockHeld;
  if (mDeviceIdle && lockHeld) {
    strongestLockMode=mLocks.getStrongestLockMode();
  }
 else {
    strongestLockMode=WifiManager.WIFI_MODE_FULL;
  }
synchronized (mWifiHandler) {
    if ((mWifiStateTracker.getWifiState() == WIFI_STATE_ENABLING) && !airplaneMode) {
      return;
    }
    if (wifiShouldBeEnabled) {
      if (wifiShouldBeStarted) {
        sWakeLock.acquire();
        sendEnableMessage(true,false,mLastEnableUid);
        sWakeLock.acquire();
        sendStartMessage(strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
      }
 else       if (!mWifiStateTracker.isDriverStopped()) {
        int wakeLockTimeout=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,DEFAULT_WAKELOCK_TIMEOUT);
        sDriverStopWakeLock.acquire();
        mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI);
        mWifiHandler.sendEmptyMessageDelayed(MESSAGE_RELEASE_WAKELOCK,wakeLockTimeout);
      }
    }
 else {
      sWakeLock.acquire();
      sendEnableMessage(false,false,mLastEnableUid);
    }
  }
}
Program: 182115
Project: 182115
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MESSAGE_ENABLE_WIFI:
    if (mWifiWatchdogService == null) {
      mWifiWatchdogService=new WifiWatchdogService(mContext,mWifiStateTracker);
    }
  setWifiEnabledBlocking(true,msg.arg1 == 1,msg.arg2);
sWakeLock.release();
break;
case MESSAGE_START_WIFI:
mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0);
mWifiStateTracker.restart();
sWakeLock.release();
break;
case MESSAGE_UPDATE_STATE:
doUpdateWifiState();
break;
case MESSAGE_DISABLE_WIFI:
setWifiEnabledBlocking(false,msg.arg1 == 1,msg.arg2);
if (mWifiWatchdogService != null) {
mWifiWatchdogService.quit();
mWifiWatchdogService=null;
}
sWakeLock.release();
break;
case MESSAGE_STOP_WIFI:
mWifiStateTracker.disconnectAndStop();
break;
case MESSAGE_RELEASE_WAKELOCK:
synchronized (sDriverStopWakeLock) {
if (sDriverStopWakeLock.isHeld()) {
sDriverStopWakeLock.release();
}
}
break;
case MESSAGE_START_ACCESS_POINT:
setWifiApEnabledBlocking(true,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
case MESSAGE_STOP_ACCESS_POINT:
setWifiApEnabledBlocking(false,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MESSAGE_ENABLE_WIFI:
    if (mWifiWatchdogService == null) {
      mWifiWatchdogService=new WifiWatchdogService(mContext,mWifiStateTracker);
    }
  setWifiEnabledBlocking(true,msg.arg1 == 1,msg.arg2);
sWakeLock.release();
break;
case MESSAGE_START_WIFI:
mWifiStateTracker.setScanOnlyMode(msg.arg1 != 0);
mWifiStateTracker.restart();
sWakeLock.release();
break;
case MESSAGE_UPDATE_STATE:
doUpdateWifiState();
break;
case MESSAGE_DISABLE_WIFI:
setWifiEnabledBlocking(false,msg.arg1 == 1,msg.arg2);
if (mWifiWatchdogService != null) {
mWifiWatchdogService.quit();
mWifiWatchdogService=null;
}
sWakeLock.release();
break;
case MESSAGE_STOP_WIFI:
mWifiStateTracker.disconnectAndStop();
break;
case MESSAGE_RELEASE_WAKELOCK:
sDriverStopWakeLock.release();
break;
case MESSAGE_START_ACCESS_POINT:
setWifiApEnabledBlocking(true,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
case MESSAGE_STOP_ACCESS_POINT:
setWifiApEnabledBlocking(false,msg.arg1,(WifiConfiguration)msg.obj);
sWakeLock.release();
break;
}
}
Program: 182116
Project: 182116
Buggy source:
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return stopDriver();
    }
 else {
      return disconnect();
    }
  }
 else {
    releaseWakeLock();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return stopDriver();
    }
 else {
      return disconnect();
    }
  }
  return true;
}
Program: 182117
Project: 182117
Buggy source:
private synchronized boolean isDriverStopped(){
  return mRunState == RUN_STATE_STOPPED || mRunState == RUN_STATE_STOPPING;
}

Fixed version (ground truth):
/** 
 * TODO: mRunState is not synchronized in some places address this as part of re-architect. TODO: We are exposing an additional public synchronized call for a wakelock optimization in WifiService. Remove it when we handle the wakelock in ConnectivityService.
 */
public synchronized boolean isDriverStopped(){
  return mRunState == RUN_STATE_STOPPED || mRunState == RUN_STATE_STOPPING;
}
Program: 182118
Project: 182118
Buggy source:
@Override public void releaseWakeLock(){
  if (mReleaseWakeLockCallback != null) {
    mReleaseWakeLockCallback.run();
  }
}

Fixed version (ground truth):
/** 
 * We release the wakelock in WifiService using a timer. TODO: Releasing wakelock using both timer and a call from ConnectivityService requires a rethink. We had problems where WifiService could keep a wakelock forever if we delete messages in the asynchronous call from ConnectivityService
 */
@Override public void releaseWakeLock(){
}
Program: 182120
Project: 182120
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,getScrollRange(),0,0)) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182121
Project: 182121
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollX=mScrollX;
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() - scrollX || x >= child.getRight() - scrollX);
  }
  return false;
}
Program: 182123
Project: 182123
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,0,0,getScrollRange())) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182124
Project: 182124
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollY=mScrollY;
    final View child=getChildAt(0);
    return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}
Program: 182125
Project: 182125
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182126
Project: 182126
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182127
Project: 182127
Buggy source:
public void onBootCompleted(){
  mBootCompleted=true;
  if (mReadyToRunLatch != null) {
    mReadyToRunLatch.countDown();
  }
}

Fixed version (ground truth):
public void onBootCompleted(){
  mBootCompleted=true;
  mSyncStorageEngine.doDatabaseCleanup(AccountManager.get(mContext).getAccounts());
  if (mReadyToRunLatch != null) {
    mReadyToRunLatch.countDown();
  }
}
Program: 182128
Project: 182128
Buggy source:
public void onAccountsUpdated(Account[] accounts){
  final boolean justBootedUp=mAccounts == INITIAL_ACCOUNTS_ARRAY;
  mAccounts=accounts;
  ActiveSyncContext activeSyncContext=mActiveSyncContext;
  if (activeSyncContext != null) {
    if (!ArrayUtils.contains(accounts,activeSyncContext.mSyncOperation.account)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(activeSyncContext,null);
    }
  }
  sendCheckAlarmsMessage();
  mSyncStorageEngine.doDatabaseCleanup(accounts);
  if (accounts.length > 0) {
    boolean onlyThoseWithUnkownSyncableState=justBootedUp;
    scheduleSync(null,null,null,0,onlyThoseWithUnkownSyncableState);
  }
}

Fixed version (ground truth):
public void onAccountsUpdated(Account[] accounts){
  final boolean justBootedUp=mAccounts == INITIAL_ACCOUNTS_ARRAY;
  mAccounts=accounts;
  ActiveSyncContext activeSyncContext=mActiveSyncContext;
  if (activeSyncContext != null) {
    if (!ArrayUtils.contains(accounts,activeSyncContext.mSyncOperation.account)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(activeSyncContext,null);
    }
  }
  sendCheckAlarmsMessage();
  if (mBootCompleted) {
    mSyncStorageEngine.doDatabaseCleanup(accounts);
  }
  if (accounts.length > 0) {
    boolean onlyThoseWithUnkownSyncableState=justBootedUp;
    scheduleSync(null,null,null,0,onlyThoseWithUnkownSyncableState);
  }
}
Program: 182132
Project: 182132
Buggy source:
private void removeAuthorityLocked(Account account,String authorityName){
  AccountInfo accountInfo=mAccounts.get(account);
  if (accountInfo != null) {
    if (accountInfo.authorities.remove(authorityName) != null) {
      writeAccountInfoLocked();
    }
  }
}

Fixed version (ground truth):
private void removeAuthorityLocked(Account account,String authorityName){
  AccountInfo accountInfo=mAccounts.get(account);
  if (accountInfo != null) {
    final AuthorityInfo authorityInfo=accountInfo.authorities.remove(authorityName);
    if (authorityInfo != null) {
      mAuthorities.remove(authorityInfo.ident);
      writeAccountInfoLocked();
    }
  }
}
Program: 182135
Project: 182135
Buggy source:
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(0).getId());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    int i=enabled.size();
    while (i > 0) {
      i--;
      if ((enabled.get(i).getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        break;
      }
    }
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(i).getId());
    return true;
  }
  return false;
}
Program: 182136
Project: 182136
Buggy source:
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabled(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}

Fixed version (ground truth):
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabledLocked(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}
Program: 182137
Project: 182137
Buggy source:
private void installDecor(){
  if (mDecor == null) {
    mDecor=generateDecor();
    mDecor.setIsRootNamespace(true);
  }
  if (mContentParent == null) {
    mContentParent=generateLayout(mDecor);
    mTitleView=(TextView)findViewById(com.android.internal.R.id.title);
    if (mTitleView != null) {
      if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
        View titleContainer=findViewById(com.android.internal.R.id.title_container);
        if (titleContainer != null) {
          titleContainer.setVisibility(View.GONE);
        }
 else {
          mTitleView.setVisibility(View.GONE);
        }
        if (mContentParent instanceof FrameLayout) {
          ((FrameLayout)mContentParent).setForeground(null);
        }
      }
 else {
        mTitleView.setText(mTitle);
      }
    }
  }
}

Fixed version (ground truth):
private void installDecor(){
  if (mDecor == null) {
    mDecor=generateDecor();
    mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    mDecor.setIsRootNamespace(true);
  }
  if (mContentParent == null) {
    mContentParent=generateLayout(mDecor);
    mTitleView=(TextView)findViewById(com.android.internal.R.id.title);
    if (mTitleView != null) {
      if ((getLocalFeatures() & (1 << FEATURE_NO_TITLE)) != 0) {
        View titleContainer=findViewById(com.android.internal.R.id.title_container);
        if (titleContainer != null) {
          titleContainer.setVisibility(View.GONE);
        }
 else {
          mTitleView.setVisibility(View.GONE);
        }
        if (mContentParent instanceof FrameLayout) {
          ((FrameLayout)mContentParent).setForeground(null);
        }
      }
 else {
        mTitleView.setText(mTitle);
      }
    }
  }
}
Program: 182138
Project: 182138
Buggy source:
public void onBootCompleted(){
  mBootCompleted=true;
  if (mReadyToRunLatch != null) {
    mReadyToRunLatch.countDown();
  }
}

Fixed version (ground truth):
public void onBootCompleted(){
  mBootCompleted=true;
  mSyncStorageEngine.doDatabaseCleanup(AccountManager.get(mContext).getAccounts());
  if (mReadyToRunLatch != null) {
    mReadyToRunLatch.countDown();
  }
}
Program: 182139
Project: 182139
Buggy source:
public void onAccountsUpdated(Account[] accounts){
  final boolean justBootedUp=mAccounts == INITIAL_ACCOUNTS_ARRAY;
  mAccounts=accounts;
  ActiveSyncContext activeSyncContext=mActiveSyncContext;
  if (activeSyncContext != null) {
    if (!ArrayUtils.contains(accounts,activeSyncContext.mSyncOperation.account)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(activeSyncContext,null);
    }
  }
  sendCheckAlarmsMessage();
  mSyncStorageEngine.doDatabaseCleanup(accounts);
  if (accounts.length > 0) {
    boolean onlyThoseWithUnkownSyncableState=justBootedUp;
    scheduleSync(null,null,null,0,onlyThoseWithUnkownSyncableState);
  }
}

Fixed version (ground truth):
public void onAccountsUpdated(Account[] accounts){
  final boolean justBootedUp=mAccounts == INITIAL_ACCOUNTS_ARRAY;
  mAccounts=accounts;
  ActiveSyncContext activeSyncContext=mActiveSyncContext;
  if (activeSyncContext != null) {
    if (!ArrayUtils.contains(accounts,activeSyncContext.mSyncOperation.account)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(activeSyncContext,null);
    }
  }
  sendCheckAlarmsMessage();
  if (mBootCompleted) {
    mSyncStorageEngine.doDatabaseCleanup(accounts);
  }
  if (accounts.length > 0) {
    boolean onlyThoseWithUnkownSyncableState=justBootedUp;
    scheduleSync(null,null,null,0,onlyThoseWithUnkownSyncableState);
  }
}
Program: 182143
Project: 182143
Buggy source:
private void removeAuthorityLocked(Account account,String authorityName){
  AccountInfo accountInfo=mAccounts.get(account);
  if (accountInfo != null) {
    if (accountInfo.authorities.remove(authorityName) != null) {
      writeAccountInfoLocked();
    }
  }
}

Fixed version (ground truth):
private void removeAuthorityLocked(Account account,String authorityName){
  AccountInfo accountInfo=mAccounts.get(account);
  if (accountInfo != null) {
    final AuthorityInfo authorityInfo=accountInfo.authorities.remove(authorityName);
    if (authorityInfo != null) {
      mAuthorities.remove(authorityInfo.ident);
      writeAccountInfoLocked();
    }
  }
}
Program: 182146
Project: 182146
Buggy source:
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN && mPopup != null && mPopup.isShowing()) {
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    showDropDown();
  }
  return false;
}

Fixed version (ground truth):
public boolean onTouch(View v,MotionEvent event){
  final int action=event.getAction();
  if (action == MotionEvent.ACTION_DOWN && mPopup != null && mPopup.isShowing()) {
    postDelayed(mResizePopupRunnable,EXPAND_LIST_TIMEOUT);
  }
 else   if (action == MotionEvent.ACTION_UP) {
    removeCallbacks(mResizePopupRunnable);
  }
  return false;
}
Program: 182147
Project: 182147
Buggy source:
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if (format == null || "String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    return new SimpleDateFormat(format);
  }
}

Fixed version (ground truth):
private DateFormat getDateFormat(){
  String format=Settings.System.getString(getContext().getContentResolver(),Settings.System.DATE_FORMAT);
  if (format == null || "String_Node_Str".equals(format)) {
    return DateFormat.getDateInstance(DateFormat.SHORT);
  }
 else {
    try {
      return new SimpleDateFormat(format);
    }
 catch (    IllegalArgumentException e) {
      return DateFormat.getDateInstance(DateFormat.SHORT);
    }
  }
}
Program: 182148
Project: 182148
Buggy source:
void scaleAll(){
  for (  ChildView v : mChildren) {
    v.mView.setLayoutParams(computeLayout(v));
  }
}

Fixed version (ground truth):
void scaleAll(){
  for (  ChildView v : mChildren) {
    requestLayout(v);
  }
}
Program: 182149
Project: 182149
Buggy source:
void attachView(int x,int y,int width,int height){
  if (mView == null) {
    return;
  }
  setBounds(x,y,width,height);
  mWebView.mPrivateHandler.post(new Runnable(){
    public void run(){
      AbsoluteLayout.LayoutParams lp=computeLayout(ChildView.this);
      if (mView.getParent() != null) {
        mView.setLayoutParams(lp);
      }
 else {
        attachViewOnUIThread(lp);
      }
    }
  }
);
}

Fixed version (ground truth):
void attachView(int x,int y,int width,int height){
  if (mView == null) {
    return;
  }
  setBounds(x,y,width,height);
  mWebView.mPrivateHandler.post(new Runnable(){
    public void run(){
      requestLayout(ChildView.this);
      if (mView.getParent() == null) {
        attachViewOnUIThread();
      }
    }
  }
);
}
Program: 182150
Project: 182150
Buggy source:
private void attachViewOnUIThread(AbsoluteLayout.LayoutParams lp){
  mWebView.addView(mView,lp);
  mChildren.add(this);
  if (!mReadyToDraw) {
    mView.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
private void attachViewOnUIThread(){
  mWebView.addView(mView);
  mChildren.add(this);
  if (!mReadyToDraw) {
    mView.setVisibility(View.GONE);
  }
}
Program: 182151
Project: 182151
Buggy source:
public boolean onScaleBegin(ScaleGestureDetector detector){
  cancelTouch();
  dismissZoomControl();
  mInZoomOverview=false;
  if (inEditingMode() && nativeFocusCandidateIsPassword()) {
    mWebTextView.setInPassword(false);
  }
  return true;
}

Fixed version (ground truth):
public boolean onScaleBegin(ScaleGestureDetector detector){
  cancelTouch();
  dismissZoomControl();
  mInZoomOverview=false;
  if (inEditingMode() && nativeFocusCandidateIsPassword()) {
    mWebTextView.setInPassword(false);
  }
  mViewManager.startZoom();
  return true;
}
Program: 182152
Project: 182152
Buggy source:
public void onScaleEnd(ScaleGestureDetector detector){
  if (mPreviewZoomOnly) {
    mPreviewZoomOnly=false;
    mAnchorX=viewToContentX((int)mZoomCenterX + mScrollX);
    mAnchorY=viewToContentY((int)mZoomCenterY + mScrollY);
    boolean reflowNow=(mActualScale - mMinZoomScale <= MINIMUM_SCALE_INCREMENT) || ((mActualScale <= 0.8 * mTextWrapScale));
    setNewZoomScale(mActualScale,reflowNow,true);
    invalidate();
  }
  if (inEditingMode() && didUpdateTextViewBounds(false) && nativeFocusCandidateIsPassword()) {
    mWebTextView.setInPassword(true);
  }
  mTouchMode=TOUCH_PINCH_DRAG;
  mConfirmMove=true;
  startTouch(detector.getFocusX(),detector.getFocusY(),mLastTouchTime);
}

Fixed version (ground truth):
public void onScaleEnd(ScaleGestureDetector detector){
  if (mPreviewZoomOnly) {
    mPreviewZoomOnly=false;
    mAnchorX=viewToContentX((int)mZoomCenterX + mScrollX);
    mAnchorY=viewToContentY((int)mZoomCenterY + mScrollY);
    boolean reflowNow=(mActualScale - mMinZoomScale <= MINIMUM_SCALE_INCREMENT) || ((mActualScale <= 0.8 * mTextWrapScale));
    setNewZoomScale(mActualScale,reflowNow,true);
    invalidate();
  }
  if (inEditingMode() && didUpdateTextViewBounds(false) && nativeFocusCandidateIsPassword()) {
    mWebTextView.setInPassword(true);
  }
  mTouchMode=TOUCH_PINCH_DRAG;
  mConfirmMove=true;
  startTouch(detector.getFocusX(),detector.getFocusY(),mLastTouchTime);
  mViewManager.endZoom();
}
Program: 182154
Project: 182154
Buggy source:
public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN && mPopup != null && mPopup.isShowing()) {
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    showDropDown();
  }
  return false;
}

Fixed version (ground truth):
public boolean onTouch(View v,MotionEvent event){
  final int action=event.getAction();
  if (action == MotionEvent.ACTION_DOWN && mPopup != null && mPopup.isShowing()) {
    postDelayed(mResizePopupRunnable,EXPAND_LIST_TIMEOUT);
  }
 else   if (action == MotionEvent.ACTION_UP) {
    removeCallbacks(mResizePopupRunnable);
  }
  return false;
}
Program: 182157
Project: 182157
Buggy source:
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
public void fling(int velocityY){
  if (getChildCount() > 0) {
    int height=getHeight() - mPaddingBottom - mPaddingTop;
    int bottom=getChildAt(0).getHeight();
    mScroller.fling(mScrollX,mScrollY,0,velocityY,0,0,0,Math.max(0,bottom - height),0,height / 2);
    final boolean movingDown=velocityY > 0;
    View newFocused=findFocusableViewInMyBounds(movingDown,mScroller.getFinalY(),findFocus());
    if (newFocused == null) {
      newFocused=this;
    }
    if (newFocused != findFocus() && newFocused.requestFocus(movingDown ? View.FOCUS_DOWN : View.FOCUS_UP)) {
      mScrollViewMovedFocus=true;
      mScrollViewMovedFocus=false;
    }
    awakenScrollBars(mScroller.getDuration());
    invalidate();
  }
}

Fixed version (ground truth):
/** 
 * Fling the scroll view
 * @param velocityY The initial velocity in the Y direction. Positivenumbers mean that the finger/cursor is moving down the screen, which means we want to scroll towards the top.
 */
public void fling(int velocityY){
  if (getChildCount() > 0) {
    int height=getHeight() - mPaddingBottom - mPaddingTop;
    int bottom=getChildAt(0).getHeight();
    mScroller.fling(mScrollX,mScrollY,0,velocityY,0,0,0,Math.max(0,bottom - height),0,height / 2);
    final boolean movingDown=velocityY > 0;
    View newFocused=findFocusableViewInMyBounds(movingDown,mScroller.getFinalY(),findFocus());
    if (newFocused == null) {
      newFocused=this;
    }
    if (newFocused != findFocus() && newFocused.requestFocus(movingDown ? View.FOCUS_DOWN : View.FOCUS_UP)) {
      mScrollViewMovedFocus=true;
      mScrollViewMovedFocus=false;
    }
    invalidate();
  }
}
Program: 182158
Project: 182158
Buggy source:
@Override protected void onOverscrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    mScrollX=scrollX;
    mScrollY=scrollY;
    if (clampedY) {
      mScroller.springback(mScrollX,mScrollY,0,0,0,getScrollRange());
    }
  }
 else {
    super.scrollTo(scrollX,scrollY);
  }
}

Fixed version (ground truth):
@Override protected void onOverscrolled(int scrollX,int scrollY,boolean clampedX,boolean clampedY){
  if (!mScroller.isFinished()) {
    mScrollX=scrollX;
    mScrollY=scrollY;
    if (clampedY) {
      mScroller.springback(mScrollX,mScrollY,0,0,0,getScrollRange());
    }
  }
 else {
    super.scrollTo(scrollX,scrollY);
  }
  awakenScrollBars();
}
Program: 182160
Project: 182160
Buggy source:
public void copyFrom(PackageSettingBase base){
  grantedPermissions=base.grantedPermissions;
  gids=base.gids;
  timeStamp=base.timeStamp;
  timeStampString=base.timeStampString;
  signatures=base.signatures;
  permissionsFixed=base.permissionsFixed;
  disabledComponents=base.disabledComponents;
  enabledComponents=base.enabledComponents;
  enabled=base.enabled;
  installStatus=base.installStatus;
}

Fixed version (ground truth):
public void copyFrom(PackageSettingBase base){
  grantedPermissions=base.grantedPermissions;
  gids=base.gids;
  timeStamp=base.timeStamp;
  timeStampString=base.timeStampString;
  signatures=base.signatures;
  permissionsFixed=base.permissionsFixed;
  haveGids=base.haveGids;
  disabledComponents=base.disabledComponents;
  enabledComponents=base.enabledComponents;
  enabled=base.enabled;
  installStatus=base.installStatus;
}