Program: 41097
Project: 41097
Buggy source:
private Package parsePackage(Resources res,XmlResourceParser parser,int flags,String[] outError) throws XmlPullParserException, IOException {
  AttributeSet attrs=parser;
  mParseInstrumentationArgs=null;
  mParseActivityArgs=null;
  mParseServiceArgs=null;
  mParseProviderArgs=null;
  String pkgName=parsePackageName(parser,attrs,flags,outError);
  if (pkgName == null) {
    mParseError=PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
    return null;
  }
  int type;
  final Package pkg=new Package(pkgName);
  boolean foundApp=false;
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifest);
  pkg.mVersionCode=sa.getInteger(com.android.internal.R.styleable.AndroidManifest_versionCode,0);
  pkg.mVersionName=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifest_versionName,0);
  if (pkg.mVersionName != null) {
    pkg.mVersionName=pkg.mVersionName.intern();
  }
  String str=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifest_sharedUserId,0);
  if (str != null && str.length() > 0) {
    String nameError=validateName(str,true);
    if (nameError != null && !"String_Node_Str".equals(pkgName)) {
      outError[0]="String_Node_Str" + str + "String_Node_Str"+ nameError;
      mParseError=PackageManager.INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID;
      return null;
    }
    pkg.mSharedUserId=str.intern();
    pkg.mSharedUserLabel=sa.getResourceId(com.android.internal.R.styleable.AndroidManifest_sharedUserLabel,0);
  }
  sa.recycle();
  pkg.installLocation=sa.getInteger(com.android.internal.R.styleable.AndroidManifest_installLocation,PARSE_DEFAULT_INSTALL_LOCATION);
  pkg.applicationInfo.installLocation=pkg.installLocation;
  int supportsSmallScreens=1;
  int supportsNormalScreens=1;
  int supportsLargeScreens=1;
  int supportsXLargeScreens=1;
  int resizeable=1;
  int anyDensity=1;
  int outerDepth=parser.getDepth();
  while ((type=parser.next()) != parser.END_DOCUMENT && (type != parser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == parser.END_TAG || type == parser.TEXT) {
      continue;
    }
    String tagName=parser.getName();
    if (tagName.equals("String_Node_Str")) {
      if (foundApp) {
        if (RIGID_PARSER) {
          outError[0]="String_Node_Str";
          mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
          return null;
        }
 else {
          Log.w(TAG,"String_Node_Str");
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
      }
      foundApp=true;
      if (!parseApplication(pkg,res,parser,attrs,flags,outError)) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermissionGroup(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermission(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermissionTree(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesPermission);
      String name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestUsesPermission_name);
      sa.recycle();
      if (name != null && !pkg.requestedPermissions.contains(name)) {
        pkg.requestedPermissions.add(name.intern());
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      ConfigurationInfo cPref=new ConfigurationInfo();
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesConfiguration);
      cPref.reqTouchScreen=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqTouchScreen,Configuration.TOUCHSCREEN_UNDEFINED);
      cPref.reqKeyboardType=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqKeyboardType,Configuration.KEYBOARD_UNDEFINED);
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqHardKeyboard,false)) {
        cPref.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
      }
      cPref.reqNavigation=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqNavigation,Configuration.NAVIGATION_UNDEFINED);
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqFiveWayNav,false)) {
        cPref.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
      }
      sa.recycle();
      pkg.configPreferences.add(cPref);
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      FeatureInfo fi=new FeatureInfo();
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesFeature);
      fi.name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestUsesFeature_name);
      if (fi.name == null) {
        fi.reqGlEsVersion=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesFeature_glEsVersion,FeatureInfo.GL_ES_VERSION_UNDEFINED);
      }
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesFeature_required,true)) {
        fi.flags|=FeatureInfo.FLAG_REQUIRED;
      }
      sa.recycle();
      if (pkg.reqFeatures == null) {
        pkg.reqFeatures=new ArrayList<FeatureInfo>();
      }
      pkg.reqFeatures.add(fi);
      if (fi.name == null) {
        ConfigurationInfo cPref=new ConfigurationInfo();
        cPref.reqGlEsVersion=fi.reqGlEsVersion;
        pkg.configPreferences.add(cPref);
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (SDK_VERSION > 0) {
        sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesSdk);
        int minVers=0;
        String minCode=null;
        int targetVers=0;
        String targetCode=null;
        TypedValue val=sa.peekValue(com.android.internal.R.styleable.AndroidManifestUsesSdk_minSdkVersion);
        if (val != null) {
          if (val.type == TypedValue.TYPE_STRING && val.string != null) {
            targetCode=minCode=val.string.toString();
          }
 else {
            targetVers=minVers=val.data;
          }
        }
        val=sa.peekValue(com.android.internal.R.styleable.AndroidManifestUsesSdk_targetSdkVersion);
        if (val != null) {
          if (val.type == TypedValue.TYPE_STRING && val.string != null) {
            targetCode=minCode=val.string.toString();
          }
 else {
            targetVers=val.data;
          }
        }
        sa.recycle();
        if (minCode != null) {
          if (!minCode.equals(SDK_CODENAME)) {
            if (SDK_CODENAME != null) {
              outError[0]="String_Node_Str" + minCode + "String_Node_Str"+ SDK_CODENAME+ "String_Node_Str";
            }
 else {
              outError[0]="String_Node_Str" + minCode + "String_Node_Str";
            }
            mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
            return null;
          }
        }
 else         if (minVers > SDK_VERSION) {
          outError[0]="String_Node_Str" + minVers + "String_Node_Str"+ SDK_VERSION+ "String_Node_Str";
          mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
          return null;
        }
        if (targetCode != null) {
          if (!targetCode.equals(SDK_CODENAME)) {
            if (SDK_CODENAME != null) {
              outError[0]="String_Node_Str" + targetCode + "String_Node_Str"+ SDK_CODENAME+ "String_Node_Str";
            }
 else {
              outError[0]="String_Node_Str" + targetCode + "String_Node_Str";
            }
            mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
            return null;
          }
          pkg.applicationInfo.targetSdkVersion=android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
        }
 else {
          pkg.applicationInfo.targetSdkVersion=targetVers;
        }
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestSupportsScreens);
      supportsSmallScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_smallScreens,supportsSmallScreens);
      supportsNormalScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_normalScreens,supportsNormalScreens);
      supportsLargeScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_largeScreens,supportsLargeScreens);
      supportsXLargeScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_xlargeScreens,supportsXLargeScreens);
      resizeable=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,resizeable);
      anyDensity=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,anyDensity);
      sa.recycle();
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestProtectedBroadcast);
      String name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestProtectedBroadcast_name);
      sa.recycle();
      if (name != null && (flags & PARSE_IS_SYSTEM) != 0) {
        if (pkg.protectedBroadcasts == null) {
          pkg.protectedBroadcasts=new ArrayList<String>();
        }
        if (!pkg.protectedBroadcasts.contains(name)) {
          pkg.protectedBroadcasts.add(name.intern());
        }
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parseInstrumentation(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestOriginalPackage);
      String orig=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestOriginalPackage_name,0);
      if (!pkg.packageName.equals(orig)) {
        if (pkg.mOriginalPackages == null) {
          pkg.mOriginalPackages=new ArrayList<String>();
          pkg.mRealPackage=pkg.packageName;
        }
        pkg.mOriginalPackages.add(orig);
      }
      sa.recycle();
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestOriginalPackage);
      String name=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestOriginalPackage_name,0);
      sa.recycle();
      if (name != null) {
        if (pkg.mAdoptPermissions == null) {
          pkg.mAdoptPermissions=new ArrayList<String>();
        }
        pkg.mAdoptPermissions.add(name);
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      pkg.mIsThemeApk=true;
      pkg.applicationInfo.isThemeable=false;
      pkg.mThemeInfos.add(new ThemeInfo(parser,res,attrs));
    }
 else     if (RIGID_PARSER) {
      outError[0]="String_Node_Str" + parser.getName();
      mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
      return null;
    }
 else {
      Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
  }
  if (!foundApp && pkg.instrumentation.size() == 0) {
    outError[0]="String_Node_Str";
    mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_EMPTY;
  }
  final int NP=PackageParser.NEW_PERMISSIONS.length;
  StringBuilder implicitPerms=null;
  for (int ip=0; ip < NP; ip++) {
    final PackageParser.NewPermissionInfo npi=PackageParser.NEW_PERMISSIONS[ip];
    if (pkg.applicationInfo.targetSdkVersion >= npi.sdkVersion) {
      break;
    }
    if (!pkg.requestedPermissions.contains(npi.name)) {
      if (implicitPerms == null) {
        implicitPerms=new StringBuilder(128);
        implicitPerms.append(pkg.packageName);
        implicitPerms.append("String_Node_Str");
      }
 else {
        implicitPerms.append(' ');
      }
      implicitPerms.append(npi.name);
      pkg.requestedPermissions.add(npi.name);
    }
  }
  if (implicitPerms != null) {
    Log.i(TAG,implicitPerms.toString());
  }
  if (supportsSmallScreens < 0 || (supportsSmallScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS;
  }
  if (supportsNormalScreens != 0) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS;
  }
  if (supportsLargeScreens < 0 || (supportsLargeScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
  }
  if (supportsXLargeScreens < 0 || (supportsXLargeScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.GINGERBREAD)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS;
  }
  if (resizeable < 0 || (resizeable > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS;
  }
  if (anyDensity < 0 || (anyDensity > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
  }
  return pkg;
}

Fixed version (ground truth):
private Package parsePackage(Resources res,XmlResourceParser parser,int flags,String[] outError) throws XmlPullParserException, IOException {
  AttributeSet attrs=parser;
  mParseInstrumentationArgs=null;
  mParseActivityArgs=null;
  mParseServiceArgs=null;
  mParseProviderArgs=null;
  String pkgName=parsePackageName(parser,attrs,flags,outError);
  if (pkgName == null) {
    mParseError=PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
    return null;
  }
  int type;
  final Package pkg=new Package(pkgName);
  boolean foundApp=false;
  TypedArray sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifest);
  pkg.mVersionCode=sa.getInteger(com.android.internal.R.styleable.AndroidManifest_versionCode,0);
  pkg.mVersionName=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifest_versionName,0);
  if (pkg.mVersionName != null) {
    pkg.mVersionName=pkg.mVersionName.intern();
  }
  String str=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifest_sharedUserId,0);
  if (str != null && str.length() > 0) {
    String nameError=validateName(str,true);
    if (nameError != null && !"String_Node_Str".equals(pkgName)) {
      outError[0]="String_Node_Str" + str + "String_Node_Str"+ nameError;
      mParseError=PackageManager.INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID;
      return null;
    }
    pkg.mSharedUserId=str.intern();
    pkg.mSharedUserLabel=sa.getResourceId(com.android.internal.R.styleable.AndroidManifest_sharedUserLabel,0);
  }
  sa.recycle();
  pkg.installLocation=sa.getInteger(com.android.internal.R.styleable.AndroidManifest_installLocation,PARSE_DEFAULT_INSTALL_LOCATION);
  pkg.applicationInfo.installLocation=pkg.installLocation;
  int supportsSmallScreens=1;
  int supportsNormalScreens=1;
  int supportsLargeScreens=1;
  int supportsXLargeScreens=1;
  int resizeable=1;
  int anyDensity=1;
  int outerDepth=parser.getDepth();
  while ((type=parser.next()) != parser.END_DOCUMENT && (type != parser.END_TAG || parser.getDepth() > outerDepth)) {
    if (type == parser.END_TAG || type == parser.TEXT) {
      continue;
    }
    String tagName=parser.getName();
    if (tagName.equals("String_Node_Str")) {
      if (foundApp) {
        if (RIGID_PARSER) {
          outError[0]="String_Node_Str";
          mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
          return null;
        }
 else {
          Log.w(TAG,"String_Node_Str");
          XmlUtils.skipCurrentTag(parser);
          continue;
        }
      }
      foundApp=true;
      if (!parseApplication(pkg,res,parser,attrs,flags,outError)) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermissionGroup(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermission(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parsePermissionTree(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesPermission);
      String name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestUsesPermission_name);
      sa.recycle();
      if (name != null && !pkg.requestedPermissions.contains(name)) {
        pkg.requestedPermissions.add(name.intern());
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      ConfigurationInfo cPref=new ConfigurationInfo();
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesConfiguration);
      cPref.reqTouchScreen=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqTouchScreen,Configuration.TOUCHSCREEN_UNDEFINED);
      cPref.reqKeyboardType=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqKeyboardType,Configuration.KEYBOARD_UNDEFINED);
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqHardKeyboard,false)) {
        cPref.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
      }
      cPref.reqNavigation=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqNavigation,Configuration.NAVIGATION_UNDEFINED);
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqFiveWayNav,false)) {
        cPref.reqInputFeatures|=ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
      }
      sa.recycle();
      pkg.configPreferences.add(cPref);
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      FeatureInfo fi=new FeatureInfo();
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesFeature);
      fi.name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestUsesFeature_name);
      if (fi.name == null) {
        fi.reqGlEsVersion=sa.getInt(com.android.internal.R.styleable.AndroidManifestUsesFeature_glEsVersion,FeatureInfo.GL_ES_VERSION_UNDEFINED);
      }
      if (sa.getBoolean(com.android.internal.R.styleable.AndroidManifestUsesFeature_required,true)) {
        fi.flags|=FeatureInfo.FLAG_REQUIRED;
      }
      sa.recycle();
      if (pkg.reqFeatures == null) {
        pkg.reqFeatures=new ArrayList<FeatureInfo>();
      }
      pkg.reqFeatures.add(fi);
      if (fi.name == null) {
        ConfigurationInfo cPref=new ConfigurationInfo();
        cPref.reqGlEsVersion=fi.reqGlEsVersion;
        pkg.configPreferences.add(cPref);
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (SDK_VERSION > 0) {
        sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestUsesSdk);
        int minVers=0;
        String minCode=null;
        int targetVers=0;
        String targetCode=null;
        TypedValue val=sa.peekValue(com.android.internal.R.styleable.AndroidManifestUsesSdk_minSdkVersion);
        if (val != null) {
          if (val.type == TypedValue.TYPE_STRING && val.string != null) {
            targetCode=minCode=val.string.toString();
          }
 else {
            targetVers=minVers=val.data;
          }
        }
        val=sa.peekValue(com.android.internal.R.styleable.AndroidManifestUsesSdk_targetSdkVersion);
        if (val != null) {
          if (val.type == TypedValue.TYPE_STRING && val.string != null) {
            targetCode=minCode=val.string.toString();
          }
 else {
            targetVers=val.data;
          }
        }
        sa.recycle();
        if (minCode != null) {
          if (!minCode.equals(SDK_CODENAME)) {
            if (SDK_CODENAME != null) {
              outError[0]="String_Node_Str" + minCode + "String_Node_Str"+ SDK_CODENAME+ "String_Node_Str";
            }
 else {
              outError[0]="String_Node_Str" + minCode + "String_Node_Str";
            }
            mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
            return null;
          }
        }
 else         if (minVers > SDK_VERSION) {
          outError[0]="String_Node_Str" + minVers + "String_Node_Str"+ SDK_VERSION+ "String_Node_Str";
          mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
          return null;
        }
        if (targetCode != null) {
          if (!targetCode.equals(SDK_CODENAME)) {
            if (SDK_CODENAME != null) {
              outError[0]="String_Node_Str" + targetCode + "String_Node_Str"+ SDK_CODENAME+ "String_Node_Str";
            }
 else {
              outError[0]="String_Node_Str" + targetCode + "String_Node_Str";
            }
            mParseError=PackageManager.INSTALL_FAILED_OLDER_SDK;
            return null;
          }
          pkg.applicationInfo.targetSdkVersion=android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
        }
 else {
          pkg.applicationInfo.targetSdkVersion=targetVers;
        }
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestSupportsScreens);
      supportsSmallScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_smallScreens,supportsSmallScreens);
      supportsNormalScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_normalScreens,supportsNormalScreens);
      supportsLargeScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_largeScreens,supportsLargeScreens);
      supportsXLargeScreens=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_xlargeScreens,supportsXLargeScreens);
      resizeable=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,resizeable);
      anyDensity=sa.getInteger(com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,anyDensity);
      sa.recycle();
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestProtectedBroadcast);
      String name=sa.getNonResourceString(com.android.internal.R.styleable.AndroidManifestProtectedBroadcast_name);
      sa.recycle();
      if (name != null && (flags & PARSE_IS_SYSTEM) != 0) {
        if (pkg.protectedBroadcasts == null) {
          pkg.protectedBroadcasts=new ArrayList<String>();
        }
        if (!pkg.protectedBroadcasts.contains(name)) {
          pkg.protectedBroadcasts.add(name.intern());
        }
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      if (parseInstrumentation(pkg,res,parser,attrs,outError) == null) {
        return null;
      }
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestOriginalPackage);
      String orig=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestOriginalPackage_name,0);
      if (!pkg.packageName.equals(orig)) {
        if (pkg.mOriginalPackages == null) {
          pkg.mOriginalPackages=new ArrayList<String>();
          pkg.mRealPackage=pkg.packageName;
        }
        pkg.mOriginalPackages.add(orig);
      }
      sa.recycle();
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      sa=res.obtainAttributes(attrs,com.android.internal.R.styleable.AndroidManifestOriginalPackage);
      String name=sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestOriginalPackage_name,0);
      sa.recycle();
      if (name != null) {
        if (pkg.mAdoptPermissions == null) {
          pkg.mAdoptPermissions=new ArrayList<String>();
        }
        pkg.mAdoptPermissions.add(name);
      }
      XmlUtils.skipCurrentTag(parser);
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
 else     if (tagName.equals("String_Node_Str")) {
      pkg.mIsThemeApk=true;
      pkg.mThemeInfos.add(new ThemeInfo(parser,res,attrs));
    }
 else     if (RIGID_PARSER) {
      outError[0]="String_Node_Str" + parser.getName();
      mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
      return null;
    }
 else {
      Log.w(TAG,"String_Node_Str" + parser.getName() + "String_Node_Str"+ mArchiveSourcePath+ "String_Node_Str"+ parser.getPositionDescription());
      XmlUtils.skipCurrentTag(parser);
      continue;
    }
  }
  if (!foundApp && pkg.instrumentation.size() == 0) {
    outError[0]="String_Node_Str";
    mParseError=PackageManager.INSTALL_PARSE_FAILED_MANIFEST_EMPTY;
  }
  final int NP=PackageParser.NEW_PERMISSIONS.length;
  StringBuilder implicitPerms=null;
  for (int ip=0; ip < NP; ip++) {
    final PackageParser.NewPermissionInfo npi=PackageParser.NEW_PERMISSIONS[ip];
    if (pkg.applicationInfo.targetSdkVersion >= npi.sdkVersion) {
      break;
    }
    if (!pkg.requestedPermissions.contains(npi.name)) {
      if (implicitPerms == null) {
        implicitPerms=new StringBuilder(128);
        implicitPerms.append(pkg.packageName);
        implicitPerms.append("String_Node_Str");
      }
 else {
        implicitPerms.append(' ');
      }
      implicitPerms.append(npi.name);
      pkg.requestedPermissions.add(npi.name);
    }
  }
  if (implicitPerms != null) {
    Log.i(TAG,implicitPerms.toString());
  }
  if (supportsSmallScreens < 0 || (supportsSmallScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS;
  }
  if (supportsNormalScreens != 0) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS;
  }
  if (supportsLargeScreens < 0 || (supportsLargeScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
  }
  if (supportsXLargeScreens < 0 || (supportsXLargeScreens > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.GINGERBREAD)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS;
  }
  if (resizeable < 0 || (resizeable > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS;
  }
  if (anyDensity < 0 || (anyDensity > 0 && pkg.applicationInfo.targetSdkVersion >= android.os.Build.VERSION_CODES.DONUT)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
  }
  if (pkg.mIsThemeApk) {
    pkg.applicationInfo.isThemeable=false;
  }
  return pkg;
}