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

Commit 2354c5eb authored by Yao Chen's avatar Yao Chen
Browse files

Check the return value of bindService, and notify media browser client

onConnectionFailed if it returns false.

Bug: 17637058
Change-Id: I2284c3a982e5ac6323f51ff7d98aae7699c695e5
parent 143dc769
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -141,11 +141,16 @@ public final class MediaBrowser {

        final ServiceConnection thisConnection = mServiceConnection = new MediaServiceConnection();

        boolean bound = false;
        try {
            mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
            if (mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE)) {
                bound = true;
            }
        } catch (Exception ex) {
            Log.e(TAG, "Failed binding to service " + mServiceComponent);
        }

        if (!bound) {
            // Tell them that it didn't work.  We are already on the main thread,
            // but we don't want to do callbacks inside of connect().  So post it,
            // and then check that we are on the same ServiceConnection.  We know