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

Commit fcf46d2e authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Revert "Checks the service is supported before binding the service""

parents 1ca978bf 2193b30f
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -129,27 +129,13 @@ public abstract class BluetoothProfileConnector<T> {
            if (mService == null) {
                logDebug("Binding service...");
                mCloseGuard.open("doUnbind");

                List<Integer> mSupportedProfileList =
                        BluetoothAdapter.getDefaultAdapter().getSupportedProfiles();

                if (!mSupportedProfileList.contains(mProfileId)) {
                    logDebug("Skip binding " + mProfileName + " service due to not supported");
                    return false;
                }

                try {
                    Intent intent = new Intent(mServiceName);
                    ComponentName comp = resolveSystemService(intent, mContext.getPackageManager());
                    intent.setComponent(comp);
                    if (comp == null) {
                        logError("Component is null");
                        return false;
                    }
                    if (!mContext.bindServiceAsUser(intent, mConnection, 0,
                    if (comp == null || !mContext.bindServiceAsUser(intent, mConnection, 0,
                            USER_HANDLE_CURRENT_OR_SELF)) {
                        logError("Could not bind to Bluetooth Service with " + intent);
                        mContext.unbindService(mConnection);
                        return false;
                    }
                } catch (SecurityException se) {