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

Commit 89600b8c authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Revert "Revert "Remove a misleading "flush" function.""" am:...

Merge "Merge "Revert "Revert "Remove a misleading "flush" function.""" am: d9bce3cf am: 80743ffc am: 172d31f8 am: c2129212"
parents d4a9b490 27a81b81
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -75,16 +75,4 @@ import java.io.OutputStream;
        }
        mSocket.write(b, offset, count);
    }

    /**
     * Wait until the data in sending queue is emptied. A polling version
     * for flush implementation. Use it to ensure the writing data afterwards will
     * be packed in the new RFCOMM frame.
     *
     * @throws IOException if an i/o error occurs.
     * @since Android 4.2.3
     */
    public void flush() throws IOException {
        mSocket.flush();
    }
}
+0 −14
Original line number Diff line number Diff line
@@ -515,20 +515,6 @@ public final class BluetoothSocket implements Closeable {
        return mSocketIS.available();
    }

    /**
     * Wait until the data in sending queue is emptied. A polling version
     * for flush implementation. Used to ensure the writing data afterwards will
     * be packed in new RFCOMM frame.
     *
     * @throws IOException if an i/o error occurs.
     */
    @UnsupportedAppUsage
    /*package*/ void flush() throws IOException {
        if (mSocketOS == null) throw new IOException("flush is called on null OutputStream");
        if (VDBG) Log.d(TAG, "flush: " + mSocketOS);
        mSocketOS.flush();
    }

    /*package*/ int read(byte[] b, int offset, int length) throws IOException {
        int ret = 0;
        if (VDBG) Log.d(TAG, "read in:  " + mSocketIS + " len: " + length);
+0 −34
Original line number Diff line number Diff line
@@ -157,40 +157,6 @@ class LocalSocketImpl
                write_native(b, myFd);
            }
        }

        /**
         * Wait until the data in sending queue is emptied. A polling version
         * for flush implementation.
         * @throws IOException
         *             if an i/o error occurs.
         */
        @Override
        public void flush() throws IOException {
            FileDescriptor myFd = fd;
            if (myFd == null) throw new IOException("socket closed");

            // Loop until the output buffer is empty.
            Int32Ref pending = new Int32Ref(0);
            while (true) {
                try {
                    // See linux/net/unix/af_unix.c
                    Os.ioctlInt(myFd, OsConstants.TIOCOUTQ, pending);
                } catch (ErrnoException e) {
                    throw e.rethrowAsIOException();
                }

                if (pending.value <= 0) {
                    // The output buffer is empty.
                    break;
                }

                try {
                    Thread.sleep(10);
                } catch (InterruptedException ie) {
                    break;
                }
            }
        }
    }

    private native int read_native(FileDescriptor fd) throws IOException;
+0 −4
Original line number Diff line number Diff line
@@ -25,15 +25,12 @@ import android.os.PowerManager;
import android.os.RecoverySystem;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.system.ErrnoException;
import android.system.Os;
import android.util.Slog;

import libcore.io.IoUtils;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

@@ -288,7 +285,6 @@ public final class RecoverySystemService extends SystemService {
                    byte[] cmdUtf8 = command.getBytes("UTF-8");
                    dos.writeInt(cmdUtf8.length);
                    dos.write(cmdUtf8, 0, cmdUtf8.length);
                    dos.flush();
                }

                // Read the status from the socket.
+0 −1
Original line number Diff line number Diff line
@@ -2082,7 +2082,6 @@ public class Vpn {
                    }
                    out.write(0xFF);
                    out.write(0xFF);
                    out.flush();

                    // Wait for End-of-File.
                    InputStream in = mSockets[i].getInputStream();