Program: 193658
Project: 193658
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void applyPostLayoutPolicyLw(WindowState win,WindowManager.LayoutParams attrs,WindowState attached){
  if (DEBUG_LAYOUT)   Slog.i(TAG,"String_Node_Str" + win + "String_Node_Str"+ win.isVisibleOrBehindKeyguardLw());
  final int fl=PolicyControl.getWindowFlags(win,attrs);
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleLw() && attrs.type == TYPE_INPUT_METHOD) {
    mForcingShowNavBar=true;
    mForcingShowNavBarLayer=win.getSurfaceLayer();
  }
  if (attrs.type == TYPE_STATUS_BAR) {
    if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
      mForceStatusBarFromKeyguard=true;
    }
    if ((attrs.privateFlags & PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT) != 0) {
      mForceStatusBarTransparent=true;
    }
  }
  boolean appWindow=attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type < FIRST_SYSTEM_WINDOW;
  final boolean showWhenLocked=(fl & FLAG_SHOW_WHEN_LOCKED) != 0;
  final boolean dismissKeyguard=(fl & FLAG_DISMISS_KEYGUARD) != 0;
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()) {
    if ((fl & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
        mForceStatusBarFromKeyguard=true;
      }
 else {
        mForceStatusBar=true;
      }
    }
    if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
      mShowingLockscreen=true;
    }
    if (attrs.type == TYPE_DREAM) {
      if (!mDreamingLockscreen || (win.isVisibleLw() && win.hasDrawnLw())) {
        mShowingDream=true;
        appWindow=true;
      }
    }
    final IApplicationToken appToken=win.getAppToken();
    if (appWindow && attached == null) {
      if (showWhenLocked) {
        mAppsToBeHidden.remove(appToken);
        mAppsThatDismissKeyguard.remove(appToken);
        if (mAppsToBeHidden.isEmpty()) {
          if (dismissKeyguard && !mKeyguardSecure) {
            mAppsThatDismissKeyguard.add(appToken);
          }
 else           if (win.isDrawnLw()) {
            mWinShowWhenLocked=win;
            mHideLockScreen=true;
            mForceStatusBarFromKeyguard=false;
          }
        }
      }
 else       if (dismissKeyguard) {
        if (mKeyguardSecure) {
          mAppsToBeHidden.add(appToken);
        }
 else {
          mAppsToBeHidden.remove(appToken);
        }
        mAppsThatDismissKeyguard.add(appToken);
      }
 else {
        mAppsToBeHidden.add(appToken);
      }
      if (attrs.x == 0 && attrs.y == 0 && attrs.width == WindowManager.LayoutParams.MATCH_PARENT && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str" + win);
        mTopFullscreenOpaqueWindowState=win;
        if (mTopFullscreenOpaqueOrDimmingWindowState == null) {
          mTopFullscreenOpaqueOrDimmingWindowState=win;
        }
        if (!mAppsThatDismissKeyguard.isEmpty() && mDismissKeyguard == DISMISS_KEYGUARD_NONE) {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str" + win);
          mDismissKeyguard=(mWinDismissingKeyguard == win && mSecureDismissingKeyguard == mKeyguardSecure) ? DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START;
          mWinDismissingKeyguard=win;
          mSecureDismissingKeyguard=mKeyguardSecure;
          mForceStatusBarFromKeyguard=mShowingLockscreen && mKeyguardSecure;
        }
 else         if (mAppsToBeHidden.isEmpty() && showWhenLocked && win.isDrawnLw()) {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str" + win);
          mHideLockScreen=true;
          mForceStatusBarFromKeyguard=false;
        }
        if ((fl & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
          mAllowLockscreenWhenOn=true;
        }
      }
      if (mWinShowWhenLocked != null && mWinShowWhenLocked.getAppToken() != win.getAppToken() && (attrs.flags & FLAG_SHOW_WHEN_LOCKED) == 0) {
        win.hideLw(false);
      }
    }
  }
 else   if (mTopFullscreenOpaqueWindowState == null && mWinShowWhenLocked == null) {
    if (win.isAnimatingLw() && appWindow && showWhenLocked&& mKeyguardHidden) {
      mHideLockScreen=true;
      mWinShowWhenLocked=win;
    }
  }
  if (mTopFullscreenOpaqueOrDimmingWindowState == null && win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw() && win.isDimming()) {
    mTopFullscreenOpaqueOrDimmingWindowState=win;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void applyPostLayoutPolicyLw(WindowState win,WindowManager.LayoutParams attrs,WindowState attached){
  if (DEBUG_LAYOUT)   Slog.i(TAG,"String_Node_Str" + win + "String_Node_Str"+ win.isVisibleOrBehindKeyguardLw());
  final int fl=PolicyControl.getWindowFlags(win,attrs);
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleLw() && attrs.type == TYPE_INPUT_METHOD) {
    mForcingShowNavBar=true;
    mForcingShowNavBarLayer=win.getSurfaceLayer();
  }
  if (attrs.type == TYPE_STATUS_BAR) {
    if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
      mForceStatusBarFromKeyguard=true;
    }
    if ((attrs.privateFlags & PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT) != 0) {
      mForceStatusBarTransparent=true;
    }
  }
  boolean appWindow=attrs.type >= FIRST_APPLICATION_WINDOW && attrs.type < FIRST_SYSTEM_WINDOW;
  final boolean showWhenLocked=(fl & FLAG_SHOW_WHEN_LOCKED) != 0;
  final boolean dismissKeyguard=(fl & FLAG_DISMISS_KEYGUARD) != 0;
  if (mTopFullscreenOpaqueWindowState == null && win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()) {
    if ((fl & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
      if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
        mForceStatusBarFromKeyguard=true;
      }
 else {
        mForceStatusBar=true;
      }
    }
    if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
      mShowingLockscreen=true;
    }
    if (attrs.type == TYPE_DREAM) {
      if (!mDreamingLockscreen || (win.isVisibleLw() && win.hasDrawnLw())) {
        mShowingDream=true;
        appWindow=true;
      }
    }
    final IApplicationToken appToken=win.getAppToken();
    if (appWindow && attached == null) {
      if (showWhenLocked) {
        mAppsToBeHidden.remove(appToken);
        mAppsThatDismissKeyguard.remove(appToken);
        if (mAppsToBeHidden.isEmpty()) {
          if (dismissKeyguard && !mKeyguardSecure) {
            mAppsThatDismissKeyguard.add(appToken);
          }
 else           if (win.isDrawnLw() || win.hasAppShownWindows()) {
            mWinShowWhenLocked=win;
            mHideLockScreen=true;
            mForceStatusBarFromKeyguard=false;
          }
        }
      }
 else       if (dismissKeyguard) {
        if (mKeyguardSecure) {
          mAppsToBeHidden.add(appToken);
        }
 else {
          mAppsToBeHidden.remove(appToken);
        }
        mAppsThatDismissKeyguard.add(appToken);
      }
 else {
        mAppsToBeHidden.add(appToken);
      }
      if (attrs.x == 0 && attrs.y == 0 && attrs.width == WindowManager.LayoutParams.MATCH_PARENT && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str" + win);
        mTopFullscreenOpaqueWindowState=win;
        if (mTopFullscreenOpaqueOrDimmingWindowState == null) {
          mTopFullscreenOpaqueOrDimmingWindowState=win;
        }
        if (!mAppsThatDismissKeyguard.isEmpty() && mDismissKeyguard == DISMISS_KEYGUARD_NONE) {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str" + win);
          mDismissKeyguard=(mWinDismissingKeyguard == win && mSecureDismissingKeyguard == mKeyguardSecure) ? DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START;
          mWinDismissingKeyguard=win;
          mSecureDismissingKeyguard=mKeyguardSecure;
          mForceStatusBarFromKeyguard=mShowingLockscreen && mKeyguardSecure;
        }
 else         if (mAppsToBeHidden.isEmpty() && showWhenLocked && (win.isDrawnLw() || win.hasAppShownWindows())) {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str" + win);
          mHideLockScreen=true;
          mForceStatusBarFromKeyguard=false;
        }
        if ((fl & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) {
          mAllowLockscreenWhenOn=true;
        }
      }
      if (mWinShowWhenLocked != null && mWinShowWhenLocked.getAppToken() != win.getAppToken() && (attrs.flags & FLAG_SHOW_WHEN_LOCKED) == 0) {
        win.hideLw(false);
      }
    }
  }
 else   if (mTopFullscreenOpaqueWindowState == null && mWinShowWhenLocked == null) {
    if (win.isAnimatingLw() && appWindow && showWhenLocked&& mKeyguardHidden) {
      mHideLockScreen=true;
      mWinShowWhenLocked=win;
    }
  }
  if (mTopFullscreenOpaqueOrDimmingWindowState == null && win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw() && win.isDimming()) {
    mTopFullscreenOpaqueOrDimmingWindowState=win;
  }
}