Program: 191230
Project: 191230
Buggy source:
public int getOrientationLocked(){
  if (mDisplayFrozen) {
    if (mLastWindowForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,"String_Node_Str" + mLastWindowForcedOrientation);
      return mLastWindowForcedOrientation;
    }
  }
 else {
    final WindowList windows=getDefaultWindowListLocked();
    for (int pos=windows.size() - 1; pos >= 0; --pos) {
      WindowState win=windows.get(pos);
      if (win.mAppToken != null) {
        break;
      }
      if (!win.isVisibleLw() || !win.mPolicyVisibilityAfterAnim) {
        continue;
      }
      int req=win.mAttrs.screenOrientation;
      if (req == SCREEN_ORIENTATION_UNSPECIFIED || req == SCREEN_ORIENTATION_BEHIND) {
        continue;
      }
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,win + "String_Node_Str" + req);
      if (mPolicy.isKeyguardHostWindow(win.mAttrs)) {
        mLastKeyguardForcedOrientation=req;
      }
      return (mLastWindowForcedOrientation=req);
    }
    mLastWindowForcedOrientation=SCREEN_ORIENTATION_UNSPECIFIED;
    if (mPolicy.isKeyguardLocked()) {
      WindowState winShowWhenLocked=(WindowState)mPolicy.getWinShowWhenLockedLw();
      AppWindowToken appShowWhenLocked=winShowWhenLocked == null ? null : winShowWhenLocked.mAppToken;
      if (appShowWhenLocked != null) {
        int req=appShowWhenLocked.requestedOrientation;
        if (req == SCREEN_ORIENTATION_BEHIND) {
          req=mLastKeyguardForcedOrientation;
        }
        if (DEBUG_ORIENTATION)         Slog.v(TAG_WM,"String_Node_Str" + appShowWhenLocked + "String_Node_Str"+ req);
        return req;
      }
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,"String_Node_Str");
      return mLastKeyguardForcedOrientation;
    }
  }
  return getAppSpecifiedOrientation();
}

Fixed version (ground truth):
public int getOrientationLocked(){
  if (mDisplayFrozen) {
    if (mLastWindowForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,"String_Node_Str" + mLastWindowForcedOrientation);
      return mLastWindowForcedOrientation;
    }
 else     if (mPolicy.isKeyguardLocked() && mLastKeyguardForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) {
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,"String_Node_Str" + "String_Node_Str" + mLastKeyguardForcedOrientation);
      return mLastKeyguardForcedOrientation;
    }
  }
 else {
    final WindowList windows=getDefaultWindowListLocked();
    for (int pos=windows.size() - 1; pos >= 0; --pos) {
      WindowState win=windows.get(pos);
      if (win.mAppToken != null) {
        break;
      }
      if (!win.isVisibleLw() || !win.mPolicyVisibilityAfterAnim) {
        continue;
      }
      int req=win.mAttrs.screenOrientation;
      if (req == SCREEN_ORIENTATION_UNSPECIFIED || req == SCREEN_ORIENTATION_BEHIND) {
        continue;
      }
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,win + "String_Node_Str" + req);
      if (mPolicy.isKeyguardHostWindow(win.mAttrs)) {
        mLastKeyguardForcedOrientation=req;
      }
      return (mLastWindowForcedOrientation=req);
    }
    mLastWindowForcedOrientation=SCREEN_ORIENTATION_UNSPECIFIED;
    if (mPolicy.isKeyguardLocked()) {
      WindowState winShowWhenLocked=(WindowState)mPolicy.getWinShowWhenLockedLw();
      AppWindowToken appShowWhenLocked=winShowWhenLocked == null ? null : winShowWhenLocked.mAppToken;
      if (appShowWhenLocked != null) {
        int req=appShowWhenLocked.requestedOrientation;
        if (req == SCREEN_ORIENTATION_BEHIND) {
          req=mLastKeyguardForcedOrientation;
        }
        if (DEBUG_ORIENTATION)         Slog.v(TAG_WM,"String_Node_Str" + appShowWhenLocked + "String_Node_Str"+ req);
        return req;
      }
      if (DEBUG_ORIENTATION)       Slog.v(TAG_WM,"String_Node_Str");
      return mLastKeyguardForcedOrientation;
    }
  }
  return getAppSpecifiedOrientation();
}