kamikaze2002261 / connectbot

Automatically exported from code.google.com/p/connectbot
Apache License 2.0
0 stars 0 forks source link

responsiveness improvements for connectbot #680

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello developers of connectbot,

I'm a Ph.D. student and I'm doing research related to Android apps'
responsiveness. I found there are some cases in connectbot that the
database is accessed/queried by UI thread. Does this affect the
performance/responsiveness of the app? An optimization could be
extracting the DB operations into AsyncTask.

For example, in PubkeyListActivity.java, the "pubkeydb" is
queried/inserted/deleted at several places in UI thread: line 334,
408, 453, 468 and so on. How about put them into AsyncTask? I send a
sample patch here. Note that in the patch, in order to avoid data
races on "pubkeydb", I also add synchronization when UI thread and
AsyncTask tries to access "pubkeydb" (e.g., without synchronization,
races on "pubkeydb" appear between "UpdateListTask" and
"onStart"/"onStop").

Similarly, I also transformed HostListActivity.java and
HostEditorActivity.java for field "hostdb". TerminalManager.java
for "hostdb" and "pubkeydb".

Also, TerminalKeyListener.java invokes "bridge.transport.write" which
writes to IO. This also lead to a potential responsiveness issue. Thus, I
tried to move it into AsyncTask. In order to keep the original
semantics, I add a method "getResult()" in the AsyncTask. If the
written throws IOException or takes more than 5 seconds (i.e., the app
is not responsive anymore), "onKey" method will return false.

There should be some other places that can be improved. What do you think
about these improvements? My thought is we can improve the responsiveness if we 
try
to avoid the access to IO/Database in UI thread.

p.s., I also sent a pull request on github. What's your opinion about this 
kind of improvements?

Thanks,
Yu

Original issue reported on code.google.com by Yu.Lin...@gmail.com on 17 Feb 2014 at 4:45

Attachments:

GoogleCodeExporter commented 8 years ago
I sent these patches two weeks ago. Do you have any comments on them? Will the 
refactorings improve the responsiveness of connectbot.

Thanks,
Yu

Original comment by Yu.Lin...@gmail.com on 4 Mar 2014 at 11:45