Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13e46665 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to have their UID...

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

Merge commit '736f5ec4' into gingerbread-plus-aosp

* commit '736f5ec4':
  Work on issue #3101415: Crespo apps seem to have their UID changed over time.
parents cf66f587 736f5ec4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3138,6 +3138,7 @@ class ContextImpl extends Context {
                    return;
                }
                XmlUtils.writeMapXml(mcr.mapToWriteToDisk, str);
                FileUtils.sync(str);
                str.close();
                setFilePermissionsFromMode(mFile.getPath(), mMode, 0);
                FileStatus stat = new FileStatus();
+22 −2
Original line number Diff line number Diff line
@@ -92,6 +92,21 @@ public class FileUtils
     */
    public static native int getFatVolumeId(String mountPoint);

    /**
     * Perform an fsync on the given FileOutputStream.  The stream at this
     * point must be flushed but not yet closed.
     */
    public static boolean sync(FileOutputStream stream) {
        try {
            if (stream != null) {
                stream.getFD().sync();
            }
            return true;
        } catch (IOException e) {
        }
        return false;
    }

    // copy a file from srcFile to destFile, return true if succeed, return
    // false if fail
    public static boolean copyFile(File srcFile, File destFile) {
@@ -118,7 +133,7 @@ public class FileUtils
            if (destFile.exists()) {
                destFile.delete();
            }
            OutputStream out = new FileOutputStream(destFile);
            FileOutputStream out = new FileOutputStream(destFile);
            try {
                byte[] buffer = new byte[4096];
                int bytesRead;
@@ -126,6 +141,11 @@ public class FileUtils
                    out.write(buffer, 0, bytesRead);
                }
            } finally {
                out.flush();
                try {
                    out.getFD().sync();
                } catch (IOException e) {
                }
                out.close();
            }
            return true;
+3 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,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;
@@ -4484,6 +4485,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) {
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class SystemKeyStore {
            FileOutputStream fos = new FileOutputStream(keyFile);
            fos.write(retKey);
            fos.flush();
            FileUtils.sync(fos);
            fos.close();
            FileUtils.setPermissions(keyFile.getName(), (FileUtils.S_IRUSR | FileUtils.S_IWUSR),
                -1, -1);
Loading