CN109831714B - Method and device for identifying earphone keys and electronic equipment - Google Patents

Method and device for identifying earphone keys and electronic equipment Download PDF

Info

Publication number
CN109831714B
CN109831714B CN201910038412.7A CN201910038412A CN109831714B CN 109831714 B CN109831714 B CN 109831714B CN 201910038412 A CN201910038412 A CN 201910038412A CN 109831714 B CN109831714 B CN 109831714B
Authority
CN
China
Prior art keywords
earphone
key
touch event
timing
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910038412.7A
Other languages
Chinese (zh)
Other versions
CN109831714A (en
Inventor
裴琨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910038412.7A priority Critical patent/CN109831714B/en
Publication of CN109831714A publication Critical patent/CN109831714A/en
Application granted granted Critical
Publication of CN109831714B publication Critical patent/CN109831714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Telephone Function (AREA)

Abstract

The embodiment of the application discloses a method and a device for identifying earphone keys, electronic equipment and a storage medium. The method comprises the following steps: when detecting the insertion event of the earphone provided with the keys, starting timing; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and executing the operation corresponding to the touch event. According to the method, when the four-section type earphone is inserted, the electronic equipment can directly report the earphone insertion event and does not enter redundant earphone type correction processes, so that unnecessary correction time consumption is reduced, a timing mode is adopted, after timing meets a reference time limit, the monitored touch event of the earphone key can be identified, and the operation corresponding to the touch event is executed, so that the electronic equipment can respond to the touch event of the earphone key more quickly.

Description

Method and device for identifying earphone keys and electronic equipment
Technical Field
The present application relates to the field of electronic devices, and in particular, to a method and an apparatus for identifying an earphone key, an electronic device, and a storage medium.
Background
The earphone is generally adopted by the external audio output equipment of the current mobile communication terminal product, a plurality of terminal products have the function of the voice assistant, and the voice assistant can be awakened by inserting the earphone, so that convenience is brought to the life of people. However, after the earphone is inserted into the terminal product, the earphone cannot be quickly recognized by the terminal product, so that the voice assistant cannot be quickly awakened, and user experience is greatly influenced.
Disclosure of Invention
In view of the foregoing, the present application provides a method, an apparatus, an electronic device, and a storage medium for identifying an earphone key, so as to improve the foregoing problems.
In a first aspect, the present application provides a method for identifying a headphone key, which is applied to an electronic device, and the method includes: when detecting the insertion event of the earphone provided with the keys, starting timing; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and executing the operation corresponding to the touch event.
In a second aspect, the present application provides an apparatus for identifying a key of a headset, which is operable on an electronic device, and includes: the timing module is used for starting timing when an insertion event of the earphone configured with the keys is detected; the identification module is used for identifying the monitored touch event of the earphone key if the timing meets the reference time limit; and the execution module is used for executing the operation corresponding to the touch event.
In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of the first aspect described above.
In a fourth aspect, the present application provides a computer-readable storage medium having a program code stored therein, wherein the program code executes the method of the first aspect.
According to the method, the device, the electronic equipment and the storage medium for identifying the earphone keys, timing is started when an insertion event of the earphone provided with the keys is detected; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and then executing the operation corresponding to the touch event. According to the method, when the four-section type earphone is inserted, the electronic equipment can directly report the earphone insertion event and does not enter redundant earphone type correction processes, so that unnecessary correction time consumption is reduced, a timing mode is adopted, after timing meets a reference time limit, the monitored touch event of the earphone key can be identified, and the operation corresponding to the touch event is executed, so that the electronic equipment can respond to the touch event of the earphone key more quickly.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a schematic diagram of a three-piece headset;
fig. 2 shows a schematic diagram of a four-segment headset;
fig. 3 is a flowchart illustrating a method for identifying a headphone key applied to an electronic device according to an embodiment of the present application;
FIG. 4 shows a flowchart of one embodiment of step S120 in FIG. 3;
fig. 5 is a flowchart illustrating a method for identifying a headphone key applied to an electronic device according to another embodiment of the present application;
FIG. 6 shows a flowchart of one embodiment of step S210 in FIG. 5;
fig. 7 is a block diagram illustrating a structure of an apparatus for identifying a headphone key, which is operated in an electronic device according to an embodiment of the present application;
fig. 8 is a block diagram illustrating a structure of an apparatus for identifying a headphone key, which is operated in an electronic device according to another embodiment of the present application;
FIG. 9 is a block diagram of an electronic device provided herein;
fig. 10 is a storage unit for storing or carrying program codes for implementing a method of identifying a headphone key according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the rapid development of mobile communication technology, electronic devices have become more intelligent. For example, more electronic devices are equipped with voice assistants. The user of the electronic equipment can realize the operation of the electronic equipment by intelligently interacting with the voice assistant.
And the electronic device may wake up the installed voice assistant in a number of ways. For example, the voice assistant may be triggered to start by a program icon arranged on a desktop of the electronic device, the voice assistant may be triggered to start by pressing a HOME key for a long time, and the voice assistant may be triggered to start by touching a key inserted into an earphone of the electronic device.
Among various earphones, a 3.5mm earphone is a common earphone used by a user, common types of earphones of the type are a three-section earphone (shown in fig. 1) and a four-section earphone (shown in fig. 2), and the common types are different from a three-section earphone plug that the four-section earphone has more earphones (microphones), and most of earphones of mobile phone accessories are of a four-section structure. The four-segment headset shown in fig. 2 has a microphone and a hook button, and after the headset is inserted into the electronic device, a user can call a voice assistant in the electronic device by pressing the hook button for a long time.
As one way, after the earphone is inserted into the smart mobile terminal, there is a process of identifying the earphone type, including identification of the earphone insertion and identification of the earphone type. Optionally, in the process of inserting the earphone into the electronic device (e.g., a mobile phone), when the earphone is inserted into the electronic device, the electronic device identifies the type of the earphone and reports the type of the earphone. As a way, if the level is unstable and the four-segment type earphone is easily recognized by mistake, the three-segment type earphone is easily recognized as the four-segment type earphone by mistake due to the rapid insertion of the earphone seat; in addition, the high-impedance type four-segment earphone often cannot be recognized for the first time, and therefore, the electronic device corrects the type of the inserted earphone first, that is, determines whether the type of the currently inserted earphone is a four-segment earphone. Optionally, after the inserted earphone is determined as a four-segment earphone, the electronic device may determine whether the identification delay of the four-segment earphone type is greater than a preset time threshold, and if so, when the user presses the hook key of the earphone for a long time, the electronic device may identify and report the long-press event of the hook key, so as to wake up the mobile phone voice assistant.
However, the inventor finds in research that if the flow of identifying the earphone type by the electronic equipment is slow, the identification of the earphone hook key is directly affected. For example, if a user directly presses the hook button for a long time after inserting the headset into a mobile phone with a voice assistant, the correction of the headset type still consumes a lot of time, and the type of the headset is not recognized and reported, so that the voice assistant cannot be woken up normally and quickly by pressing the hook button for a long time. Moreover, for the time threshold, when the number of products is large, it cannot be guaranteed that the identification delay of each electronic device for identifying the four-segment type of earphone is consistent, and in general, in order to eliminate the abnormality of each instance, the value of the time threshold is increased, so that long-time pressing of a hook key is delayed, a voice assistant cannot be waken up quickly, and user experience is greatly influenced. Therefore, the inventor provides the method, the device and the electronic equipment for recognizing the earphone key, which can improve the recognition speed of the earphone hook key and further can rapidly wake up the voice assistant.
It should be noted that, in the embodiment of the present application, besides triggering the voice assistant in the electronic device to start, the button of the headset may also trigger other applications in the electronic device to start. And what applications can be specifically started is not specifically limited in this application.
It should be noted that the headset described in the embodiment of the present application is a four-segment headset, and the scene described in the embodiment of the present application is a scene in which the hook button is quickly pressed after the four-segment headset is inserted.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Referring to fig. 3, a method for identifying a key of an earphone according to an embodiment of the present application is applied to an electronic device, and the method includes:
step S110: when the insertion event of the earphone provided with the keys is detected, timing is started.
In one way, the earphone configured with the keys in the embodiment of the present application may be a four-segment earphone or other earphones with a key control function.
The electronic device may determine whether a four-segment headset insertion event currently exists in various ways.
By one approach, the electronic device may determine whether a four-segment headset insertion event exists for the headset jack by querying for changes in the state values of the system parameters. For example, in one implementation manner, if the electronic device is an Android operating system, the Android operating system may determine whether a four-segment earphone insertion event exists in an earphone jack based on a state value reported to a user system space by a kobject _ ue of drivers/char/micco _ hsdetect.c; whether a four-section type earphone insertion event exists in the earphone jack can be judged based on an event reported to a user space by the input _ report _ Switch of the drivers/input/keyboard/micco _ keys.c; whether a four-segment earphone insertion event exists can be judged based on the values of the states of the drivers/switch/switch _ micco.c.
As another mode, the electronic device may use an earphone socket with a detection mechanical structure, connect the detection pin to the GPIO interrupt, and when the four-segment earphone is inserted, the metal of the four-segment earphone plug may touch the detection pin, so that the level of the detection pin changes, thereby causing the interrupt. Therefore, the value of the GPIO can be read in the interrupt processing function, whether the four-section type earphone is plugged in or pulled out is further judged, and if the four-section type earphone is plugged in, the four-section type earphone plugging event can be judged to exist.
As yet another way, for example, in the Android system, whether there is a four-segment headset insertion event may be detected through broadcasting. Optionally, an Intent of the Broadcast Receiver monitoring "android. This Intent may contain the following values: state (0 for unplugged, 1 for plugged in), name (string, representing type of headset) and microphone (1 for microphone in this headset, 0 for not). When the return value of the state is 1, it indicates that there is a four-segment earphone insertion event.
In order to avoid unnecessary time consumption of the electronic device in correcting the type of the four-section type earphone, a timer driving program can be started when a four-section type earphone insertion event is detected, the reporting time of the four-section type earphone event is used as a timing starting point, the time period from the timing starting point to the time before a hook key of the four-section type earphone is responded is counted, and the earphone type reporting can be accurately controlled.
Step S120: and judging whether the timing meets the reference time limit.
As one mode, the reference time limit may be configured according to the system delay of the electronic device by acquiring the system delay of the electronic device. The system delay may include a delay time during which the electronic device executes the system operation instruction. It should be noted that, in the process of setting the system delay, there are some register operations in the reporting process after the type of the four-segment type earphone is detected, for example, there are some delays in the operations of related registers such as micbias.
It will be appreciated that the electronic device may have different system latencies measured at different time periods due to the different number of programs currently running and the different number of data processing tasks currently running. In this case, as one way, the electronic device may perform multiple tests on the system delay, obtain the system delay including the statistical result of the multiple tests, and then use an average value of the system delays obtained through the multiple tests as the target system delay, and then may configure the target system delay as the reference time limit. Therefore, the method can calculate more accurate system delay and can ensure that the finally configured reference time limit has better adaptability. Furthermore, the average value of the system delay is used as the target system delay to be configured into the reference identification time limit, so that the reference time limit can be conveniently reduced, and the identification of the four-section type earphone key can be accelerated.
Furthermore, as the electronic device is used for a long time, the software system has a problem of more redundant data, and the hardware of the electronic device may be aged, which may cause a change in system delay. In another implementation, the electronic device may periodically obtain a plurality of system delays, and use a minimum value of the plurality of system delays as a target system delay; the target system delay may then be configured as a reference time limit. The minimum value of the system delays is used as the target system delay to configure the target system delay into the reference identification time limit, so that the identification time of the four-section type earphone key can be accurately reduced, and further the touch event corresponding to the four-section type earphone case can be quickly responded.
The period for obtaining the system delays may be determined in a plurality of ways.
As one mode, a period time may be configured in advance in the electronic device by a developer or a user, and the electronic device always collects a plurality of system delays according to the configured period time. Alternatively, the electronic device may adjust the period of the time delay of the acquisition of the plurality of systems according to the usage frequency of the headset. It can be understood that, data calculation related to the electronic device in the process of re-determining the reference time limit each time may consume a certain amount of electricity, and then the electronic device may calculate that the number of times of waking up the voice assistant or calling other applications through a touch event of a case of the headset within a specified time period exceeds a target threshold, and then shorten the period of obtaining the multiple system delays, so that the reference time limit may be configured more accurately in a time period when the usage frequency of the headset is higher.
In addition, for the reference time limit of the system delay, the reference identification time limit may also be obtained by modifying by the user when the headset detects the driver software through the system platform, and specifically, the user may modify according to the actual situation, which is not limited herein.
It should be noted that, in the embodiment of the present application, the reference time limit calculated based on the foregoing manner is 200 ms and 300 ms. In the earphone recognition process including the earphone correction process, the whole earphone recognition process consumes 2-3 seconds, so that the time consumption of the recognition process of the touch event of the earphone case can be greatly shortened according to the reference time limit determined by the embodiment of the application, and the electronic device can respond to the touch event of the earphone case more quickly.
For the configured reference time limit, the electronic device can judge whether the timing result meets the reference time limit in real time in the timing process. Alternatively, the timing may be greater than the reference time limit or less than the reference time limit, as described in detail below.
As one way, referring to fig. 4, step S120 may include:
step S121: and if the timing meets the reference time limit, starting to monitor the touch event of the earphone key.
The touch event of the earphone key indicates that when the hook key of the earphone is pressed, the earphone reports the touch event to the electronic equipment. The same hook key may include multiple touch events, that is, the touch events of the earphone keys corresponding to different pressing operations are different. For example, if the electronic device is a mobile phone, when a four-section type earphone is inserted into an earphone jack of the mobile phone, pressing the hook key once can turn on a music player of the mobile phone, continuously pressing the hook key twice can switch music, and pressing the hook key for a long time can wake up a voice assistant function of the mobile phone. As a way, the earphone inserted into the mobile phone needs to be an earphone used with the mobile phone.
As one way, if the timing is not less than the reference time limit, it is determined that the timing satisfies the reference time limit, and in this case, the electronic device may start to monitor the touch event of the earphone button. It should be noted that, at this time, the electronic device starts to monitor whether a touch event of the earphone key exists. As an implementation manner, the electronic device may determine whether a touch event of the earphone key exists by capturing a change in the level, and optionally, if the electronic device receives a level change signal, it may determine that the touch event of the earphone key exists; if the level change signal is not received, it can be determined that there is no touch event of the earphone key, or the actual timing has not reached the reference time limit, and a respective error occurs.
As another implementation manner, the electronic device may register to monitor, and set to monitor the touch event of the earphone key in real time, for example, determine whether there is a touch event of the hook key by monitoring a value returned by the event.
It should be noted that, if the timing is smaller than the reference time limit, the electronic device will continue to determine the timing length until the timing meets the reference time limit, and then start to monitor the touch event of the earphone button.
Alternatively, the touch event of the earphone button may be monitored when a four-segment earphone insertion event is detected. In this case, since the monitoring of the touch event of the earphone key is started simultaneously when the insertion event of the earphone configured with the key is detected, the identification process of the earphone hook key can be accelerated.
Step S122: and if the touch event of the earphone key is monitored, identifying the monitored touch event of the earphone key.
If the touch event of the earphone key is monitored, the electronic device can start to identify the specific content of the monitored touch event of the earphone key. As one approach, as previously described, the touch event of the headset key may be determined according to the category of the headset hook pressing operation triggered by the user.
Step S130: and if the timing meets the reference time limit, identifying the monitored touch event of the earphone key.
As one way, different pressing operation manners may correspond to different touch events of the earphone key, for example, in some embodiments, the electronic device may suggest a table locally in advance, where the table records touch event types of the earphone key corresponding to the different pressing manners, and for convenience of identification, different types of touch events may be replaced by different command values. As one mode, when there is a pressing operation of the headset hook key, the electronic device may determine, according to the return value, a touch operation of the headset key corresponding to the current pressing operation.
For example, in a specific application scenario, the number of pressing times of the headset hook key, the pressing type, and the touch event association corresponding to different pressing operations may be stored in the table, optionally, if one pressing is performed, it can be understood that the pressing type is stored as "short press", and the touch event corresponding to one pressing may be set to start a certain application (e.g., WeChat); if the pressing is performed twice, the pressing type may be stored as "continuous pressing", and the touch event corresponding to the pressing twice may be set to raise the call decibel, and so on, it should be noted that, for convenience of description, the relationship between the three in actual use is not limited, and then when the return value is 1, the corresponding touch event may be determined as the open WeChat, and when the return value is 2, the corresponding touch event may be determined as the raise the call decibel.
Step S140: and executing the operation corresponding to the touch event.
As one way, the touch event corresponding to the hook button length may be set as a voice assistant that wakes up the electronic device, and then the electronic device performing the operation corresponding to the touch event may be understood as waking up the voice assistant.
According to the method for identifying the earphone key, when an insertion event of the earphone provided with the key is detected, timing is started; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and then executing the operation corresponding to the touch event. According to the method, when the four-section type earphone is detected to be inserted, the electronic equipment can directly report the earphone insertion event and does not enter a redundant earphone type correction flow, so that unnecessary correction time is reduced; and the reference time limit for controlling the electronic equipment to respond to the earphone touch event is set, so that the hook key of the electronic equipment for rapidly responding to the earphone can be reached by controlling the reference time limit, and the voice assistant can be rapidly awakened.
Referring to fig. 5, a method for identifying a key of an earphone according to another embodiment of the present application is applied to an electronic device, and the method includes:
step S210: when an insertion event of the earphone provided with the keys is detected, timing is started, an application program related to touch operation of the earphone keys is started in a background, and the application program can be started in response to the touch operation of the earphone keys.
In the above embodiments, it is known that, when an insertion event of the earphone configured with the keys is detected, timing is started, and meanwhile, a touch event of the keys of the earphone can be monitored. As a mode, if the touch event of the earphone key is monitored at the same time, the application program associated with the touch operation of the earphone key may be started in the background, so that the corresponding application program may be quickly invoked according to the type of the touch event in the later period. For example, a voice assistant corresponding to a long-press earphone hook key is awakened quickly, so that a hook key event can be responded quickly, and the identification of the earphone key is accelerated.
As an implementation manner, the electronic device may set an association relationship with an application program triggered by the headset hook key, and when the electronic device detects a four-section headset insertion event, the electronic device immediately starts the application program corresponding to the touch event of the headset key in advance in a background. It should be noted that, the application program started at this time can be increased or decreased according to the user's needs, so that the electric quantity can be saved, and it is ensured that sufficient electric quantity can respond to the touch event of the earphone button. Specifically, a setting interface may be configured in the electronic device, in which all applications that can be triggered by a button of the headset in the electronic device may be displayed, and a switch may be configured for each displayed application, in which case, a user may select an application that can be started in advance in the background by triggering the switch. For example, if the user triggers the switch corresponding to the application a to the on state, the application a is configured to be started in the background in advance after the electronic device monitors the touch event of the headset case.
As one way, referring to fig. 6, step S210 may include:
step S211: and acquiring an application program which is currently started by a background and is associated with the touch operation of the earphone key.
The electronic device can determine the application program which is currently running in the background and is associated with the touch operation of the earphone key in a plurality of ways. As one way, the touch operation of the earphone button may be set to be associated with an application of the electronic device, and then the electronic device may query a currently running program in the background to determine the currently started application associated with the touch operation of the earphone button. As a mode, if the electronic device is an Android operating system, a public static boot isrun background () can be called, and an application program currently started in a background and associated with touch operation of the earphone key can be obtained according to a judgment result in a program execution process. For example, the application may be determined to be Running in the BACKGROUND and what the currently Running application is, according to if (using Process _ opportunity _ backstround), and then the application currently started in the BACKGROUND and associated with the touch operation of the headphone key may be acquired.
As another way, the application program currently running in the background and associated with the touch operation of the earphone key may be monitored in the background through the server.
Step S212: detecting whether there are other applications of the same class as the associated application.
Optionally, the electronic device may divide the different applications into different application folders according to categories, for example, the entertainment folder may include a plurality of game applications belonging to the entertainment category, and the music folder may include a plurality of music playback programs belonging to the music category. Furthermore, the electronic device may also be a device that divides different applications into different categories according to the calculated frequency of use or the usage habits of the user. For example, applications such as WeChat, Payment treasure, QQ, Camera, etc. may be divided into one folder as the same categorized application according to the frequency of use.
As a manner, the electronic device may set the associated event for the application programs stored in association, and when one of the application programs triggers the background to start the application program through the touch operation of the earphone button, in order to facilitate quick response to other touch operations of the earphone button, the electronic device may set the background to preload other application programs belonging to the same category, so as to avoid that when a user wants to start other application programs corresponding to the touch operation of the earphone button, or wants to exit the application program currently located, and restart other application programs, the electronic device needs to be manually triggered again to start other application programs, which consumes a lot of time, and thus the electronic device cannot quickly respond to other application programs corresponding to the touch operation of the earphone button.
As an embodiment, the electronic device may set a correspondence between the touch operations of the earphone keys and the application programs, including adding, modifying, deleting, and the like, the correspondence between the touch operations of the earphone keys and the application programs that are pre-configured by the system. For example, the photographing function of the electronic device may be associated with three consecutive presses of the headset hook key, and when the electronic device detects that the headset hook key is pressed three consecutive times, the application program for photographing may be started in the background. Optionally, if the user sets that each application program with the photographing function of the electronic device is placed in the same folder, in this case, the electronic device may start other application programs with the photographing function in the same folder in the background and start at the same time with the current photographing function.
Step S213: and if other application programs of the same type as the associated application program are detected to exist, starting the other application programs in the background.
If the application program is existed, in order to save time conveniently, the electronic device can start other application programs which belong to the same type with the associated application program at the background, when the application program is needed by a user, the user does not need to quit the current page where the application program is located and then manually restart the application program, but can switch to other pre-started application programs through the application program management window, so that the application program corresponding to the touch operation of the earphone key can be started more quickly, the user is facilitated, and the user experience is improved.
Step S220: and judging whether the timing meets the reference time limit.
Step S230: and if the timing meets the reference time limit, identifying the monitored touch event of the earphone key.
Step S240: and calling an application program corresponding to the touch event from the background.
As a mode, after the application programs corresponding to the touch operations of the earphone keys are queried, the application programs corresponding to the touch events can be called from the background through the system. Specifically, after the user presses the earphone key, the electronic device can quickly respond to the application program corresponding to the touch operation of the earphone key, and then open the user operation interface corresponding to the application program.
According to the method for identifying the earphone key, when an insertion event of the earphone provided with the key is detected, timing is started, and an application program related to touch operation of the earphone key is started in a background; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and then, in the process of executing the operation corresponding to the touch event, the application program which needs to be triggered and run by the touch event can be directly called from the background. According to the method, when the four-section type earphone is detected to be inserted, the electronic equipment can directly report the earphone insertion event and does not enter a redundant earphone type correction flow, so that unnecessary correction time is reduced; and the reference time limit for controlling the electronic equipment to respond to the earphone touch event is set, so that the electronic equipment can quickly respond to a hook key of the earphone by controlling the reference time limit, and an application program which needs to be triggered and run by the touch event can be quickly called.
Referring to fig. 7, an embodiment of the present application provides an apparatus 300 for identifying a key of a headset, where the apparatus 300 is operated in an electronic device, and includes: a timing module 310, a determination module 320, an identification module 330, and an execution module 340.
The timing module 310 is configured to start timing when an insertion event of the earphone configured with the keys is detected.
As one approach, the timing module 310 may be configured to start monitoring a touch event of a button of the headset when an insertion event of the headset configured with the button is detected.
As one mode, the apparatus 300 may further include an obtaining module and a configuring module, where the obtaining module is specifically configured to obtain a system delay of the electronic device, where the system delay includes a delay time in a process of executing an operation instruction by the electronic device; the configuration module is specifically configured to configure the reference time limit according to the system delay.
As an embodiment, the system delay may include a system delay obtained by multiple tests, and the step of configuring the reference time limit according to the system delay may include: taking the average value of the system delays obtained by the multiple tests as the target system delay; and configuring the target system delay as a reference time limit.
And a judging module 320, configured to judge whether the timing meets the reference time limit.
An identifying module 330, configured to identify a monitored touch event of the earphone key if the timing meets the reference time limit.
As a way, if the timing meets the reference time limit, monitoring a touch event of an earphone button may be started; optionally, if a touch event of the earphone key is monitored, the monitored touch event of the earphone key can be further identified.
The executing module 340 is configured to execute an operation corresponding to the touch event.
By way of example, the reference time limit in the embodiments of the present application may be 200-300 ms.
Referring to fig. 8, another embodiment of the present application provides an apparatus 400 for identifying a key of a headset, where the apparatus 400 is operated in an electronic device, and includes: the device comprises a starting unit 410, a judging unit 420, a recognizing unit 430 and a calling unit 440.
The starting unit 410 is configured to start timing when detecting an insertion event of a headset configured with a key, and start an application associated with touch operation of the headset key in a background, where the application can be started in response to the touch operation of the headset key.
As one way, the apparatus 400 may further include an application starting unit, which may be configured to, when an insertion event of a headset configured with a key is detected, start an application associated with a touch operation of the headset key in the background, where the application may be started in response to the touch operation of the headset key.
As an embodiment, the application starting unit is specifically configured to, when an insertion event of an earphone configured with a key is detected and a touch event of the earphone key is detected, start an application associated with a touch operation of the earphone key in a background. Optionally, as a manner, the electronic device may obtain an application program currently started in a background and associated with the touch operation of the earphone key; then detecting whether other application programs related to the application program exist in system application of the electronic equipment; and if other application programs related to the application program are detected to exist, starting the other application programs in a background.
And a judging unit 420 for judging whether the timing satisfies the reference time limit.
An identifying unit 430, configured to identify a monitored touch event of the earphone key if the timing meets the reference time limit.
The invoking unit 440 is configured to invoke an application corresponding to the touch event from the background.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling. In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
In summary, according to the method, the apparatus, and the electronic device for identifying the earphone key provided by the present application, when an insertion event of an earphone configured with keys is detected, timing is started; if the timing meets the reference time limit, identifying the monitored touch event of the earphone key; and then executing the operation corresponding to the touch event. According to the method, when the four-section type earphone is detected to be inserted, the electronic equipment can directly report the earphone insertion event and does not enter a redundant earphone type correction flow, so that unnecessary correction time is reduced; and the reference time limit for controlling the electronic equipment to respond to the earphone touch event is set, so that the hook key of the electronic equipment for rapidly responding to the earphone can be reached by controlling the reference time limit, and the voice assistant can be rapidly awakened.
An electronic device provided by the present application will be described below with reference to fig. 9.
Referring to fig. 9, based on the method and the apparatus for identifying a headphone key, another electronic device 100 capable of executing the method for identifying a headphone key is further provided in the embodiment of the present application. Electronic device 100 includes one or more processors 102 (only one shown), memory 104, and audio module 106 coupled to each other. The memory 104 stores programs that can execute the content of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
Processor 102 may include one or more processing cores, among other things. The processor 102 interfaces with various components throughout the electronic device 100 using various interfaces and circuitry to perform various functions of the electronic device 100 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 104 and invoking data stored in the memory 104. Alternatively, the processor 102 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 102 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. The CPU mainly processes an operating system, a user interface, a target application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 102, but may be implemented by a communication chip.
The Memory 104 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 104 may be used to store instructions, programs, code sets, or instruction sets. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the electronic device 100 in use, and the like.
Furthermore, the audio module 106 may be used to process audio output by an application running in the electronic device 100.
The electronic device 100 may be the electronic device 100 described above.
Referring to fig. 10, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 500 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 500 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 500 includes a non-volatile computer-readable storage medium. The computer readable storage medium 500 has storage space for program code 510 for performing any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 510 may be compressed, for example, in a suitable form.
For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (8)

1. A method for identifying earphone keys is applied to an electronic device, and comprises the following steps:
when an insertion event of an earphone provided with a key is detected, timing is started, wherein the earphone is a four-section earphone, and the starting point of the timing is the reporting time of the insertion event of the four-section earphone;
obtaining system delay of the electronic equipment, wherein the system delay comprises delay time in the process of executing an operation instruction by the electronic equipment, and the system delay comprises a plurality of periodically acquired system delays;
taking the minimum value of the plurality of system delays as a target system delay;
configuring the target system delay as a reference time limit;
judging whether the timing meets the reference time limit or not;
if the timing is not less than the reference time limit, judging that the timing meets the reference time limit, starting to monitor whether a touch event of the earphone key exists, and if the touch event of the earphone key exists, identifying the monitored touch event of the earphone key;
executing an operation corresponding to the touch event;
wherein the method further comprises:
and adjusting a collection period for collecting the system delays according to the use frequency of the four-section type earphone, and shortening the collection period after the number of times of awakening a voice assistant or calling an application program through a touch event of the four-section type earphone exceeds a target threshold value within a specified time length.
2. The method of claim 1, wherein the method further comprises: when an insertion event of an earphone provided with a key is detected, starting an application program associated with touch operation of the earphone key in a background, wherein the application program can be started in response to the touch operation of the earphone key;
the step of executing the operation corresponding to the touch event includes:
and calling an application program corresponding to the touch event from the background.
3. The method of claim 2, wherein the step of starting an application associated with a touch operation of a button of the headset in the background when an insertion event of the headset configured with the button is detected comprises:
when an insertion event of the earphone provided with the keys is detected and a touch event of the earphone keys is monitored, an application program related to touch operation of the earphone keys is started in a background.
4. The method of claim 3, wherein the step of starting an application associated with the touch operation of the earphone key in the background when the insertion event of the earphone configured with the key is detected and the touch event of the earphone key is detected further comprises:
acquiring an application program which is currently started by a background and is associated with touch operation of the earphone key;
detecting whether other application programs belonging to the same class as the associated application program exist or not;
and if other application programs of the same type as the associated application program are detected to exist, starting the other application programs in the background.
5. The method as claimed in any one of claims 1-4, wherein the reference time period is 200 ms and 300 ms.
6. An apparatus for identifying a key of a headset, the apparatus, when operating in an electronic device, comprising:
the timing module is used for starting timing when detecting an insertion event of an earphone provided with a key, wherein the earphone is a four-section earphone, and the starting point of the timing is the reporting time of the insertion event of the four-section earphone;
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring system delay of the electronic equipment, the system delay comprises delay time in the process of executing an operation instruction by the electronic equipment, and the system delay comprises a plurality of system delays which are acquired periodically; taking the minimum value of the plurality of system delays as a target system delay;
the configuration module is used for configuring the target system delay as a reference time limit;
the judging module is used for judging whether the timing meets the reference time limit;
the identification module is used for judging whether the timing meets the reference time limit if the timing is not less than the reference time limit, starting to monitor whether a touch event of the earphone key exists, and identifying the monitored touch event of the earphone key if the touch event of the earphone key exists;
the execution module is used for executing the operation corresponding to the touch event;
the acquisition module is further used for adjusting an acquisition cycle for acquiring the system delays according to the use frequency of the four-section type earphone, and shortening the acquisition cycle after a voice assistant is awakened or an application program is called through a touch event of the four-section type earphone within a specified time length and the number of times exceeds a target threshold.
7. An electronic device comprising one or more processors and memory;
one or more programs stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-5.
8. A computer-readable storage medium, having program code stored therein, wherein the program code when executed by a processor performs the method of any of claims 1-5.
CN201910038412.7A 2019-01-16 2019-01-16 Method and device for identifying earphone keys and electronic equipment Active CN109831714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910038412.7A CN109831714B (en) 2019-01-16 2019-01-16 Method and device for identifying earphone keys and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910038412.7A CN109831714B (en) 2019-01-16 2019-01-16 Method and device for identifying earphone keys and electronic equipment

Publications (2)

Publication Number Publication Date
CN109831714A CN109831714A (en) 2019-05-31
CN109831714B true CN109831714B (en) 2020-08-25

Family

ID=66861107

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910038412.7A Active CN109831714B (en) 2019-01-16 2019-01-16 Method and device for identifying earphone keys and electronic equipment

Country Status (1)

Country Link
CN (1) CN109831714B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111862975A (en) * 2020-07-15 2020-10-30 百度在线网络技术(北京)有限公司 Intelligent terminal control method, device, equipment, storage medium and system
CN114816035A (en) * 2021-01-13 2022-07-29 上海博泰悦臻网络技术服务有限公司 Interactive event based processing method, system, medium, equipment and transmission system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778319A (en) * 2009-12-11 2010-07-14 宇龙计算机通信科技(深圳)有限公司 Method, system and mobile terminal for preventing misjudgment of earphone keystroke detection
CN103118191A (en) * 2013-01-28 2013-05-22 Tcl通讯(宁波)有限公司 Using control method and mobile terminal for iPhone wire control earphone
WO2014055312A1 (en) * 2012-10-02 2014-04-10 Mh Acoustics, Llc Earphones having configurable microphone arrays
CN104333652A (en) * 2014-09-26 2015-02-04 广州酷狗计算机科技有限公司 Operation execution method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8861743B2 (en) * 2008-05-30 2014-10-14 Apple Inc. Headset microphone type detect
CN104821981B (en) * 2015-03-13 2017-11-07 惠州Tcl移动通信有限公司 A kind of detection method of earphone operation
CN204697248U (en) * 2015-05-26 2015-10-07 集怡嘉数码科技(深圳)有限公司 A kind of mobile terminal device and earphone base thereof
CN205622817U (en) * 2016-05-23 2016-10-05 敲敲科技(北京)有限公司 Button control circuit of earphone
CN107635179A (en) * 2016-07-18 2018-01-26 联想移动通信科技有限公司 A kind of method of adjustment of earphone impedance, device and terminal
CN206601696U (en) * 2016-12-05 2017-10-31 深圳市蜗爱生活科技开发有限公司 Activated Phone the intelligent terminal of control by the key of hardware one

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778319A (en) * 2009-12-11 2010-07-14 宇龙计算机通信科技(深圳)有限公司 Method, system and mobile terminal for preventing misjudgment of earphone keystroke detection
WO2014055312A1 (en) * 2012-10-02 2014-04-10 Mh Acoustics, Llc Earphones having configurable microphone arrays
CN103118191A (en) * 2013-01-28 2013-05-22 Tcl通讯(宁波)有限公司 Using control method and mobile terminal for iPhone wire control earphone
CN104333652A (en) * 2014-09-26 2015-02-04 广州酷狗计算机科技有限公司 Operation execution method and device

Also Published As

Publication number Publication date
CN109831714A (en) 2019-05-31

Similar Documents

Publication Publication Date Title
KR101932210B1 (en) Method, system for implementing operation of mobile terminal according to touching signal and mobile terminal
CN108509176B (en) Method and device for playing audio data, storage medium and intelligent terminal
CN107783803B (en) System optimization method and device of intelligent terminal, storage medium and intelligent terminal
CN108153647B (en) Log processing method and device, terminal equipment and storage medium
EP3432136B1 (en) Sound effect configuration method and related device
CN110784858B (en) Bluetooth device control method and device, electronic device and storage medium
CN108920195B (en) Boot processing method and related product
CN108038231B (en) Log processing method and device, terminal equipment and storage medium
CN108132735B (en) Terminal and application control method
CN107943269B (en) Scheduling job control method, device, terminal equipment and storage medium
CN110876180B (en) Power consumption processing method and device, electronic equipment and computer readable medium
CN109033247B (en) Application program management method and device, storage medium and terminal
US20210144498A1 (en) Method for Detecting Blocking of Microphone and Related Products
CN110703944B (en) Touch data processing method and device, terminal and storage medium
CN110491419B (en) Playing control method, system and terminal equipment
CN109831714B (en) Method and device for identifying earphone keys and electronic equipment
CN115622177B (en) Charging method, mobile terminal and storage medium
CN107766177A (en) Start optimization method, device, storage medium and terminal device
CN110058980B (en) Terminal start time early warning method, electronic device and computer readable storage medium
CN110956968A (en) Voice wake-up and voice wake-up function triggering method and device, and terminal equipment
US10863521B1 (en) Broadcast receiver control method and apparatus, and mobile terminal
WO2016172846A1 (en) Blowing action-based method for operating mobile terminal and mobile terminal
CN110570830B (en) Equipment adjusting method and device, storage medium and electronic equipment
CN108021301A (en) A kind of volume adjusting method, terminal device and computer-readable recording medium
WO2019071380A1 (en) Sleep control method, terminal, and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant