Possible cause of Hang-Bugs Found
Opened this issue · 0 comments
Dear Developers,
I am implementing a hang-bug detection tool and I am analyzing lens-launcher with it (commit number e41e6c6). I found that the main thread of lens-launcher frequently calls:
com.orm.SugarRecord.save(SugarRecord.java:416)
In particular, the above API is called as consequence of the following call:
nickrout.lenslauncher.model.AppPersistent.incrementAppCount(AppPersistent.java:108) -> com.orm.SugarRecord.save(SugarRecord.java:416)
which then performs a database operation by calling
android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469)
In my experiments, the execution of that function on the main thread may be the main cause of the eye-detectable delays (i.e., hang-bugs) experienced with lens-launcher .
As the developers guide of Android suggests, moving work off the main thread leads to higher responsiveness of the app. It is actually possible to move that operation off the main thread using background threads.
Therefore, do you think that the smoothness of the app would improve by executing the com.orm.SugarRecord.save API off the main thread?
Thanks for any information,
I hope I can help improve lens-launcher.