Loading core/java/android/content/ContentProviderClient.java +13 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.AssetFileDescriptor; import android.database.CrossProcessCursorWrapper; import android.database.Cursor; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.CancellationSignal; import android.os.DeadObjectException; Loading Loading @@ -102,8 +103,16 @@ public class ContentProviderClient implements AutoCloseable { if (sAnrHandler == null) { sAnrHandler = new Handler(Looper.getMainLooper(), null, true /* async */); } // If the remote process hangs, we're going to kill it, so we're // technically okay doing blocking calls. Binder.allowBlocking(mContentProvider.asBinder()); } else { mAnrRunnable = null; // If we're no longer watching for hangs, revert back to default // blocking behavior. Binder.defaultBlocking(mContentProvider.asBinder()); } } } Loading Loading @@ -511,6 +520,10 @@ public class ContentProviderClient implements AutoCloseable { private boolean closeInternal() { mCloseGuard.close(); if (mClosed.compareAndSet(false, true)) { // We can't do ANR checks after we cease to exist! Reset any // blocking behavior changes we might have made. setDetectNotResponding(0); if (mStable) { return mContentResolver.releaseProvider(mContentProvider); } else { Loading core/java/android/os/Binder.java +13 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,19 @@ public class Binder implements IBinder { return binder; } /** * Reset the given interface back to the default blocking behavior, * reverting any changes made by {@link #allowBlocking(IBinder)}. * * @hide */ public static IBinder defaultBlocking(IBinder binder) { if (binder instanceof BinderProxy) { ((BinderProxy) binder).mWarnOnBlocking = sWarnOnBlocking; } return binder; } /** * Inherit the current {@link #allowBlocking(IBinder)} value from one given * interface to another. Loading Loading
core/java/android/content/ContentProviderClient.java +13 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.res.AssetFileDescriptor; import android.database.CrossProcessCursorWrapper; import android.database.Cursor; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.CancellationSignal; import android.os.DeadObjectException; Loading Loading @@ -102,8 +103,16 @@ public class ContentProviderClient implements AutoCloseable { if (sAnrHandler == null) { sAnrHandler = new Handler(Looper.getMainLooper(), null, true /* async */); } // If the remote process hangs, we're going to kill it, so we're // technically okay doing blocking calls. Binder.allowBlocking(mContentProvider.asBinder()); } else { mAnrRunnable = null; // If we're no longer watching for hangs, revert back to default // blocking behavior. Binder.defaultBlocking(mContentProvider.asBinder()); } } } Loading Loading @@ -511,6 +520,10 @@ public class ContentProviderClient implements AutoCloseable { private boolean closeInternal() { mCloseGuard.close(); if (mClosed.compareAndSet(false, true)) { // We can't do ANR checks after we cease to exist! Reset any // blocking behavior changes we might have made. setDetectNotResponding(0); if (mStable) { return mContentResolver.releaseProvider(mContentProvider); } else { Loading
core/java/android/os/Binder.java +13 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,19 @@ public class Binder implements IBinder { return binder; } /** * Reset the given interface back to the default blocking behavior, * reverting any changes made by {@link #allowBlocking(IBinder)}. * * @hide */ public static IBinder defaultBlocking(IBinder binder) { if (binder instanceof BinderProxy) { ((BinderProxy) binder).mWarnOnBlocking = sWarnOnBlocking; } return binder; } /** * Inherit the current {@link #allowBlocking(IBinder)} value from one given * interface to another. Loading