use background thread for swap icons instead of AsyncTask

An AsyncTask ties into the UI thread for things like onPostExecute(). If it
is run within an AsyncTask, then it freaks out because it can't tie into
the UI thread.  We don't need it to do that here anyway, so just use a
plain Thread, and set the priority to background.
This commit is contained in:
Hans-Christoph Steiner 2016-03-29 20:40:42 +02:00
parent 260b5bb9fb
commit 29788254dd

View File

@ -702,16 +702,13 @@ public class SwapWorkflowActivity extends AppCompatActivity {
lrm.copyApksToRepo(); lrm.copyApksToRepo();
broadcast(TYPE_STATUS, getString(R.string.copying_icons)); broadcast(TYPE_STATUS, getString(R.string.copying_icons));
// run the icon copy without progress, its not a blocker // run the icon copy without progress, its not a blocker
// TODO: Fix lint error about this being run from a worker thread, says it should be new Thread() {
// run on a main thread.
new AsyncTask<Void, Void, Void>() {
@Override @Override
protected Void doInBackground(Void... params) { public void run() {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
lrm.copyIconsToRepo(); lrm.copyIconsToRepo();
return null;
} }
}.execute(); }.start();
broadcast(TYPE_COMPLETE); broadcast(TYPE_COMPLETE);
} catch (Exception e) { } catch (Exception e) {