nus-yam/ex-repair huggingface dataset:
Program: 183813
Project: 183813
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: 183814
Project: 183814
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: 183816
Project: 183816
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: 183817
Project: 183817
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: 183818
Project: 183818
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: 183819
Project: 183819
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: 183821
Project: 183821
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: 183822
Project: 183822
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: 183823
Project: 183823
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: 183824
Project: 183824
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: 183825
Project: 183825
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: 183827
Project: 183827
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: 183828
Project: 183828
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: 183829
Project: 183829
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: 183830
Project: 183830
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: 183831
Project: 183831
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: 183832
Project: 183832
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: 183833
Project: 183833
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: 183834
Project: 183834
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: 183835
Project: 183835
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: 183836
Project: 183836
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: 183837
Project: 183837
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: 183838
Project: 183838
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: 183839
Project: 183839
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: 183840
Project: 183840
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: 183841
Project: 183841
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: 183842
Project: 183842
Buggy source:
/** 
 * Called when the dependency changes.
 * @param dependency The Preference that this Preference depends on.
 * @param disableDependent Set true to disable this Preference.
 */
public void onDependencyChanged(Preference dependency,boolean disableDependent){
  setEnabled(!disableDependent);
}

Fixed version (ground truth):
/** 
 * Called when the dependency changes.
 * @param dependency The Preference that this Preference depends on.
 * @param disableDependent Set true to disable this Preference.
 */
public void onDependencyChanged(Preference dependency,boolean disableDependent){
  if (mDependencyMet == disableDependent) {
    mDependencyMet=!disableDependent;
    notifyDependencyChange(shouldDisableDependents());
    notifyChanged();
  }
}
Program: 183843
Project: 183843
Buggy source:
/** 
 * Checks whether this Preference should be enabled in the list.
 * @return True if this Preference is enabled, false otherwise.
 */
public boolean isEnabled(){
  return mEnabled;
}

Fixed version (ground truth):
/** 
 * Checks whether this Preference should be enabled in the list.
 * @return True if this Preference is enabled, false otherwise.
 */
public boolean isEnabled(){
  return mEnabled && mDependencyMet;
}
Program: 183844
Project: 183844
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: 183845
Project: 183845
Buggy source:
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) {
  }
}

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,mFancyRotationAnimation | animFlags);
  }
 catch (  RemoteException e) {
  }
}
Program: 183846
Project: 183846
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation(0);
}

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

Fixed version (ground truth):
@Override public void onChange(boolean selfChange){
  update();
  try {
    mWindowManager.setRotation(USE_LAST_ROTATION,false,mFancyRotationAnimation);
  }
 catch (  RemoteException e) {
  }
}
Program: 183848
Project: 183848
Buggy source:
/** 
 * {@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;
}

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(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
      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;
}
Program: 183849
Project: 183849
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);
    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(1);
    }
  }
}

Fixed version (ground truth):
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);
    }
  }
}
Program: 183850
Project: 183850
Buggy source:
@Override public void onOrientationChanged(int rotation){
  if (true)   Log.i(TAG,"String_Node_Str" + rotation);
  try {
    mWindowManager.setRotation(rotation,false,1);
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void onOrientationChanged(int rotation){
  if (true)   Log.i(TAG,"String_Node_Str" + rotation);
  try {
    mWindowManager.setRotation(rotation,false,mFancyRotationAnimation);
  }
 catch (  RemoteException e) {
  }
}
Program: 183851
Project: 183851
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: 183852
Project: 183852
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: 183853
Project: 183853
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation(0);
}
Program: 183854
Project: 183854
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: 183855
Project: 183855
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;
}
Program: 183856
Project: 183856
Buggy source:
public int rotationForOrientationLw(int orientation,int lastRotation,boolean displayEnabled){
synchronized (mLock) {
switch (orientation) {
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
      return Surface.ROTATION_90;
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
    return Surface.ROTATION_0;
}
if (mLidOpen) {
  return Surface.ROTATION_90;
}
 else {
  if (useSensorForOrientationLp()) {
    return mSensorRotation >= 0 ? mSensorRotation : lastRotation;
  }
  return Surface.ROTATION_0;
}
}
}

Fixed version (ground truth):
public int rotationForOrientationLw(int orientation,int lastRotation,boolean displayEnabled){
synchronized (mLock) {
switch (orientation) {
case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
      return Surface.ROTATION_90;
case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
    return Surface.ROTATION_0;
}
if (mLidOpen) {
  return Surface.ROTATION_90;
}
 else {
  if (useSensorForOrientationLp(orientation)) {
    int curRotation=mOrientationListener.getCurrentRotation();
    return curRotation >= 0 ? curRotation : lastRotation;
  }
  return Surface.ROTATION_0;
}
}
}