Program: 1308
Project: 1308
Buggy source:
protected void onCreate(Bundle savedInstanceState,Intent intent,CharSequence title,Intent[] initialIntents,List<ResolveInfo> rList,boolean alwaysUseOption){
  setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert);
  super.onCreate(savedInstanceState);
  try {
    mLaunchedFromUid=ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
  }
 catch (  RemoteException e) {
    mLaunchedFromUid=-1;
  }
  mPm=getPackageManager();
  mAlwaysUseOption=alwaysUseOption;
  mMaxColumns=getResources().getInteger(R.integer.config_maxResolverActivityColumns);
  intent.setComponent(null);
  AlertController.AlertParams ap=mAlertParams;
  ap.mTitle=title;
  mPackageMonitor.register(this,getMainLooper(),false);
  mRegistered=true;
  final ActivityManager am=(ActivityManager)getSystemService(ACTIVITY_SERVICE);
  mIconDpi=am.getLauncherLargeIconDensity();
  mIconSize=am.getLauncherLargeIconSize();
  mAdapter=new ResolveListAdapter(this,intent,initialIntents,rList,mLaunchedFromUid);
  int count=mAdapter.getCount();
  if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
    finish();
    return;
  }
 else   if (count > 1) {
    ap.mView=getLayoutInflater().inflate(R.layout.resolver_list,null);
    mListView=(ListView)ap.mView.findViewById(R.id.resolver_list);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);
    mListView.setOnItemLongClickListener(new ItemLongClickListener());
    if (alwaysUseOption) {
      mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    }
  }
 else   if (count == 1) {
    startActivity(mAdapter.intentForPosition(0));
    mPackageMonitor.unregister();
    mRegistered=false;
    finish();
    return;
  }
 else {
    ap.mMessage=getResources().getText(R.string.noApplications);
  }
  setupAlert();
  if (alwaysUseOption) {
    final ViewGroup buttonLayout=(ViewGroup)findViewById(R.id.button_bar);
    if (buttonLayout != null) {
      buttonLayout.setVisibility(View.VISIBLE);
      mAlwaysButton=(Button)buttonLayout.findViewById(R.id.button_always);
      mOnceButton=(Button)buttonLayout.findViewById(R.id.button_once);
    }
 else {
      mAlwaysUseOption=false;
    }
  }
  final int initialHighlight=mAdapter.getInitialHighlight();
  if (initialHighlight >= 0) {
    mListView.setItemChecked(initialHighlight,true);
    onItemClick(null,null,initialHighlight,0);
  }
}

Fixed version (ground truth):
protected void onCreate(Bundle savedInstanceState,Intent intent,CharSequence title,Intent[] initialIntents,List<ResolveInfo> rList,boolean alwaysUseOption){
  setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert);
  super.onCreate(savedInstanceState);
  try {
    mLaunchedFromUid=ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
  }
 catch (  RemoteException e) {
    mLaunchedFromUid=-1;
  }
  mPm=getPackageManager();
  mAlwaysUseOption=alwaysUseOption;
  mMaxColumns=getResources().getInteger(R.integer.config_maxResolverActivityColumns);
  AlertController.AlertParams ap=mAlertParams;
  ap.mTitle=title;
  mPackageMonitor.register(this,getMainLooper(),false);
  mRegistered=true;
  final ActivityManager am=(ActivityManager)getSystemService(ACTIVITY_SERVICE);
  mIconDpi=am.getLauncherLargeIconDensity();
  mIconSize=am.getLauncherLargeIconSize();
  mAdapter=new ResolveListAdapter(this,intent,initialIntents,rList,mLaunchedFromUid);
  int count=mAdapter.getCount();
  if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
    finish();
    return;
  }
 else   if (count > 1) {
    ap.mView=getLayoutInflater().inflate(R.layout.resolver_list,null);
    mListView=(ListView)ap.mView.findViewById(R.id.resolver_list);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);
    mListView.setOnItemLongClickListener(new ItemLongClickListener());
    if (alwaysUseOption) {
      mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    }
  }
 else   if (count == 1) {
    startActivity(mAdapter.intentForPosition(0));
    mPackageMonitor.unregister();
    mRegistered=false;
    finish();
    return;
  }
 else {
    ap.mMessage=getResources().getText(R.string.noApplications);
  }
  setupAlert();
  if (alwaysUseOption) {
    final ViewGroup buttonLayout=(ViewGroup)findViewById(R.id.button_bar);
    if (buttonLayout != null) {
      buttonLayout.setVisibility(View.VISIBLE);
      mAlwaysButton=(Button)buttonLayout.findViewById(R.id.button_always);
      mOnceButton=(Button)buttonLayout.findViewById(R.id.button_once);
    }
 else {
      mAlwaysUseOption=false;
    }
  }
  final int initialHighlight=mAdapter.getInitialHighlight();
  if (initialHighlight >= 0) {
    mListView.setItemChecked(initialHighlight,true);
    onItemClick(null,null,initialHighlight,0);
  }
}