Program: 42181
Project: 42181
Buggy source:
private PackageParser.Package scanPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode){
  File scanFile=new File(pkg.mScanPath);
  if (scanFile == null || pkg.applicationInfo.sourceDir == null || pkg.applicationInfo.publicSourceDir == null) {
    Slog.w(TAG,"String_Node_Str");
    mLastScanError=PackageManager.INSTALL_FAILED_INVALID_APK;
    return null;
  }
  mScanningPath=scanFile;
  if (pkg == null) {
    mLastScanError=PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
    return null;
  }
  if ((parseFlags & PackageParser.PARSE_IS_SYSTEM) != 0) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SYSTEM;
  }
  if (pkg.packageName.equals("String_Node_Str")) {
synchronized (mPackages) {
      if (mAndroidApplication != null) {
        Slog.w(TAG,"String_Node_Str");
        Slog.w(TAG,"String_Node_Str");
        Slog.w(TAG,"String_Node_Str" + mScanningPath);
        Slog.w(TAG,"String_Node_Str");
        mLastScanError=PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
        return null;
      }
      mPlatformPackage=pkg;
      pkg.mVersionCode=mSdkVersion;
      mAndroidApplication=pkg.applicationInfo;
      mResolveActivity.applicationInfo=mAndroidApplication;
      mResolveActivity.name=ResolverActivity.class.getName();
      mResolveActivity.packageName=mAndroidApplication.packageName;
      mResolveActivity.processName=mAndroidApplication.processName;
      mResolveActivity.launchMode=ActivityInfo.LAUNCH_MULTIPLE;
      mResolveActivity.flags=ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
      mResolveActivity.theme=com.android.internal.R.style.Theme_Dialog_Alert;
      mResolveActivity.exported=true;
      mResolveActivity.enabled=true;
      mResolveInfo.activityInfo=mResolveActivity;
      mResolveInfo.priority=0;
      mResolveInfo.preferredOrder=0;
      mResolveInfo.match=0;
      mResolveComponentName=new ComponentName(mAndroidApplication.packageName,mResolveActivity.name);
    }
  }
  if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD)   Log.d(TAG,"String_Node_Str" + pkg.packageName);
  if (mPackages.containsKey(pkg.packageName) || mSharedLibraries.containsKey(pkg.packageName)) {
    Slog.w(TAG,"String_Node_Str");
    Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
    Slog.w(TAG,"String_Node_Str");
    mLastScanError=PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
    return null;
  }
  File destCodeFile=new File(pkg.applicationInfo.sourceDir);
  File destResourceFile=new File(pkg.applicationInfo.publicSourceDir);
  SharedUserSetting suid=null;
  PackageSetting pkgSetting=null;
  boolean removeExisting=false;
  if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
    pkg.mOriginalPackages=null;
    pkg.mRealPackage=null;
    pkg.mAdoptPermissions=null;
  }
synchronized (mPackages) {
    if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) {
      if (mTmpSharedLibraries == null || mTmpSharedLibraries.length < mSharedLibraries.size()) {
        mTmpSharedLibraries=new String[mSharedLibraries.size()];
      }
      int num=0;
      int N=pkg.usesLibraries != null ? pkg.usesLibraries.size() : 0;
      for (int i=0; i < N; i++) {
        String file=mSharedLibraries.get(pkg.usesLibraries.get(i));
        if (file == null) {
          Slog.e(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.usesLibraries.get(i)+ "String_Node_Str");
          mLastScanError=PackageManager.INSTALL_FAILED_MISSING_SHARED_LIBRARY;
          return null;
        }
        mTmpSharedLibraries[num]=file;
        num++;
      }
      N=pkg.usesOptionalLibraries != null ? pkg.usesOptionalLibraries.size() : 0;
      for (int i=0; i < N; i++) {
        String file=mSharedLibraries.get(pkg.usesOptionalLibraries.get(i));
        if (file == null) {
          Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.usesOptionalLibraries.get(i)+ "String_Node_Str");
        }
 else {
          mTmpSharedLibraries[num]=file;
          num++;
        }
      }
      if (num > 0) {
        pkg.usesLibraryFiles=new String[num];
        System.arraycopy(mTmpSharedLibraries,0,pkg.usesLibraryFiles,0,num);
      }
      if (pkg.reqFeatures != null) {
        N=pkg.reqFeatures.size();
        for (int i=0; i < N; i++) {
          FeatureInfo fi=pkg.reqFeatures.get(i);
          if ((fi.flags & FeatureInfo.FLAG_REQUIRED) == 0) {
            continue;
          }
          if (fi.name != null) {
            if (mAvailableFeatures.get(fi.name) == null) {
              Slog.e(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ fi.name+ "String_Node_Str");
              mLastScanError=PackageManager.INSTALL_FAILED_MISSING_FEATURE;
              return null;
            }
          }
        }
      }
    }
    if (pkg.mSharedUserId != null) {
      suid=mSettings.getSharedUserLP(pkg.mSharedUserId,pkg.applicationInfo.flags,true);
      if (suid == null) {
        Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
        mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
        return null;
      }
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD) {
        Log.d(TAG,"String_Node_Str" + pkg.mSharedUserId + "String_Node_Str"+ suid.userId+ "String_Node_Str"+ suid.packages);
      }
    }
    if (false) {
      if (pkg.mOriginalPackages != null) {
        Log.w(TAG,"String_Node_Str");
        Debug.waitForDebugger();
        Log.i(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.mOriginalPackages);
      }
    }
    PackageSetting origPackage=null;
    String realName=null;
    if (pkg.mOriginalPackages != null) {
      String renamed=mSettings.mRenamedPackages.get(pkg.mRealPackage);
      if (pkg.mOriginalPackages.contains(renamed)) {
        realName=pkg.mRealPackage;
        if (!pkg.packageName.equals(renamed)) {
          pkg.setPackageName(renamed);
        }
      }
 else {
        for (int i=pkg.mOriginalPackages.size() - 1; i >= 0; i--) {
          if ((origPackage=mSettings.peekPackageLP(pkg.mOriginalPackages.get(i))) != null) {
            if (!verifyPackageUpdate(origPackage,pkg)) {
              origPackage=null;
              continue;
            }
 else             if (origPackage.sharedUser != null) {
              if (!origPackage.sharedUser.name.equals(pkg.mSharedUserId)) {
                Slog.w(TAG,"String_Node_Str" + origPackage.name + "String_Node_Str"+ pkg.packageName+ "String_Node_Str"+ origPackage.sharedUser.name+ "String_Node_Str"+ pkg.mSharedUserId);
                origPackage=null;
                continue;
              }
            }
 else {
              if (DEBUG_UPGRADE)               Log.v(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ origPackage.name);
            }
            break;
          }
        }
      }
    }
    if (mTransferedPackages.contains(pkg.packageName)) {
      Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
    }
    pkgSetting=mSettings.getPackageLP(pkg,origPackage,realName,suid,destCodeFile,destResourceFile,pkg.applicationInfo.flags,true,false);
    if (pkgSetting == null) {
      Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
      mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
      return null;
    }
    if (pkgSetting.origPackage != null) {
      pkg.setPackageName(origPackage.name);
      String msg="String_Node_Str" + pkgSetting.realName + "String_Node_Str"+ pkgSetting.name;
      reportSettingsProblem(Log.WARN,msg);
      mTransferedPackages.add(origPackage.name);
      pkgSetting.origPackage=null;
    }
    if (realName != null) {
      mTransferedPackages.add(pkg.packageName);
    }
    if (mSettings.mDisabledSysPackages.get(pkg.packageName) != null) {
      pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    pkg.applicationInfo.uid=pkgSetting.userId;
    pkg.mExtras=pkgSetting;
    if (!verifySignaturesLP(pkgSetting,pkg,parseFlags,(scanMode & SCAN_UPDATE_SIGNATURE) != 0)) {
      if ((parseFlags & PackageParser.PARSE_IS_SYSTEM) == 0) {
        mLastScanError=PackageManager.INSTALL_FAILED_UPDATE_INCOMPATIBLE;
        return null;
      }
      pkgSetting.signatures.mSignatures=pkg.mSignatures;
      if (pkgSetting.sharedUser != null) {
        if (!pkgSetting.sharedUser.signatures.mergeSignatures(pkg.mSignatures,false)) {
          mLastScanError=PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
          return null;
        }
      }
      removeExisting=true;
    }
    if ((scanMode & SCAN_NEW_INSTALL) != 0) {
      int N=pkg.providers.size();
      int i;
      for (i=0; i < N; i++) {
        PackageParser.Provider p=pkg.providers.get(i);
        if (p.info.authority != null) {
          String names[]=p.info.authority.split("String_Node_Str");
          for (int j=0; j < names.length; j++) {
            if (mProviders.containsKey(names[j])) {
              PackageParser.Provider other=mProviders.get(names[j]);
              Slog.w(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ pkg.applicationInfo.packageName+ "String_Node_Str"+ ((other != null && other.getComponentName() != null) ? other.getComponentName().getPackageName() : "String_Node_Str"));
              mLastScanError=PackageManager.INSTALL_FAILED_CONFLICTING_PROVIDER;
              return null;
            }
          }
        }
      }
    }
  }
  final String pkgName=pkg.packageName;
  if (removeExisting) {
    boolean useEncryptedFSDir=useEncryptedFilesystemForPackage(pkg);
    if (mInstaller != null) {
      int ret=mInstaller.remove(pkgName,useEncryptedFSDir);
      if (ret != 0) {
        String msg="String_Node_Str" + pkg.packageName + "String_Node_Str";
        reportSettingsProblem(Log.WARN,msg);
        mLastScanError=PackageManager.INSTALL_FAILED_REPLACE_COULDNT_DELETE;
        return null;
      }
    }
    Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
    mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  }
  if (pkg.mAdoptPermissions != null) {
    for (int i=pkg.mAdoptPermissions.size() - 1; i >= 0; i--) {
      String origName=pkg.mAdoptPermissions.get(i);
      PackageSetting orig=mSettings.peekPackageLP(origName);
      if (orig != null) {
        if (verifyPackageUpdate(orig,pkg)) {
          Slog.i(TAG,"String_Node_Str" + origName + "String_Node_Str"+ pkg.packageName);
          mSettings.transferPermissions(origName,pkg.packageName);
        }
      }
    }
  }
  long scanFileTime=scanFile.lastModified();
  final boolean forceDex=(scanMode & SCAN_FORCE_DEX) != 0;
  final boolean scanFileNewer=forceDex || scanFileTime != pkgSetting.getTimeStamp();
  pkg.applicationInfo.processName=fixProcessName(pkg.applicationInfo.packageName,pkg.applicationInfo.processName,pkg.applicationInfo.uid);
  File dataPath;
  if (mPlatformPackage == pkg) {
    dataPath=new File(Environment.getDataDirectory(),"String_Node_Str");
    pkg.applicationInfo.dataDir=dataPath.getPath();
  }
 else {
    boolean useEncryptedFSDir=useEncryptedFilesystemForPackage(pkg);
    dataPath=getDataPathForPackage(pkg);
    boolean uidError=false;
    if (dataPath.exists()) {
      mOutPermissions[1]=0;
      FileUtils.getPermissions(dataPath.getPath(),mOutPermissions);
      if (mOutPermissions[1] == pkg.applicationInfo.uid || !Process.supportsProcesses()) {
        pkg.applicationInfo.dataDir=dataPath.getPath();
      }
 else {
        boolean recovered=false;
        if ((parseFlags & PackageParser.PARSE_IS_SYSTEM) != 0) {
          if (mInstaller != null) {
            int ret=mInstaller.remove(pkgName,useEncryptedFSDir);
            if (ret >= 0) {
              String msg="String_Node_Str" + pkg.packageName + "String_Node_Str"+ mOutPermissions[1]+ "String_Node_Str"+ pkg.applicationInfo.uid+ "String_Node_Str";
              reportSettingsProblem(Log.WARN,msg);
              recovered=true;
              ret=mInstaller.install(pkgName,useEncryptedFSDir,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
              if (ret == -1) {
                msg="String_Node_Str" + pkg.packageName + "String_Node_Str";
                reportSettingsProblem(Log.WARN,msg);
                mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                return null;
              }
            }
          }
          if (!recovered) {
            mHasSystemUidErrors=true;
          }
        }
        if (!recovered) {
          pkg.applicationInfo.dataDir="String_Node_Str" + pkg.applicationInfo.uid + "String_Node_Str"+ mOutPermissions[1];
          String msg="String_Node_Str" + pkg.packageName + "String_Node_Str"+ mOutPermissions[1]+ "String_Node_Str"+ pkg.applicationInfo.uid+ "String_Node_Str";
synchronized (mPackages) {
            mSettings.mReadMessages.append(msg);
            mSettings.mReadMessages.append('\n');
            uidError=true;
            if (!pkgSetting.uidError) {
              reportSettingsProblem(Log.ERROR,msg);
            }
          }
        }
      }
      pkg.applicationInfo.dataDir=dataPath.getPath();
    }
 else {
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGV)       Log.v(TAG,"String_Node_Str" + dataPath);
      if (mInstaller != null) {
        int ret=mInstaller.install(pkgName,useEncryptedFSDir,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
        if (ret < 0) {
          mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
          return null;
        }
      }
 else {
        dataPath.mkdirs();
        if (dataPath.exists()) {
          FileUtils.setPermissions(dataPath.toString(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IXOTH,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
        }
      }
      if (dataPath.exists()) {
        pkg.applicationInfo.dataDir=dataPath.getPath();
      }
 else {
        Slog.w(TAG,"String_Node_Str" + dataPath);
        pkg.applicationInfo.dataDir=null;
      }
    }
    pkgSetting.uidError=uidError;
  }
  if (mInstaller != null) {
    String path=scanFile.getPath();
    if (scanFileNewer) {
      Log.i(TAG,path + "String_Node_Str");
      int err=cachePackageSharedLibsLI(pkg,dataPath,scanFile);
      if (err != PackageManager.INSTALL_SUCCEEDED) {
        mLastScanError=err;
        return null;
      }
    }
    pkg.mScanPath=path;
    if ((scanMode & SCAN_NO_DEX) == 0) {
      if (performDexOptLI(pkg,forceDex) == DEX_OPT_FAILED) {
        mLastScanError=PackageManager.INSTALL_FAILED_DEXOPT;
        return null;
      }
    }
  }
  if (mFactoryTest && pkg.requestedPermissions.contains(android.Manifest.permission.FACTORY_TEST)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_FACTORY_TEST;
  }
  if ((parseFlags & PackageManager.INSTALL_REPLACE_EXISTING) != 0) {
    killApplication(pkg.applicationInfo.packageName,pkg.applicationInfo.uid);
  }
synchronized (mPackages) {
    if ((scanMode & SCAN_MONITOR) != 0) {
      mAppDirs.put(pkg.mPath,pkg);
    }
    mSettings.insertPackageSettingLP(pkgSetting,pkg);
    mPackages.put(pkg.applicationInfo.packageName,pkg);
    mSettings.mPackagesToBeCleaned.remove(pkgName);
    int N=pkg.providers.size();
    StringBuilder r=null;
    int i;
    for (i=0; i < N; i++) {
      PackageParser.Provider p=pkg.providers.get(i);
      p.info.processName=fixProcessName(pkg.applicationInfo.processName,p.info.processName,pkg.applicationInfo.uid);
      mProvidersByComponent.put(new ComponentName(p.info.packageName,p.info.name),p);
      p.syncable=p.info.isSyncable;
      if (p.info.authority != null) {
        String names[]=p.info.authority.split("String_Node_Str");
        p.info.authority=null;
        for (int j=0; j < names.length; j++) {
          if (j == 1 && p.syncable) {
            p=new PackageParser.Provider(p);
            p.syncable=false;
          }
          if (!mProviders.containsKey(names[j])) {
            mProviders.put(names[j],p);
            if (p.info.authority == null) {
              p.info.authority=names[j];
            }
 else {
              p.info.authority=p.info.authority + "String_Node_Str" + names[j];
            }
            if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD)             Log.d(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ p.info.name+ "String_Node_Str"+ p.info.isSyncable);
          }
 else {
            PackageParser.Provider other=mProviders.get(names[j]);
            Slog.w(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ pkg.applicationInfo.packageName+ "String_Node_Str"+ ((other != null && other.getComponentName() != null) ? other.getComponentName().getPackageName() : "String_Node_Str"));
          }
        }
      }
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(p.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.services.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Service s=pkg.services.get(i);
      s.info.processName=fixProcessName(pkg.applicationInfo.processName,s.info.processName,pkg.applicationInfo.uid);
      mServices.addService(s);
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(s.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.receivers.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.receivers.get(i);
      a.info.processName=fixProcessName(pkg.applicationInfo.processName,a.info.processName,pkg.applicationInfo.uid);
      mReceivers.addActivity(a,"String_Node_Str");
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.activities.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.activities.get(i);
      a.info.processName=fixProcessName(pkg.applicationInfo.processName,a.info.processName,pkg.applicationInfo.uid);
      mActivities.addActivity(a,"String_Node_Str");
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissionGroups.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.PermissionGroup pg=pkg.permissionGroups.get(i);
      PackageParser.PermissionGroup cur=mPermissionGroups.get(pg.info.name);
      if (cur == null) {
        mPermissionGroups.put(pg.info.name,pg);
        if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append(pg.info.name);
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + pg.info.name + "String_Node_Str"+ pg.info.packageName+ "String_Node_Str"+ cur.info.packageName);
        if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append("String_Node_Str");
          r.append(pg.info.name);
        }
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissions.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Permission p=pkg.permissions.get(i);
      HashMap<String,BasePermission> permissionMap=p.tree ? mSettings.mPermissionTrees : mSettings.mPermissions;
      p.group=mPermissionGroups.get(p.info.group);
      if (p.info.group == null || p.group != null) {
        BasePermission bp=permissionMap.get(p.info.name);
        if (bp == null) {
          bp=new BasePermission(p.info.name,p.info.packageName,BasePermission.TYPE_NORMAL);
          permissionMap.put(p.info.name,bp);
        }
        if (bp.perm == null) {
          if (bp.sourcePackage == null || bp.sourcePackage.equals(p.info.packageName)) {
            BasePermission tree=findPermissionTreeLP(p.info.name);
            if (tree == null || tree.sourcePackage.equals(p.info.packageName)) {
              bp.packageSetting=pkgSetting;
              bp.perm=p;
              bp.uid=pkg.applicationInfo.uid;
              if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
                if (r == null) {
                  r=new StringBuilder(256);
                }
 else {
                  r.append(' ');
                }
                r.append(p.info.name);
              }
            }
 else {
              Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ tree.name+ "String_Node_Str"+ tree.sourcePackage);
            }
          }
 else {
            Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ bp.sourcePackage);
          }
        }
 else         if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append("String_Node_Str");
          r.append(p.info.name);
        }
        if (bp.perm == p) {
          bp.protectionLevel=p.info.protectionLevel;
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ p.group);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.instrumentation.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Instrumentation a=pkg.instrumentation.get(i);
      a.info.packageName=pkg.applicationInfo.packageName;
      a.info.sourceDir=pkg.applicationInfo.sourceDir;
      a.info.publicSourceDir=pkg.applicationInfo.publicSourceDir;
      a.info.dataDir=pkg.applicationInfo.dataDir;
      mInstrumentation.put(a.getComponentName(),a);
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    if (pkg.protectedBroadcasts != null) {
      N=pkg.protectedBroadcasts.size();
      for (i=0; i < N; i++) {
        mProtectedBroadcasts.add(pkg.protectedBroadcasts.get(i));
      }
    }
    pkgSetting.setTimeStamp(scanFileTime);
  }
  return pkg;
}

Fixed version (ground truth):
private PackageParser.Package scanPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode){
  File scanFile=new File(pkg.mScanPath);
  if (scanFile == null || pkg.applicationInfo.sourceDir == null || pkg.applicationInfo.publicSourceDir == null) {
    Slog.w(TAG,"String_Node_Str");
    mLastScanError=PackageManager.INSTALL_FAILED_INVALID_APK;
    return null;
  }
  mScanningPath=scanFile;
  if (pkg == null) {
    mLastScanError=PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
    return null;
  }
  if ((parseFlags & PackageParser.PARSE_IS_SYSTEM) != 0) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_SYSTEM;
  }
  if (pkg.packageName.equals("String_Node_Str")) {
synchronized (mPackages) {
      if (mAndroidApplication != null) {
        Slog.w(TAG,"String_Node_Str");
        Slog.w(TAG,"String_Node_Str");
        Slog.w(TAG,"String_Node_Str" + mScanningPath);
        Slog.w(TAG,"String_Node_Str");
        mLastScanError=PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
        return null;
      }
      mPlatformPackage=pkg;
      pkg.mVersionCode=mSdkVersion;
      mAndroidApplication=pkg.applicationInfo;
      mResolveActivity.applicationInfo=mAndroidApplication;
      mResolveActivity.name=ResolverActivity.class.getName();
      mResolveActivity.packageName=mAndroidApplication.packageName;
      mResolveActivity.processName=mAndroidApplication.processName;
      mResolveActivity.launchMode=ActivityInfo.LAUNCH_MULTIPLE;
      mResolveActivity.flags=ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
      mResolveActivity.theme=com.android.internal.R.style.Theme_Dialog_Alert;
      mResolveActivity.exported=true;
      mResolveActivity.enabled=true;
      mResolveInfo.activityInfo=mResolveActivity;
      mResolveInfo.priority=0;
      mResolveInfo.preferredOrder=0;
      mResolveInfo.match=0;
      mResolveComponentName=new ComponentName(mAndroidApplication.packageName,mResolveActivity.name);
    }
  }
  if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD)   Log.d(TAG,"String_Node_Str" + pkg.packageName);
  if (mPackages.containsKey(pkg.packageName) || mSharedLibraries.containsKey(pkg.packageName)) {
    Slog.w(TAG,"String_Node_Str");
    Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
    Slog.w(TAG,"String_Node_Str");
    mLastScanError=PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
    return null;
  }
  File destCodeFile=new File(pkg.applicationInfo.sourceDir);
  File destResourceFile=new File(pkg.applicationInfo.publicSourceDir);
  SharedUserSetting suid=null;
  PackageSetting pkgSetting=null;
  if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
    pkg.mOriginalPackages=null;
    pkg.mRealPackage=null;
    pkg.mAdoptPermissions=null;
  }
synchronized (mPackages) {
    if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) {
      if (mTmpSharedLibraries == null || mTmpSharedLibraries.length < mSharedLibraries.size()) {
        mTmpSharedLibraries=new String[mSharedLibraries.size()];
      }
      int num=0;
      int N=pkg.usesLibraries != null ? pkg.usesLibraries.size() : 0;
      for (int i=0; i < N; i++) {
        String file=mSharedLibraries.get(pkg.usesLibraries.get(i));
        if (file == null) {
          Slog.e(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.usesLibraries.get(i)+ "String_Node_Str");
          mLastScanError=PackageManager.INSTALL_FAILED_MISSING_SHARED_LIBRARY;
          return null;
        }
        mTmpSharedLibraries[num]=file;
        num++;
      }
      N=pkg.usesOptionalLibraries != null ? pkg.usesOptionalLibraries.size() : 0;
      for (int i=0; i < N; i++) {
        String file=mSharedLibraries.get(pkg.usesOptionalLibraries.get(i));
        if (file == null) {
          Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.usesOptionalLibraries.get(i)+ "String_Node_Str");
        }
 else {
          mTmpSharedLibraries[num]=file;
          num++;
        }
      }
      if (num > 0) {
        pkg.usesLibraryFiles=new String[num];
        System.arraycopy(mTmpSharedLibraries,0,pkg.usesLibraryFiles,0,num);
      }
      if (pkg.reqFeatures != null) {
        N=pkg.reqFeatures.size();
        for (int i=0; i < N; i++) {
          FeatureInfo fi=pkg.reqFeatures.get(i);
          if ((fi.flags & FeatureInfo.FLAG_REQUIRED) == 0) {
            continue;
          }
          if (fi.name != null) {
            if (mAvailableFeatures.get(fi.name) == null) {
              Slog.e(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ fi.name+ "String_Node_Str");
              mLastScanError=PackageManager.INSTALL_FAILED_MISSING_FEATURE;
              return null;
            }
          }
        }
      }
    }
    if (pkg.mSharedUserId != null) {
      suid=mSettings.getSharedUserLP(pkg.mSharedUserId,pkg.applicationInfo.flags,true);
      if (suid == null) {
        Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
        mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
        return null;
      }
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD) {
        Log.d(TAG,"String_Node_Str" + pkg.mSharedUserId + "String_Node_Str"+ suid.userId+ "String_Node_Str"+ suid.packages);
      }
    }
    if (false) {
      if (pkg.mOriginalPackages != null) {
        Log.w(TAG,"String_Node_Str");
        Debug.waitForDebugger();
        Log.i(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ pkg.mOriginalPackages);
      }
    }
    PackageSetting origPackage=null;
    String realName=null;
    if (pkg.mOriginalPackages != null) {
      String renamed=mSettings.mRenamedPackages.get(pkg.mRealPackage);
      if (pkg.mOriginalPackages.contains(renamed)) {
        realName=pkg.mRealPackage;
        if (!pkg.packageName.equals(renamed)) {
          pkg.setPackageName(renamed);
        }
      }
 else {
        for (int i=pkg.mOriginalPackages.size() - 1; i >= 0; i--) {
          if ((origPackage=mSettings.peekPackageLP(pkg.mOriginalPackages.get(i))) != null) {
            if (!verifyPackageUpdate(origPackage,pkg)) {
              origPackage=null;
              continue;
            }
 else             if (origPackage.sharedUser != null) {
              if (!origPackage.sharedUser.name.equals(pkg.mSharedUserId)) {
                Slog.w(TAG,"String_Node_Str" + origPackage.name + "String_Node_Str"+ pkg.packageName+ "String_Node_Str"+ origPackage.sharedUser.name+ "String_Node_Str"+ pkg.mSharedUserId);
                origPackage=null;
                continue;
              }
            }
 else {
              if (DEBUG_UPGRADE)               Log.v(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str"+ origPackage.name);
            }
            break;
          }
        }
      }
    }
    if (mTransferedPackages.contains(pkg.packageName)) {
      Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
    }
    pkgSetting=mSettings.getPackageLP(pkg,origPackage,realName,suid,destCodeFile,destResourceFile,pkg.applicationInfo.flags,true,false);
    if (pkgSetting == null) {
      Slog.w(TAG,"String_Node_Str" + pkg.packageName + "String_Node_Str");
      mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
      return null;
    }
    if (pkgSetting.origPackage != null) {
      pkg.setPackageName(origPackage.name);
      String msg="String_Node_Str" + pkgSetting.realName + "String_Node_Str"+ pkgSetting.name;
      reportSettingsProblem(Log.WARN,msg);
      mTransferedPackages.add(origPackage.name);
      pkgSetting.origPackage=null;
    }
    if (realName != null) {
      mTransferedPackages.add(pkg.packageName);
    }
    if (mSettings.mDisabledSysPackages.get(pkg.packageName) != null) {
      pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    pkg.applicationInfo.uid=pkgSetting.userId;
    pkg.mExtras=pkgSetting;
    if (!verifySignaturesLP(pkgSetting,pkg,parseFlags,(scanMode & SCAN_UPDATE_SIGNATURE) != 0)) {
      if ((parseFlags & PackageParser.PARSE_IS_SYSTEM_DIR) == 0) {
        mLastScanError=PackageManager.INSTALL_FAILED_UPDATE_INCOMPATIBLE;
        return null;
      }
      pkgSetting.signatures.mSignatures=pkg.mSignatures;
      if (pkgSetting.sharedUser != null) {
        if (!pkgSetting.sharedUser.signatures.mergeSignatures(pkg.mSignatures,false)) {
          mLastScanError=PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
          return null;
        }
      }
      String msg="String_Node_Str" + pkg.packageName + "String_Node_Str";
      reportSettingsProblem(Log.WARN,msg);
    }
    if ((scanMode & SCAN_NEW_INSTALL) != 0) {
      int N=pkg.providers.size();
      int i;
      for (i=0; i < N; i++) {
        PackageParser.Provider p=pkg.providers.get(i);
        if (p.info.authority != null) {
          String names[]=p.info.authority.split("String_Node_Str");
          for (int j=0; j < names.length; j++) {
            if (mProviders.containsKey(names[j])) {
              PackageParser.Provider other=mProviders.get(names[j]);
              Slog.w(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ pkg.applicationInfo.packageName+ "String_Node_Str"+ ((other != null && other.getComponentName() != null) ? other.getComponentName().getPackageName() : "String_Node_Str"));
              mLastScanError=PackageManager.INSTALL_FAILED_CONFLICTING_PROVIDER;
              return null;
            }
          }
        }
      }
    }
  }
  final String pkgName=pkg.packageName;
  if (pkg.mAdoptPermissions != null) {
    for (int i=pkg.mAdoptPermissions.size() - 1; i >= 0; i--) {
      String origName=pkg.mAdoptPermissions.get(i);
      PackageSetting orig=mSettings.peekPackageLP(origName);
      if (orig != null) {
        if (verifyPackageUpdate(orig,pkg)) {
          Slog.i(TAG,"String_Node_Str" + origName + "String_Node_Str"+ pkg.packageName);
          mSettings.transferPermissions(origName,pkg.packageName);
        }
      }
    }
  }
  long scanFileTime=scanFile.lastModified();
  final boolean forceDex=(scanMode & SCAN_FORCE_DEX) != 0;
  final boolean scanFileNewer=forceDex || scanFileTime != pkgSetting.getTimeStamp();
  pkg.applicationInfo.processName=fixProcessName(pkg.applicationInfo.packageName,pkg.applicationInfo.processName,pkg.applicationInfo.uid);
  File dataPath;
  if (mPlatformPackage == pkg) {
    dataPath=new File(Environment.getDataDirectory(),"String_Node_Str");
    pkg.applicationInfo.dataDir=dataPath.getPath();
  }
 else {
    boolean useEncryptedFSDir=useEncryptedFilesystemForPackage(pkg);
    dataPath=getDataPathForPackage(pkg);
    boolean uidError=false;
    if (dataPath.exists()) {
      mOutPermissions[1]=0;
      FileUtils.getPermissions(dataPath.getPath(),mOutPermissions);
      if (mOutPermissions[1] == pkg.applicationInfo.uid || !Process.supportsProcesses()) {
        pkg.applicationInfo.dataDir=dataPath.getPath();
      }
 else {
        boolean recovered=false;
        if ((parseFlags & PackageParser.PARSE_IS_SYSTEM) != 0) {
          if (mInstaller != null) {
            int ret=mInstaller.remove(pkgName,useEncryptedFSDir);
            if (ret >= 0) {
              String msg="String_Node_Str" + pkg.packageName + "String_Node_Str"+ mOutPermissions[1]+ "String_Node_Str"+ pkg.applicationInfo.uid+ "String_Node_Str";
              reportSettingsProblem(Log.WARN,msg);
              recovered=true;
              ret=mInstaller.install(pkgName,useEncryptedFSDir,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
              if (ret == -1) {
                msg="String_Node_Str" + pkg.packageName + "String_Node_Str";
                reportSettingsProblem(Log.WARN,msg);
                mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                return null;
              }
            }
          }
          if (!recovered) {
            mHasSystemUidErrors=true;
          }
        }
        if (!recovered) {
          pkg.applicationInfo.dataDir="String_Node_Str" + pkg.applicationInfo.uid + "String_Node_Str"+ mOutPermissions[1];
          String msg="String_Node_Str" + pkg.packageName + "String_Node_Str"+ mOutPermissions[1]+ "String_Node_Str"+ pkg.applicationInfo.uid+ "String_Node_Str";
synchronized (mPackages) {
            mSettings.mReadMessages.append(msg);
            mSettings.mReadMessages.append('\n');
            uidError=true;
            if (!pkgSetting.uidError) {
              reportSettingsProblem(Log.ERROR,msg);
            }
          }
        }
      }
      pkg.applicationInfo.dataDir=dataPath.getPath();
    }
 else {
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGV)       Log.v(TAG,"String_Node_Str" + dataPath);
      if (mInstaller != null) {
        int ret=mInstaller.install(pkgName,useEncryptedFSDir,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
        if (ret < 0) {
          mLastScanError=PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
          return null;
        }
      }
 else {
        dataPath.mkdirs();
        if (dataPath.exists()) {
          FileUtils.setPermissions(dataPath.toString(),FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IXOTH,pkg.applicationInfo.uid,pkg.applicationInfo.uid);
        }
      }
      if (dataPath.exists()) {
        pkg.applicationInfo.dataDir=dataPath.getPath();
      }
 else {
        Slog.w(TAG,"String_Node_Str" + dataPath);
        pkg.applicationInfo.dataDir=null;
      }
    }
    pkgSetting.uidError=uidError;
  }
  if (mInstaller != null) {
    String path=scanFile.getPath();
    if (scanFileNewer) {
      Log.i(TAG,path + "String_Node_Str");
      int err=cachePackageSharedLibsLI(pkg,dataPath,scanFile);
      if (err != PackageManager.INSTALL_SUCCEEDED) {
        mLastScanError=err;
        return null;
      }
    }
    pkg.mScanPath=path;
    if ((scanMode & SCAN_NO_DEX) == 0) {
      if (performDexOptLI(pkg,forceDex) == DEX_OPT_FAILED) {
        mLastScanError=PackageManager.INSTALL_FAILED_DEXOPT;
        return null;
      }
    }
  }
  if (mFactoryTest && pkg.requestedPermissions.contains(android.Manifest.permission.FACTORY_TEST)) {
    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_FACTORY_TEST;
  }
  if ((parseFlags & PackageManager.INSTALL_REPLACE_EXISTING) != 0) {
    killApplication(pkg.applicationInfo.packageName,pkg.applicationInfo.uid);
  }
synchronized (mPackages) {
    if ((scanMode & SCAN_MONITOR) != 0) {
      mAppDirs.put(pkg.mPath,pkg);
    }
    mSettings.insertPackageSettingLP(pkgSetting,pkg);
    mPackages.put(pkg.applicationInfo.packageName,pkg);
    mSettings.mPackagesToBeCleaned.remove(pkgName);
    int N=pkg.providers.size();
    StringBuilder r=null;
    int i;
    for (i=0; i < N; i++) {
      PackageParser.Provider p=pkg.providers.get(i);
      p.info.processName=fixProcessName(pkg.applicationInfo.processName,p.info.processName,pkg.applicationInfo.uid);
      mProvidersByComponent.put(new ComponentName(p.info.packageName,p.info.name),p);
      p.syncable=p.info.isSyncable;
      if (p.info.authority != null) {
        String names[]=p.info.authority.split("String_Node_Str");
        p.info.authority=null;
        for (int j=0; j < names.length; j++) {
          if (j == 1 && p.syncable) {
            p=new PackageParser.Provider(p);
            p.syncable=false;
          }
          if (!mProviders.containsKey(names[j])) {
            mProviders.put(names[j],p);
            if (p.info.authority == null) {
              p.info.authority=names[j];
            }
 else {
              p.info.authority=p.info.authority + "String_Node_Str" + names[j];
            }
            if ((parseFlags & PackageParser.PARSE_CHATTY) != 0 && Config.LOGD)             Log.d(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ p.info.name+ "String_Node_Str"+ p.info.isSyncable);
          }
 else {
            PackageParser.Provider other=mProviders.get(names[j]);
            Slog.w(TAG,"String_Node_Str" + names[j] + "String_Node_Str"+ pkg.applicationInfo.packageName+ "String_Node_Str"+ ((other != null && other.getComponentName() != null) ? other.getComponentName().getPackageName() : "String_Node_Str"));
          }
        }
      }
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(p.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.services.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Service s=pkg.services.get(i);
      s.info.processName=fixProcessName(pkg.applicationInfo.processName,s.info.processName,pkg.applicationInfo.uid);
      mServices.addService(s);
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(s.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.receivers.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.receivers.get(i);
      a.info.processName=fixProcessName(pkg.applicationInfo.processName,a.info.processName,pkg.applicationInfo.uid);
      mReceivers.addActivity(a,"String_Node_Str");
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.activities.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Activity a=pkg.activities.get(i);
      a.info.processName=fixProcessName(pkg.applicationInfo.processName,a.info.processName,pkg.applicationInfo.uid);
      mActivities.addActivity(a,"String_Node_Str");
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissionGroups.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.PermissionGroup pg=pkg.permissionGroups.get(i);
      PackageParser.PermissionGroup cur=mPermissionGroups.get(pg.info.name);
      if (cur == null) {
        mPermissionGroups.put(pg.info.name,pg);
        if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append(pg.info.name);
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + pg.info.name + "String_Node_Str"+ pg.info.packageName+ "String_Node_Str"+ cur.info.packageName);
        if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append("String_Node_Str");
          r.append(pg.info.name);
        }
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.permissions.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Permission p=pkg.permissions.get(i);
      HashMap<String,BasePermission> permissionMap=p.tree ? mSettings.mPermissionTrees : mSettings.mPermissions;
      p.group=mPermissionGroups.get(p.info.group);
      if (p.info.group == null || p.group != null) {
        BasePermission bp=permissionMap.get(p.info.name);
        if (bp == null) {
          bp=new BasePermission(p.info.name,p.info.packageName,BasePermission.TYPE_NORMAL);
          permissionMap.put(p.info.name,bp);
        }
        if (bp.perm == null) {
          if (bp.sourcePackage == null || bp.sourcePackage.equals(p.info.packageName)) {
            BasePermission tree=findPermissionTreeLP(p.info.name);
            if (tree == null || tree.sourcePackage.equals(p.info.packageName)) {
              bp.packageSetting=pkgSetting;
              bp.perm=p;
              bp.uid=pkg.applicationInfo.uid;
              if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
                if (r == null) {
                  r=new StringBuilder(256);
                }
 else {
                  r.append(' ');
                }
                r.append(p.info.name);
              }
            }
 else {
              Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ tree.name+ "String_Node_Str"+ tree.sourcePackage);
            }
          }
 else {
            Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ bp.sourcePackage);
          }
        }
 else         if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
          if (r == null) {
            r=new StringBuilder(256);
          }
 else {
            r.append(' ');
          }
          r.append("String_Node_Str");
          r.append(p.info.name);
        }
        if (bp.perm == p) {
          bp.protectionLevel=p.info.protectionLevel;
        }
      }
 else {
        Slog.w(TAG,"String_Node_Str" + p.info.name + "String_Node_Str"+ p.info.packageName+ "String_Node_Str"+ p.group);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    N=pkg.instrumentation.size();
    r=null;
    for (i=0; i < N; i++) {
      PackageParser.Instrumentation a=pkg.instrumentation.get(i);
      a.info.packageName=pkg.applicationInfo.packageName;
      a.info.sourceDir=pkg.applicationInfo.sourceDir;
      a.info.publicSourceDir=pkg.applicationInfo.publicSourceDir;
      a.info.dataDir=pkg.applicationInfo.dataDir;
      mInstrumentation.put(a.getComponentName(),a);
      if ((parseFlags & PackageParser.PARSE_CHATTY) != 0) {
        if (r == null) {
          r=new StringBuilder(256);
        }
 else {
          r.append(' ');
        }
        r.append(a.info.name);
      }
    }
    if (r != null) {
      if (Config.LOGD)       Log.d(TAG,"String_Node_Str" + r);
    }
    if (pkg.protectedBroadcasts != null) {
      N=pkg.protectedBroadcasts.size();
      for (i=0; i < N; i++) {
        mProtectedBroadcasts.add(pkg.protectedBroadcasts.get(i));
      }
    }
    pkgSetting.setTimeStamp(scanFileTime);
  }
  return pkg;
}