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

Commit 8d09a744 authored by Guang Zhu's avatar Guang Zhu Committed by Android (Google) Code Review
Browse files

Merge "pass stream contents in separate thread for executeShellCommand"

parents d81e0056 14e26012
Loading
Loading
Loading
Loading
+29 −24
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
    }

    @Override
    public void executeShellCommand(String command, ParcelFileDescriptor sink)
    public void executeShellCommand(final String command, final ParcelFileDescriptor sink)
            throws RemoteException {
        synchronized (mLock) {
            throwIfCalledByNotTrustedUidLocked();
@@ -235,6 +235,8 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
            throwIfNotConnectedLocked();
        }

        Thread streamReader = new Thread() {
            public void run() {
                InputStream in = null;
                OutputStream out = null;

@@ -259,6 +261,9 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
                    IoUtils.closeQuietly(out);
                    IoUtils.closeQuietly(sink);
                }
            };
        };
        streamReader.start();
    }

    @Override