diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-10-15 12:54:40 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-10-15 14:46:33 -0700 |
commit | 8bdf5935c0db4a66ab33a10b43398d2523cfa15d (patch) | |
tree | 5483e26cd1fb2de239b2f01f3d35c52aeeb7b598 /services/java/com/android/server/PackageManagerService.java | |
parent | efb581018bbede2ecdc76bcd9722ded5b6903254 (diff) |
Work on issue #3101415: Crespo apps seem to have their UID changed over time.
fsync!
Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
Diffstat (limited to 'services/java/com/android/server/PackageManagerService.java')
-rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 174b3ef87ccf..cc7a027feee3 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -5955,8 +5955,8 @@ class PackageManagerService extends IPackageManager.Stub { private void extractPublicFiles(PackageParser.Package newPackage, File publicZipFile) throws IOException { - final ZipOutputStream publicZipOutStream = - new ZipOutputStream(new FileOutputStream(publicZipFile)); + final FileOutputStream fstr = new FileOutputStream(publicZipFile); + final ZipOutputStream publicZipOutStream = new ZipOutputStream(fstr); final ZipFile privateZip = new ZipFile(newPackage.mPath); // Copy manifest, resources.arsc and res directory to public zip @@ -5981,6 +5981,9 @@ class PackageManagerService extends IPackageManager.Stub { } } + publicZipOutStream.finish(); + publicZipOutStream.flush(); + FileUtils.sync(fstr); publicZipOutStream.close(); FileUtils.setPermissions( publicZipFile.getAbsolutePath(), @@ -8482,8 +8485,8 @@ class PackageManagerService extends IPackageManager.Stub { mPastSignatures.clear(); try { - BufferedOutputStream str = new BufferedOutputStream(new FileOutputStream( - mSettingsFilename)); + FileOutputStream fstr = new FileOutputStream(mSettingsFilename); + BufferedOutputStream str = new BufferedOutputStream(fstr); //XmlSerializer serializer = XmlUtils.serializerInstance(); XmlSerializer serializer = new FastXmlSerializer(); @@ -8564,6 +8567,7 @@ class PackageManagerService extends IPackageManager.Stub { serializer.endDocument(); str.flush(); + FileUtils.sync(fstr); str.close(); // New settings successfully written, old ones are no longer @@ -8580,7 +8584,8 @@ class PackageManagerService extends IPackageManager.Stub { File tempFile = new File(mPackageListFilename.toString() + ".tmp"); JournaledFile journal = new JournaledFile(mPackageListFilename, tempFile); - str = new BufferedOutputStream(new FileOutputStream(journal.chooseForWrite())); + fstr = new FileOutputStream(journal.chooseForWrite()); + str = new BufferedOutputStream(fstr); try { StringBuilder sb = new StringBuilder(); for (PackageSetting pkg : mPackages.values()) { @@ -8616,6 +8621,7 @@ class PackageManagerService extends IPackageManager.Stub { str.write(sb.toString().getBytes()); } str.flush(); + FileUtils.sync(fstr); str.close(); journal.commit(); } |