nus-yam/ex-repair huggingface dataset:
Program: 24355
Project: 24355
Buggy source:
private final void performLayoutLockedInner(){
  final int dw=mDisplay.getWidth();
  final int dh=mDisplay.getHeight();
  final int N=mWindows.size();
  int i;
  if (mLayoutNeeded) {
    mPolicy.beginLayoutLw(dw,dh);
    int topAttached=-1;
    for (i=N - 1; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      boolean gone=win.mViewVisibility == View.GONE || !win.mRelayoutCalled || win.mRootToken.hidden;
      if (!gone || !win.mHaveFrame) {
        if (!win.mLayoutAttached) {
          mPolicy.layoutWindowLw(win,win.mAttrs,null);
        }
 else {
          if (topAttached < 0)           topAttached=i;
        }
      }
    }
    for (i=topAttached; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      if (win.mLayoutAttached) {
        if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame) {
          mPolicy.layoutWindowLw(win,win.mAttrs,win.mAttachedWindow);
        }
      }
    }
    mPolicy.finishLayoutLw();
    mLayoutNeeded=false;
  }
}

Fixed version (ground truth):
private final void performLayoutLockedInner(){
  final int dw=mDisplay.getWidth();
  final int dh=mDisplay.getHeight();
  final int N=mWindows.size();
  int repeats=0;
  int i;
  while (mLayoutNeeded) {
    mPolicy.beginLayoutLw(dw,dh);
    int topAttached=-1;
    for (i=N - 1; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      final AppWindowToken atoken=win.mAppToken;
      final boolean gone=win.mViewVisibility == View.GONE || !win.mRelayoutCalled || win.mRootToken.hidden || (atoken != null && atoken.hiddenRequested) || !win.mPolicyVisibility || win.mAttachedHidden || win.mExiting || win.mDestroying;
      if (!gone || !win.mHaveFrame) {
        if (!win.mLayoutAttached) {
          mPolicy.layoutWindowLw(win,win.mAttrs,null);
        }
 else {
          if (topAttached < 0)           topAttached=i;
        }
      }
    }
    for (i=topAttached; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      if (win.mLayoutAttached) {
        if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame) {
          mPolicy.layoutWindowLw(win,win.mAttrs,win.mAttachedWindow);
        }
      }
    }
    if (!mPolicy.finishLayoutLw()) {
      mLayoutNeeded=false;
    }
 else     if (repeats > 2) {
      Log.w(TAG,"String_Node_Str");
      mLayoutNeeded=false;
    }
 else {
      repeats++;
    }
  }
}
Program: 24356
Project: 24356
Buggy source:
@Override public boolean requestChildRectangleOnScreen(View child,Rect rect,boolean immediate){
  rect.offset(child.getLeft() - child.getScrollX(),child.getTop() - child.getScrollY());
  int height=getHeight() - getHorizontalScrollbarHeight();
  int screenTop=mScrollY;
  int screenBottom=screenTop + height;
  int scrollYDelta=0;
  if (rect.bottom > screenBottom && rect.top > screenTop) {
    if (rect.height() > height) {
      scrollYDelta+=(rect.top - screenTop);
    }
 else {
      scrollYDelta+=(rect.bottom - screenBottom);
    }
  }
 else   if (rect.top < screenTop) {
    scrollYDelta-=(screenTop - rect.top);
  }
  int width=getWidth() - getVerticalScrollbarWidth();
  int screenLeft=mScrollX;
  int screenRight=screenLeft + width;
  int scrollXDelta=0;
  if (rect.right > screenRight && rect.left > screenLeft) {
    if (rect.width() > width) {
      scrollXDelta+=(rect.left - screenLeft);
    }
 else {
      scrollXDelta+=(rect.right - screenRight);
    }
  }
 else   if (rect.left < screenLeft) {
    scrollXDelta-=(screenLeft - rect.left);
  }
  if ((scrollYDelta | scrollXDelta) != 0) {
    return pinScrollBy(scrollXDelta,scrollYDelta,!immediate,0);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean requestChildRectangleOnScreen(View child,Rect rect,boolean immediate){
  rect.offset(child.getLeft() - child.getScrollX(),child.getTop() - child.getScrollY());
  int height=getHeight() - getHorizontalScrollbarHeight();
  int screenTop=mScrollY;
  int screenBottom=screenTop + height;
  int scrollYDelta=0;
  if (rect.bottom > screenBottom) {
    int oneThirdOfScreenHeight=height / 3;
    if (rect.height() > 2 * oneThirdOfScreenHeight) {
      scrollYDelta=rect.top - screenTop;
    }
 else {
      scrollYDelta=rect.top - (screenTop + oneThirdOfScreenHeight);
    }
  }
 else   if (rect.top < screenTop) {
    scrollYDelta=rect.top - screenTop;
  }
  int width=getWidth() - getVerticalScrollbarWidth();
  int screenLeft=mScrollX;
  int screenRight=screenLeft + width;
  int scrollXDelta=0;
  if (rect.right > screenRight && rect.left > screenLeft) {
    if (rect.width() > width) {
      scrollXDelta+=(rect.left - screenLeft);
    }
 else {
      scrollXDelta+=(rect.right - screenRight);
    }
  }
 else   if (rect.left < screenLeft) {
    scrollXDelta-=(screenLeft - rect.left);
  }
  if ((scrollYDelta | scrollXDelta) != 0) {
    return pinScrollBy(scrollXDelta,scrollYDelta,!immediate,0);
  }
  return false;
}
Program: 24358
Project: 24358
Buggy source:
public void run(){
  try {
    if (!hasCache) {
      captureView.buildDrawingCache();
    }
    cache[0]=captureView.getDrawingCache();
  }
  finally {
    latch.countDown();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    cache[0]=captureView.createSnapshot(Bitmap.Config.ARGB_8888,0);
  }
 catch (  OutOfMemoryError e) {
    try {
      cache[0]=captureView.createSnapshot(Bitmap.Config.ARGB_4444,0);
    }
 catch (    OutOfMemoryError e2) {
      Log.w("String_Node_Str","String_Node_Str");
    }
  }
 finally {
    latch.countDown();
  }
}
Program: 24359
Project: 24359
Buggy source:
private static void capture(View root,final OutputStream clientStream,String parameter) throws IOException {
  final View captureView=findView(root,parameter);
  if (captureView != null) {
    final CountDownLatch latch=new CountDownLatch(1);
    final Bitmap[] cache=new Bitmap[1];
    final boolean hasCache=captureView.isDrawingCacheEnabled();
    final boolean willNotCache=captureView.willNotCacheDrawing();
    if (willNotCache) {
      captureView.setWillNotCacheDrawing(false);
    }
    root.post(new Runnable(){
      public void run(){
        try {
          if (!hasCache) {
            captureView.buildDrawingCache();
          }
          cache[0]=captureView.getDrawingCache();
        }
  finally {
          latch.countDown();
        }
      }
    }
);
    try {
      latch.await(CAPTURE_TIMEOUT,TimeUnit.MILLISECONDS);
      if (cache[0] != null) {
        BufferedOutputStream out=null;
        try {
          out=new BufferedOutputStream(clientStream,32 * 1024);
          cache[0].compress(Bitmap.CompressFormat.PNG,100,out);
          out.flush();
        }
  finally {
          if (out != null) {
            out.close();
          }
        }
      }
    }
 catch (    InterruptedException e) {
      Log.w("String_Node_Str","String_Node_Str" + captureView);
      Thread.currentThread().interrupt();
    }
 finally {
      if (willNotCache) {
        captureView.setWillNotCacheDrawing(true);
      }
      if (!hasCache) {
        captureView.destroyDrawingCache();
      }
    }
  }
}

Fixed version (ground truth):
private static void capture(View root,final OutputStream clientStream,String parameter) throws IOException {
  final View captureView=findView(root,parameter);
  if (captureView != null) {
    final CountDownLatch latch=new CountDownLatch(1);
    final Bitmap[] cache=new Bitmap[1];
    root.post(new Runnable(){
      public void run(){
        try {
          cache[0]=captureView.createSnapshot(Bitmap.Config.ARGB_8888,0);
        }
 catch (        OutOfMemoryError e) {
          try {
            cache[0]=captureView.createSnapshot(Bitmap.Config.ARGB_4444,0);
          }
 catch (          OutOfMemoryError e2) {
            Log.w("String_Node_Str","String_Node_Str");
          }
        }
 finally {
          latch.countDown();
        }
      }
    }
);
    try {
      latch.await(CAPTURE_TIMEOUT,TimeUnit.MILLISECONDS);
      if (cache[0] != null) {
        BufferedOutputStream out=null;
        try {
          out=new BufferedOutputStream(clientStream,32 * 1024);
          cache[0].compress(Bitmap.CompressFormat.PNG,100,out);
          out.flush();
        }
  finally {
          if (out != null) {
            out.close();
          }
          cache[0].recycle();
        }
      }
 else {
        Log.w("String_Node_Str","String_Node_Str");
        clientStream.close();
      }
    }
 catch (    InterruptedException e) {
      Log.w("String_Node_Str","String_Node_Str" + captureView);
      Thread.currentThread().interrupt();
    }
  }
}
Program: 24360
Project: 24360
Buggy source:
/** 
 * Called when layout of the windows is finished.  After this function has returned, all windows given to layoutWindow() <em>must</em> have had a frame assigned.
 */
public void finishLayoutLw();

Fixed version (ground truth):
/** 
 * Called when layout of the windows is finished.  After this function has returned, all windows given to layoutWindow() <em>must</em> have had a frame assigned.
 * @return Return true if layout state may have changed (so that another layout will be performed).
 */
public boolean finishLayoutLw();
Program: 24362
Project: 24362
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void draw(Canvas canvas){
  super.draw(canvas);
  if (mForeground != null) {
    mForeground.draw(canvas);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void draw(Canvas canvas){
  super.draw(canvas);
  if (mForeground != null) {
    final Drawable foreground=mForeground;
    if (mForegroundBoundsChanged) {
      mForegroundBoundsChanged=false;
      if (foreground != null) {
        final Rect selfBounds=mSelfBounds;
        final Rect overlayBounds=mOverlayBounds;
        final int w=mRight - mLeft;
        final int h=mBottom - mTop;
        if (mForegroundInPadding) {
          selfBounds.set(0,0,w,h);
        }
 else {
          selfBounds.set(mPaddingLeft,mPaddingTop,w - mPaddingRight,h - mPaddingBottom);
        }
        Gravity.apply(mForegroundGravity,foreground.getIntrinsicWidth(),foreground.getIntrinsicHeight(),selfBounds,overlayBounds);
        foreground.setBounds(overlayBounds);
      }
    }
    foreground.draw(canvas);
  }
}
Program: 24363
Project: 24363
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  final Drawable foreground=mForeground;
  if (foreground != null) {
    final Rect selfBounds=mSelfBounds;
    final Rect overlayBounds=mOverlayBounds;
    if (mForegroundInPadding) {
      selfBounds.set(0,0,w,h);
    }
 else {
      selfBounds.set(mPaddingLeft,mPaddingTop,w - mPaddingRight,h - mPaddingBottom);
    }
    Gravity.apply(mForegroundGravity,foreground.getIntrinsicWidth(),foreground.getIntrinsicHeight(),selfBounds,overlayBounds);
    foreground.setBounds(overlayBounds);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  mForegroundBoundsChanged=true;
}
Program: 24364
Project: 24364
Buggy source:
private final void performLayoutLockedInner(){
  final int dw=mDisplay.getWidth();
  final int dh=mDisplay.getHeight();
  final int N=mWindows.size();
  int i;
  if (mLayoutNeeded) {
    mPolicy.beginLayoutLw(dw,dh);
    int topAttached=-1;
    for (i=N - 1; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      boolean gone=win.mViewVisibility == View.GONE || !win.mRelayoutCalled || win.mRootToken.hidden;
      if (!gone || !win.mHaveFrame) {
        if (!win.mLayoutAttached) {
          mPolicy.layoutWindowLw(win,win.mAttrs,null);
        }
 else {
          if (topAttached < 0)           topAttached=i;
        }
      }
    }
    for (i=topAttached; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      if (win.mLayoutAttached) {
        if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame) {
          mPolicy.layoutWindowLw(win,win.mAttrs,win.mAttachedWindow);
        }
      }
    }
    mPolicy.finishLayoutLw();
    mLayoutNeeded=false;
  }
}

Fixed version (ground truth):
private final void performLayoutLockedInner(){
  final int dw=mDisplay.getWidth();
  final int dh=mDisplay.getHeight();
  final int N=mWindows.size();
  int repeats=0;
  int i;
  while (mLayoutNeeded) {
    mPolicy.beginLayoutLw(dw,dh);
    int topAttached=-1;
    for (i=N - 1; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      final AppWindowToken atoken=win.mAppToken;
      final boolean gone=win.mViewVisibility == View.GONE || !win.mRelayoutCalled || win.mRootToken.hidden || (atoken != null && atoken.hiddenRequested) || !win.mPolicyVisibility || win.mAttachedHidden || win.mExiting || win.mDestroying;
      if (!gone || !win.mHaveFrame) {
        if (!win.mLayoutAttached) {
          mPolicy.layoutWindowLw(win,win.mAttrs,null);
        }
 else {
          if (topAttached < 0)           topAttached=i;
        }
      }
    }
    for (i=topAttached; i >= 0; i--) {
      WindowState win=(WindowState)mWindows.get(i);
      if (win.mLayoutAttached) {
        if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame) {
          mPolicy.layoutWindowLw(win,win.mAttrs,win.mAttachedWindow);
        }
      }
    }
    if (!mPolicy.finishLayoutLw()) {
      mLayoutNeeded=false;
    }
 else     if (repeats > 2) {
      Log.w(TAG,"String_Node_Str");
      mLayoutNeeded=false;
    }
 else {
      repeats++;
    }
  }
}
Program: 24365
Project: 24365
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  return false;
}
Program: 24367
Project: 24367
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}
Program: 24368
Project: 24368
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
}
Program: 24369
Project: 24369
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (win.isVisibleLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
 else     if (mTopFullscreenOpaqueWindowState == null && attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && win.fillsScreenLw(mW,mH,true,false) && win.isVisibleLw()) {
      mTopFullscreenOpaqueWindowState=win;
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
}
Program: 24370
Project: 24370
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void finishLayoutLw(){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishLayoutLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str");
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}
Program: 24371
Project: 24371
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  return false;
}
Program: 24373
Project: 24373
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}
Program: 24374
Project: 24374
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
}
Program: 24375
Project: 24375
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (win.isVisibleLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
 else     if (mTopFullscreenOpaqueWindowState == null && attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && win.fillsScreenLw(mW,mH,true,false) && win.isVisibleLw()) {
      mTopFullscreenOpaqueWindowState=win;
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
}
Program: 24376
Project: 24376
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void finishLayoutLw(){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishLayoutLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str");
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}
Program: 24377
Project: 24377
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishAnimationLw(){
  return false;
}
Program: 24379
Project: 24379
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginLayoutLw(int displayWidth,int displayHeight){
  mW=displayWidth;
  mH=displayHeight;
  mDockLeft=mContentLeft=mCurLeft=0;
  mDockTop=mContentTop=mCurTop=0;
  mDockRight=mContentRight=mCurRight=displayWidth;
  mDockBottom=mContentBottom=mCurBottom=displayHeight;
  mDockLayer=0x10000000;
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
  if (mStatusBar != null) {
    final Rect pf=mTmpParentFrame;
    final Rect df=mTmpDisplayFrame;
    final Rect vf=mTmpVisibleFrame;
    pf.left=df.left=vf.left=0;
    pf.top=df.top=vf.top=0;
    pf.right=df.right=vf.right=displayWidth;
    pf.bottom=df.bottom=vf.bottom=displayHeight;
    mStatusBar.computeFrameLw(pf,df,vf,vf);
    if (mStatusBar.isVisibleLw()) {
      mDockTop=mContentTop=mCurTop=mStatusBar.getFrameLw().bottom;
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str" + mDockBottom + "String_Node_Str"+ mContentBottom+ "String_Node_Str"+ mCurBottom);
    }
  }
}
Program: 24380
Project: 24380
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mForceStatusBar=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void beginAnimationLw(int displayWidth,int displayHeight){
}
Program: 24381
Project: 24381
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
  if (win.isVisibleLw()) {
    if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      mForceStatusBar=true;
    }
 else     if (mTopFullscreenOpaqueWindowState == null && attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type <= LAST_APPLICATION_WINDOW && win.fillsScreenLw(mW,mH,true,false) && win.isVisibleLw()) {
      mTopFullscreenOpaqueWindowState=win;
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void animatingWindowLw(WindowState win,WindowManager.LayoutParams attrs){
}
Program: 24382
Project: 24382
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void finishLayoutLw(){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean finishLayoutLw(){
  boolean changed=false;
  boolean hiding=false;
  if (mStatusBar != null) {
    if (mForceStatusBar) {
      if (DEBUG_LAYOUT)       Log.v(TAG,"String_Node_Str");
      changed|=mStatusBar.showLw(true);
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      WindowManager.LayoutParams lp=mTopFullscreenOpaqueWindowState.getAttrs();
      boolean hideStatusBar=(lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
      if (hideStatusBar) {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.hideLw(true);
        hiding=true;
      }
 else {
        if (DEBUG_LAYOUT)         Log.v(TAG,"String_Node_Str");
        changed|=mStatusBar.showLw(true);
      }
    }
  }
  if (changed && hiding) {
    IStatusBar sbs=IStatusBar.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
    if (sbs != null) {
      try {
        sbs.deactivate();
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}
Program: 24383
Project: 24383
Buggy source:
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation(0);
    }
  }
}

Fixed version (ground truth):
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
  boolean updateRotation=false;
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation=true;
    }
  }
  if (updateRotation) {
    updateRotation(0);
  }
}
Program: 24384
Project: 24384
Buggy source:
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation(0);
    }
  }
}

Fixed version (ground truth):
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
  boolean updateRotation=false;
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation=true;
    }
  }
  if (updateRotation) {
    updateRotation(0);
  }
}
Program: 24385
Project: 24385
Buggy source:
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation(0);
    }
  }
}

Fixed version (ground truth):
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
  boolean updateRotation=false;
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    mFancyRotationAnimation=Settings.System.getInt(resolver,"String_Node_Str",0) != 0 ? 0x80 : 0;
    int accelerometerDefault=Settings.System.getInt(resolver,Settings.System.ACCELEROMETER_ROTATION,DEFAULT_ACCELEROMETER_ROTATION);
    if (mAccelerometerDefault != accelerometerDefault) {
      mAccelerometerDefault=accelerometerDefault;
      updateOrientationListenerLp();
    }
    String imId=Settings.Secure.getString(resolver,Settings.Secure.DEFAULT_INPUT_METHOD);
    boolean hasSoftInput=imId != null && imId.length() > 0;
    if (mHasSoftInput != hasSoftInput) {
      mHasSoftInput=hasSoftInput;
      updateRotation=true;
    }
  }
  if (updateRotation) {
    updateRotation(0);
  }
}
Program: 24386
Project: 24386
Buggy source:
private boolean acquireWifiLockLocked(WifiLock wifiLock){
  mLocks.addLock(wifiLock);
  int uid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  try {
switch (wifiLock.mLockMode) {
case (WifiManager.WIFI_MODE_FULL):
      mBatteryStats.noteFullWifiLockAcquired(uid);
case (WifiManager.WIFI_MODE_SCAN_ONLY):
    mBatteryStats.noteScanWifiLockAcquired(uid);
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
updateWifiState();
return true;
}

Fixed version (ground truth):
private boolean acquireWifiLockLocked(WifiLock wifiLock){
  mLocks.addLock(wifiLock);
  int uid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  try {
switch (wifiLock.mLockMode) {
case WifiManager.WIFI_MODE_FULL:
      ++mFullLocksAcquired;
    mBatteryStats.noteFullWifiLockAcquired(uid);
  break;
case WifiManager.WIFI_MODE_SCAN_ONLY:
++mScanLocksAcquired;
mBatteryStats.noteScanWifiLockAcquired(uid);
break;
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
updateWifiState();
return true;
}
Program: 24387
Project: 24387
Buggy source:
private boolean releaseWifiLockLocked(IBinder lock){
  boolean hadLock;
  WifiLock wifiLock=mLocks.removeLock(lock);
  hadLock=(wifiLock != null);
  if (hadLock) {
    int uid=Binder.getCallingUid();
    long ident=Binder.clearCallingIdentity();
    try {
switch (wifiLock.mLockMode) {
case (WifiManager.WIFI_MODE_FULL):
        mBatteryStats.noteFullWifiLockReleased(uid);
case (WifiManager.WIFI_MODE_SCAN_ONLY):
      mBatteryStats.noteScanWifiLockReleased(uid);
  }
}
 catch (RemoteException e) {
}
 finally {
  Binder.restoreCallingIdentity(ident);
}
}
updateWifiState();
return hadLock;
}

Fixed version (ground truth):
private boolean releaseWifiLockLocked(IBinder lock){
  boolean hadLock;
  WifiLock wifiLock=mLocks.removeLock(lock);
  hadLock=(wifiLock != null);
  if (hadLock) {
    int uid=Binder.getCallingUid();
    long ident=Binder.clearCallingIdentity();
    try {
switch (wifiLock.mLockMode) {
case WifiManager.WIFI_MODE_FULL:
        ++mFullLocksReleased;
      mBatteryStats.noteFullWifiLockReleased(uid);
    break;
case WifiManager.WIFI_MODE_SCAN_ONLY:
  ++mScanLocksReleased;
mBatteryStats.noteScanWifiLockReleased(uid);
break;
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
}
updateWifiState();
return hadLock;
}
Program: 24388
Project: 24388
Buggy source:
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    return WifiNative.disconnectCommand();
  }
 else {
    releaseWakeLock();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return WifiNative.stopDriverCommand();
    }
 else {
      return WifiNative.disconnectCommand();
    }
  }
 else {
    releaseWakeLock();
  }
  return true;
}
Program: 24389
Project: 24389
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName).append("String_Node_Str").append(mRunState).append(LS);
  sb.append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName);
  sb.append("String_Node_Str");
  if (mRunState >= 1 && mRunState <= mRunStateNames.length) {
    sb.append(mRunStateNames[mRunState - 1]);
  }
 else {
    sb.append(mRunState);
  }
  sb.append(LS).append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}
Program: 24390
Project: 24390
Buggy source:
private boolean acquireWifiLockLocked(WifiLock wifiLock){
  mLocks.addLock(wifiLock);
  int uid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  try {
switch (wifiLock.mLockMode) {
case (WifiManager.WIFI_MODE_FULL):
      mBatteryStats.noteFullWifiLockAcquired(uid);
case (WifiManager.WIFI_MODE_SCAN_ONLY):
    mBatteryStats.noteScanWifiLockAcquired(uid);
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
updateWifiState();
return true;
}

Fixed version (ground truth):
private boolean acquireWifiLockLocked(WifiLock wifiLock){
  mLocks.addLock(wifiLock);
  int uid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  try {
switch (wifiLock.mLockMode) {
case WifiManager.WIFI_MODE_FULL:
      ++mFullLocksAcquired;
    mBatteryStats.noteFullWifiLockAcquired(uid);
  break;
case WifiManager.WIFI_MODE_SCAN_ONLY:
++mScanLocksAcquired;
mBatteryStats.noteScanWifiLockAcquired(uid);
break;
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
updateWifiState();
return true;
}
Program: 24391
Project: 24391
Buggy source:
private boolean releaseWifiLockLocked(IBinder lock){
  boolean hadLock;
  WifiLock wifiLock=mLocks.removeLock(lock);
  hadLock=(wifiLock != null);
  if (hadLock) {
    int uid=Binder.getCallingUid();
    long ident=Binder.clearCallingIdentity();
    try {
switch (wifiLock.mLockMode) {
case (WifiManager.WIFI_MODE_FULL):
        mBatteryStats.noteFullWifiLockReleased(uid);
case (WifiManager.WIFI_MODE_SCAN_ONLY):
      mBatteryStats.noteScanWifiLockReleased(uid);
  }
}
 catch (RemoteException e) {
}
 finally {
  Binder.restoreCallingIdentity(ident);
}
}
updateWifiState();
return hadLock;
}

Fixed version (ground truth):
private boolean releaseWifiLockLocked(IBinder lock){
  boolean hadLock;
  WifiLock wifiLock=mLocks.removeLock(lock);
  hadLock=(wifiLock != null);
  if (hadLock) {
    int uid=Binder.getCallingUid();
    long ident=Binder.clearCallingIdentity();
    try {
switch (wifiLock.mLockMode) {
case WifiManager.WIFI_MODE_FULL:
        ++mFullLocksReleased;
      mBatteryStats.noteFullWifiLockReleased(uid);
    break;
case WifiManager.WIFI_MODE_SCAN_ONLY:
  ++mScanLocksReleased;
mBatteryStats.noteScanWifiLockReleased(uid);
break;
}
}
 catch (RemoteException e) {
}
 finally {
Binder.restoreCallingIdentity(ident);
}
}
updateWifiState();
return hadLock;
}
Program: 24392
Project: 24392
Buggy source:
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    return WifiNative.disconnectCommand();
  }
 else {
    releaseWakeLock();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * We want to stop the driver, but if we're connected to a network, we first want to disconnect, so that the supplicant is always in a known state (DISCONNECTED) when the driver is stopped.
 * @return {@code true} if the operation succeeds, which means that thedisconnect or stop command was initiated.
 */
public synchronized boolean disconnectAndStop(){
  if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
    setNotificationVisible(false,0,false,0);
    mRunState=RUN_STATE_STOPPING;
    if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
      return WifiNative.stopDriverCommand();
    }
 else {
      return WifiNative.disconnectCommand();
    }
  }
 else {
    releaseWakeLock();
  }
  return true;
}
Program: 24393
Project: 24393
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName).append("String_Node_Str").append(mRunState).append(LS);
  sb.append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName);
  sb.append("String_Node_Str");
  if (mRunState >= 1 && mRunState <= mRunStateNames.length) {
    sb.append(mRunStateNames[mRunState - 1]);
  }
 else {
    sb.append(mRunState);
  }
  sb.append(LS).append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}
Program: 24394
Project: 24394
Buggy source:
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDisplayedLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,0);
}

Fixed version (ground truth):
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDisplayedLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}