Program: 195187
Project: 195187
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public int finishPostLayoutPolicyLw(){
  if (mWinShowWhenLocked != null && mTopFullscreenOpaqueWindowState != null && mWinShowWhenLocked.getAppToken() != mTopFullscreenOpaqueWindowState.getAppToken() && isKeyguardLocked()) {
    mWinShowWhenLocked.getAttrs().flags|=FLAG_SHOW_WALLPAPER;
    mTopFullscreenOpaqueWindowState.hideLw(false);
    mTopFullscreenOpaqueWindowState=mWinShowWhenLocked;
  }
  int changes=0;
  boolean topIsFullscreen=false;
  final WindowManager.LayoutParams lp=(mTopFullscreenOpaqueWindowState != null) ? mTopFullscreenOpaqueWindowState.getAttrs() : null;
  if (!mShowingDream) {
    mDreamingLockscreen=mShowingLockscreen;
    if (mDreamingSleepTokenNeeded) {
      mDreamingSleepTokenNeeded=false;
      mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN,0,1).sendToTarget();
    }
  }
 else {
    if (!mDreamingSleepTokenNeeded) {
      mDreamingSleepTokenNeeded=true;
      mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN,1,1).sendToTarget();
    }
  }
  if (mStatusBar != null) {
    if (DEBUG_LAYOUT)     Slog.i(TAG,"String_Node_Str" + mForceStatusBar + "String_Node_Str"+ mForceStatusBarFromKeyguard+ "String_Node_Str"+ mTopFullscreenOpaqueWindowState);
    if (mForceStatusBar || mForceStatusBarFromKeyguard) {
      if (DEBUG_LAYOUT)       Slog.v(TAG,"String_Node_Str");
      if (mStatusBarController.setBarShowingLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT;
      }
      topIsFullscreen=mTopIsFullscreen && mStatusBar.isAnimatingLw();
      if (mForceStatusBarFromKeyguard && mStatusBarController.isTransientShowing()) {
        mStatusBarController.updateVisibilityLw(false,mLastSystemUiFlags,mLastSystemUiFlags);
      }
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      final int fl=PolicyControl.getWindowFlags(null,lp);
      if (localLOGV) {
        Slog.d(TAG,"String_Node_Str" + mTopFullscreenOpaqueWindowState.getFrameLw() + "String_Node_Str"+ mTopFullscreenOpaqueWindowState.getShownFrameLw());
        Slog.d(TAG,"String_Node_Str" + mTopFullscreenOpaqueWindowState.getAttrs() + "String_Node_Str"+ Integer.toHexString(fl));
      }
      topIsFullscreen=(fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0 || (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
      if (mStatusBarController.isTransientShowing()) {
        if (mStatusBarController.setBarShowingLw(true)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
      }
 else       if (topIsFullscreen) {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str");
        if (mStatusBarController.setBarShowingLw(false)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
 else {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str");
        }
      }
 else {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str");
        if (mStatusBarController.setBarShowingLw(true)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
      }
    }
  }
  if (mTopIsFullscreen != topIsFullscreen) {
    if (!topIsFullscreen) {
      changes|=FINISH_LAYOUT_REDO_LAYOUT;
    }
    mTopIsFullscreen=topIsFullscreen;
  }
  if (mKeyguardDelegate != null && mStatusBar != null) {
    if (localLOGV)     Slog.v(TAG,"String_Node_Str" + mHideLockScreen);
    if (mDismissKeyguard != DISMISS_KEYGUARD_NONE && !mKeyguardSecure) {
      mKeyguardHidden=true;
      if (setKeyguardOccludedLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
      if (mKeyguardDelegate.isShowing()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            mKeyguardDelegate.keyguardDone(false,false);
          }
        }
);
      }
    }
 else     if (mHideLockScreen) {
      mKeyguardHidden=true;
      if (setKeyguardOccludedLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
    }
 else     if (mDismissKeyguard != DISMISS_KEYGUARD_NONE) {
      if (mDismissKeyguard == DISMISS_KEYGUARD_START) {
        mKeyguardHidden=false;
        if (setKeyguardOccludedLw(false)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
        }
        mHandler.post(new Runnable(){
          @Override public void run(){
            mKeyguardDelegate.dismiss();
          }
        }
);
      }
    }
 else {
      mWinDismissingKeyguard=null;
      mKeyguardHidden=false;
      if (setKeyguardOccludedLw(false)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
    }
  }
  if ((updateSystemUiVisibilityLw() & SYSTEM_UI_CHANGING_LAYOUT) != 0) {
    changes|=FINISH_LAYOUT_REDO_LAYOUT;
  }
  updateLockScreenTimeout();
  return changes;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public int finishPostLayoutPolicyLw(){
  if (mWinShowWhenLocked != null && mTopFullscreenOpaqueWindowState != null && mWinShowWhenLocked.getAppToken() != mTopFullscreenOpaqueWindowState.getAppToken() && isKeyguardLocked()) {
    mWinShowWhenLocked.getAttrs().flags|=FLAG_SHOW_WALLPAPER;
    mTopFullscreenOpaqueWindowState.hideLw(false);
    mTopFullscreenOpaqueWindowState=mWinShowWhenLocked;
  }
  int changes=0;
  boolean topIsFullscreen=false;
  final WindowManager.LayoutParams lp=(mTopFullscreenOpaqueWindowState != null) ? mTopFullscreenOpaqueWindowState.getAttrs() : null;
  if (!mShowingDream) {
    mDreamingLockscreen=mShowingLockscreen;
    if (mDreamingSleepTokenNeeded) {
      mDreamingSleepTokenNeeded=false;
      mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN,0,1).sendToTarget();
    }
  }
 else {
    if (!mDreamingSleepTokenNeeded) {
      mDreamingSleepTokenNeeded=true;
      mHandler.obtainMessage(MSG_UPDATE_DREAMING_SLEEP_TOKEN,1,1).sendToTarget();
    }
  }
  if (mStatusBar != null) {
    if (DEBUG_LAYOUT)     Slog.i(TAG,"String_Node_Str" + mForceStatusBar + "String_Node_Str"+ mForceStatusBarFromKeyguard+ "String_Node_Str"+ mTopFullscreenOpaqueWindowState);
    boolean shouldBeTransparent=mForceStatusBarTransparent && !mForceStatusBar && !mForceStatusBarFromKeyguard;
    if (!shouldBeTransparent) {
      mStatusBarController.setShowTransparent(false);
    }
 else     if (!mStatusBar.isVisibleLw()) {
      mStatusBarController.setShowTransparent(true);
    }
    if (mForceStatusBar || mForceStatusBarFromKeyguard || mForceStatusBarTransparent) {
      if (DEBUG_LAYOUT)       Slog.v(TAG,"String_Node_Str");
      if (mStatusBarController.setBarShowingLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT;
      }
      topIsFullscreen=mTopIsFullscreen && mStatusBar.isAnimatingLw();
      if (mForceStatusBarFromKeyguard && mStatusBarController.isTransientShowing()) {
        mStatusBarController.updateVisibilityLw(false,mLastSystemUiFlags,mLastSystemUiFlags);
      }
    }
 else     if (mTopFullscreenOpaqueWindowState != null) {
      final int fl=PolicyControl.getWindowFlags(null,lp);
      if (localLOGV) {
        Slog.d(TAG,"String_Node_Str" + mTopFullscreenOpaqueWindowState.getFrameLw() + "String_Node_Str"+ mTopFullscreenOpaqueWindowState.getShownFrameLw());
        Slog.d(TAG,"String_Node_Str" + mTopFullscreenOpaqueWindowState.getAttrs() + "String_Node_Str"+ Integer.toHexString(fl));
      }
      topIsFullscreen=(fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0 || (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
      if (mStatusBarController.isTransientShowing()) {
        if (mStatusBarController.setBarShowingLw(true)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
      }
 else       if (topIsFullscreen) {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str");
        if (mStatusBarController.setBarShowingLw(false)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
 else {
          if (DEBUG_LAYOUT)           Slog.v(TAG,"String_Node_Str");
        }
      }
 else {
        if (DEBUG_LAYOUT)         Slog.v(TAG,"String_Node_Str");
        if (mStatusBarController.setBarShowingLw(true)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT;
        }
      }
    }
  }
  if (mTopIsFullscreen != topIsFullscreen) {
    if (!topIsFullscreen) {
      changes|=FINISH_LAYOUT_REDO_LAYOUT;
    }
    mTopIsFullscreen=topIsFullscreen;
  }
  if (mKeyguardDelegate != null && mStatusBar != null) {
    if (localLOGV)     Slog.v(TAG,"String_Node_Str" + mHideLockScreen);
    if (mDismissKeyguard != DISMISS_KEYGUARD_NONE && !mKeyguardSecure) {
      mKeyguardHidden=true;
      if (setKeyguardOccludedLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
      if (mKeyguardDelegate.isShowing()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            mKeyguardDelegate.keyguardDone(false,false);
          }
        }
);
      }
    }
 else     if (mHideLockScreen) {
      mKeyguardHidden=true;
      if (setKeyguardOccludedLw(true)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
    }
 else     if (mDismissKeyguard != DISMISS_KEYGUARD_NONE) {
      if (mDismissKeyguard == DISMISS_KEYGUARD_START) {
        mKeyguardHidden=false;
        if (setKeyguardOccludedLw(false)) {
          changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
        }
        mHandler.post(new Runnable(){
          @Override public void run(){
            mKeyguardDelegate.dismiss();
          }
        }
);
      }
    }
 else {
      mWinDismissingKeyguard=null;
      mKeyguardHidden=false;
      if (setKeyguardOccludedLw(false)) {
        changes|=FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG | FINISH_LAYOUT_REDO_WALLPAPER;
      }
    }
  }
  if ((updateSystemUiVisibilityLw() & SYSTEM_UI_CHANGING_LAYOUT) != 0) {
    changes|=FINISH_LAYOUT_REDO_LAYOUT;
  }
  updateLockScreenTimeout();
  return changes;
}