Program: 23068
Project: 23068
Buggy source:
private void setBackground(LinearLayout topPanel,LinearLayout contentPanel,View customPanel,boolean hasButtons,TypedArray a,boolean hasTitle,View buttonPanel){
  int fullDark=a.getResourceId(R.styleable.AlertDialog_fullDark,R.drawable.popup_full_dark);
  int topDark=a.getResourceId(R.styleable.AlertDialog_topDark,R.drawable.popup_top_dark);
  int centerDark=a.getResourceId(R.styleable.AlertDialog_centerDark,R.drawable.popup_center_dark);
  int bottomDark=a.getResourceId(R.styleable.AlertDialog_bottomDark,R.drawable.popup_bottom_dark);
  int fullBright=a.getResourceId(R.styleable.AlertDialog_fullBright,R.drawable.popup_full_bright);
  int topBright=a.getResourceId(R.styleable.AlertDialog_topBright,R.drawable.popup_top_bright);
  int centerBright=a.getResourceId(R.styleable.AlertDialog_centerBright,R.drawable.popup_center_bright);
  int bottomBright=a.getResourceId(R.styleable.AlertDialog_bottomBright,R.drawable.popup_bottom_bright);
  int bottomMedium=a.getResourceId(R.styleable.AlertDialog_bottomMedium,R.drawable.popup_bottom_medium);
  int centerMedium=a.getResourceId(R.styleable.AlertDialog_centerMedium,R.drawable.popup_center_medium);
  View[] views=new View[4];
  boolean[] light=new boolean[4];
  View lastView=null;
  boolean lastLight=false;
  int pos=0;
  if (hasTitle) {
    views[pos]=topPanel;
    light[pos]=false;
    pos++;
  }
  views[pos]=(contentPanel.getVisibility() == View.GONE) ? null : contentPanel;
  light[pos]=mListView == null ? false : true;
  pos++;
  if (customPanel != null) {
    views[pos]=customPanel;
    light[pos]=mForceInverseBackground;
    pos++;
  }
  if (hasButtons) {
    views[pos]=buttonPanel;
    light[pos]=true;
  }
  boolean setView=false;
  for (pos=0; pos < views.length; pos++) {
    View v=views[pos];
    if (v == null) {
      continue;
    }
    if (lastView != null) {
      if (!setView) {
        lastView.setBackgroundResource(lastLight ? topBright : topDark);
      }
 else {
        lastView.setBackgroundResource(lastLight ? centerBright : centerDark);
      }
      setView=true;
    }
    lastView=v;
    lastLight=light[pos];
  }
  if (lastView != null) {
    if (setView) {
      lastView.setBackgroundResource(lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark);
    }
 else {
      lastView.setBackgroundResource(lastLight ? fullBright : fullDark);
    }
  }
  if ((mListView != null) && (mAdapter != null)) {
    mListView.setAdapter(mAdapter);
    if (mCheckedItem > -1) {
      mListView.setItemChecked(mCheckedItem,true);
      mListView.setSelection(mCheckedItem);
    }
  }
}

Fixed version (ground truth):
private void setBackground(LinearLayout topPanel,LinearLayout contentPanel,View customPanel,boolean hasButtons,TypedArray a,boolean hasTitle,View buttonPanel){
  int fullDark=a.getResourceId(R.styleable.AlertDialog_fullDark,R.drawable.popup_full_dark);
  int topDark=a.getResourceId(R.styleable.AlertDialog_topDark,R.drawable.popup_top_dark);
  int centerDark=a.getResourceId(R.styleable.AlertDialog_centerDark,R.drawable.popup_center_dark);
  int bottomDark=a.getResourceId(R.styleable.AlertDialog_bottomDark,R.drawable.popup_bottom_dark);
  int fullBright=a.getResourceId(R.styleable.AlertDialog_fullBright,R.drawable.popup_full_bright);
  int topBright=a.getResourceId(R.styleable.AlertDialog_topBright,R.drawable.popup_top_bright);
  int centerBright=a.getResourceId(R.styleable.AlertDialog_centerBright,R.drawable.popup_center_bright);
  int bottomBright=a.getResourceId(R.styleable.AlertDialog_bottomBright,R.drawable.popup_bottom_bright);
  int bottomMedium=a.getResourceId(R.styleable.AlertDialog_bottomMedium,R.drawable.popup_bottom_medium);
  View[] views=new View[4];
  boolean[] light=new boolean[4];
  View lastView=null;
  boolean lastLight=false;
  int pos=0;
  if (hasTitle) {
    views[pos]=topPanel;
    light[pos]=false;
    pos++;
  }
  views[pos]=(contentPanel.getVisibility() == View.GONE) ? null : contentPanel;
  light[pos]=mListView != null;
  pos++;
  if (customPanel != null) {
    views[pos]=customPanel;
    light[pos]=mForceInverseBackground;
    pos++;
  }
  if (hasButtons) {
    views[pos]=buttonPanel;
    light[pos]=true;
  }
  boolean setView=false;
  for (pos=0; pos < views.length; pos++) {
    View v=views[pos];
    if (v == null) {
      continue;
    }
    if (lastView != null) {
      if (!setView) {
        lastView.setBackgroundResource(lastLight ? topBright : topDark);
      }
 else {
        lastView.setBackgroundResource(lastLight ? centerBright : centerDark);
      }
      setView=true;
    }
    lastView=v;
    lastLight=light[pos];
  }
  if (lastView != null) {
    if (setView) {
      lastView.setBackgroundResource(lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark);
    }
 else {
      lastView.setBackgroundResource(lastLight ? fullBright : fullDark);
    }
  }
  if ((mListView != null) && (mAdapter != null)) {
    mListView.setAdapter(mAdapter);
    if (mCheckedItem > -1) {
      mListView.setItemChecked(mCheckedItem,true);
      mListView.setSelection(mCheckedItem);
    }
  }
}