Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 751fdc09 authored by Fred Quintana's avatar Fred Quintana
Browse files

only make AccountManager throw an exception on blocking calls in the UI thread...

only make AccountManager throw an exception on blocking calls in the UI thread if the application's SDK is froyo or later
parent 6420877c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.Parcelable;
import android.os.Build;
import android.util.Log;

import java.io.IOException;
@@ -841,9 +842,11 @@ public class AccountManager {
                    "calling this from your main thread can lead to deadlock");
            Log.e(TAG, "calling this from your main thread can lead to deadlock and/or ANRs",
                    exception);
            if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.FROYO) {
                throw exception;
            }
        }
    }

    private void postToHandler(Handler handler, final AccountManagerCallback<Bundle> callback,
            final AccountManagerFuture<Bundle> future) {
+1 −1
Original line number Diff line number Diff line
@@ -1788,7 +1788,7 @@ public class AccountManagerService
        if (!permissionGranted && isDebuggableMonkeyBuild) {
            // TODO: Skip this check when running automated tests. Replace this
            // with a more general solution.
            Log.w(TAG, "no credentials permission for usage of " + account + ", "
            Log.d(TAG, "no credentials permission for usage of " + account + ", "
                    + authTokenType + " by uid " + Binder.getCallingUid()
                    + " but ignoring since this is a monkey build");
            return true;