Program: 43172
Project: 43172
Buggy source:
private void openPanel(PanelFeatureState st,KeyEvent event){
  if (st.isOpen) {
    return;
  }
  Callback cb=getCallback();
  if ((cb != null) && (!cb.onMenuOpened(st.featureId,st.menu))) {
    closePanel(st,true);
    return;
  }
  final WindowManager wm=getWindowManager();
  if (wm == null) {
    return;
  }
  if (!preparePanel(st,event)) {
    return;
  }
  if (st.decorView == null || st.refreshDecorView) {
    if (st.decorView == null) {
      if (!initializePanelDecor(st) || (st.decorView == null))       return;
    }
 else     if (st.refreshDecorView && (st.decorView.getChildCount() > 0)) {
      st.decorView.removeAllViews();
    }
    if (!initializePanelContent(st) || (st.shownPanelView == null)) {
      return;
    }
    ViewGroup.LayoutParams lp=st.shownPanelView.getLayoutParams();
    if (lp == null) {
      lp=new ViewGroup.LayoutParams(WRAP_CONTENT,WRAP_CONTENT);
    }
    int backgroundResId;
    if (lp.width == ViewGroup.LayoutParams.FILL_PARENT) {
      backgroundResId=st.fullBackground;
    }
 else {
      backgroundResId=st.background;
    }
    st.decorView.setWindowBackground(getContext().getResources().getDrawable(backgroundResId));
    st.decorView.addView(st.shownPanelView,lp);
    if (!st.shownPanelView.hasFocus()) {
      st.shownPanelView.requestFocus();
    }
  }
  st.isOpen=true;
  st.isHandled=false;
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WRAP_CONTENT,WRAP_CONTENT,st.x,st.y,WindowManager.LayoutParams.TYPE_APPLICATION_PANEL,WindowManager.LayoutParams.FLAG_DITHER | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,st.decorView.mDefaultOpacity);
  lp.gravity=st.gravity;
  lp.windowAnimations=st.windowAnimations;
  wm.addView(st.decorView,lp);
}

Fixed version (ground truth):
private void openPanel(PanelFeatureState st,KeyEvent event){
  if (st.isOpen) {
    return;
  }
  Callback cb=getCallback();
  if ((cb != null) && (!cb.onMenuOpened(st.featureId,st.menu))) {
    closePanel(st,true);
    return;
  }
  final WindowManager wm=getWindowManager();
  if (wm == null) {
    return;
  }
  if (!preparePanel(st,event)) {
    return;
  }
  if (st.decorView == null || st.refreshDecorView) {
    if (st.decorView == null) {
      if (!initializePanelDecor(st) || (st.decorView == null))       return;
    }
 else     if (st.refreshDecorView && (st.decorView.getChildCount() > 0)) {
      st.decorView.removeAllViews();
    }
    if (!initializePanelContent(st) || (st.shownPanelView == null)) {
      return;
    }
    ViewGroup.LayoutParams lp=st.shownPanelView.getLayoutParams();
    if (lp == null) {
      lp=new ViewGroup.LayoutParams(WRAP_CONTENT,WRAP_CONTENT);
    }
    int backgroundResId;
    if (lp.width == ViewGroup.LayoutParams.FILL_PARENT) {
      backgroundResId=st.fullBackground;
    }
 else {
      backgroundResId=st.background;
    }
    st.decorView.setWindowBackground(getContext().getResources().getDrawable(backgroundResId));
    st.decorView.addView(st.shownPanelView,lp);
    if (!st.shownPanelView.hasFocus()) {
      st.shownPanelView.requestFocus();
    }
  }
  st.isOpen=true;
  st.isHandled=false;
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WRAP_CONTENT,WRAP_CONTENT,st.x,st.y,WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG,WindowManager.LayoutParams.FLAG_DITHER | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,st.decorView.mDefaultOpacity);
  lp.gravity=st.gravity;
  lp.windowAnimations=st.windowAnimations;
  wm.addView(st.decorView,lp);
}