onilink25 / android-bluez-ime

Automatically exported from code.google.com/p/android-bluez-ime
0 stars 0 forks source link

RfcommReader .stop() starting service #152

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
in RfcommReader.java line 200, there's the following:

m_context.startService(m_foregroundServiceIntent);

Should this not be stopping the service, and therefore be changed to:

m_context.stopService(m_foregroundServiceIntent);

Original issue reported on code.google.com by frat...@gmail.com on 27 Feb 2012 at 2:00

GoogleCodeExporter commented 8 years ago
No, I don't think so.
The service acts as a controller frontend for the actual thread(s).
So calling startService is semantically wrong, but the startService call simply 
passes a message to the service, and the service exits when there are no more 
messages to process. In this case line 200 sends a stop message to the service, 
which will cause it to stop the actual running thread. The service itself will 
then exit.

Is there a problem with how it works?

Original comment by kenneth@hexad.dk on 27 Feb 2012 at 3:15

GoogleCodeExporter commented 8 years ago
Thank you for the clarification! I was just reading through the code, trying to 
understand it and had no problem with how it works!

Original comment by frat...@gmail.com on 29 Feb 2012 at 10:34

GoogleCodeExporter commented 8 years ago
Super :)

Original comment by kenneth@hexad.dk on 29 Feb 2012 at 11:05