nus-yam/ex-repair huggingface dataset:
Program: 182844
Project: 182844
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: 182845
Project: 182845
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: 182846
Project: 182846
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: 182847
Project: 182847
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 182848
Project: 182848
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: 182849
Project: 182849
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: 182850
Project: 182850
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: 182851
Project: 182851
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: 182852
Project: 182852
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 182853
Project: 182853
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: 182854
Project: 182854
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: 182855
Project: 182855
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: 182856
Project: 182856
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: 182857
Project: 182857
Buggy source:
void doVisibilityChanged(boolean visible){
  mVisible=visible;
  reportVisibility();
}

Fixed version (ground truth):
void doVisibilityChanged(boolean visible){
  if (!mDestroyed) {
    mVisible=visible;
    reportVisibility();
  }
}
Program: 182858
Project: 182858
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: 182859
Project: 182859
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: 182860
Project: 182860
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: 182861
Project: 182861
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: 182862
Project: 182862
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: 182863
Project: 182863
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: 182864
Project: 182864
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: 182865
Project: 182865
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: 182866
Project: 182866
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: 182867
Project: 182867
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: 182868
Project: 182868
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: 182869
Project: 182869
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: 182870
Project: 182870
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: 182871
Project: 182871
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: 182872
Project: 182872
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: 182873
Project: 182873
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowing();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowingAndNotHidden();
}
Program: 182874
Project: 182874
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: 182875
Project: 182875
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: 182876
Project: 182876
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: 182877
Project: 182877
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: 182878
Project: 182878
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowing();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean keyguardIsShowingTq(){
  return mKeyguardMediator.isShowingAndNotHidden();
}
Program: 182879
Project: 182879
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: 182880
Project: 182880
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: 182881
Project: 182881
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();
  }
}