A communication method, storage medium and electronic device
By registering the HFP and A2DP protocols before the phone and Bluetooth headset establish a connection, and establishing an HFP connection first, the stuttering problem caused by ringtone switching during incoming calls is resolved, thus improving the user's call experience.
Patent Information
- Application Number
- CN202311709735.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-08-15
AI Technical Summary
When a mobile phone and a Bluetooth headset establish a connection, the incoming call ringtone may stutter due to the switching during the protocol registration process, affecting the user experience.
Complete the registration of HFP and A2DP in advance, establish the HFP connection first and then the A2DP connection to ensure that the call service transmits audio data through HFP.
This avoids stuttering during ringtone switching, improving the user's call experience.
Smart Images

Figure CN119497049B_ABST
Abstract
Description
[0001] This application is a divisional application. The original application is entitled "A Communication Method, Storage Medium and Electronic Device", with application number 202311026635.4 and application date of August 15, 2023. The entire contents of the original application are incorporated herein by reference. Technical Field
[0002] This application relates to the field of Bluetooth technology, and more particularly to a communication method, storage medium, and electronic device. Background Technology
[0003] The Advanced Audio Distribution Profile (A2DP) and the Hands-Free Profile (HFP) are two protocols used in a primary electronic device (using a mobile phone as an example) to transmit audio services. Through A2DP and HFP, a mobile phone can transmit audio data to a second Bluetooth-enabled electronic device (using a Bluetooth headset as an example). A2DP is characterized by non-real-time audio transmission and is used for multimedia services, such as music playback. HFP is characterized by real-time audio transmission and is used for call services, such as real-time voice communication.
[0004] Bluetooth physical links are divided into synchronous connection-oriented (SCO) links and asynchronous connection-less (ACL) links. SCO links are used to transmit data with high real-time requirements, such as audio data in voice calls. ACL links are used to transmit data with non-real-time requirements, such as audio data in music applications. Therefore, to ensure call quality, mobile phone voice calls need to transmit audio data via HFP over SCO links.
[0005] However, in some situations, such as when the phone has Bluetooth enabled and is paired but not connected to a Bluetooth headset, if the phone receives an incoming call, according to the Bluetooth protocol, the phone will play the ringtone through the Bluetooth headset, thus establishing a connection. When the phone and Bluetooth headset are connected, if the HFP and A2DP protocols related to Bluetooth transmission are registered using the `getProfileProxy` function, the phone will initially transmit the ringtone via A2DP before switching to HFP, as A2DP registration is faster than HFP registration. During this switching process, the phone will pause the audio data transmission of the ringtone, causing a stuttering or interrupted ringtone playback. Summary of the Invention
[0006] To address the issue of stuttering ringtones on mobile phones, this application provides a communication method, a storage medium, and an electronic device.
[0007] In a first aspect, this application provides a communication method, comprising: corresponding to a first electronic device satisfying a first condition, the first electronic device completes registration of the Telephone Service Protocol (HFP) and the Bluetooth Audio Transfer Model Protocol (A2DP); the first electronic device receives incoming call information and detects a second electronic device that has been paired with the first electronic device via Bluetooth 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 via the Telephone Service Protocol (HFP), wherein the audio data includes the incoming call ringtone corresponding to the incoming call information, and the first electronic device establishes a Bluetooth Audio Transfer Model Protocol (A2DP) connection after establishing the Telephone Service Protocol (HFP) connection.
[0008] It is understood that the first electronic device mentioned in this application includes any electronic device such as a mobile phone that can make voice calls and has Bluetooth functionality, and the second electronic device mentioned in this application includes any electronic device such as a Bluetooth headset that has Bluetooth functionality and audio data playback functionality.
[0009] In this way, the phone completes HFP and A2DP registration in advance. When a call comes in, the phone first establishes an HFP connection with the Bluetooth headset, and the ringtone will be played on the headset via HFP, depending on the call type. Afterwards, the phone establishes an A2DP connection with the headset, and the phone no longer chooses to play the ringtone via A2DP. This avoids the stuttering sound that occurs when switching from playing the ringtone via A2DP to playing it via HFP on the Bluetooth headset, thus improving the user's call experience.
[0010] In one possible implementation of the first aspect above, the first condition includes at least one of the following: entering the power-on phase, Bluetooth function being turned on, and detecting an electronic device that has been paired with Bluetooth.
[0011] It is understood that the first condition mentioned in this application can be that the mobile phone is in the initialization phase, which includes, but is not limited to, entering the power-on phase, having Bluetooth enabled, or detecting an electronic device that has been paired with Bluetooth.
[0012] In one possible implementation of the first aspect above, the first electronic device establishes a Telephone Service Protocol (HFP) connection by sending a message to a Bluetooth application to establish an HFP connection with the second electronic device, and the Bluetooth application establishes the HFP connection.
[0013] In one possible implementation of the first aspect above, transmitting audio data to a second electronic device via the Telephone Service Protocol (HFP) includes: a telephone application in the first electronic device receiving a message indicating that the HFP connection has been successfully established, and sending a command to the audio framework to switch out a sound device; the audio framework selecting the sound device as the second electronic device that has established a HFP connection with the first electronic device, and transmitting audio data to the second electronic device.
[0014] It is understood that the sound-emitting device can also be a mobile phone speaker, earpiece, or other audio device connected to the mobile phone. This application does not limit the type of sound-emitting device.
[0015] In one possible implementation of the first aspect above, after establishing a Telephone Service Protocol (HFP) connection, the first electronic device establishes a Bluetooth Audio Transmission Model Protocol (A2DP) connection, including: after establishing a 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 second electronic device, and the Bluetooth application establishes the Bluetooth Audio Transmission Model Protocol (A2DP) connection.
[0016] Understandably, to ensure that both voice calls and multimedia services on the phone can be played through the Bluetooth headset, the phone needs to establish a dual connection with the Bluetooth headset using both the Bluetooth Audio Transmission Model Protocol (A2DP) and the Telephony Protocol (HFP). After establishing an HFP connection between the phone and the Bluetooth headset, an A2DP connection is then established.
[0017] In one possible implementation of the first aspect above, the communication method further includes: after the first electronic device and the second electronic device establish a Bluetooth Audio Transmission Model Protocol (A2DP) connection, the audio frame in the first electronic device no longer reselects the sound output device.
[0018] It is understandable that, since the audio data for the call is transmitted via HFP on the SCO link, and has the characteristic of real-time audio transmission, in order to ensure call quality, the audio framework selects the Bluetooth headset that establishes an HFP connection with the mobile phone as the sound output device, instead of selecting a new sound output device.
[0019] In one 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 is understandable that the first preset function includes the getProfileProxy function.
[0021] In one possible implementation of the first aspect above, the Bluetooth application establishes a Telephone Service Protocol (HFP) connection, including the Bluetooth application establishing an HFP connection with a second electronic device by calling a second preset function.
[0022] It is understandable that the second preset function includes the ConnectHfp function in the onServiceConnected function.
[0023] In one possible implementation of the first aspect above, the Bluetooth application establishes a Bluetooth Audio Transmission Model Protocol (A2DP) connection, including: the first electronic device establishing a Bluetooth Audio Transmission Model Protocol (A2DP) connection with the second electronic device by calling a third preset function.
[0024] It is understandable that the third preset function includes the ConnectA2dp function in the onServiceConnected function.
[0025] Secondly, this application provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement the first aspect and any possible communication method of the first aspect.
[0026] Thirdly, this 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 first aspect and any possible communication method of the first aspect. Attached Figure Description
[0027] Figure 1(a) illustrates a scenario of a mobile phone 20 receiving a call, according to some embodiments of this application;
[0028] Figure 1(b) illustrates another scenario of a mobile phone 20 receiving a call, according to some embodiments of this application;
[0029] Figure 2 According to some embodiments of this application, a schematic diagram of the software architecture of a mobile phone 20 is shown;
[0030] Figure 3 According to some embodiments of this application, an interactive schematic diagram of a mobile phone 20 is shown;
[0031] Figure 4 According to some embodiments of this application, an interactive schematic diagram of a mobile phone 20 is shown;
[0032] Figure 5 According to some embodiments of this application, a schematic diagram of the hardware structure of a mobile phone 20 is shown. Detailed Implementation
[0033] The illustrative embodiments of this 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 capable of making voice calls and having Bluetooth functionality, including but not limited to mobile phones, media players, tablets, laptops, ultra-mobile personal computers (UMPCs), and personal digital assistants (PDAs). For ease of description, this application will use mobile phone 20 as an example of the first electronic device.
[0035] The second electronic device mentioned in this application can be any electronic device with Bluetooth functionality and audio data playback capability, including but not limited to wireless headphones, wireless speakers, wireless bracelets, wireless in-vehicle systems, wireless smart glasses, wireless watches, augmented reality (AR) / virtual reality (VR) devices, etc. This application does not impose any special limitations on the specific form of the second electronic device. For ease of description, this application uses Bluetooth headphones 10 and tablet computers 30 as examples of second electronic devices.
[0036] The technical solutions of some embodiments of this application are described below with reference to the accompanying drawings.
[0037] Figure 1(a) illustrates a scenario where a phone 20 receives a call. As shown in Figure 1(a), the Bluetooth headset 10 and the tablet 30 are paired and connected, meaning they have established a trusted relationship through authentication, and the audio output from the tablet 30 can be played through the Bluetooth headset 10. If the phone 20 has Bluetooth enabled and is paired but not connected to the Bluetooth headset 10 (meaning they have already established a trusted relationship), the phone 20's audio output can be played through its own speaker, not through the Bluetooth headset 10. If the phone 20 receives an incoming call, according to the Bluetooth protocol, it will preempt the Bluetooth headset 10, meaning it will connect to it.
[0038] Figure 1(b) illustrates another scenario involving a call received by mobile phone 20. As shown in Figure 1(b), if mobile phone 20 has Bluetooth enabled and is paired but not connected to Bluetooth headset 10 (meaning the headset 10 and mobile phone 20 have established a trusted relationship through authentication, but the user manually disconnects the headset 10 from the phone), the audio output of mobile phone 20 can be played through its own speaker and not through the headset 10. In this case, if mobile phone 20 receives an incoming call, according to the Bluetooth protocol, mobile phone 20 will connect to Bluetooth headset 10.
[0039] As mentioned earlier, when mobile phone 20 receives an incoming call message, in order for the ringtone of mobile phone 20 to be played from Bluetooth headset 10, mobile phone 20 needs to establish HFP and A2DP connections. During the connection establishment process, the ringtone may experience stuttering. Specifically, after receiving an incoming call message, mobile phone 20 first registers the protocols used for transmitting audio services, including HFP (the protocol for call services) and A2DP (the protocol for multimedia services), and then establishes A2DP and HFP connections between mobile phone 20 and Bluetooth headset 10. After establishing A2DP and HFP connections between mobile phone 20 and Bluetooth headset 10, mobile phone 20 can transmit audio data via Bluetooth, i.e., play the ringtone on Bluetooth headset 10. The registration processes of HFP and A2DP by mobile phone 20 are parallel processes; that is, mobile phone 20 will register HFP and A2DP simultaneously. However, if mobile phone 20 executes the getProfileProxy function, mobile phone 20 will register A2DP faster, i.e., mobile phone 20 will complete A2DP registration first. Since the process of establishing HFP and A2DP connections between mobile phone 20 and Bluetooth headset 10 is a serial process, that is, after mobile phone 20 completes A2DP registration, mobile phone 20 will first establish an A2DP connection with Bluetooth headset 10. For example, mobile phone 20 can first establish an A2DP connection with Bluetooth headset 10 by executing the ConnectA2dp function in the onServiceConnected function, and play the incoming call ringtone on Bluetooth headset 10 through A2DP.
[0040] To ensure that both call and multimedia services on mobile phone 20 can be played through Bluetooth headset 10, after receiving an incoming call message, mobile phone 20 needs to establish dual connections with Bluetooth headset 10 via A2DP and HFP. After establishing an A2DP connection, mobile phone 20 will complete HFP registration after a period of time. Only after HFP registration is complete can mobile phone 20 establish an HFP connection with Bluetooth headset 10. For example, mobile phone 20 can establish an HFP connection with Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function. Call services transmit audio data via HFP over the SCO link, featuring real-time audio transmission. After establishing an HFP connection, mobile phone 20 will prioritize playing the incoming call ringtone on Bluetooth headset 10 via HFP; that is, mobile phone 20 will switch from playing the incoming call ringtone on Bluetooth headset 10 via A2DP to playing it via HFP. During the process of switching the ringtone on phone 20, the phone 20 will pause the audio stream of the ringtone, which will cause the ringtone of phone 20 to stutter.
[0041] To address the aforementioned issues, this application provides a method for resolving ringtone stuttering. Specifically, the phone can be pre-registered for HFP and A2DP. For example, during power-on, when Bluetooth is enabled, or when the phone detects a previously paired but not yet connected Bluetooth headset, the `getProfileProxy` function completes HFP and A2DP registration. Then, if the phone receives an incoming call, it can choose to establish an HFP connection with the Bluetooth headset first, and then an A2DP connection. For instance, the phone executes the `ConnectHfp` function within the `onServiceConnected` function to establish an HFP connection with the Bluetooth headset; then, it executes the `ConnectA2dp` function within the `onServiceConnected` function to establish an A2DP connection. Thus, the phone's ringtone will be played on the Bluetooth headset via HFP. This avoids the stuttering issue that occurs when switching from A2DP to HFP playback on the Bluetooth headset, improving the user's call experience.
[0042] The following is combined Figure 2 The software architecture of the mobile phone 20 mentioned in this application is described. Figure 2 A schematic diagram of the software architecture of a mobile phone 20 is shown. (For example...) Figure 2 As shown, the software architecture of the mobile phone 20, from top to bottom, consists of the application layer 101, the framework layer 102, the Android library 103, and the driver layer 104.
[0043] Application layer 101 may include applications such as a main interface, telephone, Bluetooth, and audio manager. 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 telephone application is used to broadcast incoming calls from mobile phone 20 and to send the audio stream of the incoming call ringtone from mobile phone 20 to frame layer 102. The audio manager application is used to register A2DP and HFP, and to send a message to the Bluetooth application establishing an HFP and A2DP connection with Bluetooth headset 10. The Bluetooth application is used to establish an HFP and A2DP connection with Bluetooth headset 10 and to broadcast a successful connection to frame layer 102.
[0044] Framework layer 102 includes telephone framework, Bluetooth framework, audio framework, etc. Framework layer 102 provides multi-language frameworks for application layer 101, including computing power (including CPU computing power, Graphics Processing Unit (GPU) computing power, Image Signal Processor (ISP) computing power, etc.), sound recognition capabilities (including microphone sound recognition capabilities, speech recognition capabilities, etc.), device security capabilities (including trusted operating environment security levels, etc.), display capabilities (including screen resolution, screen size, etc.), playback capabilities (including amplification capabilities, stereo sound capabilities, etc.), and storage capabilities (including device memory capabilities, random access memory (RAM) capabilities, etc.), without limitation. Applications in application layer 101 can implement corresponding functions by calling the functions corresponding to the various capabilities provided by framework layer 102.
[0045] The telephone framework provides communication functions for the mobile phone 20, such as call status management (including call connection and disconnection). The Bluetooth framework provides Bluetooth services for the mobile phone 20. The audio framework receives audio services sent by various applications in the application layer 101, identifies the type of audio service, and performs service arbitration and preemption. In this application, the audio framework is used to select the sound-emitting device as the Bluetooth headset 20 that establishes an A2DP or HFP connection with the mobile phone 20, and to receive ringtone audio streams.
[0046] Android Library 103 includes Surface Manager, Media Library, 3D Graphics Processing Library, Android Runtime, etc.
[0047] The Surface Manager manages the display subsystem and provides 2D and 3D layer blending for multiple applications. The Media Library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing library (e.g., OpenGL ES) is used for 3D graphics drawing, image rendering, compositing, and layer processing. The Android Runtime includes the core library and the virtual machine. The Android Runtime is responsible for scheduling and managing the Android system. The core library consists of two parts: functions that Java calls and the core Android libraries. Application Layer 101 and Framework Layer 102 run in the virtual machine. The virtual machine executes the Java files of Application Layer 101 and Framework Layer 102 as binary files. The virtual machine is used for object lifecycle 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 driver, Bluetooth driver, audio driver, etc.
[0049] Understandable. 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 this application may include more or fewer parts, or may be split or merged, or may adopt other architectures, which are not limited here.
[0050] The following is combined Figure 3 The software architecture of the phone 20 is described, along with the specific interaction process within the phone 20 when a call comes in. Figure 3 A schematic diagram of the interaction process in a mobile phone 20 is shown, such as... Figure 3 As shown, the interaction process includes the following steps:
[0051] S101: The Bluetooth application sends a Bluetooth broadcast to the audio manager application.
[0052] When Bluetooth is turned on on the phone 20, the Bluetooth app sends a broadcast to the audio manager app announcing that Bluetooth is on.
[0053] S102: The phone application sends a ringtone audio stream to the audio frame.
[0054] When a call comes in on the phone, the phone app sends a ringtone audio stream to the audio frame.
[0055] In some embodiments, the ringtone audio stream sent by the telephone application is of type stream_ring function, and this application does not limit the type of ringtone audio stream.
[0056] S103: The phone app sends an incoming call broadcast to the audio manager app.
[0057] When a call comes in at 20, the phone app sends a call broadcast to the audio manager app.
[0058] In some embodiments, step S102 may also be performed after step S103, that is, the telephone 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 frame. This application embodiment does not limit the order in which the telephone application sends the ringtone audio stream and the incoming call broadcast.
[0059] In some embodiments, the incoming call broadcast may include the caller's phone number, caller's carrier information, etc.
[0060] S104: Register HFP and A2DP for the Audio Manager application.
[0061] Upon receiving an incoming call broadcast from phone number 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 of the audio manager application registering HFP and A2DP.
[0063] The registration processes of HFP and A2DP by the audio manager application are parallel processes, meaning that the audio manager application will register HFP and A2DP at the same time. If the getProfileProxy function is executed on the phone, the audio manager application will register A2DP faster, meaning that the audio manager application will complete the registration of A2DP first.
[0064] As mentioned earlier, HFP features real-time audio transmission and is used for call services, such as real-time voice communication. A2DP features non-real-time audio transmission and is used for multimedia services, such as music playback.
[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 earlier, since the process of establishing HFP and A2DP connections between mobile phone 20 and 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 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 to the audio frame announcing a successful connection.
[0069] The Bluetooth application sends a broadcast to the audio frame to establish an A2DP connection with the Bluetooth headset 10.
[0070] In some embodiments, Bluetooth applications can send a broadcast of a successful connection using the Context.sendBroadcast function.
[0071] S107: Audio frame selects the output device.
[0072] The audio frame selects the sound output device as Bluetooth headset 10, which establishes an A2DP connection with mobile phone 20.
[0073] In some embodiments, the sound-emitting device may also be a speaker, earpiece, or audio device connected to the mobile phone 20. This application does not limit the type of 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] To ensure that both voice calls and multimedia services on mobile phone 20 can be played through Bluetooth headset 10, mobile phone 20 needs to establish dual connections with Bluetooth headset 10 via A2DP and HFP. After establishing the A2DP connection between mobile phone 20 and Bluetooth headset 10, mobile phone 20 will complete HFP registration after a period of time. Once mobile phone 20 has completed HFP registration, the audio manager application sends a message to the Bluetooth application to establish an HFP connection with 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 to the phone application announcing a successful connection.
[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, Bluetooth applications can send a broadcast of a successful connection using the Context.sendBroadcast function.
[0080] S110: The phone application sends a message to the audio framework to select the output device.
[0081] After receiving a broadcast that establishes an HFP connection with Bluetooth headset 10, the phone application sends a message to the audio frame to select the sound output device.
[0082] S111: Audio frame selects the output device.
[0083] As mentioned earlier, since the call service is audio data transmitted via HFP on the SCO link, it has the characteristic of real-time audio transmission. In order to ensure call quality, the audio framework selects the sound output device as the Bluetooth headset 10 that establishes an HFP connection with the mobile phone 20.
[0084] When the phone 20 switches from playing the ringtone on the Bluetooth headset 10 via A2DP to playing the ringtone on the Bluetooth headset 10 via HFP, the phone 20 will pause the audio data transmission of the ringtone, which will cause the ringtone of the phone 20 to stutter.
[0085] The following is combined Figure 4 The software architecture of the phone 20 is described, along with the specific interaction process within the phone 20 when a call comes in. Figure 4 A schematic diagram of the interaction process in a mobile phone 20 is shown, such as... Figure 4 The interaction process includes the following steps:
[0086] S201: The Bluetooth application sends a broadcast to the audio manager application indicating that Bluetooth is turned on.
[0087] When Bluetooth is turned on on the phone 20, the Bluetooth app sends a broadcast to the audio manager app announcing that Bluetooth is on.
[0088] S202: Register HFP and A2DP for the Audio Manager application.
[0089] During the initialization phase of the phone 20, such as when the phone 20 is powered on, when the user manually opens the Bluetooth application, or when the phone 20 detects a previously paired but not connected Bluetooth headset 10, 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 of the audio manager application registering HFP and A2DP.
[0091] In some embodiments, the implementation logic of the registration service may include the getProfileProxy function, which registers HFP by executing the getProfileProxy(context, mBluetoothListener, BluetoothProfile.HEADSET) function and registers A2DP by executing the getProfileProxy(context, mBluetoothListener, BluetoothProfile.A2DP) function.
[0092] As mentioned earlier, HFP features real-time audio transmission and is used for call services, such as real-time voice communication. A2DP features non-real-time audio transmission and is used for multimedia services, such as music playback.
[0093] The process of registering HFP and A2DP in the audio manager application is a parallel process, meaning that the audio manager application will register HFP and A2DP at the same time.
[0094] S203: The phone application sends a ringtone audio stream to the audio frame.
[0095] When a call comes in on the phone, the phone app sends a ringtone audio stream to the audio frame.
[0096] In some embodiments, the ringtone audio stream sent by the telephone application is of type stream_ring function, and this application does not limit the type of ringtone audio stream.
[0097] S204: The phone app sends an incoming call broadcast to the audio manager app.
[0098] When a call comes in at 20, the phone app sends a call broadcast to the audio manager app.
[0099] In some embodiments, step S203 may also occur after step S204, i.e., 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 frame. This application embodiment 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 caller's phone number, caller's carrier 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, based on the characteristic that the audio data of the call service is suitable for transmission via 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 establish an HFP connection with the Bluetooth headset 10 by calling the ConnectHfp function in the onServiceConnected function.
[0103] In some embodiments, the logic for establishing an HFP connection with the Bluetooth headset 10 may include, after the mobile phone 20 successfully registers the HFP, entering the onServiceConnected function 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 to the phone application announcing a successful connection.
[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, Bluetooth applications can send a broadcast of a successful connection using the Context.sendBroadcast function.
[0107] S207: The phone application sends a message to the audio frame to cut off the sound device.
[0108] After receiving the message that an HFP connection has been established with the Bluetooth headset 10, the phone application sends a message to the audio frame to cut off the sound device.
[0109] S208: Audio frame selects the output device.
[0110] The audio frame selects the sound output device as Bluetooth headset 10, which establishes an HFP connection with mobile phone 20.
[0111] In some embodiments, the sound-emitting device may also be a speaker, earpiece, or audio device connected to the mobile phone 20. This application does not limit the type of 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] To ensure that both voice calls and multimedia services on mobile phone 20 can be played through Bluetooth headset 10, mobile phone 20 needs to establish dual connections with Bluetooth headset 10 via A2DP and HFP. After establishing an HFP connection between mobile phone 20 and Bluetooth headset 10, the audio manager application sends a message to the Bluetooth application to establish an A2DP connection with Bluetooth headset 10.
[0114] In this 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 and the Bluetooth headset 10 can establish an A2DP connection.
[0115] In some embodiments, the logic for 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 using the connectA2dp(bluetoothDevice) function to enable the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0116] S210: The Bluetooth application sends a broadcast to the audio frame announcing a successful connection.
[0117] The Bluetooth application sends a broadcast to the audio frame to establish an A2DP connection with the Bluetooth headset 10.
[0118] In some embodiments, Bluetooth applications can send a broadcast of a successful connection using the Context.sendBroadcast function.
[0119] S211: The audio frame no longer reselects the output device.
[0120] Since the audio data for the call service is transmitted via HFP on the SCO link, and has the characteristic of real-time audio transmission, in order to ensure call quality, the audio framework selects the Bluetooth headset 10, which establishes an HFP connection with the mobile phone 20, as the sound output device, and does not reselect the sound output device.
[0121] In this application, if the mobile phone 20 and the Bluetooth headset 10 are in a paired but not connected state, the mobile phone 20 completes the registration of HFP and A2DP during initialization. If the mobile phone 20 receives an incoming call, based on the characteristic that the audio data of the call service is suitable for transmission via HFP, the mobile phone 20 chooses to first establish an HFP connection with the Bluetooth headset 10, 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; then, it establishes an A2DP connection with the Bluetooth headset 10 by executing the ConnectA2dp function in the onServiceConnected function. In this way, the ringtone of the mobile phone 20 will be played in the Bluetooth headset 10 via HFP. This avoids the phenomenon of ringtone stuttering when switching from playing the ringtone of the mobile phone 20 via A2DP to playing it via HFP in the Bluetooth headset 10, thus improving the user's call experience.
[0122] The following is combined Figure 5 This section introduces the hardware structure of the mobile phone 20. For example, Figure 5 A schematic diagram of the hardware structure of a mobile phone 20 is shown. 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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 structures illustrated in the embodiments of this application do not constitute a specific limitation on the mobile phone 20. In other embodiments of this application, the mobile phone 20 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0124] The processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may serve as the central nervous system and command center of the mobile phone 20. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. For example, in some embodiments of this application, the processor 110 may execute the communication methods mentioned in this application.
[0125] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The processor 110 can execute the communication methods mentioned in this application based on instructions and data.
[0126] The charging management module 140 receives charging input from the charger. The power management module 141 connects to the battery 142, and the charging management module 140 connects to the processor 110. The wireless communication function of the mobile phone 20 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. The mobile communication module 150 can provide wireless communication solutions for mobile phone 20, including 2G / 3G / 4G / 5G. The wireless communication module 160 can provide wireless communication solutions for mobile phone 20, 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 (NFC), and infrared (IR) technologies. For example, in this embodiment, Bluetooth can be used to establish a Bluetooth connection with Bluetooth headset 10.
[0127] The mobile phone 20 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0128] The display screen 194 is used to display images, videos, etc. The mobile phone 20 can realize shooting functions through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0129] The mobile phone 20 can perform audio functions, such as music playback and recording, through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0130] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110. For example, in some embodiments of this application, the ringtone of the mobile phone 20 can be converted from digital audio information into analog audio signals for output by the audio module 170.
[0131] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The mobile phone 20 can listen to music or make hands-free calls through the speaker 170A. For example, in this embodiment, the speaker 170A of the mobile phone 20 can be used as a sound-generating device for incoming call ringtones.
[0132] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the mobile phone 20 receives a call or voice message, the receiver 170B can be brought close to the user's ear to listen to the voice.
[0133] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Mobile phone 20 may have at least one microphone 170C. In some embodiments, mobile phone 20 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, mobile phone 20 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0134] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0135] The above describes the possible hardware structure of mobile phone 20. It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on mobile phone 20. In other embodiments of this application, mobile phone 20 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0136] This application provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement the communication method provided in this application.
[0137] This application provides an electronic device, including: 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 in this application.
[0138] In the accompanying drawings, some structural or methodological 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 necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0139] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0140] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0141] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.
Claims
1. A communication method applied to a first electronic device, characterized in that: Corresponding to the first electronic device meeting 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 the first call; In response to the first call, the first electronic device establishes a Telephone Service Protocol (HFP) connection with the Bluetooth headset. The first electronic device sends audio data corresponding to the incoming call ringtone to the Bluetooth headset through the HFP connection. Before receiving the first call, the first electronic device and the Bluetooth headset have already been paired and no Bluetooth connection has been established. After the first electronic device establishes a 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. 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 condition corresponding to the first electronic device satisfying the first condition, and the first electronic device registering the Telephone Service Protocol (HFP) and the Bluetooth Audio Transmission Model Protocol (A2DP), includes: In response to a user action, the first electronic device initiates the Bluetooth service; After activating the Bluetooth service, the first electronic device registers the Telephone Service Protocol (HFP) and the Bluetooth Audio Transmission Model 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 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 ringtone to the Bluetooth headset via the Telephony Service Protocol (HFP) connection, including: The telephone application in the first electronic device receives the message that the Telephone Service Protocol (HFP) has been successfully established and sends a command to the audio frame to cut out the audio device. The audio framework selects the sound-emitting device as the Bluetooth headset that has established a Telephone Service Protocol (HFP) connection with the first electronic device, and sends audio data corresponding to the incoming call ringtone 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 a 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 includes a Bluetooth headset, a first electronic device, and a second electronic device. The first electronic device is paired with the Bluetooth headset but has not established a Bluetooth connection, while the second electronic device is paired with the Bluetooth headset and has established a Bluetooth connection. Corresponding to the first electronic device meeting 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 the first call; The first electronic device responds to the first call and establishes a Telephone Service Protocol (HFP) connection with the Bluetooth headset. The first electronic device sends audio data corresponding to the incoming call ringtone to the Bluetooth headset through the HFP connection. The Bluetooth headset plays audio data sent by the first electronic device; After the first electronic device establishes a 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. 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, In response to the user's operation, the first electronic device starts the Bluetooth service; After activating the Bluetooth service, the first electronic device registers the Telephone Service Protocol (HFP) and the Bluetooth Audio Transmission Model 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 from the Bluetooth connection with the second electronic device.
10. An electronic device, characterized in that, include: Memory is used to store instructions executed by one or more processors of an electronic device; And a processor for executing instructions stored in the memory to implement the communication method of any one of claims 1 to 5.
Citation Information
Patent Citations
Information processing apparatus and mobile communication apparatus
US20100069007A1
Call control method and apparatus, and electronic device and computer-readable storage medium
WO2023045784A1