Merge "Don't prematurely delete temporary files" into jb-mr1-dev
This commit is contained in:
@@ -6334,7 +6334,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
packageFile = mTempPackage;
|
packageFile = mTempPackage;
|
||||||
|
|
||||||
FileUtils.setPermissions(packageFile.getAbsolutePath(),
|
FileUtils.setPermissions(packageFile.getAbsolutePath(),
|
||||||
FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IROTH,
|
FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IRGRP
|
||||||
|
| FileUtils.S_IROTH,
|
||||||
-1, -1);
|
-1, -1);
|
||||||
} else {
|
} else {
|
||||||
packageFile = null;
|
packageFile = null;
|
||||||
@@ -6515,12 +6516,12 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
// will succeed.
|
// will succeed.
|
||||||
if (mArgs != null) {
|
if (mArgs != null) {
|
||||||
processPendingInstall(mArgs, mRet);
|
processPendingInstall(mArgs, mRet);
|
||||||
}
|
|
||||||
|
|
||||||
if (mTempPackage != null) {
|
if (mTempPackage != null) {
|
||||||
if (!mTempPackage.delete()) {
|
if (!mTempPackage.delete()) {
|
||||||
Slog.w(TAG, "Couldn't delete temporary file: "
|
Slog.w(TAG, "Couldn't delete temporary file: " +
|
||||||
+ mTempPackage.getAbsolutePath());
|
mTempPackage.getAbsolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7942,17 +7943,23 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deleteTempPackageFiles() {
|
private void deleteTempPackageFiles() {
|
||||||
FilenameFilter filter = new FilenameFilter() {
|
final FilenameFilter filter = new FilenameFilter() {
|
||||||
public boolean accept(File dir, String name) {
|
public boolean accept(File dir, String name) {
|
||||||
return name.startsWith("vmdl") && name.endsWith(".tmp");
|
return name.startsWith("vmdl") && name.endsWith(".tmp");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
String tmpFilesList[] = mAppInstallDir.list(filter);
|
deleteTempPackageFilesInDirectory(mAppInstallDir, filter);
|
||||||
if(tmpFilesList == null) {
|
deleteTempPackageFilesInDirectory(mDrmAppPrivateInstallDir, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final void deleteTempPackageFilesInDirectory(File directory,
|
||||||
|
FilenameFilter filter) {
|
||||||
|
final String[] tmpFilesList = directory.list(filter);
|
||||||
|
if (tmpFilesList == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < tmpFilesList.length; i++) {
|
for (int i = 0; i < tmpFilesList.length; i++) {
|
||||||
File tmpFile = new File(mAppInstallDir, tmpFilesList[i]);
|
final File tmpFile = new File(directory, tmpFilesList[i]);
|
||||||
tmpFile.delete();
|
tmpFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user