nus-yam/ex-repair huggingface dataset:
Program: 192887
Project: 192887
Buggy source:
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  exitIdleInternal(reason);
}

Fixed version (ground truth):
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    exitIdleInternal(reason);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192888
Project: 192888
Buggy source:
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  addPowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    addPowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192889
Project: 192889
Buggy source:
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  removePowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    removePowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192890
Project: 192890
Buggy source:
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (  Atlas.Type type : Atlas.Type.values()) {
    for (int width=mEnd; width > mStart; width-=mStep) {
      for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
        if (width * height <= mThreshold)         continue;
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            break;
          }
        }
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (int width=mEnd; width > mStart; width-=mStep) {
    for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
      if (width * height <= mThreshold)       continue;
      boolean packSuccess=false;
      for (      Atlas.Type type : Atlas.Type.values()) {
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            packSuccess=true;
            break;
          }
        }
      }
      if (!packSuccess) {
        break;
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}
Program: 192891
Project: 192891
Buggy source:
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (  Atlas.Type type : Atlas.Type.values()) {
    for (int width=mEnd; width > mStart; width-=mStep) {
      for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
        if (width * height <= mThreshold)         continue;
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            break;
          }
        }
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (int width=mEnd; width > mStart; width-=mStep) {
    for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
      if (width * height <= mThreshold)       continue;
      boolean packSuccess=false;
      for (      Atlas.Type type : Atlas.Type.values()) {
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            packSuccess=true;
            break;
          }
        }
      }
      if (!packSuccess) {
        break;
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}
Program: 192892
Project: 192892
Buggy source:
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (  Atlas.Type type : Atlas.Type.values()) {
    for (int width=mEnd; width > mStart; width-=mStep) {
      for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
        if (width * height <= mThreshold)         continue;
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            break;
          }
        }
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (DEBUG_ATLAS)   Log.d(LOG_TAG,"String_Node_Str" + Thread.currentThread().getName());
  Atlas.Entry entry=new Atlas.Entry();
  for (int width=mEnd; width > mStart; width-=mStep) {
    for (int height=MAX_SIZE; height > MIN_SIZE; height-=STEP) {
      if (width * height <= mThreshold)       continue;
      boolean packSuccess=false;
      for (      Atlas.Type type : Atlas.Type.values()) {
        final int count=packBitmaps(type,width,height,entry);
        if (count > 0) {
          mResults.add(new WorkerResult(type,width,height,count));
          if (count == mBitmaps.size()) {
            packSuccess=true;
            break;
          }
        }
      }
      if (!packSuccess) {
        break;
      }
    }
  }
  if (mSignal != null) {
    mSignal.countDown();
  }
}
Program: 192893
Project: 192893
Buggy source:
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  exitIdleInternal(reason);
}

Fixed version (ground truth):
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    exitIdleInternal(reason);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192894
Project: 192894
Buggy source:
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  addPowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    addPowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192895
Project: 192895
Buggy source:
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  removePowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    removePowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192896
Project: 192896
Buggy source:
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  exitIdleInternal(reason);
}

Fixed version (ground truth):
@Override public void exitIdle(String reason){
  getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    exitIdleInternal(reason);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192897
Project: 192897
Buggy source:
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  addPowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void addPowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    addPowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192898
Project: 192898
Buggy source:
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  removePowerSaveWhitelistAppInternal(name);
}

Fixed version (ground truth):
@Override public void removePowerSaveWhitelistApp(String name){
  getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,null);
  long ident=Binder.clearCallingIdentity();
  try {
    removePowerSaveWhitelistAppInternal(name);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 192899
Project: 192899
Buggy source:
@Override protected void createPopupWindow(){
  mPopupWindow=new CustomPopupWindow(mTextView.getContext(),com.android.internal.R.attr.textSuggestionsWindowStyle);
  mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
  mPopupWindow.setFocusable(true);
  mPopupWindow.setClippingEnabled(false);
}

Fixed version (ground truth):
@Override protected void createPopupWindow(){
  mPopupWindow=new CustomPopupWindow();
  mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
  mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  mPopupWindow.setFocusable(true);
  mPopupWindow.setClippingEnabled(false);
}
Program: 192900
Project: 192900
Buggy source:
@Override protected void createPopupWindow(){
  mPopupWindow=new CustomPopupWindow(mTextView.getContext(),com.android.internal.R.attr.textSuggestionsWindowStyle);
  mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
  mPopupWindow.setFocusable(true);
  mPopupWindow.setClippingEnabled(false);
}

Fixed version (ground truth):
@Override protected void createPopupWindow(){
  mPopupWindow=new CustomPopupWindow();
  mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
  mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  mPopupWindow.setFocusable(true);
  mPopupWindow.setClippingEnabled(false);
}
Program: 192901
Project: 192901
Buggy source:
public void updateRunningAccounts(){
  if (Log.isLoggable(TAG,Log.VERBOSE))   Log.v(TAG,"String_Node_Str");
  mSyncHandler.sendEmptyMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED);
}

Fixed version (ground truth):
private void updateRunningAccounts(boolean resyncAllTargets){
  if (Log.isLoggable(TAG,Log.VERBOSE))   Log.v(TAG,"String_Node_Str");
  Message m=mSyncHandler.obtainMessage(SyncHandler.MESSAGE_ACCOUNTS_UPDATED);
  m.arg1=resyncAllTargets ? 1 : 0;
  m.sendToTarget();
}
Program: 192902
Project: 192902
Buggy source:
private void onUserRemoved(int userId){
  updateRunningAccounts();
  mSyncStorageEngine.doDatabaseCleanup(new Account[0],userId);
synchronized (mSyncQueue) {
    mSyncQueue.removeUserLocked(userId);
  }
}

Fixed version (ground truth):
private void onUserRemoved(int userId){
  updateRunningAccounts(false);
  mSyncStorageEngine.doDatabaseCleanup(new Account[0],userId);
synchronized (mSyncQueue) {
    mSyncQueue.removeUserLocked(userId);
  }
}
Program: 192903
Project: 192903
Buggy source:
private void onUserStopping(int userId){
  updateRunningAccounts();
  cancelActiveSync(new SyncStorageEngine.EndPoint(null,null,userId),null);
}

Fixed version (ground truth):
private void onUserStopping(int userId){
  updateRunningAccounts(false);
  cancelActiveSync(new SyncStorageEngine.EndPoint(null,null,userId),null);
}
Program: 192904
Project: 192904
Buggy source:
private void onUserUnlocked(int userId){
  AccountManagerService.getSingleton().validateAccounts(userId);
  mSyncAdapters.invalidateCache(userId);
  updateRunningAccounts();
synchronized (mSyncQueue) {
    mSyncQueue.addPendingOperations(userId);
  }
  final Account[] accounts=AccountManagerService.getSingleton().getAccounts(userId,mContext.getOpPackageName());
  for (  Account account : accounts) {
    scheduleSync(account,userId,SyncOperation.REASON_USER_START,null,null,0,0,true);
  }
  sendCheckAlarmsMessage();
}

Fixed version (ground truth):
private void onUserUnlocked(int userId){
  AccountManagerService.getSingleton().validateAccounts(userId);
  mSyncAdapters.invalidateCache(userId);
  updateRunningAccounts(false);
synchronized (mSyncQueue) {
    mSyncQueue.addPendingOperations(userId);
  }
  final Account[] accounts=AccountManagerService.getSingleton().getAccounts(userId,mContext.getOpPackageName());
  for (  Account account : accounts) {
    scheduleSync(account,userId,SyncOperation.REASON_USER_START,null,null,0,0,true);
  }
  sendCheckAlarmsMessage();
}
Program: 192905
Project: 192905
Buggy source:
private void updateRunningAccountsH(){
  mRunningAccounts=AccountManagerService.getSingleton().getRunningAccounts();
  if (mBootCompleted) {
    doDatabaseCleanup();
  }
  AccountAndUser[] accounts=mRunningAccounts;
  for (  ActiveSyncContext currentSyncContext : mActiveSyncContexts) {
    if (!containsAccountAndUser(accounts,currentSyncContext.mSyncOperation.target.account,currentSyncContext.mSyncOperation.target.userId)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(currentSyncContext,null);
    }
  }
  sendCheckAlarmsMessage();
}

Fixed version (ground truth):
private void updateRunningAccountsH(boolean resyncAll){
  mRunningAccounts=AccountManagerService.getSingleton().getRunningAccounts();
  if (mBootCompleted) {
    doDatabaseCleanup();
  }
  AccountAndUser[] accounts=mRunningAccounts;
  for (  ActiveSyncContext currentSyncContext : mActiveSyncContexts) {
    if (!containsAccountAndUser(accounts,currentSyncContext.mSyncOperation.target.account,currentSyncContext.mSyncOperation.target.userId)) {
      Log.d(TAG,"String_Node_Str");
      sendSyncFinishedOrCanceledMessage(currentSyncContext,null);
    }
  }
  if (resyncAll) {
    scheduleSync(null,UserHandle.USER_ALL,SyncOperation.REASON_ACCOUNTS_UPDATED,null,null,0,0,false);
  }
 else {
    sendCheckAlarmsMessage();
  }
}
Program: 192907
Project: 192907
Buggy source:
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}

Fixed version (ground truth):
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",targetClass.getSimpleName(),methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}
Program: 192912
Project: 192912
Buggy source:
void setTransparentRegionWindow(Session session,IWindow client,Region region){
  long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      WindowState w=windowForClientLocked(session,client,false);
      if (SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + region,null);
      if ((w != null) && w.mHasSurface) {
        w.mWinAnimator.setTransparentRegionHintLocked(region);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
void setTransparentRegionWindow(Session session,IWindow client,Region region){
  long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      WindowState w=windowForClientLocked(session,client,false);
      if (SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + region,false);
      if ((w != null) && w.mHasSurface) {
        w.mWinAnimator.setTransparentRegionHintLocked(region);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 192913
Project: 192913
Buggy source:
private void startAppFreezingScreenLocked(AppWindowToken wtoken){
  if (DEBUG_ORIENTATION) {
    RuntimeException e=null;
    if (!HIDE_STACK_CRAWLS) {
      e=new RuntimeException();
      e.fillInStackTrace();
    }
    Slog.i(TAG_WM,"String_Node_Str" + wtoken.appToken + "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.mAppAnimator.freezingScreen,e);
  }
  if (!wtoken.hiddenRequested) {
    if (!wtoken.mAppAnimator.freezingScreen) {
      wtoken.mAppAnimator.freezingScreen=true;
      wtoken.mAppAnimator.lastFreezeDuration=0;
      mAppsFreezingScreen++;
      if (mAppsFreezingScreen == 1) {
        startFreezingDisplayLocked(false,0,0);
        mH.removeMessages(H.APP_FREEZE_TIMEOUT);
        mH.sendEmptyMessageDelayed(H.APP_FREEZE_TIMEOUT,2000);
      }
    }
    final int N=wtoken.allAppWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=wtoken.allAppWindows.get(i);
      w.mAppFreezing=true;
    }
  }
}

Fixed version (ground truth):
private void startAppFreezingScreenLocked(AppWindowToken wtoken){
  if (DEBUG_ORIENTATION)   logWithStack(TAG,"String_Node_Str" + wtoken.appToken + "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.mAppAnimator.freezingScreen);
  if (!wtoken.hiddenRequested) {
    if (!wtoken.mAppAnimator.freezingScreen) {
      wtoken.mAppAnimator.freezingScreen=true;
      wtoken.mAppAnimator.lastFreezeDuration=0;
      mAppsFreezingScreen++;
      if (mAppsFreezingScreen == 1) {
        startFreezingDisplayLocked(false,0,0);
        mH.removeMessages(H.APP_FREEZE_TIMEOUT);
        mH.sendEmptyMessageDelayed(H.APP_FREEZE_TIMEOUT,2000);
      }
    }
    final int N=wtoken.allAppWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=wtoken.allAppWindows.get(i);
      w.mAppFreezing=true;
    }
  }
}
Program: 192914
Project: 192914
Buggy source:
static void logSurface(SurfaceControl s,String title,String msg,RuntimeException where){
  String str="String_Node_Str" + s + "String_Node_Str"+ msg+ "String_Node_Str"+ title;
  if (where != null) {
    Slog.i(TAG_WM,str,where);
  }
 else {
    Slog.i(TAG_WM,str);
  }
}

Fixed version (ground truth):
static void logSurface(SurfaceControl s,String title,String msg){
  String str="String_Node_Str" + s + "String_Node_Str"+ msg+ "String_Node_Str"+ title;
  Slog.i(TAG_WM,str);
}
Program: 192918
Project: 192918
Buggy source:
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  if (SHOW_TRANSACTIONS)   WindowManagerService.logSurface(mWin,"String_Node_Str",null);
  if (mSurfaceController != null) {
    mSurfaceController.setLayer(mAnimLayer + 1);
  }
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}

Fixed version (ground truth):
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  if (SHOW_TRANSACTIONS)   WindowManagerService.logSurface(mWin,"String_Node_Str",false);
  if (mSurfaceController != null) {
    mSurfaceController.setLayer(mAnimLayer + 1);
  }
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}
Program: 192920
Project: 192920
Buggy source:
void destroyDeferredSurfaceLocked(){
  try {
    if (mPendingDestroySurface != null) {
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        RuntimeException e=null;
        if (!HIDE_STACK_CRAWLS) {
          e=new RuntimeException();
          e.fillInStackTrace();
        }
        WindowManagerService.logSurface(mWin,"String_Node_Str",e);
      }
      mPendingDestroySurface.destroyInTransaction();
      if (!mDestroyPreservedSurfaceUponRedraw) {
        mWallpaperControllerLocked.hideWallpapers(mWin);
      }
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ mPendingDestroySurface+ "String_Node_Str"+ mSession+ "String_Node_Str"+ e.toString());
  }
  mSurfaceDestroyDeferred=false;
  mPendingDestroySurface=null;
}

Fixed version (ground truth):
void destroyDeferredSurfaceLocked(){
  try {
    if (mPendingDestroySurface != null) {
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        WindowManagerService.logSurface(mWin,"String_Node_Str",true);
      }
      mPendingDestroySurface.destroyInTransaction();
      if (!mDestroyPreservedSurfaceUponRedraw) {
        mWallpaperControllerLocked.hideWallpapers(mWin);
      }
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ mPendingDestroySurface+ "String_Node_Str"+ mSession+ "String_Node_Str"+ e.toString());
  }
  mSurfaceDestroyDeferred=false;
  mPendingDestroySurface=null;
}
Program: 192921
Project: 192921
Buggy source:
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}

Fixed version (ground truth):
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",targetClass.getSimpleName(),methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}
Program: 192926
Project: 192926
Buggy source:
void setTransparentRegionWindow(Session session,IWindow client,Region region){
  long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      WindowState w=windowForClientLocked(session,client,false);
      if (SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + region,null);
      if ((w != null) && w.mHasSurface) {
        w.mWinAnimator.setTransparentRegionHintLocked(region);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
void setTransparentRegionWindow(Session session,IWindow client,Region region){
  long origId=Binder.clearCallingIdentity();
  try {
synchronized (mWindowMap) {
      WindowState w=windowForClientLocked(session,client,false);
      if (SHOW_TRANSACTIONS)       WindowManagerService.logSurface(w,"String_Node_Str" + region,false);
      if ((w != null) && w.mHasSurface) {
        w.mWinAnimator.setTransparentRegionHintLocked(region);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 192927
Project: 192927
Buggy source:
private void startAppFreezingScreenLocked(AppWindowToken wtoken){
  if (DEBUG_ORIENTATION) {
    RuntimeException e=null;
    if (!HIDE_STACK_CRAWLS) {
      e=new RuntimeException();
      e.fillInStackTrace();
    }
    Slog.i(TAG_WM,"String_Node_Str" + wtoken.appToken + "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.mAppAnimator.freezingScreen,e);
  }
  if (!wtoken.hiddenRequested) {
    if (!wtoken.mAppAnimator.freezingScreen) {
      wtoken.mAppAnimator.freezingScreen=true;
      wtoken.mAppAnimator.lastFreezeDuration=0;
      mAppsFreezingScreen++;
      if (mAppsFreezingScreen == 1) {
        startFreezingDisplayLocked(false,0,0);
        mH.removeMessages(H.APP_FREEZE_TIMEOUT);
        mH.sendEmptyMessageDelayed(H.APP_FREEZE_TIMEOUT,2000);
      }
    }
    final int N=wtoken.allAppWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=wtoken.allAppWindows.get(i);
      w.mAppFreezing=true;
    }
  }
}

Fixed version (ground truth):
private void startAppFreezingScreenLocked(AppWindowToken wtoken){
  if (DEBUG_ORIENTATION)   logWithStack(TAG,"String_Node_Str" + wtoken.appToken + "String_Node_Str"+ wtoken.hidden+ "String_Node_Str"+ wtoken.mAppAnimator.freezingScreen);
  if (!wtoken.hiddenRequested) {
    if (!wtoken.mAppAnimator.freezingScreen) {
      wtoken.mAppAnimator.freezingScreen=true;
      wtoken.mAppAnimator.lastFreezeDuration=0;
      mAppsFreezingScreen++;
      if (mAppsFreezingScreen == 1) {
        startFreezingDisplayLocked(false,0,0);
        mH.removeMessages(H.APP_FREEZE_TIMEOUT);
        mH.sendEmptyMessageDelayed(H.APP_FREEZE_TIMEOUT,2000);
      }
    }
    final int N=wtoken.allAppWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=wtoken.allAppWindows.get(i);
      w.mAppFreezing=true;
    }
  }
}
Program: 192928
Project: 192928
Buggy source:
static void logSurface(SurfaceControl s,String title,String msg,RuntimeException where){
  String str="String_Node_Str" + s + "String_Node_Str"+ msg+ "String_Node_Str"+ title;
  if (where != null) {
    Slog.i(TAG_WM,str,where);
  }
 else {
    Slog.i(TAG_WM,str);
  }
}

Fixed version (ground truth):
static void logSurface(SurfaceControl s,String title,String msg){
  String str="String_Node_Str" + s + "String_Node_Str"+ msg+ "String_Node_Str"+ title;
  Slog.i(TAG_WM,str);
}
Program: 192932
Project: 192932
Buggy source:
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  if (SHOW_TRANSACTIONS)   WindowManagerService.logSurface(mWin,"String_Node_Str",null);
  if (mSurfaceController != null) {
    mSurfaceController.setLayer(mAnimLayer + 1);
  }
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}

Fixed version (ground truth):
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  if (SHOW_TRANSACTIONS)   WindowManagerService.logSurface(mWin,"String_Node_Str",false);
  if (mSurfaceController != null) {
    mSurfaceController.setLayer(mAnimLayer + 1);
  }
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}
Program: 192934
Project: 192934
Buggy source:
void destroyDeferredSurfaceLocked(){
  try {
    if (mPendingDestroySurface != null) {
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        RuntimeException e=null;
        if (!HIDE_STACK_CRAWLS) {
          e=new RuntimeException();
          e.fillInStackTrace();
        }
        WindowManagerService.logSurface(mWin,"String_Node_Str",e);
      }
      mPendingDestroySurface.destroyInTransaction();
      if (!mDestroyPreservedSurfaceUponRedraw) {
        mWallpaperControllerLocked.hideWallpapers(mWin);
      }
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ mPendingDestroySurface+ "String_Node_Str"+ mSession+ "String_Node_Str"+ e.toString());
  }
  mSurfaceDestroyDeferred=false;
  mPendingDestroySurface=null;
}

Fixed version (ground truth):
void destroyDeferredSurfaceLocked(){
  try {
    if (mPendingDestroySurface != null) {
      if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
        WindowManagerService.logSurface(mWin,"String_Node_Str",true);
      }
      mPendingDestroySurface.destroyInTransaction();
      if (!mDestroyPreservedSurfaceUponRedraw) {
        mWallpaperControllerLocked.hideWallpapers(mWin);
      }
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ mPendingDestroySurface+ "String_Node_Str"+ mSession+ "String_Node_Str"+ e.toString());
  }
  mSurfaceDestroyDeferred=false;
  mPendingDestroySurface=null;
}
Program: 192935
Project: 192935
Buggy source:
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}

Fixed version (ground truth):
private static long registerMethod(Class<?> targetClass,String methodName,Class[] types,int nArgs){
  String methodIndexName=String.format("String_Node_Str",targetClass.getSimpleName(),methodName,nArgs);
synchronized (sMethodIndexLock) {
    Long methodId=METHOD_NAME_TO_ID.get(methodIndexName);
    if (methodId != null) {
      return methodId;
    }
    Class[] args=new Class[nArgs];
    Method method=null;
    for (    Class typeVariant : types) {
      for (int i=0; i < nArgs; i++) {
        args[i]=typeVariant;
      }
      try {
        method=targetClass.getDeclaredMethod(methodName,args);
      }
 catch (      NoSuchMethodException ignore) {
      }
    }
    if (method != null) {
      methodId=sNextId++;
      ID_TO_METHOD.put(methodId,method);
      METHOD_NAME_TO_ID.put(methodIndexName,methodId);
      return methodId;
    }
  }
  return 0;
}
Program: 192937
Project: 192937
Buggy source:
/** 
 * Original bounds of the task if applicable, otherwise fullscreen rect. 
 */
public void getBounds(Rect out){
  if (useCurrentBounds()) {
    out.set(mBounds);
    return;
  }
  mStack.getDisplayContent().getLogicalDisplayRect(out);
}

Fixed version (ground truth):
/** 
 * Original bounds of the task if applicable, otherwise fullscreen rect. 
 */
void getBounds(Rect out){
  if (useCurrentBounds()) {
    out.set(mBounds);
    return;
  }
  mStack.getDisplayContent().getLogicalDisplayRect(out);
}
Program: 192938
Project: 192938
Buggy source:
void getStackDockedModeBoundsLocked(Rect outBounds){
  if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
    outBounds.set(mBounds);
    return;
  }
  final TaskStack dockedStack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (dockedStack == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!dockedStack.isVisibleLocked()) {
    mDisplayContent.getLogicalDisplayRect(mTmpRect);
    return;
  }
  final int dockedSide=dockedStack.getDockSide();
  if (dockedSide == DOCKED_INVALID) {
    Slog.e(TAG_WM,"String_Node_Str" + dockedStack);
    outBounds.set(mBounds);
    return;
  }
  mDisplayContent.getLogicalDisplayRect(mTmpRect);
  dockedStack.getRawBounds(mTmpRect2);
  final boolean dockedOnTopOrLeft=dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT;
  getStackDockedModeBounds(mTmpRect,outBounds,mStackId,mTmpRect2,mDisplayContent.mDividerControllerLocked.getContentWidth(),dockedOnTopOrLeft);
}

Fixed version (ground truth):
void getStackDockedModeBoundsLocked(Rect outBounds,boolean ignoreVisibilityOnKeyguardShowing){
  if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
    outBounds.set(mBounds);
    return;
  }
  final TaskStack dockedStack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (dockedStack == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!dockedStack.isVisibleLocked(ignoreVisibilityOnKeyguardShowing)) {
    mDisplayContent.getLogicalDisplayRect(outBounds);
    return;
  }
  final int dockedSide=dockedStack.getDockSide();
  if (dockedSide == DOCKED_INVALID) {
    Slog.e(TAG_WM,"String_Node_Str" + dockedStack);
    outBounds.set(mBounds);
    return;
  }
  mDisplayContent.getLogicalDisplayRect(mTmpRect);
  dockedStack.getRawBounds(mTmpRect2);
  final boolean dockedOnTopOrLeft=dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT;
  getStackDockedModeBounds(mTmpRect,outBounds,mStackId,mTmpRect2,mDisplayContent.mDividerControllerLocked.getContentWidth(),dockedOnTopOrLeft);
}
Program: 192939
Project: 192939
Buggy source:
boolean isVisibleLocked(){
  final boolean keyguardOn=mService.mPolicy.isKeyguardShowingOrOccluded();
  if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
    return false;
  }
  for (int i=mTasks.size() - 1; i >= 0; i--) {
    Task task=mTasks.get(i);
    for (int j=task.mAppTokens.size() - 1; j >= 0; j--) {
      if (!task.mAppTokens.get(j).hidden) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
boolean isVisibleLocked(boolean ignoreVisibilityOnKeyguardShowing){
  final boolean keyguardOn=mService.mPolicy.isKeyguardShowingOrOccluded();
  if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
    return ignoreVisibilityOnKeyguardShowing;
  }
  for (int i=mTasks.size() - 1; i >= 0; i--) {
    Task task=mTasks.get(i);
    for (int j=task.mAppTokens.size() - 1; j >= 0; j--) {
      if (!task.mAppTokens.get(j).hidden) {
        return true;
      }
    }
  }
  return false;
}
Program: 192940
Project: 192940
Buggy source:
public void getStackDockedModeBounds(int stackId,Rect bounds){
synchronized (mWindowMap) {
    final TaskStack stack=mStackIdToStack.get(stackId);
    if (stack != null) {
      stack.getStackDockedModeBoundsLocked(bounds);
      return;
    }
    bounds.setEmpty();
  }
}

Fixed version (ground truth):
public void getStackDockedModeBounds(int stackId,Rect bounds,boolean ignoreVisibilityOnKeyguardShowing){
synchronized (mWindowMap) {
    final TaskStack stack=mStackIdToStack.get(stackId);
    if (stack != null) {
      stack.getStackDockedModeBoundsLocked(bounds,ignoreVisibilityOnKeyguardShowing);
      return;
    }
    bounds.setEmpty();
  }
}
Program: 192942
Project: 192942
Buggy source:
/** 
 * Original bounds of the task if applicable, otherwise fullscreen rect. 
 */
public void getBounds(Rect out){
  if (useCurrentBounds()) {
    out.set(mBounds);
    return;
  }
  mStack.getDisplayContent().getLogicalDisplayRect(out);
}

Fixed version (ground truth):
/** 
 * Original bounds of the task if applicable, otherwise fullscreen rect. 
 */
void getBounds(Rect out){
  if (useCurrentBounds()) {
    out.set(mBounds);
    return;
  }
  mStack.getDisplayContent().getLogicalDisplayRect(out);
}
Program: 192943
Project: 192943
Buggy source:
void getStackDockedModeBoundsLocked(Rect outBounds){
  if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
    outBounds.set(mBounds);
    return;
  }
  final TaskStack dockedStack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (dockedStack == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!dockedStack.isVisibleLocked()) {
    mDisplayContent.getLogicalDisplayRect(mTmpRect);
    return;
  }
  final int dockedSide=dockedStack.getDockSide();
  if (dockedSide == DOCKED_INVALID) {
    Slog.e(TAG_WM,"String_Node_Str" + dockedStack);
    outBounds.set(mBounds);
    return;
  }
  mDisplayContent.getLogicalDisplayRect(mTmpRect);
  dockedStack.getRawBounds(mTmpRect2);
  final boolean dockedOnTopOrLeft=dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT;
  getStackDockedModeBounds(mTmpRect,outBounds,mStackId,mTmpRect2,mDisplayContent.mDividerControllerLocked.getContentWidth(),dockedOnTopOrLeft);
}

Fixed version (ground truth):
void getStackDockedModeBoundsLocked(Rect outBounds,boolean ignoreVisibilityOnKeyguardShowing){
  if (!StackId.isResizeableByDockedStack(mStackId) || mDisplayContent == null) {
    outBounds.set(mBounds);
    return;
  }
  final TaskStack dockedStack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (dockedStack == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!dockedStack.isVisibleLocked(ignoreVisibilityOnKeyguardShowing)) {
    mDisplayContent.getLogicalDisplayRect(outBounds);
    return;
  }
  final int dockedSide=dockedStack.getDockSide();
  if (dockedSide == DOCKED_INVALID) {
    Slog.e(TAG_WM,"String_Node_Str" + dockedStack);
    outBounds.set(mBounds);
    return;
  }
  mDisplayContent.getLogicalDisplayRect(mTmpRect);
  dockedStack.getRawBounds(mTmpRect2);
  final boolean dockedOnTopOrLeft=dockedSide == DOCKED_TOP || dockedSide == DOCKED_LEFT;
  getStackDockedModeBounds(mTmpRect,outBounds,mStackId,mTmpRect2,mDisplayContent.mDividerControllerLocked.getContentWidth(),dockedOnTopOrLeft);
}
Program: 192944
Project: 192944
Buggy source:
boolean isVisibleLocked(){
  final boolean keyguardOn=mService.mPolicy.isKeyguardShowingOrOccluded();
  if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
    return false;
  }
  for (int i=mTasks.size() - 1; i >= 0; i--) {
    Task task=mTasks.get(i);
    for (int j=task.mAppTokens.size() - 1; j >= 0; j--) {
      if (!task.mAppTokens.get(j).hidden) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
boolean isVisibleLocked(boolean ignoreVisibilityOnKeyguardShowing){
  final boolean keyguardOn=mService.mPolicy.isKeyguardShowingOrOccluded();
  if (keyguardOn && !StackId.isAllowedOverLockscreen(mStackId)) {
    return ignoreVisibilityOnKeyguardShowing;
  }
  for (int i=mTasks.size() - 1; i >= 0; i--) {
    Task task=mTasks.get(i);
    for (int j=task.mAppTokens.size() - 1; j >= 0; j--) {
      if (!task.mAppTokens.get(j).hidden) {
        return true;
      }
    }
  }
  return false;
}
Program: 192945
Project: 192945
Buggy source:
public void getStackDockedModeBounds(int stackId,Rect bounds){
synchronized (mWindowMap) {
    final TaskStack stack=mStackIdToStack.get(stackId);
    if (stack != null) {
      stack.getStackDockedModeBoundsLocked(bounds);
      return;
    }
    bounds.setEmpty();
  }
}

Fixed version (ground truth):
public void getStackDockedModeBounds(int stackId,Rect bounds,boolean ignoreVisibilityOnKeyguardShowing){
synchronized (mWindowMap) {
    final TaskStack stack=mStackIdToStack.get(stackId);
    if (stack != null) {
      stack.getStackDockedModeBoundsLocked(bounds,ignoreVisibilityOnKeyguardShowing);
      return;
    }
    bounds.setEmpty();
  }
}
Program: 192946
Project: 192946
Buggy source:
/** 
 * @return whether there are any docked tasks.
 */
public boolean hasDockedTask(){
  if (mIam == null)   return false;
  ActivityManager.StackInfo stackInfo=null;
  try {
    stackInfo=mIam.getStackInfo(DOCKED_STACK_ID);
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
  return stackInfo != null;
}

Fixed version (ground truth):
/** 
 * @return whether there are any docked tasks for the current user.
 */
public boolean hasDockedTask(){
  if (mIam == null)   return false;
  ActivityManager.StackInfo stackInfo=null;
  try {
    stackInfo=mIam.getStackInfo(DOCKED_STACK_ID);
    if (stackInfo != null && stackInfo.userId != getCurrentUser()) {
      return false;
    }
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
  return stackInfo != null;
}
Program: 192947
Project: 192947
Buggy source:
void updateDisplayInfo(final DisplayContent displayContent){
  if (displayContent == null) {
    return;
  }
  if (mFullscreen) {
    setBounds(null,Configuration.EMPTY);
    return;
  }
  final int newRotation=displayContent.getDisplayInfo().rotation;
  if (mRotation == newRotation) {
    return;
  }
  mTmpRect2.set(mPreScrollBounds);
  displayContent.rotateBounds(mRotation,newRotation,mTmpRect2);
  if (setBounds(mTmpRect2,mOverrideConfig) != BOUNDS_CHANGE_NONE) {
    if (mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
      mService.mH.sendMessage(mService.mH.obtainMessage(RESIZE_TASK,mTaskId,RESIZE_MODE_SYSTEM_SCREEN_ROTATION,mPreScrollBounds));
    }
  }
}

Fixed version (ground truth):
void updateDisplayInfo(final DisplayContent displayContent){
  if (displayContent == null) {
    return;
  }
  if (mFullscreen) {
    setBounds(null,Configuration.EMPTY);
    return;
  }
  final int newRotation=displayContent.getDisplayInfo().rotation;
  if (mRotation == newRotation) {
    return;
  }
  mTmpRect2.set(mPreScrollBounds);
  if (!StackId.isTaskResizeAllowed(mStack.mStackId)) {
    setBounds(mTmpRect2,mOverrideConfig);
    return;
  }
  displayContent.rotateBounds(mRotation,newRotation,mTmpRect2);
  if (setBounds(mTmpRect2,mOverrideConfig) != BOUNDS_CHANGE_NONE) {
    mService.mH.obtainMessage(RESIZE_TASK,mTaskId,RESIZE_MODE_SYSTEM_SCREEN_ROTATION,mPreScrollBounds).sendToTarget();
  }
}
Program: 192948
Project: 192948
Buggy source:
void updateDisplayInfo(final DisplayContent displayContent){
  if (displayContent == null) {
    return;
  }
  if (mFullscreen) {
    setBounds(null,Configuration.EMPTY);
    return;
  }
  final int newRotation=displayContent.getDisplayInfo().rotation;
  if (mRotation == newRotation) {
    return;
  }
  mTmpRect2.set(mPreScrollBounds);
  displayContent.rotateBounds(mRotation,newRotation,mTmpRect2);
  if (setBounds(mTmpRect2,mOverrideConfig) != BOUNDS_CHANGE_NONE) {
    if (mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
      mService.mH.sendMessage(mService.mH.obtainMessage(RESIZE_TASK,mTaskId,RESIZE_MODE_SYSTEM_SCREEN_ROTATION,mPreScrollBounds));
    }
  }
}

Fixed version (ground truth):
void updateDisplayInfo(final DisplayContent displayContent){
  if (displayContent == null) {
    return;
  }
  if (mFullscreen) {
    setBounds(null,Configuration.EMPTY);
    return;
  }
  final int newRotation=displayContent.getDisplayInfo().rotation;
  if (mRotation == newRotation) {
    return;
  }
  mTmpRect2.set(mPreScrollBounds);
  if (!StackId.isTaskResizeAllowed(mStack.mStackId)) {
    setBounds(mTmpRect2,mOverrideConfig);
    return;
  }
  displayContent.rotateBounds(mRotation,newRotation,mTmpRect2);
  if (setBounds(mTmpRect2,mOverrideConfig) != BOUNDS_CHANGE_NONE) {
    mService.mH.obtainMessage(RESIZE_TASK,mTaskId,RESIZE_MODE_SYSTEM_SCREEN_ROTATION,mPreScrollBounds).sendToTarget();
  }
}
Program: 192949
Project: 192949
Buggy source:
/** 
 * This should be the only way to get the time from the system.
 */
private long checkAndGetTimeLocked(){
  final long actualSystemTime=System.currentTimeMillis();
  final long actualRealtime=SystemClock.elapsedRealtime();
  final long expectedSystemTime=(actualRealtime - mRealTimeSnapshot) + mSystemTimeSnapshot;
  boolean resetBeginIdleTime=false;
  if (Math.abs(actualSystemTime - expectedSystemTime) > TIME_CHANGE_THRESHOLD_MILLIS) {
    if (Math.abs(actualSystemTime - expectedSystemTime) > mAppIdleDurationMillis) {
      mScreenOnSystemTimeSnapshot=actualSystemTime;
      mScreenOnTime=0;
      resetBeginIdleTime=true;
    }
    final int userCount=mUserState.size();
    for (int i=0; i < userCount; i++) {
      final UserUsageStatsService service=mUserState.valueAt(i);
      service.onTimeChanged(expectedSystemTime,actualSystemTime,resetBeginIdleTime);
    }
    mRealTimeSnapshot=actualRealtime;
    mSystemTimeSnapshot=actualSystemTime;
  }
  return actualSystemTime;
}

Fixed version (ground truth):
/** 
 * This should be the only way to get the time from the system.
 */
private long checkAndGetTimeLocked(){
  final long actualSystemTime=System.currentTimeMillis();
  final long actualRealtime=SystemClock.elapsedRealtime();
  final long expectedSystemTime=(actualRealtime - mRealTimeSnapshot) + mSystemTimeSnapshot;
  boolean resetBeginIdleTime=false;
  if (Math.abs(actualSystemTime - expectedSystemTime) > TIME_CHANGE_THRESHOLD_MILLIS) {
    if (Math.abs(actualSystemTime - expectedSystemTime) > mAppIdleDurationMillis) {
      mScreenOnSystemTimeSnapshot=actualSystemTime;
      mScreenOnTime=0;
      resetBeginIdleTime=true;
    }
    final int userCount=mUserState.size();
    for (int i=0; i < userCount; i++) {
      final UserUsageStatsService service=mUserState.valueAt(i);
      service.onTimeChanged(expectedSystemTime,actualSystemTime,mScreenOnTime,resetBeginIdleTime);
    }
    mRealTimeSnapshot=actualRealtime;
    mSystemTimeSnapshot=actualSystemTime;
  }
  return actualSystemTime;
}
Program: 192950
Project: 192950
Buggy source:
void onTimeChanged(long oldTime,long newTime,boolean resetBeginIdleTime){
  persistActiveStats();
  mDatabase.onTimeChanged(newTime - oldTime);
  loadActiveStats(newTime,resetBeginIdleTime);
  refreshAppIdleRollingWindow(newTime);
}

Fixed version (ground truth):
void onTimeChanged(long oldTime,long newTime,long deviceUsageTime,boolean resetBeginIdleTime){
  persistActiveStats();
  mDatabase.onTimeChanged(newTime - oldTime);
  loadActiveStats(newTime,resetBeginIdleTime);
  refreshAppIdleRollingWindow(newTime,deviceUsageTime);
}