keithr-git / omnidroid

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

Slow operation in UI thread #183

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Dear developers,

I am analyzing Omnidroid using a static code checker. I found some slow 
operations in Omnidroid's UI thread.

Android documentation says this:

http://developer.android.com/training/articles/perf-anr.html

"Any method that runs in the UI thread should do as little work as possible on 
that thread. In particular, activities should do as little as possible in key 
life-cycle methods such as onCreate(). Potentially long running operations such 
as network or database operations, or computationally expensive calculations 
such as resizing bitmaps should be done in a worker thread (e.g., via 
AsyncTask)."

I found the following event handlers transitively performing database queries 
and file IO:

edu.nyu.cs.omnidroid.app.view.simple.ActivitySavedRules$RuleListAdapter's 
onClick() handler at line 353
edu.nyu.cs.omnidroid.app.view.simple.ActivitySavedRules's onItem() click at 
line 92
edu.nyu.cs.omnidroid.app.view.simple.ActivityLogTabs's onCreate(), onResume(), 
and onOptionsItemSelected() handlers
edu.nyu.cs.omnidroid.app.view.simple.ActivityChooseFiltersAndActions's 
onActivityResult()  and onContextItemSelected() handlers
edu.nyu.cs.omnidroid.app.view.simple.ActivityDlgApplicationLoginInput's 
onCreate() handler
edu.nyu.cs.omnidroid.app.view.simple.ActivitySavedRules's onCreate(), 
onActivityResult(), onContextItemSelected(), and onOptionsItemSelected() 
handlers
edu.nyu.cs.omnidroid.app.view.simple.ActivityDlgLog's onCreate() handler
edu.nyu.cs.omnidroid.app.view.simple.ActivityMain's onCreate() and onResume() 
handlers

Do you think these slow operations will affect Omnidroid's performance (making 
the GUI sluggish)? If yes, perhaps moving them to a separate thread can help 
make Omnidroid more smooth in user interaction. Looking forward to your reply 
and hope I can help improve Omnidroid.

Original issue reported on code.google.com by yepang...@gmail.com on 25 Jul 2013 at 1:47

GoogleCodeExporter commented 8 years ago
File IO is a threat to performance, and should be avoided in main thread.

Original comment by jalex4...@gmail.com on 6 Aug 2013 at 1:59