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

Commit c669802f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add flag to exclude capability propagation when connecting...

Merge "Add flag to exclude capability propagation when connecting MediaBrowser" into tm-dev am: 2b0d0669

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/34390915



Change-Id: If8974cff9e9b8900443a6b9a522a170f63dc690e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6f7be314 2b0d0669
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.ResultReceiver;
import android.service.media.IMediaBrowserService;
import android.service.media.IMediaBrowserServiceCallbacks;
import android.service.media.MediaBrowserService;
import android.service.media.MediaBrowserService.BrowserRoot;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -183,8 +184,13 @@ public final class MediaBrowser {

                boolean bound = false;
                try {
                    bound = mContext.bindService(intent, mServiceConnection,
                            Context.BIND_AUTO_CREATE | Context.BIND_INCLUDE_CAPABILITIES);
                    int bindServiceFlags = Context.BIND_AUTO_CREATE;
                    if (mRootHints == null
                        || (!mRootHints.containsKey(BrowserRoot.EXTRA_EXCLUDE_CAPABILITIES)
                                && !mRootHints.containsKey(BrowserRoot.EXTRA_RECENT))) {
                        bindServiceFlags |= Context.BIND_INCLUDE_CAPABILITIES;
                    }
                    bound = mContext.bindService(intent, mServiceConnection, bindServiceFlags);
                } catch (Exception ex) {
                    Log.e(TAG, "Failed binding to service " + mServiceComponent);
                }
+12 −0
Original line number Diff line number Diff line
@@ -872,6 +872,18 @@ public abstract class MediaBrowserService extends Service {
         */
        public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";

        /**
         * A key for the root hint when connecting a browser to indicate that the bind connection
         * should not include capabilities.
         *
         * <p>When using {@link #EXTRA_RECENT}, this flag is assumed to be set as well.
         *
         * @see android.content.Context#BIND_INCLUDE_CAPABILITIES
         * @hide
         */
        public static final String EXTRA_EXCLUDE_CAPABILITIES =
                "android.service.media.extra.EXCLUDE_CAPABILITIES";

        private final String mRootId;
        private final Bundle mExtras;