bpellin/keepassdroid — pull request #43 by yulin2 (2014-02-17 18:28:15+00:00)
Title: potential improvement for responsiveness in keepassdroid

Hello developers of KeePassDroid,

I'm a Ph.D. student and I'm doing research related to Android apps'
responsiveness. KeePassFroid uses "ProgressTask" to execute long
operations in backgroud thread to improve responsiveness. However, I
found there are still some cases that the database is accessed/queried
in UI thread. Do they affect the performance/responsiveness of the
app?

For example, in FileSelectActivity.java, the "fileHistory.deleteFile"
is invoked at line 400 in "onContextItemSelected", and the DB is
eventually accessed. How about put them into AsyncTask? I attach a
sample patch here to show this. Note that after put it into AsyncTask,
there are data races on "fileHistory", since "fileHistory" is also used in
other threads at several places (e.g., line 250, line 337). Thus, the
"fileHistory.init()" can be invoked concurrently, we could add
synchronization on it. I put line 287, 288 into AsyncTask as well.

Similarly, I also transformed PasswordActivity.java and put
"getKeyFile" method (which access DB) into AsyncTask.

There may 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 DB in UI thread.

Thanks,
Yu