Communication method, storage medium and electronic equipment
By completing the registration of HFP and A2DP in advance, and establishing an HFP connection when receiving an incoming call, then establishing an A2DP connection, the problem of stuttering when switching ringtones in mobile phones is solved and the call experience is improved.
Patent Information
- Application Number
- CN202311709735.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2043-08-15
AI Technical Summary
When the phone receives an incoming call, it causes the incoming call ringtone to stutter during the process of switching the incoming call ringtone through A2DP and HFP protocols.
Complete the registration of HFP and A2DP in advance. When receiving incoming call information, first establish an HFP connection with the Bluetooth headset, and then establish an A2DP connection to ensure that the incoming call ringtone is played through HFP.
It avoids the stuttering of incoming ringtones when switching from A2DP to HFP, and improves the user's call experience.
Smart Images

Figure CN119497049A_ABST
Abstract
Description
[0001] This application is a divisional application. The name of the original application is a communication method, storage medium and electronic device. The application number of the original application is 202311026635.4, and the original application date is August 15, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of Bluetooth technology, and in particular to a communication method, a storage medium and an electronic device. Background Art
[0003] The Bluetooth audio transmission model agreement (Advanced Audio Distribution Profile, A2DP) and the telephone service agreement (Hands-free Profile, HFP) are two protocols for transmitting audio services in the first electronic device (hereinafter referred to as a mobile phone). That is, through A2DP and HFP, the mobile phone can transmit audio data to the second electronic device with Bluetooth function (hereinafter referred to as a Bluetooth headset) through Bluetooth. Among them, A2DP has the characteristic of non-real-time audio transmission and is used to implement multimedia services, such as playing music. HFP has the characteristic of real-time audio transmission and is used to implement call services, such as real-time voice.
[0004] Bluetooth physical links are divided into synchronous links (synchronous connection oriented, SCO) and asynchronous links (asynchronous connection less, ACL). SCO links are used to transmit data with high real-time requirements, such as audio data for call services. ACL links are used to transmit data with non-real-time requirements, such as audio data for music applications. Therefore, in order to ensure call quality, the call service of the mobile phone needs to transmit audio data through HFP on the SCO link.
[0005] However, in some cases, such as when the Bluetooth function of the mobile phone is turned on and the mobile phone is paired with but not connected to the Bluetooth headset, if the mobile phone receives an incoming call, the mobile phone will play the incoming call ring tone through the Bluetooth headset according to the Bluetooth protocol, so the mobile phone will establish a connection with the Bluetooth headset. When the mobile phone establishes a connection with the Bluetooth headset, if the getProfileProxy function is used to register the Bluetooth transmission-related HFP and A2DP protocols, since the registration process of A2DP is faster than that of HFP, the mobile phone will first transmit the incoming call ring tone through A2DP, and then switch to transmitting the incoming call ring tone through HFP. During the switching process, the mobile phone will suspend the audio data transmission of the incoming call ring tone, which will cause the incoming call ring tone of the mobile phone to freeze. Summary of the invention
[0006] In order to solve the problem of the incoming call ring tone of the above-mentioned mobile phone being stuck, the present application provides a communication method, a storage medium and an electronic device.
[0007] In a first aspect, the present application provides a communication method, comprising: corresponding to a first electronic device satisfying a first condition, the first electronic device completes registration of a telephone service protocol HFP and a Bluetooth audio transmission model protocol A2DP; the first electronic device receives an incoming call message, and detects a second electronic device that has been Bluetooth paired with the first electronic device but has not established a Bluetooth connection; the first electronic device establishes a Bluetooth connection with the second electronic device, and the first electronic device first establishes a telephone service protocol HFP connection to transmit audio data to the second electronic device through the telephone service protocol HFP, wherein the audio data includes an incoming call ringtone corresponding to the incoming call message, and the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection after establishing the telephone service protocol HFP connection.
[0008] It can be understood that the first electronic device mentioned in this application includes any electronic device that can make voice calls and has Bluetooth function, such as a mobile phone, and the second electronic device mentioned in this application includes any electronic device that has Bluetooth function and audio data playback function, such as a Bluetooth headset.
[0009] In this way, the mobile phone completes the registration of HFP and A2DP in advance. When a call comes in, the mobile phone first chooses to establish an HFP connection with the Bluetooth headset according to the type of call service, and the incoming call ringtone of the mobile phone will be played on the Bluetooth headset through HFP. After that, the mobile phone establishes an A2DP connection with the Bluetooth headset, and the mobile phone no longer chooses to play the incoming call ringtone through A2DP. This avoids the phenomenon of the incoming call ringtone being stuck when the mobile phone's incoming call ringtone switches from playing on the Bluetooth headset through A2DP to playing on the Bluetooth headset through HFP, improving the user's call experience.
[0010] In a possible implementation of the first aspect above, the first condition includes at least one of the following: entering the power-on phase, the Bluetooth function is turned on, and an electronic device that has been Bluetooth paired is detected.
[0011] It can be understood that the first condition mentioned in this application may be that the mobile phone is in the initialization stage, and the initialization stage of the mobile phone includes but is not limited to entering the power-on stage, the Bluetooth function is turned on, and an electronic device that has been paired with Bluetooth is detected.
[0012] In a possible implementation of the first aspect above, the first electronic device establishes a telephone service protocol HFP connection in the following manner: an audio manager application in the first electronic device sends a message to a Bluetooth application to establish a telephone service protocol HFP connection with the second electronic device, and the Bluetooth application establishes a telephone service protocol HFP connection.
[0013] In a possible implementation of the first aspect above, audio data is transmitted to a second electronic device via the telephone service protocol HFP, including: a telephone application in the first electronic device receives information that the telephone service protocol HFP is successfully established, and sends an instruction to the audio framework to switch the sound device; the audio framework selects the sound device as the second electronic device that has established a telephone service protocol HFP connection with the first electronic device, and transmits audio data to the second electronic device.
[0014] It is understandable that the sound-emitting device may also be a speaker or receiver of a mobile phone, or an audio device connected to the mobile phone. This application does not limit the type of the sound-emitting device.
[0015] In a possible implementation of the first aspect above, the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection after establishing a telephone service protocol HFP connection, including: after the first electronic device establishes the telephone service protocol HFP connection, the audio butler application in the first electronic device sends a message to the Bluetooth application to establish a Bluetooth audio transmission model protocol A2DP connection with the second electronic device, and the Bluetooth application establishes the Bluetooth audio transmission model protocol A2DP connection.
[0016] It is understandable that in order to ensure that both the call service and multimedia service in the mobile phone can be played through the Bluetooth headset, the mobile phone needs to establish a dual connection with the Bluetooth headset, namely the Bluetooth audio transmission model protocol A2DP and the telephone service protocol HFP. After the mobile phone and the Bluetooth headset establish the HFP connection, the mobile phone and the Bluetooth headset establish the A2DP connection.
[0017] In a possible implementation of the first aspect above, the communication method further includes: after the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection with the second electronic device, the audio framework in the first electronic device no longer reselects the sound-emitting device.
[0018] It can be understood that since the call service is audio data transmitted through HFP on the SCO link, which has the characteristics of real-time audio transmission, in order to ensure the call quality, the audio framework selects the sound device as the Bluetooth headset that establishes an HFP connection with the mobile phone, and no longer reselects the sound device.
[0019] In a possible implementation of the first aspect above, the first electronic device completes the registration of the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP, including: the first electronic device completes the registration of the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP by executing a first preset function.
[0020] It can be understood that the first preset function includes the getProfileProxy function.
[0021] In a possible implementation of the first aspect, the Bluetooth application establishes a telephone service protocol (HFP) connection, including the Bluetooth application establishing a telephone service protocol (HFP) connection with the second electronic device by calling a second preset function.
[0022] It can be understood that the second preset function includes the ConnectHfp function in the onServiceConnected function.
[0023] In a possible implementation of the first aspect above, the Bluetooth application establishes a Bluetooth audio transmission model protocol A2DP connection, including: the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection with the second electronic device by calling a third preset function.
[0024] It can be understood that the third preset function includes the ConnectA2dp function in the onServiceConnected function.
[0025] In a second aspect, the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed on an electronic device, the electronic device implements the above-mentioned first aspect and any possible communication method of the first aspect.
[0026] In a third aspect, the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device; and a processor for executing the instructions stored in the memory to implement the above-mentioned first aspect and any possible communication method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] FIG1( a ) shows a schematic diagram of a scenario in which a mobile phone 20 receives an incoming call according to some embodiments of the present application;
[0028] FIG1( b ) shows another schematic diagram of a scenario in which a mobile phone 20 receives a call according to some embodiments of the present application;
[0029] Figure 2 According to some embodiments of the present application, a schematic diagram of a software architecture of a mobile phone 20 is shown;
[0030] Figure 3 According to some embodiments of the present application, a schematic diagram of an interaction of a mobile phone 20 is shown;
[0031] Figure 4 According to some embodiments of the present application, a schematic diagram of an interaction of a mobile phone 20 is shown;
[0032] Figure 5 According to some embodiments of the present application, a schematic diagram of the hardware structure of a mobile phone 20 is shown. DETAILED DESCRIPTION
[0033] The illustrative embodiments of the present application include, but are not limited to, a communication method, a storage medium, and an electronic device.
[0034] The first electronic device mentioned in this application can be any electronic device that can make voice calls and has Bluetooth function, including but not limited to mobile phones, media players, tablet computers, laptops, ultra-mobile personal computers (ultra-mobile personal computers, UMPCs), personal digital assistants (personal digital assistants, PDAs). For the sake of ease of description, this application takes the first electronic device as a mobile phone 20 as an example for introduction.
[0035] The second electronic device mentioned in this application can be any electronic device with Bluetooth function and audio data playback function, including but not limited to wireless headphones, wireless speakers, wireless bracelets, wireless car-mounted, wireless smart glasses, wireless watches, augmented reality (AR) / virtual reality (VR) devices and other devices. This application does not impose any special restrictions on the specific form of the second electronic device. For ease of description, this application takes the second electronic device as a Bluetooth headset 10 and a tablet computer 30 as an example for introduction.
[0036] The technical solutions of some embodiments of the present application are described below in conjunction with the accompanying drawings.
[0037] FIG1(a) shows a schematic diagram of a scenario in which a mobile phone 20 receives an incoming call. As shown in FIG1(a), the Bluetooth headset 10 and the tablet computer 30 are in a paired and connected state, that is, the Bluetooth headset 10 and the tablet computer 30 have established a trusted relationship through authentication, and the output audio of the tablet computer 30 can be played through the Bluetooth headset 10. At this time, if the mobile phone 20 turns on the Bluetooth function and is in a paired but unconnected state with the Bluetooth headset 10, that is, the Bluetooth headset 10 and the mobile phone 20 have previously established a trusted relationship through authentication, the output audio of the mobile phone 20 can be played through the local speaker, but cannot be played through the Bluetooth headset 10. At this time, if the mobile phone 20 receives an incoming call, according to the provisions of the Bluetooth protocol, the mobile phone 20 will seize the Bluetooth headset 10, that is, the mobile phone 20 will connect to the Bluetooth headset 10.
[0038] FIG1(b) shows another schematic diagram of a scenario in which a call is received by the mobile phone 20. As shown in FIG1(b), if the mobile phone 20 has turned on the Bluetooth function and is paired but not connected to the Bluetooth headset 10, that is, the Bluetooth headset 10 and the mobile phone 20 have established a trusted relationship through authentication, but the user manually disconnects the Bluetooth headset 10 from the mobile phone 20, that is, the output audio of the mobile phone 20 can be played through the speaker of the mobile phone, but cannot be played through the Bluetooth headset 10. At this time, if the mobile phone 20 receives an incoming call, according to the provisions of the Bluetooth protocol, the mobile phone 20 will connect to the Bluetooth headset 10.
[0039] As mentioned above, when the mobile phone 20 receives an incoming call message, in order to allow the incoming call ringtone of the mobile phone 20 to be played from the Bluetooth headset 10, the mobile phone 20 needs to establish HFP and A2DP connections, and there is a phenomenon that the incoming call ringtone of the mobile phone will be stuck during the process of establishing the connection. Specifically, after receiving the incoming call message, the mobile phone 20 will first register the protocol for transmitting audio services, including HFP, which is a protocol for implementing call services, and A2DP, which is a protocol for implementing multimedia services, and then establish the A2DP and HFP connection between the mobile phone 20 and the Bluetooth headset 10. After the mobile phone 20 and the Bluetooth headset 10 establish the A2DP and HFP connections, the mobile phone 20 can perform Bluetooth transmission of audio data, that is, play the incoming call ringtone on the Bluetooth headset 10. Among them, the process of the mobile phone 20 registering HFP and A2DP is a parallel process, that is, the mobile phone 20 will register HFP and A2DP at the same time. However, if the mobile phone 20 executes the getProfileProxy function, the speed of the mobile phone 20 registering A2DP is faster, that is, the mobile phone 20 completes the registration of A2DP first. Since the process of establishing HFP and A2DP connection between the mobile phone 20 and the Bluetooth headset 10 is a serial process, that is, after the mobile phone 20 completes the A2DP registration, the mobile phone 20 will first establish an A2DP connection with the Bluetooth headset 10. For example, the mobile phone 20 can first establish an A2DP connection with the Bluetooth headset 10 by executing the ConnectA2dp function in the onServiceConnected function, and play the incoming call ringtone on the Bluetooth headset 10 through A2DP.
[0040] In order to ensure that both the call service and multimedia service in the mobile phone 20 can be played through the Bluetooth headset 10, after the mobile phone 20 receives the incoming call message, the mobile phone 20 needs to establish a dual connection of A2DP and HFP with the Bluetooth headset 10. After the mobile phone 20 establishes the A2DP connection with the Bluetooth headset 10, the mobile phone 20 can complete the HFP registration after a period of time. After the mobile phone 20 completes the HFP registration, the mobile phone 20 can establish the HFP connection with the Bluetooth headset 10. For example, the mobile phone 20 can establish the HFP connection with the Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function. The call service is the audio data transmitted through HFP on the SCO link, which has the characteristics of real-time audio transmission. After the mobile phone 20 establishes the HFP connection with the Bluetooth headset 10, the mobile phone 20 will give priority to playing the incoming call ring tone on the Bluetooth headset 10 through HFP, that is, the mobile phone 20 will switch from playing the incoming call ring tone on the Bluetooth headset 10 through A2DP to playing the incoming call ring tone on the Bluetooth headset 10 through HFP. In the process of switching the incoming call ring tone of the mobile phone 20, since the mobile phone 20 will pause the audio stream of the incoming call ring tone, the incoming call ring tone of the mobile phone 20 will be stuck.
[0041] In order to solve the above problems, the present application provides a method for solving the problem of jamming of incoming call ringtones. Specifically, the mobile phone can be controlled to complete the registration of HFP and A2DP in advance. For example, the mobile phone completes the registration of HFP and A2DP through the getProfileProxy function when it is turned on, when the Bluetooth function is turned on, or when the mobile phone detects a Bluetooth headset that has been paired but not connected before. Then, if the mobile phone receives an incoming call message, it can choose to establish an HFP connection with the Bluetooth headset first, and then establish an A2DP connection with the Bluetooth headset. For example, the mobile phone establishes an HFP connection with the Bluetooth headset by executing the ConnectHfp function in the onServiceConnected function; and then establishes an A2DP connection with the Bluetooth headset by executing the ConnectA2dp function in the onServiceConnected function. In this way, the incoming call ringtone of the mobile phone will be played on the Bluetooth headset through HFP. Thereby avoiding the phenomenon that the incoming call ringtone of the mobile phone is jammed when the incoming call ringtone is switched from playing on the Bluetooth headset through A2DP to playing on the Bluetooth headset through HFP, thereby improving the user's call experience.
[0042] Combine the following Figure 2 The software architecture of the mobile phone 20 mentioned in this application is introduced. Figure 2 A schematic diagram of the software architecture of a mobile phone 20 is shown. Figure 2 As shown, the software architecture of the mobile phone 20 is respectively an application layer 101, a framework layer 102, an Android library 103 and a driver layer 104 from top to bottom.
[0043] The application layer 101 may include applications such as the main interface, phone, Bluetooth, and audio housekeeper. The application layer 101 may also include other applications, such as payment applications, shopping applications, banking applications, chat applications, or financial management applications, etc., which are not limited in this application. In this application, the phone application is used to send a broadcast of an incoming call to the mobile phone 20, and to send an audio stream of an incoming call ringtone in the mobile phone 20 to the framework layer 102. The audio housekeeper application is used to register A2DP and HFP, and to send a message to the Bluetooth application to establish an HFP and A2DP connection with the Bluetooth headset 10. The Bluetooth application is used to establish an HFP and A2DP connection with the Bluetooth headset 10, and to send a broadcast of a successful connection to the framework layer 102.
[0044] The framework layer 102 includes a telephone framework, a Bluetooth framework, an audio framework, etc. The framework layer 102 provides a multi-language framework for the application layer 101, such as computing power (which may include CPU computing power, graphics processing unit (GPU) computing power, image signal processor (ISP) computing power, etc.), sound recognition capability (which may include microphone sound recognition capability, voice recognition capability, etc.), security capability in terms of device security protection (which may include trusted operating environment security level, etc.), display capability (which may include screen resolution, screen size, etc.), playback capability (including sound amplification capability, stereo sound capability, etc.), and storage capability (which may include device memory capability, random access memory (RAM) capability, etc.)), which are not limited here. The application of the application layer 101 can implement the corresponding functions by calling the functions corresponding to the various capabilities provided by the framework layer 102.
[0045] Among them, the phone framework is used to provide communication functions for the mobile phone 20. For example, the management of call status (including connecting, hanging up, etc.). The Bluetooth framework is used to provide Bluetooth services for the mobile phone 20. The audio framework receives audio services sent by each application of the application layer 101, identifies the type of audio services, and performs service arbitration and preemption. In this application, the audio framework is used to select the sound device as a Bluetooth headset 20 that establishes an A2DP or HFP connection with the mobile phone 20, and is used to receive the ringtone audio stream.
[0046] The Android library 103 includes a surface manager, a media library, a 3D graphics processing library, an Android runtime, and the like.
[0047] Among them, the surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of multiple commonly used audio and video formats, as well as static image files. The media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The three-dimensional graphics processing library (for example, OpenGL ES) is used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing. The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one part is the function function that the Java language needs to call, and the other part is the Android core library. The application layer 101 and the framework layer 102 run in the virtual machine. The virtual machine executes the Java files of the application layer 101 and the framework layer 102 as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0048] The driver layer 104 can provide the mobile phone 20 with unified peripheral access capabilities and management framework, including display drivers, Bluetooth drivers, audio drivers, etc.
[0049] Understandably, Figure 2 The software architecture of the mobile phone 20 shown is only an example. In other embodiments, the software architecture applicable to the embodiments of the present application may include more or less, or may be split or merged in parts, or may adopt other architectures, which are not limited here.
[0050] Combine the following Figure 3 and the software architecture of the mobile phone 20, and introduces the specific process of interaction in the mobile phone 20 when the mobile phone 20 receives an incoming call. Figure 3 A schematic diagram of the interaction process in the mobile phone 20 is shown. Figure 3 As shown, the interaction process includes the following steps:
[0051] S101: The Bluetooth application sends a Bluetooth on broadcast to the audio manager application.
[0052] When the Bluetooth of the mobile phone 20 is turned on, the Bluetooth application sends a broadcast indicating that the Bluetooth is turned on to the audio manager application.
[0053] S102: The phone application sends a ring tone audio stream to the audio framework.
[0054] When a call comes in to the mobile phone 20, the phone application sends a ring tone audio stream to the audio framework.
[0055] In some embodiments, the ring tone audio stream sent by the phone application is of the type of the stream_ring function, and the present application does not impose any limitation on the type of the ring tone audio stream.
[0056] S103: The phone application sends an incoming call broadcast to the audio manager application.
[0057] When a call comes in to the mobile phone 20, the phone application sends an incoming call broadcast to the audio manager application.
[0058] In some embodiments, step S102 may also be performed after step S103, that is, the phone application first sends the incoming call broadcast of the mobile phone 20 to the audio manager application, and then sends the ringtone audio stream to the audio framework. The embodiment of the present application does not limit the order in which the phone application sends the ringtone audio stream and the incoming call broadcast.
[0059] In some embodiments, the incoming call broadcast may include the incoming call phone number, the incoming call operator information, etc.
[0060] S104: The audio manager application registers HFP and A2DP.
[0061] After receiving the incoming call broadcast from the mobile phone 20, the audio manager application registers HFP and A2DP.
[0062] In some embodiments, the audio manager application can register HFP and A2DP by executing the getProfileProxy function. This application does not limit the specific implementation method of the audio manager application registering HFP and A2DP.
[0063] The process of the audio manager application registering HFP and A2DP is a parallel process, that is, the audio manager application will register HFP and A2DP at the same time. If the mobile phone 20 executes the getProfileProxy function, the audio manager application registers A2DP faster, that is, the audio manager application completes the registration with A2DP first.
[0064] As mentioned above, HFP has the characteristic of real-time audio transmission and is used to implement call services, such as real-time voice, etc. A2DP has the characteristic of non-real-time audio transmission and is used to implement multimedia services, such as playing music, etc.
[0065] S105: The audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0066] As mentioned above, since the process of establishing HFP and A2DP connection between the mobile phone 20 and the Bluetooth headset 10 is a serial process, after the audio manager application completes the A2DP registration, the audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0067] In some embodiments, the Bluetooth application first establishes an A2DP connection with the Bluetooth headset 10 by executing the ConnectA2dp function in the onServiceConnected function.
[0068] S106: The Bluetooth application sends a broadcast of successful connection to the audio framework.
[0069] The Bluetooth application sends a broadcast to the audio framework to establish an A2DP connection with the Bluetooth headset 10.
[0070] In some embodiments, the Bluetooth application may send a broadcast of successful connection through the Context.sendBroadcast function.
[0071] S107: The audio framework selects a sound output device.
[0072] The audio framework selects the sound device as the Bluetooth headset 10 that establishes an A2DP connection with the mobile phone 20.
[0073] In some embodiments, the sound-emitting device may also be a speaker or receiver of the mobile phone 20, or a device such as an audio device connected to the mobile phone 20. The present application does not limit the type of the sound-emitting device.
[0074] S108: The audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10.
[0075] In order to ensure that both the call service and the multimedia service in the mobile phone 20 can be played through the Bluetooth headset 10, the mobile phone 20 needs to establish a dual connection of A2DP and HFP with the Bluetooth headset 10. After the mobile phone 20 establishes the A2DP connection with the Bluetooth headset 10, the mobile phone 20 can complete the HFP registration after a period of time. When the mobile phone 20 completes the HFP registration, the audio manager application sends a message to the Bluetooth application to establish the HFP connection with the Bluetooth headset 10.
[0076] In some embodiments, the Bluetooth application establishes an HFP connection with the Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function.
[0077] S109: The Bluetooth application sends a broadcast indicating successful connection to the phone application.
[0078] The Bluetooth application sends a broadcast to the phone application to establish an HFP connection with the Bluetooth headset 10 .
[0079] In some embodiments, the Bluetooth application may send a broadcast of successful connection through the Context.sendBroadcast function.
[0080] S110: The phone application sends a message to the audio framework to select a sound device.
[0081] After receiving the broadcast of establishing an HFP connection with the Bluetooth headset 10, the phone application sends a message to the audio framework to select a sound device.
[0082] S111: The audio framework selects a sound output device.
[0083] As mentioned above, since the call service is audio data transmitted through HFP on the SCO link, which has the characteristic of real-time audio transmission, in order to ensure the call quality, the audio framework selects the sound device as the Bluetooth headset 10 that establishes an HFP connection with the mobile phone 20.
[0084] When the mobile phone 20 switches from playing the incoming call ring tone on the Bluetooth headset 10 through A2DP to playing the incoming call ring tone on the Bluetooth headset 10 through HFP, the mobile phone 20 will suspend the audio data transmission of the incoming call ring tone, so that the incoming call ring tone of the mobile phone 20 becomes stuck.
[0085] Combine the following Figure 4 and the software architecture of the mobile phone 20, and introduces the specific process of interaction in the mobile phone 20 when the mobile phone 20 receives an incoming call. Figure 4 A schematic diagram of the interaction process in the mobile phone 20 is shown. Figure 4 The interaction process includes the following steps:
[0086] S201: The Bluetooth application sends a broadcast indicating that Bluetooth is turned on to the audio manager application.
[0087] When the Bluetooth of the mobile phone 20 is turned on, the Bluetooth application sends a broadcast indicating that the Bluetooth is turned on to the audio manager application.
[0088] S202: The audio manager application registers HFP and A2DP.
[0089] During the initialization phase of the mobile phone 20, such as the power-on phase of the mobile phone 20, the phase when the user manually opens the Bluetooth application, or when the mobile phone 20 detects a Bluetooth headset 10 that was previously paired but not connected, the audio manager application registers HFP and A2DP.
[0090] In some embodiments, the audio manager application can register HFP and A2DP by executing the getProfileProxy function. This application does not limit the specific implementation method of the audio manager application registering HFP and A2DP.
[0091] In some embodiments, the implementation logic of the registration service may be included in the getProfileProxy function, registering HFP by executing the getProfileProxy(context, mBluetoothListener, BluetoothProfile.HEADSET) function, and registering A2DP by executing the getProfileProxy(context, mBluetoothListener, BluetoothProfile.A2DP) function.
[0092] As mentioned above, HFP has the characteristic of real-time audio transmission and is used to implement call services, such as real-time voice, etc. A2DP has the characteristic of non-real-time audio transmission and is used to implement multimedia services, such as playing music, etc.
[0093] The process of the audio manager application registering HFP and A2DP is a parallel process, that is, the audio manager application will register HFP and A2DP at the same time.
[0094] S203: The phone application sends a ring tone audio stream to the audio framework.
[0095] When a call comes in to the mobile phone 20, the phone application sends a ring tone audio stream to the audio framework.
[0096] In some embodiments, the ring tone audio stream sent by the phone application is of the type of the stream_ring function, and the present application does not impose any limitation on the type of the ring tone audio stream.
[0097] S204: The phone application sends an incoming call broadcast to the audio manager application.
[0098] When a call comes in to the mobile phone 20, the phone application sends an incoming call broadcast to the audio manager application.
[0099] In some embodiments, step S203 may also be after step S204, that is, the phone application first sends the incoming call broadcast of the mobile phone 20 to the audio manager application, and then sends the ringtone audio stream to the audio framework. The embodiment of the present application does not limit the order in which the phone application sends the ringtone audio stream and the incoming call broadcast.
[0100] In some embodiments, the incoming call broadcast may include the incoming call phone number, the incoming call operator information, etc.
[0101] S205: The audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10.
[0102] When the mobile phone 20 receives an incoming call message, according to the characteristic that the audio data of the call service is suitable for transmission through HFP, the audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10. The Bluetooth application can call the ConnectHfp function in the onServiceConnected function when executing the onServiceConnected function, so that the Bluetooth application first establishes an HFP connection with the Bluetooth headset 10.
[0103] In some embodiments, the implementation logic of establishing an HFP connection with the Bluetooth headset 10 may include entering the onServiceConnected function after the mobile phone 20 successfully registers the HFP, and using the connectHFP(bluetoothDevice) function to enable the Bluetooth application to first establish an HFP connection with the Bluetooth headset 10.
[0104] S206: The Bluetooth application sends a broadcast indicating successful connection to the phone application.
[0105] The Bluetooth application sends a broadcast to the phone application to establish an HFP connection with the Bluetooth headset 10 .
[0106] In some embodiments, the Bluetooth application may send a broadcast of successful connection through the Context.sendBroadcast function.
[0107] S207: The phone application sends a message to the audio framework to switch out of the sound device.
[0108] After receiving the message for establishing the HFP connection with the Bluetooth headset 10, the phone application sends a message for switching out the sound device to the audio framework.
[0109] S208: The audio framework selects a sound output device.
[0110] The audio framework selects the sound device as the Bluetooth headset 10 that establishes an HFP connection with the mobile phone 20.
[0111] In some embodiments, the sound-emitting device may also be a speaker or receiver of the mobile phone 20, or a device such as an audio device connected to the mobile phone 20. The present application does not limit the type of the sound-emitting device.
[0112] S209: The audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0113] In order to ensure that both the call service and the multimedia service in the mobile phone 20 can be played through the Bluetooth headset 10, the mobile phone 20 needs to establish a dual connection of A2DP and HFP with the Bluetooth headset 10. After the mobile phone 20 establishes an HFP connection with the Bluetooth headset 10, the audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0114] In the present application, the Bluetooth application can establish an AD2P connection with the Bluetooth headset 10 by executing the onServiceConnected function, for example, by calling the ConnectA2dp function in the onServiceConnected function, so that the Bluetooth application establishes an A2DP connection with the Bluetooth headset 10.
[0115] In some embodiments, the implementation logic of establishing an A2DP connection with the Bluetooth headset 10 may include, after the mobile phone 20 successfully registers A2DP, going to the onServiceConnected function, and establishing an A2DP connection between the Bluetooth application and the Bluetooth headset 10 through the connectA2dp(bluetoothDevice) function.
[0116] S210: The Bluetooth application sends a broadcast of successful connection to the audio framework.
[0117] The Bluetooth application sends a broadcast to the audio framework to establish an A2DP connection with the Bluetooth headset 10.
[0118] In some embodiments, the Bluetooth application may send a broadcast of successful connection through the Context.sendBroadcast function.
[0119] S211: The audio framework no longer reselects the sound device.
[0120] Since the call service is audio data transmitted through HFP on the SCO link, which has the characteristic of real-time audio transmission, in order to ensure the call quality, the audio framework selects the sound device as the Bluetooth headset 10 that establishes an HFP connection with the mobile phone 20, and no longer reselects the sound device.
[0121] In the present application, if the mobile phone 20 and the Bluetooth headset 10 are in a paired but unconnected state, the mobile phone 20 completes the registration of HFP and A2DP during initialization. If the mobile phone 20 receives an incoming call, according to the characteristics that the audio data of the call service is suitable for transmission through HFP, the mobile phone 20 chooses to establish an HFP connection with the Bluetooth headset 10 first, and then establish an A2DP connection with the Bluetooth headset 10. For example, the mobile phone 20 establishes an HFP connection with the Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function; and then establishes an A2DP connection with the Bluetooth headset 10 by executing the ConnectA2dp function in the onServiceConnected function. In this way, the incoming ringtone of the mobile phone 20 will be played in the Bluetooth headset 10 through HFP. Thereby avoiding the phenomenon that the incoming ringtone of the mobile phone 20 is stuck when switching from playing in the Bluetooth headset 10 through A2DP to playing in the Bluetooth headset 10 through HFP, thereby improving the user's call experience.
[0122] Combine the following Figure 5 The hardware structure of the mobile phone 20 is introduced. For example, Figure 5 The figure shows a schematic diagram of the hardware structure of a mobile phone 20. The mobile phone 20 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0123] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the mobile phone 20. In other embodiments of the present application, the mobile phone 20 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0124] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the mobile phone 20. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. For example, in some embodiments of the present application, the processor 110 can execute the communication method mentioned in the present application.
[0125] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The processor 110 may execute the communication method mentioned in the present application based on the instructions and data.
[0126] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The wireless communication function of the mobile phone 20 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor and the baseband processor. The mobile communication module 150 can provide solutions for wireless communication including 2G / 3G / 4G / 5G applied on the mobile phone 20. The wireless communication module 160 can provide solutions for wireless communication including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc. applied on the mobile phone 20. For example, in the embodiment of the present application, Bluetooth can be used to establish a Bluetooth connection with the Bluetooth headset 10.
[0127] The mobile phone 20 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0128] The display screen 194 is used to display images, videos, etc. The mobile phone 20 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0129] The mobile phone 20 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
[0130] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110. For example, in some embodiments of the present application, the incoming call ringtone of the mobile phone 20 can convert digital audio information into analog audio signal output through the audio module 170.
[0131] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The mobile phone 20 can listen to music or listen to hands-free calls through the speaker 170A. For example, in the embodiment of the present application, the speaker 170A of the mobile phone 20 can be used as a sound device for the incoming call ringtone.
[0132] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the mobile phone 20 receives a call or voice message, the voice can be received by placing the receiver 170B close to the ear.
[0133] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The mobile phone 20 can be provided with at least one microphone 170C. In other embodiments, the mobile phone 20 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the mobile phone 20 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, and directional recording functions, etc.
[0134] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0135] The above describes the possible hardware structure of the mobile phone 20. It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the mobile phone 20. In other embodiments of the present application, the mobile phone 20 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0136] The present application provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed on an electronic device, the electronic device implements the communication method provided by the present application.
[0137] The present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device; and a processor for executing the instructions stored in the memory to implement the communication method provided by the present application.
[0138] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0139] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0140] It should be noted that, in the examples and description of the present application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the statement "comprise one" do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0141] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.
Claims
1. A communication method, applied to a first electronic device, characterized in that: Corresponding to the first electronic device satisfying the first condition, the first electronic device registers the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP; After completing the registration of the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP, the first electronic device receives a first call; In response to the first call, the first electronic device establishes a telephone service protocol HFP connection with the Bluetooth headset, and the first electronic device sends audio data corresponding to the incoming call ring tone to the Bluetooth headset through the telephone service protocol HFP connection. Before receiving the first call, the first electronic device and the Bluetooth headset have been paired and no Bluetooth connection has been established; After the first electronic device establishes the telephone service protocol HFP connection with the Bluetooth headset, the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection with the Bluetooth headset, and after completing the establishment of the Bluetooth audio transmission model protocol A2DP connection, the first electronic device sends the audio data to the Bluetooth headset through the telephone service protocol HFP connection.
2. The method according to claim 1, characterized in that The first electronic device satisfies the first condition, and the first electronic device registers the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP, including: In response to a user operation, the first electronic device starts a Bluetooth service; After starting the Bluetooth service, the first electronic device registers the telephone service protocol HFP and the Bluetooth audio transmission profile protocol A2DP.
3. The communication method according to claim 1, characterized in that: The first electronic device establishes a telephone service protocol HFP connection in the following manner: The audio manager application in the first electronic device sends a message to the Bluetooth application to establish a telephone service protocol HFP connection with the Bluetooth headset, and the Bluetooth application establishes the telephone service protocol HFP connection.
4. The communication method according to claim 3, characterized in that: The first electronic device sends audio data corresponding to the incoming call ring tone to the Bluetooth headset through the telephone service protocol HFP connection, including: The telephone application in the first electronic device receives the information that the telephone service protocol HFP is successfully established, and sends a command to switch out the sound device to the audio framework; The audio framework selects the sound-emitting device as the Bluetooth headset that establishes a telephone service protocol HFP connection with the first electronic device, and sends audio data corresponding to the incoming call ring tone to the Bluetooth headset.
5. The communication method according to claim 3, characterized in that: The first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection with the Bluetooth headset, including: After the first electronic device establishes the telephone service protocol HFP connection, the audio manager application in the first electronic device sends a message to the Bluetooth application to establish a Bluetooth audio transmission model protocol A2DP connection with the Bluetooth headset, and the Bluetooth application establishes the Bluetooth audio transmission model protocol A2DP connection.
6. A communication system, characterized in that: The communication system comprises a Bluetooth headset, a first electronic device and a second electronic device, wherein the first electronic device has been paired with the Bluetooth headset but has not established a Bluetooth connection, and the second electronic device has been paired with the Bluetooth headset and has established a Bluetooth connection; Corresponding to the first electronic device satisfying the first condition, the first electronic device registers the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP; After completing the registration of the telephone service protocol HFP and the Bluetooth audio transmission model protocol A2DP, the first electronic device receives a first call; The first electronic device responds to the first call and establishes a telephone service protocol (HFP) connection with the Bluetooth headset, and the first electronic device sends audio data corresponding to the incoming call ring tone to the Bluetooth headset through the telephone service protocol (HFP) connection; The Bluetooth headset plays the audio data sent by the first electronic device; After the first electronic device establishes the telephone service protocol HFP connection with the Bluetooth headset, the first electronic device establishes a Bluetooth audio transmission model protocol A2DP connection with the Bluetooth headset, and after completing the establishment of the Bluetooth audio transmission model protocol A2DP connection, the first electronic device sends the audio data to the Bluetooth headset through the telephone service protocol HFP connection.
7. The system according to claim 6, characterized in that The first electronic device starts a Bluetooth service in response to a user operation; After starting the Bluetooth service, the first electronic device registers the telephone service protocol HFP and the Bluetooth audio transmission profile protocol A2DP.
8. The system according to claim 6, characterized in that Before the Bluetooth headset plays the audio data sent by the first electronic device, the Bluetooth headset plays the audio data sent by the second electronic device.
9. The system according to claim 6, characterized in that After the first electronic device receives the first call, the Bluetooth headset disconnects the Bluetooth connection with the second electronic device.
10. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device; and a processor, configured to execute instructions stored in the memory to implement the communication method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Vehicle-mounted communication method and vehicle-mounted equipment
CN114422984A
Bluetooth connection method, device and system
CN116074986A
Information processing apparatus and mobile communication apparatus
US20100069007A1
Subscription-Enabled Audio Device and Subscription System
US20180176766A1
Call control method and apparatus, and electronic device and computer-readable storage medium
WO2023045784A1