Communication method, storage medium, and electronic device
By completing the registration of HFP and A2DP in advance, and establishing an HFP connection first and then establishing an A2DP connection when receiving an incoming call, the problem of lag during the ringtone switching of the mobile phone is solved and the call experience is improved.
Patent Information
- Application Number
- PCT/CN2023/138227
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-15
- Filing Date
- 2023-12-12
- Publication Date
- 2025-02-20
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 phenomenon of stuttering when switching from A2DP to HFP on the phone, and improves the user's call experience.
Smart Images

Figure CN2023138227_20022025_PF_FP_ABST
Abstract
Description
Communication method, storage medium and electronic device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 15, 2023, with application number 202311026635.4 and application name “A communication method, storage medium and electronic device”. The entire contents of the above application are incorporated by reference into this application. 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 Advanced Audio Distribution Profile (A2DP) and the Hands-Free Profile (HFP) are two protocols used to transmit audio services within a first electronic device (hereinafter, a mobile phone is used as an example). A2DP and HFP allow a mobile phone to transmit audio data via Bluetooth to a second Bluetooth-enabled electronic device (hereinafter, a Bluetooth headset is used as an example). A2DP, however, features non-real-time audio transmission and is used for multimedia services such as music playback. HFP, on the other hand, features real-time audio transmission and is used for call services such as real-time voice.
[0004] Bluetooth physical links are divided into synchronous connection-oriented (SCO) and asynchronous connection-less (ACL) links. SCO links are used to transmit data with high real-time requirements, such as audio data for phone calls. ACL links are used to transmit data that does not require real-time performance, such as audio data for music applications. Therefore, to ensure call quality, mobile phone calls require audio data to be transmitted over SCO links using HFP.
[0005] However, in some cases, such as when the Bluetooth function is turned on on a mobile phone and the phone is paired with but not connected to a Bluetooth headset, if the phone receives an incoming call, the phone will play the ringtone through the Bluetooth headset according to the Bluetooth protocol, and thus the phone will establish a connection with the Bluetooth headset. When the phone establishes a connection with the Bluetooth headset, if the getProfileProxy function is used to register the Bluetooth transmission-related HFP and A2DP protocols, the phone will first transmit the ringtone through A2DP and then switch to HFP because the registration process of A2DP is faster than that of HFP. During this switching process, the phone will suspend the audio data transmission of the ringtone, causing the phone's ringtone to be stuck.
[0006] Summary of the Invention
[0007] 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.
[0008] In a first aspect, the present application provides a communication method, including: 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 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 and 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.
[0009] 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.
[0010] This way, the phone completes HFP and A2DP registrations in advance. When a call comes in, the phone first chooses to establish an HFP connection with the Bluetooth headset based on the call service type. The ringtone will be played on the Bluetooth headset via HFP. Afterwards, the phone establishes an A2DP connection with the Bluetooth headset, and the ringtone is no longer played via A2DP. This avoids the ringtone lag caused by the switch from playing the Bluetooth headset via A2DP to playing it via HFP, thus improving the user's call experience.
[0011] 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.
[0012] 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 Bluetooth paired is detected.
[0013] In a possible implementation of the first aspect above, 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 second electronic device, and the Bluetooth application establishes the telephone service protocol HFP connection.
[0014] 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 establishes a telephone service protocol HFP connection with the first electronic device, and transmits audio data to the second electronic device.
[0015] 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 a mobile phone. This application does not limit the type of the sound-emitting device.
[0016] 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.
[0017] It is understood that in order to ensure that both calls and multimedia services in the mobile phone can be played through the Bluetooth headset, the mobile phone needs to establish a dual connection with the Bluetooth headset using 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.
[0018] 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 device.
[0019] It is understandable 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 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 selects a new sound device.
[0020] 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.
[0021] It can be understood that the first preset function includes the getProfileProxy function.
[0022] In a possible implementation of the first aspect, the Bluetooth application establishes the HFP connection, including the Bluetooth application establishing the HFP connection with the second electronic device by calling a second preset function.
[0023] It can be understood that the second preset function includes the ConnectHfp function in the onServiceConnected function.
[0024] 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.
[0025] It can be understood that the third preset function includes the ConnectA2dp function in the onServiceConnected function.
[0026] 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.
[0027] 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
[0028] 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;
[0029] FIG1( b ) shows another schematic diagram of a scenario in which a mobile phone 20 receives an incoming call according to some embodiments of the present application;
[0030] FIG2 shows a schematic diagram of a software architecture of a mobile phone 20 according to some embodiments of the present application;
[0031] FIG3 shows a schematic diagram of interaction of a mobile phone 20 according to some embodiments of the present application;
[0032] FIG4 shows a schematic diagram of interaction of a mobile phone 20 according to some embodiments of the present application;
[0033] FIG5 shows a schematic diagram of the hardware structure of a mobile phone 20 according to some embodiments of the present application. DETAILED DESCRIPTION
[0034] The illustrative embodiments of the present application include, but are not limited to, a communication method, a storage medium, and an electronic device.
[0035] 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 (UMPCs), and personal digital assistants (PDAs). For the sake of convenience of description, this application takes the first electronic device as a mobile phone 20 as an example.
[0036] The second electronic device mentioned in this application can be any electronic device with Bluetooth functionality and audio data playback functionality, including but not limited to wireless headphones, wireless speakers, wireless bracelets, wireless car-mounted devices, 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.
[0037] The technical solutions of some embodiments of the present application are described below with reference to the accompanying drawings.
[0038] Figure 1(a) shows a schematic diagram of a scenario in which a mobile phone 20 receives an incoming call. As shown in Figure 1(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 preempt the Bluetooth headset 10, that is, the mobile phone 20 will connect to the Bluetooth headset 10.
[0039] Figure 1(b) illustrates another scenario involving an incoming call from 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, that is, the Bluetooth headset 10 and mobile phone 20 have established a trusted relationship through authentication, but the user manually disconnects the Bluetooth headset 10 from the phone 20. This means that the audio output from mobile phone 20 can be played through the phone's speakers but not through Bluetooth headset 10. At this point, if mobile phone 20 receives an incoming call, it will connect to Bluetooth headset 10 according to the Bluetooth protocol.
[0040] As previously mentioned, when mobile phone 20 receives an incoming call message, in order for the incoming call tone to be played through the Bluetooth headset 10, mobile phone 20 needs to establish HFP and A2DP connections. During this connection establishment process, the incoming call tone may experience lag. Specifically, after receiving the incoming call message, mobile phone 20 first registers the protocols used to transmit audio services, including HFP (the protocol for voice calls) and A2DP (the protocol for multimedia services). It then establishes both A2DP and HFP connections between mobile phone 20 and Bluetooth headset 10. Once the A2DP and HFP connections are established, mobile phone 20 can transmit audio data via Bluetooth, i.e., play the incoming call tone through Bluetooth headset 10. The HFP and A2DP registration processes are parallel, meaning that mobile phone 20 registers both HFP and A2DP simultaneously. However, if mobile phone 20 executes the getProfileProxy function, A2DP registration is faster, meaning that it completes A2DP registration first. Since the process of establishing HFP and A2DP connections 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.
[0041] To ensure that both call services and multimedia services on mobile phone 20 can be played through the Bluetooth headset 10, after receiving an incoming call message, mobile phone 20 needs to establish a dual connection with the Bluetooth headset 10 using both A2DP and HFP. After establishing the A2DP connection with the Bluetooth headset 10, it will take some time for mobile phone 20 to complete HFP registration. Only after completing HFP registration can mobile phone 20 establish an HFP connection with the Bluetooth headset 10. For example, mobile phone 20 can establish an HFP connection with the Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function. Call services are audio data transmitted via HFP over an SCO link, which features real-time audio transmission. After establishing an HFP connection with the Bluetooth headset 10, mobile phone 20 will prioritize playing the incoming call ringtone on the Bluetooth headset 10 via HFP. That is, mobile phone 20 will switch from playing the incoming call ringtone on the Bluetooth headset 10 via A2DP to playing the incoming call ringtone on the Bluetooth headset 10 via HFP. In the process of switching the incoming call ring tone on the mobile phone 20, since the mobile phone 20 will suspend the audio stream of the incoming call ring tone, the incoming call ring tone of the mobile phone 20 will be stuck.
[0042] In order to solve the above problems, the present application provides a method for solving the problem of jammed ringtones for incoming calls. Specifically, the mobile phone can be controlled to complete the registration of HFP and A2DP in advance. For example, when the mobile phone 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, the registration of HFP and A2DP is completed through the getProfileProxy function. 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. This avoids the phenomenon of jammed ringtones when the incoming call ringtone of the mobile phone switches from playing on the Bluetooth headset through A2DP to playing on the Bluetooth headset through HFP, thereby improving the user's calling experience.
[0043] The software architecture of the mobile phone 20 mentioned in this application is described below with reference to Figure 2. Figure 2 shows a schematic diagram of the software architecture of the mobile phone 20. As shown in Figure 2, the software architecture of the mobile phone 20 comprises, from top to bottom, an application layer 101, a framework layer 102, an Android library 103, and a driver layer 104.
[0044] The application layer 101 may include applications such as the main interface, phone, Bluetooth, and audio manager. 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 is used to send an audio stream of the incoming ringtone in the mobile phone 20 to the framework layer 102. The audio manager application is used to register A2DP and HFP, and is used 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 is used to send a broadcast of a successful connection to the framework layer 102.
[0045] 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.), voice recognition capability (which may include microphone voice recognition capability, voice recognition capability, etc.), security capabilities 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.
[0046] Among them, the phone framework is used to provide communication functions for the mobile phone 20. For example, the management of call status (including answering, 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 service; 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.
[0047] The Android library 103 includes a surface manager, a media library, a 3D graphics processing library, an Android runtime, and the like.
[0048] The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of various common audio and video formats, as well as static image files. The media library supports a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. A 3D graphics processing library (e.g., OpenGL ES) implements 3D graphics drawing, image rendering, compositing, and layer processing. The Android Runtime consists of a core library and a virtual machine. The Android Runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one for Java language functions and the other for 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 in the application layer 101 and the framework layer 102 as binary files. The virtual machine is responsible for object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0049] The driver layer 104 can provide the mobile phone 20 with unified peripheral access capabilities and a management framework, including display drivers, Bluetooth drivers, audio drivers, etc.
[0050] It can be understood that the software architecture of the mobile phone 20 shown in Figure 2 is only an example. In other embodiments, the software architecture applicable to the embodiments of the present application may include more or less, or parts may be split or merged, or other architectures may be adopted, which are not limited here.
[0051] The following describes the specific process of interaction in the mobile phone 20 when a call comes in, in conjunction with FIG3 and the software architecture of the mobile phone 20. FIG3 shows a schematic diagram of a process of interaction in the mobile phone 20. As shown in FIG3, the interaction process includes the following steps:
[0052] S101: The Bluetooth application sends a Bluetooth open broadcast to the audio manager application.
[0053] 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.
[0054] S102: The phone application sends a ringtone audio stream to the audio framework.
[0055] When a call comes in to the mobile phone 20, the phone application sends a ringtone audio stream to the audio framework.
[0056] In some embodiments, the ringtone audio stream sent by the phone application is of the type of the stream_ring function. This application does not impose any restrictions on the type of the ringtone audio stream.
[0057] S103: The phone application sends an incoming call broadcast to the audio manager application.
[0058] When a call comes in to the mobile phone 20 , the phone application sends an incoming call broadcast to the audio manager application.
[0059] 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.
[0060] In some embodiments, the incoming call broadcast may include the incoming call phone number, the incoming call operator information, etc.
[0061] S104: The audio manager application registers HFP and A2DP.
[0062] After receiving the incoming call broadcast from the mobile phone 20, the audio manager application registers HFP and A2DP.
[0063] 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.
[0064] 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.
[0065] As mentioned above, HFP has the feature of real-time audio transmission and is used to implement call services, such as real-time voice, etc. A2DP has the feature of non-real-time audio transmission and is used to implement multimedia services, such as playing music, etc.
[0066] S105: The audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0067] As mentioned above, since the process of establishing HFP and A2DP connections 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.
[0068] 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.
[0069] S106: The Bluetooth application sends a broadcast indicating successful connection to the audio framework.
[0070] The Bluetooth application sends a broadcast to the audio framework to establish an A2DP connection with the Bluetooth headset 10.
[0071] In some embodiments, the Bluetooth application may send a broadcast of a successful connection through the Context.sendBroadcast function.
[0072] S107: The audio framework selects a sound output device.
[0073] The audio framework selects the sound device as the Bluetooth headset 10 that establishes an A2DP connection with the mobile phone 20.
[0074] In some embodiments, the sound-emitting device may also be a speaker or receiver of the mobile phone 20, or an audio device connected to the mobile phone 20. This application does not limit the type of the sound-emitting device.
[0075] S108 : The audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10 .
[0076] To ensure that both call services and multimedia services 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 and the Bluetooth headset 10 establish an A2DP connection, it will take some time for the mobile phone 20 to complete the HFP registration. After the mobile phone 20 completes the HFP registration, the audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10.
[0077] In some embodiments, the Bluetooth application establishes an HFP connection with the Bluetooth headset 10 by executing the ConnectHfp function in the onServiceConnected function.
[0078] S109: The Bluetooth application sends a broadcast indicating successful connection to the phone application.
[0079] The Bluetooth application sends a broadcast to the phone application to establish an HFP connection with the Bluetooth headset 10 .
[0080] In some embodiments, the Bluetooth application may send a broadcast of a successful connection through the Context.sendBroadcast function.
[0081] S110: The phone application sends a message to the audio framework to select a sound device.
[0082] 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.
[0083] S111: The audio framework selects a sound device.
[0084] 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.
[0085] When the mobile phone 20 switches from playing the incoming call ring tone on the Bluetooth headset 10 via A2DP to playing the incoming call ring tone on the Bluetooth headset 10 via HFP, the mobile phone 20 will suspend the audio data transmission of the incoming call ring tone, causing the incoming call ring tone of the mobile phone 20 to be stuck.
[0086] The following describes the specific process of interaction in the mobile phone 20 when a call comes in, in conjunction with FIG4 and the software architecture of the mobile phone 20. FIG4 shows a schematic diagram of a process of interaction in the mobile phone 20. As shown in FIG4, the interaction process includes the following steps:
[0087] S201: The Bluetooth application sends a broadcast indicating that Bluetooth is turned on to the audio manager application.
[0088] 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.
[0089] S202: The audio manager application registers HFP and A2DP.
[0090] During the initialization phase of the mobile phone 20, such as when the mobile phone 20 is turned on, when the user manually opens the Bluetooth application, or when the mobile phone 20 detects a Bluetooth headset 10 that has been paired but not connected before, the audio manager application registers HFP and A2DP.
[0091] 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.
[0092] 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.
[0093] As mentioned above, HFP has the feature of real-time audio transmission and is used to implement call services, such as real-time voice, etc. A2DP has the feature of non-real-time audio transmission and is used to implement multimedia services, such as playing music, etc.
[0094] The audio manager app registers HFP and A2DP in parallel.
[0095] S203: The phone application sends the ring tone audio stream to the audio framework.
[0096] When a call comes in to the mobile phone 20, the phone application sends a ringtone audio stream to the audio framework.
[0097] In some embodiments, the ringtone audio stream sent by the phone application is of the type of the stream_ring function. This application does not impose any restrictions on the type of the ringtone audio stream.
[0098] S204: The phone application sends an incoming call broadcast to the audio manager application.
[0099] When a call comes in to the mobile phone 20 , the phone application sends an incoming call broadcast to the audio manager application.
[0100] In some embodiments, step S203 may also be performed 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.
[0101] In some embodiments, the incoming call broadcast may include the incoming call phone number, the incoming call operator information, etc.
[0102] S205: The audio manager application sends a message to the Bluetooth application to establish an HFP connection with the Bluetooth headset 10.
[0103] 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 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.
[0104] In some embodiments, the implementation logic for establishing an HFP connection with the Bluetooth headset 10 may include entering the onServiceConnected function after the mobile phone 20 successfully registers HFP, and enabling the Bluetooth application to first establish an HFP connection with the Bluetooth headset 10 through the connectHFP(bluetoothDevice) function.
[0105] S206: The Bluetooth application sends a broadcast indicating a successful connection to the phone application.
[0106] The Bluetooth application sends a broadcast to the phone application to establish an HFP connection with the Bluetooth headset 10 .
[0107] In some embodiments, the Bluetooth application may send a broadcast of a successful connection through the Context.sendBroadcast function.
[0108] S207: The phone application sends a message to the audio framework to switch out of the sound device.
[0109] After receiving the message for establishing the HFP connection with the Bluetooth headset 10 , the phone application sends a message for switching out of the sound device to the audio framework.
[0110] S208: The audio framework selects a sound output device.
[0111] The audio framework selects the sound device as the Bluetooth headset 10 that establishes an HFP connection with the mobile phone 20.
[0112] In some embodiments, the sound-emitting device may also be a speaker or receiver of the mobile phone 20, or an audio device connected to the mobile phone 20. This application does not limit the type of the sound-emitting device.
[0113] S209: The audio manager application sends a message to the Bluetooth application to establish an A2DP connection with the Bluetooth headset 10.
[0114] In order to ensure that both call services and multimedia services 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.
[0115] 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 establishes an A2DP connection with the Bluetooth headset 10.
[0116] In some embodiments, the implementation 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 establishing an A2DP connection between the Bluetooth application and the Bluetooth headset 10 through the connectA2dp(bluetoothDevice) function.
[0117] S210: The Bluetooth application sends a broadcast indicating a successful connection to the audio framework.
[0118] The Bluetooth application sends a broadcast to the audio framework to establish an A2DP connection with the Bluetooth headset 10.
[0119] In some embodiments, the Bluetooth application may send a broadcast of a successful connection through the Context.sendBroadcast function.
[0120] S211: The audio framework no longer reselects the sound device.
[0121] 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 selects the sound device again.
[0122] In this application, if the mobile phone 20 and the Bluetooth headset 10 are paired but not connected, 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 fact 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 first 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 via HFP. This avoids the phenomenon of the incoming ringtone of the mobile phone 20 being stuck when the incoming ringtone is switched from being played in the Bluetooth headset 10 via A2DP to being played in the Bluetooth headset 10 via HFP, thereby improving the user's calling experience.
[0123] The hardware structure of mobile phone 20 is described below with reference to FIG5 . For example, FIG5 shows a schematic diagram of the hardware structure of mobile phone 20. 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 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.
[0124] It should be understood that the structures illustrated in the embodiments of the present application do 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, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0125] The processor 110 may include one or more processing units, for example: the processor 110 may include 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), etc. Among them, different processing units can be independent devices or integrated into 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 based on the instruction opcode and the timing signal to complete the control of instruction fetching and execution. For example, in some embodiments of the present application, the processor 110 can execute the communication method mentioned in the present application.
[0126] 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 this application based on the instructions and data.
[0127] 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 modem processor and the baseband processor. The mobile communication module 150 can provide wireless communication solutions including 2G / 3G / 4G / 5G applied on the mobile phone 20. The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR) and the like 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.
[0128] Mobile phone 20 implements display functionality through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0129] The display screen 194 is used to display images, videos, etc. The mobile phone 20 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0130] The mobile phone 20 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0131] The audio module 170 is used to convert digital audio information into analog audio signals for output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110. For example, in some embodiments of the present application, the incoming call ringtone of the mobile phone 20 can be converted into an analog audio signal by the audio module 170.
[0132] Speaker 170A, also known as a "horn," is used to convert audio electrical signals into sound signals. Mobile phone 20 can listen to music or make hands-free calls through speaker 170A. For example, in this embodiment of the present application, speaker 170A of mobile phone 20 can be used as a sound device for incoming call ringtones.
[0133] The receiver 170B, also called the "earpiece", is used to convert audio electrical signals into sound signals. When the mobile phone 20 receives a call or a voice message, the voice can be heard by placing the receiver 170B close to the ear.
[0134] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the 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 sound signal collection, noise reduction, and identification of sound sources, and realize directional recording function, etc.
[0135] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0136] The above describes the possible hardware structures of the mobile phone 20. It should be 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 shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0137] 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.
[0138] 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.
[0139] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order may not be required. Rather, 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 a structural or method feature in a particular figure does not imply that such feature is required in all embodiments, and in some embodiments, such features may not be included or may be combined with other features.
[0140] 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 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 raised by this application. In addition, in order to highlight the innovative part of this application, the above-mentioned device embodiments of this application do not introduce units / modules that are not closely related to solving the technical problems raised by this application. This does not mean that other units / modules do not exist in the above-mentioned device embodiments.
[0141] It should be noted that in the examples and description of the present application, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a" does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0142] While the present application has been shown 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
Communication method, storage medium and electronic equipment
CN116744244A
Vehicle-mounted communication method and vehicle-mounted equipment
CN114422984A
Audio service processing system, electronic equipment and Bluetooth earphone
CN115002934A
Information processing apparatus and mobile communication apparatus
US20100069007A1
Call method, apparatus, and system
WO2022007848A1