[Libreoffice-bugs] [Bug 111398] New: Use a single thread for data transmission

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Aug 5 15:16:11 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=111398

            Bug ID: 111398
           Summary: Use a single thread for data transmission
           Product: Impress Remote
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Android app
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: andrzej at ahunt.org

We currently try to spawn a new thread every time we need to post a command
from the app:
https://gerrit.libreoffice.org/gitweb?p=impress_remote.git;a=blob;f=android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/communication/CommandsTransmitter.java;h=1c01618741b64938f24be6edbbe4d8665cfd5ec2;hb=refs/heads/master#l42

I'm currently converting this to an AsyncTask which is already an improvement
(depending on version, AsyncTask uses a single thread, or pool of threads) -
however we should ideally ensure only a single thread is used for all
communication, which we could do by creating a handler specific to the socket
and posting the AsyncTask to that handler.

Rather oddly, this method actually crashed on my N6P running Android 7.1 (i.e.
before the AsyncTask conversion):
> android.os.NetworkOnMainThreadException
> at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
> at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)

I'm guessing Android's StrictMode thread detection gets confused when you
create arbitrary threads, there's probably not much point in debugging that
since creating Thread's in that way is very un-Androidy anyway.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170805/a1e3ab8b/attachment-0001.html>


More information about the Libreoffice-bugs mailing list