A method and device for arbitrating an audio focus of a vehicle, and an electronic device
By dynamically managing audio focus using hash tables and preset focus arbitration tables, the problem of applications needing to manually restore audio focus in existing technologies is solved, achieving automatic restoration and flexible audio focus management, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-14
- Publication Date
- 2026-03-17
AI Technical Summary
The existing audio focus arbitration strategy is fixed and the storage method is not flexible enough, which means that the application needs to manually click to regain audio focus after losing it, which reduces the user experience.
It employs a hash table storage structure and a preset focus arbitration table to dynamically manage the allocation of audio focus through arbitration relationships, including rejection, mixing, and preemption, and automatically recovers applications that have lost audio focus.
This improves the user experience, allowing the application to regain audio focus without manual intervention, thus enhancing the flexibility and efficiency of audio focus management.
Smart Images

Figure CN114995779B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio focus management technology, and more specifically, to an arbitration method, arbitration device, and electronic device for in-vehicle audio focus. Background Technology
[0002] Audio focus management technology is a technique for handling the relationship between two or more audio files when they are playing simultaneously. For example, in the Android system, multiple music playback applications may play song audio at the same time. In this case, it is necessary to consider how to handle the relationship between these song audio files to prevent multiple music playback applications from playing song audio at the same time. Only the application that has acquired the audio focus can play the song audio.
[0003] Existing audio focus management technologies typically use a stack structure to store focus request and release information for various applications. However, due to the last-in-first-out (LIFO) storage method of the stack, the arbitration strategy for audio focus is usually "the latter preempts the former, and so on," meaning the application whose audio focus is preempted is popped off the stack. Furthermore, this existing audio focus arbitration method has a relatively fixed arbitration strategy and inflexible storage, meaning that in some cases, an application whose audio focus has been preempted can only regain it through manual user interaction, thus degrading the user experience. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide an arbitration method, arbitration device and electronic device for in-vehicle audio focus, which can arbitrate in-vehicle audio focus based on a preset focus arbitration table and using a hash table storage structure, so that in-vehicle applications that have temporarily lost audio focus do not need to be manually clicked by the user to regain audio focus, thereby improving the user experience.
[0005] In a first aspect, embodiments of this application provide an arbitration method for in-vehicle audio focus, the arbitration method comprising:
[0006] Obtain the request for audio focus from the current target vehicle device;
[0007] In response to the usage request, the first application requesting to occupy audio focus is parsed out;
[0008] Identify at least one second application currently occupying audio focus in the target vehicle;
[0009] Using a pre-set focus arbitration table, the arbitration relationship between the first application and each second application is determined respectively; the arbitration relationship includes any one of the following: rejection, mixing, and preemption;
[0010] When the arbitration relationship is rejected, the type of audio focus occupation by the first application is determined. If the occupation type is short-term occupation, the second application is still used to occupy the audio focus. If the occupation type is long-term occupation, a tag indicating that the second application is blocking the first application is added to the first application. The first application with the added tag is temporarily stored in a first hash table for temporarily storing applications waiting to occupy audio focus. It is checked whether all the second applications added to the tags of the temporarily stored first application have released audio focus. After the second applications have released audio focus, the temporarily stored first application is read from the first hash table and used to occupy audio focus.
[0011] When the arbitration relationship is a mix, both the first application and the second application are used to occupy audio focus;
[0012] When the arbitration relationship is preemptive, the first application is used to occupy audio focus.
[0013] Optionally, when the arbitration relationship is a mixing, the arbitration method further includes:
[0014] For each application waiting to occupy audio focus in the first hash table, add a tag indicating that the first application is blocking the application waiting to occupy audio focus. Check whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, read the application waiting to occupy audio focus from the first hash table and use the application waiting to occupy audio focus to occupy audio focus.
[0015] Optionally, when the arbitration relationship is one of preemption, the arbitration method further includes:
[0016] While the first application is occupying audio focus, determine the type of audio focus occupation by the second application;
[0017] When the occupancy type is short-term occupancy, release the audio focus of the second application;
[0018] When the occupancy type is long-term occupancy, add a tag to the second application indicating that the first application is blocking the second application, and temporarily store the tagged second application in the first hash table; detect whether the first application added to the tag of the temporarily stored second application has released audio focus; after the first application releases audio focus, read the temporarily stored second application from the first hash table, and use the temporarily stored second application to occupy audio focus.
[0019] Optionally, after the temporarily stored second application occupies audio focus, the arbitration method further includes:
[0020] The temporarily stored second application is stored in a second hash table used to store the application currently occupying audio focus;
[0021] Detect whether the second application stored has released audio focus;
[0022] After the stored second application releases audio focus, it is checked whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, the applications waiting to occupy audio focus are read from the first hash table and used to occupy audio focus.
[0023] Secondly, embodiments of this application provide an arbitration device for in-vehicle audio focus, the arbitration device comprising:
[0024] The acquisition module is used to acquire the request for audio focus in the current target vehicle device;
[0025] The first application determination module is used to parse out the first application that requests to occupy the audio focus in response to the usage request;
[0026] The second application determination module is used to determine at least one second application currently occupying the audio focus in the target vehicle.
[0027] The arbitration relationship determination module is used to determine the arbitration relationship between the first application and each second application using a pre-set focus arbitration table; the arbitration relationship includes any one of the following: preemption, mixing, and rejection;
[0028] The first audio focus occupancy module is used to determine the occupancy type of the first application when the arbitration relationship is rejected. If the occupancy type is short-term, the second application is still used to occupy the audio focus. If the occupancy type is long-term, a tag is added to the first application indicating that the second application is blocking the first application. The first application with the tag is temporarily stored in a first hash table for temporarily storing applications waiting to occupy audio focus. The module checks whether all the second applications added to the tags of the temporarily stored first applications have released their audio focus. After all the second applications have released their audio focus, the module reads the temporarily stored first application from the first hash table and uses the temporarily stored first application to occupy the audio focus.
[0029] The second audio focus occupancy module is used to simultaneously use the first application and the second application to occupy audio focus when the arbitration relationship is a mixing;
[0030] The third audio focus occupancy module is used to occupy audio focus using the first application when the arbitration relationship is preemptive.
[0031] Optionally, the second audio focus occupancy module is further used for:
[0032] For each application waiting to occupy audio focus in the first hash table, add a tag indicating that the first application is blocking the application waiting to occupy audio focus. Check whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, read the application waiting to occupy audio focus from the first hash table and use the application waiting to occupy audio focus to occupy audio focus.
[0033] Optionally, the third audio focus occupancy module is further configured to:
[0034] While the first application is occupying audio focus, determine the type of audio focus occupation by the second application;
[0035] When the occupancy type is short-term occupancy, release the audio focus of the second application;
[0036] When the occupancy type is long-term occupancy, add a tag to the second application indicating that the first application is blocking the second application, and temporarily store the tagged second application in the first hash table; detect whether the first application added to the tag of the temporarily stored second application has released audio focus; after the first application releases audio focus, read the temporarily stored second application from the first hash table, and use the temporarily stored second application to occupy audio focus.
[0037] Optionally, the third audio focus occupancy module is further configured to:
[0038] While the temporarily stored second application occupies audio focus, the temporarily stored second application is stored in a second hash table used to store the application currently occupying audio focus;
[0039] Detect whether the second application stored has released audio focus;
[0040] After the stored second application releases audio focus, it is checked whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, the applications waiting to occupy audio focus are read from the first hash table and used to occupy audio focus.
[0041] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the arbitration method for vehicle audio focus as described in any of the first aspects.
[0042] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the arbitration method for vehicle audio focus as described in any one of the first aspects.
[0043] The vehicle audio focus arbitration method, arbitration device, and electronic device provided in this application embodiment can arbitrate the vehicle audio focus based on a preset focus arbitration table and using a hash table storage structure. This allows users to regain audio focus without having to manually play audio for some special applications, thereby improving the user experience. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 A flowchart of an arbitration method for in-vehicle audio focus provided in an embodiment of this application is shown;
[0046] Figure 2 This document illustrates a flowchart of an arbitration method for in-vehicle audio focus when the arbitration relationship is a mixing relationship, as provided in an embodiment of this application.
[0047] Figure 3 This document illustrates a flowchart of an arbitration method for in-vehicle audio focus when the arbitration relationship is one of preemption, as provided in an embodiment of this application.
[0048] Figure 4 This illustration shows a structural schematic diagram of an arbitration device for in-vehicle audio focus provided in an embodiment of this application;
[0049] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0051] See Figure 1 As shown, Figure 1 A flowchart illustrating an arbitration method for in-vehicle audio focus provided in an embodiment of this application. Figure 1 As shown in the figure, an arbitration method for vehicle audio focus provided in this application includes the following steps:
[0052] S10. Obtain the request for audio focus from the current target in-vehicle device. For example, the request may be issued by an application on the in-vehicle device. For example, the in-vehicle device may be an in-vehicle MP3 player, an in-vehicle computer, etc. The application may be a music, telephone, navigation, GPS, etc. For example, the music application may be QQ Music.
[0053] Here, audio focus refers to the control of a device application over audio hardware. Only an application that has acquired audio focus can use an audio output device to play audio from that application. For example, when a user needs to play music on a target in-vehicle device, the music application on the target in-vehicle device (e.g., QQ Music) requests audio focus. Only after acquiring audio focus can the music application use an audio output device (e.g., a speaker) to play music from that application.
[0054] S20. In response to the usage request, the first application requesting to occupy audio focus is parsed out. For example, the first application requesting to occupy audio focus can be an application such as music, telephone, navigation, GPS application, voice broadcast system, emergency call, etc.
[0055] S30. Determine at least one second application currently occupying audio focus in the target vehicle.
[0056] It should be noted that before executing the vehicle audio focus arbitration method of this application embodiment, a first hash table and a second hash table need to be established in advance. The second hash table is used to store the application occupying the current audio focus, and the first hash table is used to store the application waiting to occupy the audio focus.
[0057] Here, the application that currently holds audio focus includes one or more applications; that is, the applications stored in the second hash table include one or more applications. Similarly, the application waiting to occupy audio focus includes one or more applications; that is, the applications stored in the first hash table include one or more applications.
[0058] S40. Using a pre-set focus arbitration table, determine the arbitration relationship between the first application and each second application respectively; the first arbitration relationship includes any one of the following: preemption, mixing, and rejection.
[0059] Here, the focus arbitration table pre-sets the arbitration relationship between every two applications. For example, in the focus arbitration table, one of the header rows or header columns represents the second application currently occupying audio focus, and the other represents the first application requesting to occupy audio focus. The information at the intersection of the header rows and header columns represents the arbitration relationship between the two applications.
[0060] For example, the arbitration relationships in the focus arbitration table include rejection, preemption, and mixing relationships. A rejection relationship indicates that the priority of the second application is higher than that of the first application, and therefore the first application is refused to preempt the audio focus. A preemption relationship indicates that the priority of the first application is higher than that of the second application, and therefore the first application can preempt the audio focus of the second application. A mixing relationship indicates that the priority of the first application is equal to that of the second application, and therefore the first application and the second application can share the audio focus.
[0061] For example, the focus arbitration table can be as shown in Table 1:
[0062] Table 1 - Focus Arbitration Table
[0063]
[0064] Please continue reading. Figure 1When the arbitration relationship is rejected, in step S50, the second application is still used to occupy the audio focus, and in step S51, the occupation type of the first application occupying the audio focus is determined. When the occupation type is short-term occupation, in step S52, the second application is still used to occupy the audio focus, and a focus application failure notification is sent to the first application. When the occupation type is long-term occupation, in step S53, a tag is added to the first application indicating that the second application is blocking the first application, and the tagged first application is temporarily stored in a first hash table for temporarily storing applications waiting to occupy the audio focus. After the tagged first application is temporarily stored in the first hash table, in step S54, it is detected whether all the second applications added to the tags of the temporarily stored first application have released the audio focus. After the second applications have all released the audio focus, in step S55, the temporarily stored first application is read from the first hash table, and the temporarily stored first application is used to occupy the audio focus.
[0065] Here, for example, the audio focus occupation type can be parsed from the usage request of each application when requesting audio focus. Specifically, a long-term audio focus occupation type indicates that the corresponding application expects to occupy audio focus for a long time, while a short-term audio focus occupation type indicates that the corresponding application expects to occupy audio focus for a short time. For example, the application corresponding to the long-term audio focus occupation type could be a music application or a navigation application, while the application corresponding to the short-term audio focus occupation type could be a phone application or an emergency call application.
[0066] Here, a second application that blocks the first application from occupying the current audio focus is added to the first application's tag. By adding tags, a relationship can be established between the application currently occupying the audio focus and the application whose audio focus is being blocked.
[0067] Here, releasing audio focus means that the second application that has already occupied the audio focus no longer occupies the audio focus.
[0068] Below, we will use specific examples to illustrate how to determine the application of audio focus when the arbitration relationship is rejected.
[0069] If the first application requesting to occupy audio focus is "Music", and the current application occupying audio focus is "Phone", since the arbitration relationship is a rejection relationship, "Phone" will still occupy audio focus. At the same time, the occupation type of "Music" occupying audio focus is determined. Since the occupation type is "long-term occupation", the tag "Phone" is added to "Music", and "Music" with the tag "Phone" is temporarily stored in the first hash table used to temporarily store applications waiting to occupy audio focus. It is checked whether "Phone" added to the tag of "Music" has released audio focus. After "Phone" releases audio focus, the temporarily stored "Music" is read from the first hash table, and "Music" is used to occupy audio focus. "Music" is then stored in a pre-set second hash table.
[0070] Please also refer to Figure 1 and Figure 2 , Figure 2 A flowchart of an arbitration method for vehicle audio focus when the arbitration relationship is mixing, as provided in an embodiment of this application, is shown.
[0071] like Figure 2 As shown, when the arbitration relationship is mixing, in step S60, the first application and the second application are used simultaneously to occupy audio focus; after the first application and the second application occupy audio focus, in step S61, a tag is added to each application waiting to occupy audio focus in the first hash table, indicating that the first application is blocking the application waiting to occupy audio focus; after adding a tag to each application waiting to occupy audio focus, in step S62, it is detected whether the applications added to the tags of each application waiting to occupy audio focus in the first hash table have all released audio focus; after all the applications added to the tags of the applications waiting to occupy audio focus have released audio focus, in step S63, the application waiting to occupy audio focus is read from the first hash table, and the application waiting to occupy audio focus is used to occupy audio focus, while the application waiting to occupy audio focus is stored in the second hash table.
[0072] Below, we will use specific examples to illustrate how to determine the application that occupies audio focus when the arbitration relationship is a mix.
[0073] Suppose the first application requesting audio focus is "Navigation", the current application holding audio focus is "Phone", and the application waiting to hold audio focus is "Music". Since the arbitration relationship between "Navigation" and "Phone" is a mixed relationship, both "Phone" and "Navigation" are used to hold audio focus simultaneously. After "Navigation" holds audio focus, it is stored in the second hash table. After "Phone" holds audio focus after "Navigation", because "Navigation" has higher priority than "Music", the tag "Navigation" is added to "Music" in the first hash table. At this point, two applications, "Phone" and "Navigation", are added to the "Music" tag. Then, it is checked whether both "Phone" and "Navigation" added to the "Music" tag in the first hash table have released audio focus. After both "Phone" and "Navigation" have released audio focus, "Music" is read from the first hash table, and "Music" is used to hold audio focus and stored in the second hash table.
[0074] Please also refer to Figure 1 and Figure 3 , Figure 3 A flowchart is shown below illustrating an arbitration method for in-vehicle audio focus when the arbitration relationship is preemptive, according to an embodiment of this application.
[0075] like Figure 3As shown, when the arbitration relationship is preemption, in step S70, the first application occupies the audio focus. While the first application occupies the audio focus, in step S71, the occupancy type of the second application is determined; when the occupancy type is short-term, in step S72, the audio focus of the second application is released; when the occupancy type is long-term, in step S73, a tag indicating that the first application is blocking the second application is added to the second application, and the tagged second application is temporarily stored in the first hash table; after temporarily storing the second application in the first hash table, in step S74, it is checked whether the first application added to the tag of the temporarily stored second application has released the audio focus; after the second application releases the audio focus, in step S75, the temporarily stored second application is read from the first hash table, and... The temporary second application occupies the audio focus. While using the temporary second application to occupy the audio focus, the temporary second application is stored in a second hash table used to store the application currently occupying the audio focus. Then, in step S76, it is detected whether the stored second application has released the audio focus. After the stored second application releases the audio focus, in step S77, it is detected whether all the applications added to the tags of the applications waiting to occupy the audio focus in the first hash table have released the audio focus. After all the applications added to the tags of the applications waiting to occupy the audio focus have released the audio focus, in step 78, the applications waiting to occupy the audio focus are read from the first hash table and the applications waiting to occupy the audio focus are used to occupy the audio focus.
[0076] Below, we will use specific examples to illustrate how to determine the application of audio focus occupancy when the arbitration relationship is preemptive.
[0077] If the first application requesting audio focus is "Emergency Call," and the applications currently holding audio focus are "Phone" and "Navigation," with "Music" waiting to acquire audio focus, then due to the preemptive arbitration relationship, "Emergency Call" is used to acquire audio focus. While "Emergency Call" acquires audio focus, the acquisition type of "Phone" and "Navigation" is determined. Since "Phone" has a short-term acquisition type, its audio focus is released, and it is removed from the second hash table. Since "Navigation" has a long-term acquisition type, the tag "Emergency Call" is added to "Navigation," and this application is temporarily stored in the first hash table used to temporarily store applications waiting to acquire audio focus. It is then checked whether "Emergency Call," which is tagged with "Navigation," has released its audio focus. After "Emergency Call" releases its audio focus, the temporarily stored application is read from the first hash table. The system selects "Navigation" and uses it to occupy audio focus. While "Navigation" occupies audio focus, it stores "Navigation" in a second hash table used to store applications currently occupying audio focus. After storing "Navigation" in the second hash table, it checks whether the stored "Navigation" has released audio focus. After "Navigation" releases audio focus, it checks whether all applications added to the "Music" tag in the first hash table have released audio focus. Since the applications added to the "Music" tag are "Navigation" and "Phone", after detecting that both "Navigation" and "Phone" have released audio focus, it reads "Music" from the first hash table, uses "Music" to occupy audio focus, and simultaneously stores "Music" in the second hash table.
[0078] This application provides an audio focus arbitration method that uses a hash table storage structure based on a preset focus arbitration table to arbitrate the audio focus of an in-vehicle application. This allows in-vehicle applications that have temporarily lost audio focus to regain it without requiring manual clicking by the user, thereby improving the user experience.
[0079] It should be noted that the software program for executing the arbitration method for in-vehicle audio focus provided in this application embodiment is located in the CarService.apk file. Each time the software program is debugged or modified, only this file needs to be replaced. This method makes debugging much simpler.
[0080] Based on the same inventive concept, this application also provides an in-vehicle audio arbitration device corresponding to the above-described in-vehicle audio arbitration method.
[0081] See Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of an in-vehicle audio arbitration device according to an embodiment of this application. The in-vehicle audio arbitration device 400 includes:
[0082] The acquisition module 401 is used to acquire the request for audio focus in the current target vehicle device;
[0083] The first application determination module 402 is used to parse out the first application that requests to occupy the audio focus in response to the usage request;
[0084] The second application determination module 403 is used to determine at least one second application currently occupying the audio focus in the target vehicle;
[0085] Arbitration relationship determination module 404 is used to determine the arbitration relationship between the first application and each second application using a pre-set focus arbitration table; the arbitration relationship includes any one of the following: preemption, mixing, and rejection;
[0086] The first audio focus occupancy module 405 is used to determine the occupancy type of the first application occupying audio focus when the arbitration relationship is rejected. When the occupancy type is short-term occupancy, the second application is still used to occupy audio focus. When the occupancy type is long-term occupancy, a tag is added to the first application indicating that the second application is blocking the first application. The first application with the tag is temporarily stored in a first hash table for temporarily storing applications waiting to occupy audio focus. The module checks whether all the second applications added to the tags of the temporarily stored first applications have released audio focus. After all the second applications have released audio focus, the temporarily stored first application is read from the first hash table and the temporarily stored first application is used to occupy audio focus.
[0087] The second audio focus occupancy module 406 is used to simultaneously use the first application and the second application to occupy audio focus when the arbitration relationship is a mixing.
[0088] The third audio focus occupancy module 407 is used to occupy the audio focus using the first application when the arbitration relationship is preemptive.
[0089] In one possible implementation, the second audio focus occupancy module 406 is further configured to:
[0090] For each application waiting to occupy audio focus in the first hash table, add a tag indicating that the first application is blocking the application waiting to occupy audio focus. Check whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, read the application waiting to occupy audio focus from the first hash table and use the application waiting to occupy audio focus to occupy audio focus.
[0091] In one possible implementation, the third audio focus occupancy module 407 is further configured to:
[0092] While the first application is occupying audio focus, determine the type of audio focus occupation by the second application;
[0093] When the occupancy type is short-term occupancy, release the audio focus of the second application;
[0094] When the occupancy type is long-term occupancy, add a tag to the second application indicating that the first application is blocking the second application, and temporarily store the tagged second application in the first hash table; detect whether the first application added to the tag of the temporarily stored second application has released audio focus; after the first application releases audio focus, read the temporarily stored second application from the first hash table, and use the temporarily stored second application to occupy audio focus.
[0095] In one possible implementation, the third audio focus occupancy module 407 is further configured to:
[0096] While the temporarily stored second application occupies audio focus, the temporarily stored second application is stored in a second hash table used to store the application currently occupying audio focus;
[0097] Detect whether the second application stored has released audio focus;
[0098] After the stored second application releases audio focus, it is checked whether all applications added to the tags of each application waiting to occupy audio focus in the first hash table have released audio focus. After all applications added to the tags of the applications waiting to occupy audio focus have released audio focus, the applications waiting to occupy audio focus are read from the first hash table and used to occupy audio focus.
[0099] The vehicle audio focus arbitration device provided in this application embodiment can arbitrate the vehicle audio focus based on a preset focus arbitration table and using a hash table storage structure. This allows vehicle applications that have temporarily lost audio focus to regain it without requiring manual clicking by the user, thereby improving the user experience.
[0100] See Figure 5 As shown, Figure 5This is a schematic diagram of an electronic device provided in an embodiment of this application. The electronic device 500 includes a processor 501, a memory 502, and a bus 503. The memory 502 stores machine-readable instructions executable by the processor 501. When the electronic device is running, the processor 501 communicates with the memory 502 via the bus 503. The processor 501 executes the machine-readable instructions to perform the steps of the arbitration method for vehicle audio focus described above.
[0101] Specifically, the memory 502 and processor 501 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 501 runs the computer program stored in the memory 502, it can execute the arbitration method for the vehicle audio focus mentioned above.
[0102] Corresponding to the above-described arbitration method for vehicle audio focus, this application embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described arbitration method for vehicle audio focus.
[0103] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or modules may be electrical, mechanical, or other forms.
[0104] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0105] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0106] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0107] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of arbitrating an audio focus of a vehicle, the method comprising: The arbitration method comprises: obtaining a use request of an application audio focus in a current target vehicle-mounted device; in response to the use request, resolving a first application requesting to occupy the audio focus; determining at least one second application currently occupying the audio focus in the target vehicle-mounted device; using a pre-set focus arbitration table to determine an arbitration relationship between the first application and each second application, respectively; the arbitration relationship comprises any one of the following: rejection, mixing and preemption; when the arbitration relationship is rejection, the second application still occupies the audio focus, and a type of occupying the audio focus by the first application is judged; when the type is short-time occupying, the second application still occupies the audio focus; when the type is long-time occupying, a label of the second application blocking the first application is added to the first application, and the first application with the added label is temporarily stored in a first hash table for temporarily storing applications waiting to occupy the audio focus; whether the second applications added in the label of the temporarily stored first application have all released the audio focus is detected; after the second applications have all released the audio focus, the temporarily stored first application is read from the first hash table, and the first application is used to occupy the audio focus; when the arbitration relationship is mixing, the first application and the second application are used to occupy the audio focus at the same time; when the arbitration relationship is mixing, the arbitration method further comprises: a label of the first application blocking the application waiting to occupy the audio focus is added to each application in the first hash table, whether the applications added in the label of each application waiting to occupy the audio focus in the first hash table have all released the audio focus is detected, and after the applications added in the label of the application waiting to occupy the audio focus have all released the audio focus, the application waiting to occupy the audio focus is read from the first hash table, and the application is used to occupy the audio focus; when the arbitration relationship is preemption, the first application is used to occupy the audio focus.
2. The arbitration method of claim 1, wherein, when the arbitration relationship is preemption, the arbitration method further comprises: when the first application occupies the audio focus, a type of occupying the audio focus by the second application is judged; when the type is short-time occupying, the audio focus of the second application is released; when the type is long-time occupying, a label of the first application blocking the second application is added to the second application, and the second application with the added label is temporarily stored in the first hash table; whether the first application added in the label of the temporarily stored second application has released the audio focus is detected, and after the first application has released the audio focus, the temporarily stored second application is read from the first hash table, and the second application is used to occupy the audio focus.
3. The arbitration method of claim 2, wherein, the arbitration method further comprises: when the temporarily stored second application occupies the audio focus, the temporarily stored second application is stored in a second hash table for storing applications currently occupying the audio focus; whether the stored second application has released the audio focus is detected; After the second application in the storage releases the audio focus, whether the applications added in the tags of each application waiting to occupy the audio focus in the first hash table are all released from the audio focus is detected respectively, and after the applications added in the tags of the application waiting to occupy the audio focus are all released from the audio focus, the application waiting to occupy the audio focus is read from the first hash table, and the audio focus is occupied by the application waiting to occupy the audio focus.
4. An arbitration device for audio focus in a vehicle, characterized in that The arbitration device comprises: An acquisition module is configured to acquire a use request for applying for an audio focus in a current target vehicle-mounted device; A first application determination module is configured to parse a first application requesting to occupy the audio focus in response to the use request; A second application determination module is configured to determine at least one second application currently occupying the audio focus in the target vehicle-mounted device; An arbitration relationship determination module is configured to determine an arbitration relationship between the first application and each second application by using a pre-set focus arbitration table; the arbitration relationship comprises any one of the following: preemption, mixing, and rejection; A first audio focus occupation module is configured to, when the arbitration relationship is rejection, determine an occupation type of the first application occupying the audio focus, still use the second application to occupy the audio focus when the occupation type is short-time occupation, add a tag of the second application blocking the first application to the first application when the occupation type is long-time occupation, and temporarily store the first application added with the tag in a first hash table for temporarily storing applications waiting to occupy the audio focus, detect whether the second application added in the tag of the temporarily stored first application is all released from the audio focus, read the temporarily stored first application from the first hash table after the second application is all released from the audio focus, and use the temporarily stored first application to occupy the audio focus; A second audio focus occupation module is configured to, when the arbitration relationship is mixing, use the first application and the second application to occupy the audio focus at the same time; The second audio focus occupation module is further configured to: add the tag of the first application blocking the application waiting to occupy the audio focus to each application waiting to occupy the audio focus in the first hash table, detect whether the applications added in the tags of each application waiting to occupy the audio focus in the first hash table are all released from the audio focus respectively, read the application waiting to occupy the audio focus from the first hash table after the applications added in the tags of the application waiting to occupy the audio focus are all released from the audio focus, and use the application waiting to occupy the audio focus to occupy the audio focus; A third audio focus occupation module is configured to, when the arbitration relationship is preemption, use the first application to occupy the audio focus.
5. An arbitration device according to claim 4, characterised in that, The third audio focus occupation module is further configured to: judge an occupation type of the second application occupying the audio focus while the first application occupies the audio focus; release the audio focus of the second application when the occupation type is short-time occupation; add the tag of the first application blocking the second application to the second application when the occupation type is long-time occupation, and temporarily store the second application added with the tag in the first hash table; detecting whether the first application added in the tag of the second application in the temporary storage has released the audio focus, reading the second application in the temporary storage from the first hash table and using the second application in the temporary storage to occupy the audio focus after the first application releases the audio focus.
6. An arbitration device according to claim 5, characterised in that, The third audio focus occupation module is further configured to: store the second application in the temporary storage in a second hash table for storing an application currently occupying the audio focus while the second application in the temporary storage occupies the audio focus; detect whether the second application in the storage has released the audio focus; detect whether the applications added in the tags of each application waiting to occupy the audio focus in the first hash table have all released the audio focus respectively after the second application in the storage releases the audio focus, read the applications waiting to occupy the audio focus from the first hash table and use the applications waiting to occupy the audio focus to occupy the audio focus after the applications added in the tags of the applications waiting to occupy the audio focus have all released the audio focus.
7. An electronic device, comprising: comprise: a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to perform the steps of the arbitration method of the in-vehicle audio focus as claimed in any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the arbitration method of the in-vehicle audio focus as claimed in any one of claims 1 to 3.
Citation Information
Patent Citations
Audio searching method and device, computer equipment and storage medium
CN112784098A
Audio playing method and audio playing device
CN113050911A
Arbitration method and device for vehicle-mounted audio focus
CN113794968A