am 13e46665: am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to have their UID changed over time." into gingerbread

Merge commit '13e46665ff69c1a37880762d7d611aacdf02dac7'

* commit '13e46665ff69c1a37880762d7d611aacdf02dac7':
  Work on issue #3101415: Crespo apps seem to have their UID changed over time.
This commit is contained in:
Dianne Hackborn
2010-10-18 08:04:47 -07:00
committed by Android Git Automerger
11 changed files with 52 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.BatteryManager;
import android.os.Binder;
import android.os.FileUtils;
import android.os.IBinder;
import android.os.DropBoxManager;
import android.os.RemoteException;
@@ -405,7 +406,7 @@ class BatteryService extends Binder {
dumpFile = new File(DUMPSYS_DATA_PATH + BATTERY_STATS_SERVICE_NAME + ".dump");
dumpStream = new FileOutputStream(dumpFile);
batteryInfoService.dump(dumpStream.getFD(), DUMPSYS_ARGS);
dumpStream.getFD().sync();
FileUtils.sync(dumpStream);
// add dump file to drop box
db.addFile("BATTERY_DISCHARGE_INFO", dumpFile, DropBoxManager.IS_TEXT);

View File

@@ -26,6 +26,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Debug;
import android.os.DropBoxManager;
import android.os.FileUtils;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.os.StatFs;
@@ -183,7 +184,8 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
int bufferSize = mBlockSize;
if (bufferSize > 4096) bufferSize = 4096;
if (bufferSize < 512) bufferSize = 512;
output = new BufferedOutputStream(new FileOutputStream(temp), bufferSize);
FileOutputStream foutput = new FileOutputStream(temp);
output = new BufferedOutputStream(foutput, bufferSize);
if (read == buffer.length && ((flags & DropBoxManager.IS_GZIPPED) == 0)) {
output = new GZIPOutputStream(output);
flags = flags | DropBoxManager.IS_GZIPPED;
@@ -200,6 +202,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
read = input.read(buffer);
if (read <= 0) {
FileUtils.sync(foutput);
output.close(); // Get a final size measurement
output = null;
} else {

View File

@@ -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();
}

View File

@@ -35,6 +35,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Binder;
import android.os.Bundle;
import android.os.FileUtils;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.FileObserver;
@@ -836,6 +837,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
} catch (IOException ex) {}
}
if (fos != null) {
FileUtils.sync(fos);
try {
fos.close();
} catch (IOException ex) {}

View File

@@ -6151,6 +6151,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.w(TAG, "Failure writing last done pre-boot receivers", e);
file.delete();
} finally {
FileUtils.sync(fos);
if (dos != null) {
try {
dos.close();

View File

@@ -23,6 +23,8 @@ import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import com.android.internal.os.PkgUsageStats;
import android.os.FileUtils;
import android.os.Parcel;
import android.os.Process;
import android.os.ServiceManager;
@@ -471,6 +473,7 @@ public final class UsageStatsService extends IUsageStats.Stub {
out.recycle();
stream.flush();
} finally {
FileUtils.sync(stream);
stream.close();
}
}