nus-yam/ex-repair huggingface dataset:
Program: 43769
Project: 43769
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: 43770
Project: 43770
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: 43772
Project: 43772
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: 43773
Project: 43773
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: 43774
Project: 43774
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: 43776
Project: 43776
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: 43777
Project: 43777
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: 43778
Project: 43778
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: 43780
Project: 43780
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: 43781
Project: 43781
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: 43782
Project: 43782
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: 43784
Project: 43784
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: 43785
Project: 43785
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: 43786
Project: 43786
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: 43788
Project: 43788
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: 43789
Project: 43789
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: 43790
Project: 43790
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: 43791
Project: 43791
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: 43793
Project: 43793
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);
}
Program: 43794
Project: 43794
Buggy source:
public boolean setRotationUncheckedLocked(int rotation,int animFlags){
  boolean changed;
  if (rotation == WindowManagerPolicy.USE_LAST_ROTATION) {
    rotation=mRequestedRotation;
  }
 else {
    mRequestedRotation=rotation;
  }
  if (DEBUG_ORIENTATION)   Log.v(TAG,"String_Node_Str" + rotation);
  rotation=mPolicy.rotationForOrientationLw(mForcedAppOrientation,mRotation,mDisplayEnabled);
  if (DEBUG_ORIENTATION)   Log.v(TAG,"String_Node_Str" + rotation);
  changed=mDisplayEnabled && mRotation != rotation;
  if (changed) {
    if (DEBUG_ORIENTATION)     Log.v(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ mRotation+ "String_Node_Str"+ mForcedAppOrientation+ "String_Node_Str"+ mRequestedRotation+ "String_Node_Str");
    mRotation=rotation;
    mWindowsFreezingScreen=true;
    mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
    mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT),2000);
    startFreezingDisplayLocked();
    Log.i(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ animFlags);
    mQueue.setOrientation(rotation);
    if (mDisplayEnabled) {
      Surface.setOrientation(0,rotation);
    }
    for (int i=mWindows.size() - 1; i >= 0; i--) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.mSurface != null) {
        w.mOrientationChanging=true;
      }
    }
    for (int i=mRotationWatchers.size() - 1; i >= 0; i--) {
      try {
        mRotationWatchers.get(i).onRotationChanged(rotation);
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}

Fixed version (ground truth):
public boolean setRotationUncheckedLocked(int rotation,int animFlags){
  boolean changed;
  if (rotation == WindowManagerPolicy.USE_LAST_ROTATION) {
    rotation=mRequestedRotation;
  }
 else {
    mRequestedRotation=rotation;
    mLastRotationFlags=animFlags;
  }
  if (DEBUG_ORIENTATION)   Log.v(TAG,"String_Node_Str" + rotation);
  rotation=mPolicy.rotationForOrientationLw(mForcedAppOrientation,mRotation,mDisplayEnabled);
  if (DEBUG_ORIENTATION)   Log.v(TAG,"String_Node_Str" + rotation);
  changed=mDisplayEnabled && mRotation != rotation;
  if (changed) {
    if (DEBUG_ORIENTATION)     Log.v(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ mRotation+ "String_Node_Str"+ mForcedAppOrientation+ "String_Node_Str"+ mRequestedRotation+ "String_Node_Str");
    mRotation=rotation;
    mWindowsFreezingScreen=true;
    mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
    mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT),2000);
    startFreezingDisplayLocked();
    Log.i(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ animFlags);
    mQueue.setOrientation(rotation);
    if (mDisplayEnabled) {
      Surface.setOrientation(0,rotation,animFlags);
    }
    for (int i=mWindows.size() - 1; i >= 0; i--) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.mSurface != null) {
        w.mOrientationChanging=true;
      }
    }
    for (int i=mRotationWatchers.size() - 1; i >= 0; i--) {
      try {
        mRotationWatchers.get(i).onRotationChanged(rotation);
      }
 catch (      RemoteException e) {
      }
    }
  }
  return changed;
}
Program: 43795
Project: 43795
Buggy source:
Configuration updateOrientationFromAppTokensLocked(Configuration appConfig,IBinder freezeThisOneIfNeeded){
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      changed=true;
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
    }
    if (changed) {
      changed=setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,1);
      if (changed) {
        if (freezeThisOneIfNeeded != null) {
          AppWindowToken wtoken=findAppWindowToken(freezeThisOneIfNeeded);
          if (wtoken != null) {
            startAppFreezingScreenLocked(wtoken,ActivityInfo.CONFIG_ORIENTATION);
          }
        }
        return computeNewConfigurationLocked();
      }
    }
    if (appConfig != null) {
      mTempConfiguration.setToDefaults();
      if (computeNewConfigurationLocked(mTempConfiguration)) {
        if (appConfig.diff(mTempConfiguration) != 0) {
          Log.i(TAG,"String_Node_Str" + mTempConfiguration);
          return new Configuration(mTempConfiguration);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return null;
}

Fixed version (ground truth):
Configuration updateOrientationFromAppTokensLocked(Configuration appConfig,IBinder freezeThisOneIfNeeded){
  boolean changed=false;
  long ident=Binder.clearCallingIdentity();
  try {
    int req=computeForcedAppOrientationLocked();
    if (req != mForcedAppOrientation) {
      changed=true;
      mForcedAppOrientation=req;
      mPolicy.setCurrentOrientationLw(req);
    }
    if (changed) {
      changed=setRotationUncheckedLocked(WindowManagerPolicy.USE_LAST_ROTATION,mLastRotationFlags & (~Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE));
      if (changed) {
        if (freezeThisOneIfNeeded != null) {
          AppWindowToken wtoken=findAppWindowToken(freezeThisOneIfNeeded);
          if (wtoken != null) {
            startAppFreezingScreenLocked(wtoken,ActivityInfo.CONFIG_ORIENTATION);
          }
        }
        return computeNewConfigurationLocked();
      }
    }
    if (appConfig != null) {
      mTempConfiguration.setToDefaults();
      if (computeNewConfigurationLocked(mTempConfiguration)) {
        if (appConfig.diff(mTempConfiguration) != 0) {
          Log.i(TAG,"String_Node_Str" + mTempConfiguration);
          return new Configuration(mTempConfiguration);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return null;
}
Program: 43796
Project: 43796
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: 43797
Project: 43797
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: 43798
Project: 43798
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: 43799
Project: 43799
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: 43800
Project: 43800
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: 43801
Project: 43801
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: 43802
Project: 43802
Buggy source:
void observe(){
  ContentResolver resolver=mContext.getContentResolver();
  resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.END_BUTTON_BEHAVIOR),false,this);
  resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),false,this);
  resolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD),false,this);
  update();
}

Fixed version (ground truth):
void observe(){
  ContentResolver resolver=mContext.getContentResolver();
  resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.END_BUTTON_BEHAVIOR),false,this);
  resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION),false,this);
  resolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD),false,this);
  resolver.registerContentObserver(Settings.System.getUriFor("String_Node_Str"),false,this);
  update();
}
Program: 43803
Project: 43803
Buggy source:
void updateRotation(){
  mPowerManager.setKeyboardVisibility(mLidOpen);
  int rotation=Surface.ROTATION_0;
  if (mLidOpen) {
    rotation=Surface.ROTATION_90;
  }
  try {
    mWindowManager.setRotation(rotation,true);
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
void updateRotation(int animFlags){
  mPowerManager.setKeyboardVisibility(mLidOpen);
  int rotation=Surface.ROTATION_0;
  if (mLidOpen) {
    rotation=Surface.ROTATION_90;
  }
  try {
    mWindowManager.setRotation(rotation,true,animFlags);
  }
 catch (  RemoteException e) {
  }
}
Program: 43804
Project: 43804
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation(0);
}
Program: 43805
Project: 43805
Buggy source:
@Override public void onChange(boolean selfChange){
  update();
  try {
    mWindowManager.setRotation(USE_LAST_ROTATION,false);
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange){
  update();
  try {
    mWindowManager.setRotation(USE_LAST_ROTATION,false,1);
  }
 catch (  RemoteException e) {
  }
}
Program: 43806
Project: 43806
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean preprocessInputEventTq(RawInputEvent event){
switch (event.type) {
case RawInputEvent.EV_SW:
    if (event.keycode == 0) {
      mLidOpen=event.value == 0;
      updateRotation();
      if (keyguardIsShowingTq()) {
        if (mLidOpen) {
          mKeyguardMediator.pokeWakelock();
        }
      }
 else {
        if (mLidOpen) {
          mPowerManager.userActivity(SystemClock.uptimeMillis(),false,LocalPowerManager.BUTTON_EVENT);
        }
 else {
          mPowerManager.userActivity(SystemClock.uptimeMillis(),false,LocalPowerManager.OTHER_EVENT);
        }
      }
    }
}
return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean preprocessInputEventTq(RawInputEvent event){
switch (event.type) {
case RawInputEvent.EV_SW:
    if (event.keycode == 0) {
      mLidOpen=event.value == 0;
      updateRotation(0);
      if (keyguardIsShowingTq()) {
        if (mLidOpen) {
          mKeyguardMediator.pokeWakelock();
        }
      }
 else {
        if (mLidOpen) {
          mPowerManager.userActivity(SystemClock.uptimeMillis(),false,LocalPowerManager.BUTTON_EVENT);
        }
 else {
          mPowerManager.userActivity(SystemClock.uptimeMillis(),false,LocalPowerManager.OTHER_EVENT);
        }
      }
    }
}
return false;
}