set the progress bar and progress dialog on the ui thread

Change-Id: I7eaf38bdb5bf24d3b32f169581b3cf3b6b1a3a30