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

Commit d30324c2 authored by Junyeong Bak's avatar Junyeong Bak Committed by Thomas Stuart
Browse files

Enable checking the binding of Bluetooth InCallService



Whenever a Incoming Call occurs, Bluetooth InCallService fails to unbind at the end of the call.
Just like other InCallService, it has been fixed to make Bluetooth InCallService also check the status before binding.

Flag: EXEMPT patch is already in downstream partner branch
Fixes: 422414419 (internal partner shadow)
Test: While in Incoming Call status

Signed-off-by: default avatarJunyeong Bak <junyeong.bak@samsung.com>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:088966217162d128b72cb9a4ecdcc9685e1d2835)
Merged-In: If4d5371cb9d8fc3e05d281f2e575fda4012e3bf4
Change-Id: If4d5371cb9d8fc3e05d281f2e575fda4012e3bf4
parent 2e1f3938
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -2128,13 +2128,12 @@ public class InCallController extends CallsManagerListenerBase implements
     * @param call The newly added call that triggered the binding to the in-call services.
     */
    public void bindToBTService(Call call, UserHandle userHandle) {
        Log.i(this, "bindToBtService");
        UserHandle userToBind = userHandle == null
                ? getUserFromCall(call)
                : userHandle;
        UserManager um = mContext.getSystemService(UserManager.class);
        UserHandle parentUser = um.getProfileParent(userToBind);

        Log.i(this, "bindToBtService, child:%s  parent:%s", userToBind, parentUser);
        // Track the call if we don't already know about it.
        addCall(call);
        List<InCallServiceInfo> infos = getInCallServiceComponents(userToBind,
@@ -2156,14 +2155,18 @@ public class InCallController extends CallsManagerListenerBase implements
            }
        }

        mBtBindingFuture.put(userToBind, new CompletableFuture<Boolean>().completeOnTimeout(false,
                mTimeoutsAdapter.getCallBindBluetoothInCallServicesDelay(
        if (!mBTInCallServiceConnections.containsKey(userToBind)) {
            mBtBindingFuture.put(userToBind, new CompletableFuture<Boolean>().completeOnTimeout(
                    false, mTimeoutsAdapter.getCallBindBluetoothInCallServicesDelay(
                            mContext, mFeatureFlags), TimeUnit.MILLISECONDS));
            InCallServiceBindingConnection btIcsBindingConnection =
                    new InCallServiceBindingConnection(infos.get(0),
                            serviceUnavailableForUser ? parentUser : userToBind);
            mBTInCallServiceConnections.put(userToBind, btIcsBindingConnection);
        btIcsBindingConnection.connect(call);
        }
        final InCallServiceBindingConnection btInCallServiceConnection =
                mBTInCallServiceConnections.get(userToBind);
        btInCallServiceConnection.connect(call);
    }

    /**