Allow onGetSliceDescendants to be slow

Because sometimes it needs to be

Test: existing tests
Bug: 79132845
Bug: 77873463
Change-Id: I93aa8553c48c856bf96c347a229be6e770751708
This commit is contained in:
Jason Monk
2018-05-11 08:23:59 -07:00
parent 3b592910c5
commit a66dfee8d0
2 changed files with 3 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemService;
import android.annotation.WorkerThread;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
@@ -217,6 +218,7 @@ public class SliceManager {
* @return All slices within the space.
* @see SliceProvider#onGetSliceDescendants(Uri)
*/
@WorkerThread
public @NonNull Collection<Uri> getSliceDescendants(@NonNull Uri uri) {
ContentResolver resolver = mContext.getContentResolver();
try (ContentProviderClient provider = resolver.acquireContentProviderClient(uri)) {

View File

@@ -398,12 +398,7 @@ public abstract class SliceProvider extends ContentProvider {
private Collection<Uri> handleGetDescendants(Uri uri) {
mCallback = "onGetSliceDescendants";
Handler.getMain().postDelayed(mAnr, SLICE_BIND_ANR);
try {
return onGetSliceDescendants(uri);
} finally {
Handler.getMain().removeCallbacks(mAnr);
}
return onGetSliceDescendants(uri);
}
private void handlePinSlice(Uri sliceUri) {