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@lists.freedesktop.org
          Reporter: andr...@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.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to