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

Commit 5af9dd3f authored by Sal Savage's avatar Sal Savage
Browse files

Detach on download pending with no results, don't send null

Tag: #stability
Bug: 286153876
Test: atest BluetoothInstrumentationTests
Change-Id: I15701d3ec12c63004d0a943a0a18bda3338ac851
parent 9481e51a
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -230,14 +230,16 @@ public class BluetoothMediaBrowserService extends MediaBrowserServiceCompat {
        if (DBG) Log.d(TAG, "onLoadChildren parentMediaId= " + parentMediaId);
        BrowseResult contents = getContents(parentMediaId);
        byte status = contents.getStatus();
        if (status == BrowseResult.DOWNLOAD_PENDING && contents == null) {
            Log.i(TAG, "Download pending - no contents, id= " + parentMediaId);
        List<MediaItem> results = contents.getResults();
        if (status == BrowseResult.DOWNLOAD_PENDING && results == null) {
            Log.i(TAG, "Download pending - no results, id= " + parentMediaId);
            result.detach();
        } else {
            if (DBG) {
                Log.d(TAG, "id= " + parentMediaId + ", status= " + contents.getStatusString());
                Log.d(TAG, "id= " + parentMediaId + ", status= " + contents.getStatusString()
                        + ", results=" + results);
            }
            result.sendResult(contents.getResults());
            result.sendResult(results);
        }
    }