nus-yam/ex-repair huggingface dataset:
Program: 24395
Project: 24395
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: 24396
Project: 24396
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: 24398
Project: 24398
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: 24399
Project: 24399
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: 24400
Project: 24400
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation(0);
}
Program: 24401
Project: 24401
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: 24402
Project: 24402
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: 24403
Project: 24403
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;
}
}
}
Program: 24404
Project: 24404
Buggy source:
void updateOrientationListenerLp(){
  if (!mOrientationListener.canDetectOrientation()) {
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + mScreenOn + "String_Node_Str"+ mCurrentAppOrientation+ "String_Node_Str"+ mOrientationSensorEnabled);
  boolean disable=true;
  if (mScreenOn) {
    if (needSensorRunningLp()) {
      disable=false;
      if (!mOrientationSensorEnabled) {
        mOrientationListener.enable();
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        mSensorRotation=-1;
        mOrientationSensorEnabled=true;
      }
    }
  }
  if (disable && mOrientationSensorEnabled) {
    mOrientationListener.disable();
    if (localLOGV)     Log.i(TAG,"String_Node_Str");
    mSensorRotation=-1;
    mOrientationSensorEnabled=false;
  }
}

Fixed version (ground truth):
void updateOrientationListenerLp(){
  if (!mOrientationListener.canDetectOrientation()) {
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + mScreenOn + "String_Node_Str"+ mCurrentAppOrientation+ "String_Node_Str"+ mOrientationSensorEnabled);
  boolean disable=true;
  if (mScreenOn) {
    if (needSensorRunningLp()) {
      disable=false;
      if (!mOrientationSensorEnabled) {
        mOrientationListener.enable();
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        mOrientationSensorEnabled=true;
      }
    }
  }
  if (disable && mOrientationSensorEnabled) {
    mOrientationListener.disable();
    if (localLOGV)     Log.i(TAG,"String_Node_Str");
    mOrientationSensorEnabled=false;
  }
}
Program: 24405
Project: 24405
Buggy source:
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    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();
    }
  }
}

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);
    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);
    }
  }
}
Program: 24406
Project: 24406
Buggy source:
boolean useSensorForOrientationLp(){
  if (mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) {
    return true;
  }
  if (mAccelerometerDefault != 0 && (mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean useSensorForOrientationLp(int appOrientation){
  if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) {
    return true;
  }
  if (mAccelerometerDefault != 0 && (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) {
    return true;
  }
  return false;
}
Program: 24407
Project: 24407
Buggy source:
@Override public void onOrientationChanged(int rotation){
  if (rotation != mSensorRotation) {
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ mSensorRotation);
    mSensorRotation=rotation;
    try {
      mWindowManager.setRotation(rotation,false);
    }
 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,1);
  }
 catch (  RemoteException e) {
  }
}
Program: 24408
Project: 24408
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: 24409
Project: 24409
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: 24410
Project: 24410
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: 24411
Project: 24411
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: 24412
Project: 24412
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: 24413
Project: 24413
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void enableScreenAfterBoot(){
  readLidState();
  updateRotation(0);
}
Program: 24414
Project: 24414
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: 24415
Project: 24415
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: 24416
Project: 24416
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;
}
}
}
Program: 24417
Project: 24417
Buggy source:
void updateOrientationListenerLp(){
  if (!mOrientationListener.canDetectOrientation()) {
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + mScreenOn + "String_Node_Str"+ mCurrentAppOrientation+ "String_Node_Str"+ mOrientationSensorEnabled);
  boolean disable=true;
  if (mScreenOn) {
    if (needSensorRunningLp()) {
      disable=false;
      if (!mOrientationSensorEnabled) {
        mOrientationListener.enable();
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        mSensorRotation=-1;
        mOrientationSensorEnabled=true;
      }
    }
  }
  if (disable && mOrientationSensorEnabled) {
    mOrientationListener.disable();
    if (localLOGV)     Log.i(TAG,"String_Node_Str");
    mSensorRotation=-1;
    mOrientationSensorEnabled=false;
  }
}

Fixed version (ground truth):
void updateOrientationListenerLp(){
  if (!mOrientationListener.canDetectOrientation()) {
    return;
  }
  if (localLOGV)   Log.i(TAG,"String_Node_Str" + mScreenOn + "String_Node_Str"+ mCurrentAppOrientation+ "String_Node_Str"+ mOrientationSensorEnabled);
  boolean disable=true;
  if (mScreenOn) {
    if (needSensorRunningLp()) {
      disable=false;
      if (!mOrientationSensorEnabled) {
        mOrientationListener.enable();
        if (localLOGV)         Log.i(TAG,"String_Node_Str");
        mOrientationSensorEnabled=true;
      }
    }
  }
  if (disable && mOrientationSensorEnabled) {
    mOrientationListener.disable();
    if (localLOGV)     Log.i(TAG,"String_Node_Str");
    mOrientationSensorEnabled=false;
  }
}
Program: 24418
Project: 24418
Buggy source:
public void update(){
  ContentResolver resolver=mContext.getContentResolver();
synchronized (mLock) {
    mEndcallBehavior=Settings.System.getInt(resolver,Settings.System.END_BUTTON_BEHAVIOR,DEFAULT_ENDCALL_BEHAVIOR);
    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();
    }
  }
}

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);
    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);
    }
  }
}
Program: 24419
Project: 24419
Buggy source:
boolean useSensorForOrientationLp(){
  if (mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) {
    return true;
  }
  if (mAccelerometerDefault != 0 && (mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean useSensorForOrientationLp(int appOrientation){
  if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) {
    return true;
  }
  if (mAccelerometerDefault != 0 && (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) {
    return true;
  }
  return false;
}
Program: 24420
Project: 24420
Buggy source:
@Override public void onOrientationChanged(int rotation){
  if (rotation != mSensorRotation) {
    if (localLOGV)     Log.i(TAG,"String_Node_Str" + rotation + "String_Node_Str"+ mSensorRotation);
    mSensorRotation=rotation;
    try {
      mWindowManager.setRotation(rotation,false);
    }
 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,1);
  }
 catch (  RemoteException e) {
  }
}
Program: 24421
Project: 24421
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: 24422
Project: 24422
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: 24423
Project: 24423
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: 24424
Project: 24424
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: 24425
Project: 24425
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: 24426
Project: 24426
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: 24427
Project: 24427
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: 24428
Project: 24428
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: 24429
Project: 24429
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: 24430
Project: 24430
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: 24431
Project: 24431
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: 24432
Project: 24432
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: 24433
Project: 24433
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: 24434
Project: 24434
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: 24436
Project: 24436
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: 24437
Project: 24437
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: 24438
Project: 24438
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;
}