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

Commit cba635f5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent NPE in getSliceDescendants"

parents 511f1ac2 c0cc49a4
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;

@@ -223,10 +224,15 @@ public class SliceManager {
    public @NonNull Collection<Uri> getSliceDescendants(@NonNull Uri uri) {
        ContentResolver resolver = mContext.getContentResolver();
        try (ContentProviderClient provider = resolver.acquireUnstableContentProviderClient(uri)) {
            if (provider == null) {
                Log.w(TAG, TextUtils.formatSimple("Unknown URI: %s", uri));
            } else {
                Bundle extras = new Bundle();
                extras.putParcelable(SliceProvider.EXTRA_BIND_URI, uri);
            final Bundle res = provider.call(SliceProvider.METHOD_GET_DESCENDANTS, null, extras);
                final Bundle res = provider.call(
                        SliceProvider.METHOD_GET_DESCENDANTS, null, extras);
                return res.getParcelableArrayList(SliceProvider.EXTRA_SLICE_DESCENDANTS);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to get slice descendants", e);
        }