An Interrupt Handling Method and an Electronic Device
By performing NFC power-down operation when the preset conditions are met, the power consumption and heating problems caused by the NFC object being close to the mobile phone are solved, which extends the standby time and ensures the normal use of the NFC function.
Patent Information
- Application Number
- CN202310152277.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-07
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2043-02-07
AI Technical Summary
When the NFC object approaches the mobile phone, it causes the mobile phone to generate a large number of interrupt signals, increasing power consumption and heating problems, and shortening the standby time.
When the electronic device senses the NFC product, it is determined whether the preset power down condition is met. If it is not in the preset geofence, the time difference is greater than the preset value or the mode is a preset non-use mode. If it is satisfied, the NFC power down operation will be performed to reduce the number of times of processing interrupt signals.
Reduce power consumption of electronic devices, extend standby time, avoid heating problems, and ensure normal processing of NFC interrupt signals when necessary, improving user experience.
Smart Images

Figure CN117119566B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of terminals, and in particular, to an interrupt processing method and an electronic device. Background Art
[0002] With the development and popularization of near field communication (NFC) technology, more and more electronic devices (such as mobile phones) use NFC technology. When an NFC object (such as a bus card or a car key) approaches the NFC sensing area of a mobile phone, the mobile phone is triggered to generate an NFC interrupt signal and process the NFC interrupt signal.
[0003] In daily life, when a user has no need to use the NFC function of a mobile phone and places the mobile phone and the NFC object together, the NFC object approaches the mobile phone for a long time, and the mobile phone generates and processes a large number of NFC interrupt signals, resulting in a relatively fast power consumption of the electronic device, a shortened standby time, and a heating problem. For example, a user often puts a bus card and a mobile phone in a pocket or a bag together, and the bus card remains in a close state with the mobile phone, triggering the mobile phone to generate a large number of NFC interrupt signals and requiring processing of the large number of NFC interrupt signals. Summary of the Invention
[0004] In view of this, this application provides an interrupt processing method and an electronic device, which can reduce the power consumption of the electronic device.
[0005] In a first aspect, this application provides an interrupt processing method. When an electronic device senses an NFC product, the electronic device performs an NFC power-down operation when it determines that the electronic device meets a preset power-down condition; wherein, the NFC power-down operation is used to trigger the power-down of the NFC device in the electronic device.
[0006] The preset power-down condition represents a condition where the user does not use the NFC function of the electronic device; the preset power-down condition includes at least one of not being within a preset geographical fence, the time difference between the current time and a preset common NFC time being greater than a preset time difference, the distance between the current location of the electronic device and a preset common NFC location being greater than a preset distance difference, and the electronic device being in a preset NFC non-use mode.
[0007] In this application, when the electronic device senses an NFC product, the electronic device generates an NFC interrupt signal. Therefore, the electronic device can determine whether the electronic device meets the preset power-down condition. If it does, it indicates that the electronic device is in a scenario where the user does not use the NFC function of the electronic device. Therefore, the electronic device can perform NFC power-down, so that the electronic device can avoid generating and processing NFC interrupt signals, reduce the power consumption of the electronic device, thereby reducing the power consumption of the electronic device, effectively extending the standby time of the electronic device, and avoiding the heating problem of the electronic device caused by the need to process a large number of NFC interrupt signals.
[0008] Exemplarily, the above preset NFC non-use mode may include at least one of a pocket mode, a pocket and motion combination mode, a stationary mode, and a black screen mode; the pocket and motion combination mode represents a combination mode of the pocket mode and the motion mode.
[0009] In a possible implementation manner of the first aspect, when the electronic device senses an NFC product, within the first time period, the electronic device generates a first number of NFC interrupt signals;
[0010] For the first number of NFC interrupt signals, the electronic device initiates a first number of interrupt processes, that is, executes the first number of interrupt processes. After the end of the first time period, the electronic device determines whether the first number is greater than a first preset threshold.
[0011] If not, the electronic device can re-enter the first time period. If so, the electronic device determines whether the electronic device meets the preset power-down condition.
[0012] When it is determined that the electronic device meets the preset power-down condition, an NFC power-down operation is performed.
[0013] In this application, when the electronic device senses an NFC product, the electronic device can generate an NFC interrupt signal. The electronic device counts the number of NFC interrupt signals generated by the electronic device within the first time period. After the end of the first time period, the electronic device determines whether the number of NFC interrupt signals generated within the first time period is greater than a first preset threshold. If it is greater, it indicates that the electronic device generates a large number of NFC interrupt signals, and the electronic device can determine whether the electronic device meets the preset power-down condition. If not, it indicates that the number of NFC interrupt signals generated by the electronic device is small, and the power consumption of the electronic device for processing NFC interrupts is small. The electronic device does not need to be powered down. Therefore, the electronic device can continue to enter the first time period to continue to determine whether the electronic device generates a large number of NFC interrupt signals.
[0014] In a possible implementation of the first aspect, when the electronic device determines that it does not meet the above-mentioned preset power-down condition, the electronic device processes the NFC interruption signal generated by the electronic device and can re-enter the first time period to make the next round of judgment.
[0015] In this application, if the power-down condition is not met, it indicates that the electronic device is in a scenario where the user uses the NFC function of the electronic device. Therefore, the electronic device can continue to normally process the NFC interruption signal generated by the electronic device, so that when the electronic device is used as a virtual NFC object by the user, relevant NFC services can also be successfully processed, ensuring the user experience.
[0016] In a possible implementation of the first aspect, the NFC power-down operation is used to trigger the periodic power-down of the NFC device. Based on this, both the power consumption of the electronic device can be reduced, and the electronic device can normally process the NFC interruption signal generated by the electronic device.
[0017] In a possible implementation of the first aspect, after the electronic device performs the NFC power-down operation, that is, when the electronic device is in the NFC power-down state, the electronic device performs the NFC power-up operation when it determines that it does not meet the preset power-down condition; wherein, the NFC power-up operation is used to trigger the power-up of the NFC device. Based on this, the normal use of the NFC function of the electronic device by the user can be ensured.
[0018] In a possible implementation of the first aspect, after the electronic device performs the NFC power-down operation, in response to the user's operation of turning on the NFC control switch of the electronic device, the electronic device performs the NFC power-up operation; wherein, the NFC power-up operation is used to trigger the power-up of the NFC device. Based on this, the NFC can be quickly powered up, enabling the user to normally use the NFC function of the mobile phone and improving user satisfaction.
[0019] In a possible implementation of the first aspect, after the above-mentioned first time period, due to a large number of NFC interruption signals being generated within the first time period, the electronic device can display a first prompt message. The first prompt message is used to prompt the user that an abnormal NFC product touches the electronic device, and it is recommended that the user place the electronic device and the NFC product separately, that is, it is recommended that the user do not put the electronic device and the NFC product together to avoid the generation of an NFC interruption storm by the electronic device.
[0020] In another possible implementation of the first aspect, the process of the above-mentioned interruption handling may include:
[0021] When the target NFC application of the electronic device receives an NFC broadcast message, it processes the NFC interruption based on the NFC broadcast message. The target NFC application refers to the NFC application registered in the electronic device to listen for NFC messages; the NFC broadcast message is generated based on an NFC interruption event; the NFC interruption event is generated based on any first NFC interruption signal generated by the electronic device within the first time period; the NFC broadcast message includes the identifier and / or the type of the NFC product, thereby achieving successful processing of the NFC interruption signal. That is to say, the interruption processing may include generating an NFC interruption event, sending an NFC broadcast message, and launching the target NFC application.
[0022] Exemplarily, the determination process of the above-mentioned target NFC application is as follows:
[0023] In one example, the number of NFC applications of the above-mentioned electronic device is multiple, indicating that multiple NFC applications can process the above-mentioned NFC interruption signal. Therefore, the electronic device can perform target interruption processing and display a second prompt message. The second prompt message includes options for at least one NFC application, which are used to prompt the user to select the NFC application for processing the NFC product; wherein, the above-mentioned target NFC application is the NFC application selected by the user. The target interruption processing can be any one of the interruption processes that the electronic device needs to execute. For example, the target interruption processing is the first interruption processing among the above-mentioned first number of interruption processes.
[0024] In another example, the number of NFC applications on the above-mentioned electronic device is multiple, and a default NFC application is set among the NFC applications. The above-mentioned target NFC application can be the default NFC application.
[0025] In another example, the foreground application of the electronic device is an NFC application, indicating that the NFC application may be the NFC application that the user wants to use. Then, the above-mentioned target NFC application can be the NFC application indicated by the foreground application.
[0026] In another example, when the foreground interface of the electronic device is the NFC interface in the NFC application, it indicates that the NFC application occupies the relevant NFC resources of the mobile phone. The above-mentioned target NFC application can be the NFC application, and the NFC interface indicates the interface providing the NFC function in the NFC application.
[0027] In a possible implementation of the first aspect, initiating one instance of the interrupt handling includes generating an NFC interrupt event, sending an NFC broadcast message, and launching at least one of the target NFC applications; that is, when the electronic device initiates one instance of the interrupt handling, it can execute all or part of the steps in the above-described interrupt handling. That is to say, initiating one instance of the interrupt handling can execute steps such as generating an NFC interrupt event, sending an NFC broadcast message, and launching at least one of the target NFC applications. Exemplarily, when the electronic device initiates N (such as the above-mentioned first quantity) instances of the interrupt handling, the electronic device can execute generating N NFC interrupt events, sending N NFC broadcast messages, and launching at least one of the target NFC applications N times.
[0028] In a second aspect, the present application provides an electronic device, which includes an NFC device, a display screen, a memory, and one or more processors; the display screen, the memory, the NFC device, and the processor are coupled;
[0029] The display screen is used to display images generated by the processor, and the memory is used to store computer program code, and the computer program code includes computer instructions;
[0030] The NFC device is used to sense NFC products and generate NFC interrupt signals;
[0031] The processor is used to determine that the electronic device meets a preset power-down condition and trigger the power-down of the NFC device;
[0032] The preset power-down condition includes at least one of the electronic device not being within a preset geographical fence, the time difference between the current time and a preset common NFC time being greater than a preset time difference value, the distance between the current location of the electronic device and a preset common NFC location being greater than a preset distance difference value, and the electronic device being in a preset NFC non-use mode.
[0033] Exemplarily, when the processor executes the computer instructions, the electronic device is caused to execute the method described in the above first aspect and any of its possible implementations.
[0034] In a possible implementation of the second aspect, within a first time period, the NFC device generates a first quantity of NFC interrupt signals and sends the first quantity of NFC interrupt signals to the processor;
[0035] The processor is used to initiate the first quantity of interrupt handling for the first quantity of NFC interrupt signals.
[0036] In another possible implementation of the second aspect, the Linux kernel on the processor is used to generate an NFC interrupt event for the NFC interrupt signal and send the NFC interrupt event to the NFC process in the electronic device.
[0037] The NFC process is used to send an NFC broadcast message for the NFC interrupt event. The NFC broadcast message is used to trigger the target NFC application in the electronic device to process the NFC interrupt for the NFC broadcast message.
[0038] In a third aspect, the present application provides a chip, which is used to determine that the electronic device where the chip is located meets a preset power-down condition and trigger the power-down of the NFC device in the electronic device;
[0039] The preset power-down condition includes that the electronic device is not within a preset geographical fence, the time difference between the current time and the preset common NFC time is greater than a preset time difference value, the distance between the current location of the electronic device and the preset common NFC location is greater than a preset distance difference value, and the electronic device is in at least one of the preset NFC non-use modes.
[0040] Exemplarily, the above chip may also be referred to as an application processor AP, an AP processor, an AP chip, a processor, etc.
[0041] In a fourth aspect, the present application provides a computer-readable storage medium, including computer instructions, which when running on an electronic device, cause the electronic device to execute the method described in the first aspect and any of its possible implementation manners above.
[0042] In a fifth aspect, the present application provides a computer program product, which when running on an electronic device, causes the electronic device to execute the method described in the first aspect and any of its possible implementation manners above.
[0043] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the chip described in the third aspect, the computer storage medium described in the fourth aspect, and the computer program product described in the fifth aspect above can refer to the beneficial effects in the first aspect and any of its possible implementation manners, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1A It is a schematic diagram of an NFC object display interface provided by an embodiment of the present application;
[0045] Figure 1B It is a schematic diagram of swiping a card provided by an embodiment of the present application;
[0046] Figure 2AA touch schematic diagram provided by an embodiment of this application;
[0047] Figure 2B An NFC product interaction schematic diagram provided by an embodiment of this application;
[0048] Figure 3 A hardware structure schematic diagram of an electronic device provided by an embodiment of this application;
[0049] Figure 4 A structural block diagram of an electronic device provided by an embodiment of this application;
[0050] Figure 5 A flowchart schematic diagram of an interrupt processing method provided by an embodiment of this application;
[0051] Figure 6 A prompt information display schematic diagram one provided by an embodiment of this application;
[0052] Figure 7A A prompt information display schematic diagram two provided by an embodiment of this application;
[0053] Figure 7B A prompt information display schematic provided by an embodiment of this application Figure Three ;
[0054] Figure 7C An NFC setting interface display schematic diagram provided by an embodiment of this application;
[0055] Figure 8 An interrupt request processing flow execution schematic diagram provided by an embodiment of this application;
[0056] Figure 9A An NFC interrupt signal processing flow schematic diagram one provided by an embodiment of this application;
[0057] Figure 9B An NFC interrupt signal processing flow schematic diagram two provided by an embodiment of this application;
[0058] Figure 10A A log display schematic diagram one provided by an embodiment of this application;
[0059] Figure 10B A log display schematic diagram two provided by an embodiment of this application;
[0060] Figure 10C A log display schematic provided by an embodiment of this application Figure Three ;
[0061] Figure 10D A log display schematic provided by an embodiment of this application Figure Four ;
[0062] Figure 10E A schematic diagram of log display provided by an embodiment of the present application Figure Five ;
[0063] Figure 11 A schematic diagram of a power-down control process provided by an embodiment of the present application. Detailed implementation manners
[0064] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of this embodiment, unless otherwise specified, the meaning of "a plurality" is two or more.
[0065] A user can bring an NFC object (such as an NFC card, a car key, etc.) close to a mobile phone (such as close to the NFC sensing area of the mobile phone) to trigger the mobile phone to generate an NFC interruption signal and process the NFC interruption, so that the mobile phone adds the information of the NFC object, enabling the user to use the virtual NFC object based on the NFC function of the mobile phone. Herein, the NFC object may include NFC objects such as NFC cards, car keys, etc. Exemplarily, the NFC card may include an access control card, a bus card, a bank card, a recharge card, etc. For example, as Figure 1A shown, the electronic device 200 has added the information of a bus card. When the user needs to pay transportation fees, as Figure 1B shown, the user can bring the electronic device 200 with the NFC switch turned on close to the card reader 101 on the bus. Here, the electronic device 200 can act as a bus card and can pay transportation fees.
[0066] It should be understood that the above-mentioned "close" may mean that the distance between two objects is relatively close (such as the electronic device 200 is very close to the card reader 101), and one object can sense the other object, or the "close" means that the two objects come into contact (such as the electronic device 200 is stuck to the card reader 101), and one object can sense the other object.
[0067] In some scenarios, an NFC object may be close to an electronic device for a long time, causing the electronic device to frequently detect the NFC object. If the NFC switch of the electronic device is turned on, when the electronic device frequently detects the NFC object, the electronic device may generate a large number of NFC interrupt signals. When the number of generated NFC interrupt signals reaches a certain level, the electronic device may experience an interrupt storm phenomenon. And for each NFC interrupt signal generated by the electronic device (i.e., an NFC interrupt occurs), the electronic device needs to perform an interrupt handling operation based on the generated NFC interrupt signal. In this application, interrupt handling refers to the process of handling an NFC interrupt in response to an NFC interrupt signal. This increases the power consumption of the electronic device, resulting in a relatively fast power consumption rate of the electronic device, and the electronic device may experience a heating problem. Also, when the electronic device is in the standby state, due to the relatively fast power consumption rate of the electronic device, the standby time of the electronic device is shortened, reducing the user's satisfaction. For example, the NFC object is a bus card. Users often put the bus card and the mobile phone in the pocket or bag of their clothes. Due to limited space, the bus card is likely to be close to the mobile phone (such as the bus card touches the mobile phone, or the distance between the bus card and the mobile phone is very small). As Figure 2A shown, the bus card is close to the back cover of the mobile phone 200, and the bus card touches the mobile phone 200. When the bus card frequently touches the mobile phone 200, the mobile phone generates a large number of NFC interrupt signals, and the mobile phone 200 needs to process this large number of NFC interrupt signals, resulting in a relatively fast power consumption rate of the mobile phone.
[0068] In some embodiments, as Figure 2B shown, the above-mentioned electronic device 200 may include an NFC device and an application processor (AP). When the NFC device in the electronic device 200 detects an NFC object, the NFC device may generate an NFC interrupt signal. After that, the NFC device may send the NFC interrupt signal to the AP for the AP to process the NFC interrupt signal, such as the AP transmitting data with the NFC object through the NFC device. When the NFC device frequently detects an NFC object, such as when the NFC device is close to the electronic device for a long time, the NFC device generates a large number of NFC interrupt signals, and the AP needs to process a large number of NFC interrupt signals, resulting in an increase in the power consumption of the AP and the NFC device, thus causing a relatively fast power consumption rate of the electronic device.
[0069] Exemplarily, the NFC device of the above-mentioned electronic device 200 may include an NFC chip and an NFC antenna. Among them, the NFC chip has a communication function and a certain computing ability. The NFC antenna is a near-field coupling antenna. Generally speaking, the NFC antenna is composed of a coupling coil (or called an NFC coil) and a magnetic thin film.
[0070] Exemplarily, the above-mentioned transmitted data may indicate that the AP in the electronic device 200 writes data to the NFC object through the NFC device in the electronic device 200, or the transmitted data may indicate that the AP reads data from the NFC object through the NFC device.
[0071] It should be noted that when the above-mentioned NFC object approaches the electronic device, the NFC coil in the NFC object may be a passive coil, and the NFC coil in the electronic device 200 may be an active coil. In other words, the NFC object is equivalent to a passive NFC product, and the electronic device 200 is equivalent to an active NFC product. Mutual induction occurs between the electronic device 200 and the NFC object. During the mutual induction process, the NFC object can obtain power from the NFC coil of the electronic device 200, so that the NFC object can perform communication operations (such as transmitting data to the NFC chip of the mobile phone) through this power.
[0072] Correspondingly, when the user uses a virtual NFC object (or it is described that the electronic device 200 is used as a virtual NFC object) based on the NFC function of the electronic device 200, the electronic device 200 is equivalent to a passive NFC product. As described above Figure 1B As shown, when the electronic device approaches the card swiping machine, the electronic device is equivalent to a passive NFC product, and the card swiping machine is equivalent to an active NFC product.
[0073] Therefore, in view of the above problems, the present application proposes an interrupt processing method. Considering that when the user uses a virtual NFC object such as a virtual bus card (briefly described as the electronic device being used as a virtual NFC object) based on the NFC function of the electronic device, that is, considering that the electronic device is used as a passive NFC product, the electronic device only needs to process some of the generated NFC interrupt signals to successfully implement relevant NFC services (such as paying transportation fees). Therefore, when the electronic device senses an NFC product, the electronic device can generate an NFC interrupt signal. The electronic device counts the number of NFC interrupt signals generated by the electronic device within a first time period. After the end of the first time period, the electronic device determines whether the number of NFC interrupt signals generated within the first time period is greater than a first preset threshold. If it is greater, it indicates that the electronic device generates a large number of NFC interrupt signals, and the electronic device can determine whether the electronic device meets the preset power-down condition. If it is met, it indicates that the electronic device is in a scenario where the user does not use the NFC function of the electronic device. Therefore, the electronic device can perform NFC power-down, so that the electronic device does not need to generate and process NFC interrupt signals, which can reduce the power consumption of the electronic device, thereby reducing the power consumption of the electronic device, effectively extending the standby time of the electronic device. And it can avoid the heating problem of the electronic device caused by the need to process a large number of NFC interrupt signals.
[0074] If the power-off condition is not met, it indicates that the electronic device is in a scenario where the user uses virtual NFC objects such as virtual transit cards based on the NFC function of the electronic device. Therefore, the electronic device can continue to normally process the NFC interruption signals generated by the electronic device, so that when the electronic device is used as a virtual NFC object by the user, relevant NFC services can also be successfully processed, ensuring the user experience.
[0075] Exemplarily, the electronic device in the embodiments of the present application may be a device such as a mobile phone, a tablet computer, a wearable device, a personal digital assistant (PDA), etc. that has an NFC device and an AP. The embodiments of the present application do not impose special restrictions on the specific form of the electronic device.
[0076] Exemplarily, Figure 3 shows a schematic structural diagram of the electronic device 200. As Figure 3 shown, the electronic device 200 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 interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0077] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0078] The processor 110 may include one or more processing units. For example, the processor 110 may include an AP, a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0079] Exemplarily, the above-mentioned processor 110 may be a central processing unit (CPU).
[0080] Among them, the controller may be the nerve center and command center of the electronic device 200. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0081] Among them, the AP can be used to process NFC interrupt signals.
[0082] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0083] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0084] It can be understood that the interface connection relationships among the modules illustrated in the embodiments of the present invention are only illustrative and do not constitute a structural limitation on the electronic device 200. In some other embodiments of the present application, the electronic device 200 may also adopt different interface connection methods or a combination of multiple interface connection methods in the above embodiments.
[0085] The charging management module 140 is configured to receive a charging input from a charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0086] The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0087] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: the antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0088] The mobile communication module 150 may provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device 200. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through the antenna 1 and radiate it out. In some embodiments, at least some functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.
[0089] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays images or videos through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and provided in the same device as the mobile communication module 150 or other functional modules.
[0090] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 200, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves through the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive the signal to be transmitted from the processor 110, perform frequency modulation and amplification on it, and convert it into electromagnetic waves through the antenna 2 and radiate it out.
[0091] Among them, the wireless communication module 160 may include an NFC device, which is used to provide the above-mentioned NFC wireless communication solution and can sense (i.e., detect) an NFC object or device that touches the electronic device.
[0092] Among them, the NFC device may be connected to the above-mentioned AP through a wire, and the NFC device can communicate with the AP. When the NFC device senses an external NFC object, the NFC device can generate an NFC interrupt signal and send the NFC interrupt signal to the AP so that the AP processes the NFC interrupt signal.
[0093] Exemplarily, the above-mentioned NFC device may include an NFC antenna and an NFC chip.
[0094] In some embodiments, antenna 1 of the electronic device 200 is coupled to the mobile communication module 150, and antenna 2 is coupled to the wireless communication module 160, so that the electronic device 200 can communicate with the network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0095] The electronic device 200 realizes the display function through the GPU, the display screen (i.e., the screen) 194, and the application processor, etc. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change the display information.
[0096] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 200 may include one or N display screens 194, where N is a positive integer greater than 1.
[0097] The electronic device 200 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0098] The external memory interface 120 can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device 200.
[0099] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 200 by running the instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area can store the operating system, application programs required for at least one function (such as the sound playback function, the image playback function, etc.). The storage data area can store the data created during the use of the electronic device 200 (such as audio data, phone book, etc.). In addition, the internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0100] The electronic device 200 can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor, etc. For example, music playback, recording, etc.
[0101] In some embodiments, the sensor module 180 may include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0102] The keys 190 include a power-on key, volume keys, etc. The motor 191 can generate a vibration prompt.
[0103] The indicator 192 can be an indicator light, which can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0104] The SIM card interface 195 is used to connect to a SIM card. The SIM card can be in contact with and separated from the electronic device 200 by being inserted into or pulled out of the SIM card interface 195. The electronic device 200 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 200 interacts with the network through the SIM card to implement functions such as calls and data communication. In some embodiments, the electronic device 200 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 200 and cannot be separated from the electronic device 200.
[0105] Exemplarily, the software system of the above-mentioned electronic device 200 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, the Android TM system is taken as an example to exemplarily illustrate the software structure of the electronic device 200.
[0106] Figure 4 is the block diagram of the structure of the electronic device 200 in the embodiments of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android TM system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Android runtime (AndroidTM runtime), system libraries, and the Linux kernel layer.
[0107] Among them, the above application layer may include a series of application packages. Such as Figure 4 shown, the application package may include applications such as camera, gallery, calendar, call, wallet, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0108] Exemplarily, the above wallet is an NFC application, and the application package may further include other NFC applications, and the other NFC applications indicate applications that include NFC functions, that is, applications that require the use of NFC technology.
[0109] The above application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0110] Such as Figure 4 shown, the above application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, an NFC process, etc.
[0111] The NFC process can be used to send NFC broadcast messages to the application layer to start relevant NFC applications in the application layer. Exemplarily, the NFC process runs in the com.android.nfc process, and the application program file corresponding to this process is named Nfc.apk.
[0112] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0113] The content provider is used to store and obtain data, and make these data accessible to applications. The data may include video, image, audio, incoming and outgoing calls, browsing history and bookmarks, phone book, etc.
[0114] The view system includes visible controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
[0115] The telephone manager is used to provide the communication function of the electronic device 200. For example, the management of call status (including answering, hanging up, etc.).
[0116] The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
[0117] The notification manager enables the application to display notification information in the status bar. It can be used to convey message types of notifications, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of background running applications, and can also be a notification that appears on the screen in the form of a dialog window. For example, it can prompt text information in the status bar, emit a prompt sound, vibrate the electronic device, blink the indicator light, etc.
[0118] The above Android TM runtime includes core libraries and a virtual machine. Android TM runtime is responsible for the scheduling and management of the Android system.
[0119] The core libraries include two parts: one is the functional functions that the Java language needs to call, and the other is the core libraries of Android.
[0120] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0121] The system libraries can include multiple functional modules. For example: Surface Manager (surfacemanager), Media Libraries, 3D graphics processing libraries (such as: OpenGLES), 2D graphics engines (such as: SGL), etc.
[0122] The Surface Manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0123] The Media Libraries support the playback and recording of various common audio and video formats, as well as static image files, etc. The Media Libraries can support multiple audio and video coding formats, such as, MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0124] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0125] The 2D graphics engine is a graphics engine for 2D drawing.
[0126] The above-mentioned Linux kernel layer is the layer between hardware and software. The Linux kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver. The Linux kernel layer can communicate with the hardware layer. For example, the hardware layer may include an AP and an NFC device. Correspondingly, the hardware layer can communicate with the upper-layer application through the Linux kernel layer (i.e., the Linux kernel) to implement the processing of NFC interrupt signals.
[0127] Exemplarily, in combination with the above Figure 2B , as described above Figure 4 As shown, the generation of an NFC interrupt signal and the processing process of the NFC interrupt signal may include steps a - d.
[0128] a: When the above-mentioned NFC device senses an NFC object, it can send the NFC interrupt signal to the above-mentioned AP.
[0129] Optionally, when the NFC device senses an NFC object, it can generate an NFC interrupt signal.
[0130] Exemplarily, when the NFC object approaches the sensing area of the NFC device (i.e., the NFC sensing area of the electronic device), the NFC device can sense the NFC object. In this application, the NFC object approaching the NFC sensing area of the electronic device means that the distance between the NFC object and the NFC sensing area of the electronic device is less than a preset distance, and the preset distance can be 10 cm, 5 cm, etc.
[0131] Among them, a manifestation of the NFC object approaching the NFC device can be: the NFC object touches the NFC sensing area of the electronic device, and the distance between the two is 0, as shown in the above Figure 2A where the bus card touches the mobile phone 200, and the bus card approaches the mobile phone 200. Another manifestation can be: the distance between the NFC object and the NFC sensing area of the electronic device is very small, but there is no touch.
[0132] When the NFC device senses the NFC object, it can generate an NFC interrupt signal. Thus, when the NFC device continuously senses the NFC object, it can continuously generate an NFC interrupt signal and continuously send the NFC interrupt signal to the AP.
[0133] Exemplarily, when the NFC object remains close to the NFC sensing area of the electronic device, the NFC device in the electronic device can continuously sense the NFC object.
[0134] It should also be noted that the above-mentioned NFC sensing area of the electronic device can be in the top area of the back cover of the electronic device or the middle area of the back cover of the electronic device.
[0135] b: After the AP receives the NFC interrupt signal, the Linux kernel layer processes the NFC interrupt signal.
[0136] Exemplarily, after the NFC interrupt process in the Linux kernel layer receives the NFC interrupt signal, it can read the data of the NFC object (such as information like the identifier and type of the NFC object), and save it to the buffer area of the Linux kernel layer.
[0137] c: In response to the NFC interrupt signal, the above-mentioned Linux kernel layer sends an NFC interrupt event to the NFC process.
[0138] It should be noted that the NFC process can also be called the NFC module. When the NFC process reads the NFC interrupt event, it needs to enter the kernel state (or the operating system state) from the user state to directly access the underlying data. When the interrupt is triggered, the NFC process switches from the user state to the operating system state. Among them, the user state can also be called the application program state. When the NFC process is in the application program state, data access is restricted and it cannot access the underlying data.
[0139] d: After the NFC process receives the above-mentioned NFC interrupt event, it sends an NFC broadcast message. The wallet application receives the NFC broadcast message and processes the NFC interrupt based on the NFC broadcast message.
[0140] In some embodiments, after the NFC process receives the above-mentioned NFC interrupt event, it reads the data of the NFC object from the buffer area of the above-mentioned Linux kernel layer. Exemplarily, before the NFC process reads the buffer area of the Linux kernel layer, it needs to switch from the user state to the kernel state.
[0141] It can be understood that the NFC process can be a structure, which has a first flag bit and a second flag bit. The first flag bit indicates that the NFC process has the permission to access the buffer area of the Linux kernel layer; the second flag bit indicates whether the NFC process is currently in the kernel state or the user state.
[0142] The kernel state indicates the state that can access peripherals, AP registers, and the memory of the Linux kernel layer. When the process is in the user state, it cannot access peripherals, AP registers, and the buffer area of the Linux kernel layer.
[0143] Among them, the peripheral can be a device other than the AP, such as an NFC device, a Bluetooth chip, a Wi-Fi chip, etc.
[0144] Optionally, the scenarios for accessing AP registers can include configuring the level of pins (such as when controlling certain peripherals, it is necessary to adjust the pin voltage corresponding to the peripheral), the application program calling the internal timer of the AP, adjusting the CPU frequency point, etc.
[0145] Optionally, scenarios for accessing the memory of the Linux kernel layer may include data reading and writing using a virtual file system (VFS).
[0146] In some embodiments, after receiving an NFC interrupt event, the NFC process may determine whether the event type corresponding to the NFC interrupt event belongs to a first preset type. The first preset type indicates the type that requires application processing. Exemplarily, when the NFC interrupt process reads valid data of an NFC object (such as information about the type of the NFC object), the event type corresponding to the NFC interrupt event may be the first preset type. For example, when an NFC device has an abnormality and generates an NFC interrupt signal but may not be able to successfully read the data of the NFC object, correspondingly, the event type corresponding to the NFC interrupt event is not the first preset type. For another example, when the communication protocol between the NFC device and the NFC object is different, causing the NFC device to be unable to successfully read the data of the NFC object, correspondingly, the event type corresponding to the NFC interrupt event is not the first preset type. For another example, during the process of the NFC device reading the data of the NFC object, if the NFC object moves away from the NFC device, that is, the NFC object is no longer close to the NFC device, resulting in a failed data reading, correspondingly, the event type corresponding to the NFC interrupt event is not the first preset type.
[0147] Exemplarily, the NFC broadcast message may include information such as the identifier and type of the above-mentioned NFC object.
[0148] It can be understood that the Linux kernel runs on the AP of the electronic device 200. The above-mentioned Android system runs on the Linux kernel.
[0149] In order to reduce the power consumption of the electronic device, after determining that a large number of NFC interrupt signals are generated, the electronic device in this application may only process some of the NFC interrupt signals instead of all of them, thereby reducing the power consumption caused by the electronic device processing the NFC interrupt signals. The application scenarios of the technical solution of this application will be described below in combination with several examples.
[0150] In a scenario, when an NFC object approaches an electronic device, the electronic device senses the NFC object and generates an NFC interrupt signal. When the electronic device continues to approach the electronic device, the electronic device continuously (or is described as frequently) senses the NFC object, and the electronic device will generate a large number of NFC interrupt signals. For example, when an NFC card and the electronic device are placed together in a limited space such as a pocket or a backpack for a long time, the NFC card continuously approaches the electronic device, such as the NFC card frequently touches the electronic device. The electronic device frequently senses the NFC object and generates a large number of NFC interrupt signals. To reduce the power consumption required for the mobile phone to process a large number of NFC interrupt signals, the electronic device can only process some of the NFC interrupt signals.
[0151] In another scenario, when a first device supporting the NFC function approaches an electronic device, after the electronic device senses the first device, it generates an NFC interrupt signal. When the first device continues to be in a state of approaching the electronic device, the electronic device will generate a large number of NFC interrupt signals. The first device may include devices with NFC components such as mobile phones, tablets, wearable devices, and personal digital assistants. For example, the first device is mobile phone 1 and the electronic device is mobile phone 2. When mobile phone 1 and mobile phone 2 are placed together for a long time, mobile phone 2 will also generate a large number of NFC interrupt signals. Therefore, to reduce the power consumption required for processing a large number of NFC interrupt signals, the electronic device can only process some of the NFC interrupt signals.
[0152] In another scenario, when a user uses a virtual NFC object such as a virtual bus card based on the NFC function of an electronic device, the NFC chip on the electronic device will still continue to work for a certain period of time. Correspondingly, it will also continuously generate NFC interrupt signals. After passing through this certain period of time, the NFC chip will enter the sleep state. For example, after the user uses the virtual bus card on the electronic device to swipe the card reader on the bus (which can be briefly described as the electronic device swiping the bus card), the NFC chip on the electronic device will still generate a large number of NFC interrupt signals. Therefore, the electronic device can only process some of the NFC interrupt signals.
[0153] Of course, the technical solution of this application can also be applied to other scenarios that require generating a large number of NFC interrupt signals. Here, they will not be elaborated one by one.
[0154] Next, taking the above-mentioned electronic device as a mobile phone as an example, a method for interrupt processing provided by an embodiment of this application will be specifically introduced in combination with the accompanying drawings. As Figure 5 shown, this method includes S301 - S305.
[0155] S301. The mobile phone senses the NFC object and generates N NFC interrupt signals within the first time period.
[0156] Optionally, after detecting an NFC touch operation, the mobile phone generates an NFC interrupt signal in response to the NFC touch operation. Here, the NFC trigger operation indicates that when an NFC object touches the mobile phone (such as the NFC sensing area of the mobile phone), the mobile phone senses the NFC object and generates an NFC interrupt signal.
[0157] It should be understood that the touch between the above-mentioned NFC object and the mobile phone is an example of the NFC object approaching the mobile phone (or described as the NFC object and the mobile phone being in a proximity state). When there is no touch between the NFC object and the mobile phone but the distance is very small, the mobile phone can also sense the NFC object and generate an NFC interrupt signal. Here, the very small distance between the NFC object and the mobile phone is also a situation where the NFC object approaches the mobile phone.
[0158] Here, the solution of the present application is introduced by taking the NFC object as an example. When the mobile phone approaches an NFC product, an NFC interrupt signal can be generated. After generating the NFC interrupt signal, the mobile phone can adopt the solution disclosed in the present application to process the NFC interrupt signal. Exemplarily, the NFC product includes NFC objects (such as NFC cards like bank cards, bus cards, recharge cards, access control cards, etc., and car keys) and NFC devices (such as card readers, mobile phones, etc.) and other electronic products using NFC technology.
[0159] S302. For the N NFC interrupt signals within the first time period, the mobile phone performs N interrupt processes.
[0160] In the embodiment of the present application, when the mobile phone senses an NFC object, the mobile phone can generate an NFC interrupt signal. Since it is necessary to determine whether the mobile phone generates a large number of NFC interrupt signals, and considering the situation where the user uses virtual NFC objects such as virtual bus cards based on the NFC function of the mobile phone, within the first time period, when the mobile phone continuously senses the NFC object, the mobile phone can continuously generate NFC interrupt signals. Every time the mobile phone generates an NFC interrupt signal, the mobile phone can directly perform an interrupt process (such as an interrupt request (IRQ) processing flow) based on the NFC interrupt signal, so that the NFC interrupt signals within the first time period are properly processed. Thus, when the NFC object sensed by the above-mentioned mobile phone is actually an NFC device, in other words, the NFC interrupt signals generated by the above-mentioned mobile phone are actually generated when the user can use virtual NFC objects such as virtual bus cards based on the NFC function of the mobile phone (or described as the mobile phone being used as a virtual NFC object), it can ensure that relevant NFC services can be successfully processed and meet the user's normal demand for using the relevant NFC functions of the mobile phone.
[0161] In some embodiments, every time the mobile phone generates an NFC interruption signal, a counter can be used for counting once, so that the number of NFC interruption signals generated within a time period (such as the above-mentioned first time period) can be determined, for the mobile phone to use the number of NFC interruption signals generated within the first time period to determine whether NFC power-down is required after the end of the first time period. The first time period can be the moment after the mobile phone starts to generate NFC interruption signals, such as the time when the mobile phone generates the first NFC interruption signal. For example, after the mobile phone senses an NFC object, at each preset period, the number of NFC interruption signals generated within the preset period is counted. The time length of one preset period here is one time period. After the end of one preset period, the mobile phone can determine whether the number of NFC interruption signals generated within the one preset period is greater than a first preset threshold. If so, the mobile phone can determine whether the mobile phone meets the preset power-down condition. If it meets the condition, the mobile phone can perform power-down. If it does not meet the condition, the mobile phone can continue to count the number of NFC interruption signals generated within the next preset period for the next round of determination. Here, one preset period can be one of the above-mentioned first time periods.
[0162] Among them, the duration of the above-mentioned preset period can be set according to actual needs. Generally speaking, the preset period can be the duration when the mobile phone is used for an NFC object. For example, when paying transportation fees, the duration when the user touches the mobile phone to the card swiping machine, that is, the duration when the mobile phone swipes the bus card.
[0163] Optionally, the time when the mobile phone senses the first NFC interruption signal generated by the NFC object can be regarded as the start time of the first preset period.
[0164] In some embodiments, after the mobile phone generates an NFC interruption signal, if the value of flag 1 (or called the first flag) is the first preset identifier, it indicates that the mobile phone generates a large number of NFC interruption signals, and the mobile phone can determine whether the mobile phone meets the preset power-down condition. If the value of flag 1 is the second preset identifier, it indicates that the mobile phone does not generate a large number of NFC interruption signals, and the time period where the NFC interruption signal is located can be the first time period, and the mobile phone can continue to count it.
[0165] In some other embodiments, after the mobile phone generates an NFC interruption signal, it can be determined whether there is a flag 2 (or called the second flag) in the mobile phone. If not, it indicates that the mobile phone does not generate a large number of NFC interruption signals, and the time period where the NFC interruption signal is located can be the first time period, and the mobile phone can continue to count it. If there is a flag 2, it indicates that the mobile phone generates a large number of NFC interruption signals, and the mobile phone can determine whether the mobile phone meets the preset power-down condition.
[0166] It should be understood that whether the above mobile phone is in the standby state or the working state, when an NFC object approaches the mobile phone and the mobile phone senses the NFC object, an NFC interrupt signal can be generated.
[0167] Exemplarily, the process of the above mobile phone performing interrupt processing based on the NFC interrupt signal may include: First, the mobile phone may generate (or be described as generating) an NFC interrupt event based on the NFC interrupt signal. Among them, the NFC interrupt event may include information such as the identifier of the NFC product (such as the above NFC object) corresponding to the NFC interrupt signal and the type of the NFC product. After that, the mobile phone may generate an NFC broadcast message based on the NFC interrupt event, and the NFC broadcast message may include information such as the identifier of the NFC product and the type of the NFC product. Then, the target NFC application of the mobile phone receives the NFC broadcast message, and based on the NFC broadcast message, it can process the NFC interrupt event. Among them, the target NFC application is an NFC application registered in the mobile phone to listen for NFC messages. It should be noted that there may be multiple NFC applications registered in the mobile phone to listen for NFC messages, and the target NFC application is the application that responds to this NFC interrupt event among the multiple NFC applications. In this application, the NFC application refers to an NFC application registered to listen for NFC messages.
[0168] Among them, the determination process of the above target NFC application can be introduced through the following multiple implementation manners.
[0169] In one implementation manner, the number of NFC applications on the mobile phone is greater than or equal to 2, and a default NFC application is set in the NFC applications. The above target NFC application may be the default NFC application.
[0170] In another implementation manner, the number of NFC applications on the mobile phone is greater than or equal to 2, and there is no default NFC application in the NFC applications, indicating that there are multiple NFC applications that can process the above NFC interrupt signal. Therefore, the mobile phone can display a second prompt message for prompting the user to select an NFC application for processing the above NFC object. For example, the NFC applications of the mobile phone may include a wallet application, Application 1, and Application 2. The mobile phone can display the second prompt message 10 as shown in Figure 6 The user selects Application 1. In response to the selection operation of Application 1, the mobile phone can use Application 1 as the above target NFC application. Application 1 can process the NFC interrupt event based on the received NFC broadcast message.
[0171] In some embodiments, the number of NFC applications on the mobile phone is greater than or equal to 2. After the mobile phone senses an NFC object, if the screen of the mobile phone is on, the mobile phone can display the above-mentioned second prompt message. If the screen of the mobile phone is off, the screen is lit and the second prompt message is displayed; if the screen of the mobile phone is on, the second prompt message is displayed. Or if the screen of the mobile phone is off, the mobile phone may not display the second prompt message until the screen of the mobile phone is turned on and the second prompt message is displayed, thus avoiding the situation that the user cannot see the second prompt message due to the mobile phone being in the black screen state, resulting in unnecessary display and further avoiding waste of resources.
[0172] In another implementation, the foreground application of the mobile phone is an NFC application. After the mobile phone senses an NFC object, the interface of the NFC application is displayed. When the foreground application of the mobile phone is an NFC application, it indicates that this NFC application may be the NFC application that the user wants to use. Therefore, this NFC application can be used as the target NFC application and the interface of the NFC application is displayed.
[0173] In another implementation, the foreground application of the mobile phone is an NFC application, and the first interface of the foreground application displayed on the mobile phone is an NFC interface. After the mobile phone senses an NFC object, the first interface continues to be displayed. When the foreground application of the mobile phone is an NFC application and the first interface of the foreground application displayed on the mobile phone is an NFC interface, it indicates that this NFC application occupies the relevant NFC resources of the mobile phone. This NFC application can be used as the target NFC application. Among them, the NFC interface refers to an interface related to the NFC service, such as an interface for displaying information of existing NFC objects of the foreground application.
[0174] In another implementation, after the mobile phone senses an NFC object, the interface of the NFC application that matches the NFC object is displayed. Here, the NFC application that matches the NFC object means an NFC application that has relevant information of the NFC object (such as the identifier of the NFC object, the type of the NFC object). For example, if the NFC object is a bus card, after the mobile phone senses the NFC object, the wallet application of the mobile phone determines that it has the information of the bus card and displays an interface including the information of the bus card. Of course, the wallet application of the mobile phone can also perform other operations, such as reading data from or writing data to the bus card. Here, the wallet application is the target NFC application.
[0175] It should also be noted that if the number of NFC applications on the mobile phone is one, after the mobile phone senses an NFC object, this NFC application can be directly defaulted to be the target NFC application.
[0176] It can be understood that generating an NFC interruption event is a step in performing interruption handling. One NFC interruption event corresponds to one interruption handling. If interruption handling is performed several times, several interruption events will be generated. That is to say, generating one NFC interruption event can indicate that interruption handling is performed once, and generating several NFC interruption events means that interruption handling has been performed several times. For example, within the first time period mentioned above, the mobile phone generates N interruption signals, and the mobile phone performs N interruption handling operations, which means that the mobile phone generates N NFC interruption events. Correspondingly, the above S302 can be alternatively described as for the N NFC interruption signals within the first time period, the mobile phone generates N NFC interruption events.
[0177] Based on the NFC interruption event, generating an NFC broadcast message is a step in performing interruption handling. Optionally, performing interruption handling may not include the step of generating an NFC broadcast message based on the NFC interruption event. Correspondingly, performing interruption handling also does not include the steps of sending the NFC broadcast message and the target NFC application in the mobile phone handling the NFC interruption event based on the NFC broadcast message.
[0178] Exemplarily, when the event type corresponding to the NFC interruption event is not the first preset type, performing interruption handling does not include the step of generating an NFC broadcast message based on the NFC interruption event. When the event type corresponding to the NFC interruption event is the first preset type, performing interruption handling may include the step of generating an NFC broadcast message based on the NFC interruption event. In some scenarios, taking the example that each time interruption handling is performed, it includes the step of generating an NFC broadcast message based on the NFC interruption event, within the first time period mentioned above, the mobile phone generates N NFC interruption signals, and the mobile phone performs N interruption handling operations, which means that the mobile phone generates N NFC broadcast messages. Correspondingly, the above S302 can be alternatively described as for the N NFC interruption signals within the first time period, the mobile phone generates N NFC broadcast messages, or alternatively described as the mobile phone sends N NFC broadcast messages, or alternatively described as the target NFC application in the mobile phone is launched N times.
[0179] S303. After the end of the first time period mentioned above, the mobile phone determines whether the mobile phone meets the preset power-down condition. The number N of NFC interruption signals generated during the first time period is greater than the first preset threshold.
[0180] Among them, the preset power-down condition indicates the condition (i.e., scenario) where the user does not use the NFC function of the mobile phone.
[0181] It should be noted that, optionally, after the end of the first time period, the above mobile phone can determine whether the value of flag 1 is the first preset identifier. If the value of flag 1 is the first preset identifier, the mobile phone can determine whether the mobile phone meets the preset power-down condition. If the value of flag 1 is the second preset identifier, the mobile phone can not determine whether the mobile phone meets the preset power-down condition.
[0182] It should also be noted that the value of flag 1 is set based on the number of NFC interruption signals in the previous cycle (or described as a time period).
[0183] Alternatively, the above mobile phone can determine whether the number of NFC interruption signals generated within the above first time period is greater than a first preset threshold. When the number of NFC interruption signals generated within the above first time period is greater than the first preset threshold, the mobile phone can set flag 1 to the first preset identifier. When the number of NFC interruption signals generated within the above first time period is less than the first preset threshold, flag 1 is set to the second preset identifier. In this embodiment, since the number of NFC interruption signals generated within the above first time period (i.e., N) is greater than the first preset threshold, the mobile phone can determine whether the NFC device of the mobile phone needs to be powered down, such as executing the above S303.
[0184] In another implementation manner, when the number of NFC interruption signals generated within the first time period is less than the first preset threshold, it indicates that the number of NFC interruption signals generated by the mobile phone is small. Then the mobile phone does not need to control the NFC device to power down, and there is no need to determine whether the mobile phone meets the preset power-down condition. The mobile phone can continue to process new NFC interruption signals generated by the mobile phone, and it can be considered that the mobile phone re-enters the above first time period.
[0185] It should be understood that when the number of NFC interruption signals generated within the above first time period (i.e., N) is equal to the first preset threshold, the mobile phone can determine whether the mobile phone meets the first preset time according to the process that the number of NFC interruption signals generated within the above first time period is greater than the first preset threshold. The mobile phone can also continue to process new NFC interruption signals and count according to the process that the number of NFC interruption signals generated within the above first time period is less than the first preset threshold. The present application does not limit it.
[0186] Exemplarily, the above preset power-down conditions include that the mobile phone is not within a preset geographical fence, the time difference between the current time and the preset common NFC time is greater than a preset time difference value, the distance between the current position of the mobile phone and the preset common NFC location is greater than a preset distance difference value, and the mode of the mobile phone is at least one of the preset NFC non-use modes. Among them, the above preset NFC non-use mode represents the mobile phone mode when the user does not use the NFC function of the mobile phone.
[0187] In one implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence. The preset geographical fence represents the geographical fence where the mobile phone is used as a virtual NFC object by the user. For example, a bus stop fence, a subway fence, an access control geographical fence. Correspondingly, after the end of the first time period, the mobile phone can determine whether the mobile phone is within the preset geographical fence. If it is not within the preset geographical fence, it indicates that the user may not use the NFC function of the mobile phone, then the mobile phone can determine that the mobile phone meets the preset power-down condition. If it is within the preset geographical fence, it indicates that the user may use the NFC function of the mobile phone. For example, when the mobile phone is within the access control geographical fence, the user may use the mobile phone to open the access control. The NFC of the mobile phone does not need to be powered down, then the mobile phone can determine that the mobile phone does not meet the preset power-down condition.
[0188] Exemplarily, when determining whether the mobile phone is within the preset geographical fence, it can be determined according to the traditional method. For example, the mobile phone can determine by whether the location of the mobile phone is within the position range corresponding to the preset geographical fence. For another example, the mobile phone can determine by whether the Wi-Fi connected to the mobile phone exists the Wi-Fi corresponding to the preset geographical fence.
[0189] In another implementation, the above-mentioned preset power-down condition may include that the time difference between the current time and the preset NFC common time is greater than the preset time difference value. The preset NFC common time represents the time when the mobile phone is often used as an NFC object by the user, that is, the time when the user generally uses the NFC application of the mobile phone. The number of the preset NFC common times is one or more. The mobile phone can calculate the time difference between the current time and each preset NFC common time respectively. If each time difference is greater than the preset time difference value, it indicates that the current time is far from the time when the user uses the NFC function of the mobile phone, that is, it indicates that the user may not use the NFC function of the mobile phone currently, then the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0190] If there is a time difference less than or equal to the preset time difference value, it indicates that the current time is close to the time when the user uses the NFC function of the mobile phone, and there is no need to turn off the NFC of the mobile phone, then the mobile phone can determine that the mobile phone does not meet the preset power-down condition.
[0191] Among them, the above-mentioned preset time difference value can be set according to actual needs, and it can be 0 or a positive number.
[0192] In another implementation, the above-mentioned preset power-down condition may include that the distance between the current location of the mobile phone and the preset common NFC location is greater than the preset distance difference. The preset common NFC location refers to the location where the mobile phone is often used by the user as a virtual NFC object, that is, the location where the user generally uses the NFC application of the mobile phone. The number of the preset common NFC locations is one or more. The mobile phone can calculate the distances between the current location of the mobile phone and each of the preset common NFC locations respectively. If each distance is greater than the preset distance difference, it indicates that the current location is far from the locations where the user uses the NFC function of the mobile phone, that is, it indicates that the user may not use the NFC function of the mobile phone currently, then the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0193] If there is a distance less than or equal to the preset time difference, it indicates that the current time is close to the location where the user uses the NFC function of the mobile phone, and there is no need to turn off the NFC of the mobile phone, then the mobile phone can determine that the mobile phone does not meet the preset power-down condition. For example, the user often uses the car key on the mobile phone in Parking Lot 1 to open the car. Therefore, when the distance between the current location of the mobile phone and Parking Lot 1 is close, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone does not meet the preset power-down condition.
[0194] Exemplarily, the above-mentioned preset common NFC time and preset common NFC location can be determined by the mobile phone based on the usage records of the applications on the mobile phone. The usage records of the applications may include information such as the identification of the application, the usage time, and the usage location. For example, the mobile phone can analyze the usage records of the applications on the mobile phone based on relevant machine learning algorithms to determine the user's habit of using the NFC application of the mobile phone, that is, to determine the common time and common location of the NFC application of the mobile phone.
[0195] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within the preset geographical fence and the time difference between the current time and the preset common NFC time is greater than the preset time difference. Correspondingly, if the mobile phone is not within the preset geographical fence and the time difference between the current time and the preset NFC time is greater than the preset time difference, it indicates that the user may not use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone meets the preset power-down condition. If the mobile phone is within the preset geographical fence, or the time difference between the current time and the preset NFC time is less than or equal to the preset time difference, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone does not meet the preset power-down condition.
[0196] In another implementation, the above-mentioned preset power-down condition may include that the time difference between the current time and the preset common NFC time is greater than a preset time difference value, and the distance between the current location of the mobile phone and the preset common NFC location is greater than a preset distance difference value. Correspondingly, if the time difference between the current time and the preset NFC time is greater than the preset time difference value, and the distance between the current location of the mobile phone and the preset common NFC location is greater than the preset distance difference value, it indicates that the user may not use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0197] If the time difference between the current time and the preset NFC time is less than or equal to the preset time difference value, or the distance between the current location of the mobile phone and the preset common NFC location is less than or equal to the preset distance difference value, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0198] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence, the time difference between the current time and the preset common NFC time is greater than a preset time difference value, and the distance between the current location of the mobile phone and the preset common NFC location is greater than a preset distance difference value. Correspondingly, if the mobile phone is not within the preset geographical fence, the time difference between the current time and the preset NFC time is greater than the preset time difference value, and the distance between the current location of the mobile phone and the preset common NFC location is greater than the preset distance difference value, it indicates that the user may not use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0199] If the mobile phone is within the preset geographical fence, the time difference between the current time and the preset NFC time is less than or equal to the preset time difference value, or the distance between the current location of the mobile phone and the preset common NFC location is less than or equal to the preset distance difference value, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mobile phone meets the preset power-down condition.
[0200] In another implementation, the above-mentioned preset power-down condition may include that the mode of the mobile phone is the preset NFC non-use mode. Correspondingly, if the mode of the mobile phone is the preset NFC non-use mode, it indicates that the user may not use the NFC function of the mobile phone currently, and the mobile phone can determine that the mobile phone meets the preset power-down condition. If the mode of the mobile phone is not the preset NFC non-use mode, it indicates that the user may use the NFC function of the mobile phone currently, and the mobile phone can determine that the mobile phone does not meet the preset power-down condition.
[0201] Exemplarily, the preset NFC non - usage mode may include at least one of a pocket mode, a pocket - sports combined mode, a stationary mode, and a black - screen mode. Among them, the pocket - sports combined mode represents a combined mode of the pocket mode and the sports mode. For example, the pocket - sports combined mode includes a pocket mode + walking mode, a pocket mode + driving mode, a pocket mode + cycling mode, etc.
[0202] In this implementation manner, when the mobile phone determines whether the mode of the mobile phone is the preset NFC non - usage mode, it can be determined through the following examples.
[0203] In one example, the above - mentioned preset NFC non - usage mode may include a pocket mode. When the user uses the NFC function of the mobile phone, the mobile phone generally acts as a passive NFC product, that is, the mobile phone is generally used as a virtual NFC object. For example, the user uses the mobile phone as an access card to open the access control, the user uses the mobile phone as a bus card to pay transportation fees, the user uses the mobile phone as a car key to lock the car and open the vehicle (such as an electric vehicle, a car, etc.). When the mobile phone is used as a virtual NFC object, it needs to be close to an NFC device such as a card reader or a reader. For example, when the user uses the virtual bus card of the mobile phone to pay transportation fees, the mobile phone needs to be close to the card reader on the bus. When the mobile phone is placed in the user's pocket or bag, the mobile phone is generally not used as a virtual NFC object. That is to say, the NFC interruption signal sensed by the mobile phone generated by the above - mentioned NFC object is not the NFC interruption signal generated when the user actively uses the NFC function of the mobile phone. Therefore, even if the NFC of the mobile phone is turned off, it will not affect the user. Correspondingly, when the mode of the mobile phone is the pocket mode, the mobile phone can determine that the mode of the mobile phone is the preset NFC non - usage mode.
[0204] When the mode of the mobile phone is not the pocket mode, it indicates that the mobile phone may be used as a virtual NFC object, and the mobile phone can determine that the mode of the mobile phone is not the preset non - usage mode. For example, if the mode of the mobile phone is the handheld mode, it indicates that the mobile phone is held by the user, and the mobile phone may be used as a virtual NFC object, then the mode of the mobile phone is not the preset NFC non - usage mode.
[0205] Exemplarily, the above - mentioned mobile phone can detect whether the mobile phone is in a closed position such as a pocket or a bag through a distance sensor above the mobile phone screen to determine whether the mode of the mobile phone is the pocket mode. Of course, the mobile phone can also determine whether the mobile phone is in the pocket mode through other means.
[0206] Exemplarily, the above-mentioned mobile phone can determine whether the mobile phone is in the hand-held mode through the specific absorption rate (Sar) sensor in the mobile phone. Under the action of an external electromagnetic field, an induced electromagnetic field will be generated in the human body. Since various organs of the human body are lossy dielectrics, an electric current will be generated in the internal electromagnetic field, resulting in the absorption and dissipation of electromagnetic energy. By reading the capacitance value of the mobile phone antenna through the electromagnetic wave absorption ratio sensor in the mobile phone, the electromagnetic power absorbed or consumed by human tissues can be detected, and then based on the magnitude of the capacitance value, it can be determined whether the mobile phone is in the hand-held state.
[0207] In another example, in order to improve the accuracy of the mode of the mobile phone determined based on the pocket mode, the above-mentioned preset NFC non-use mode may include a pocket motion combination mode, that is, on the basis of the pocket mode, the motion mode of the mobile phone is combined to determine that the mobile phone is in the mode where the user does not use the NFC function of the mobile phone, that is, to determine whether the mode of the mobile phone is the preset NFC non-use mode. When the mobile phone is put into the pocket and is in the motion mode, the user generally does not use the NFC function of the mobile phone. Therefore, the mobile phone can determine that the mode of the mobile phone is the preset NFC non-use mode. For example, when the user puts the mobile phone into the pocket during cycling, the mobile phone is in the pocket mode and the cycling mode. At this time, the user generally does not use the NFC function of the mobile phone. The NFC interruption signal generated during the above first time period may not be generated when the mobile phone is used as a virtual NFC object, but is generated due to accidental contact between the mobile phone and the NFC product in the pocket. Another example is that when the user puts the mobile phone into the pocket during driving, the mobile phone is in the pocket mode and the driving mode. At this time, the user generally does not use the NFC function of the mobile phone. Another example is that when the user puts the mobile phone into the pocket during walking, the mobile phone is in the pocket mode and the walking mode. At this time, the user generally does not use the NFC function of the mobile phone.
[0208] When the mode of the mobile phone is not the pocket mode or not the motion mode, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mode of the mobile phone is not the preset NFC non-use mode. For example, when the user is walking, the user may use the NFC function of the mobile phone.
[0209] Exemplarily, the motion mode of the mobile phone can be determined by activity recognition (AR). Activity recognition refers to collecting the behavior characteristics of the mobile phone through underlying sensors (such as acceleration sensors, gyroscopes, etc.). By recognizing the behavior characteristics of the mobile phone, it can be detected whether the mobile phone is in user activity scenarios such as in-vehicle, cycling, walking, running, stationary, lying down, etc.
[0210] In another example, the above-mentioned preset NFC non-usage mode may include a stationary mode. When a user is sleeping, studying, working, or engaged in other activities that do not require the use of the NFC function of the mobile phone, the user generally does not use the NFC function of the mobile phone. Therefore, when the user, that is, the user's mobile phone is in the stationary mode, the mobile phone generally will not be used as a virtual NFC object. Correspondingly, the mobile phone can obtain the mode of the mobile phone. When the mode of the mobile phone is the stationary mode, the mobile phone can determine that the mode of the mobile phone is the preset NFC non-usage mode. When the mode of the mobile phone is not the stationary mode, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mode of the mobile phone is not the preset NFC non-usage mode.
[0211] Exemplarily, if the duration of detecting that the mobile phone has not moved exceeds a second preset duration, it indicates that the mobile phone has not been moved for a long time. Therefore, the mobile phone can determine that the mobile phone is in the stationary mode. Otherwise, the mobile phone can determine that the mobile phone is not in the stationary mode. Or, in order to improve the accuracy of mobile phone mode judgment, if the duration of detecting that the mobile phone has not moved exceeds a second preset duration, and the current time belongs to a preset stationary time, where the preset stationary time includes at least one of a preset sleeping time, a preset working time, and a preset studying time, then the mobile phone can determine that the mobile phone is in the stationary mode. Otherwise, the mobile phone determines that the mobile phone is in a non-stationary mode.
[0212] Among them, the above-mentioned preset sleeping time, preset working time, and preset studying time can be obtained by the mobile phone based on the analysis of the user's mobile phone usage habits. For example, based on the user's mobile phone usage records, the mobile phone determines that the user generally does not use the mobile phone from 22:00 to 6:00, and the mobile phone can determine that the user's sleeping time is from 22:00 to 6:00. Or, the preset sleeping time, preset working time, and studying time can also be pre-set by the user.
[0213] In another example, the above-mentioned NFC non-usage mode may include a black screen mode. When a user uses the mobile phone, the mobile phone is generally in the lit screen mode. Therefore, when the mobile phone is in the black screen mode, the mobile phone generally will not be used as a virtual NFC object. That is to say, the NFC interruption signal generated by the mobile phone sensing the above-mentioned NFC object is not the NFC interruption signal generated when the user actively uses the NFC function of the mobile phone. Therefore, even if the NFC of the mobile phone is turned off, it will not affect the user. Correspondingly, the mobile phone can obtain the screen mode of the mobile phone. When the screen mode is the black screen mode, the mobile phone can determine that the mode of the mobile phone is the preset NFC non-usage mode. When the mode of the mobile phone is the lit screen mode, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can determine that the mode of the mobile phone is not the preset NFC non-usage mode.
[0214] In another example, the above-mentioned preset NFC non-usage mode may include a pocket mode and a stationary mode. When a user is at work or studying, many users will put their mobile phones in their pockets or bags, and at this time, the user may not use the NFC function of the mobile phone. Therefore, when the mode of the mobile phone is the pocket mode and the stationary mode, it indicates that the mobile phone may not be used as a virtual NFC object. Then, when it is determined that the mode of the mobile phone is the stationary mode and the black screen mode, the mode of the mobile phone meets the preset NFC non-usage mode. When the mode of the mobile phone is the pocket mode or the stationary mode, it indicates that the mobile phone may be used as a virtual NFC object, and the mode of the mobile phone does not meet the preset NFC non-usage mode.
[0215] In another example, the above-mentioned preset NFC non-usage mode may include a pocket mode and a black screen mode. When the user puts the mobile phone in the pocket or bag and the mobile phone is in the black screen state, it indicates that the probability of the user using the mobile phone at this time is relatively low, which also means that the probability of the user using the NFC function of the mobile phone at this time is relatively low. Then, when it is determined that the mode of the mobile phone is the stationary mode and the black screen mode, the mode of the mobile phone meets the preset NFC non-usage mode. When the mode of the mobile phone is the pocket mode or the screen-on mode, it indicates that the mobile phone may be used as a virtual NFC object, and the mode of the mobile phone does not meet the preset NFC non-usage mode.
[0216] In another example, the above-mentioned preset NFC non-usage mode may include a stationary mode and a black screen mode. When the user is sleeping, working or studying and the mobile phone is in the black screen state, it indicates that the probability of the user using the mobile phone at this time is relatively low, which also means that the probability of the user using the NFC function of the mobile phone at this time is relatively low. Then, when it is determined that the mode of the mobile phone is the stationary mode and the black screen mode, the mode of the mobile phone meets the preset NFC non-usage mode. When the mode of the mobile phone is the pocket mode or the screen-on mode, it indicates that the mobile phone may be used as a virtual NFC object, and the mode of the mobile phone does not meet the preset NFC non-usage mode.
[0217] The several examples listed above are only several possible situations of the modes included in the above-mentioned preset NFC non-usage mode. The preset NFC non-usage mode may include other situations, as long as it includes at least one of the above pocket mode, pocket movement combination mode, stationary mode, and black screen mode. For example, the preset NFC non-usage mode may include the pocket mode, the stationary mode, and the black screen mode. Therefore, when the mode of the mobile phone includes the pocket mode, the stationary mode, and the black screen mode, it indicates that the user may not use the NFC function of the mobile phone. Therefore, the mobile phone can determine that the mobile phone meets the preset NFC non-usage mode. Otherwise, when the mode of the mobile phone does not include the pocket mode, the stationary mode, or the black screen mode, the mobile phone can determine that the mobile phone does not meet the preset NFC non-usage mode.
[0218] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence and the mode of the mobile phone is a preset NFC non-use mode. Correspondingly, when determining whether the mobile phone meets the preset power-down condition, the mobile phone may determine whether the mobile phone is within the preset geographical fence and determine whether the mode of the mobile phone is the preset NFC non-use mode. If the mobile phone is not within the preset geographical fence and the mode of the mobile phone is the preset NFC non-use mode, it indicates that the user may not use the NFC function of the mobile phone, and the mobile phone may determine that the mobile phone meets the preset power-down condition.
[0219] If the mobile phone is within the preset geographical fence and the mode of the mobile phone is not the preset NFC non-use mode, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone may determine that the mobile phone does not meet the above-mentioned preset power-down condition.
[0220] In another implementation, the above-mentioned preset power-down condition may include that the distance between the current location of the mobile phone and a preset NFC frequently used location is greater than a preset distance difference and the mode of the mobile phone is the preset NFC non-use mode. Correspondingly, when determining whether the mobile phone meets the preset power-down condition, the mobile phone may determine whether the distance between the current location of the mobile phone and the preset NFC frequently used location is greater than the preset distance difference and determine whether the mode of the mobile phone is the preset NFC non-use mode. If the distance between the current location of the mobile phone and the preset NFC frequently used location is greater than the preset distance difference and the mode of the mobile phone is the preset NFC non-use mode, the mobile phone may determine that the mobile phone meets the preset power-down condition.
[0221] If the distance between the current location of the mobile phone and the preset NFC frequently used location is less than or equal to the preset distance difference, or the mode of the mobile phone is not the preset NFC non-use mode, the mobile phone may determine that the mobile phone does not meet the preset power-down condition.
[0222] In another implementation, the above-mentioned preset power-down condition may include that the time difference between the current time and a preset NFC frequently used time is greater than a preset time difference and the mode of the mobile phone is the preset NFC non-use mode. Among them, in this implementation, the process of the mobile phone determining whether the mobile phone meets the preset power-down condition is similar to the determination process in the above-mentioned implementation, and will not be elaborated here.
[0223] In another implementation, the above-mentioned preset power-down condition may include that the time difference between the current time and a preset NFC frequently used time is greater than a preset time difference, the distance between the current location of the mobile phone and a preset NFC frequently used location is greater than a preset distance difference, and the mode of the mobile phone is the preset NFC non-use mode. Among them, in this implementation, the process of the mobile phone determining whether the mobile phone meets the preset power-down condition is similar to the determination process in the above-mentioned implementation, and will not be elaborated here.
[0224] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence, the time difference between the current time and the preset common NFC time is greater than a preset time difference value, and the mode of the mobile phone is a preset NFC non-use mode. Among them, in this implementation, the process for the mobile phone to determine whether the mobile phone meets the preset power-down condition is similar to the determination process in the above implementation, and will not be elaborated here.
[0225] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence, the distance between the current location of the mobile phone and the preset common NFC location is greater than a preset distance difference value, and the mode of the mobile phone is a preset NFC non-use mode. Among them, in this implementation, the process for the mobile phone to determine whether the mobile phone meets the preset power-down condition is similar to the determination process in the above implementation, and will not be elaborated here.
[0226] In another implementation, the above-mentioned preset power-down condition may include that the mobile phone is not within a preset geographical fence, the time difference between the current time and the preset common NFC time is greater than a preset time difference value, the distance between the current location of the mobile phone and the preset common NFC location is greater than a preset distance difference value, and the mode of the mobile phone is a preset NFC non-use mode. Among them, in this implementation, the process for the mobile phone to determine whether the mobile phone meets the preset power-down condition is similar to the determination process in the above implementation, and will not be elaborated here.
[0227] In the embodiments of the present application, when the number (i.e., N) of NFC interruption signals generated within the above-mentioned first time period is greater than a first preset threshold, it indicates that a large number of NFC interruption signals are generated by the mobile phone. Then, the mobile phone can determine whether the mobile phone meets the preset power-down condition, that is, determine whether the mobile phone is in a scenario where the user does not use the NFC function of the mobile phone. If the preset power-down condition is not met, it indicates that the user may use the NFC function of the mobile phone, and then the mobile phone can execute S304. If the preset power-down condition is met, it indicates that the user may not use the NFC function of the mobile phone, and then the mobile phone can execute S305.
[0228] In some embodiments, after the mobile phone statistically obtains the number of NFC interruption signals generated by the mobile phone within the first time period, when the number (i.e., N) is greater than the first preset threshold, it indicates that a large number of NFC interruption signals are generated by the mobile phone, and the mobile phone can set the flag 1 as a first preset identifier. The first preset identifier can be used to indicate that the number of NFC interruption signals generated by the mobile phone within the first time period is greater than the first preset threshold. When the number (i.e., N) is less than the first preset threshold, the mobile phone can set the flag 1 as a second preset identifier.
[0229] Exemplarily, after the end of the first time period, after a new NFC interrupt signal is generated, the mobile phone can first determine the value of flag 1. When the flag 1 is the first preset identifier, it indicates that the number of NFC interrupt signals generated by the mobile phone within the first time period is greater than the first preset threshold. The mobile phone can determine whether the mobile phone meets the above preset power-down condition, so as to perform NFC power-down when the user does not use the NFC function of the mobile phone.
[0230] When the flag 1 is the second preset identifier, it indicates that the number of NFC interrupt signals generated by the mobile phone is small. The mobile phone can normally process the NFC interrupt signals generated by the mobile phone, thereby avoiding unnecessary NFC power-down. And the mobile phone can continue to count, and the time period where the new NFC interrupt signal is located can be a new first time period.
[0231] In this embodiment, optionally, after the mobile phone meets the preset power-down condition, the mobile phone can also initialize the counter and set the flag 1 to the second preset identifier. After the NFC of the mobile phone is powered on again, the mobile phone can reuse the counter to count and re-enter the first time period.
[0232] In some other embodiments, after the above mobile phone counts the number of NFC interrupt signals generated within the first time period, when the number of NFC interrupt signals generated within the first time period (i.e., N), that is, the value of the counter is greater than the first preset threshold, it indicates that the mobile phone has generated a large number of NFC interrupt signals. The mobile phone can set flag 2. The flag 2 can be used to indicate that the number of NFC interrupt signals generated by the mobile phone within the first time period is greater than the first preset threshold. When the number of NFC interrupt signals generated within the first time period is less than the first preset threshold, it indicates that the mobile phone has not generated a large number of NFC interrupt signals, and the mobile phone can not set flag 2 (that is, can clear flag 2).
[0233] Exemplarily, after the end of the first time period, after a new NFC interrupt signal is generated, the mobile phone can first determine whether there is flag 2. When the flag 2 is detected, it indicates that the mobile phone frequently generates NFC interrupt signals. Then the mobile phone continues to determine whether the mobile phone is in a scenario where the user does not use the NFC function of the mobile phone, that is, determines whether the mobile phone meets the above preset power-down condition, so as to perform NFC power-down when the user does not use the NFC function of the mobile phone. When the flag 2 is not detected, it indicates that the number of NFC interrupt signals generated by the mobile phone is small. The mobile phone can normally process the NFC interrupt signals generated by the mobile phone, thereby avoiding unnecessary NFC power-down, and the time period where the new NFC interrupt signal is located can be a new first time period.
[0234] In this embodiment, optionally, after the mobile phone meets the preset power-off condition, the mobile phone can also initialize the counter and clear the flag 2. After the NFC of the mobile phone is powered on again, the mobile phone can reuse the counter for counting and re-enter the first time period.
[0235] Among them, the specific values of the above-mentioned flag 2, the first preset identifier, and the second preset identifier can be set according to actual needs, and the present application does not limit them.
[0236] In some embodiments, after the mobile phone senses the NFC object, it can count the number of NFC interrupt signals generated within each preset period, so that when the mobile phone reaches the next preset period, it can use the number of NFC interrupt signals generated in the previous preset period of the next preset period to determine whether to perform NFC power-off. For example, the time when the mobile phone obtains the first NFC interrupt signal can be regarded as the start time of the first preset period. At the end of the first preset period, the second preset period begins. When the number of NFC interrupt signals generated within the first preset period is less than the first preset threshold, the mobile phone can use the counter to continue counting the number of NFC interrupt signals generated within the second preset period. At the end of the second preset period, the third preset period begins. The mobile phone can count the NFC interrupt signals generated within each preset period through the counter to obtain the number of NFC interrupt signals generated within each preset period.
[0237] Among them, optionally, the counter in the mobile phone is cleared periodically. At the beginning of a preset period, the counter in the mobile phone starts counting. When the preset period ends, the counter is cleared. Or, the counter in the mobile phone is not cleared periodically, and the value of the counter is the cumulative number of NFC interrupt numbers generated. When the mobile phone obtains the first NFC interrupt signal, the preset period in which the first NFC interrupt signal is located is the first preset period. The counter in the mobile phone starts counting. When the preset period passes, that is, when reaching the second preset period, the counter in the mobile phone continues to count. Correspondingly, when the mobile phone determines whether the number of NFC interrupt signals generated within the second preset period is greater than the first preset threshold, it is actually determining whether the value of the counter is greater than the sum of the first preset threshold and the number of NFC interrupt signals generated within the first preset period.
[0238] It can be understood that since the duration of the first time period is generally short, when the number of NFC interruption signals generated within the above-mentioned first time period is greater than the first preset threshold, it indicates that the mobile phone has generated a large number of NFC interruption signals within the first time period. Therefore, after the end of the first time period, the mobile phone can consider that the mobile phone is still generating a large number of NFC interruption signals currently. In order to reduce the power consumption required for the mobile phone to generate and process a large number of NFC interruption signals, the mobile phone can determine whether the mobile phone is currently in a scenario where the user does not use the NFC function of the mobile phone, so as to determine whether to power down the NFC of the mobile phone.
[0239] Generally speaking, due to the short duration of the first time period, the NFC interruption signals generated by the mobile phone within this first time period are generally the same, that is, repetitive. Therefore, within the first time period, after the mobile phone generates an NFC interruption signal, it will perform a count once. However, there is still a possibility that the NFC interruption signals generated by the mobile phone within the first time period are different from other NFC interruption signals within this time period. For example, there are two NFC cards and the mobile phone in the user's pocket. Within the first time period, the mobile phone touches the two NFC cards successively. Within the above-mentioned first time period, after the mobile phone generates an NFC interruption signal, it is determined whether the generated NFC interruption signal is the same as the previously generated NFC interruption signal. If it is the same, it indicates that the mobile phone has generated a repetitive NFC interruption signal, and the mobile phone can continue to perform a count using the counter and process this NFC interruption signal.
[0240] Otherwise, the mobile phone can process this NFC interruption signal without performing a count. Optionally, the mobile phone can initialize the counter. For the next generated NFC interruption signal, the mobile phone can re-enter the first time period, so that the number of repetitive NFC interruption signals generated by the mobile phone within the first time period can be statistically obtained.
[0241] In some embodiments, in the case where the NFC interruption signal generated by the mobile phone is different from the previously generated NFC interruption signal, the mobile phone can set the value of flag 1 to the second preset identifier or clear flag 2.
[0242] S304. For the NFC interruption signals generated after the above-mentioned first time period, the mobile phone performs interruption processing.
[0243] Exemplarily, when it is determined that the mobile phone does not meet the above-mentioned preset power-down condition, it indicates that the user may use the NFC function of the mobile phone. Therefore, the mobile phone does not need to perform the NFC power-down operation, and the mobile phone can normally process the NFC interruption signals generated by the mobile phone and can re-enter the first time period. After the end of the new first time period, when the number of NFC interruption signals generated within the new first time period is greater than the first preset threshold, the mobile phone can determine whether the mobile phone meets the preset power-down condition, so that when the mobile phone meets the preset power-down condition, that is, when the user does not use the NFC function of the mobile phone, the NFC of the mobile phone can be powered down in time, thereby reducing the power consumption of the mobile phone. For example, the first time period is a preset cycle. After the end of the preset cycle, the mobile phone can determine whether the number of NFC interruption signals generated within the preset cycle is greater than the first preset threshold. If it is greater, the mobile phone can determine whether the mobile phone meets the preset power-down condition. If it does not meet, the mobile phone can enter the next cycle, that is, re-enter the first time period. After the end of the next cycle, the mobile phone can determine whether the number of NFC interruption signals generated within the next cycle is greater than the first preset threshold. The start time of the next cycle can be the end time of the preset cycle.
[0244] S305. The above mobile phone performs an NFC power-down operation, where the NFC power-down operation is used to trigger the power-down of the NFC device in the mobile phone.
[0245] In the embodiment of the present application, when it is determined that the mobile phone meets the preset power-down condition, it indicates that the user may not use the NFC function of the mobile phone. Therefore, the mobile phone can turn off the NFC, that is, can control the power-down of the NFC device in the mobile phone. After the NFC device is powered down, the mobile phone will not continue to generate NFC interruption signals and does not need to continue to process NFC interruption signals, thereby reducing the power consumption of the mobile phone.
[0246] Exemplarily, the above mobile phone controlling the power-down of the NFC device can be to control the power-down of the NFC antenna and / or the NFC chip in the NFC device.
[0247] In some embodiments, the above NFC power-down operation can also be used to trigger the periodic power-down of the NFC device in the mobile phone, that is, power down once every preset time. For example, the mobile phone can control the NFC device to power down for 1 second, then control the NFC device to power on for 1 second, and then control the NFC device to power down for 1 second, that is, control the NFC to power down once every 1 second during this period. When powered on, the mobile phone can normally generate and process NFC interruption signals, so as to ensure the successful implementation of NFC services (such as users using the mobile phone to swipe the bus card) and reduce the power consumption of the mobile phone at the same time.
[0248] In this embodiment, during the power-on period of the NFC device, the mobile phone can determine whether the number of NFC interrupt signals generated by the mobile phone is large. If not, it indicates that the NFC interrupt signals generated by the mobile phone have decreased, and the mobile phone can maintain the power-on state of the NFC device, that is, there is no need to continue to control the NFC device to power off periodically. When the number of NFC interrupt signals generated by the mobile phone is small, the mobile phone can also initialize a counter to re-enter the first time period.
[0249] If the number of NFC interrupt signals generated by the mobile phone is large, the mobile phone can continue to control the NFC device to power off periodically.
[0250] Among them, the process by which the above-mentioned mobile phone determines whether the number of NFC interrupt signals generated by the mobile phone is large during the power-on period of the NFC device can be: during the current power-on period, if the number of NFC interrupt signals generated by the NFC device in the previous power-on period in the mobile phone is greater than a second preset threshold, it indicates that the number of NFC interrupt signals generated by the NFC device is large. Otherwise, the number of NFC interrupt signals generated by the NFC device is small.
[0251] In some embodiments, after performing the above S305, when the NFC device of the mobile phone is powered off, in order to ensure that the user can use the NFC function of the mobile phone in time, the mobile phone can also continue to determine whether the mobile phone is in an NFC usage scenario. If so, the mobile phone can control the NFC device of the mobile phone to power on. Next, the process of the mobile phone powering on the NFC based on the NFC usage scenario will be continued. This process can include the above Figure 5 shown S306 - S308.
[0252] S306. When the mobile phone is in the NFC power-off state, determine whether the mobile phone meets the preset power-off conditions.
[0253] Exemplarily, when the mobile phone is in the NFC power-off state, that is, when the NFC device of the mobile phone is powered off, the mobile phone can periodically determine whether the mobile phone meets the preset power-off conditions. If the mobile phone meets the preset power-off conditions, it indicates that the user may still not use the NFC function of the mobile phone, and the mobile phone can execute S307. If the mobile phone does not meet the preset power-off conditions, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone can execute S308.
[0254] S307. The mobile phone maintains the NFC power-off state.
[0255] S308. The mobile phone performs an NFC power-on operation. Among them, the NFC power-on operation is used to trigger the NFC device in the mobile phone to power on.
[0256] In this application, when the mobile phone is in the NFC power-off state, if the mobile phone does not meet the preset power-off conditions, it indicates that the user may use the NFC function of the mobile phone. Therefore, in order to enable the user to use the NFC function of the mobile phone normally, the mobile phone can restore NFC power-on, that is, the mobile phone performs an NFC power-on operation so that the NFC device can normally generate an NFC interrupt signal, so that the mobile phone can normally process the NFC interrupt signal generated by the NFC device. For example, the preset power-off conditions include that the mode of the mobile phone is a preset NFC non-use mode. The preset NFC non-use mode includes the pocket mode. The mobile phone is in the NFC power-off state. The mobile phone determines that the mode of the mobile phone is not the pocket mode, and the mobile phone can perform an NFC power-on operation. When the user takes out the mobile phone from the pocket, that is, when the mobile phone detects that the mode of the mobile phone exits the pocket mode, it indicates that the user may use the NFC function of the mobile phone, and the mobile phone no longer meets the preset power-off conditions. Another example is that the preset NFC non-use mode includes the stationary mode. The mobile phone is in the NFC power-off state. The mobile phone detects that the mobile phone moves, and the mobile phone can perform an NFC power-on operation. Another example is that the preset NFC non-use mode includes the black screen mode. The mobile phone is in the NFC power-off state. The mobile phone detects that the mobile phone screen lights up, and the mobile phone can perform an NFC power-on operation. Another example is that the preset power-off condition includes that the time difference between the current time and the preset NFC common time is greater than the preset time difference value. The mobile phone is in the NFC power-off state. The mobile phone determines that the time difference between the current time and the preset NFC common time is less than or equal to the preset time difference value, and the mobile phone can perform an NFC power-on operation. When the mobile phone monitors (or is described as determining) that the preset common time is about to be reached, that is, when it monitors that the time difference between the current time and the preset NFC common time is less than or equal to the preset time difference value, the mobile phone can perform an NFC power-on operation, so as to restore NFC power-on before the user uses the NFC function of the mobile phone and avoid the user using the NFC function of the mobile phone.
[0257] The above introduced a situation where the mobile phone determines whether the mobile phone meets the preset power-off conditions after generating a large number of NFC interrupt signals. Of course, the mobile phone can also determine whether the mobile phone meets the preset power-off conditions after the mobile phone senses an NFC object. For example, the mobile phone can determine whether the mobile phone meets the preset power-off conditions after generating the first NFC interrupt signal, or the mobile phone can determine whether the mobile phone meets the preset power-off conditions after generating an NFC interrupt signal.
[0258] In some embodiments, to prevent the mobile phone from experiencing an NFC interruption storm, when the NFC interruption signal (i.e., the above-mentioned N) generated by the mobile phone within the first time period is greater than the first preset threshold, or when the mobile phone does not meet the above-mentioned preset power-down condition, the mobile phone can display a first prompt message on the screen of the mobile phone. This first prompt message is used to prompt the user that an abnormal NFC product has touched the mobile phone and it is recommended that the user not place the mobile phone and the NFC product together.
[0259] Optionally, when the number of NFC interruption signals generated within the first time period is greater than the first preset threshold, if the mobile phone screen is on, the mobile phone can display the above-mentioned first prompt message. Or if the mobile phone screen is off, the mobile phone can not display this second prompt message until the mobile phone screen turns on and then displays the first prompt message, thereby avoiding unnecessary display caused by the mobile phone being in the black screen state, and further avoiding waste of resources. Exemplarily, to avoid the user being unable to see the first prompt message in time due to the mobile phone being in the black screen state (such as the mobile phone being in the standby state), when the number of NFC interruption signals generated within the first time period is greater than the first preset threshold, when the mobile phone screen is black, the mobile phone can not display the first prompt message. When the mobile phone screen is on, the mobile phone can display the first prompt message, so that the user can see the first prompt message in time and unnecessary display can be avoided.
[0260] Or, when the number of NFC interruption signals generated within the first time period is greater than the first preset threshold, if the mobile phone screen is off, then turn on the screen and display the first prompt message.
[0261] Among them, the above-mentioned first prompt message can be displayed in the form of a pop-up window. For example, the mobile phone can display the first prompt message in the form of a pop-up window in the notification bar (such as Figure 7A the first prompt message 20 shown), and again, for example, the mobile phone can display the first prompt message in the form of a pop-up window on the interface displayed by the mobile phone (such as Figure 7B the mobile phone displays the first prompt message 21 on the lock screen interface shown).
[0262] It can be understood that the above-mentioned NFC interruption signal is a hardware interruption. Although there is a delay between the generation of the NFC interruption signal and the processing of the NFC interruption signal, the delay is relatively small. Therefore, it can be considered that the mobile phone processes the NFC interruption signals generated within the time period within that time period.
[0263] In some embodiments, the user can determine whether to end the power-down of NFC according to needs. When the above-mentioned NFC device is powering down, if the user needs to use the NFC function of the mobile phone, the user can turn on such as Figure 7CThe NFC control switch shown. In response to the opening operation of the NFC control switch, the mobile phone can restore the NFC power-on, that is, it can perform the NFC power-on operation, so that the user can normally use the NFC function of the mobile phone and improve the user satisfaction.
[0264] It can be understood that the above-mentioned execution of the interruption handling can represent all or part of the steps included in the execution of the interruption handling. The execution of the interruption handling can also be described as initiating the interruption handling. Initiating an interruption handling can represent performing one or more of the steps of generating an NFC interruption event, sending an NFC broadcast message, and launching a target NFC application.
[0265] In some embodiments, as Figure 8 shown, when the mobile phone receives the first NFC interruption signal and executes the first IRQ handling process, the first cycle (such as the above-mentioned first time period) starts. The IRQ handling process within the first cycle does not need to be filtered, that is, each IRQ handling process needs to be executed. At the end of the first cycle, when the mobile phone determines that the mobile phone meets the preset power-down condition, the mobile phone can trigger the power-down of the NFC device, so that the NFC device will no longer generate NFC interruption signals, and the mobile phone does not need to execute the IRQ handling process anymore, thereby effectively reducing the power consumption of the mobile phone.
[0266] In this application, when the mobile phone generates an NFC interruption signal, the mobile phone can determine whether the mobile phone generates a large number of NFC interruption signals according to the number of NFC interruption signals generated in the previous time period. When the mobile phone generates a large number of NFC interruption signals, the mobile phone can determine whether the mobile phone meets the preset power-down condition, that is, determine whether the user uses the NFC function of the mobile phone. If the mobile phone meets the preset power-down condition, it indicates that the user may not use the NFC function of the mobile phone, that is, it indicates that the NFC interruption signals generated by the mobile phone (such as the NFC interruption signals generated in the above-mentioned first time period) may not be generated when the user actively uses the NFC function of the mobile phone, and the NFC power-down of the mobile phone will not affect the user. Therefore, the mobile phone can perform NFC power-down. If the mobile phone does not meet the preset power-down condition, it indicates that the user may use the NFC function of the mobile phone, that is, it indicates that the NFC interruption signals generated by the mobile phone may be generated when the user actively uses the NFC function of the mobile phone, and the NFC power-down of the mobile phone will affect the user. Therefore, the mobile phone does not need to perform NFC power-down, so as to ensure that the mobile phone can normally implement the NFC service and ensure the user experience.
[0267] Next, in combination with the above Figure 4 shown software structure, a possible implementation process of S301 - S302 in the above Figure 5 will be introduced in detail. This process can include S401 - S405 as Figure 9A shown.
[0268] S401. The NFC device in the mobile phone senses the NFC card. During the first time period, the NFC device of the mobile phone generates N NFC interrupt signals.
[0269] S402. During the first time period, the NFC device of the mobile phone sends the N NFC interrupt signals to the AP of the mobile phone.
[0270] Exemplarily, when the mobile phone senses the NFC card, the NFC device in the mobile phone can generate an NFC interrupt signal. Each time the NFC device generates an NFC interrupt signal, it can send the generated NFC interrupt signal to the AP.
[0271] In some embodiments, the NFC device of the mobile phone may include a first pin. The first pin of the NFC device is connected to the second pin of the above-mentioned AP through a wire. When the mobile phone senses the NFC card, the signal output by the first pin of the NFC device changes from a first signal to a second signal (i.e., the above-mentioned NFC interrupt signal). Thereafter, the NFC device can send the second signal to the AP.
[0272] Wherein, the above-mentioned first signal and second signal are different electrical signals. For example, the first signal is a low-level signal, and the second signal can be a high-level signal. Another example is that the first signal is a high-level signal, and the second signal can be a low-level signal. Another example is that the first signal is a rising-edge signal, and the second signal can be a falling-edge signal. Another example is that the first signal is a falling-edge signal, and the second signal can be a rising-edge signal. Several high levels indicate several interrupt signals, and there are several high-level signals during the first time period.
[0273] S403. During the above-mentioned first time period, the above-mentioned AP receives the above-mentioned N NFC interrupt signals.
[0274] S404. During the first time period, the Linux kernel on the above-mentioned AP sends the above-mentioned N first NFC interrupt events to the NFC process of the mobile phone based on the N NFC interrupt signals.
[0275] In some embodiments, after the Linux kernel obtains the NFC interrupt signal sent by the NFC device, it can determine whether the NFC interrupt signal is the same as the previous obtained NFC interrupt signal. If the same, the Linux kernel continues to execute the NFC interrupt signal processing solution disclosed in this application, such as continuing to count. Otherwise, the Linux kernel can initialize the counter, set the flag 1 to the above-mentioned second preset identifier, or clear the flag 2. Specifically, such as Figure 9BAs shown, after the Linux kernel receives the NFC interrupt signal (or the current NFC interrupt signal) generated by the NFC device, it can record the identifier of the NFC product corresponding to the NFC interrupt signal (i.e., the identifier of the current NFC product corresponding to the current NFC interrupt signal). After that, the Linux kernel can determine whether the identifier of the current NFC product is the same as the identifier of the previous NFC product. The identifier of the previous NFC product represents the identifier of the NFC product corresponding to the previous NFC interrupt signal of the current NFC interrupt signal.
[0276] If not, the Linux kernel can store the identifier of the NFC product corresponding to the current NFC interrupt signal (i.e., the new NFC product identifier), and initialize the counter, that is, clear the counter. And the Linux kernel can continue to be in the current NFC interrupt signal normally. If so, the Linux kernel can increment the counter by one, and the Linux kernel can continue to be in the current NFC interrupt signal normally, so as to determine whether the mobile phone frequently generates repeated NFC interrupt signals within the first time period. In this embodiment, after initializing the counter, the flag 2 can be cleared, or the flag 1 can be set to the second preset identifier.
[0277] In some embodiments, as described above Figure 9A As shown, when the AP receives the NFC interrupt signal, the AP can execute S10. When the AP is in the sleep state, it switches to the working state (the AP is woken up), and the Linux kernel processes the NFC interrupt signal. When the AP is in the working state, the Linux kernel processes the NFC interrupt signal.
[0278] In some embodiments, since there is no need to filter the NFC interrupt signals within the first time period, within the first time period, every time the AP receives an NFC interrupt signal, the Linux kernel on the AP can generate a first NFC interrupt event based on the one NFC interrupt signal.
[0279] Exemplarily, the process of the above Linux kernel generating an NFC interrupt event based on the NFC interrupt signal may include: the Linux kernel can obtain the interrupt vector table and determine the NFC interrupt handling function corresponding to the NFC interrupt signal. The interrupt vector table includes multiple external interrupt numbers and the interrupt handling function corresponding to each external interrupt number in the multiple external interrupt numbers. The interrupt handling function can be used to indicate the processing operations that the mobile phone needs to perform.
[0280] After that, the Linux kernel can determine the interrupt handling function corresponding to the above NFC interrupt number from the interrupt vector table. The interrupt handling function can be used to instruct the Linux kernel to read the data of the NFC card from the above NFC card and generate an NFC interrupt event based on the data of the NFC card. Combining Figure 10A with the log shown in, after entering the IRQ handling process, when the Linux kernel executes the interrupt handling function corresponding to the NFC interrupt number, it needs to read the data of the NFC card from the above NFC card. Among them, the Figure 10A 297 in can be the NFC interrupt number. Figure 10A The header data in can be the front part of the data read from the NFC card, and it is not necessary to print all the read data.
[0281] Exemplarily, the NFC interrupt number corresponding to the above NFC interrupt signal can be the pin number of the above first pin / above second pin. Combining Figure 10B with the log shown in, the interrupt handling function corresponding to the NFC interrupt number (such as 297) was executed multiple times within the 1 second. That is to say, within the 1 second, the NFC device frequently generates NFC interrupt signals and needs to frequently handle NFC interrupt signals.
[0282] In some embodiments, within a first time period, when the Linux kernel receives the NFC interrupt signal sent by the above NFC device, the Linux kernel can count through a counter to count the number of NFC interrupt signals generated within the first time period. At the end of the first time period, the Linux kernel can obtain the number of NFC interrupt signals generated within the first time period. When the number is greater than the first preset threshold, the Linux kernel can set the flag 1 to the above first preset identifier, or set the flag 2. When the number is less than the first preset threshold, the Linux kernel can not set the flag 2, or can set the flag 1 to the above second preset identifier, so that when the Linux kernel gets to the end of the first time period, it can determine whether the mobile phone meets the preset power-down condition according to the flag 2 or flag 1, that is, determine whether the mobile phone is in a scenario where the user does not use the NFC function of the mobile phone.
[0283] Exemplarily, within a first time period, every time the Linux kernel receives an NFC interrupt signal, it generates a corresponding NFC interrupt event. Then the Linux kernel can report the NFC interrupt event to the NFC process. Here, the NFC interrupt events generated within the first time period can be the above first NFC interrupt events. As Figure 10C each log shown in represents the reporting of an NFC interrupt event, and it can be seen that the NFC interrupt events are frequently reported. Exemplarily, the Figure 10CThe nfa_dm_nfc_response_cback in the shown log represents the reporting of an NFC interruption event. 0x5016 represents the event type corresponding to the NFC interruption event. Optionally, this 0x5016 belongs to the first preset type, that is, the event type corresponding to the NFC interruption event is 0x5016, and the NFC process can send an NFC broadcast message based on this NFC interruption event.
[0284] S405. During this first time period, the NFC process receives the above N first NFC interruption events and performs N first NFC operations based on the N first NFC interruption events.
[0285] In some embodiments, the process of S406 can include S20 - S22 as shown above. Figure 9A Among them, S20. The above NFC process generates N first NFC broadcast messages based on the N first NFC interruption events. After that, S21. The NFC process sends the above N first NFC broadcast messages. After that, S22. The target NFC application in the NFC application of the mobile phone receives the above N first NFC broadcast messages and processes the N NFC interruptions.
[0286] Exemplarily, every time the NFC process receives an NFC interruption event (such as the above first NFC interruption event), it generates an NFC broadcast message based on this one NFC interruption event. After that, the NFC process broadcasts this NFC broadcast message. After that, for the NFC application in the mobile phone, after receiving this NFC broadcast message, the NFC application is started. As Figure 10D The shown log indicates that the NFC broadcast message can start the wallet application process, that is, it can trigger the start of the wallet application. Among them, the sendBroadcast, caller: com.android.nfc in the log represents that the process name for sending the broadcast message is com.android.nfc. AppStart:..., proc: com.xxx.call represents that the xxx application is started. For example, xxx is the wallet application.
[0287] When the number of NFC broadcast messages is large, as Figure 10E can be seen from the shown log, the wallet application is frequently started. Exemplarily, the Figure 10E behind the Startproc field in the shown log represents the name of the application process that is started. For example, Startproc: com.xxx represents that the xxx application is started. And the Startproc: com.xxx: reportNfcDumpInfo in the log represents that the NFC - related process of the xxx application is started.
[0288] After the NFC application is launched, it determines whether to process the NFC broadcast message.
[0289] If so, it indicates that the NFC application is the target NFC application matching the NFC object, that is, it indicates that the NFC application needs to process the NFC broadcast message, and then the NFC application processes the NFC interruption. For example, if the NFC object is a bus card and the wallet application is the target NFC application, the processing of the NFC interruption by the wallet application may include writing data to the bus card, or reading the required data from the bus card, etc.
[0290] If not, the NFC application does not process the NFC broadcast message.
[0291] In some embodiments, the process of the above IRQ processing flow may include starting from generating an NFC interruption event by the above Linux kernel based on the NFC interruption signal, until the target NFC application processes the NFC interruption.
[0292] It should be understood that since the NFC interruption signal is a hardware interruption, its processing process is relatively fast. Therefore, although there is a delay between the generation of the NFC interruption signal and the processing of the NFC interruption signal, the time difference is very small, and it can be considered to be synchronous. For example, although there is a delay between the time when the above Linux kernel reports the first NFC interruption event and the time when the NFC device generates the NFC interruption signal, the delay is very small. Therefore, it can be considered that the NFC device generates N NFC interruption signals within the first time period, and the Linux kernel also reports the NFC interruption event corresponding to the NFC interruption signal within the first time period.
[0293] Next, in combination with the above Figure 4 shown software structure, a possible implementation process of S303 - S305 in the above Figure 5 will be introduced in detail. This process may include S406 - S409 as Figure 9A shown.
[0294] S406. After the end of the first time period, the above Linux kernel determines whether the mobile phone meets the preset power - off condition. Among them, the number N of NFC interruption signals generated in the above first time period is greater than the first preset threshold.
[0295] In the embodiment of the present application, when the number of NFC interruption signals generated during the above first time period (i.e., N) is greater than the first preset threshold, it indicates that a large number of NFC interruption signals are generated by the mobile phone. Then, the Linux kernel can determine whether the mobile phone meets the preset power-down condition, that is, determine whether the mobile phone is in a scenario where the user does not use the NFC function of the mobile phone. If the preset power-down condition is not met, it indicates that the user may use the NFC function of the mobile phone. If the preset power-down condition is met, it indicates that the user may not use the NFC function of the mobile phone.
[0296] S407. If the preset power-down condition is met, the Linux kernel performs an NFC power-down operation.
[0297] Exemplarily, the Linux kernel can send a power-down instruction to the NFC device through the AP, and the power-down instruction is used to trigger the power-down of the NFC device.
[0298] In some embodiments, the above NFC power-down operation can be used to trigger the periodic power-down of the NFC device in the mobile phone, that is, power down once every preset time. As Figure 11 shown, the AP (i.e., the Linux kernel on the AP) determines whether the mobile phone meets the preset power-down condition. If not, it indicates that the user may use the NFC function of the mobile phone, that is, it indicates that the NFC interruption signals generated during the above first time period may be generated when the mobile phone is used as a virtual NFC object. Therefore, in order to ensure the normal use of the NFC function of the mobile phone, the AP does not need to control the periodic power-down of the NFC device and continues to process the NFC interruption signals generated by the NFC device.
[0299] If so, it indicates that the user may not use the NFC function of the mobile phone, that is, it indicates that the NFC interruption signals generated during the above first time period may not be generated when the mobile phone is used as a virtual NFC object, but may be generated due to accidental touch. Therefore, the AP can control the periodic power-on of the NFC device. When the NFC device is powered on, the NFC device can generate an NFC interruption signal and send the NFC interruption signal to the AP, so that the AP processes the NFC interruption signal, thereby enabling the NFC function of the mobile phone to be possibly used normally by the user.
[0300] Exemplarily, as Figure 11 shown, during the power-down period of the above NFC device, the AP (the Linux kernel through the NFC process) can send a notification message to the NFC application of the mobile phone to prompt the NFC application that the NFC device in the mobile phone has been turned off. And, since the NFC device has been turned off, it is also unnecessary to send an NFC broadcast message.
[0301] In some embodiments, during power-down of the above NFC device, the Linux kernel may not send a shutdown broadcast to the upper-layer application through the NFC process. And the Linux kernel may not update the NFC status of the mobile phone, and the NFC status may still be in the enabled state, avoiding the user's confusion about why the NFC of the mobile phone is turned off.
[0302] S408. If the preset power-down condition is not met, the Linux kernel counts based on the NFC interrupt signal generated by the NFC device and sends a second NFC interrupt event to the NFC process.
[0303] Exemplarily, after the end of the first time period, when the Linux kernel obtains a new NFC interrupt signal, it determines whether the mobile phone meets the preset power-down condition. If not, the Linux kernel can perform a count and generate a corresponding NFC interrupt event (or called the second interrupt event). Then the Linux kernel can report the NFC interrupt event to the NFC process. The time period where the NFC interrupt signal is located can be regarded as a new first time period. Among them, if the new NFC interrupt signal is the first new NFC interrupt signal obtained by the Linux kernel after the end of the first time period (or called time period 1), then the first new NFC interrupt signal is the first NFC interrupt signal within the new first time period (or called time period 2). The start time of the time period 2 can be the end time of the time period 1.
[0304] S409. The NFC process receives the above second NFC interrupt event and performs a second NFC operation based on the second NFC interrupt event.
[0305] Among them, the process of the NFC process performing the second NFC operation based on the second NFC interrupt event is similar to the process of the NFC process performing the first NFC operation based on the first NFC interrupt event.
[0306] In this application, when the NFC card approaches the mobile phone, the NFC device is awakened, and the NFC device on the mobile phone wakes up the AP through the NFC interrupt signal. After the AP is awakened, it needs to process the NFC interrupt signal reported by the NFC. When the NFC card touches the mobile phone frequently, it may cause the NFC device and the AP to be awakened frequently, increasing the power consumption of the mobile phone. At the same time, after the NFC device is awakened, the mobile phone may have a short-term hold lock to prevent the sleep problem, with relatively high power consumption. Therefore, in order to reduce the power consumption, when it is determined that the number of NFC interrupt signals generated by the NFC device is large, the Linux kernel can determine whether the NFC function of the mobile phone is used by the user. If it is not used by the user, the Linux kernel can perform the NFC power-down operation, so that the NFC device of the mobile phone does not need to generate NFC interrupt signals, and the AP does not need to process NFC interrupt signals, reducing the power consumption of the mobile phone.
[0307] In some embodiments, when an NFC product (such as an NFC card) approaches an electronic device, the current of the electronic device adopting the NFC interrupt signal processing solution disclosed in this application is small. While the current of the electronic device that does not adopt the NFC interrupt signal processing solution disclosed in this application to process the NFC interrupt signal is large. When the electronic device is in the standby state, the contrast effect of the two currents is more obvious.
[0308] It should be understood that the receive and send operations between the modules inside the mobile phone described in this application actually refer to the call of functions.
[0309] In some embodiments, this application provides a computer-readable storage medium, including computer instructions. When the computer instructions run on a Bluetooth device, the electronic device is caused to execute the interrupt processing method described above.
[0310] In some embodiments, this application provides a computer program product. When the computer program product runs on a Bluetooth device, the electronic device is caused to execute the interrupt processing method described above.
[0311] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0312] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.
[0313] The units described as separate components may or may not be physically separated. The components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0314] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0315] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks or optical discs and other various media that can store program codes.
[0316] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An interrupt handling method, characterized in that, Including: An electronic device senses a Near Field Communication (NFC) product; At every preset period, the electronic device counts a first quantity of NFC interrupt signals generated within the preset period, and for the first quantity of NFC interrupt signals, the electronic device initiates the first quantity of interrupt processing; After the preset period ends, if the first quantity is greater than a first preset threshold, and when it is determined that the electronic device meets the preset power-down condition, the electronic device performs an NFC power-down operation; wherein, the NFC power-down operation is used to trigger the NFC device in the electronic device to power down periodically; during the power-down period of the NFC device, the NFC state of the electronic device is in an on state; during the current power-up period of the periodic power-down of the NFC device, if the quantity of NFC interrupt signals generated by the electronic device during the previous power-up period is less than or equal to a second preset threshold, the electronic device maintains the powered-up state of the NFC device, re-enters the preset period, and returns to the step of the electronic device counting the first quantity of NFC interrupt signals generated within the preset period; If the quantity of NFC interrupt signals generated by the electronic device during the previous power-up period is greater than the second preset threshold, the electronic device continues to control the NFC device to power down periodically; The preset power-down condition includes that the electronic device is in at least one of a pocket mode and a pocket movement combination mode; the pocket movement combination mode means that the electronic device is in the pocket mode and the movement mode.
2. The method according to claim 1, wherein The method further includes: After the preset period ends, the electronic device displays a first prompt message; the first prompt message is used to prompt the user that an abnormal NFC product touches the electronic device, and recommends that the user place the electronic device and the NFC product separately.
3. The method according to claim 1 or 2, characterized in that Initiating one-time interrupt processing includes generating an NFC interrupt event, sending an NFC broadcast message, and pulling up a target NFC application at least one of them; Initiating the first quantity of interrupt processing includes generating the first quantity of NFC interrupt events, sending the first quantity of NFC broadcast messages, and pulling up the target NFC application X times at least one of them, where X is equal to the first quantity.
4. The method according to claim 1, characterized in that The method further includes: When the electronic device does not meet the preset power-down condition, for the NFC interrupt signals generated by the electronic device, the electronic device performs interrupt processing.
5. The method according to claim 1 or 2, characterized in that, After performing the NFC power-down operation, the method further includes: When it is determined that the electronic device does not meet the preset power-down condition, the electronic device performs an NFC power-up operation; wherein, the NFC power-up operation is used to trigger the NFC device to power up.
6. The method according to claim 1 or 2, characterized in that, After performing the NFC power-down operation, the method further includes: In response to the user's opening operation of the NFC control switch of the electronic device, the electronic device performs an NFC power-up operation; wherein, the NFC power-up operation is used to trigger the NFC device to power up.
7. An electronic device, characterized in that, The electronic device includes an NFC device, a display screen, a memory, and one or more processors; the display screen, the memory, the NFC device, and the processors are coupled; The display screen is used to display images generated by the processor, and the memory is used to store computer program code, and the computer program code includes computer instructions; The NFC device is used to sense NFC products and generate NFC interrupt signals; The processor is used to count a first quantity of NFC interrupt signals generated by the NFC device within the preset period every preset period, and initiate interrupt processing for the first quantity of NFC interrupt signals; After the preset period ends, if the first quantity is greater than a first preset threshold, then when it is determined that the electronic device meets the preset power-down condition, trigger the NFC device to power down periodically; During the power-down period, the NFC state of the electronic device is in the on state; during the current power-on period of the periodic power-down of the NFC device, if the quantity of NFC interrupt signals generated by the NFC device during the previous power-on period is less than or equal to a second preset threshold, then maintain the power-on state of the NFC device, re-enter the preset period, and return to the step of counting the first quantity of NFC interrupt signals generated by the NFC device within the preset period; If the quantity of NFC interrupt signals generated by the NFC device during the previous power-on period is greater than the second preset threshold, then continue to control the NFC device to power down periodically; The preset power-down condition includes that the electronic device is in at least one of a pocket mode and a pocket motion combination mode; the pocket motion combination mode means that the electronic device is in a pocket mode and a motion mode.
8. A chip, characterized in that, Including: The chip is used to count a first quantity of NFC interrupt signals generated by the NFC device in the electronic device where the chip is located within the preset period every preset period, and initiate interrupt processing for the first quantity of NFC interrupt signals; After the preset period ends, if the first quantity is greater than a first preset threshold, then when it is determined that the electronic device meets the preset power-down condition, trigger the NFC device to power down periodically; During the power-down period, the NFC state of the electronic device is in the on state; During the current power-on period of the periodic power-down of the NFC device, if the quantity of NFC interrupt signals generated by the NFC device during the previous power-on period is less than or equal to a second preset threshold, then maintain the power-on state of the NFC device, re-enter the preset period, and return to the step of counting the first quantity of NFC interrupt signals generated by the NFC device in the electronic device where the chip is located within the preset period; If the quantity of NFC interrupt signals generated by the NFC device during the previous power-on period is greater than the second preset threshold, then continue to control the NFC device to power down periodically The preset power-down condition includes that the electronic device is in at least one of the pocket mode and the pocket and motion combination mode; the pocket and motion combination mode means that the electronic device is in the pocket mode and the motion mode.
9. A computer-readable storage medium, characterized in that, It includes computer instructions that, when running on an electronic device, cause the electronic device to execute the interruption processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
A method and a device for saving electricity of a mobile terminal
CN104159281A
Networking control method and device of terminal and electronic device
CN106507299A
NFC device detection
CN109905861A
System and method for reducing NFC power consumption after turning off screen of mobile phone and computer readable storage medium
CN113596254A
NFC function control method, NFC function control device and storage medium
CN115601029A