Program: 193230
Project: 193230
Buggy source:
/** 
 * Locked on mService.mWindowMap. 
 */
private void animateLocked(long frameTimeNs){
  if (!mInitialized) {
    return;
  }
  mCurrentTime=frameTimeNs / TimeUtils.NANOS_PER_MS;
  mBulkUpdateParams=SET_ORIENTATION_CHANGE_COMPLETE;
  boolean wasAnimating=mAnimating;
  mAnimating=false;
  mAppWindowAnimating=false;
  if (DEBUG_WINDOW_TRACE) {
    Slog.i(TAG,"String_Node_Str" + mCurrentTime);
  }
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str");
  SurfaceControl.openTransaction();
  SurfaceControl.setAnimationTransaction();
  try {
    final int numDisplays=mDisplayContentsAnimators.size();
    for (int i=0; i < numDisplays; i++) {
      final int displayId=mDisplayContentsAnimators.keyAt(i);
      updateAppWindowsLocked(displayId);
      DisplayContentsAnimator displayAnimator=mDisplayContentsAnimators.valueAt(i);
      final ScreenRotationAnimation screenRotationAnimation=displayAnimator.mScreenRotationAnimation;
      if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
        if (screenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
          mAnimating=true;
        }
 else {
          mBulkUpdateParams|=SET_UPDATE_ROTATION;
          screenRotationAnimation.kill();
          displayAnimator.mScreenRotationAnimation=null;
          if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
            mService.mAccessibilityController.onRotationChangedLocked(mService.getDefaultDisplayContentLocked(),mService.mRotation);
          }
        }
      }
      updateWindowsLocked(displayId);
      updateWallpaperLocked(displayId);
      final WindowList windows=mService.getWindowListLocked(displayId);
      final int N=windows.size();
      for (int j=0; j < N; j++) {
        windows.get(j).mWinAnimator.prepareSurfaceLocked(true);
      }
    }
    for (int i=0; i < numDisplays; i++) {
      final int displayId=mDisplayContentsAnimators.keyAt(i);
      testTokenMayBeDrawnLocked(displayId);
      final ScreenRotationAnimation screenRotationAnimation=mDisplayContentsAnimators.valueAt(i).mScreenRotationAnimation;
      if (screenRotationAnimation != null) {
        screenRotationAnimation.updateSurfacesInTransaction();
      }
      mAnimating|=mService.getDisplayContentLocked(displayId).animateDimLayers();
      if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
        mService.mAccessibilityController.drawMagnifiedRegionBorderIfNeededLocked();
      }
    }
    if (mAnimating) {
      mService.scheduleAnimationLocked();
    }
    if (mService.mWatermark != null) {
      mService.mWatermark.drawIfNeeded();
    }
  }
 catch (  RuntimeException e) {
    Slog.wtf(TAG,"String_Node_Str",e);
  }
 finally {
    SurfaceControl.closeTransaction();
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str");
  }
  boolean hasPendingLayoutChanges=false;
  final int numDisplays=mService.mDisplayContents.size();
  for (int displayNdx=0; displayNdx < numDisplays; ++displayNdx) {
    final DisplayContent displayContent=mService.mDisplayContents.valueAt(displayNdx);
    final int pendingChanges=getPendingLayoutChanges(displayContent.getDisplayId());
    if ((pendingChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
      mBulkUpdateParams|=SET_WALLPAPER_ACTION_PENDING;
    }
    if (pendingChanges != 0) {
      hasPendingLayoutChanges=true;
    }
  }
  boolean doRequest=false;
  if (mBulkUpdateParams != 0) {
    doRequest=mWindowPlacerLocked.copyAnimToLayoutParamsLocked();
  }
  if (hasPendingLayoutChanges || doRequest) {
    mWindowPlacerLocked.requestTraversal();
  }
  if (mAnimating && !wasAnimating && Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
    Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER,"String_Node_Str",0);
  }
  if (!mAnimating && wasAnimating) {
    mWindowPlacerLocked.requestTraversal();
    if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
      Trace.asyncTraceEnd(Trace.TRACE_TAG_WINDOW_MANAGER,"String_Node_Str",0);
    }
  }
  if (mRemoveReplacedWindows) {
    removeReplacedWindowsLocked();
  }
  mService.destroyPreservedSurfaceLocked();
  if (DEBUG_WINDOW_TRACE) {
    Slog.i(TAG,"String_Node_Str" + mAnimating + "String_Node_Str"+ Integer.toHexString(mBulkUpdateParams)+ "String_Node_Str"+ Integer.toHexString(getPendingLayoutChanges(Display.DEFAULT_DISPLAY)));
  }
}

Fixed version (ground truth):
/** 
 * Locked on mService.mWindowMap. 
 */
private void animateLocked(long frameTimeNs){
  if (!mInitialized) {
    return;
  }
  mCurrentTime=frameTimeNs / TimeUtils.NANOS_PER_MS;
  mBulkUpdateParams=SET_ORIENTATION_CHANGE_COMPLETE;
  boolean wasAnimating=mAnimating;
  setAnimating(false);
  mAppWindowAnimating=false;
  if (DEBUG_WINDOW_TRACE) {
    Slog.i(TAG,"String_Node_Str" + mCurrentTime);
  }
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str");
  SurfaceControl.openTransaction();
  SurfaceControl.setAnimationTransaction();
  try {
    final int numDisplays=mDisplayContentsAnimators.size();
    for (int i=0; i < numDisplays; i++) {
      final int displayId=mDisplayContentsAnimators.keyAt(i);
      updateAppWindowsLocked(displayId);
      DisplayContentsAnimator displayAnimator=mDisplayContentsAnimators.valueAt(i);
      final ScreenRotationAnimation screenRotationAnimation=displayAnimator.mScreenRotationAnimation;
      if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
        if (screenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
          setAnimating(true);
        }
 else {
          mBulkUpdateParams|=SET_UPDATE_ROTATION;
          screenRotationAnimation.kill();
          displayAnimator.mScreenRotationAnimation=null;
          if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
            mService.mAccessibilityController.onRotationChangedLocked(mService.getDefaultDisplayContentLocked(),mService.mRotation);
          }
        }
      }
      updateWindowsLocked(displayId);
      updateWallpaperLocked(displayId);
      final WindowList windows=mService.getWindowListLocked(displayId);
      final int N=windows.size();
      for (int j=0; j < N; j++) {
        windows.get(j).mWinAnimator.prepareSurfaceLocked(true);
      }
    }
    for (int i=0; i < numDisplays; i++) {
      final int displayId=mDisplayContentsAnimators.keyAt(i);
      testTokenMayBeDrawnLocked(displayId);
      final ScreenRotationAnimation screenRotationAnimation=mDisplayContentsAnimators.valueAt(i).mScreenRotationAnimation;
      if (screenRotationAnimation != null) {
        screenRotationAnimation.updateSurfacesInTransaction();
      }
      orAnimating(mService.getDisplayContentLocked(displayId).animateDimLayers());
      if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
        mService.mAccessibilityController.drawMagnifiedRegionBorderIfNeededLocked();
      }
    }
    if (mAnimating) {
      mService.scheduleAnimationLocked();
    }
    if (mService.mWatermark != null) {
      mService.mWatermark.drawIfNeeded();
    }
  }
 catch (  RuntimeException e) {
    Slog.wtf(TAG,"String_Node_Str",e);
  }
 finally {
    SurfaceControl.closeTransaction();
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str");
  }
  boolean hasPendingLayoutChanges=false;
  final int numDisplays=mService.mDisplayContents.size();
  for (int displayNdx=0; displayNdx < numDisplays; ++displayNdx) {
    final DisplayContent displayContent=mService.mDisplayContents.valueAt(displayNdx);
    final int pendingChanges=getPendingLayoutChanges(displayContent.getDisplayId());
    if ((pendingChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
      mBulkUpdateParams|=SET_WALLPAPER_ACTION_PENDING;
    }
    if (pendingChanges != 0) {
      hasPendingLayoutChanges=true;
    }
  }
  boolean doRequest=false;
  if (mBulkUpdateParams != 0) {
    doRequest=mWindowPlacerLocked.copyAnimToLayoutParamsLocked();
  }
  if (hasPendingLayoutChanges || doRequest) {
    mWindowPlacerLocked.requestTraversal();
  }
  if (mAnimating && !wasAnimating && Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
    Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER,"String_Node_Str",0);
  }
  if (!mAnimating && wasAnimating) {
    mWindowPlacerLocked.requestTraversal();
    if (Trace.isTagEnabled(Trace.TRACE_TAG_WINDOW_MANAGER)) {
      Trace.asyncTraceEnd(Trace.TRACE_TAG_WINDOW_MANAGER,"String_Node_Str",0);
    }
  }
  if (mRemoveReplacedWindows) {
    removeReplacedWindowsLocked();
  }
  mService.destroyPreservedSurfaceLocked();
  if (DEBUG_WINDOW_TRACE) {
    Slog.i(TAG,"String_Node_Str" + mAnimating + "String_Node_Str"+ Integer.toHexString(mBulkUpdateParams)+ "String_Node_Str"+ Integer.toHexString(getPendingLayoutChanges(Display.DEFAULT_DISPLAY)));
  }
}