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

@@ -77,6 +77,7 @@ public class AtomicFile {
public void finishWrite(FileOutputStream str) {
if (str != null) {
FileUtils.sync(str);
try {
str.close();
mBackupName.delete();
@@ -88,6 +89,7 @@ public class AtomicFile {
public void failWrite(FileOutputStream str) {
if (str != null) {
FileUtils.sync(str);
try {
str.close();
mBaseName.delete();
@@ -109,6 +111,7 @@ public class AtomicFile {
public void truncate() throws IOException {
try {
FileOutputStream fos = new FileOutputStream(mBaseName);
FileUtils.sync(fos);
fos.close();
} catch (FileNotFoundException e) {
throw new IOException("Couldn't append " + mBaseName);

View File

@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothHeadset;
import android.net.TrafficStats;
import android.os.BatteryManager;
import android.os.BatteryStats;
import android.os.FileUtils;
import android.os.Handler;
import android.os.Message;
import android.os.Parcel;
@@ -4490,6 +4491,7 @@ public final class BatteryStatsImpl extends BatteryStats {
FileOutputStream stream = new FileOutputStream(mFile.chooseForWrite());
stream.write(next.marshall());
stream.flush();
FileUtils.sync(stream);
stream.close();
mFile.commit();
} catch (IOException e) {