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

Commit 7b78bbcb authored by Sal Savage's avatar Sal Savage Committed by android-build-merger
Browse files

Merge "Add default content style to BluetoothMediaBrowserService"

am: 0b8c189a

Change-Id: Ie9f3a876fe9fbec43cd5ad96978c14deaab29021
parents d9877844 0b8c189a
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -63,6 +63,16 @@ public class BluetoothMediaBrowserService extends MediaBrowserServiceCompat {
    // Browsing related structures.
    private List<MediaSessionCompat.QueueItem> mMediaQueue = new ArrayList<>();

    // Media Framework Content Style constants
    private static final String CONTENT_STYLE_SUPPORTED =
            "android.media.browse.CONTENT_STYLE_SUPPORTED";
    public static final String CONTENT_STYLE_PLAYABLE_HINT =
            "android.media.browse.CONTENT_STYLE_PLAYABLE_HINT";
    public static final String CONTENT_STYLE_BROWSABLE_HINT =
            "android.media.browse.CONTENT_STYLE_BROWSABLE_HINT";
    public static final int CONTENT_STYLE_LIST_ITEM_HINT_VALUE = 1;
    public static final int CONTENT_STYLE_GRID_ITEM_HINT_VALUE = 2;

    // Error messaging extras
    public static final String ERROR_RESOLUTION_ACTION_INTENT =
            "android.media.extras.ERROR_RESOLUTION_ACTION_INTENT";
@@ -117,6 +127,14 @@ public class BluetoothMediaBrowserService extends MediaBrowserServiceCompat {
        mSession.setPlaybackState(errorState);
    }

    private Bundle getDefaultStyle() {
        Bundle style = new Bundle();
        style.putBoolean(CONTENT_STYLE_SUPPORTED, true);
        style.putInt(CONTENT_STYLE_BROWSABLE_HINT, CONTENT_STYLE_GRID_ITEM_HINT_VALUE);
        style.putInt(CONTENT_STYLE_PLAYABLE_HINT, CONTENT_STYLE_LIST_ITEM_HINT_VALUE);
        return style;
    }

    @Override
    public synchronized void onLoadChildren(final String parentMediaId,
            final Result<List<MediaBrowserCompat.MediaItem>> result) {
@@ -133,7 +151,8 @@ public class BluetoothMediaBrowserService extends MediaBrowserServiceCompat {
    @Override
    public BrowserRoot onGetRoot(String clientPackageName, int clientUid, Bundle rootHints) {
        if (DBG) Log.d(TAG, "onGetRoot");
        return new BrowserRoot(BrowseTree.ROOT, null);
        Bundle style = getDefaultStyle();
        return new BrowserRoot(BrowseTree.ROOT, style);
    }

    private void updateNowPlayingQueue(BrowseTree.BrowseNode node) {