private Collection<ProcessErrorStateInfo> launchActivity(String packageName){
  Intent homeIntent=new Intent(Intent.ACTION_MAIN);
  homeIntent.addCategory(Intent.CATEGORY_HOME);
  homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  Intent intent=mPackageManager.getLaunchIntentForPackage(packageName);
  if (intent == null) {
    Log.d(TAG,"Skipping " + packageName + "; missing launch intent");
    return null;
  }
  final Collection<ProcessErrorStateInfo> preErr=mActivityManager.getProcessesInErrorState();
  mContext.startActivity(intent);
  try {
    Thread.sleep(mAppLaunchTimeout);
  }
 catch (  InterruptedException e) {
  }
  mContext.startActivity(homeIntent);
  try {
    Thread.sleep(mWorkspaceLaunchTimeout);
  }
 catch (  InterruptedException e) {
  }
  final Collection<ProcessErrorStateInfo> postErr=mActivityManager.getProcessesInErrorState();
  if (preErr != null && postErr != null) {
    postErr.removeAll(preErr);
  }
  return postErr;
}

private Collection < ProcessErrorStateInfo > launchActivity ( String packageName ) { Intent homeIntent = new Intent ( Intent . ACTION_MAIN ) ; homeIntent . addCategory ( Intent . CATEGORY_HOME ) ; homeIntent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; Intent intent = mPackageManager . getLaunchIntentForPackage ( packageName ) ; if ( intent == null ) { Log . d ( TAG , "Skipping " + packageName + "; missing launch intent" ) ; return null ; } final Collection < ProcessErrorStateInfo > preErr = mActivityManager . getProcessesInErrorState ( ) ; mContext . startActivity ( intent ) ; try { Thread . sleep ( mAppLaunchTimeout ) ; } catch ( InterruptedException e ) { } mContext . startActivity ( homeIntent ) ; try { Thread . sleep ( mWorkspaceLaunchTimeout ) ; } catch ( InterruptedException e ) { } final Collection < ProcessErrorStateInfo > postErr = mActivityManager . getProcessesInErrorState ( ) ; if ( preErr != null && postErr != null ) { postErr . removeAll ( preErr ) ; } return postErr ; }
launches and activity and queries for errors .
