Audio test method, electronic device, computer program product and chip system
By recording the device identifiers of multiple built-in microphones in the electronic device and setting test flags, an earpiece audio output stream is created, enabling parallel testing of multiple microphones. This solves the problem of long test cycles in existing technologies and improves test efficiency and sensitivity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2026-03-10
AI Technical Summary
In the testing of electronic devices, especially multi-microphone devices, existing technologies often result in excessively long test cycles due to serial testing methods, while audio loopback testing methods cannot achieve parallel testing of multiple microphones, thus hindering further improvement in overall testing efficiency.
By recording the device identifiers of multiple built-in microphones upon receiving a microphone test command, setting the test flag to the enabled state, creating an audio output stream routed to the earpiece, forcibly switching the audio input device to multiple built-in microphones, and creating n or n+1 channel audio input streams, parallel testing of multiple built-in microphones can be achieved.
Parallel testing with multiple microphones was successfully implemented, improving the overall testing efficiency of electronic devices. In particular, it enabled the acquisition of accurate audio input data when headphones were in place, thereby enhancing test sensitivity and signal-to-noise ratio.
Smart Images

Figure CN121645115A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to an audio testing method, electronic device, computer program product, and chip system. Background Technology
[0002] Electronic devices such as mobile phones and tablets undergo a series of rigorous tests before leaving the factory to ensure that their performance indicators meet factory standards. As a key module enabling voice calls, media playback, and voice interaction, the audio system's performance directly affects the reliability and user experience of electronic devices. Therefore, audio testing (AT) is an essential part of the factory testing process for electronic devices.
[0003] Related technologies generally employ serial testing methods to perform audio tests on individual audio components. However, this serial testing method lengthens the testing cycle of electronic devices, resulting in low overall testing efficiency. Furthermore, the shortcomings of this serial testing method are more pronounced in multi-microphone electronic devices. To improve the overall testing efficiency of electronic devices, related technologies provide an audio loop-through testing method. This method, by establishing a loop-through test path, enables simultaneous testing of the speaker (or horn), microphone, and headphone jack in a single test. Compared to the aforementioned serial testing method, the audio loop-through testing method can improve the overall testing efficiency of electronic devices to some extent. However, because this audio loop-through testing method cannot achieve parallel testing of multiple microphones, it cannot further improve the overall testing efficiency of electronic devices. Summary of the Invention
[0004] This application provides an audio testing method, electronic device, computer program product, and chip system that can successfully perform parallel testing of multiple microphones while the headphones are in place, further improving the overall testing efficiency of electronic devices.
[0005] In a first aspect, embodiments of this application provide an audio testing method, comprising: upon receiving a microphone testing instruction, recording device identifiers of a plurality of built-in microphones to be tested, and setting the value of a test flag bit to a first preset value; the first preset value is used to indicate that the factory test mode is enabled; in response to the microphone testing instruction, creating an audio output stream routed to the earpiece; when creating an audio input stream in response to the microphone testing instruction, if it is detected that the headphone jack is currently in a headphone-in-place state and the value of the test flag bit is the first preset value, then according to the pre-recorded device identifiers, configuring the plurality of built-in microphones as the current audio input device, and creating an audio input stream containing n channels or n+1 channels; n being the number of the plurality of built-in microphones; turning on the earpiece and playing target audio output data through the earpiece; turning on the plurality of built-in microphones and acquiring audio input data collected by each of the plurality of built-in microphones in parallel through the n channels or n+1 channels; and analyzing the performance of the plurality of built-in microphones based on the target audio output data and the audio input data.
[0006] Optionally, the test control equipment may be a system or device for controlling electronic equipment to perform automated test processes.
[0007] Optionally, the microphone test command can be used to instruct electronic devices to perform automatic tests on their built-in microphones.
[0008] For example, a microphone test instruction can be a microphone airtightness test instruction. A microphone airtightness test instruction can be used to instruct an electronic device to perform an airtightness test on its built-in microphone.
[0009] For example, a microphone test command can be a microphone frequency response test command. A microphone frequency response test command can be used to instruct the frequency response of an electronic device's built-in microphone to be tested.
[0010] Optionally, after receiving a microphone test command, the electronic device can identify all its built-in microphones as the built-in microphones to be tested and record the device identifiers of all built-in microphones.
[0011] For example, the device identifier may include a device number and a device name, etc.
[0012] The value of the test flag can be used to indicate the on / off state of the factory test mode of the electronic device. Optionally, when the value of the test flag is a first preset value, it can be used to indicate that the factory test mode is on; when the value of the test flag is a second preset value, it can be used to indicate that the factory test mode is off. For example, the first preset value can be on, and the second preset value can be off. As another example, the first preset value can be 1, and the second preset value can be 0.
[0013] Optionally, when n is even, the electronic device can create an audio input stream containing n channels. Optionally, when n is odd, the electronic device can create an audio input stream containing n+1 channels.
[0014] The audio testing method provided in this application, upon receiving a microphone test command, records the device representation of the multiple built-in microphones to be tested and sets the value of the test flag to a first preset value indicating that the factory test mode is enabled, thereby providing a correct reference for the subsequent creation of the audio input stream; by creating an audio output stream routed to the earpiece, the audio output device can be switched to the earpiece, facilitating the subsequent playback of the target audio output data through the earpiece; when creating the audio input stream, even if the headphone jack is in the headphone-on state, it first determines whether the value of the test flag is the first preset value, and if the value of the test flag is the first preset value, it forces the audio input device to be switched to the multiple built-in microphones to be tested, and creates an audio input stream including n channels or n+1 channels, ensuring that the number of channels in the audio input stream is equal to or greater than the number of multiple built-in microphones; by enabling multiple microphones and acquiring the audio input data collected by each of the multiple built-in microphones in parallel through the n channels or n+1 channels in the audio input stream, it ensures that the acquired audio input data is correct, thereby successfully achieving parallel testing of multiple built-in microphones and further improving the overall testing efficiency of electronic devices.
[0015] In one optional implementation of the first aspect, recording the device identifiers of the multiple built-in microphones to be tested and setting the value of the test flag bit to a first preset value includes: when the application layer receives a microphone test instruction from the test control device, it sends a multi-microphone self-test request to the hardware abstraction layer; the multi-microphone self-test request carries the device identifiers of the multiple built-in microphones to be tested; the hardware abstraction layer responds to the multi-microphone self-test request, records the device identifiers of the multiple built-in microphones to be tested, and updates the value of the test flag bit to the first preset value.
[0016] For example, a multi-microphone self-test request may carry device identifiers for multiple built-in microphones to be tested.
[0017] In one optional implementation of the first aspect, when creating an audio input stream in response to the microphone test command, if it is detected that the headphone jack is currently in a headphone-in-place state and the value of the test flag is the first preset value, then according to the pre-recorded device identifier, the plurality of built-in microphones are configured as the current audio input device, and an audio input stream containing n channels or n+1 channels is created, including: the application layer sending a microphone self-test result acquisition request to the framework layer; the framework layer, in response to the microphone self-test result acquisition request, sending an audio input stream creation request to the hardware abstraction layer when it is detected that the headphone jack is currently in a headphone-in-place state; the audio input stream creation request is used to indicate that the headphone microphone is used as the current audio input device, and an audio input stream is created for the headphone microphone; after receiving the audio input stream creation request, the hardware abstraction layer acquires the pre-recorded value of the test flag, and when it is detected that the value of the test flag is the first preset value, according to the pre-recorded device identifier of the plurality of built-in microphones, configures the plurality of built-in microphones as the current audio input device, and creates an audio input stream containing n channels or n+1 channels.
[0018] In one optional implementation of the first aspect, after receiving the audio input stream creation request, the hardware abstraction layer obtains the value of the pre-recorded test flag bit, and when it detects that the value of the test flag bit is the first preset value, configures the multiple built-in microphones as the current audio input device according to the pre-recorded device identifiers of the multiple built-in microphones, and creates an audio input stream containing n channels or n+1 channels, including: after receiving the audio input stream creation request, the audio hardware interface of the hardware abstraction layer transmits the audio input stream creation request to the audio customization module of the hardware abstraction layer; the audio customization module controls the audio device configuration module of the hardware abstraction layer to configure the multiple built-in microphones as the current audio input device according to the pre-recorded device identifiers of the multiple built-in microphones; the audio customization module creates an audio input stream containing n channels or n+1 channels.
[0019] In one alternative implementation of the first aspect, in response to the microphone test command, creating an audio output stream routed to the earpiece includes: the application layer sending an audio output stream creation request to the framework layer in response to the microphone test command; the framework layer passing the audio output stream creation request to the hardware abstraction layer; and the hardware abstraction layer creating an audio output routed to the earpiece in response to the audio output stream creation request.
[0020] The audio testing method provided in this application can force the audio output device of an electronic device to be switched to the earpiece by creating an audio output stream routed to the earpiece; and can provide a stable sound source for testing the built-in microphone by playing the target audio output data through the earpiece.
[0021] In one optional implementation of the first aspect, the microphone test command is a microphone airtightness test command; correspondingly, acquiring the audio input data collected by each of the plurality of built-in microphones in parallel through the n channels or n+1 channels includes: acquiring the audio input data collected by each of the plurality of built-in microphones in a blocked state through the n channels or n+1 channels in parallel; correspondingly, analyzing the performance of the plurality of built-in microphones based on the target audio output data and the audio input data includes: for each built-in microphone, calculating the leakage value of the built-in microphone based on the target audio output data and the audio input data collected by the built-in microphone in a blocked state, and evaluating the airtightness of the built-in microphone based on the leakage value of the built-in microphone.
[0022] The audio testing method provided in this application embodiment can block the holes of each built-in microphone by using a test control device, so that each built-in microphone is in a blocked state. By acquiring the audio input data collected by each of the multiple built-in microphones in the blocked state, parallel airtightness testing of multiple built-in microphones can be achieved based on the audio input data and the target audio output data, thereby improving the airtightness testing efficiency of electronic devices.
[0023] In an alternative implementation of the first aspect, the method further includes adjusting the volume of the earpiece to its maximum volume before playing the target audio output data through the earpiece.
[0024] The audio testing method provided in this application creates a strong sound pressure environment inside the electronic device by adjusting the volume of the earpiece to the maximum volume. This allows the built-in microphone to capture audio signals that leak through very small gaps, thereby improving the sensitivity and signal-to-noise ratio of microphone airtightness detection.
[0025] Secondly, embodiments of this application provide an electronic device, including: one or more processors, and a memory;
[0026] The memory is coupled to one or more processors, and the memory is used to store computer program code, which includes computer instructions. One or more processors call the computer instructions to cause the electronic device to perform an audio testing method as described in any of the implementations of the first aspect above.
[0027] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform an audio testing method as described in any of the implementations of the first aspect above.
[0028] Fourthly, embodiments of this application provide a computer program product, including a computer program, which, when run, causes an audio testing method as described in any implementation of the first aspect above to be executed.
[0029] Fifthly, embodiments of this application provide a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform an audio testing method as described in any of the implementations of the first aspect above.
[0030] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0031] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0032] Figure 2 A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;
[0033] Figure 3 A schematic flowchart illustrating an audio testing method provided in an embodiment of this application;
[0034] Figure 4 A schematic flowchart illustrating an audio testing method provided in another embodiment of this application;
[0035] Figure 5 This application provides a schematic diagram illustrating the interaction between various software layers during the implementation of an audio testing method.
[0036] Figure 6 A schematic diagram illustrating the interaction process between various software layers during the implementation of an existing audio testing method.
[0037] Figure 7 A schematic flowchart illustrating the underlying implementation logic of an audio testing method provided in this application embodiment;
[0038] Figure 8 This is a schematic flowchart illustrating an audio testing method provided in another embodiment of this application. Detailed Implementation
[0039] It should be noted that the terminology used in the implementation section of the embodiments of this application is only used to explain the specific embodiments of this application and is not intended to limit this application. In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related items, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, "at least one" or "one or more" means one, two or more.
[0040] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0041] References to "one embodiment" or "some embodiments" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0042] Electronic devices such as mobile phones and tablets undergo a series of rigorous tests before leaving the factory to ensure that their performance indicators meet factory standards. As a key module enabling voice calls, media playback, and voice interaction, the audio system's performance directly affects the reliability and user experience of electronic devices. Therefore, audio testing (AT) is an essential part of the factory testing process for electronic devices.
[0043] Audio testing is mainly used to check whether the performance indicators (such as frequency response and airtightness) of various audio components (such as microphones, speakers, handsets and headphone jacks) in an audio system meet the factory standards.
[0044] Related technologies typically employ a serial testing method to test each audio device, meaning only one device is tested at a time, with the next device being tested only after the previous one has been completed. This serial testing method lengthens the testing cycle of electronic devices, resulting in prolonged occupation of the test control equipment and consequently low overall testing efficiency. Furthermore, to achieve high-quality sound pickup and noise reduction in various scenarios, electronic devices are generally equipped with multiple microphones (e.g., a main microphone for call pickup, a secondary microphone for ambient sound acquisition, and a rear microphone for video recording). The increased number of microphones exacerbates the aforementioned drawbacks of the serial testing method.
[0045] To improve the overall testing efficiency of electronic devices, a related technology provides an audio loopback testing method. This method connects the headphone jack of the electronic device to the test control device using a data cable, creating a loopback test path. This loopback test path allows for simultaneous testing of the speaker (or loudspeaker), microphone, and headphone jack in a single test. Compared to the serial testing method described above, the audio loopback testing method can improve the overall testing efficiency of electronic devices to a certain extent. However, under traditional audio control logic, once headphones are connected to the headphone jack of an electronic device, the system, to ensure user experience, will force the audio input device to switch to the headphone microphone and create a headphone audio stream. This "user-first" audio control logic has the following technical problem: when multiple microphones need to be tested in parallel, the system cannot obtain audio data from multiple microphones, causing the parallel testing of multiple microphones to fail, thus failing to further improve the overall testing efficiency of electronic devices.
[0046] In view of this, to solve the technical problem that multi-microphone parallel testing of electronic devices cannot be successfully performed when headphones are in place, resulting in the inability to further improve the overall testing efficiency of electronic devices, this application provides an audio testing method. When a microphone test command is received, the device representation of the multiple built-in microphones to be tested is recorded, and the value of the test flag is set to a first preset value indicating that the factory test mode is enabled, thereby providing a correct reference for the subsequent creation of the audio input stream; by creating an audio output stream routed to the earpiece, the audio output device can be switched to the earpiece, thus facilitating the subsequent playback of the target audio output data through the earpiece; by creating the audio input stream, even if... When the headphone jack is in the headphone-on state, it first checks whether the value of the test flag is the first preset value. If the value of the test flag is the first preset value, it forces the audio input device to switch to the multiple built-in microphones to be tested and creates an audio input stream with n or n+1 channels. This ensures that the number of channels in the audio input stream is equal to or greater than the number of built-in microphones. By activating multiple microphones and acquiring the audio input data collected by each of the multiple built-in microphones in parallel through the n or n+1 channels in the audio input stream, it ensures that the acquired audio input data is correct, thus successfully achieving parallel testing of multiple built-in microphones and further improving the overall testing efficiency of electronic devices.
[0047] The audio testing method provided in this application can be applied to electronic devices. Exemplarily, electronic devices may include mobile phones, tablets, laptops, wearable devices, augmented reality (AR) devices, virtual reality (VR) devices, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs), etc. This application does not limit the type of electronic device.
[0048] The following explanation uses a mobile phone as an example to illustrate the structure of an electronic device. For example, Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 1As shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180I, a touch sensor 180J, a bone conduction sensor 180K, an ambient light sensor 180L, etc.
[0049] It is understood that the above structure does not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0050] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.
[0051] The USB port 130 can be a USB standard compliant interface, specifically a Mini USB port, a MicroUSB port, or a USB Type-C port. The USB port 130 can be used to connect a charger to charge electronic devices; it can also be used to transfer data between electronic devices and peripheral devices; and it can be used to connect headphones for audio playback. Furthermore, the USB port 130 can also be used to connect other electronic devices, such as test and control equipment or AR devices.
[0052] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.
[0053] Antenna 1 and antenna 2 can be used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0054] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use in electronic devices. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 can be housed in the processor 110. In other embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be housed in the same device.
[0055] The modem processor may include a modulator and a demodulator. The modulator can be used to modulate a low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator can be used to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator can then transmit the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor can output sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.) or display images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and housed within the same device as the mobile communication module 150 or other functional modules.
[0056] The wireless communication module 160 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (WIFI) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and / or infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 can receive electromagnetic waves via antenna 2, frequency modulate and filter the electromagnetic wave signals, and send the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.
[0057] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling the electronic device to communicate with networks and other devices via wireless communication technology.
[0058] For example, an electronic device may implement audio functions, such as music playback and recording, through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, and an application processor.
[0059] The audio module 170 can be used to convert digital audio information into analog audio output signals, and can also be used to convert analog audio input information into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 can be located in the processor 110. In other embodiments, some functional modules of the audio module 170 can be located in the processor 110.
[0060] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. For example, an electronic device can listen to music or make hands-free calls through the speaker 170A.
[0061] The receiver 170B, also known as a "handpiece," is used to convert audio electrical signals into sound signals. For example, when an electronic device answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0062] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. For example, when making a phone call or sending a voice message, a user can bring their mouth close to microphone 170C to speak, inputting the sound signal into microphone 170C. Optionally, the electronic device may have at least one microphone 170C. For example, in some embodiments, the electronic device may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, the electronic device may have three, four, or more microphones 170C, enabling sound signal collection, noise reduction, sound source identification, and directional recording, etc.
[0063] The headphone jack 170D can be used to connect wired headphones. For example, the headphone jack 170D can be a USB interface 130, a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface, etc.
[0064] The electronic device runs a software system. For example, the software system running on the electronic device could be... system, system, The system, Harmony OS, or other operating systems, etc.
[0065] The software system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture, etc. This application uses a layered architecture as an example to illustrate the software system of an electronic device.
[0066] Please see Figure 2 This is an architecture diagram of a software system for an electronic device provided in an embodiment of this application. Figure 2 As shown, a layered architecture divides the software system of an electronic device into several layers, each with a clear role and division of labor, and the layers communicate with each other through software interfaces. For example, the software system of an electronic device can be divided into five layers, from top to bottom: the application (APP) layer, the framework layer, the Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer.
[0067] The application layer can include a range of applications, such as man-machine interface (MMI) applications, video, Bluetooth, music, calling, camera, and alarm clock applications.
[0068] The MMI application, also known as the factory test application, serves as a communication bridge between testers and the underlying system. It should be noted that the specific functions of the MMI application are described in detail in the subsequent method embodiments, and will not be elaborated upon here.
[0069] The framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The framework layer may include predefined functions. For example, it may include an audio server (AudioFinger), a window manager, a content provider, a phone manager, and a resource manager. It should be noted that the specific functionality of the audio server can be found in the relevant descriptions in the subsequent method embodiments, and will not be detailed here.
[0070] The Android runtime is responsible for scheduling and managing the Android system. It includes core libraries and a virtual machine. The core libraries consist of two parts: functions that Java calls and the core Android libraries themselves. The application and framework layers run within the virtual machine. The virtual machine executes the Java files from the application and framework layers as binary files. It handles functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0071] The system library can include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library, and a 2D graphics engine.
[0072] The hardware abstraction layer (HAL) provides a unified hardware operation interface for upper-layer applications. For example, the HAL may include an audio hardware abstraction module (Audio HAL), a display module, and a camera module. It should be noted that the specific functions of the audio hardware abstraction module are described in detail in the subsequent method embodiments and will not be elaborated here.
[0073] The kernel layer is the layer between hardware and software. For example, the kernel layer may contain at least a display driver, a camera driver, an audio driver, and a sensor driver.
[0074] The audio testing method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0075] Please see Figure 3 This is a schematic flowchart illustrating an audio testing method provided in an embodiment of this application. The device executing this method can be the aforementioned electronic device. Figure 3 As shown, the method may include S301 to S306, as detailed below:
[0076] S301, when the electronic device receives a microphone test command, it records the device identifiers of the multiple built-in microphones to be tested and sets the value of the test flag bit to a first preset value; the first preset value is used to indicate that the factory test mode is enabled.
[0077] Optionally, the electronic device can receive microphone test commands from the test control device. The test control device can be a system or apparatus for controlling the electronic device to execute automated test procedures.
[0078] In some embodiments, a communication connection can be established between the test control device and the electronic device. This communication connection can be a wired connection (e.g., a USB-based connection) or a wireless connection (e.g., a Wi-Fi connection or a Bluetooth connection). This application does not limit the communication connection method between the test control device and the electronic device. Therefore, the test control device can send microphone test commands to the electronic device using either wireless or wired communication.
[0079] Understandably, in some application scenarios, in order to improve the overall testing efficiency of electronic devices, the headphone jack of the electronic device is also connected to a test component similar to a wired headphone on the test control device. This will keep the headphone jack of the electronic device in the headphone position throughout the entire audio test.
[0080] Microphone test commands can be used to instruct electronic devices to automatically test their built-in microphones. A built-in microphone refers to a microphone integrated within the electronic device itself. For example, a built-in microphone may include a main microphone located at the bottom of the electronic device, a secondary microphone located at the top of the electronic device, and a rear microphone located at the back of the electronic device.
[0081] Optionally, testing of the built-in microphone may include airtightness testing and frequency response testing.
[0082] Therefore, in some embodiments, the aforementioned microphone test command can be a microphone airtightness test command. The microphone airtightness test command can be used to instruct an airtightness test to be performed on the built-in microphone of an electronic device.
[0083] In other embodiments, the microphone test command described above may be a microphone frequency response test command. A microphone frequency response test command can be used to instruct the testing of the frequency response of a built-in microphone of an electronic device. It is understood that, in other embodiments, the microphone test command described above may also be a test command used to test other performance indicators of the microphone.
[0084] Optionally, to improve microphone testing efficiency, after receiving a microphone test command, the electronic device can identify all its built-in microphones as the built-in microphones to be tested and record the device identifiers of all built-in microphones. For example, assuming the electronic device is equipped with a main microphone, a secondary microphone, and a rear microphone, after receiving the microphone test command, the electronic device can identify the main microphone, the secondary microphone, and the rear microphone as the built-in microphones to be tested.
[0085] For example, the device identifier mentioned above may include a device number and a device name. The device number is a unique identifier assigned to multiple built-in microphones by an electronic device. For example, the device number assigned to multiple built-in microphones could be 0x80000004. The device name is a manually defined, readable identifier for the multiple built-in microphones; for example, the device name for the multiple built-in microphones could be all_mic.
[0086] The value of the test flag can be used to indicate the on / off state of the factory test mode of the electronic device. Optionally, when the value of the test flag is a first preset value, it can be used to indicate that the factory test mode is on; when the value of the test flag is a second preset value, it can be used to indicate that the factory test mode is off. For example, the first preset value can be on, and the second preset value can be off. As another example, the first preset value can be 1, and the second preset value can be 0.
[0087] Optional, combined Figure 2 The electronic device includes an application layer, framework layer, hardware abstraction layer, and kernel layer. Specifically, S301 may include, for example... Figure 4 S3011 to S3012 are described in detail below:
[0088] S3011, when the application layer receives a microphone test command from the test control device, it sends a multi-microphone self-test request to the hardware abstraction layer.
[0089] Combination Figure 3 Optionally, the application layer of the electronic device may include an MMI application.
[0090] Based on this, electronic devices can receive microphone test commands from test control devices through the MMI application in the application layer, and send multi-microphone self-test requests to the hardware abstraction layer. For example, the multi-microphone self-test request may carry device identifiers of the multiple built-in microphones to be tested.
[0091] Optional, such as Figure 5 As shown, a test management module can be configured in the MMI application. Based on this, electronic devices can send multi-microphone self-test requests to the hardware abstraction layer through the test management module in the MMI application. A multi-microphone self-test request can be, for example, REC_MULTI_MIC_SELF_CHECK_MSG.
[0092] Optional, such as Figure 5 As shown, the Hardware Abstraction Layer (HALSAHardware) can include an Audio Hardware Interface (AudioALSAHardware) and an Audio Customization (AudioCust) module. The Audio Hardware Interface can be configured with a SetParameter function. Based on this, the test management module in the MMI application can send a multi-microphone self-test request to the Audio Customization module of the HALSAHardware by calling the SetParameter function in the Audio Hardware Interface.
[0093] S3012, the hardware abstraction layer responds to the multi-microphone self-test request, records the device identifiers of the multiple built-in microphones to be tested, and updates the value of the test flag bit to the first preset value.
[0094] Optionally, the hardware abstraction layer can record the device identifiers of multiple built-in microphones to be tested through the audio customization module and update the value of the test flag bit to the first preset value.
[0095] Please continue reading. Figure 5 In one specific implementation, the audio customization module may include an audio customization HAL (AudioCustomHal) and an audio customization factory (AudioCustomFactory). Based on this, when the audio hardware interface in the hardware abstraction layer receives a multi-microphone self-test request from the MMI application, it can forward the request to the audio customization HAL in the audio customization module. The audio customization HAL can record the device identifiers of the multiple built-in microphones to be tested carried in the multi-microphone self-test request in the audio customization factory, and can update the value of the test flag in the audio customization factory to a first preset value.
[0096] For example, when the device names and device numbers of the multiple built-in microphones to be tested carried in the multi-microphone self-test request are input_device=allmicallmic and input_device0x80000004 respectively, the device identifiers of the multiple built-in microphones recorded by the audio customization HAL in the audio customization factory can be: Device name: input_device=allmic; Device number: input_device0x80000004. Optionally, when the first preset value is on, the audio customization HAL can update the value of the test flag recorded in the audio customization factory to: mmi_test=on; when the first preset value is 1, the audio customization HAL can update the value of the test flag recorded in the audio customization factory to: mmi_test=1.
[0097] S302, in response to a microphone test command, the electronic device creates an audio output stream routed to the earpiece.
[0098] Understandably, the purpose of microphone airtightness testing is to assess the extent to which internal audio sources in electronic devices can leak through structural gaps and be captured by the built-in microphone. Therefore, when testing a built-in microphone, the internal audio source needs to be provided by the electronic device's internal audio output device (such as an earpiece). Based on this, when the electronic device receives a microphone test command, it must create not only an audio input stream but also an audio output stream.
[0099] This application embodiment can force the audio output device of an electronic device to be switched to the earpiece by creating an audio output stream routed to the earpiece; by playing the target audio output data through the earpiece, a stable sound source can be provided for testing the built-in microphone.
[0100] In one alternative implementation, S302 may include, for example: Figure 4 S3021 to S3023 are described in detail below:
[0101] S3021, in response to the microphone test command, the application layer sends an audio output stream creation request to the framework layer.
[0102] Optionally, when the application-layer MMI application receives a microphone test request, it can create a... Figure 5 The audio playback object (AudioTrack) shown sends an audio output stream creation request to the framework layer. For example, the audio output stream creation instruction can carry audio parameters such as sampling rate and data format.
[0103] S3022, the framework layer passes an audio output stream creation request to the hardware abstraction layer.
[0104] Optionally, after receiving an audio output stream creation request, the audio server (AudioFlinger) in the framework layer can instantiate an audio output stream (StreamOut) and pass the audio output stream creation request to the hardware framework layer.
[0105] S3023, the Hardware Abstraction Layer responds to an audio output stream creation request by creating an audio output stream routed to the earpiece.
[0106] In some embodiments, the hardware framework layer may further include an audio stream manager (AudioALSAStreamManager). Based on this, after receiving an audio output stream creation request, the audio hardware interface in the hardware framework layer can pass the audio output stream creation instruction to the audio stream manager. The audio stream manager can then create an audio output stream routed to the earpiece.
[0107] S303, when the electronic device creates an audio input stream in response to a microphone test command, if it detects that the headphone jack is currently in the headphone-in-position state and the value of the test flag is a first preset value, then according to the pre-recorded device identifier, it configures multiple built-in microphones as the current audio input devices and creates an audio input stream containing n channels or n+1 channels; n is the number of multiple built-in microphones.
[0108] Optionally, when n is even, the electronic device can create an audio input stream containing n channels. Optionally, when n is odd, the electronic device can create an audio input stream containing n+1 channels. For example, with two microphones, the electronic device can create an audio input stream containing two channels; with three microphones, it can create an audio input stream containing four channels; and with four microphones, it can create an audio input stream containing four channels.
[0109] In this embodiment of the application, when the electronic device creates an audio input stream, if it detects that the headphone jack is currently in the headphone position, unlike the prior art which directly creates an audio input stream based on the headphone microphone as the current audio input device, the electronic device in this embodiment of the application does not directly create an audio input stream based on the headphone microphone as the current audio input device. Instead, it obtains the value of the current test flag bit and determines whether the value of the current test flag bit is a first preset value.
[0110] Optionally, when the value of the current test flag is the first preset value, it indicates that the factory test mode is currently enabled. At this time, the electronic device can configure the multiple built-in microphones to be tested as the current audio input devices according to the device identifiers of the multiple built-in microphones stored in advance, and create an audio input stream containing n channels or n+1 channels.
[0111] Optionally, if the value of the current test flag is not the first preset value, the electronic device can configure the headset microphone as the current audio input device and create an audio input stream containing only mono.
[0112] In one alternative implementation, S303 may include, for example: Figure 4 S3031 to S3033 are described in detail below:
[0113] S3031, The application layer sends a microphone self-test result retrieval request to the framework layer.
[0114] The microphone self-test result retrieval request can be used to instruct the acquisition of audio input data from multiple built-in microphones under test. For example, a microphone self-test result retrieval request could be REC_MULTI_MIC_CHECK_RESULT_MSG.
[0115] S3032, in response to the microphone self-test result acquisition request, if the headphone jack is detected to be in headphone-in-place state, the framework layer sends an audio input stream creation request to the hardware abstraction layer; the audio input stream creation request is used to indicate that the headphone microphone is the current audio input device and to create an audio input stream for the headphone microphone.
[0116] Understandably, before acquiring audio input data from the built-in microphone, an audio input stream needs to be established to carry and transmit the audio input data. Therefore, after receiving a microphone self-test result acquisition request, the framework layer can respond to the microphone self-test result acquisition request by sending an audio input stream creation request to the hardware abstraction layer.
[0117] It's important to note that when the framework layer sends an audio input stream creation request to the hardware abstraction layer, it first checks the current state of the headphone jack to determine if the user is currently using headphones. Typically, when the framework layer detects that the headphone jack is in a headphone-enabled state, it assumes the user is currently using headphones. To avoid impacting the user's headphone experience, the framework layer sends an audio input stream creation request to the hardware abstraction layer, instructing the headphone microphone to be used as the current audio input device and creating an audio input stream for the headphone microphone.
[0118] S3033 After receiving the audio input stream creation request, the hardware abstraction layer obtains the value of the pre-recorded test flag bit. If the value of the test flag bit is detected to be the first preset value, the multiple built-in microphones are configured as the current audio input devices according to the device identifiers of the multiple built-in microphones pre-recorded, and an audio input stream containing n channels or n+1 channels is created.
[0119] It should be noted that, as Figure 6 As shown, in traditional audio testing methods, after receiving an audio input stream creation request that instructs the headphone microphone to be used as the current audio input device and to create an audio input stream for the headphone microphone, the hardware abstraction layer directly sets the headphone microphone as the current audio input device and creates a mono audio input stream for it based on the request. This results in the MMI application ultimately acquiring audio input data that lacks some or all of the audio input data collected by the built-in microphone under test, thus failing to achieve parallel testing of multiple built-in microphones.
[0120] Unlike traditional audio testing methods, the hardware abstraction layer in this embodiment does not directly follow the instruction to create an audio input stream after receiving an audio input stream creation request that instructs the headphone microphone to be used as the current audio input device and to create an audio input stream for the headphone microphone. Instead, it first checks whether the value of the current test flag bit is a first preset value.
[0121] Optionally, when the hardware abstraction layer detects that the value of the current test flag is the first preset value, it can configure multiple built-in microphones as the current audio input devices according to the device identifiers of multiple built-in microphones recorded in advance, and create an audio input stream containing n channels or n+1 channels.
[0122] Optionally, when the hardware abstraction layer detects that the value of the current test flag is not the first preset value, it uses the headset microphone as the current audio input device and creates an audio input stream containing one audio input channel for the headset microphone.
[0123] Specifically, the audio custom HAL in the audio custom module of the hardware abstraction layer can receive an audio input stream creation request from the framework layer and obtain the value of the current test flag from the audio custom factory to detect whether the value of the current test flag is the first preset value. Optionally, when the audio custom HAL detects that the value of the current test flag is the first preset value, it can obtain the identifiers of multiple built-in microphones to be tested that are pre-recorded from the audio custom factory, and configure n channels or n+1 channels in the abstract audio input stream (AudioALSAStreamIn) in the hardware abstraction layer based on the device identifiers of the multiple built-in microphones, thus creating an audio input stream containing n channels or n+1 channels.
[0124] S304, the electronic device turns on the earpiece and plays the target audio output data through the earpiece.
[0125] For example, the target audio output data can be pink noise. Optionally, the target audio output data can specifically be pulse-code modulation (PCM) data.
[0126] Optional, such as Figure 4 As shown, S304 may specifically include S3041 to S3042, as detailed below:
[0127] S3041, the hardware abstraction layer sends a handpiece activation command to the kernel layer.
[0128] S3042, the kernel layer controls the hardware layer to enable the earpiece so that the earpiece can play the target audio output data.
[0129] For example, the kernel layer includes a mixer. Based on this, the kernel layer mixer can control the hardware layer to turn on the earpiece.
[0130] S305, the electronic device activates multiple built-in microphones and acquires audio input data collected by each of the multiple built-in microphones in parallel through n channels or n+1 channels in the audio input stream.
[0131] As is understandable, each channel in the audio input stream corresponds to a built-in microphone. Electronic devices can acquire audio input data from the corresponding built-in microphone through each channel in the audio input stream. This enables the simultaneous acquisition of audio input data from multiple built-in microphones, allowing for successful parallel testing of multiple built-in microphones based on the acquired audio input data.
[0132] S306, the electronic device analyzes the performance of multiple built-in microphones based on target audio output data and audio input data.
[0133] Optionally, when the microphone test command is a microphone airtightness test command, the test control device can physically block the holes of multiple built-in microphones while issuing the microphone airtightness test command to the electronic device. By blocking the holes of each built-in microphone, the electronic device can perform parallel airtightness tests on multiple microphones through the audio input data collected by each built-in microphone.
[0134] Based on this, the electronic device can acquire audio input data from multiple built-in microphones in a blocked state through n channels or n+1 channels in parallel. For each built-in microphone, the electronic device can calculate the leakage value of the built-in microphone based on the target audio output data and the audio input data acquired by the built-in microphone in a blocked state, and can evaluate the airtightness of the built-in microphone based on the leakage value.
[0135] The following combination Figure 7 The underlying implementation logic of an audio testing method provided in this application embodiment will be described. For example... Figure 7 The underlying implementation logic of the audio testing method may include S701 to S716, as detailed below:
[0136] S701: When the application layer receives a microphone test command from the test control device, it sends a multi-microphone self-test request to the hardware abstraction layer.
[0137] S702, the hardware abstraction layer responds to the multi-microphone self-test request, records the device identifiers of the multiple built-in microphones to be tested, and updates the value of the test flag bit to the first preset value.
[0138] S703, the application layer sends a microphone self-test result retrieval request to the framework layer.
[0139] S704, in response to the microphone self-test result acquisition request, if the headphone jack is detected to be in headphone-in-place state, the framework layer sends an audio input stream creation request to the hardware abstraction layer; the audio input stream creation request is used to indicate that the headphone microphone is the current audio input device and to create an audio input stream for the headphone microphone.
[0140] S705, the hardware abstraction layer determines whether the value of the current test flag is the first preset value.
[0141] If the S706 is used, the hardware abstraction layer configures multiple built-in microphones as the current audio input devices.
[0142] S707, if not, the hardware abstraction layer configures multiple built-in microphones as the current audio input device.
[0143] S708, the framework layer detects that the headphone jack is in the headphone in-place state and sends an audio input stream creation request to the hardware abstraction layer again; the audio input stream creation request is used to indicate that the headphone microphone is the current audio input device and to create an audio input stream for the headphone microphone.
[0144] S709, the hardware abstraction layer again determines whether the value of the current test flag is the first preset value.
[0145] If it is an S710, the hardware abstraction layer keeps the current audio input device as the multiple built-in microphones to be tested.
[0146] S711, if not, the hardware abstraction layer updates the current audio input device to a headphone microphone.
[0147] The S712 hardware abstraction layer determines whether the current audio input device is multiple built-in microphones.
[0148] S713, if so, the hardware abstraction layer creates an audio input stream containing n channels or n+1 channels.
[0149] S714, if not, the hardware abstraction layer determines whether the current audio input device is a headphone microphone.
[0150] If it is an S715, then the Hardware Abstraction Layer creates an audio input stream containing a mono channel.
[0151] The S716 hardware abstraction layer controls audio acquisition by opening audio input devices through the kernel layer.
[0152] It should be noted that, regarding Figure 7 For a detailed explanation of each of the above steps, please refer to [link / reference]. Figure 3 The relevant descriptions in the corresponding embodiments will not be repeated here.
[0153] As can be seen from the above, the audio testing method provided in this application, by recording the device representation of the multiple built-in microphones to be tested when receiving the microphone test command, and setting the value of the test flag bit to a first preset value indicating that the factory test mode is enabled, can provide a correct reference for the subsequent creation of the audio input stream; by creating an audio output stream routed to the earpiece, the audio output device can be switched to the earpiece, which facilitates the subsequent playback of the target audio output data through the earpiece; by determining whether the value of the test flag bit is the first preset value when creating the audio input stream, even if the headphone jack is in the headphone-on state, and forcibly switching the audio input device to the multiple built-in microphones to be tested if the value of the test flag bit is the first preset value, and creating an audio input stream including n channels or n+1 channels, can ensure that the number of channels in the audio input stream is equal to or greater than the number of multiple built-in microphones; by enabling multiple microphones and acquiring the audio input data collected by each of the multiple built-in microphones in parallel through the n channels or n+1 channels in the audio input stream, it can ensure that the acquired audio input data is correct, thereby successfully realizing the parallel testing of multiple built-in microphones and further improving the overall testing efficiency of electronic devices.
[0154] Please see Figure 8 This is a schematic flowchart illustrating an audio testing method provided in another embodiment of this application. Figure 8 As shown, with Figure 3 Compared to the corresponding embodiments, the audio testing method provided in this embodiment may further include S307 before S304, as detailed below:
[0155] S307, the electronic device adjusts the earpiece volume to the maximum volume.
[0156] This application embodiment creates a strong sound pressure environment inside the electronic device by adjusting the earpiece volume to the maximum volume. This allows the built-in microphone to capture audio signals that leak through very small gaps, thereby improving the sensitivity and signal-to-noise ratio of the microphone's airtightness detection.
[0157] Based on the same technical concept, embodiments of this application also provide an electronic device, which may include one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and one or more processors call the computer instructions to cause the electronic device to perform one or more steps in any of the above method embodiments.
[0158] Based on the same technical concept, embodiments of this application also provide a computer-readable storage medium storing a computer-executable program, which, when invoked by a computer, causes the computer to perform one or more steps in any of the above method embodiments.
[0159] Based on the same technical concept, embodiments of this application also provide a computer program product, including a computer program, which, when run, causes an audio testing method as described in any of the implementations of the first aspect above to be executed.
[0160] Based on the same technical concept, embodiments of this application also provide a chip system, including a processor coupled to a memory, which executes a computer-executable program stored in the memory to implement one or more steps in any of the above method embodiments. This chip system can be a single chip or a chip module composed of multiple chips.
[0161] In the above embodiments, the descriptions of each embodiment have different focuses. Parts not described in detail or in a particular embodiment can be referred to in the relevant descriptions of other embodiments. It should be understood that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0162] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0163] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0164] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.
Claims
1. An audio testing method, characterized by, The method comprises the steps of: recording the device identifiers of the multiple built-in microphones to be tested when receiving a microphone test instruction, and setting the value of a test flag bit to a first preset value; the first preset value is used to indicate that the factory test mode is in an open state; in response to the microphone test instruction, an audio output stream to the earpiece is created; when the audio input stream is created in response to the microphone test instruction, if it is detected that the earphone interface is currently in an earphone in-place state and the value of the test flag bit is the first preset value, the multiple built-in microphones are configured as the current audio input device according to the pre-recorded device identifiers, and an audio input stream containing n sound channels or n+1 sound channels is created; n is the number of the multiple built-in microphones; the earpiece is turned on, and target audio output data is played through the earpiece; the multiple built-in microphones are turned on, and audio input data collected by the multiple built-in microphones is acquired through the n sound channels or n+1 sound channels in parallel; the performance of the multiple built-in microphones is analyzed according to the target audio output data and the audio input data.
2. The method of claim 1, wherein, recording the device identifiers of the multiple built-in microphones to be tested when receiving a microphone test instruction, and setting the value of a test flag bit to a first preset value, comprising: when receiving a microphone test instruction from a test control device, the application layer sends a multi-microphone self-test request to the hardware abstraction layer; the multi-microphone self-test request carries the device identifiers of the multiple built-in microphones to be tested; the hardware abstraction layer records the device identifiers of the multiple built-in microphones to be tested in response to the multi-microphone self-test request, and updates the value of the test flag bit to the first preset value.
3. The method of claim 1, wherein, when the audio input stream is created in response to the microphone test instruction, if it is detected that the earphone interface is currently in an earphone in-place state and the value of the test flag bit is the first preset value, the multiple built-in microphones are configured as the current audio input device according to the pre-recorded device identifiers, and an audio input stream containing n sound channels or n+1 sound channels is created, comprising: the application layer sends a microphone self-test result acquisition request to the framework layer; the framework layer sends an audio input stream creation request to the hardware abstraction layer in response to the microphone self-test result acquisition request under the condition that it is detected that the earphone interface is currently in an earphone in-place state; the audio input stream creation request is used to instruct to take the earphone microphone as the current audio input device and create an audio input stream for the earphone microphone; after receiving the audio input stream creation request, the hardware abstraction layer acquires the value of the pre-recorded test flag bit, and under the condition that it is detected that the value of the test flag bit is the first preset value, the multiple built-in microphones are configured as the current audio input device according to the pre-recorded device identifiers of the multiple built-in microphones, and an audio input stream containing n sound channels or n+1 sound channels is created.
4. The method of claim 3, wherein, The hardware abstraction layer receives the audio input stream creation request, acquires the value of the pre-recorded test flag, and in the case of detecting that the value of the test flag is the first preset value, configures the plurality of built-in microphones as the current audio input device according to the pre-recorded device identifiers of the plurality of built-in microphones, and creates an audio input stream containing n channels or n+1 channels, including: The audio hardware interface of the hardware abstraction layer transmits the audio input stream creation request to the audio customization module of the hardware abstraction layer after receiving the audio input stream creation request; The audio customization module controls the audio device configuration module of the hardware abstraction layer to configure the plurality of built-in microphones as the current audio input device according to the pre-recorded device identifiers of the plurality of built-in microphones; The audio customization module creates an audio input stream containing n channels or n+1 channels.
5. The method according to any one of claims 1 to 4, characterized in that, In response to the microphone test instruction, an audio output stream routed to the earpiece is created, including: The application layer sends an audio output stream creation request to the framework layer in response to the microphone test instruction; The framework layer transmits the audio output stream creation request to the hardware abstraction layer; The hardware abstraction layer creates an audio output stream routed to the earpiece in response to the audio output stream creation request.
6. The method according to any one of claims 1 to 4, characterized in that, The microphone test instruction is a microphone airtightness test instruction; correspondingly, the audio input data collected by the plurality of built-in microphones is acquired in parallel through the n channels or n+1 channels, including: The audio input data collected by the plurality of built-in microphones in the blocked hole state is acquired in parallel through the n channels or n+1 channels; Correspondingly, the performance of the plurality of built-in microphones is analyzed according to the target audio output data and the audio input data, including: For each built-in microphone, the leakage value of the built-in microphone is calculated according to the target audio output data and the audio input data collected by the built-in microphone in the blocked hole state, and the airtightness of the built-in microphone is evaluated according to the leakage value of the built-in microphone.
7. The method according to any one of claims 1 to 4, characterized in that, Before playing the target audio output data through the earpiece, the method further includes: Adjusting the volume of the earpiece to the maximum volume.
8. An electronic device, comprising: Including: One or more processors, and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to make the electronic device execute the method of any one of claims 1 to 7.
9. A computer program product, characterised in that, The computer program is executed to make the method of any one of claims 1 to 7 be executed.
10. A chip system, characterized by The chip system is applied to an electronic device, and the chip system includes one or more processors configured to invoke computer instructions to make the electronic device execute the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Mobile phone automatic test device and method
CN102387234A
Method and device for detecting sound leakage and electronic device
CN107835482A
Microphone hole blockage detection method and related product
CN109151698A
Audio test method and device for multi-microphone phone
CN113573225A
Echo test method for call fault and device to be tested
CN116456016A