Closed blazern closed 7 years ago
hi @blazern , would you mind sharing the detail Android versions?
@daboxu, the device had Android 6.0.1
thanks @blazern , I modified our onedrive-explorer-android https://github.com/OneDrive/onedrive-explorer-android for reproducing it, what I did is pretty simple in PlaceholderFragment.java https://github.com/OneDrive/onedrive-explorer-android/blob/master/app/src/main/java/com/microsoft/onedrive/apiexplorer/PlaceholderFragment.java#L77:
catch (final UnsupportedOperationException ignored) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
app.createOneDriveClient(getActivity(), serviceCreated);
}
});
}
WIth emulator version 6.0 and I cannot reproduce the issue. There could be two potentials to rule out: 1) the emulator does not work 2) my code is not right.
If you don't mind, please share more about the emulator and the code so we can move forward.
Sorry, but I left the place I worked for so the codebase in which I could reproduce the problem is no longer available to me. :(
Ok, I will close this issue for now and if anyone could reproduce it, feel free to reopen it.
Some versions of Android use a single thread for all AsyncTasks to run their onBackground(..) if the execution was started with a call of AsyncTask.execute().
A deadlock will happen if client code started an AsyncTask with AsyncTask.execute() and then performed silent login to OneDrive from AsyncTask's onBackground(..) - OneDrive SDK uses the AsyncTask.execute() method too. OneDrive's AsyncTask will wait for client's AsyncTask to finish because they are supposed to run on the same thread, but client's AsyncTask can't finish without OneDrive finishing the authorization.
If the SDK used executeOnExecutor(..) method, the problem would be solved.