Program: 194003
Project: 194003
Buggy source:
ActivityRecord(ActivityManagerService _service,ProcessRecord _caller,int _launchedFromUid,String _launchedFromPackage,Intent _intent,String _resolvedType,ActivityInfo aInfo,Configuration _configuration,ActivityRecord _resultTo,String _resultWho,int _reqCode,boolean _componentSpecified,ActivityStackSupervisor supervisor,ActivityContainer container,Bundle options){
  service=_service;
  appToken=new Token(this,service);
  info=aInfo;
  launchedFromUid=_launchedFromUid;
  launchedFromPackage=_launchedFromPackage;
  userId=UserHandle.getUserId(aInfo.applicationInfo.uid);
  intent=_intent;
  shortComponentName=_intent.getComponent().flattenToShortString();
  resolvedType=_resolvedType;
  componentSpecified=_componentSpecified;
  configuration=_configuration;
  stackConfigOverride=(container != null) ? container.mStack.mOverrideConfig : Configuration.EMPTY;
  resultTo=_resultTo;
  resultWho=_resultWho;
  requestCode=_reqCode;
  state=ActivityState.INITIALIZING;
  frontOfTask=false;
  launchFailed=false;
  stopped=false;
  delayedResume=false;
  finishing=false;
  configDestroy=false;
  keysPaused=false;
  inHistory=false;
  visible=true;
  nowVisible=false;
  idle=false;
  hasBeenLaunched=false;
  mStackSupervisor=supervisor;
  mInitialActivityContainer=container;
  if (options != null) {
    pendingOptions=new ActivityOptions(options);
    mLaunchTaskBehind=pendingOptions.getLaunchTaskBehind();
    PendingIntent usageReport=pendingOptions.getUsageTimeReport();
    if (usageReport != null) {
      appTimeTracker=new AppTimeTracker(usageReport);
    }
  }
  haveState=true;
  if (aInfo != null) {
    if (aInfo.targetActivity == null || aInfo.launchMode == ActivityInfo.LAUNCH_MULTIPLE || aInfo.launchMode == ActivityInfo.LAUNCH_SINGLE_TOP) {
      realActivity=_intent.getComponent();
    }
 else {
      realActivity=new ComponentName(aInfo.packageName,aInfo.targetActivity);
    }
    taskAffinity=aInfo.taskAffinity;
    stateNotNeeded=(aInfo.flags & ActivityInfo.FLAG_STATE_NOT_NEEDED) != 0;
    appInfo=aInfo.applicationInfo;
    nonLocalizedLabel=aInfo.nonLocalizedLabel;
    labelRes=aInfo.labelRes;
    if (nonLocalizedLabel == null && labelRes == 0) {
      ApplicationInfo app=aInfo.applicationInfo;
      nonLocalizedLabel=app.nonLocalizedLabel;
      labelRes=app.labelRes;
    }
    icon=aInfo.getIconResource();
    logo=aInfo.getLogoResource();
    theme=aInfo.getThemeResource();
    realTheme=theme;
    if (realTheme == 0) {
      realTheme=aInfo.applicationInfo.targetSdkVersion < Build.VERSION_CODES.HONEYCOMB ? android.R.style.Theme : android.R.style.Theme_Holo;
    }
    if ((aInfo.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0) {
      windowFlags|=WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
    }
    if ((aInfo.flags & ActivityInfo.FLAG_MULTIPROCESS) != 0 && _caller != null && (aInfo.applicationInfo.uid == Process.SYSTEM_UID || aInfo.applicationInfo.uid == _caller.info.uid)) {
      processName=_caller.processName;
    }
 else {
      processName=aInfo.processName;
    }
    if (intent != null && (aInfo.flags & ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS) != 0) {
      intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    }
    packageName=aInfo.applicationInfo.packageName;
    launchMode=aInfo.launchMode;
    AttributeCache.Entry ent=AttributeCache.instance().get(packageName,realTheme,com.android.internal.R.styleable.Window,userId);
    final boolean translucent=ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false) || (!ent.array.hasValue(com.android.internal.R.styleable.Window_windowIsTranslucent) && ent.array.getBoolean(com.android.internal.R.styleable.Window_windowSwipeToDismiss,false));
    fullscreen=ent != null && !ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false) && !translucent;
    noDisplay=ent != null && ent.array.getBoolean(com.android.internal.R.styleable.Window_windowNoDisplay,false);
    if ((!_componentSpecified || _launchedFromUid == Process.myUid() || _launchedFromUid == 0) && Intent.ACTION_MAIN.equals(_intent.getAction()) && _intent.hasCategory(Intent.CATEGORY_HOME)&& _intent.getCategories().size() == 1 && _intent.getData() == null && _intent.getType() == null && (intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && isNotResolverActivity()) {
      mActivityType=HOME_ACTIVITY_TYPE;
    }
 else     if (realActivity.getClassName().contains(RECENTS_PACKAGE_NAME)) {
      mActivityType=RECENTS_ACTIVITY_TYPE;
    }
 else {
      mActivityType=APPLICATION_ACTIVITY_TYPE;
    }
    immersive=(aInfo.flags & ActivityInfo.FLAG_IMMERSIVE) != 0;
  }
 else {
    realActivity=null;
    taskAffinity=null;
    stateNotNeeded=false;
    appInfo=null;
    processName=null;
    packageName=null;
    fullscreen=true;
    noDisplay=false;
    mActivityType=APPLICATION_ACTIVITY_TYPE;
    immersive=false;
  }
}

Fixed version (ground truth):
ActivityRecord(ActivityManagerService _service,ProcessRecord _caller,int _launchedFromUid,String _launchedFromPackage,Intent _intent,String _resolvedType,ActivityInfo aInfo,Configuration _configuration,ActivityRecord _resultTo,String _resultWho,int _reqCode,boolean _componentSpecified,ActivityStackSupervisor supervisor,ActivityContainer container,Bundle options){
  service=_service;
  appToken=new Token(this,service);
  info=aInfo;
  launchedFromUid=_launchedFromUid;
  launchedFromPackage=_launchedFromPackage;
  userId=UserHandle.getUserId(aInfo.applicationInfo.uid);
  intent=_intent;
  shortComponentName=_intent.getComponent().flattenToShortString();
  resolvedType=_resolvedType;
  componentSpecified=_componentSpecified;
  configuration=_configuration;
  stackConfigOverride=(container != null) ? container.mStack.mOverrideConfig : Configuration.EMPTY;
  resultTo=_resultTo;
  resultWho=_resultWho;
  requestCode=_reqCode;
  state=ActivityState.INITIALIZING;
  frontOfTask=false;
  launchFailed=false;
  stopped=false;
  delayedResume=false;
  finishing=false;
  configDestroy=false;
  keysPaused=false;
  inHistory=false;
  visible=true;
  nowVisible=false;
  idle=false;
  hasBeenLaunched=false;
  mStackSupervisor=supervisor;
  mInitialActivityContainer=container;
  if (options != null) {
    pendingOptions=new ActivityOptions(options);
    mLaunchTaskBehind=pendingOptions.getLaunchTaskBehind();
    PendingIntent usageReport=pendingOptions.getUsageTimeReport();
    if (usageReport != null) {
      appTimeTracker=new AppTimeTracker(usageReport);
    }
  }
  haveState=true;
  if (aInfo != null) {
    if (aInfo.targetActivity == null || aInfo.launchMode == ActivityInfo.LAUNCH_MULTIPLE || aInfo.launchMode == ActivityInfo.LAUNCH_SINGLE_TOP) {
      realActivity=_intent.getComponent();
    }
 else {
      realActivity=new ComponentName(aInfo.packageName,aInfo.targetActivity);
    }
    taskAffinity=aInfo.taskAffinity;
    stateNotNeeded=(aInfo.flags & ActivityInfo.FLAG_STATE_NOT_NEEDED) != 0;
    appInfo=aInfo.applicationInfo;
    nonLocalizedLabel=aInfo.nonLocalizedLabel;
    labelRes=aInfo.labelRes;
    if (nonLocalizedLabel == null && labelRes == 0) {
      ApplicationInfo app=aInfo.applicationInfo;
      nonLocalizedLabel=app.nonLocalizedLabel;
      labelRes=app.labelRes;
    }
    icon=aInfo.getIconResource();
    logo=aInfo.getLogoResource();
    theme=aInfo.getThemeResource();
    realTheme=theme;
    if (realTheme == 0) {
      realTheme=aInfo.applicationInfo.targetSdkVersion < Build.VERSION_CODES.HONEYCOMB ? android.R.style.Theme : android.R.style.Theme_Holo;
    }
    if ((aInfo.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0) {
      windowFlags|=WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
    }
    if ((aInfo.flags & ActivityInfo.FLAG_MULTIPROCESS) != 0 && _caller != null && (aInfo.applicationInfo.uid == Process.SYSTEM_UID || aInfo.applicationInfo.uid == _caller.info.uid)) {
      processName=_caller.processName;
    }
 else {
      processName=aInfo.processName;
    }
    if (intent != null && (aInfo.flags & ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS) != 0) {
      intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    }
    packageName=aInfo.applicationInfo.packageName;
    launchMode=aInfo.launchMode;
    AttributeCache.Entry ent=AttributeCache.instance().get(packageName,realTheme,com.android.internal.R.styleable.Window,userId);
    final boolean translucent=ent != null && (ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,false) || (!ent.array.hasValue(com.android.internal.R.styleable.Window_windowIsTranslucent) && ent.array.getBoolean(com.android.internal.R.styleable.Window_windowSwipeToDismiss,false)));
    fullscreen=ent != null && !ent.array.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,false) && !translucent;
    noDisplay=ent != null && ent.array.getBoolean(com.android.internal.R.styleable.Window_windowNoDisplay,false);
    if ((!_componentSpecified || _launchedFromUid == Process.myUid() || _launchedFromUid == 0) && Intent.ACTION_MAIN.equals(_intent.getAction()) && _intent.hasCategory(Intent.CATEGORY_HOME)&& _intent.getCategories().size() == 1 && _intent.getData() == null && _intent.getType() == null && (intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && isNotResolverActivity()) {
      mActivityType=HOME_ACTIVITY_TYPE;
    }
 else     if (realActivity.getClassName().contains(RECENTS_PACKAGE_NAME)) {
      mActivityType=RECENTS_ACTIVITY_TYPE;
    }
 else {
      mActivityType=APPLICATION_ACTIVITY_TYPE;
    }
    immersive=(aInfo.flags & ActivityInfo.FLAG_IMMERSIVE) != 0;
  }
 else {
    realActivity=null;
    taskAffinity=null;
    stateNotNeeded=false;
    appInfo=null;
    processName=null;
    packageName=null;
    fullscreen=true;
    noDisplay=false;
    mActivityType=APPLICATION_ACTIVITY_TYPE;
    immersive=false;
  }
}