mmorciegov / android-wifi-tether

Automatically exported from code.google.com/p/android-wifi-tether
7 stars 3 forks source link

Slow operations in UI thread #1856

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dear developers,

I am studying android-wifi-tether using a static code checker. I found some 
potential slow operations in android-wifi-tether'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() and onResume(). 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 performing file IO or remote data reading:

com.googlecode.android.wifi.tether.AccessControlActivity's onClick() handler at 
line 80: file reading and deleting
com.googlecode.android.wifi.tether.SetupActivity's onCreate() handler: file 
reading and input stream zipping
com.googlecode.android.wifi.tether.LogActivity's onCreate() handler: file 
reading and data loading from an URL
com.googlecode.android.wifi.tether.AccessControlActivity's onCreate(): file 
reading

Do you think these slow operations will affect android-wifi-tether's 
performance (e.g., making GUI not smooth enough)? If yes, perhaps moving them 
to a separate thread can help make android-wifi-tether super smooth in user 
interaction. Looking forward to your reply and hope I can help improve 
android-wifi-tether.

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