Program: 22460
Project: 22460
Buggy source:
private void processPendingMove(final MoveParams mp,final int currentStatus){
  mHandler.post(new Runnable(){
    public void run(){
      mHandler.removeCallbacks(this);
      int returnCode=currentStatus;
      if (currentStatus == PackageManager.MOVE_SUCCEEDED) {
        int uidArr[]=null;
        ArrayList<String> pkgList=null;
synchronized (mPackages) {
          PackageParser.Package pkg=mPackages.get(mp.packageName);
          if (pkg == null) {
            Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str");
            returnCode=PackageManager.MOVE_FAILED_DOESNT_EXIST;
          }
 else           if (!mp.srcArgs.getCodePath().equals(pkg.applicationInfo.sourceDir)) {
            Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str"+ mp.srcArgs.getCodePath()+ "String_Node_Str"+ pkg.applicationInfo.sourceDir+ "String_Node_Str");
            returnCode=PackageManager.MOVE_FAILED_INTERNAL_ERROR;
          }
 else {
            uidArr=new int[]{pkg.applicationInfo.uid};
            pkgList=new ArrayList<String>();
            pkgList.add(mp.packageName);
          }
        }
        if (returnCode == PackageManager.MOVE_SUCCEEDED) {
          sendResourcesChangedBroadcast(false,pkgList,uidArr);
synchronized (mInstallLock) {
synchronized (mPackages) {
              PackageParser.Package pkg=mPackages.get(mp.packageName);
              if (pkg == null) {
                Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str");
                returnCode=PackageManager.MOVE_FAILED_DOESNT_EXIST;
              }
 else               if (!mp.srcArgs.getCodePath().equals(pkg.applicationInfo.sourceDir)) {
                Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str"+ mp.srcArgs.getCodePath()+ "String_Node_Str"+ pkg.applicationInfo.sourceDir+ "String_Node_Str");
                returnCode=PackageManager.MOVE_FAILED_INTERNAL_ERROR;
              }
 else {
                String oldCodePath=pkg.mPath;
                String newCodePath=mp.targetArgs.getCodePath();
                String newResPath=mp.targetArgs.getResourcePath();
                pkg.mPath=newCodePath;
                if (moveDexFilesLI(pkg) != PackageManager.INSTALL_SUCCEEDED) {
                  pkg.mPath=pkg.mScanPath;
                  returnCode=PackageManager.MOVE_FAILED_INSUFFICIENT_STORAGE;
                }
 else {
                  pkg.mScanPath=newCodePath;
                  pkg.applicationInfo.sourceDir=newCodePath;
                  pkg.applicationInfo.publicSourceDir=newResPath;
                  PackageSetting ps=(PackageSetting)pkg.mExtras;
                  ps.codePath=new File(pkg.applicationInfo.sourceDir);
                  ps.codePathString=ps.codePath.getPath();
                  ps.resourcePath=new File(pkg.applicationInfo.publicSourceDir);
                  ps.resourcePathString=ps.resourcePath.getPath();
                  if ((mp.flags & PackageManager.INSTALL_EXTERNAL) != 0) {
                    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_EXTERNAL_STORAGE;
                  }
 else {
                    pkg.applicationInfo.flags&=~ApplicationInfo.FLAG_EXTERNAL_STORAGE;
                  }
                  ps.setFlags(pkg.applicationInfo.flags);
                  mAppDirs.remove(oldCodePath);
                  mAppDirs.put(newCodePath,pkg);
                  mSettings.writeLP();
                }
              }
            }
            sendResourcesChangedBroadcast(true,pkgList,uidArr);
          }
        }
      }
      if (returnCode != PackageManager.MOVE_SUCCEEDED) {
        if (mp.targetArgs != null) {
          mp.targetArgs.doPostInstall(PackageManager.INSTALL_FAILED_INTERNAL_ERROR);
        }
      }
 else {
        Runtime.getRuntime().gc();
synchronized (mInstallLock) {
          mp.srcArgs.doPostDeleteLI(true);
        }
      }
      IPackageMoveObserver observer=mp.observer;
      if (observer != null) {
        try {
          observer.packageMoved(mp.packageName,returnCode);
        }
 catch (        RemoteException e) {
          Log.i(TAG,"String_Node_Str");
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void processPendingMove(final MoveParams mp,final int currentStatus){
  mHandler.post(new Runnable(){
    public void run(){
      mHandler.removeCallbacks(this);
      int returnCode=currentStatus;
      if (currentStatus == PackageManager.MOVE_SUCCEEDED) {
        int uidArr[]=null;
        ArrayList<String> pkgList=null;
synchronized (mPackages) {
          PackageParser.Package pkg=mPackages.get(mp.packageName);
          if (pkg == null) {
            Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str");
            returnCode=PackageManager.MOVE_FAILED_DOESNT_EXIST;
          }
 else           if (!mp.srcArgs.getCodePath().equals(pkg.applicationInfo.sourceDir)) {
            Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str"+ mp.srcArgs.getCodePath()+ "String_Node_Str"+ pkg.applicationInfo.sourceDir+ "String_Node_Str");
            returnCode=PackageManager.MOVE_FAILED_INTERNAL_ERROR;
          }
 else {
            uidArr=new int[]{pkg.applicationInfo.uid};
            pkgList=new ArrayList<String>();
            pkgList.add(mp.packageName);
          }
        }
        if (returnCode == PackageManager.MOVE_SUCCEEDED) {
          sendResourcesChangedBroadcast(false,pkgList,uidArr,null);
synchronized (mInstallLock) {
synchronized (mPackages) {
              PackageParser.Package pkg=mPackages.get(mp.packageName);
              if (pkg == null) {
                Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str");
                returnCode=PackageManager.MOVE_FAILED_DOESNT_EXIST;
              }
 else               if (!mp.srcArgs.getCodePath().equals(pkg.applicationInfo.sourceDir)) {
                Slog.w(TAG,"String_Node_Str" + mp.packageName + "String_Node_Str"+ mp.srcArgs.getCodePath()+ "String_Node_Str"+ pkg.applicationInfo.sourceDir+ "String_Node_Str");
                returnCode=PackageManager.MOVE_FAILED_INTERNAL_ERROR;
              }
 else {
                String oldCodePath=pkg.mPath;
                String newCodePath=mp.targetArgs.getCodePath();
                String newResPath=mp.targetArgs.getResourcePath();
                pkg.mPath=newCodePath;
                if (moveDexFilesLI(pkg) != PackageManager.INSTALL_SUCCEEDED) {
                  pkg.mPath=pkg.mScanPath;
                  returnCode=PackageManager.MOVE_FAILED_INSUFFICIENT_STORAGE;
                }
 else {
                  pkg.mScanPath=newCodePath;
                  pkg.applicationInfo.sourceDir=newCodePath;
                  pkg.applicationInfo.publicSourceDir=newResPath;
                  PackageSetting ps=(PackageSetting)pkg.mExtras;
                  ps.codePath=new File(pkg.applicationInfo.sourceDir);
                  ps.codePathString=ps.codePath.getPath();
                  ps.resourcePath=new File(pkg.applicationInfo.publicSourceDir);
                  ps.resourcePathString=ps.resourcePath.getPath();
                  if ((mp.flags & PackageManager.INSTALL_EXTERNAL) != 0) {
                    pkg.applicationInfo.flags|=ApplicationInfo.FLAG_EXTERNAL_STORAGE;
                  }
 else {
                    pkg.applicationInfo.flags&=~ApplicationInfo.FLAG_EXTERNAL_STORAGE;
                  }
                  ps.setFlags(pkg.applicationInfo.flags);
                  mAppDirs.remove(oldCodePath);
                  mAppDirs.put(newCodePath,pkg);
                  mSettings.writeLP();
                }
              }
            }
            sendResourcesChangedBroadcast(true,pkgList,uidArr,null);
          }
        }
      }
      if (returnCode != PackageManager.MOVE_SUCCEEDED) {
        if (mp.targetArgs != null) {
          mp.targetArgs.doPostInstall(PackageManager.INSTALL_FAILED_INTERNAL_ERROR);
        }
      }
 else {
        Runtime.getRuntime().gc();
synchronized (mInstallLock) {
          mp.srcArgs.doPostDeleteLI(true);
        }
      }
      IPackageMoveObserver observer=mp.observer;
      if (observer != null) {
        try {
          observer.packageMoved(mp.packageName,returnCode);
        }
 catch (        RemoteException e) {
          Log.i(TAG,"String_Node_Str");
        }
      }
    }
  }
);
}