Merge pull request #2222 from hagau/cleanup_ssh_api_lib
Cosmetic improvements to SshAuthenticationApi
This commit is contained in:
commit
0a72dda6fc
|
@ -151,22 +151,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -178,9 +178,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue