Cosmetic improvements to SshAuthenticationApi

This commit is contained in:
Christian Hagau
2017-11-22 00:00:00 +00:00
parent 1f7c7f49d4
commit 0ca314e7f9

View File

@@ -149,22 +149,22 @@ public class SshAuthenticationApi {
void onReturn(final Intent result); void onReturn(final Intent result);
} }
private class SshAgentAsyncTask extends AsyncTask<Void, Integer, Intent> { private class SshAgentAsyncTask extends AsyncTask<Void, Void, Intent> {
Intent data; Intent mRequest;
ISshAgentCallback callback; ISshAgentCallback mCallback;
private SshAgentAsyncTask(Intent data, ISshAgentCallback callback) { private SshAgentAsyncTask(Intent request, ISshAgentCallback callback) {
this.data = data; mRequest = request;
this.callback = callback; mCallback = callback;
} }
@Override @Override
protected Intent doInBackground(Void... unused) { protected Intent doInBackground(Void... unused) {
return executeApi(data); return executeApi(mRequest);
} }
protected void onPostExecute(Intent result) { protected void onPostExecute(Intent result) {
callback.onReturn(result); mCallback.onReturn(result);
} }
} }
@@ -176,9 +176,9 @@ public class SshAuthenticationApi {
// don't serialize async tasks, always execute them in parallel // don't serialize async tasks, always execute them in parallel
// http://commonsware.com/blog/2012/04/20/asynctask-threading-regression-confirmed.html // http://commonsware.com/blog/2012/04/20/asynctask-threading-regression-confirmed.html
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else { } else {
task.execute((Void[]) null); task.execute();
} }
} }