Program: 43038
Project: 43038
Buggy source:
private Activity parseActivity(Package owner,Resources res,XmlPullParser parser,AttributeSet attrs,int flags,String[] outError,boolean receiver) throws XmlPullParserException, IOException {
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestActivity);
  if (mParseActivityArgs == null) {
    mParseActivityArgs=new ParseComponentArgs(owner,outError,com.android.internal.R.styleable.AndroidManifestActivity_name,com.android.internal.R.styleable.AndroidManifestActivity_label,com.android.internal.R.styleable.AndroidManifestActivity_icon,mSeparateProcesses,com.android.internal.R.styleable.AndroidManifestActivity_process,com.android.internal.R.styleable.AndroidManifestActivity_enabled);
  }
  mParseActivityArgs.tag=receiver ? "String_Node_Str" : "String_Node_Str";
  mParseActivityArgs.sa=sa;
  mParseActivityArgs.flags=flags;
  Activity a=new Activity(mParseActivityArgs,new ActivityInfo());
  if (outError[0] != null) {
    sa.recycle();
    return null;
  }
  final boolean setExported=sa.hasValue(com.android.internal.R.styleable.AndroidManifestActivity_exported);
  if (setExported) {
    a.info.exported=sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_exported,false);
  }
  a.info.theme=sa.getResourceId(com.android.internal.R.styleable.AndroidManifestActivity_theme,0);
  String str;
  str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestActivity_permission);
  if (str == null) {
    a.info.permission=owner.applicationInfo.permission;
  }
 else {
    a.info.permission=str.length() > 0 ? str.toString().intern() : null;
  }
  str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestActivity_taskAffinity);
  a.info.taskAffinity=buildTaskAffinityName(owner.applicationInfo.packageName,owner.applicationInfo.taskAffinity,str,outError);
  a.info.flags=0;
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_multiprocess,false)) {
    a.info.flags|=ActivityInfo.FLAG_MULTIPROCESS;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_finishOnTaskLaunch,false)) {
    a.info.flags|=ActivityInfo.FLAG_FINISH_ON_TASK_LAUNCH;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_clearTaskOnLaunch,false)) {
    a.info.flags|=ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_noHistory,false)) {
    a.info.flags|=ActivityInfo.FLAG_NO_HISTORY;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_alwaysRetainTaskState,false)) {
    a.info.flags|=ActivityInfo.FLAG_ALWAYS_RETAIN_TASK_STATE;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_stateNotNeeded,false)) {
    a.info.flags|=ActivityInfo.FLAG_STATE_NOT_NEEDED;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_excludeFromRecents,false)) {
    a.info.flags|=ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_allowTaskReparenting,(owner.applicationInfo.flags & ApplicationInfo.FLAG_ALLOW_TASK_REPARENTING) != 0)) {
    a.info.flags|=ActivityInfo.FLAG_ALLOW_TASK_REPARENTING;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_finishOnCloseSystemDialogs,false)) {
    a.info.flags|=ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS;
  }
  if (!receiver) {
    a.info.launchMode=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_launchMode,ActivityInfo.LAUNCH_MULTIPLE);
    a.info.screenOrientation=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_screenOrientation,ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    a.info.configChanges=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_configChanges,0);
    a.info.softInputMode=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_windowSoftInputMode,0);
  }
 else {
    a.info.launchMode=ActivityInfo.LAUNCH_MULTIPLE;
    a.info.configChanges=0;
  }
  sa.recycle();
  if (outError[0] != null) {
    return null;
  }
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      ActivityIntentInfo intent=new ActivityIntentInfo(a);
      if (!parseIntent(res,parser,attrs,flags,intent,outError,!receiver)) {
        return null;
      }
      if (intent.countActions() == 0) {
        Log.w(TAG,"String_Node_Str" + intent + "String_Node_Str");
      }
 else {
        a.intents.add(intent);
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      if ((a.metaData=parseMetaData(res,parser,attrs,a.metaData,outError)) == null) {
        return null;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        if (receiver) {
          Log.w(TAG,"String_Node_Str" + parser.getName());
        }
 else {
          Log.w(TAG,"String_Node_Str" + parser.getName());
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      if (receiver) {
        outError[0]="String_Node_Str" + parser.getName();
      }
 else {
        outError[0]="String_Node_Str" + parser.getName();
      }
      return null;
    }
  }
  if (!setExported) {
    a.info.exported=a.intents.size() > 0;
  }
  return a;
}

Fixed version (ground truth):
private Activity parseActivity(Package owner,Resources res,XmlPullParser parser,AttributeSet attrs,int flags,String[] outError,boolean receiver) throws XmlPullParserException, IOException {
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestActivity);
  if (mParseActivityArgs == null) {
    mParseActivityArgs=new ParseComponentArgs(owner,outError,com.android.internal.R.styleable.AndroidManifestActivity_name,com.android.internal.R.styleable.AndroidManifestActivity_label,com.android.internal.R.styleable.AndroidManifestActivity_icon,mSeparateProcesses,com.android.internal.R.styleable.AndroidManifestActivity_process,com.android.internal.R.styleable.AndroidManifestActivity_enabled);
  }
  mParseActivityArgs.tag=receiver ? "String_Node_Str" : "String_Node_Str";
  mParseActivityArgs.sa=sa;
  mParseActivityArgs.flags=flags;
  Activity a=new Activity(mParseActivityArgs,new ActivityInfo());
  if (outError[0] != null) {
    sa.recycle();
    return null;
  }
  final boolean setExported=sa.hasValue(com.android.internal.R.styleable.AndroidManifestActivity_exported);
  if (setExported) {
    a.info.exported=sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_exported,false);
  }
  a.info.theme=sa.getResourceId(com.android.internal.R.styleable.AndroidManifestActivity_theme,0);
  String str;
  str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestActivity_permission);
  if (str == null) {
    a.info.permission=owner.applicationInfo.permission;
  }
 else {
    a.info.permission=str.length() > 0 ? str.toString().intern() : null;
  }
  str=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestActivity_taskAffinity);
  a.info.taskAffinity=buildTaskAffinityName(owner.applicationInfo.packageName,owner.applicationInfo.taskAffinity,str,outError);
  a.info.flags=0;
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_multiprocess,false)) {
    a.info.flags|=ActivityInfo.FLAG_MULTIPROCESS;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_finishOnTaskLaunch,false)) {
    a.info.flags|=ActivityInfo.FLAG_FINISH_ON_TASK_LAUNCH;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_clearTaskOnLaunch,false)) {
    a.info.flags|=ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_noHistory,false)) {
    a.info.flags|=ActivityInfo.FLAG_NO_HISTORY;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_alwaysRetainTaskState,false)) {
    a.info.flags|=ActivityInfo.FLAG_ALWAYS_RETAIN_TASK_STATE;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_stateNotNeeded,false)) {
    a.info.flags|=ActivityInfo.FLAG_STATE_NOT_NEEDED;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_excludeFromRecents,false)) {
    a.info.flags|=ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_allowTaskReparenting,(owner.applicationInfo.flags & ApplicationInfo.FLAG_ALLOW_TASK_REPARENTING) != 0)) {
    a.info.flags|=ActivityInfo.FLAG_ALLOW_TASK_REPARENTING;
  }
  if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestActivity_finishOnCloseSystemDialogs,false)) {
    a.info.flags|=ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS;
  }
  if (!receiver) {
    a.info.launchMode=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_launchMode,ActivityInfo.LAUNCH_MULTIPLE);
    a.info.screenOrientation=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_screenOrientation,ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    a.info.configChanges=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_configChanges,0);
    a.info.softInputMode=sa.getInt(com.android.internal.R.styleable.AndroidManifestActivity_windowSoftInputMode,0);
  }
 else {
    a.info.launchMode=ActivityInfo.LAUNCH_MULTIPLE;
    a.info.configChanges=0;
  }
  sa.recycle();
  if (outError[0] != null) {
    return null;
  }
  int outerDepth=parser.getDepth();
  int type;
  while ((type=parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
      continue;
    }
    if (parser.getName().equals("String_Node_Str")) {
      ActivityIntentInfo intent=new ActivityIntentInfo(a);
      if (!parseIntent(res,parser,attrs,flags,intent,outError,!receiver)) {
        return null;
      }
      if (intent.countActions() == 0) {
        Log.w(TAG,"String_Node_Str" + intent + "String_Node_Str");
      }
 else {
        a.intents.add(intent);
      }
    }
 else     if (parser.getName().equals("String_Node_Str")) {
      if ((a.metaData=parseMetaData(res,parser,attrs,a.metaData,outError)) == null) {
        return null;
      }
    }
 else {
      if (!RIGID_PARSER) {
        Log.w(TAG,"String_Node_Str" + mArchiveSourcePath + "String_Node_Str");
        if (receiver) {
          Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        }
 else {
          Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
        }
        XmlUtils.skipCurrentTag(parser);
        continue;
      }
      if (receiver) {
        outError[0]="String_Node_Str" + parser.getName();
      }
 else {
        outError[0]="String_Node_Str" + parser.getName();
      }
      return null;
    }
  }
  if (!setExported) {
    a.info.exported=a.intents.size() > 0;
  }
  return a;
}