nus-yam/ex-repair huggingface dataset:
Program: 42797
Project: 42797
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 42798
Project: 42798
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 42799
Project: 42799
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 42800
Project: 42800
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 42801
Project: 42801
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 42802
Project: 42802
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 42803
Project: 42803
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 42804
Project: 42804
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 42805
Project: 42805
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 42806
Project: 42806
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 42807
Project: 42807
Buggy source:
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}

Fixed version (ground truth):
public void executeMessage(Message message){
switch (message.what) {
case DO_ATTACH:
{
      try {
        mConnection.attachEngine(this);
      }
 catch (      RemoteException e) {
        Log.w(TAG,"String_Node_Str",e);
        return;
      }
      Engine engine=onCreateEngine();
      mEngine=engine;
      mActiveEngines.add(engine);
      engine.attach(this);
      return;
    }
case DO_DETACH:
{
    mActiveEngines.remove(mEngine);
    mEngine.detach();
    return;
  }
case DO_SET_DESIRED_SIZE:
{
  mEngine.doDesiredSizeChanged(message.arg1,message.arg2);
  return;
}
case MSG_UPDATE_SURFACE:
mEngine.updateSurface(true,false);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG,"String_Node_Str" + mEngine + "String_Node_Str"+ message.arg1);
mEngine.doVisibilityChanged(message.arg1 != 0);
break;
case MSG_WALLPAPER_OFFSETS:
{
mEngine.doOffsetsChanged();
}
break;
case MSG_WALLPAPER_COMMAND:
{
WallpaperCommand cmd=(WallpaperCommand)message.obj;
mEngine.doCommand(cmd);
}
break;
case MSG_WINDOW_RESIZED:
{
final boolean reportDraw=message.arg1 != 0;
mEngine.updateSurface(true,false);
if (reportDraw) {
try {
mEngine.mSession.finishDrawing(mEngine.mWindow);
}
 catch (RemoteException e) {
}
}
}
break;
case MSG_TOUCH_EVENT:
{
MotionEvent ev=(MotionEvent)message.obj;
synchronized (mEngine.mLock) {
if (mEngine.mPendingMove == ev) {
mEngine.mPendingMove=null;
}
}
if (DEBUG) Log.v(TAG,"String_Node_Str" + ev);
mEngine.onTouchEvent(ev);
ev.recycle();
}
break;
default :
Log.w(TAG,"String_Node_Str" + message.what);
}
}
Program: 42808
Project: 42808
Buggy source:
/** 
 * Called once to initialize the engine.  After returning, the engine's surface will be created by the framework.
 */
public void onCreate(SurfaceHolder surfaceHolder){
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
}
Program: 42809
Project: 42809
Buggy source:
/** 
 * Called right before the engine is going away.  After this the surface will be destroyed and this Engine object is no longer valid.
 */
public void onDestroy(){
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (int i=0; i < mActiveEngines.size(); i++) {
    mActiveEngines.get(i).detach();
  }
  mActiveEngines.clear();
}
Program: 42810
Project: 42810
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 42811
Project: 42811
Buggy source:
void detach(){
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}

Fixed version (ground truth):
void detach(){
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  if (mVisible) {
    mVisible=false;
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + this);
    onVisibilityChanged(false);
  }
  if (mDestroyReportNeeded) {
    mDestroyReportNeeded=false;
    SurfaceHolder.Callback callbacks[];
synchronized (mSurfaceHolder.mCallbacks) {
      callbacks=new SurfaceHolder.Callback[mSurfaceHolder.mCallbacks.size()];
      mSurfaceHolder.mCallbacks.toArray(callbacks);
    }
    for (    SurfaceHolder.Callback c : callbacks) {
      c.surfaceDestroyed(mSurfaceHolder);
    }
    if (DEBUG)     Log.v(TAG,"String_Node_Str" + mSurfaceHolder + "String_Node_Str"+ this);
    onSurfaceDestroyed(mSurfaceHolder);
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + this);
  onDestroy();
  unregisterReceiver(mReceiver);
  if (mCreated) {
    try {
      mSession.remove(mWindow);
    }
 catch (    RemoteException e) {
    }
    mSurfaceHolder.mSurface.release();
    mCreated=false;
  }
}
Program: 42812
Project: 42812
Buggy source:
private synchronized final void sendIntent(){
  Intent intent=new Intent(Intent.ACTION_HEADSET_PLUG);
  intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
  int state=0;
  int microphone=0;
  if ((mHeadsetState & BIT_HEADSET) != (mPrevHeadsetState & BIT_HEADSET)) {
    microphone=1;
    if ((mHeadsetState & BIT_HEADSET) != 0) {
      state=1;
    }
  }
 else   if ((mHeadsetState & BIT_HEADSET_NO_MIC) != (mPrevHeadsetState & BIT_HEADSET_NO_MIC)) {
    if ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0) {
      state=1;
    }
  }
  intent.putExtra("String_Node_Str",state);
  intent.putExtra("String_Node_Str",mHeadsetName);
  intent.putExtra("String_Node_Str",microphone);
  ActivityManagerNative.broadcastStickyIntent(intent,null);
}

Fixed version (ground truth):
private final void sendIntent(int headset){
  if ((mHeadsetState & headset) != (mPrevHeadsetState & headset)) {
    Intent intent=new Intent(Intent.ACTION_HEADSET_PLUG);
    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
    int state=0;
    int microphone=0;
    if ((headset & HEADSETS_WITH_MIC) != 0) {
      microphone=1;
    }
    if ((mHeadsetState & headset) != 0) {
      state=1;
    }
    intent.putExtra("String_Node_Str",state);
    intent.putExtra("String_Node_Str",mHeadsetName);
    intent.putExtra("String_Node_Str",microphone);
    if (LOG)     Log.v(TAG,"String_Node_Str" + state + "String_Node_Str"+ mHeadsetName+ "String_Node_Str"+ microphone);
    ActivityManagerNative.broadcastStickyIntent(intent,null);
  }
}
Program: 42813
Project: 42813
Buggy source:
@Override public void handleMessage(Message msg){
  if (mPendingIntent) {
    sendIntent();
    mPendingIntent=false;
  }
  mWakeLock.release();
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (mPendingIntent) {
    sendIntents();
    mPendingIntent=false;
  }
  mWakeLock.release();
}
Program: 42814
Project: 42814
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & (BIT_HEADSET | BIT_HEADSET_NO_MIC);
  if (headsetState != mHeadsetState) {
    boolean isUnplug=false;
    if (((mHeadsetState & BIT_HEADSET) != 0 && (headsetState & BIT_HEADSET) == 0) || ((mHeadsetState & BIT_HEADSET_NO_MIC) != 0 && (headsetState & BIT_HEADSET_NO_MIC) == 0)) {
      isUnplug=true;
    }
    mHeadsetName=newName;
    mPrevHeadsetState=mHeadsetState;
    mHeadsetState=headsetState;
    mPendingIntent=true;
    if (isUnplug) {
      Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
      mContext.sendBroadcast(intent);
      mWakeLock.acquire();
      mHandler.sendEmptyMessageDelayed(0,1000);
    }
 else {
      sendIntent();
      mPendingIntent=false;
    }
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  mPendingIntent=true;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendEmptyMessageDelayed(0,1000);
  }
 else {
    sendIntents();
    mPendingIntent=false;
  }
}
Program: 42815
Project: 42815
Buggy source:
public void appendAndroidSpecificProperty(final String mimeType,ContentValues contentValues){
  List<String> rawValueList=new ArrayList<String>();
  rawValueList.add(mimeType);
  final List<String> columnNameList;
  if (!sAllowedAndroidPropertySet.contains(mimeType)) {
    return;
  }
  for (int i=1; i <= VCardConstants.MAX_DATA_COLUMN; i++) {
    String value=contentValues.getAsString("String_Node_Str" + i);
    if (value == null) {
      value="String_Node_Str";
    }
    rawValueList.add(value);
  }
  appendLineWithCharsetAndQPDetection(VCardConstants.PROPERTY_X_ANDROID_CUSTOM,rawValueList);
}

Fixed version (ground truth):
public void appendAndroidSpecificProperty(final String mimeType,ContentValues contentValues){
  if (!sAllowedAndroidPropertySet.contains(mimeType)) {
    return;
  }
  final List<String> rawValueList=new ArrayList<String>();
  for (int i=1; i <= VCardConstants.MAX_DATA_COLUMN; i++) {
    String value=contentValues.getAsString("String_Node_Str" + i);
    if (value == null) {
      value="String_Node_Str";
    }
    rawValueList.add(value);
  }
  boolean needCharset=(mShouldAppendCharsetParam && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  mBuilder.append(VCardConstants.PROPERTY_X_ANDROID_CUSTOM);
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  if (reallyUseQuotedPrintable) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(VCARD_PARAM_ENCODING_QP);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  mBuilder.append(mimeType);
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (reallyUseQuotedPrintable) {
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}
Program: 42816
Project: 42816
Buggy source:
public void appendLine(final String propertyName,final List<String> parameterList,final List<String> rawValueList,final boolean needCharset,final boolean needQuotedPrintable){
  mBuilder.append(propertyName);
  if (parameterList != null && parameterList.size() > 0) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    appendTypeParameters(parameterList);
  }
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  boolean first=true;
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (needQuotedPrintable) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(VCARD_PARAM_ENCODING_QP);
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    if (first) {
      first=false;
    }
 else {
      mBuilder.append(VCARD_ITEM_SEPARATOR);
    }
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}

Fixed version (ground truth):
public void appendLine(final String propertyName,final List<String> parameterList,final List<String> rawValueList,final boolean needCharset,final boolean needQuotedPrintable){
  mBuilder.append(propertyName);
  if (parameterList != null && parameterList.size() > 0) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    appendTypeParameters(parameterList);
  }
  if (needCharset) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(mVCardCharsetParameter);
  }
  if (needQuotedPrintable) {
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(VCARD_PARAM_ENCODING_QP);
  }
  mBuilder.append(VCARD_DATA_SEPARATOR);
  boolean first=true;
  for (  String rawValue : rawValueList) {
    final String encodedValue;
    if (needQuotedPrintable) {
      encodedValue=encodeQuotedPrintable(rawValue);
    }
 else {
      encodedValue=escapeCharacters(rawValue);
    }
    if (first) {
      first=false;
    }
 else {
      mBuilder.append(VCARD_ITEM_SEPARATOR);
    }
    mBuilder.append(encodedValue);
  }
  mBuilder.append(VCARD_END_OF_LINE);
}
Program: 42817
Project: 42817
Buggy source:
public void appendLineWithCharsetAndQPDetection(final String propertyName,final List<String> parameterList,final List<String> rawValueList){
  boolean needCharset=false;
  boolean reallyUseQuotedPrintable=false;
  for (  String rawValue : rawValueList) {
    if (!needCharset && mShouldUseQuotedPrintable && !VCardUtils.containsOnlyPrintableAscii(rawValue)) {
      needCharset=true;
    }
    if (!reallyUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValue)) {
      reallyUseQuotedPrintable=true;
    }
    if (needCharset && reallyUseQuotedPrintable) {
      break;
    }
  }
  appendLine(propertyName,parameterList,rawValueList,needCharset,reallyUseQuotedPrintable);
}

Fixed version (ground truth):
public void appendLineWithCharsetAndQPDetection(final String propertyName,final List<String> parameterList,final List<String> rawValueList){
  boolean needCharset=(mShouldAppendCharsetParam && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(rawValueList));
  appendLine(propertyName,parameterList,rawValueList,needCharset,reallyUseQuotedPrintable);
}
Program: 42818
Project: 42818
Buggy source:
/** 
 * TODO: Merge detector and parser mode.
 */
public VCardParser_V21(int parseType){
  super(parseType);
  if (parseType == VCardConfig.PARSE_TYPE_FOMA) {
    mNestCount=1;
  }
}

Fixed version (ground truth):
public VCardParser_V21(int parseType){
  super(parseType);
  if (parseType == VCardConfig.PARSE_TYPE_FOMA) {
    mNestCount=1;
  }
}
Program: 42819
Project: 42819
Buggy source:
public static boolean containsOnlyPrintableAscii(final String... values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyPrintableAscii(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!((asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n')) {
        return false;
      }
    }
  }
  return true;
}
Program: 42820
Project: 42820
Buggy source:
/** 
 * This is useful since vCard 3.0 often requires the ("X-") properties and groups should contain only alphabets, digits, and hyphen. Note: It is already known some devices (wrongly) outputs properties with characters which should not be in the field. One example is "X-GOOGLE TALK". We accept such kind of input but must never output it unless the target is very specific to the device which is able to parse the malformed input. 
 */
public static boolean containsOnlyAlphaDigitHyphen(final String... values){
  if (values == null) {
    return true;
  }
  final int upperAlphabetFirst=0x41;
  final int upperAlphabetAfterLast=0x5b;
  final int lowerAlphabetFirst=0x61;
  final int lowerAlphabetAfterLast=0x7b;
  final int digitFirst=0x30;
  final int digitAfterLast=0x3A;
  final int hyphen='-';
  for (  final String str : values) {
    if (TextUtils.isEmpty(str)) {
      continue;
    }
    final int length=str.length();
    for (int i=0; i < length; i=str.offsetByCodePoints(i,1)) {
      int codepoint=str.codePointAt(i);
      if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) || (upperAlphabetFirst <= codepoint && codepoint < upperAlphabetAfterLast) || (digitFirst <= codepoint && codepoint < digitAfterLast)|| (codepoint == hyphen))) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyAlphaDigitHyphen(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int upperAlphabetFirst=0x41;
  final int upperAlphabetAfterLast=0x5b;
  final int lowerAlphabetFirst=0x61;
  final int lowerAlphabetAfterLast=0x7b;
  final int digitFirst=0x30;
  final int digitAfterLast=0x3A;
  final int hyphen='-';
  for (  final String str : values) {
    if (TextUtils.isEmpty(str)) {
      continue;
    }
    final int length=str.length();
    for (int i=0; i < length; i=str.offsetByCodePoints(i,1)) {
      int codepoint=str.codePointAt(i);
      if (!((lowerAlphabetFirst <= codepoint && codepoint < lowerAlphabetAfterLast) || (upperAlphabetFirst <= codepoint && codepoint < upperAlphabetAfterLast) || (digitFirst <= codepoint && codepoint < digitAfterLast)|| (codepoint == hyphen))) {
        return false;
      }
    }
  }
  return true;
}
Program: 42821
Project: 42821
Buggy source:
/** 
 * This is useful when checking the string should be encoded into quoted-printable or not, which is required by vCard 2.1. See the definition of "7bit" in vCard 2.1 spec for more information.
 */
public static boolean containsOnlyNonCrLfPrintableAscii(final String... values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!(asciiFirst <= c && c <= asciiLast)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public static boolean containsOnlyNonCrLfPrintableAscii(final Collection<String> values){
  if (values == null) {
    return true;
  }
  final int asciiFirst=0x20;
  final int asciiLast=0x7E;
  for (  final String value : values) {
    if (TextUtils.isEmpty(value)) {
      continue;
    }
    final int length=value.length();
    for (int i=0; i < length; i=value.offsetByCodePoints(i,1)) {
      final int c=value.codePointAt(i);
      if (!(asciiFirst <= c && c <= asciiLast)) {
        return false;
      }
    }
  }
  return true;
}
Program: 42822
Project: 42822
Buggy source:
public void testContainsOnlyNonCrLfPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(builder.toString()));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
}

Fixed version (ground truth):
public void testContainsOnlyNonCrLfPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii((List<String>)null));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii(builder.toString()));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
}
Program: 42823
Project: 42823
Buggy source:
public void testContainsOnlyAlphaDigitHyphen(){
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String[])null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  for (int i=0; i < 0x30; i++) {
    if (i == 0x2D) {
      continue;
    }
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x3A; i < 0x41; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x5B; i < 0x61; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x7B; i < 0x100; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
}

Fixed version (ground truth):
public void testContainsOnlyAlphaDigitHyphen(){
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((String[])null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen((List<String>)null));
  assertTrue(VCardUtils.containsOnlyAlphaDigitHyphen("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyNonCrLfPrintableAscii("String_Node_Str"));
  for (int i=0; i < 0x30; i++) {
    if (i == 0x2D) {
      continue;
    }
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x3A; i < 0x41; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x5B; i < 0x61; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
  for (int i=0x7B; i < 0x100; i++) {
    assertFalse(VCardUtils.containsOnlyAlphaDigitHyphen(String.valueOf((char)i)));
  }
}
Program: 42824
Project: 42824
Buggy source:
public void testContainsOnlyPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyPrintableAscii(builder.toString()));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
}

Fixed version (ground truth):
public void testContainsOnlyPrintableAscii(){
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((String[])null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii((List<String>)null));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  StringBuilder builder=new StringBuilder();
  for (int i=0x20; i < 0x7F; i++) {
    builder.append((char)i);
  }
  assertTrue(VCardUtils.containsOnlyPrintableAscii(builder.toString()));
  assertTrue(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
  assertFalse(VCardUtils.containsOnlyPrintableAscii("String_Node_Str"));
}
Program: 42825
Project: 42825
Buggy source:
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowing() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}

Fixed version (ground truth):
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowingAndNotHidden() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}
Program: 42826
Project: 42826
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowing();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowingAndNotHidden();
}
Program: 42827
Project: 42827
Buggy source:
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowing();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}

Fixed version (ground truth):
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowingAndNotHidden();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}
Program: 42828
Project: 42828
Buggy source:
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowing())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}

Fixed version (ground truth):
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}
Program: 42829
Project: 42829
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (!mHideLockScreen && mKeyguardMediator.isShowing()) {
  }
 else   if (!mHideLockScreen && mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          startDockOrHome();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    startDockOrHome();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowingAndNotHidden()) {
  }
 else   if (!mHideLockScreen && mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          startDockOrHome();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    startDockOrHome();
  }
}
Program: 42830
Project: 42830
Buggy source:
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowing() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}

Fixed version (ground truth):
public void screenOnStoppedLw(){
  if (!mKeyguardMediator.isShowingAndNotHidden() && mPowerManager.isScreenOn()) {
    long curTime=SystemClock.uptimeMillis();
    mPowerManager.userActivity(curTime,false,LocalPowerManager.OTHER_EVENT);
  }
}
Program: 42831
Project: 42831
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowing();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowingAndNotHidden();
}
Program: 42832
Project: 42832
Buggy source:
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowing();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}

Fixed version (ground truth):
void showGlobalActionsDialog(){
  if (mGlobalActions == null) {
    mGlobalActions=new GlobalActions(mContext);
  }
  final boolean keyguardShowing=mKeyguardMediator.isShowingAndNotHidden();
  mGlobalActions.showDialog(keyguardShowing,isDeviceProvisioned());
  if (keyguardShowing) {
    mKeyguardMediator.pokeWakelock();
  }
}
Program: 42833
Project: 42833
Buggy source:
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowing())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}

Fixed version (ground truth):
public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  final boolean hapticsDisabled=Settings.System.getInt(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0) == 0;
  if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {
    return false;
  }
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    mVibrator.vibrate(mLongPressVibePattern,-1);
  return true;
case HapticFeedbackConstants.VIRTUAL_KEY:
mVibrator.vibrate(mVirtualKeyVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
mVibrator.vibrate(mSafeModeDisabledVibePattern,-1);
return true;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
mVibrator.vibrate(mSafeModeEnabledVibePattern,-1);
return true;
}
return false;
}
Program: 42834
Project: 42834
Buggy source:
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (!mHideLockScreen && mKeyguardMediator.isShowing()) {
  }
 else   if (!mHideLockScreen && mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          startDockOrHome();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    startDockOrHome();
  }
}

Fixed version (ground truth):
/** 
 * A home key -> launch home action was detected.  Take the appropriate action given the situation with the keyguard.
 */
void launchHomeFromHotKey(){
  if (mKeyguardMediator.isShowingAndNotHidden()) {
  }
 else   if (!mHideLockScreen && mKeyguardMediator.isInputRestricted()) {
    mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult(){
      public void onKeyguardExitResult(      boolean success){
        if (success) {
          try {
            ActivityManagerNative.getDefault().stopAppSwitches();
          }
 catch (          RemoteException e) {
          }
          sendCloseSystemWindows();
          startDockOrHome();
        }
      }
    }
);
  }
 else {
    try {
      ActivityManagerNative.getDefault().stopAppSwitches();
    }
 catch (    RemoteException e) {
    }
    sendCloseSystemWindows();
    startDockOrHome();
  }
}