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

Commit 16ffade7 authored by William Escande's avatar William Escande
Browse files

Do not autoconnect hfp if hfp is disallowed but a2dp is

Test: manual autoconnection while HFP was disallowed, check the hfp is not connected
Bug: 230747342
Merged-In: Ic712a6de47e9df83db182028963f857817e6b789
Change-Id: Ic712a6de47e9df83db182028963f857817e6b789
(cherry picked from commit 11cb95ec)
parent a215df9a
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -413,9 +413,10 @@ public class A2dpService extends ProfileService {
            if (!isOutgoingRequest) {
            if (!isOutgoingRequest) {
                HeadsetService headsetService = HeadsetService.getHeadsetService();
                HeadsetService headsetService = HeadsetService.getHeadsetService();
                if (headsetService != null && headsetService.okToAcceptConnection(device, true)) {
                if (headsetService != null && headsetService.okToAcceptConnection(device, true)) {
                    Log.d(TAG, "okToConnect: Fallback connection to allowed HFP profile");
                    Log.d(TAG, "okToConnect: return false,"
                            + " Fallback connection to allowed HFP profile");
                    headsetService.connect(device);
                    headsetService.connect(device);
                    return true;
                    return false;
                }
                }
            }
            }
            // Otherwise, reject the connection if connectionPolicy is not valid.
            // Otherwise, reject the connection if connectionPolicy is not valid.
+2 −2
Original line number Original line Diff line number Diff line
@@ -2061,10 +2061,10 @@ public class HeadsetService extends ProfileService {
            if (!isOutgoingRequest) {
            if (!isOutgoingRequest) {
                A2dpService a2dpService = A2dpService.getA2dpService();
                A2dpService a2dpService = A2dpService.getA2dpService();
                if (a2dpService != null && a2dpService.okToConnect(device, true)) {
                if (a2dpService != null && a2dpService.okToConnect(device, true)) {
                    Log.d(TAG, "okToAcceptConnection: return temporary true,"
                    Log.d(TAG, "okToAcceptConnection: return false,"
                            + " Fallback connection to allowed A2DP profile");
                            + " Fallback connection to allowed A2DP profile");
                    a2dpService.connect(device);
                    a2dpService.connect(device);
                    return true;
                    return false;
                }
                }
            }
            }
            Log.w(TAG, "okToAcceptConnection: return false, connectionPolicy=" + connectionPolicy);
            Log.w(TAG, "okToAcceptConnection: return false, connectionPolicy=" + connectionPolicy);