WO2021129147A1 - 接近传感器的异常检测方法、装置及移动终端 - Google Patents

接近传感器的异常检测方法、装置及移动终端 Download PDF

Info

Publication number
WO2021129147A1
WO2021129147A1 PCT/CN2020/125382 CN2020125382W WO2021129147A1 WO 2021129147 A1 WO2021129147 A1 WO 2021129147A1 CN 2020125382 W CN2020125382 W CN 2020125382W WO 2021129147 A1 WO2021129147 A1 WO 2021129147A1
Authority
WO
WIPO (PCT)
Prior art keywords
proximity sensor
mobile terminal
output value
proximity
blocked
Prior art date
Application number
PCT/CN2020/125382
Other languages
English (en)
French (fr)
Inventor
李经纬
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2021129147A1 publication Critical patent/WO2021129147A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/24Arrangements for testing
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/02Systems using the reflection of electromagnetic waves other than radio waves
    • G01S17/06Systems determining position data of a target
    • G01S17/08Systems determining position data of a target for measuring distance only
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S7/00Details of systems according to groups G01S13/00, G01S15/00, G01S17/00
    • G01S7/48Details of systems according to groups G01S13/00, G01S15/00, G01S17/00 of systems according to group G01S17/00
    • G01S7/497Means for monitoring or calibrating
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01VGEOPHYSICS; GRAVITATIONAL MEASUREMENTS; DETECTING MASSES OR OBJECTS; TAGS
    • G01V8/00Prospecting or detecting by optical means
    • G01V8/10Detecting, e.g. by using light barriers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M2250/00Details of telephonic subscriber devices
    • H04M2250/12Details of telephonic subscriber devices including a sensor for measuring a physical value, e.g. temperature or motion

Definitions

  • This application belongs to the technical field of sensor detection, and in particular relates to an abnormal detection method, device and mobile terminal of a proximity sensor.
  • Proximity sensors are sensors that can sense the proximity of objects.
  • Proximity sensors can be of various types.
  • proximity sensors can include infrared proximity sensors and ultrasonic proximity sensors. Take the infrared proximity sensor as an example to explain the principle.
  • the infrared proximity sensor emits infrared light continuously when it starts to work. The infrared light will be reflected back to the proximity sensor after encountering an obstacle.
  • the photodiode in the proximity sensor receives the reflected infrared light.
  • the infrared proximity sensor judges whether there is an external object approaching or far away from the proximity sensor according to the energy of the reflected infrared light received.
  • Proximity sensors are widely used in various mobile terminals to detect whether the user is close to the mobile terminal, and thereby realize flexible control of operations such as adjustment of the brightness of the display screen of the mobile terminal and switching between on and off. For example, during a voice call, if the proximity sensor detects that the user is close to the mobile terminal, the display screen is turned off, and if it is detected that the user is moving away from the terminal, the display screen is turned on to prevent the user from misoperation of the display screen during the voice call.
  • the proximity sensor in the mobile terminal may be abnormal.
  • you directly control the display screen based on the output value reported by the abnormal proximity sensor it is very likely that the display screen of the mobile terminal will be turned off when the user is far away, and will remain off. It cannot be illuminated.
  • the embodiments of the present application provide an abnormality detection method and device of a proximity sensor, and a mobile terminal, which can identify whether the proximity sensor in the mobile terminal is abnormal.
  • the first aspect of the embodiments of the present application provides an abnormal detection method of a proximity sensor, which is applied to a mobile terminal including the proximity sensor, and includes:
  • the mobile terminal samples the output value of the proximity sensor to obtain a first sample output value
  • the mobile terminal performs a data stability analysis on the output value of the first sample to obtain a stability analysis result
  • the mobile terminal obtains a detection result of whether the proximity sensor is abnormal according to the first sample output value and the stability analysis result.
  • the size and data stability of the sampled output value are monitored to determine whether the proximity sensor is continuously and stably outputting abnormal data, thereby obtaining the correctness Whether the proximity sensor has a detection result of proximity abnormality.
  • the method before the mobile terminal samples the output value of the proximity sensor, the method further includes:
  • the mobile terminal performs the operation of sampling the output value of the proximity sensor.
  • the embodiment of the present application first recognizes whether the proximity sensor is blocked; and when it is recognized that the proximity sensor is not blocked, the sampling of the output value of the proximity sensor and the proximity abnormality detection are initiated. Furthermore, it is ensured that the abnormality detection will not be interfered by the occlusion, and the credibility of the abnormality detection result is improved.
  • the operation of the mobile terminal to identify whether the proximity sensor is blocked specifically includes:
  • the mobile terminal obtains the ambient light intensity and the posture data of the mobile terminal, and based on the ambient light intensity and the posture data, identifies whether the proximity sensor is blocked.
  • the embodiment of the application simultaneously synthesizes the ambient light intensity and posture data where the mobile terminal is located to determine whether the proximity sensor may be in a blocked state, and realizes accurate recognition of whether the proximity sensor is blocked.
  • the operation of the mobile terminal to identify whether the proximity sensor is blocked specifically includes:
  • the mobile terminal obtains the intensity of the ambient light and the angle data of the pitch and roll angle of the mobile terminal. If the intensity of the ambient light is greater than the intensity threshold, the angle data of the pitch falls within the preset pitch angle value range, and The angle data of the roll angle belongs to the preset value range of the roll angle, and it is determined that the proximity sensor is not blocked.
  • the pitch angle and roll angle of the mobile terminal are used to accurately recognize whether the mobile terminal is held by the user in the space posture.
  • the mobile terminal is in the space posture held by the user and the ambient light intensity is strong At this time, it is determined that the proximity sensor is not blocked, which further realizes the accurate identification of whether the proximity sensor is blocked.
  • the mobile terminal obtains the detection result of whether the proximity sensor is abnormal according to the first sample output value and the stability analysis result, which specifically includes:
  • the mobile terminal determines that the The detection result is that the proximity sensor has a proximity abnormality.
  • the output value of the first sample collected in the first time period can meet the requirements of both numerical value and data stability, it means that the output value of the proximity sensor is stable and large at this time, and it meets the criterion of close to abnormality.
  • the application embodiment will determine that the detection result is that the proximity sensor has a proximity abnormality, thereby realizing accurate detection of the proximity abnormality.
  • the mobile terminal obtains a detection result of whether the proximity sensor is abnormal according to the first sample output value and the stability analysis result, which specifically includes:
  • the mobile terminal performs statistics The number of operations for sampling the output value of the proximity sensor to obtain the output value of the first sample
  • the mobile terminal detects the on-off state of its own display screen; if the on-off state of the display screen changes, the mobile terminal returns to perform the process of the proximity sensor The operation of sampling the output value to obtain the output value of the first sample;
  • the mobile terminal determines that the detection result is that the proximity sensor has a proximity abnormality.
  • the embodiment of the present application will determine that the detection result is that the proximity sensor has a proximity abnormality, thereby improving The accuracy of proximity anomaly detection.
  • the mobile terminal analyzes the first sample output value and the stability analysis result to obtain a detection result of whether the proximity sensor is abnormal, which specifically includes:
  • the mobile terminal performs statistics The number of operations for sampling the output value of the proximity sensor to obtain the output value of the first sample
  • the mobile terminal If the number of operations is less than the preset number of cycles, and the mobile terminal detects the on-off switching instruction of its own display screen, the mobile terminal returns to execute the sampling of the output value of the proximity sensor to obtain the first Operation of this output value;
  • the mobile terminal determines that the detection result is that the proximity sensor has a proximity abnormality.
  • the embodiment of the present application will determine that the detection result is that the proximity sensor has a proximity abnormality, thereby improving The accuracy of proximity anomaly detection.
  • the method before the mobile terminal recognizes whether the proximity sensor is blocked, the method further includes:
  • the mobile terminal samples the output value of the proximity sensor to obtain a second sample output value
  • the mobile terminal If there is a value greater than the second output value threshold among the second sample output values sampled within the second time period, the mobile terminal performs the operation of identifying whether the proximity sensor is blocked, wherein the first The second output value threshold is less than or equal to the first output value threshold.
  • the embodiments of the present application can avoid wasting the processor resources of the mobile terminal to a certain extent, and improve the detection efficiency of whether the proximity sensor has a proximity abnormality.
  • the method before the mobile terminal recognizes whether the proximity sensor is blocked, the method further includes:
  • the mobile terminal detects that it performs a preset behavior or a preset operation, it performs the operation of identifying whether the proximity sensor is blocked.
  • the embodiment of the present application guarantees the credibility of the proximity sensor abnormality detection result, and improves the accuracy of the operation control of the mobile terminal.
  • the identification operation of the preset behavior or the preset operation specifically includes:
  • a preset trigger instruction is detected, it is determined that the mobile terminal is performing a preset behavior or a preset operation.
  • the method before the mobile terminal recognizes whether the proximity sensor is blocked, the method further includes:
  • the mobile terminal periodically executes the operation of identifying whether the proximity sensor is blocked with a preset time point as a starting time point and a third duration as a period value.
  • the embodiment of the present application guarantees the credibility of the proximity sensor abnormality detection result, and improves the accuracy of the operation control of the mobile terminal.
  • the method further includes:
  • the proximity sensor is blocked, according to the first time point and the third time period when the operation of recognizing whether the proximity sensor is blocked, the next time the operation of recognizing whether the proximity sensor is blocked is acquired The second point in time;
  • each time the detection fails the next time the proximity sensor is close to the abnormal detection time point is started in advance, which can prevent the time between two effective detections from being too long and the reliability of the detection result is reduced.
  • the method further includes:
  • the mobile terminal stores the detection result in a local non-volatile memory.
  • the embodiments of the present application can guarantee the normal call of the proximity sensor by the mobile terminal during the period from the start-up to the first detection result of the proximity sensor abnormality after the start-up.
  • the method further includes:
  • the mobile terminal When the terminal needs to use the data reported by the proximity sensor, if the detection result is that the proximity sensor has a proximity abnormality, the mobile terminal ignores the data reported by the proximity sensor; or
  • the mobile terminal When the terminal needs to use the data reported by the proximity sensor, if the detection result is that the proximity sensor has a proximity abnormality, the mobile terminal sets the display screen of the mobile terminal to be always on.
  • the embodiment of the present application will promptly modify the original display screen on and off control scheme, set the display screen to be always on, or ignore the data reported by the proximity sensor, and display with reference to other parameters of the mobile terminal The screen is turned on and off, so as to avoid the situation that the display screen of the mobile terminal is continuously turned off due to the proximity of the proximity sensor.
  • a second aspect of the embodiments of the present application provides an abnormality detection device for a proximity sensor, including:
  • the occlusion recognition module is used to recognize whether the proximity sensor is occluded
  • the data analysis module is configured to, if the proximity sensor is not blocked, sample the output value of the proximity sensor to obtain a first sample output value, and perform data stability analysis on the first sample output value to obtain Corresponding stability analysis results;
  • the abnormality detection module is used to analyze the output value of the first sample and the stability analysis result to obtain a detection result of whether the proximity sensor is abnormal.
  • a third aspect of the embodiments of the present application provides a terminal device.
  • the terminal device includes a memory and a processor.
  • the memory stores a computer program that can run on the processor.
  • the processor executes the The computer program is used to enable the terminal device to implement the steps of the method for detecting abnormality of the proximity sensor as described in any one of the above-mentioned first aspects.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, including: a computer program is stored, wherein the computer program is executed by a processor to enable a terminal device to implement any of the above-mentioned first aspects.
  • a computer program is stored, wherein the computer program is executed by a processor to enable a terminal device to implement any of the above-mentioned first aspects.
  • the fifth aspect of the embodiments of the present application provides a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to execute the method for detecting anomaly of the proximity sensor in any one of the above-mentioned first aspects.
  • FIG. 1 is a schematic structural diagram of a mobile phone to which a proximity sensor abnormality detection method provided by an embodiment of the present application is applicable;
  • 2A is a schematic flowchart of a method for detecting abnormality of a proximity sensor according to an embodiment of the present application
  • 2B is a schematic flowchart of a method for detecting abnormality of a proximity sensor according to an embodiment of the present application
  • Figure 3 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a method for detecting abnormality of a proximity sensor according to an embodiment of the present application
  • FIG. 7A is a schematic flowchart of a method for detecting abnormality of a proximity sensor according to an embodiment of the present application
  • FIG. 7B is a schematic flowchart of a method for detecting an abnormality of a proximity sensor according to an embodiment of the present application
  • FIG. 8 is a schematic structural diagram of an abnormality detection device for a proximity sensor according to an embodiment of the present application.
  • Fig. 9 is a schematic structural diagram of a mobile terminal provided by an embodiment of the present application.
  • the term “if” can be construed as “when” or “once” or “in response to determination” or “in response to detecting “.
  • the phrase “if determined” or “if detected [described condition or event]” can be interpreted as meaning “once determined” or “in response to determination” or “once detected [described condition or event]” depending on the context ]” or “in response to detection of [condition or event described]”.
  • the method for detecting anomaly of the proximity sensor provided by the embodiment of the application can be applied to mobile terminals such as mobile phones, tablet computers, and wearable devices.
  • the mobile terminal is the execution subject of the method for detecting anomaly of the proximity sensor provided by this embodiment of the application.
  • the embodiments of this application do not impose any restrictions on the specific types of mobile terminals.
  • the wearable device may also be a general term for applying wearable technology to intelligently design daily wear and develop wearable devices.
  • wearable devices such as gloves, watches and clothing.
  • a wearable device is a portable device that is directly worn on the body or integrated into the user's clothes or accessories.
  • Wearable devices are not only a kind of hardware device, but also realize powerful functions through software support, data interaction, and cloud interaction.
  • wearable smart devices include full-featured, large-sized, complete or partial functions that can be implemented without relying on smart phones, such as smart watches or smart glasses, and only focus on a certain type of application function, and need to be used in conjunction with other devices such as smart phones. , Such as various smart bracelets for physical sign monitoring.
  • Fig. 1 shows a block diagram of a part of the structure of a mobile phone provided in an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a proximity sensor 150, an ambient light sensor 151, an audio circuit 160, and wireless fidelity (Wi-Fi).
  • Fi Wireless fidelity
  • Fi Wireless fidelity
  • Module 170 processor 180, power supply 190 and other components.
  • FIG. 1 does not constitute a limitation on the mobile phone, and may include more or fewer components than those shown in the figure, or a combination of some components, or different component arrangements.
  • the RF circuit 110 can be used for receiving and sending signals during information transmission or communication. In particular, after receiving the downlink information of the base station, it is processed by the processor 180; in addition, the designed uplink data is sent to the base station.
  • the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, and the like.
  • the RF circuit 110 can also communicate with the network and other devices through wireless communication.
  • the above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), Email, Short Messaging Service (SMS), etc.
  • GSM Global System of Mobile Communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • Email Short Messaging Service
  • the memory 120 may be used to store software programs, detection results of abnormal proximity sensor proximity, and modules.
  • the processor 180 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 120.
  • the memory 120 may mainly include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of mobile phones (such as audio data, detection results of proximity sensor proximity abnormalities, etc.), etc.
  • the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the input unit 130 may be used to receive inputted numeric or character information, and generate key signal input related to user settings and function control of the mobile phone 100.
  • the input unit 130 may include a touch panel 131 and other input devices 132.
  • the touch panel 131 also known as a touch screen, can collect user touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc.) on the touch panel 131 or near the touch panel 131. Operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 131 may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the user's touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it To the processor 180, and can receive and execute the commands sent by the processor 180.
  • the touch panel 131 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave.
  • the input unit 130 may also include other input devices 132.
  • the other input device 132 may include, but is not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackball, mouse, and joystick.
  • the display unit 140 may be used to display information input by the user or information provided to the user and various menus of the mobile phone.
  • the display unit 140 may include a display screen 141.
  • the display screen 141 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an organic light emitting diode (Organic Light-Emitting Diode, OLED), etc.
  • the touch panel 131 can cover the display screen 141. When the touch panel 131 detects a touch operation on or near it, it transmits it to the processor 180 to determine the type of the touch event, and then the processor 180 responds to the touch event. The type provides a corresponding visual output on the display 141.
  • the touch panel 131 and the display screen 141 are used as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 131 and the display screen 141 can be integrated. Realize the input and output functions of the mobile phone.
  • the mobile phone 100 also includes a proximity sensor 150 and an ambient light sensor 151.
  • the ambient light sensor can detect the intensity of the ambient light where the mobile phone is located.
  • the proximity sensor can detect that an external object is approaching or away from the phone.
  • sensors such as barometers, hygrometers, thermometers, and attitude sensors that can be configured in the mobile phone, I won't repeat them here.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the mobile phone.
  • the audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is then output by the audio circuit 160. After being received, it is converted into audio data, and then processed by the audio data output processor 180, and then sent to, for example, another mobile phone via the RF circuit 110, or the audio data is output to the memory 120 for further processing.
  • Wi-Fi is a short-distance wireless transmission technology.
  • the mobile phone can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170. It provides users with wireless broadband Internet access.
  • FIG. 1 shows the Wi-Fi module 170, it is understandable that it is not a necessary component of the mobile phone 100, and can be omitted as needed without changing the essence of the invention.
  • the processor 180 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes by running or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120. Various functions and processing data of the mobile phone can be used to monitor the mobile phone as a whole.
  • the processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 180.
  • the mobile phone 100 also includes a power source 190 (such as a battery) for supplying power to various components.
  • a power source 190 such as a battery
  • the power source can be logically connected to the processor 180 through a power management system, so that functions such as charging, discharging, and power consumption management can be managed through the power management system.
  • the mobile phone 100 may also include a camera.
  • the position of the camera on the mobile phone 100 may be front-mounted or rear-mounted, which is not limited in the embodiment of the present application.
  • the mobile phone 100 may include a single camera, a dual camera, or a triple camera, etc., which is not limited in the embodiment of the present application.
  • the mobile phone 100 may include three cameras, of which one is a main camera, one is a wide-angle camera, and one is a telephoto camera.
  • the multiple cameras may be all front-mounted, or all rear-mounted, or partly front-mounted and some rear-mounted, which is not limited in the embodiment of the present application.
  • the mobile phone 100 may also include a Bluetooth module, etc., which will not be repeated here.
  • two output thresholds are generally set.
  • the output value of the proximity sensor is greater than the larger output value threshold, it indicates that the current user is closer to the mobile terminal, and the mobile terminal will determine that the user is in a close state at this time.
  • the output value of the proximity sensor is less than the smaller output value threshold, it means that the current user is far away from the mobile terminal, and the mobile terminal will determine that the user is far away.
  • proximity sensor abnormalities can be divided into two categories, one is far away abnormality, when the output value of the proximity sensor output will be less than the smaller output value threshold, the other is proximity abnormality, when the proximity sensor The output value of the output will be greater than the larger output value threshold.
  • the proximity state and the far state correspond to different operation steps. At this time, if the proximity sensor has a proximity abnormality, it will directly cause the operation of the mobile terminal to be unable to be controlled normally.
  • the display screen when controlling the on-off state of the display screen of the mobile terminal based on the proximity sensor data, the display screen will be turned off when approaching, and therefore the proximity abnormality will cause the display screen to remain in the off state and cannot be illuminated. Therefore, in order to prevent the abnormal operation of the mobile terminal caused by the abnormal proximity sensor, such as causing the display screen to remain in the extinguished state, a method that can recognize the proximity abnormality of the proximity sensor is needed.
  • the embodiment of the present application first recognizes whether the proximity sensor is blocked, and when it is recognized that the proximity sensor is not blocked, the sampling of the proximity sensor output value and the proximity abnormality detection are initiated.
  • the size and data stability of the sampled output value will be detected to determine whether the proximity sensor is continuously and stably outputting abnormal data, and then whether the proximity sensor exists
  • the detection result of the proximity abnormality ensures the accuracy and reliability of the proximity abnormality detection of the proximity sensor.
  • the type of proximity sensor actually used in the embodiment of the present application needs to be determined according to the actual scene, which is not limited here, and includes, but is not limited to, infrared proximity sensors and ultrasonic proximity sensors.
  • the proximity sensor as an infrared proximity sensor as an example, the embodiments of the present application are described as follows:
  • FIG. 2A shows a schematic flowchart of a method for detecting abnormality of a proximity sensor according to an embodiment of the present application. This method can be applied to the above-mentioned mobile phone 100, and can also be applied to other mobile terminals containing proximity sensors. The details are as follows:
  • S2001 The mobile terminal samples the output value of the proximity sensor to obtain the first sample output value.
  • S2002 The mobile terminal performs data stability analysis on the output value of the first sample, and obtains a corresponding stability analysis result.
  • S2003 The mobile terminal obtains a detection result of whether the proximity sensor is abnormal according to the output value of the first sample and the stability analysis result.
  • the proximity sensor Since there is a proximity sensor with an abnormal proximity, its output value will continue to be large and relatively stable. Therefore, in the embodiment of the present application, the proximity sensor will be identified based on the output value and stability of the proximity sensor to determine whether the proximity sensor is abnormal.
  • the specific detection principle and operation details can be described with reference to the embodiment corresponding to FIG. 2B, which will not be repeated here.
  • the mobile terminal may be placed in various possible different scenarios as the user uses it, for example, placed inside opaque objects such as pockets, school bags, and boxes, or placed on tables and stools. Wait for the surface of the object, or be held by the user.
  • the proximity sensor may or may not be blocked.
  • occlusion refers to the presence of obstacles in the proximity of the proximity sensor, so that the energy of the wave received by the proximity sensor is continuously strong.
  • the proximity sensor is blocked by the palm of the user, an obstacle is placed on the surface of the proximity sensor, and the proximity sensor is placed inside an opaque object.
  • the proximity sensor is in a blocked state. When the proximity sensor is in a blocked state, there is no abnormality for the proximity sensor.
  • the output value of the proximity sensor will continue to be large.
  • it is also based on the output value to determine whether it is abnormal; if the output value continues to be large, it is confirmed as abnormal. Therefore, if the embodiment shown in FIG. 2A is an abnormality detection performed when the proximity sensor is blocked, no matter whether the proximity sensor has a proximity abnormality, the final output result is that the output value continues to be large, which leads to the abnormal detection result. The credibility is low.
  • an embodiment of the present application provides an abnormality detection method for a proximity sensor. The details are as follows:
  • S201 The mobile terminal recognizes whether the proximity sensor is blocked.
  • the embodiment of the present application starts the proximity sensor proximity abnormality detection process when the proximity sensor proximity abnormality detection is triggered.
  • the proximity abnormality detection it will first identify whether the proximity sensor is blocked, and only when the proximity sensor is not blocked, will the subsequent specific operation of the proximity sensor abnormality detection be initiated.
  • the embodiment of the present application does not limit the specific occlusion detection method used, and can be set by a technician according to actual needs.
  • the specific trigger method of proximity anomaly detection is not limited here, and can be set by a technician according to actual needs.
  • it can be set as a timing trigger, for example, it can be set as a fixed time point trigger for each bar. At this time, when a fixed time point is reached, the operation of S201 will be triggered.
  • a sensor detection function may also be provided in the mobile terminal, and the operation of S201 can be triggered when the user activates the sensor detection function.
  • the ambient light intensity is sometimes not directly equivalent to whether the proximity sensor is blocked or not.
  • a mobile phone when both the ambient light sensor and the proximity sensor are set in the top area of the mobile phone (in fact, many full-screen mobile phones have a large number of sensors set in the top area of the mobile phone to achieve the full-screen effect of the mobile phone).
  • the mobile phone is placed face down on the desktop, referring to Figure 3, since the ambient light sensor is located on the top of the mobile phone, the ambient light sensor can still detect strong ambient light normally at this time.
  • the proximity sensor because it detects whether there is an obstacle approaching in the front of the mobile terminal, for the proximity sensor, the desktop is now a fixed obstacle with a very close distance; that is, the proximity sensor is at this time. Obscured state. Therefore, if the proximity sensor is judged directly based on the intensity of the ambient light, it will inevitably cause a large number of false recognition results, which makes it difficult to effectively guarantee the recognition accuracy of the proximity sensor abnormality.
  • the embodiment of the present application in order to accurately recognize that the proximity sensor is not blocked, the embodiment of the present application will simultaneously integrate the two dimensional data of the ambient light intensity and the spatial attitude of the mobile terminal to determine whether the proximity sensor is blocked.
  • the recognition process of occlusion is as follows:
  • the mobile terminal obtains the ambient light intensity and the posture data of the mobile terminal, and based on the ambient light intensity and posture data, identifies whether the proximity sensor is blocked.
  • the ambient light intensity can be detected by the ambient light sensor in the mobile terminal
  • the posture data can be detected by the posture sensor in the mobile terminal.
  • the types of posture sensors that can be used include, but are not limited to, gyroscopes, multi-axis accelerometers, and gravity sensors, which need to be determined according to the actual mobile terminal hardware configuration.
  • the embodiment of the present application still reserves the ambient light intensity as one of the indicators for detecting whether the proximity sensor is blocked.
  • the mobile terminal may present various postures in the space during the process of being used by the user. For example, refer to FIG. 4 for the vertical screen posture when the user is operating on the vertical screen, and the back horizontal screen posture when placed on the table with the front face down and the back face up in Fig. 3, and so on.
  • the actual application shows that the possibility of the proximity sensor being blocked under different postures is also very different.
  • the mobile terminal when the mobile terminal is in the back landscape posture, the user generally places the mobile terminal on top of a table, stool and other objects with the back of the mobile terminal facing up. At this time, the proximity sensor is in a blocked state.
  • the mobile terminal When the mobile terminal is in a vertical screen posture or an approximate vertical screen posture, the user is generally using the mobile terminal, and the proximity sensor is in an unobstructed state at this time.
  • the embodiment of the present application will also take the spatial attitude of the mobile terminal as one of the consideration indicators, that is, will simultaneously integrate the ambient light intensity and attitude data where the mobile terminal is located to determine whether the proximity sensor may be The state of occlusion.
  • the embodiment of the present application will set a light intensity threshold as a measure of ambient light intensity, or set a set of calculation rules for the light intensity threshold, so as to calculate the corresponding light intensity threshold when the ambient light intensity comparison is required.
  • the embodiment of the present application also selects some spatial postures with a low probability of being blocked by the proximity sensor, and sets the posture data corresponding to these postures to realize the recognition of the spatial posture when the proximity sensor is not blocked.
  • the method for setting the light intensity threshold is not limited in the embodiment of the present application, and can be selected or set by a technician according to actual needs.
  • the light intensity threshold can be set to a fixed value.
  • the size of the specific fixed value is not limited here, and a suitable light intensity threshold can be set by the technician according to actual needs. For example, it can be considered and set according to factors such as the geographic area where the actual user is located.
  • the light intensity threshold can be set to any value between 30 lux and 70 lux, for example, it can be set to 50 lux. Or 60 Lux.
  • a set of corresponding light intensity threshold calculation rules may be set.
  • the specific calculation rules are not limited here, and can be set by technicians according to actual needs.
  • the calculation rule can be set according to factors such as the geographic area where the actual user is located and the real-time time period (such as day or night).
  • the calculation rules can be set as follows: set a reference value in advance, set different constant coefficients for different geographic areas and time periods, and then set the constant coefficient coefficients corresponding to the geographic area and time period where the user is in real time. , To calculate the sum of the reference value, and then get the final light intensity threshold.
  • the embodiment of the present application does not limit the selected spatial posture and the corresponding posture data, which can be selected or set by the technicians themselves.
  • the vertical screen posture can be set as the space posture required in the embodiments of this application.
  • the corresponding posture data set in the vertical screen posture of the mobile terminal can be used as the judgment data when the proximity sensor is not blocked, that is, as long as the ambient light intensity is greater than the intensity threshold, and the posture data of the mobile terminal belongs to the corresponding vertical screen posture.
  • the posture data collection can determine that the proximity sensor is not blocked. Conversely, as long as the ambient light intensity is less than or equal to the intensity threshold and the posture data of the mobile terminal does not belong to the corresponding posture data set in the vertical screen posture, any one or two conditions will determine that the proximity sensor is blocked.
  • the attitude data of the mobile terminal includes three attitude angles: pitch angle, roll angle, and yaw angle.
  • the pitch angle, roll angle, and yaw angle respectively refer to the angles generated by the mobile terminal rotating around the x-axis, y-axis, and z-axis of the mobile terminal coordinate system.
  • attitude angle of the mobile terminal includes three angle data of pitch angle, yaw angle and roll angle
  • the attitude data obtained in the embodiment of the present application may include any one or more angle data among the pitch angle, the yaw angle, and the roll angle.
  • the attitude data corresponding to the space attitude at this time only needs to include the angle data of the pitch angle and the roll angle.
  • the attitude data in the embodiment of the present application only includes angle data referring to the pitch angle and the roll angle, and the yaw angle is ignored. It can be seen that the content of the posture data actually required to be collected in the embodiment of the present application needs to be determined according to the posture data corresponding to the actually selected spatial posture.
  • the embodiment of the application selects the corresponding posture set when the mobile terminal is held by the user as the spatial posture set for judging that the proximity sensor is not blocked, and sets the corresponding pitch angle
  • the value range and the roll angle value range are used for detection.
  • the mobile terminal obtains the ambient light intensity and the pitch and roll angle data of the mobile terminal. If the ambient light intensity is greater than the intensity threshold, the pitch angle data belongs to the preset pitch angle value range, and the roll angle angle data belongs to the preset pitch angle. Set the roll angle value range to determine that the proximity sensor is not blocked. Conversely, as long as the ambient light intensity is less than or equal to the intensity threshold, the angle data of the pitch angle does not belong to the preset pitch angle value range, and the angle data of the roll angle does not belong to the preset roll angle value range, these three conditions are Any one or more of the conditions will determine that the proximity sensor is blocked.
  • the embodiments of this application do not limit the specific pitch angle value range and roll angle value range, and the technician can detect the changes in the corresponding pitch angle and roll angle when the mobile terminal is actually held, and according to the detection result
  • the pitch angle value range may be set to [-50°, 15°]
  • the roll angle value range may be set to [-30°, 30°].
  • the pitch angle and roll angle of the mobile terminal are used to accurately recognize whether the mobile terminal is held by the user in the space posture.
  • the mobile terminal is in the space posture held by the user and the ambient light intensity is strong At this time, it is determined that the proximity sensor is not blocked, which further realizes the accurate identification of whether the proximity sensor is blocked.
  • the mobile terminal samples the output value of the proximity sensor to obtain a first sample output value, and performs a data stability analysis on the first sample output value to obtain a corresponding stability analysis result.
  • the proximity sensor When the proximity sensor is not blocked, if there is no abnormality in the proximity sensor, the reflected infrared light received by the proximity sensor continues to be weak or cannot receive the reflected infrared light, so the output value of the proximity sensor will continue to be small; and if the proximity sensor There is a proximity abnormality, and the output value of the proximity sensor will continue to be large at this time. Therefore, in the case that the proximity sensor is not blocked, theoretically effective detection of the proximity abnormality of the proximity sensor can be achieved.
  • the infrared light intensity received by the proximity sensor under occlusion is subject to certain fluctuations due to the movement of the obstacle itself and the influence of factors such as the light in the environment.
  • the output value of the sensor will also have certain volatility. Therefore, in theory, it is possible to achieve a secondary screening of the occlusion situation according to the volatility of the output value of the proximity sensor, which provides a double guarantee for the identification of the proximity abnormality.
  • the output values are generally very stable with extremely small volatility. Therefore, by analyzing the stability of the output value of the proximity sensors, it is possible to identify whether the proximity sensors are in proximity abnormalities.
  • the embodiment of the present application will start sampling the output value of the proximity sensor, and at the same time, perform data stability analysis on the obtained first sample output value, so as to obtain the characterization
  • the stability analysis result of the volatility of the output value provides necessary data for subsequent abnormal detection of the proximity sensor based on the output value size of the first sample and the stability analysis result.
  • the sampling frequency of the proximity sensor output value is not limited, and can be set by a technician according to actual needs. In some embodiments, the sampling frequency can be set to any one of 30 times/sec to 60 times/sec. frequency.
  • data stability analysis refers to analyzing the degree of dispersion or concentration of data to obtain a quantitative result of data stability.
  • the higher the degree of dispersion between the data the greater the fluctuation of the data, indicating that the degree of concentration between the data is poorer, and the stability of the data is worse; when the degree of dispersion between the data is lower, the data fluctuates The smaller the value, the higher the degree of concentration between the data, the better the data stability.
  • any one or both of data dispersion analysis and concentration analysis can be used to quantify data stability, which can be selected or set by a technician according to actual needs.
  • the embodiments of this application do not limit the specific analysis methods of data stability, which can be selected or set by technicians according to actual needs, including but not limited to adjacent difference method, most value difference method, statistical method (such as Calculate variance and standard deviation, etc.) and percentage measurement method.
  • the data type corresponding to the stability analysis result may also have certain differences.
  • the adjacent difference method can be used for data stability analysis.
  • the stability analysis result is a value that changes in real time with each output value sampling.
  • the variance in the statistical method can also be used as the stability analysis result. In this case, after sampling for a period of time, the output value obtained by the sampling will be calculated for the variance, and the obtained variance value will be used as Corresponding stability analysis results.
  • a stability level can be determined according to the magnitude of the numerical value, and the stability level can be used as the stability analysis result.
  • the data stability is divided into one, two and three levels, and after calculating a value that can characterize the data stability, the corresponding level is determined according to the value. Therefore, in these embodiments, the stability analysis result is a specific level rather than a numerical value.
  • S203 The mobile terminal obtains a detection result of whether the proximity sensor is abnormal according to the first sample output value and the stability analysis result.
  • the embodiment of the present application will detect whether the output value of the first sample is continuously large, and at the same time, it will also detect the output value of the first sample according to the stability analysis result. Whether it is stable, and comprehensively determine whether the proximity sensor has a proximity abnormality based on the two detection results.
  • a first output value threshold is preset in the embodiment of the application, and when the output value of the first sample is greater than the first output value threshold, it is determined that the first output value is greater than the first output value threshold.
  • the sample output value is relatively large; when it is not greater than the first output value threshold, it is determined that the first sample output value is relatively small.
  • the specific first output value threshold is not limited here, and can be set by the technician according to the actual use of the proximity sensor. For example, after determining the type of proximity sensor that needs to be analyzed and detected, the technician can detect the output value of some similar proximity sensors with proximity abnormalities in advance, and set the required value according to the actual detection result.
  • the first output threshold when the proximity sensor is an infrared proximity sensor, the first output value threshold can be set to any value from 1600 to 2000, for example, it can be set to 1800 or 1900.
  • the embodiment of the present application in order to measure whether the output value of the proximity sensor is stable, that is, whether the fluctuation is large, the embodiment of the present application also presets a preset value range.
  • the stability analysis result is within the preset value range, the current The application embodiment will determine that the output value output by the proximity sensor is stable. Otherwise, if it is not within the preset value range, it is considered that the output value fluctuates greatly and is unstable.
  • the embodiment of the present application does not limit the specific preset value range used, and can be set by a technician according to the data stability analysis method used and the actual demand for the stability of the output value.
  • the setting of the value range is preset according to the different quantification methods of data stability in practical applications.
  • an upper threshold is often set. When the stability analysis result is less than the upper threshold, it is determined that the output value is stable.
  • a lower threshold is often set. When the stability analysis result is higher than the lower threshold, it is determined that the output value is stable.
  • an upper threshold and a lower threshold are set respectively, and the output value is determined when the result obtained by the degree of dispersion analysis method is less than the upper threshold value, and the result obtained by the degree of concentration analysis method is greater than the lower threshold value. stable.
  • the sampling and abnormal detection of the output value of the proximity sensor are started.
  • the size and data stability of the sampled output value will be detected to determine whether the proximity sensor is continuously and stably outputting abnormal data.
  • S203 can be replaced with S601.
  • the anomaly detection method provided by the embodiment of the present application includes:
  • S201 The mobile terminal recognizes whether the proximity sensor is blocked.
  • the mobile terminal samples the output value of the proximity sensor to obtain a first sample output value, and performs a data stability analysis on the first sample output value to obtain a corresponding stability analysis result.
  • the embodiment of the present application also sets a first duration as the corresponding continuous detection duration, and performs the same sampling of the first output value within the first duration.
  • This output value analyzes the numerical value and data stability to determine whether the proximity sensor is abnormal.
  • the specific value of the first duration It can be set by technicians according to actual needs, and it is not limited here.
  • the first duration can be set to any value from 0 to 60 minutes.
  • the embodiment of the present application will compare the first output value threshold value of the first sample output value sampled each time within the first time length after the start of sampling. At the same time, it will also determine whether the stability analysis result of the output value of the first sample sampled in the first time period is within the preset value range. If the output value of the first sample sampled in the first time period meets the value at the same time. The two requirements of size and data stability indicate that the output value of the proximity sensor is stable and large at this time, and satisfies the judgment standard of proximity abnormality. At this time, the embodiment of the present application will determine that the detection result is that the proximity sensor has proximity abnormality.
  • the embodiment of the present application will determine that the proximity sensor does not have a proximity abnormality, and end the approach to the proximity sensor Abnormal detection operation.
  • the method of analyzing the degree of dispersion is selected to quantify the stability of the data.
  • the stability analysis result output by S202 is the data fluctuation value obtained after the discrete degree analysis is performed on the output value. It can be seen from the description in S203 that, at this time, the preset value range can be replaced by an upper threshold, and in this embodiment of the present application, a preset fluctuation threshold will be set as the upper threshold.
  • the "stability analysis result is in the preset value range" in S601 can be replaced with "the data fluctuation value is less than the preset fluctuation threshold" in the embodiment of the present application.
  • the specific size of the preset fluctuation threshold can be set by a technician according to actual needs, and is not limited here.
  • the proximity sensor is an infrared proximity sensor
  • the preset fluctuation threshold can be set to any value from 50 to 200.
  • the specific data stability analysis method used is not limited in the embodiments of the present application. It can be seen from the description in the foregoing embodiment of the present application that, depending on the data stability analysis method used, the stability analysis result output in S202 may be data that changes as the sampling situation of the output value changes. For example, in the adjacent difference method, the stability analysis result will change in real time with each output value sampling. For another example, the statistical method is to analyze all the output values of the first sample within a period of time to obtain the corresponding stability analysis result.
  • the end time of the analysis period in some embodiments is set to the time from the current sampling to the output value of the first sample, for example, suppose it is set to calculate the variance of the output value of the first sample obtained by sampling in the last 20 seconds.
  • the corresponding stability analysis result will also change correspondingly every time a new first sample output value is sampled.
  • the output stability analysis result may also be a fixed data obtained by analyzing the output value of all the first samples in the first time period after the sampling of the first time period is completed, for example, outputting all the first samples in the first time period
  • the variance calculation is performed on the value, and the variance is used as the corresponding stability analysis result. Therefore, corresponding to different stability analysis results output conditions, there will be certain differences in the detection process of the stability analysis results in the embodiments of the present application. in particular:
  • the corresponding generated stability analysis result is data that will change as the sampling situation of the output value changes.
  • the detection of the stability analysis result in the embodiment of the present application will also determine whether the new stability analysis result is within the corresponding preset value range every time a new stability analysis result is generated. Before the end of the first period of sampling, as long as there is a stability analysis result that does not fall within the preset value range, it will be determined that the output value of the proximity sensor is unstable. For example, when the adjacent difference method is used for analysis, each time the output value of the first sample is sampled in S202, the output value of the first sample sampled this time will be compared with the output value of the first sample sampled last time.
  • the embodiment of the present application will determine whether the difference value belongs to the preset value range every time after the difference value is calculated, and if it does not, it is determined that the output value of the proximity sensor is unstable.
  • the selected data stability analysis method is a fixed stability analysis result obtained by analyzing the output values of all the first samples in the first time period after the sampling of the first time period is completed.
  • S202 will analyze the output value of the first sample in the first time period obtained by the sampling after the sampling of the first time period is completed, and obtain a corresponding stability analysis result.
  • the embodiment of the present application will also determine whether the final calculated stability analysis result falls within the preset value range after the first time duration sampling ends, and if it does not, it is determined that the output value of the proximity sensor is unstable.
  • a common processing strategy is to directly immobilize the control state of the mobile terminal, and the immobilized control state will cause the mobile terminal to malfunction. Indicators such as efficiency or power consumption are affected. For example, in order to prevent the display of a mobile terminal from being continuously turned off due to an abnormal approach, a common processing strategy is to directly set the display of the mobile terminal to always be on. At this time, the probability of user misoperation and the power consumption of the mobile terminal will increase. Therefore, the accuracy of the actual proximity abnormality often has a greater impact on the user's use of the mobile terminal.
  • the foregoing embodiments of the present application can detect the proximity abnormality of the proximity sensor, a single detection often has a certain accidental error, and also It cannot meet the different levels of requirements for the accuracy of proximity anomaly detection in different scenarios.
  • the method for detecting proximity abnormality includes:
  • S701 The mobile terminal determines whether the proximity sensor is blocked. If the proximity sensor is not blocked, the operation of S702 is performed.
  • S702 The mobile terminal samples the output value of the proximity sensor to obtain a first sample output value, and performs a data stability analysis on the first sample output value to obtain a corresponding stability analysis result.
  • S701 and S702 please refer to the description of S201 and S202 in the embodiment corresponding to FIG. 2B, which will not be repeated here.
  • the operating principle of S701 is basically the same as that of S601. Therefore, for the description of the first duration, the size of the first sample output value and the principle and step description of the data stability detection, please refer to the embodiment corresponding to FIG. 6 Relevant descriptions in, I won’t repeat them here.
  • the difference from S601 is that, after detecting that the output value of the proximity sensor is stable and large, the embodiment of the application only ends the current detection process of the output value and data stability of the first sample without determining Whether the proximity sensor has reception abnormality. At the same time, after each end of the detection process, the embodiment of the present application will also count the total number of times the detection process is executed after it is recognized that the proximity sensor is not blocked. Since the detection process needs to be returned to the operation of S702 each time the detection process is executed, only It is necessary to count the number of times the operation is performed to obtain the total number of corresponding proximity anomaly detections. Among them, the end of the detection process refers to the completion of the detection of the output value of the current sample and the stability analysis result, and the detection result is that the output value is stable and large.
  • a variable may be set to record the number of proximity anomaly detections. That is, every time the proximity sensor is detected abnormally, the variable will be self-added by one. At this time, the statistics of the number of operations of "the mobile terminal samples the output value of the proximity sensor to obtain the first sample output value", It only needs to subtract the initial value of the variable from the real-time value of the variable.
  • S704 The mobile terminal compares the number of operations with the preset number of cycles, and then executes S705 or S707.
  • the preset number of cycles is used to limit the total number of times for proximity anomaly detection. Since a single approach anomaly detection often has a certain occasional error, in order to improve the accuracy of approach anomaly detection, the embodiment of the present application provides a mechanism for selecting the number of approach anomaly detections. The probability of accidental error is adjusted through different times of proximity anomaly detection, so that the accuracy level of proximity anomaly detection can be adjusted.
  • the preset cycle times are control parameters for different accuracy levels. Theoretically, the larger the preset number of cycles, the higher the accuracy of approaching anomaly detection, but at the same time, the detection efficiency will be reduced and the power consumption will be increased. Therefore, the specific preset number of cycles can be carried out by the technicians according to the actual scene requirements.
  • the setting of a fixed value or the generation rule for setting the preset number of cycles is not limited here.
  • it can be set to any value from 1 to 10, for example, it can be set to 2 or 4.
  • a generation rule for the preset number of cycles can also be preset, and when the preset number of cycles needs to be used, processing is performed according to the rule to obtain a real-time corresponding preset number of cycles.
  • the embodiment of the present application will continue to perform the next proximity anomaly detection.
  • the next detection is directly started after the completion of one near anomaly detection, because the interval between the two detections is too short, the difference in the environmental conditions corresponding to the mobile terminal is generally minimal or even no difference, and The results of the two detections are often the same, which results in the latter detection being of less practical significance and less helpful to the improvement of detection accuracy.
  • the embodiment of the present application will also identify the brightness of the display screen.
  • the off state changes, and according to the on-off state change of the display screen, it is judged whether the environment in which the mobile terminal is located has changed, and then it is decided whether to start the next proximity abnormality detection.
  • the recognition of the change in the on-off state of the display screen includes two optional implementations: active recognition and passive recognition:
  • the mobile terminal will actively detect whether the display screen has changed on or off, and will return to perform the operation of S702 when it detects that the on or off state has changed.
  • S705 and S706, which will not be repeated here. the operation of S702 is not executed, and the next detection is started according to a certain rule.
  • the specific detection opening rules are not limited here, and can be set by the technicians themselves, for example, it can be set to periodic detection.
  • the mobile terminal will not actively detect whether the display screen has a light-off state change, but will determine that the display screen has a light-off state change when it passively detects a switching command to the display screen. Since it will not actively detect the status of the display screen, there will be no "display on-off status has not changed" in this implementation, but will continue to wait for the on-off switch instruction until the "display on-off state has not changed". The result of a change in status. At this time, referring to FIG. 7B, in the embodiment corresponding to FIG.
  • the two steps S705 and S706 will be replaced by "S7001, if the number of operations is less than the preset number of cycles, and the mobile terminal detects the Turn on and off the switching instruction, and the mobile terminal returns to a step of "operation of S702".
  • S705 will not be executed, but S7001 will be executed.
  • the triggering method of the on-off switching instruction is not limited here, and needs to be determined according to the actual scenario, including but not limited to: active input by the user, sent by a third-party device, or actively generated by the internal program of the mobile terminal.
  • S706 The mobile terminal judges whether the on-off state of the display screen has changed. If the on-off state of the display screen changes, the mobile terminal returns to perform the operation of S702.
  • the on-off state change of the display screen means that the display screen changes from on-screen to off-screen or from off-screen to bright-screen.
  • the display screen changes on or off it means that the user has operated the mobile terminal, or the mobile terminal has detected changes in some environmental parameters. That is, the environment in which the mobile terminal is located has undergone a certain change at this time. Therefore, when a change in the on-off state of the display screen is detected, the embodiment of the present application returns to perform the operation of S702, thereby starting a new round of proximity sensor proximity abnormality detection.
  • the embodiment of the present application does not limit the number of times of the on-off state change when detecting the on-off state change. For example, as long as a change in the on-off state of the display screen is detected, a new round of proximity anomaly detection can be triggered; or it can be triggered to initiate a new round of proximity anomaly detection only when multiple on-off status changes are detected. Since when a user needs to use a mobile terminal, he needs to hold the mobile terminal in his hand to perform an effective switching of the screen on and off. At this time, the space environment in which the mobile terminal is located has changed. Therefore, in theory, the more the on-off state of the display screen changes, the greater the probability that the spatial environment in which the mobile terminal is located will change.
  • the set value of the specific number of changes can be set by the technicians according to actual needs.
  • the number of changes may be set to 2 times. At this time, it is necessary to detect once the display screen is changed from the on state to the off state, and once the off state is changed to the on state (the order of the two detections is not limited), then it is determined that the change in the state of the display screen meets the requirements, and Return to perform the operation of sampling the output value of the proximity sensor to obtain the output value of the first sample.
  • the embodiment of the present application is in the process of detecting the proximity of the proximity sensor every time, as long as the size of the first output value sample or the data stability requirement does not meet the requirements, it will be determined that there is no proximity abnormality in the proximity sensor, and the proximity sensor will be terminated. Proximity anomaly detection. Therefore, when the counted number of operations is equal to the preset number of cycles, the detection results of the consecutive preset number of cycles in the embodiment of the present application all indicate that the proximity sensor has a proximity abnormality. Therefore, the embodiment of the present application will determine that the proximity sensor has a proximity abnormality at this time.
  • a mechanism for selecting the number of times of proximity anomaly detection is set to perform an optional number of proximity anomaly detections on the proximity sensor, so that the technician can select the setting according to the actual scene's requirements for the accuracy of proximity anomaly detection.
  • the embodiment of the present application will also determine whether there is a change in the environment of the mobile terminal based on the change of the on-off state of the mobile terminal display screen, and then determine the start timing of each approach to abnormal detection. , Thereby ensuring the effectiveness of each approach anomaly detection, and further improving the accuracy of multiple approach anomaly detection.
  • the embodiments of the present application will determine the on-off status of the display screen of the mobile terminal based on the detection result of the proximity abnormality obtained in S2003, S203, S601 or S709. Perform control, that is, after S2003, S203, S601 or S709, the embodiments of this application include:
  • the mobile terminal When the terminal needs to use the data reported by the proximity sensor, if the detection result is that the proximity sensor has a proximity abnormality, the mobile terminal ignores the data reported by the proximity sensor. or
  • the mobile terminal When the terminal needs to use the data reported by the proximity sensor, if the detection result is that the proximity sensor is abnormal, the mobile terminal sets the screen of the mobile terminal to be always on.
  • the display on-off state control scheme generally includes two types.
  • the first type is to control the on-off state of the display screen only based on the output value of the proximity sensor
  • the second type is to control the on-off state of the display screen based on the output value of the proximity sensor and other parameters of the mobile terminal at the same time.
  • the other parameters used can be selected and set by the technician according to the actual mobile terminal situation.
  • the other parameters may be set to any one or more of the ultrasonic data of the mobile terminal, the received user touch instruction, and the recognized user gesture instruction.
  • the embodiments of the present application may use any one of the following two schemes to perform the on-off state of the mobile terminal display screen control:
  • the embodiment of the present application sets the display screen to be always on.
  • the embodiment of the present application ignores the data reported by the proximity sensor, and performs the on-off state control of the display screen according to other parameters originally selected.
  • the embodiment of the present application will timely modify the original display screen on and off control scheme, set the display screen to be always on, or refer to other parameters of the mobile terminal to control the screen on and off, so as to avoid The situation that the display screen of the mobile terminal continues to go out due to the proximity of the proximity sensor is abnormal.
  • the proximity sensor when the proximity sensor is identified When abnormal, the proximity sensor can be directly turned off to reduce the power consumption of the mobile terminal.
  • the embodiment of the present application may also perform rapid detection of the proximity sensor output value before performing the occlusion recognition of the proximity sensor. Then, based on the result of the rapid detection, it is determined whether or not the detection steps of the above-mentioned embodiments of the present application need to be executed.
  • the steps of quickly detecting the proximity sensor in the embodiment of the present application include:
  • the mobile terminal samples the output value of the proximity sensor to obtain the second sample output value.
  • the embodiment of the present application will sample the output value of the proximity sensor in advance to obtain the second sample output value for rapid detection.
  • the mobile terminal determines that there is no proximity abnormality in the proximity sensor.
  • the mobile terminal performs an operation to identify whether the proximity sensor is blocked, wherein the second output value threshold is less than or equal to the first output value threshold.
  • the output value threshold When the embodiment of this application is combined with the embodiment corresponding to FIG. 7A or FIG. 7B, the operation of S701 is performed.
  • the proximity sensor can continuously output a small value, it means that the proximity sensor can normally detect that the obstacle is far away from the proximity sensor at this time, which means that the proximity sensor has no proximity abnormality at this time. Therefore, when it is detected that the second sample output value output by the proximity sensor during the second time period is less than or equal to the second output value threshold, the embodiment of the present application will determine that the proximity sensor does not have a proximity abnormality, and will not activate the aforementioned implementations of the present application. Example detection steps to avoid wasting the processor resources of the mobile terminal.
  • the specific value of the second duration can be set by a technician according to actual needs, and is not limited here.
  • the second duration can be set to 2 seconds to 10 seconds, for example, it can be set to 3 seconds or 5 seconds.
  • the second output value threshold is used to determine whether the second sample output value is small.
  • the specific second output value threshold is not limited here, and can be set by the technician according to the actual use of the proximity sensor. For details, refer to the description of the setting of the first output value threshold in the embodiment corresponding to FIG. 2B to set the second output value threshold, but it should be ensured that the second output value threshold is less than or equal to the first output value threshold to ensure The consistency of the before and after testing ensures the credibility of the testing.
  • the detection step is to achieve accurate detection of whether the proximity sensor is close to an abnormality.
  • the proximity sensor is quickly detected before the detection of whether the proximity sensor is abnormally close to determine whether the proximity sensor can normally detect the distance of the obstacle. And only when it is impossible to determine whether the proximity sensor can normally detect the distant state of the obstacle, the detection of whether the proximity sensor is blocked is started, and the detection steps of the above-mentioned embodiments of the present application are entered.
  • the embodiments of the present application can avoid wasting the processor resources of the mobile terminal to a certain extent, and improve the detection efficiency of whether the proximity sensor has a proximity abnormality.
  • the start timing of the proximity sensor proximity anomaly detection solution is very important. If the startup timing is unreasonable, it may directly reduce the credibility of the detection result, which in turn leads to inaccurate control of the mobile terminal. For example, suppose that the start time is set to 00:00 on January 1 every year. At this time, the time interval between two near anomaly detections is as long as 1 year.
  • the triggering process of proximity sensor proximity anomaly detection includes:
  • the mobile terminal When the mobile terminal detects that the mobile terminal performs a preset behavior or a preset operation, it initiates the proximity abnormality detection operation to the proximity sensor, and, taking the preset time point as the starting time point and the third time length as the period value, the period starts Proximity abnormality detection operation of the proximity sensor.
  • the triggering process for the proximity sensor proximity abnormality detection can also be set as:
  • the mobile terminal After the mobile terminal is turned on or after detecting that the user clicks on the proximity sensor abnormal detection function, it initiates the proximity abnormal detection operation of the proximity sensor.
  • the triggering process for the proximity sensor proximity abnormality detection can also only be set as:
  • the mobile terminal uses the preset time point as the starting time point and the third time length as the period value to periodically start the operation of identifying whether the proximity sensor is blocked.
  • the “initiating abnormal proximity detection of the proximity sensor” in the embodiment of the present application refers to the step of quickly detecting the proximity sensor.
  • the “initiating proximity abnormal detection of the proximity sensor” in the embodiment of the present application refers to the operation of S201 or S701.
  • the specific detection preset behaviors and preset operation types are not limited here, and can be set by the technicians according to their needs, including but not limited to the power-on behavior, and the detection function of the proximity sensor proximity abnormality when the user clicks.
  • the mobile terminal when the mobile terminal detects that the mobile terminal performs a preset behavior or a preset operation, it initiates a proximity abnormality detection operation to the proximity sensor, and the preset time point is the starting time point, and the third time period is It is the period value, and the period starts the proximity abnormality detection operation of the proximity sensor.
  • the identified operation may be as follows: if the preset trigger instruction is detected, it is determined that the mobile terminal is performing the preset behavior or operation.
  • the actual mobile terminal will receive corresponding control instructions before starting to perform various behaviors and operations, or generate corresponding data or instructions after performing various behaviors and operations. For example, after the user clicks on the detection function of the proximity sensor abnormality, the mobile terminal will generate a corresponding detection start instruction. Therefore, in this embodiment of the application, the preset behaviors and operations that need to be detected are analyzed in advance, and the control instructions that the mobile terminal may receive before performing the preset behaviors and operations, and the possible control instructions after the preset behaviors and operations are performed are determined. The generated data or instructions are then unified as the preset trigger instructions in the embodiments of the present application. During the normal operation of the mobile terminal, if the existence of these preset trigger instructions is detected, the embodiment of the present application will determine that the mobile terminal is performing the corresponding preset behavior or preset operation.
  • the embodiment of the present application does not limit the preset time point specifically as the starting time point, and the specific start period value third duration, which can be selected or set by the technician according to actual needs.
  • the preset time point may be a fixed time point, for example, it may be 00:00 in the morning every day.
  • the preset time point may also be a time point associated with certain behaviors or operations, for example, it may be set to the time point when the boot is completed; at this time, the corresponding proximity abnormality can be activated as long as the boot is completed.
  • the corresponding proximity anomaly detection will be periodically started with this time point as the starting point.
  • the third time period in the embodiment of the present application can be set to any value less than 1 month.
  • the third time period can be set to one week.
  • the proximity sensor will be detected for proximity anomaly every other week.
  • the third time period can also be set to 1 hour, at this time every hour. A proximity abnormality detection is performed on the proximity sensor.
  • the mobile terminal after the mobile terminal is powered on or after detecting that the user has clicked on the proximity sensor abnormal detection function, it initiates the proximity sensor abnormality detection operation.
  • the user can actively click on the detection function of proximity sensor proximity abnormality when needed, or power off the mobile terminal again, and the mobile terminal can activate the proximity sensor only after it is turned on or the user actively triggers the detection function.
  • the proximity anomaly detection operation Therefore, the mobile terminal will not automatically start the proximity abnormality detection operation of the proximity sensor during the normal use of the user, and will not cause interference to the normal use of the mobile terminal by the user.
  • the interval time for the user to switch the mobile terminal on and off is uncontrollable. And it is also unpredictable when the user will activate the detection function of the proximity sensor abnormality.
  • the state of the proximity sensor may change during the undetected period. For example, the proximity sensor may be damaged due to collisions, etc., and the proximity sensor changes from normal to abnormal. For another example, if the user takes the originally damaged proximity sensor for repair, the proximity sensor changes from abnormal proximity to normal at this time. Therefore, if the proximity sensor is not detected for a long period of time, the reliability of the detection result may be reduced.
  • the mobile terminal uses the preset time point as the starting time point and the third time length as the period value to periodically perform the operation of identifying whether the proximity sensor is blocked.
  • the embodiment of the present application periodically detects whether the proximity sensor has a proximity abnormality, thereby realizing the timely update of the state of the proximity sensor, and ensuring the credibility of the proximity sensor proximity abnormality detection result.
  • the embodiments of the present application will forcibly terminate the process, and determine that the proximity sensor proximity abnormality detection fails, and at the same time, the detection result related to whether the proximity abnormality exists may not be output.
  • the embodiment of the present application does not limit the detection frequency of whether the proximity sensor is blocked, and can be specifically set by a technician according to actual needs. In some optional embodiments, it can be set to any frequency from 10 times/minute to 60 times/minute.
  • the detection and triggering process for the proximity sensor abnormality can be: taking the preset time point as the starting time point and the third time length as the period value, periodically starting the proximity sensor When approaching an abnormality detection operation.
  • the detection triggering process for the proximity sensor proximity abnormality of the embodiment of the present application may be:
  • the mobile terminal uses the preset time point as the starting time point and the third time length as the period value to periodically start the operation of identifying whether the proximity sensor is blocked. If it is detected that the proximity sensor is blocked, according to the first time point and the third time period when the proximity sensor is blocked, the second time point for the next operation to recognize whether the proximity sensor is blocked is obtained; from the first time Select a third time point from the point to the second time point, update the starting time point to the third time point, and periodically start the operation of identifying whether the proximity sensor is blocked.
  • the “initiating abnormal proximity detection of the proximity sensor” in the embodiment of the present application refers to the step of quickly detecting the proximity sensor.
  • the “initiating proximity abnormal detection of the proximity sensor” in the embodiment of the present application refers to the operation of S201 or S701.
  • the theoretical next time will be calculated according to the start time point of the current detection and the set period value of the third time period. The time of start. On this basis, between the current start time point and the calculated next start time point, a time point is selected as a new start time point. Finally, the original starting time point is updated to the selected new starting time point, so as to advance the starting time of the next detection.
  • the specific method for selecting the new startup time point is not limited here, and can be set by the technicians themselves.
  • the third duration is set to 1 day, and it is assumed that the last start time is 00:00 on January 1st, and the start time of the current detection is 00:00 on January 2nd. At this point, it can be calculated that the next startup time is 00:00 on January 3rd. If the test is started normally according to the third time period, it will cause an effective test not to be performed between 00:00 on January 1st and 00:00 on January 3rd, which will reduce the credibility of the test results during this period. In order to prevent this from happening, the embodiment of the present application will select a time point between these two time points as the new starting time point, for example, 12:00 on January 1st can be selected. As a result, the actual start time point for the next time becomes 12:00 on January 1st, which is ahead of the theoretical 00:00 on January 2nd.
  • each time the detection fails the next time the proximity sensor is close to the abnormal detection time point is started in advance, which can prevent the time between two effective detections from being too long and the reliability of the detection result is reduced.
  • the mobile terminal may need to call the output value of the proximity sensor and perform operations at any time according to the actual needs of the user after it is turned on, for example, perform operations on the display screen of the mobile terminal according to the output value of the proximity sensor.
  • the actual detection of proximity sensor proximity abnormality itself takes a period of time. Therefore, in theory, we cannot determine the proximity by means of detection until the first detection result of proximity sensor proximity abnormality after the startup is completed. Whether the sensor is actually close to abnormal. But on the other hand, it can be known from theoretical analysis that the damage or abnormality of the optical device is not abrupt, that is, the state of the proximity sensor should be the same before and after the power-on.
  • the embodiment of the present application in order to ensure the normal call of the proximity sensor by the mobile terminal during the period from the completion of the boot to the first detection result of the proximity sensor abnormality after the boot.
  • various embodiments of the present application obtain the detection result of the proximity sensor abnormality.
  • the embodiment of the present application also stores the detection result locally.
  • the embodiment of the present application stores the detection result in a local non-volatile memory.
  • the stored detection result data can be updated according to the latest detection result of the proximity sensor proximity abnormality.
  • the detection result of the proximity sensor is used as the actual state of the proximity sensor.
  • the brightness and/or the on-off state of the display screen of the mobile terminal can be controlled according to the latest detection result read from the non-volatile memory.
  • FIG. 8 shows a structural block diagram of the abnormal detection device of the proximity sensor provided in an embodiment of the present application. The relevant part.
  • the abnormal detection device of the proximity sensor includes:
  • the occlusion recognition module 81 is used to recognize whether the proximity sensor is occluded.
  • the data analysis module 82 is used to sample the output value of the proximity sensor if the proximity sensor is not blocked to obtain the first sample output value, and perform data stability analysis on the first sample output value to obtain the corresponding stability analysis result.
  • the abnormality detection module 83 is used to analyze the output value of the first sample and the stability analysis result to obtain the detection result of whether the proximity sensor is abnormal.
  • the occlusion recognition module 81 includes:
  • the abnormality detection module 83 includes:
  • the first abnormality determination module is used to determine the detection result if the output value of the first sample obtained by the sampling is greater than the first output value threshold within the first time period after the sampling is started, and the stability analysis result is within the preset value range
  • the proximity sensor has a proximity abnormality.
  • the abnormality detection module 83 includes:
  • the operation statistics module is used to perform statistics on the proximity sensor if the output value of the first sample obtained by sampling is greater than the first output value threshold within the first time period after the start of sampling, and the stability analysis result is within the preset value range. Perform output value sampling to obtain the number of operations for the output value of the first sample.
  • the on-off detection module is used to detect the on-off status of its own display screen if the number of operations is less than the preset number of cycles. If the on-off state of the display screen changes, the mobile terminal returns to perform the operation of sampling the output value of the proximity sensor to obtain the output value of the first sample.
  • the second abnormality determination module is used for determining that the detection result is that the proximity sensor has a proximity abnormality if the number of operations is equal to the preset number of cycles.
  • the abnormality detection device of the proximity sensor further includes:
  • the sampling module is used to sample the output value of the proximity sensor to obtain the second sample output value.
  • the pre-detection module is used to perform the operation of identifying whether the proximity sensor is blocked if there is a value greater than the second output value threshold in the second sample output value sampled in the second time period, where the second output value threshold is less than or Equal to the first output value threshold.
  • the abnormality detection device of the proximity sensor further includes:
  • the first trigger module is configured to perform an operation of identifying whether the proximity sensor is blocked if it detects that it performs a preset behavior or a preset operation.
  • the abnormality detection device of the proximity sensor further includes:
  • the second trigger module is configured to periodically perform the operation of identifying whether the proximity sensor is blocked, taking the preset time point as the starting time point and the third time length as the period value.
  • the second trigger module includes:
  • the time point acquisition module is used to obtain the second time point for the next operation to identify whether the proximity sensor is blocked according to the first time point and the third time period when the proximity sensor is blocked or not, if the proximity sensor is blocked. .
  • the time point update module is used to select a third time point from the first time point to the second time point, update the starting time point to the third time point, and periodically perform the operation of identifying whether the proximity sensor is blocked.
  • the abnormality detection device of the proximity sensor further includes:
  • the storage module is used to store the detection result in the local non-volatile memory.
  • FIG. 9 is a schematic structural diagram of a mobile terminal provided by an embodiment of this application.
  • the mobile terminal 9 of this embodiment includes: at least one processor 90 (only one is shown in FIG. 9), a processor, a memory 91, a proximity sensor 92, and the at least one processor 90 stored in the memory 91 and available in the at least one processor 90.
  • a computer program 93 running on the processor 90 when the processor 90 executes the computer program 93, implements the steps in any of the foregoing embodiments of the abnormal detection method for each proximity sensor.
  • the mobile terminal 9 may be a mobile computing device such as a mobile phone, a tablet computer, and a wearable device.
  • the mobile terminal may include, but is not limited to, a processor 90, a memory 91, and a proximity sensor 92.
  • FIG. 9 is only an example of the mobile terminal 9 and does not constitute a limitation on the mobile terminal 9. It may include more or less components than those shown in the figure, or a combination of certain components, or different components. , For example, can also include input and output devices, network access devices, and so on.
  • the so-called processor 90 may be a central processing unit (Central Processing Unit, CPU), and the processor 90 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and application specific integrated circuits (Application Specific Integrated Circuits). , ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 91 may be an internal storage unit of the mobile terminal 9 in some embodiments, such as a hard disk or memory of the mobile terminal 9. In other embodiments, the memory 91 may also be an external storage device of the mobile terminal 9, such as a plug-in hard disk equipped on the mobile terminal 9, a smart media card (SMC), a secure digital (Secure Digital, SD) card, flash card (Flash Card), etc. Further, the memory 91 may also include both an internal storage unit of the mobile terminal 9 and an external storage device. The memory 91 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 91 can also be used to temporarily store data that has been output or will be output.
  • a boot loader BootLoader
  • the embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
  • the embodiments of the present application provide a computer program product.
  • the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
  • the 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 computer readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the camera device/mobile terminal, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium.
  • ROM read-only memory
  • RAM random access memory
  • electric carrier signal telecommunications signal and software distribution medium.
  • U disk mobile hard disk, floppy disk or CD-ROM, etc.
  • computer-readable media cannot be electrical carrier signals and telecommunication signals.
  • the disclosed device/mobile terminal and method may be implemented in other ways.
  • the device/mobile terminal embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units.
  • components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Abstract

本申请提供了接近传感器的异常检测方法、装置及移动终端,适用于传感器检测技术领域,该方法应用于包含接近传感器的移动终端,该方法包括:移动终端对接近传感器进行输出值采样,得到第一样本输出值。移动终端对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果;移动终端根据第一样本输出值和稳定性分析结果,得到接近传感器是否异常的检测结果。通过先进行接近传感器是否被遮挡的识别,并在无遮挡的情况下,同时利用接近传感器输出值的大小和数据稳定性来确定最终的异常检测结果,从而保障了对接近传感器接近异常检测的准确可靠。

Description

接近传感器的异常检测方法、装置及移动终端
本申请要求于2019年12月27日提交国家知识产权局、申请号为201911375969.6、申请名称为“接近传感器的异常检测方法、装置及移动终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于传感器检测技术领域,尤其涉及接近传感器的异常检测方法、装置及移动终端。
背景技术
接近传感器是能感知物体接近的传感器。接近传感器可以有多种类型,例如,接近传感器可包括红外接近传感器和超声波接近传感器等类型。以红外接近传感器为例进行原理说明。红外接近传感器在开始工作时会连续向外发射红外光。红外光遇到障碍物之后会被反射回接近传感器。接近传感器中的光敏二极管会接收该反射红外光。红外接近传感器根据接收到的被反射的红外光的能量,来判断是否有外部物体靠近或远离接近传感器。
接近传感器被广泛应用在各种移动终端之中,用以检测用户是否靠近移动终端,进而实现对移动终端显示屏亮度调整和亮灭状态切换等操作的灵活控制。例如语音通话过程中,若通过接近传感器检测到用户靠近移动终端则熄灭显示屏,若检测到用户远离移动该终端则点亮显示屏,以防止用户在语音通话过程中对显示屏的误操作。
实际应用中,移动终端中的接近传感器可能会出现异常。在使用该移动终端进行语音通话等操作时,若直接根据异常接近传感器上报的输出值进行显示屏控制,极有可能导致移动终端的显示屏在用户远离时仍被熄灭,且会一直保持熄灭状态而无法被点亮。
发明内容
有鉴于此,本申请实施例提供了接近传感器的异常检测方法、装置及移动终端,可以识别移动终端中的接近传感器是否存在异常。
本申请实施例的第一方面提供了一种接近传感器的异常检测方法,应用于包含所述接近传感器的移动终端,包括:
所述移动终端对所述接近传感器进行输出值采样,得到第一样本输出值;
所述移动终端对所述第一样本输出值进行数据稳定性分析,得到稳定性分析结果;
所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果。
本申请实施例在对接近传感器输出值进行采样和接近异常检测时,会对采样出的输出值的大小和数据稳定性进行监测,以判断接近传感器是否在持续稳定地输出异常数据,进而得到对接近传感器是否存在接近异常的检测结果。通过先进行接近传感器是否被遮挡的识别,并在无遮挡的情况下,同时利用接近传感器输出值的大小和数据稳定性来确定最终的异常检测结果,从而保障了对接近传感器接近异常检测的准确可靠。
在第一方面的第一种可能实现方式中,所述移动终端在对所述接近传感器进行输出值采样之 前,还包括:
所述移动终端识别所述接近传感器是否被遮挡;
若所述接近传感器未被遮挡,所述移动终端执行所述对所述接近传感器进行输出值采样的操作。
本申请实施例首先会对接近传感器是否被遮挡进行识别;并在识别出接近传感器没有被遮挡的时候,启动对接近传感器输出值的采样和接近异常检测。进而保证了在进行异常检测时,不会受到遮挡的干扰,提高了异常检测结果的可信度。
在第一方面的第二种可能实现方式中,所述移动终端识别所述接近传感器是否被遮挡的操作,具体包括:
所述移动终端获取环境光强度以及所述移动终端的姿态数据,并基于所述环境光强度和所述姿态数据,识别所述接近传感器是否被遮挡。
本申请实施例同时综合移动终端所处的环境光强度以及姿态数据,来判断接近传感器是否可能处于被遮挡的状态,实现了对接近传感器是否被遮挡的准确识别。
在第一方面的第三种可能实现方式中,所述移动终端识别所述接近传感器是否被遮挡的操作,具体包括:
所述移动终端获取环境光强度和移动终端的俯仰角和翻滚角的角度数据,若所述环境光强度大于强度阈值,所述俯仰角的角度数据属于预设的俯仰角取值范围,且所述翻滚角的角度数据属于预设的翻滚角取值范围,判定所述接近传感器未被遮挡。
在本申请实施例中,通过移动终端的俯仰角和翻滚角实现对移动终端是否为被用户持握的空间姿态的准确识别,在移动终端处于被用户持握的空间姿态且环境光强度较强时,判定接近传感器未被遮挡,进一步实现了对接近传感器是否被遮挡的准确识别。
在第一方面的第四种可能实现方式中,所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果,具体包括:
若开始采样后的第一时长内,采样得到的所述第一样本输出值均大于第一输出值阈值,且所述稳定性分析结果处于预设取值范围,所述移动终端判定所述检测结果为所述接近传感器存在接近异常。
若第一时长内采集到的第一样本输出值能同时满足数值大小和数据稳定性两个要求,说明此时接近传感器的输出值稳定且较大,满足接近异常的判断标准,此时本申请实施例会判定检测结果为接近传感器存在接近异常,从而实现了对接近异常的准确检测。
在第一方面的第五种可能实现方式中,所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果,具体包括:
若开始采样后的第一时长内,采样得到的所述第一样本输出值均大于第一输出值阈值,且所述稳定性分析结果处于预设取值范围,所述移动终端统计执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作次数;
若所述操作次数小于预设循环次数,所述移动终端检测自身显示屏的亮灭状态;若所述显示屏的亮灭状态发生变化,所述移动终端返回执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作;
若所述操作次数等于预设循环次数,所述移动终端判定所述检测结果为所述接近传感器存在接近异常。
若第一时长内采集到的第一样本输出值能同时满足数值大小和数据稳定性两个要求,说明此时接近传感器的输出值稳定且较大。同时若连续多次检测的结果都是接近传感器的输出值稳定且较大,说明此时检测结果的可信度极高,因此本申请实施例会判定检测结果为接近传感器存在接近异常,从而提升了对接近异常检测的准确性。
在第一方面的第六种可能实现方式中,所述移动终端对所述第一样本输出值和所述稳定性分析结果进行分析,得到所述接近传感器是否异常的检测结果,具体包括:
若开始采样后的第一时长内,采样得到的所述第一样本输出值均大于第一输出值阈值,且所述稳定性分析结果处于预设取值范围,所述移动终端统计执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作次数;
若所述操作次数小于预设循环次数,且所述移动终端检测到对自身显示屏的亮灭切换指令,所述移动终端返回执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作;
若所述操作次数等于预设循环次数,所述移动终端判定所述检测结果为所述接近传感器存在接近异常。
若第一时长内采集到的第一样本输出值能同时满足数值大小和数据稳定性两个要求,说明此时接近传感器的输出值稳定且较大。同时若连续多次检测的结果都是接近传感器的输出值稳定且较大,说明此时检测结果的可信度极高,因此本申请实施例会判定检测结果为接近传感器存在接近异常,从而提升了对接近异常检测的准确性。
在第一方面的第七种可能实现方式中,在所述移动终端识别所述接近传感器是否被遮挡之前,还包括:
所述移动终端对所述接近传感器进行输出值采样,得到第二样本输出值;
若第二时长内采样得到的所述第二样本输出值中,存在大于第二输出值阈值的值,所述移动终端执行所述识别所述接近传感器是否被遮挡的操作,其中,所述第二输出值阈值小于或等于所述第一输出值阈值。
通过在启动对接近传感器是否接近异常的检测之前先对接近传感器进行快速检测,判断接近传感器是否可以正常进行障碍物的远离状态检测。并仅在无法确定出接近传感器是否可以正常进行障碍物的远离状态检测时,启动对接近传感器是否被遮挡的检测,并进入上述本申请各实施例的检测步骤。从而使得本申请实施例可以一定程度上避免对移动终端处理器资源的浪费,提升对接近传感器是否存在接近异常的检测效率。
在第一方面的第八种可能实现方式中,在所述移动终端识别所述接近传感器是否被遮挡之前,还包括:
所述移动终端若检测到自身执行预设行为或预设操作,执行所述识别所述接近传感器是否被遮挡的操作。
通过在移动终端执行预设行为或预设操作时进行接近传感器异常检测,使得本申请实施例保障了接近传感器接近异常检测结果的可信度,提高了对移动终端操作控制的准确性。
在第一方面的第九种可能实现方式中,在第六中可能实现方式的基础上,对预设行为或预设操作识别操作,具体包括:
若检测到预设触发指令,则判定移动终端在执行预设行为或预设操作。
通过对预设触发指令的检测,实现了对预设行为和预设操作的准确识别。
在第一方面的第十种可能实现方式中,在所述移动终端识别所述接近传感器是否被遮挡之前, 还包括:
所述移动终端以预设时间点为起始时间点,以第三时长为周期值,周期执行所述识别所述接近传感器是否被遮挡的操作。
通过周期进行接近传感器异常检测,使得本申请实施例保障了接近传感器接近异常检测结果的可信度,提高了对移动终端操作控制的准确性。
在第一方面的第十一种可能实现方式中,在第八种可能实现方式的基础上,在所述移动终端识别所述接近传感器是否被遮挡之前,还包括:
若所述接近传感器被遮挡,根据当次执行所述识别所述接近传感器是否被遮挡操作的第一时间点和所述第三时长,获取下一次执行所述识别所述接近传感器是否被遮挡操作的第二时间点;
从所述第一时间点到所述第二时间点之间选取一个第三时间点,将所述起始时间点更新为所述第三时间点,并周期执行所述识别所述接近传感器是否被遮挡的操作。
本申请实施例在每次检测失败时,都会提前下一次启动对接近传感器接近异常的检测时间点,可以防止两次有效检测的相隔时间过长导致检测结果的可信度下降。
在第一方面的第十二种可能实现方式中,在所述得到所述接近传感器是否异常的检测结果之后,还包括:
所述移动终端将所述检测结果储存至本地非易失性存储器中。
本申请实施例可以保障在开机完成到开机后的对接近传感器接近异常的第一次检测结果出来前这一段时间内,移动终端对接近传感器的正常调用。
在第一方面的第十三种可能实现方式中,在所述得到所述接近传感器是否异常的检测结果之后,还包括:
在所述终端需要使用所述接近传感器上报的数据时,若所述检测结果为所述接近传感器存在接近异常,则所述移动终端忽略所述接近传感器上报的数据;或者
在所述终端需要使用所述接近传感器上报的数据时,若所述检测结果为所述接近传感器存在接近异常,则所述移动终端将所述移动终端的显示屏设置为常亮。
当识别出接近传感器存在接近异常时,本申请实施例会及时修改原本的显示屏亮灭控制方案,将显示屏设置为常亮,或者忽略接近传感器上报的数据,参考移动终端的其他参数来进行显示屏亮灭控制,从而避免了移动终端因接近传感器接近异常导致的显示屏持续熄灭的情况发生。
本申请实施例的第二方面提供了一种接近传感器的异常检测装置,包括:
遮挡识别模块,用于识别所述接近传感器是否被遮挡;
数据分析模块,用于若所述接近传感器未被遮挡,对所述接近传感器进行输出值采样,得到第一样本输出值,并对所述第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果;
异常检测模块,用于对所述第一样本输出值和所述稳定性分析结果进行分析,得到所述接近传感器是否异常的检测结果。
本申请实施例的第三方面提供了一种终端设备,所述终端设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时,使得终端设备实现如上述第一方面中任一项所述接近传感器的异常检测方法的步骤。
本申请实施例的第四方面提供了一种计算机可读存储介质,包括:存储有计算机程序,其特征在于,所述计算机程序被处理器执行时,使得终端设备实现如上述第一方面中任一项所述接近传感器的异常检测方法的步骤。
本申请实施例的第五方面提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述接近传感器的异常检测方法。
可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。
附图说明
图1是本申请一实施例提供的接近传感器的异常检测方法所适用于的手机的结构示意图;
图2A是本申请一实施例提供的接近传感器的异常检测方法的流程示意图;
图2B是本申请一实施例提供的接近传感器的异常检测方法的流程示意图;
图3是本申请一实施例提供的应用场景示意图;
图4是本申请一实施例提供的应用场景示意图;
图5是本申请一实施例提供的应用场景示意图;
图6是本申请一实施例提供的接近传感器的异常检测方法的流程示意图;
图7A是本申请一实施例提供的接近传感器的异常检测方法的流程示意图;
图7B是本申请一实施例提供的接近传感器的异常检测方法的流程示意图;
图8是本申请实施例提供的接近传感器的异常检测装置的结构示意图;
图9是本申请实施例提供的移动终端的结构示意图。
具体实施方式
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
本申请实施例提供的接近传感器的异常检测方法可以应用于手机、平板电脑和可穿戴设备等移动终端上,此时移动终端即为本申请实施例提供的接近传感器的异常检测方法的执行主体,本申请实施例对移动终端的具体类型不作任何限制。
作为示例而非限定,当所述移动终端为可穿戴设备时,该可穿戴设备还可以是应用穿戴式技术对日常穿戴进行智能化设计、开发出可以穿戴的设备的总称。如手套、手表及服饰等。可穿戴 设备即直接穿在身上,或是整合到用户的衣服或配件的一种便携式设备。可穿戴设备不仅仅是一种硬件设备,更是通过软件支持以及数据交互、云端交互来实现强大的功能。广义穿戴式智能设备包括功能全、尺寸大、可不依赖智能手机实现完整或者部分的功能,如智能手表或智能眼镜等,以及只专注于某一类应用功能,需要和其它设备如智能手机配合使用,如各类进行体征监测的智能手环等。
以所述移动终端为手机为例。图1示出的是与本申请实施例提供的手机的部分结构的框图。参考图1,手机包括:射频(Radio Frequency,RF)电路110、存储器120、输入单元130、显示单元140、接近传感器150、环境光传感器151、音频电路160、无线保真(wireless fidelity,Wi-Fi)模块170、处理器180、以及电源190等部件。本领域技术人员可以理解,图1中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图1对手机的各个构成部件进行具体的介绍:
RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器180处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。
存储器120可用于存储软件程序、对接近传感器接近异常的检测结果以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器120可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、对接近传感器接近异常的检测结果等)等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元130可用于接收输入的数字或字符信息,以及产生与手机100的用户设置以及功能控制有关的键信号输入。具体地,输入单元130可包括触控面板131以及其他输入设备132。触控面板131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板131上或在触控面板131附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板131。除了触控面板131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元140可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元140可包括显示屏141,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示屏141。进一步的,触控面板131可覆盖显示屏141,当触控面板131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示屏141上提供相应的视觉输出。虽然在图1中,触控面板131与显示屏141是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板131与显示屏141集成而实现手机的输入和输出功能。
手机100还包括接近传感器150和环境光传感器151。其中,环境光传感器可检测手机所处环境光的强度。接近传感器可检测外部物体靠近或远离手机。至于手机还可配置的气压计、湿度计、温度计、姿态传感器等其他传感器,在此不再赘述。
音频电路160、扬声器161,传声器162可提供用户与手机之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一手机,或者将音频数据输出至存储器120以便进一步处理。
Wi-Fi属于短距离无线传输技术,手机通过Wi-Fi模块170可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图1示出了Wi-Fi模块170,但是可以理解的是,其并不属于手机100的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器180是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理单元;优选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。
手机100还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
尽管未示出,手机100还可以包括摄像头。可选地,摄像头在手机100的上的位置可以为前置的,也可以为后置的,本申请实施例对此不作限定。
可选地,手机100可以包括单摄像头、双摄像头或三摄像头等,本申请实施例对此不作限定。例如,手机100可以包括三摄像头,其中,一个为主摄像头、一个为广角摄像头、一个为长焦摄像头。
可选地,当手机100包括多个摄像头时,这多个摄像头可以全部前置,或者全部后置,或者一部分前置、另一部分后置,本申请实施例对此不作限定。
另外,尽管未示出,手机100还可以包括蓝牙模块等,在此不再赘述。
实际应用中,为了准确区分用户接近状态和远离状态,一般都会设置一大一小两个输出值阈值。当接近传感器的输出值大于较大的输出值阈值时,说明当前用户离移动终端较近,此时移动终端会判定用户处于接近状态。反之当接近传感器的输出值小于较小的输出值阈值时,说明当前 用户离移动终端较远,此时移动终端会判定用户处于远离状态。对应于上述两种状态,接近传感器异常可分为两类,一类是远离异常,此时接近传感器输出的输出值会小于较小的输出值阈值,另一类是接近异常,此时接近传感器输出的输出值会大于较大的输出值阈值。当基于接近传感器数据来控制移动终端的一些操作时,由于接近状态和远离状态会对应着不同的操作步骤,此时若接近传感器存在接近异常,会直接导致移动终端的操作无法正常控制。例如,当基于接近传感器数据来控制移动终端的显示屏亮灭状态时,由于接近状态时会熄灭显示屏,因此接近异常会导致显示屏持续处于熄灭状态而无法被点亮。因此为了防止接近传感器异常导致的移动终端操作异常,如导致显示屏持续处于熄灭状态,需要一种可以实现对接近传感器接近异常识别的方法。
为了实现对接近传感器接近异常的识别,本申请实施例首先会对接近传感器是否被遮挡进行识别,并在识别出接近传感器没有被遮挡的时候,启动对接近传感器输出值的采样和接近异常检测。在对接近传感器输出值进行采样和接近异常检测时,会对采样出的输出值的大小和数据稳定性进行检测,以判断接近传感器是否在持续稳定地输出异常数据,进而得到对接近传感器是否存在接近异常的检测结果,保障了对接近传感器接近异常检测的准确可靠。其中,本申请实施例实际使用的接近传感器种类需根据实际场景确定,此处不予限定,包括但不限于如红外接近传感器和超声波接近传感器。
以接近传感器为红外接近传感器为例对本申请实施例进行说明如下:
图2A示出了本申请实施例提供的一种接近传感器的异常检测方法的示意性流程图。该方法可以应用于上述手机100中,也可以应用于其他包含接近传感器的移动终端中。详述如下:
S2001,移动终端对接近传感器进行输出值采样,得到第一样本输出值。
S2002,移动终端对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果。
S2003,移动终端根据第一样本输出值和稳定性分析结果,得到接近传感器是否异常的检测结果。
由于存在接近异常的接近传感器,其输出值会持续较大且较为稳定,因此本申请实施例中会基于接近传感器的输出值大小和稳定性情况,来识别接近传感器是否存在异常。其中,具体的检测原理和操作细节等说明,可以参考图2B对应的实施例说明,此处不予赘述。
实际应用中,移动终端可能会随着用户的使用而被置于各种可能的不同场景之中,例如放置在口袋、书包以及盒子之类的不透光物体内部,或者被放置在桌子和凳子等物体表面,又或者被用户手持。在这些不同的场景之中,接近传感器既有可能会被遮挡也有可能不会被遮挡。其中,遮挡是指接近传感器较近距离内存在障碍物,使得接近传感器接收到的波的能量持续较强。例如接近传感器被用户手掌挡住、接近传感器表面放置一个障碍物,以及将接近传感器放置在不透光物体内部,这些场景下接近传感器就是处于被遮挡的状态。当接近传感器处于被遮挡的状态时,对于接近传感器不存在任何异常的情况。此时由于被遮挡接近传感器接收到的反射红外线持续较强,从而导致接近传感器的输出值会持续较大。而在检测异常时,也是基于输出值来判断是否异常;若输出值持续较大,则确认为异常。因此若图2A所示实施例是在接近传感器被遮挡的情况下进行的异常检测,此时无论接近传感器是否存在接近异常,最终输出的结果都是输出值持续较大,从而导致异常检测的结果可信度较低。
为了提高异常检测结果的可信度,参考图2B,本申请实施例提供了一种接近传感器的异常检测方法。详述如下:
S201,移动终端识别接近传感器是否被遮挡。
为了保障对接近传感器接近异常检测的可信度,本申请实施例在接近传感器接近异常检测被触发时,开始对接近传感器的接近异常检测流程。进行接近异常检测时,首先会识别接近传感器是否被遮挡,并仅在接近传感器未被遮挡时,才启动后续对接近传感器异常检测的具体操作。其中,本申请实施例不对具体使用的遮挡检测方法进行限定,可由技术人员根据实际需求进行设定。在一些实施例中,可以根据移动终端所处的环境光强度或者移动终端的空间姿态,来识别移动终端是否被遮挡,并将识别出的结果作为接近传感器的被遮挡状态。而在另一些实施例中,可以同时根据移动终端检测到的环境光强度以及移动终端的空间姿态,来识别接近传感器是否被遮挡。其中,接近异常检测的具体触发方式此处不予限定,可由技术人员根据实际需求进行设定。例如在一些实施例中,可以设置为定时触发,如可以设置为每条的固定时间点触发。此时,达到固定时间点时就会触发S201的操作。而在另一些实施例中,也可以在移动终端中设置一个传感器检测功能,当用户启动该传感器检测功能时即可触发S201的操作。
在一些场景之中,环境光强度有时候并不能和接近传感器是否被遮挡直接进行等同。以手机为例,当环境光传感器和接近传感器都设置在手机的顶部区域时(实际上很多全面屏手机就是将大量的传感器设置在手机顶部区域,以实现手机全面屏的效果)。此时若将手机正面朝下放置于桌面,参考图3,由于环境光传感器位于手机顶部,因此此时环境光传感器仍可以正常检测到较强的环境光。但对于接近传感器而言,由于其检测的是在移动终端正面方向是否有障碍物靠近,因此对于接近传感器而言,桌面此时就是一个距离很近的固定障碍物;即此时接近传感器就处于被遮挡状态。因此若直接根据环境光强度来判断接近传感器是否被遮挡,势必会造成大量的错误识别结果,从而使得接近传感器接近异常的识别准确率难以得到有效保障。
作为本申请的一个可选实施例,为了准确识别出接近传感器未被遮挡的情况,本申请实施例中会同时综合环境光强度和移动终端的空间姿态两个维度数据,来进行接近传感器是否被遮挡的识别,识别的过程如下:
移动终端获取环境光强度以及移动终端的姿态数据,并基于环境光强度和姿态数据,识别接近传感器是否被遮挡。
其中,环境光强度可由移动终端中的环境光传感器检测得到,姿态数据可由移动终端中的姿态传感器检测得到。同时,可使用的姿态传感器种类包括但不限于如陀螺仪、多轴加速度计和重力传感器,具体需根据实际移动终端硬件配置确定。
虽然检测到的环境光较强时无法说明接近传感器是否被遮挡,但反之当环境光较弱时,说明移动终端有极大的可能正处于一个被遮挡的场景之中。例如在用户口袋之中,此时接近传感器同样也处于被遮挡的状态,因此本申请实施例仍然保留了环境光强度作为检测接近传感器是否被遮挡的指标之一。同时,考虑到移动终端在被用户使用的过程中,可能会在空间中呈现各种不同的姿态。例如参考图4用户竖屏操作时的竖屏姿态,以及图3中正面朝下背面朝上放置桌子上时的背面横屏姿态等。而实际应用表明,不同的姿态下接近传感器被遮挡的可能性也存在极大的差异,例如当移动终端处于背面横屏姿态时,一般就是用户将移动终端背面朝上放置桌子凳子等物体上,此时接近传感器处于被遮挡的状态。而当移动终端处于竖屏姿态或近似竖屏姿态时,一般都是用户正在使用移动终端,此时接近传感器处于未被遮挡的状态。正是基于这一原理,本申请实施例还会同时将移动终端的空间姿态作为考量指标之一,即会同时综合移动终端所处的环境光强度以及姿态数据,来判断接近传感器是否可能处于被遮挡的状态。
具体而言,本申请实施例会设置一个作为衡量环境光强弱的光强阈值,或者设置一套对光强 阈值的计算规则,以在需要进行环境光强度比对时计算出对应的光强阈值。同时,本申请实施例还会选取出一些接近传感器被遮挡概率较小的空间姿态,并设置好这些姿态对应的姿态数据,以实现对接近传感器未被遮挡时的空间姿态识别。
其中,本申请实施例中不对光强阈值的设定方法进行限定,可由技术人员根据实际需求进行选取或设定。在一些实施例中,可以将光强阈值设置为一固定值,此处不对具体固定值的大小进行限定,可由技术人员根据实际需求来设定一个适宜的光强阈值。例如可以根据实际用户所处的地理区域等因素来进行考量和设定,在这些实施例中,可以将光强阈值设置为30勒克斯~70勒克斯之间的任意一值,如可以设置为50勒克斯或者60勒克斯。在另一些实施例中,可以不设置一个固定的光强阈值,而是设置一套对应的光强阈值计算规则。同样,此处不对具体的计算规则进行限定,可由技术人员根据实际需求来进行设定。例如可以根据实际用户所处的地理区域和实时所处时段(如是白天还是晚上)等因素来进行计算规则的设置。在这些实施例中,可以将计算规则设置为:预先设置一个基准值,并对不同的地理区域和时段设置不同的常数项系数,再根据用户实时所处的地理区域和时段对应的常数项系数,来对基准值进行求和值计算,进而得到最终使用的光强阈值。
同时,本申请实施例亦不对选取的空间姿态以及对应的姿态数据进行限定,可由技术人员自行选取或设定。在一些实施例中,可以将竖屏姿态设置为本申请实施例中所需的空间姿态。此时可以将移动终端竖屏姿态下对应的姿态数据集合作为接近传感器未被遮挡时的判断数据,即此时只要环境光强度大于强度阈值,且移动终端的姿态数据属于竖屏姿态下对应的姿态数据集合,即可判定接近传感器未被遮挡。反之,只要满足环境光强度小于或等于强度阈值以及移动终端的姿态数据不属于竖屏姿态下对应的姿态数据集合中,任意一个或两个条件,都会判定接近传感器被遮挡。
参考图5,移动终端的姿态数据包括俯仰角、翻滚角和偏航角三种姿态角。其中,俯仰角、翻滚角和偏航角分别是指移动终端围绕着移动终端坐标系的x轴、y轴和z轴旋转所产生的夹角。
应当理解地,虽然移动终端的姿态角中包含俯仰角、偏航角和翻滚角三种角度数据,但根据实际选取的空间姿态对应的姿态数据情况的不同。本申请实施例中获取的姿态数据可以包含俯仰角、偏航角和翻滚角中的任意一个或多个角度数据。例如,当选取的空间姿态仅根据俯仰角和翻滚角就可以识别时,此时空间姿态对应的姿态数据中只需包含俯仰角和翻滚角的角度数据即可。对应的,此时本申请实施例中的姿态数据仅仅只包含指俯仰角和翻滚角的角度数据,而无需理会偏航角。由此可知,本申请实施例中实际所需采集的姿态数据内容,需根据实际选取的空间姿态对应的姿态数据情况进行确定。
作为本申请的一个可选实施例,考虑到实际应用中当用户持握移动终端时,接近传感器都是处于未被遮挡的状态,而被持握的过程中移动终端的空间姿态是有一定变化的,被持握时移动终端对应的俯仰角和翻滚角都是有一定浮动空间的。因此为了实现对接近传感器是否被遮挡的准确识别,本申请实施例选取了移动终端被用户持握时对应的姿态集合,作为判断接近传感器为未被遮挡的空间姿态集合,并设置对应的俯仰角取值范围和翻滚角取值范围以进行检测。本申请实施例对接近传感器是否被遮挡的识别过程如下:
移动终端获取环境光强度和移动终端的俯仰角和翻滚角的角度数据,若环境光强度大于强度阈值,俯仰角的角度数据属于预设的俯仰角取值范围,且翻滚角的角度数据属于预设的翻滚角取值范围,判定接近传感器未被遮挡。反之,只要满足环境光强度小于或等于强度阈值、俯仰角的 角度数据不属于预设的俯仰角取值范围,以及翻滚角的角度数据不属于预设的翻滚角取值范围,这三个条件中的任意一个或多个条件,都会判定接近传感器被遮挡。
本申请实施例中不对具体设置的俯仰角取值范围和翻滚角取值范围进行限定,可由技术人员根据实际移动终端被持握时对应俯仰角和翻滚角的变化情况进行检测,并根据检测结果进行设定,在一些实施例中,可以将俯仰角取值范围设置为[-50°,15°],并将翻滚角取值范围设置为[-30°,30°]。
在本申请实施例中,通过移动终端的俯仰角和翻滚角实现对移动终端是否为被用户持握的空间姿态的准确识别,在移动终端处于被用户持握的空间姿态且环境光强度较强时,判定接近传感器未被遮挡,进一步实现了对接近传感器是否被遮挡的准确识别。
S202,若接近传感器未被遮挡,移动终端对接近传感器进行输出值采样,得到第一样本输出值,并对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果。
在接近传感器未被遮挡时,若接近传感器不存在任何异常,此时接近传感器接收到的反射红外线持续较弱或者接收不到反射红外线,因此接近传感器的输出值会持续较小;而若接近传感器存在接近异常,此时接近传感器的输出值会持续较大,因此在接近传感器未被遮挡的情况下,理论上可以实现对接近传感器接近异常的有效检测。
基于上述原理可知,在接近传感器未被遮挡时,理论上通过检测接近传感器输出值是否持续较大就可以识别出接近传感器是否存在接近异常。但一方面,实际应用中发现,无论使用何种方法来检测接近传感器是否被遮挡,都难以保证其检测结果绝对准确。因此,即使是S201中检测的结果为接近传感器未被遮挡,实际上仍可能有较小的几率接近传感器是处于被遮挡的状态,此时若直接根据接近传感器输出值是否持续较大来判定接近传感器是否存在接近异常,就会导致识别结果准确率下降。但实际应用中又发现,无论是何种遮挡情况,由于障碍物自身运动以及环境中光线等因素的影响,遮挡情况下接近传感器接收到的红外光强度是具有一定波动性的,最终体现为接近传感器的输出值也会有一定波动性。因此,理论上可以根据接近传感器输出值的波动性如何,来实现对遮挡情况的进行二次筛选,为接近异常的识别提供双重保障。另一方面,实际应用中发现,对于存在接近异常的接近传感器,其输出值一般波动性极小数值非常稳定,因此通过分析接近传感器的输出值稳定性,可以识别出接近传感器是否处于接近异常。
基于上述分析,本申请实施例在检测出接近传感器未被遮挡时,会开始对接近传感器进行输出值采样,并同时会对得到的第一样本输出值进行数据稳定性分析,从而得到可以表征输出值波动性的稳定性分析结果,以为后续基于第一样本输出值大小和稳定性分析结果对接近传感器进行异常检测提供所需数据。
在本申请实施例中,不对接近传感器输出值采样频率进行限定,可由技术人员根据实际需求设定,在一些实施例中,采样频率可以设置为30次/秒~60次/秒中的任意一频率。
在本申请实施例中,数据稳定性分析是指对数据的离散程度或集中程度进行分析,以得到对数据稳定性的量化结果。对于一组数据而言,其数据之间的离散程度越高,数据波动就越大,说明数据之间集中程度越差,数据稳定性越差;当数据之间的离散程度越低,数据波动就越小,说明数据之间集中程度越高,数据稳定性越好。
在本申请实施例中,可选用数据离散程度分析和集中程度分析中任意一种或两种的方式,来实现对数据稳定性的量化,具体可由技术人员根据实际需求选取或设定,此处不予限定。同时本申请实施例也不对数据稳定性的具体分析方法进行限定,可由技术人员根据实际需求选取或设定, 包括但不限于如相邻差值法、最值差值法、统计学方法(如计算方差和标准差等)和百分数衡量法等。根据选取的数据稳定性分析方法不同,稳定性分析结果对应的数据类型也可以存在一定的差异。例如,在一些实施例中,可以选用相邻差值法来进行数据稳定性分析,此时在每次采样到接近传感器的输出值时,都会将此次采样到的输出值与前一次采样的输出值求差,并将计算出的差值作为稳定性分析结果。因此在这些实施例之中,稳定性分析结果是一个随着每次输出值采样实时变化的数值。在另一些实施例中,也可以选用统计学方法中的方差来作为稳定性分析结果,此时会在采样一段时间之后,对采样得到的输出值来进行方差计算,并将得到方差值作为对应的稳定性分析结果。而在有一些实施例中,也可以在得到上述可表征数据稳定性的数值的基础上,根据该数值的大小来确定出一个稳定性等级,并将该稳定性等级作为稳定性分析结果。例如将数据稳定性划分为一级、二级和三级,并在计算出可表征数据稳定性的数值之后,根据该数值确定出对应的等级。因此在这些实施例中,稳定性分析结果就是一个具体的等级而非一个数值。
S203,移动终端根据第一样本输出值和稳定性分析结果,得到接近传感器是否异常的检测结果。
在得到第一样本输出值和对应的稳定性分析结果的基础上,本申请实施例会检测第一样本输出值是否持续较大,同时还会根据稳定性分析结果检测第一样本输出值的是否稳定,并根据两个检测结果综合判定接近传感器是否存在接近异常。
其中,为了衡量第一样本输出值是否较大,本申请实施例中会预先设定一个第一输出值阈值,并在第一样本输出值大于该第一输出值阈值时,判定第一样本输出值较大;在不大于第一输出值阈值时,则判定第一样本输出值较小。具体的第一输出值阈值大小此处不予限定,可由技术人员根据实际使用的接近传感器情况设定。例如,可以在确定出所需分析检测的接近传感器种类之后,由技术人员预先对一些存在接近异常的同类接近传感器进行输出值检测,并根据检测的实际结果来设定本申请实施例所需的第一输出阈值。在一些实施例中,当接近传感器为红外接近传感器时,可以将第一输出值阈值设置为1600~2000中的任意一值,如可以设置为1800或者1900。
同时,为了衡量接近传感器输出的输出值大小是否稳定,即波动是否较大,本申请实施例还会预先设置一个预设取值范围,当稳定性分析结果处于该预设取值范围时,本申请实施例会判定接近传感器输出的输出值大小稳定,反之若不处于该预设取值范围,则认为输出值波动较大不稳定。同样,本申请实施例亦不对具体使用的预设取值范围进行限定,可由技术人员根据使用的数据稳定性分析方法以及实际对输出值稳定性的需求设定。其中,应当说明地,由于数据的离散程度与数据稳定性呈负相关,而集中程度与数据稳定性呈正相关,因此根据实际应用中数据稳定性的量化方式的不同,预设取值范围的设定方式也会存在一定差异。例如在仅选用分析离散程度的方式量化数据稳定性时,往往是设定一个上限阈值,当稳定性分析结果小于该上限阈值时,则判定输出值大小稳定。在仅选用集中程度的方式量化数据稳定性时,则往往是设置一个下限阈值,当稳定性分析结果高于该下限阈值时,则判定输出值大小稳定。而在同时选用两种方式时,则分别设置一个上限阈值和一个下限阈值,并在离散程度分析方式得到的结果小于上限阈值,同时集中程度分析方式得到的结果大于下限阈值时,判定输出值大小稳定。
本申请实施例中,仅当识别出接近传感器未被遮挡时,才启动对接近传感器输出值的采样和异常检测。在对接近传感器输出值进行采样和异常检测时,会对采样出的输出值的大小和数据稳定性进行检测,以判断接近传感器是否在持续稳定地输出异常数据。通过是否被遮挡的识别加数据稳定性分析,既实现了对接近传感器接近异常时的输出值稳定的特性检测,又实现了对遮挡情 况的二次筛选,为接近异常的检测提供了双重保证,进而实现了对接近传感器是否存在接近异常的准确可靠检测。
作为图2B对应的实施例中S203的一种具体实现方式,参考图6,S203可以被替换为S601。本申请实施例提供的异常检测方法,包括:
S201,移动终端识别接近传感器是否被遮挡。
S202,若接近传感器未被遮挡,移动终端对接近传感器进行输出值采样,得到第一样本输出值,并对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果。
对S201和S202的说明可参考图2B对应的实施例说明,此处不予赘述。
S601,若开始采样后的第一时长内,采样得到的样本输出值均大于第一输出值阈值,且稳定性分析结果处于预设取值范围,移动终端判定检测结果为接近传感器存在接近异常。
第一样本输出值是否持续较大以及第一样本输出值的是否稳定,都是对于一段时间内的第一样本输出值进行分析的结果。因此在上述设定好第一输出值阈值和预设取值范围的基础上,本申请实施例还会设置一个第一时长作为对应的持续检测时长,并对第一时长内采样的第一样本输出值进行数值大小和数据稳定性的分析,以判断接近传感器是否存在异常。其中,理论上第一时长越长检测结果的可信度也越高,但第一时长过长又会导致检测的效率降低,且会导致移动终端功耗增大,因此第一时长的具体值可由技术人员根据实际需求自行设定,此处不予限定。在一些实施例中,可以将第一时长设置为0~60分钟中的任意一值。
在设定好第一时长的基础上,本申请实施例会在开始采样后的第一时长内,对每次采样到的第一样本输出值进行第一输出值阈值的比较。同时,还会判断第一时长内采样到的第一样本输出值的稳定性分析结果是否处于预设取值范围内,若第一时长内采集到的第一样本输出值能同时满足数值大小和数据稳定性两个要求,说明此时接近传感器的输出值稳定且较大,满足接近异常的判断标准,此时本申请实施例会判定检测结果为接近传感器存在接近异常。反之,若第一样本输出值不大于第一输出值阈值,或者稳定性分析结果不处于预设取值范围内,本申请实施例都会判定接近传感器不存在接近异常,并结束对接近传感器接近异常的检测操作。
作为本申请的一个可选实施例,选用分析离散程度的方式量化数据稳定性。此时S202输出的稳定性分析结果,即为对输出值进行离散程度分析后得到的数据波动值。由上述S203中说明可知,此时预设取值范围可由一个上限阈值代替,在本申请实施例中会设置一个预设波动阈值作为上限阈值。
在此基础上,S601中的“稳定性分析结果处于预设取值范围”,在本申请实施例中可被替换为“数据波动值小于预设波动阈值”。
其中,预设波动阈值的具体大小可由技术人员根据实际需求设定,此处不予限定。例如当接近传感器为红外接近传感器时,在使用相邻差值法进行数据稳定性分析的一些实施例中,该预设波动阈值可设置为50~200中的任意一值。
其中,应当理解地,本申请实施例中没有对具体使用的数据稳定性分析方法进行限定。由前述本申请实施例中的说明可知,根据使用的数据稳定性分析方法的不同,S202中输出的稳定性分析结果,有可能是会随着输出值采样情况变化而变化的数据。例如相邻差值法中,稳定性分析结果会随着每次输出值采样而实时变化。又例如,统计学方法虽然都是对一段时间内所有的第一样本输出值进行分析从而得到对应的稳定性分析结果。但若一些实施例中设置分析时间段的终点时刻为当前采样到第一样本输出值的时刻,例如假设设置为对最近20秒采样得到的第一样本输出值 进行方差计算,此时在第一时长采样结束前,每次采样到新的第一样本输出值时对应的稳定性分析结果也会产生对应的变化。同时,输出的稳定性分析结果也有可能是在第一时长采样完成之后,对第一时长内所有第一样本输出值分析得到的一个固定数据,例如对第一时长内所有第一样本输出值进行方差计算,并将方差作为对应的稳定性分析结果,因此,对应于不同的稳定性分析结果输出情况,本申请实施例中对稳定性分析结果的检测过程也会存在一定的差异。具体而言:
在一些实施例中,若所选用的数据稳定性分析方法,对应生成的稳定性分析结果是会随着输出值采样情况变化而变化的数据。此时本申请实施例对稳定性分析结果的检测,也是会在每次生成新的稳定性分析结果之后,都判断新的稳定性分析结果是否处于对应的预设取值范围内。在第一时长的采样结束前,只要有稳定性分析结果不属于预设取值范围,都会判定接近传感器的输出值不稳定。例如,当使用相邻差值法分析时,S202中每次采样到第一样本输出值时,都将此次采样到的第一样本输出值与上一次采样的第一样本输出值求差,并将差值作为稳定性分析结果。此时本申请实施例就会在每次计算出差值之后,判定差值是否属于预设取值范围,若不属于,则判定接近传感器的输出值不稳定。
在另一些实施例中,所选用的数据稳定性分析方法是在第一时长采样完成之后,对第一时长内所有第一样本输出值分析得到的一个固定的稳定性分析结果。此时S202会在第一时长采样完成后才对采样得到的第一时长内的第一样本输出值进行分析,并得到一个对应的稳定性分析结果。对应的,本申请实施例也会第一时长采样结束之后,判断最终计算出稳定性分析结果是否属于预设取值范围,若不属于,则判定接近传感器的输出值不稳定。
在基于接近传感器数据进行移动终端操作控制时,为了防止接近异常导致的移动终端操作异常,常见的处理策略是直接将移动终端的控制状态固定化,而固定化的控制状态又会导致移动终端的效率或功耗等指标受到影响。例如,为了防止接近异常导致的移动终端显示屏持续熄灭,常见的处理策略是直接设置移动终端显示屏常亮,此时用户误操作的几率以及移动终端的功耗都会有所上升。因此实际接近异常的准确与否,对用户使用移动终端的影响往往较大,本申请前述实施例虽然可以实现对接近传感器接近异常的检测,但单次检测往往会存在一定的偶然性误差,同时也无法满足不同场景下对对接近异常检测的准确性的不同等级需求。
因此,为了满足不同场景下对接近异常检测不同等级的准确性需求,进一步地提升对接近异常检测的准确率。参考图7A,在图2B对应的实施例的基础上,本申请另一实施例中,接近异常的检测方法包括:
S701,移动终端判断接近传感器是否被遮挡。若接近传感器未被遮挡,则执行S702的操作。
S702,移动终端对接近传感器进行输出值采样,得到第一样本输出值,并对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果。
对S701和S702的说明可参考图2B对应的实施例中对S201和S202的说明,此处不予赘述。
S703,若开始采样后的第一时长内,采样得到的第一样本输出值均大于第一输出值阈值,且稳定性分析结果处于预设取值范围,移动终端统计执行对接近传感器进行输出值采样,得到第一样本输出值的操作次数。
其中,S701的操作原理与S601基本相同,因此对第一时长的相关说明,以及对第一样本输出值的大小和数据稳定性检测的原理和步骤说明,均可参考图6对应的实施例中的相关说明,此处不予赘述。
与S601不同之处在于,本申请实施例在检测出接近传感器的输出值稳定且较大之后,仅仅只 是结束当次对第一样本输出值大小和数据稳定性的检测流程,而不会判定接近传感器是否存在接收异常。同时,在每次结束检测流程之后,本申请实施例还会统计在识别出接近传感器未被遮挡后,执行检测流程的总次数,由于每次执行检测流程都需要返回至S702的操作,因此只需要统计执行该操作的次数,即可得到对应的接近异常检测的总次数。其中,结束检测流程,是指完成了对当次样本输出值大小和稳定性分析结果的检测,且检测结果为输出值稳定且较大。
作为本申请的一个可选实施例,为了便于进行接近异常检测的总次数的统计,可以设置一个变量用于记录接近异常检测的次数。即每完成一次对接近传感器的接近异常检测,就对该变量进行自加一操作,此时,对“移动终端对接近传感器进行输出值采样,得到第一样本输出值”操作次数的统计,只需要将该变量的实时值减去变量的初始值即可。
S704,移动终端比较操作次数和预设循环次数的大小,然后执行S705或者S707。
S705,若操作次数小于预设循环次数,移动终端检测自身显示屏的亮灭状态。
其中,预设循环次数用于限制对接近异常检测的总次数。由于单次接近异常检测往往会存在一定的偶然性误差,因此为了提高接近异常检测的准确性,本申请实施例设置了一个可选接近异常检测次数的机制。通过不同次数的接近异常检测来调整偶然性误差的概率,从而实现对接近异常检测准确等级的可调整化。其中,预设循环次数就是对不同准确等级的控制参数。理论上预设循环次数越大对接近异常检测的准确率越高,但同时也会导致检测的效率降低且功耗增强,因此具体的预设循环次数值,可由技术人员根据实际场景需求来进行固定值设定或者设置预设循环次数的生成规则,此处不予限定。例如在一些实施例中,可以设置为1~10中任意一值,如可以设置为2或者4。而在另一些实施例中,也可以预先设置一个预设循环次数的生成规则,并在需要使用预设循环次数时,根据该规则来进行处理,从而得到实时对应的预设循环次数。
当接近异常检测的总次数还没有达到预设循环次数要求时,本申请实施例会继续进行下一次的接近异常检测。但实际应用中发现,若在一次接近异常检测完成后直接开启下一次的检测,由于两次检测之间间隔时间过短,此时移动终端对应的环境情况差异一般极小甚至可能没有差异,且两次检测的结果往往也是相同的,从而导致后一次检测的实际意义较小,对检测准确率的提升帮助较小。因此,为了保障相邻两次接近异常检测的环境情况具有一定的差异性,在检测出接近异常检测的总次数还没有达到预设循环次数要求后,本申请实施例还会识别显示屏的亮灭状态变化,并根据显示屏的亮灭状态变化,来判断移动终端所处的环境是否发生了变化,进而决定是否要开启下一次的接近异常检测。
其中,应当说明地,由于显示屏亮灭状态变化的时机无法预知,因此在实际应用中,对于显示屏亮灭状态变化的识别包括主动识别和被动识别两种可选的实施方式:
对于主动识别,此时移动终端会主动检测显示屏是否发生亮灭状态变化,并会检测到发生亮灭状态变化时返回执行S702的操作,具体可参考S705和S706的说明,此处不予赘述。而当未检测到发生亮灭变化时,则不执行S702的操作,而是以一定规则开启下一次的检测。其中具体的检测开启规则此处不予限定,可由技术人员自行设定,例如,可以设置为周期检测。
对于被动识别,此时移动终端不会去主动检测显示屏是否发生亮灭状态变化,而是会在被动检测到对显示屏的亮灭切换指令的时候,判定显示屏亮灭状态发生变化。由于不会去主动检测显示屏状态,因此在这种实施方式中不会有“显示屏亮灭状态未发生变化”的情况出现,而是会持续等待亮灭切换指令,直至得到“显示屏亮灭状态发生变化”的结果。此时参考图7B,在图7A对应的实施例中,本实施例会将S705和S706两个步骤,替换为“S7001,若操作次数小于预设 循环次数,且移动终端检测到对自身显示屏的亮灭切换指令,移动终端返回执行S702的操作”的一个步骤。对应的S704之后将不会执行S705,而是执行S7001。其中,亮灭切换指令的触发方式此处不予限定,需根据实际场景确定,包括但不限于如:用户主动输入、第三方设备发送或者由移动终端内部程序主动生成。
S706,移动终端判断显示屏的亮灭状态是否发生变化。若显示屏的亮灭状态发生变化,移动终端返回执行S702的操作。
其中,显示屏发生亮灭状态变化,是指显示屏从亮屏变到灭屏或者从灭屏变到亮屏。当显示屏发生亮灭状态变化时,说明用户操作过移动终端,或者移动终端检测到了一些环境参数的变化。即此时移动终端所处的环境发生了一定的变化。因此,在检测到显示屏亮灭状态发生变化时,本申请实施例会返回执行S702的操作,从而启动新一轮的接近传感器接近异常检测。
其中,本申请实施例在检测亮灭状态变化时,不限定亮灭状态变化的次数。如既可以是只要检测到一次显示屏亮灭状态变化,就触发启动新一轮的接近异常检测;也可以是需要检测到多次的亮灭状态变化才触发启动新一轮的接近异常检测。由于当用户需要使用移动终端时,就需要将移动终端拿到手上进行操作,才能实现亮灭屏的有效切换,此时移动终端所处的空间环境就发生了改变。因此理论上显示屏的亮灭状态变化次数越多,对应移动终端所处空间环境发生变化的概率越大。但实际上显示屏相邻两次的亮灭状态变化间隔时间难以预知,从而使得该变化次数设定的越大,对应的检测效率也会越低。因此,具体变化次数设定值可由技术人员根据实际需求设定。在一些实施例中,可以将变化次数设定为2次。此时需要检测到一次显示屏由点亮状态变为熄灭状态,以及一次熄灭状态变为点亮状态(两者检测到的顺序不限),才会判定显示屏亮灭状态变化满足要求,并返回执行对接近传感器进行输出值采样,得到第一样本输出值的操作。
S707,若操作次数等于预设循环次数,移动终端判定检测结果为接近传感器存在接近异常。
由于本申请实施例在每次接近传感器接近异常检测的过程中,只要有第一输出值样本的大小或数据稳定性需求不满足要求,都会判定接近传感器不存在接近异常,且会终止对接近传感器的接近异常检测。因此当统计出的操作次数等于预设循环次数时,说明本申请实施例连续预设循环次数的检测结果均表明接近传感器存在接近异常,因此此时本申请实施例会判定接近传感器存在接近异常。
在本申请实施例中,通过设置一个可选接近异常检测次数的机制来对接近传感器进行可选次数的接近异常检测,使得技术人员可以根据实际场景对接近异常检测准确性的需求来选取设定适宜的预设循环次数,并进行对应预设循环次数的检测,从而使得本申请实施例可以最大可能地满足不同实际场景对检测准确的不同等级需求。同时当预设循环次数大于1时,本申请实施例还会基于移动终端显示屏的亮灭状态变化情况,来确定移动终端所处环境是否存在变化,进而确定出每一次接近异常检测的启动时机,进而保障了每一次接近异常检测的有效性,进一步地提升了多次接近异常检测时的准确性。
作为本申请的一个可选实施例,在上述本申请各实施例的基础上,本申请实施例会基于S2003、S203、S601或S709得到的接近异常的检测结果,来对移动终端显示屏亮灭状态进行控制,即在S2003、S203、S601或S709之后,本申请实施例,包括:
在终端需要使用接近传感器上报的数据时,若检测结果为接近传感器存在接近异常,则移动终端忽略接近传感器上报的数据。或者
在终端需要使用接近传感器上报的数据时,若检测结果为接近传感器存在接近异常,则移动 终端将移动终端的屏幕设置为常亮。
实际在需要调用接近传感器输出值来进行移动终端显示屏亮灭状态控制的场景中,显示屏亮灭状态控制方案一般包含两类。第一类是仅根据接近传感器的输出值来进行显示屏亮灭状态控制,第二类是同时根据接近传感器的输出值和移动终端的其他参数来进行显示屏亮灭状态控制。其中,所使用的其他参数可由技术人员根据实际移动终端情况进行选取设定。在一些实施例中,其他参数可以设置为移动终端超声波数据、接收到的用户触控指令,以及识别出的用户手势指令中的任意一种或多种。对应于上述两类控制方案,当上述本申请各实施例的检测结果为接近传感器存在接近异常时,本申请实施例可以采用以下两种方案中的任意一种来进行移动终端显示屏亮灭状态控制:
1、当移动终端原本的显示屏亮灭状态控制方案为第一类方案时,本申请实施例会将显示屏设置为常亮。
2、当移动终端原本的显示屏亮灭状态控制方案为第二类方案时,本申请实施例会忽略掉接近传感器上报的数据,而根据原本选用的其他参数来进行显示屏的亮灭状态控制。
当识别出接近传感器存在接近异常时,本申请实施例会及时修改原本的显示屏亮灭控制方案,将显示屏设置为常亮,或者参考移动终端的其他参数来进行显示屏亮灭控制,从而避免了移动终端因接近传感器接近异常导致的显示屏持续熄灭的情况发生。
作为本申请的一个可选实施例,考虑到上述两种方案的实质都是不参考接近传感器的输出值来进行显示屏亮灭状态控制,因此在本申请实施例中,当识别接近传感器存在接近异常时,可以直接关闭接近传感器,以减小移动终端功耗。
实际应用中发现,接近异常检测的过程本身需要一定的时间,同时也需要占用一定的移动终端处理器资源。因此在接近传感器本身不存在接近异常时,若直接采用上述本申请各实施例的检测方法进行处理,无疑会造成一定的处理器资源浪费。
为了提升对接近传感器是否存在接近异常的检测效率,节约移动终端的处理器资源,本申请实施例还可以在对接近传感器进行被遮挡识别之前,会先对接近传感器输出值进行快速检测。然后基于快速检测的结果来决定是否需要执行上述本申请各实施例的检测步骤。在S201或S701之前,本申请实施例对接近传感器快速检测的步骤包括:
移动终端对接近传感器进行输出值采样,得到第二样本输出值。
在识别接近传感器是否被遮挡之前,本申请实施例会预先对接近传感器输出值进行采样,得到用于快速检测的第二样本输出值。
若第二时长内采样得到的第二样本输出值均小于或等于第二输出值阈值,移动终端判定接近传感器不存在接近异常。
若第二时长内采样得到的第二样本输出值中,存在大于第二输出值阈值的值,移动终端则执行识别接近传感器是否被遮挡的操作,其中,第二输出值阈值小于或等于第一输出值阈值。当本申请实施例与图7A或图7B对应的实施例结合应用时,则是执行S701的操作。
若接近传感器可以持续输出较小的值,说明此时接近传感器可以正常检测出障碍物与接近传感器之间处于远离状态,即可说明接近传感器此时不存在接近异常。因此在检测出接近传感器在第二时长内输出的第二样本输出值均小于或等于第二输出值阈值时,本申请实施例会判定接近传感器不存在接近异常,并不会启动上述本申请各实施例的检测步骤,以避免对移动终端处理器资源的浪费。
其中,理论上第二时长越长检测结果的可信度越高,但检测效率却越低。因此第二时长的具体值可由技术人员根据实际需求来进行设定,此处不予限定。在一些实施例中,可以将第二时长设置为2秒~10秒,例如可以设置为3秒或5秒。第二输出值阈值用于判定第二样本输出值是否较小,具体的第二输出值阈值大小此处不予限定,可由技术人员根据实际使用的接近传感器情况设定。具体可参考图2B对应的实施例中对第一输出值阈值的设定说明来进行第二输出值阈值的设定,但应当保证第二输出值阈值小于或等于第一输出值阈值,以保障前后检测的一致性,保障检测的可信度。
当接近传感器无法持续输出较小的值的时候,说明此时无法确定接近传感器是否可以正常检测出障碍物与接近传感器之间的远离状态,此时本申请实施例会启动上述本申请各实施例的检测步骤,以实现对接近传感器是否接近异常的准确检测。
在本申请实施例中,通过在启动对接近传感器是否接近异常的检测之前先对接近传感器进行快速检测,判断接近传感器是否可以正常进行障碍物的远离状态检测。并仅在无法确定出接近传感器是否可以正常进行障碍物的远离状态检测时,启动对接近传感器是否被遮挡的检测,并进入上述本申请各实施例的检测步骤。从而使得本申请实施例可以一定程度上避免对移动终端处理器资源的浪费,提升对接近传感器是否存在接近异常的检测效率。
实际应用中,若需要基于接近传感器的数据来控制移动终端的一些操作,例如控制显示屏亮灭或者控制显示屏亮度调节,接近传感器接近异常检测方案的启动时机十分重要。若启动时机不合理,可能直接会导致检测的结果可信度降低,进而导致对移动终端的控制不准确。例如,假设将启动时机设置为每年1月1号凌晨00:00。此时两次接近异常检测的时间间隔长达1年。在一年内,无论接近传感器出现何种变化,此时都无法及时更新检测实际的接近传感器情况,从而导致检测结果的可信度大大降低,且基于该低可信度的检测结果来进行移动终端的操作控制,势必会导致控制的准确率大大降低。
因此,为了尽可能地保障接近传感器接近异常检测结果的可信度,提高对移动终端操作控制的准确性,在上述本申请各实施例的基础上,作为本申请的一个可选实施例,对接近传感器接近异常检测的触发流程,包括:
当移动终端检测到移动终端执行预设行为或预设操作时,启动对接近传感器的接近异常检测操作,以及,以预设时间点为起始时间点,以第三时长为周期值,周期启动对接近传感器的接近异常检测操作。
作为本申请的另一个可选实施例,对接近传感器接近异常检测的触发流程,还可以设置为:
移动终端在开机后或在检测到用户点击对接近传感器接近异常的检测功能后,启动对接近传感器的接近异常检测操作。
作为本申请的又一个可选实施例,对接近传感器接近异常检测的触发流程,亦可以仅设置为:
移动终端以预设时间点为起始时间点,以第三时长为周期值,周期启动识别接近传感器是否被遮挡的操作。
其中,当实际应用中需要在S201或S701之前对接近传感器快速检测时,本申请实施例的“启动对接近传感器的接近异常检测”是指对接近传感器快速检测的步骤。而当实际应用中不需要进行快速检测时,本申请实施例的“启动对接近传感器的接近异常检测”则是指S201或S701的操作。具体检测的预设行为和预设操作种类此处不予限定,可由技术人员根据需求自行设定,包括但不限于如开机行为,以及用户点击对接近传感器接近异常的检测功能。
对于可选实施例:当移动终端检测到移动终端执行预设行为或预设操作时,启动对接近传感器的接近异常检测操作,以及,以预设时间点为起始时间点,以第三时长为周期值,周期启动对接近传感器的接近异常检测操作。
作为对预设行为或预设操作识别的一种具体实现方式,本申请实施例中,识别的操作可以如下:若检测到预设触发指令,则判定移动终端在执行预设行为或操作。
考虑到实际移动终端在开始执行各种行为和操作前,会接收到对应一些控制指令,或者在执行各种行为和操作之后,会生成对应的数据或者指令。例如用户点击对接近传感器接近异常的检测功能后,移动终端会生成一个对应的检测启动指令。因此本申请实施例中会预先对所需检测的预设行为和操作进行分析,确定出移动终端在执行预设行为和操作前可能接收到的控制指令,以及在执行预设行为和操作后可能生成的数据或指令,再将这些数据和指令统一作为本申请实施例中的预设触发指令。而在移动终端正常运行的过程中,若检测到了这些预设触发指令的存在,本申请实施例就会判定移动终端正在执行对应的预设行为或预设操作。
同时,本申请实施例不对具体作为起始时间点的预设时间点,以及具体启动的周期值第三时长进行限定,可由技术人员根据实际需求进行选取或设定。对于预设时间点而言,在一些实施例中,预设时间点可以是一个固定时间点,如可以是每日凌晨00:00。而在另一些实施例中,预设时间点也可以是与某些行为或操作相关联的时间点,例如可以设置为开机完成时的时间点;此时只要开机完成就可以启动对应的接近异常检测,同时还会以该时间点为起点来周期启动对应的接近异常检测。对于第三时长而言,为了避免过长时间不检测导致的检测结果可信度较低的情况,本申请实施例中第三时长可设置为小于1个月的任意一值,例如在一些实施例中可以设置第三时长为一周,此时每隔一周就会对接近传感器进行一次接近异常检测,而在另一些实施例中,也可以设置第三时长为1小时,此时每隔一小时就会对接近传感器进行一次接近异常检测。
对于可选实施例:移动终端在开机后或在检测到用户点击对接近传感器接近异常的检测功能后,启动对接近传感器的接近异常检测操作。
在本申请实施例中,用户可以在需要时主动点击对接近传感器接近异常的检测功能,或者将移动终端重新关机开机,移动终端则在开机后或者用户主动触发检测功能后,才启动对接近传感器的接近异常检测操作。从而使得移动终端不会在用户正常使用的过程中,自动启动对接近传感器的接近异常检测操作,更不会对用户正常使用移动终端造成干扰。
一般的,用户对移动终端执行开关机的间隔时长是不可控的。并且用户何时会启动对接近传感器接近异常的检测功能也是无法预知的。而当长时间不对接近传感器进行接近异常的检测时,在未检测的这段时间内,接近传感器的状态可能会发生变化。例如,可能由于碰撞等原因导致接近传感器损坏,此时接近传感器就从正常变为了接近异常。又例如,用户将原本损坏的接近传感器拿去维修,此时接近传感器就从接近异常变为了正常。因此若长时间不对接近传感器是否存在接近异常进行检测,有可能会使得检测结果的可信度降低。
对于可选实施例:移动终端以预设时间点为起始时间点,以第三时长为周期值,周期执行识别接近传感器是否被遮挡的操作。
其中,起始时间点和第三时长的设置,均可参考上述相关说明,此处不予赘述。本申请实施例通过周期检测接近传感器是否存在接近异常,实现了对接近传感器状态的及时更新,保障了对接近传感器接近异常检测结果的可信度。
由图2B对应的实施例说明可知,接近传感器是否被遮挡对接近传感器接近异常检测的影响 极大。当接近传感器被遮挡状态时,接近传感器异常检测的结果可信度较低。因此,为了保障接近传感器异常检测结果的可信度,在执行上述本申请各实施例对接近传感器进行接近异常检测的操作同时,本申请实施例还会持续检测接近传感器是否被遮挡;并在检测出接近传感器被遮挡时,终止对接近传感器接近异常检测的操作。此时无论执行到了上述本申请各实施例中哪一步操作,本申请实施例都会强制终止流程,并判定对接近传感器接近异常的检测失败,同时可以不输出与是否存在接近异常的相关检测结果。
其中,本申请实施例不对接近传感器是否被遮挡的检测频率进行限定,具体可由技术人员根据实际需求设定。在一些可选实施例中,可以设置为10次/分钟~60次/分钟中的任意一频率。
由上述本申请实施例的说明可知,若在对接近传感器进行接近异常检测的过程中,接近传感器从未被遮挡的状态变为被遮挡的状态,此时移动终端会强制终止对接近传感器接近异常检测的操作,从而使得当次的检测失败。同时由上述本申请实施例的说明还可知,在对接近传感器接近异常的检测触发流程可以为:以预设时间点为起始时间点,以第三时长为周期值,周期启动对接近传感器的接近异常检测操作时。其中,若两次有效检测的相隔时间过长,将会导致检测结果的可信度下降。因此为了保障检测结果的可信度,在上述本申请各实例的基础上,本申请实施例对接近传感器接近异常的检测触发流程可以为:
移动终端以预设时间点为起始时间点,以第三时长为周期值,周期启动识别接近传感器是否被遮挡的操作。若检测出接近传感器被遮挡,根据当次执行识别接近传感器是否被遮挡操作的第一时间点和第三时长,获取下一次执行识别接近传感器是否被遮挡操作的第二时间点;从第一时间点到第二时间点之间选取一个第三时间点,将起始时间点更新为第三时间点,并周期启动识别接近传感器是否被遮挡的操作。
与上述实施例相同的,当实际应用中需要在S201或S701之前对接近传感器快速检测时,本申请实施例的“启动对接近传感器的接近异常检测”是指对接近传感器快速检测的步骤。而当实际应用中不需要进行快速检测时,本申请实施例的“启动对接近传感器的接近异常检测”则是指S201或S701的操作。
在本申请实施例中,当检测出接近传感器被遮挡,即对接近传感器接近异常的检测失败时,首先会根据当次检测的启动时间点和设置的周期值第三时长来计算出理论上下一次启动的时间点。在此基础上,再在当次启动时间点到计算出的下次启动时间点之间,选取出一个时间点来新的起始时间点。最后再将原本的起始时间点更新为该选取出的新的起始时间点,进而使得下一次检测的启动时间提前。其中,具体的新启动时间点选取方法此处不予限定,可由技术人员自行设定。以一实例进行说明,假设设置第三时长为1天,同时假设上次启动的时间为1月1日00:00,当次检测的启动时间点为1月2日00:00。此时,可计算出下一次的启动时间点就是1月3日00:00。若按照第三时长正常启动检测,将会导致1月1日00:00~1月3日00:00之间无法进行一次有效的检测,使得这段时间内的检测结果可信度降低。为了防止这种情况发生,本申请实施例会在这两个时间点之间选取出一个时间点作为新的起始时间点,例如可以选取1月1日12:00。从而使得下一次的实际启动时间点变成了1月1日12:00,提前于理论的1月2日00:00。
本申请实施例在每次检测失败时,都会提前下一次启动对接近传感器接近异常的检测时间点,可以防止两次有效检测的相隔时间过长导致检测结果的可信度下降。
作为本申请的一个可选实施例,考虑到在开机后根据用户实际需求的不同,移动终端随时可能需要调用接近传感器的输出值并进行操作,如根据接近传感器的输出值对移动终端显示屏进行 亮灭状态控制。而实际对接近传感器接近异常的检测本身需要一段时间,因此理论上,在开机完成到开机后的对接近传感器接近异常的第一次检测结果出来前,我们是无法通过检测的手段来确定出接近传感器实际是否存在接近异常的。但另一方面由理论分析可知,光学器件损坏或出现异常不是突变的,即开机前后接近传感器的状态应该是一致的。
因此在上述理论的基础上,为了在开机完成到开机后的对接近传感器接近异常的第一次检测结果出来前这一段时间内,保障移动终端对接近传感器的正常调用。在上述本申请各实施例得到对接近传感器接近异常的检测结果之后。本申请实施例还会对检测结果进行本地存储。同时为了防止移动终端掉电后丢失检测结果数据,本申请实施例会将检测结果存储在本地的非易失性存储器之中。该存储的检测结果数据可以根据最新对接近传感器接近异常的检测结果进行更新。从而使得移动终端每次开机后都可以直接从非易失性存储器之中读取出最新的检测结果,并在开机后的对接近传感器接近异常的第一次检测结果出来前,将读取出的检测结果作为接近传感器的实际状态进行使用操作。例如,可以根据从非易失性存储器之中读取出最新的检测结果对移动终端的显示屏亮度和/或亮灭状态进行控制。其中,当读取出的检测结果为接近传感器存在接近异常时,可以参考上述本申请实施例,通过非接近传感器输出值的其他参数来对移动终端的显示屏亮度和/或亮灭状态进行控制,从而避免异常的接近传感器对显示屏亮度和亮灭状态控制的干扰。
应当理解地,上述实施例虽然是以红外接近传感器为例进行说明,但本申请的各个实施例同样可以应用至对其他种类接近传感器的接近异常检测,如对超声波接近传感器的接近异常检测,这些对其他种类接近传感器的接近异常检测,均应包含在本申请的保护范围之内。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的接近传感器的异常检测方法,图8示出了本申请实施例提供的接近传感器的异常检测装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图8,该接近传感器的异常检测装置包括:
遮挡识别模块81,用于识别接近传感器是否被遮挡。
数据分析模块82,用于若接近传感器未被遮挡,对接近传感器进行输出值采样,得到第一样本输出值,并对第一样本输出值进行数据稳定性分析,得到对应的稳定性分析结果。
异常检测模块83,用于对第一样本输出值和稳定性分析结果进行分析,得到接近传感器是否异常的检测结果。
进一步地,遮挡识别模块81,包括:
获取环境光强度以及自身的姿态角数据,并基于环境光强度和姿态角数据,识别接近传感器是否被遮挡。
进一步地,异常检测模块83,包括:
第一异常判定模块,用于若开始采样后的第一时长内,采样得到的第一样本输出值均大于第一输出值阈值,且稳定性分析结果处于预设取值范围,判定检测结果为接近传感器存在接近异常。
进一步地,异常检测模块83,包括:
操作统计模块,用于若开始采样后的第一时长内,采样得到的第一样本输出值均大于第一输出值阈值,且稳定性分析结果处于预设取值范围,统计执行对接近传感器进行输出值采样,得到第一样本输出值的操作次数。
亮灭检测模块,用于若操作次数小于预设循环次数,检测自身显示屏的亮灭状态。若显示屏 的亮灭状态发生变化,移动终端返回执行对接近传感器进行输出值采样,得到第一样本输出值的操作。
第二异常判定模块,用于若操作次数等于预设循环次数,判定检测结果为接近传感器存在接近异常。
进一步地,该接近传感器的异常检测装置,还包括:
采样模块,用于对接近传感器进行输出值采样,得到第二样本输出值。
预检测模块,用于若第二时长内采样得到的第二样本输出值中,存在大于第二输出值阈值的值,执行识别接近传感器是否被遮挡的操作,其中,第二输出值阈值小于或等于第一输出值阈值。
进一步地,该接近传感器的异常检测装置,还包括:
第一触发模块,用于若检测到自身执行预设行为或预设操作,执行识别接近传感器是否被遮挡的操作。
进一步地,该接近传感器的异常检测装置,还包括:
第二触发模块,用于以预设时间点为起始时间点,以第三时长为周期值,周期执行识别接近传感器是否被遮挡的操作。
进一步地,第二触发模块,包括:
时间点获取模块,用于若接近传感器被遮挡,根据当次执行识别接近传感器是否被遮挡操作的第一时间点和第三时长,获取下一次执行识别接近传感器是否被遮挡操作的第二时间点。
时间点更新模块,用于从第一时间点到第二时间点之间选取一个第三时间点,将起始时间点更新为第三时间点,并周期执行识别接近传感器是否被遮挡的操作。
进一步地,该接近传感器的异常检测装置,还包括:
存储模块,用于将检测结果储存至本地非易失性存储器中。
本申请实施例提供的接近传感器的异常检测装置装置中各模块实现各自功能的过程,具体可参考前述图2B-7所示实施例以及其他相关方法实施例的描述,此处不再赘述。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
图9为本申请一实施例提供的移动终端的结构示意图。该实施例的移动终端9包括:至少一个处理器90(图9中仅示出一个)处理器、存储器91、接近传感器92以及存储在所述存储器91中并可在所述至少一个处理器90上运行的计算机程序93,所述处理器90执行所述计算机程序93时实现上述任意各个接近传感器的异常检测方法实施例中的步骤。
所述移动终端9可以是手机、平板电脑和可穿戴设备等可移动的计算设备。该移动终端可包括,但不仅限于,处理器90、存储器91、接近传感器92。本领域技术人员可以理解,图9仅仅是移动终端9的举例,并不构成对移动终端9的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。
所称处理器90可以是中央处理单元(Central Processing Unit,CPU),该处理器90还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器91在一些实施例中可以是所述移动终端9的内部存储单元,例如移动终端9的硬 盘或内存。所述存储器91在另一些实施例中也可以是所述移动终端9的外部存储设备,例如所述移动终端9上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器91还可以既包括所述移动终端9的内部存储单元也包括外部存储设备。所述存储器91用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器91还可以用于暂时地存储已经输出或者将要输出的数据。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/移动终端的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/移动终端和方法,可以通过其它的方式实现。例如,以上所描述的装置/移动终端实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接, 可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (14)

  1. 一种接近传感器的异常检测方法,应用于包含所述接近传感器的移动终端,其特征在于,包括:
    所述移动终端对所述接近传感器进行输出值采样,得到第一样本输出值;
    所述移动终端对所述第一样本输出值进行数据稳定性分析,得到稳定性分析结果;
    所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果。
  2. 如权利要求1所述的方法,其特征在于,所述移动终端在对所述接近传感器进行输出值采样之前,还包括:
    所述移动终端识别所述接近传感器是否被遮挡;
    若所述接近传感器未被遮挡,所述移动终端执行所述对所述接近传感器进行输出值采样的操作。
  3. 如权利要求2所述的方法,其特征在于,所述移动终端识别所述接近传感器是否被遮挡,包括:
    所述移动终端获取环境光强度以及所述移动终端的姿态数据,并基于所述环境光强度和所述姿态数据,识别所述接近传感器是否被遮挡。
  4. 如权利要求1至3任意一项所述的方法,其特征在于,所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果,包括:
    若开始采样后的第一时长内,采样得到的所述第一样本输出值均大于第一输出值阈值,且所述稳定性分析结果处于预设取值范围,所述移动终端判定所述检测结果为所述接近传感器存在接近异常。
  5. 如权利要求4所述的方法,其特征在于,所述稳定性分析结果包括数据波动值;所述稳定性分析结果处于预设取值范围,包括:所述数据波动值小于预设波动阈值。
  6. 如权利要求1至3任意一项所述的方法,其特征在于,所述移动终端根据所述第一样本输出值和所述稳定性分析结果,得到所述接近传感器是否异常的检测结果,包括:
    若开始采样后的第一时长内,采样得到的所述第一样本输出值均大于第一输出值阈值,且所述稳定性分析结果处于预设取值范围,所述移动终端统计执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作次数;
    若所述操作次数小于预设循环次数,且所述移动终端自身显示屏的亮灭状态发生变化,所述移动终端返回执行所述对所述接近传感器进行输出值采样,得到第一样本输出值的操作;
    若所述操作次数等于预设循环次数,所述移动终端判定所述检测结果为所述接近传感器存在接近异常。
  7. 如权利要求2至6任意一项所述的方法,其特征在于,在所述移动终端识别所述接近传感器是否被遮挡之前,还包括:
    所述移动终端对所述接近传感器进行输出值采样,得到第二样本输出值;
    若第二时长内采样得到的所述第二样本输出值中,存在大于第二输出值阈值的值,所述移动终端执行所述识别所述接近传感器是否被遮挡的操作,其中,所述第二输出值阈值小于或等于所述第一输出值阈值。
  8. 如权利要求2至7任意一项所述的方法,其特征在于,在所述移动终端识别所述接近传感 器是否被遮挡之前,还包括:
    所述移动终端若检测到自身执行预设行为或预设操作,执行所述识别所述接近传感器是否被遮挡的操作。
  9. 如权利要求2至8任意一项所述的方法,其特征在于,在所述移动终端识别所述接近传感器是否被遮挡之前,还包括:
    所述移动终端以预设时间点为起始时间点,以第三时长为周期值,周期执行所述识别所述接近传感器是否被遮挡的操作。
  10. 如权利要求9所述的方法,其特征在于,还包括:
    若所述接近传感器被遮挡,根据当次执行所述识别所述接近传感器是否被遮挡操作的第一时间点和所述第三时长,获取下一次执行所述识别所述接近传感器是否被遮挡操作的第二时间点;
    从所述第一时间点到所述第二时间点之间选取一个第三时间点,将所述起始时间点更新为所述第三时间点,并周期执行所述识别所述接近传感器是否被遮挡的操作。
  11. 如权利要求1至10任意一项所述的方法,其特征在于,在所述得到所述接近传感器是否异常的检测结果之后,还包括:
    所述移动终端将所述检测结果储存至本地非易失性存储器中。
  12. 如权利要求1至11任意一项所述的方法,其特征在于,在所述得到所述接近传感器是否异常的检测结果之后,还包括:
    在所述终端需要使用所述接近传感器上报的数据时,若所述检测结果为所述接近传感器存在接近异常,则所述移动终端忽略所述接近传感器上报的数据;或者
    在所述终端需要使用所述接近传感器上报的数据时,若所述检测结果为所述接近传感器存在接近异常,则所述移动终端将所述移动终端的显示屏设置为常亮。
  13. 一种移动终端,包括接近传感器、存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时,所述移动终端实现如权利要求1至12任一项所述的方法。
  14. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被执行时实现如权利要求1至12任一项所述的方法。
PCT/CN2020/125382 2019-12-27 2020-10-30 接近传感器的异常检测方法、装置及移动终端 WO2021129147A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911375969.6A CN111182115B (zh) 2019-12-27 2019-12-27 接近传感器的异常检测方法、装置及移动终端
CN201911375969.6 2019-12-27

Publications (1)

Publication Number Publication Date
WO2021129147A1 true WO2021129147A1 (zh) 2021-07-01

Family

ID=70654145

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/125382 WO2021129147A1 (zh) 2019-12-27 2020-10-30 接近传感器的异常检测方法、装置及移动终端

Country Status (2)

Country Link
CN (1) CN111182115B (zh)
WO (1) WO2021129147A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518133A (zh) * 2022-01-13 2022-05-20 首钢京唐钢铁联合有限责任公司 传感器数值跳变的检测方法、装置、电子设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111182115B (zh) * 2019-12-27 2022-06-10 荣耀终端有限公司 接近传感器的异常检测方法、装置及移动终端
CN115314590A (zh) * 2022-06-21 2022-11-08 华为技术有限公司 接近事件的判定方法和电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016049861A1 (zh) * 2014-09-30 2016-04-07 华为技术有限公司 接近光传感器的控制方法、装置和移动终端
CN106443639A (zh) * 2016-09-26 2017-02-22 深圳市金立通信设备有限公司 一种距离校准方法和终端
CN106486127A (zh) * 2015-08-25 2017-03-08 中兴通讯股份有限公司 一种语音识别参数自动调整的方法、装置及移动终端
CN106547638A (zh) * 2016-11-08 2017-03-29 广东欧珀移动通信有限公司 防止接近状态异常的方法、装置及移动终端
CN109343066A (zh) * 2018-09-18 2019-02-15 Oppo广东移动通信有限公司 接近传感器的控制方法、装置、存储介质及移动终端
CN111182115A (zh) * 2019-12-27 2020-05-19 北京华为数字技术有限公司 接近传感器的异常检测方法、装置及移动终端

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102265252B (zh) * 2011-06-24 2013-04-24 华为终端有限公司 一种调整红外接近传感器的感知阈值的方法和装置
US20130260834A1 (en) * 2012-04-03 2013-10-03 Voxer Ip Llc Proximity detection system for operating a mobile communication device in either a handset mode or speakerphone mode

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016049861A1 (zh) * 2014-09-30 2016-04-07 华为技术有限公司 接近光传感器的控制方法、装置和移动终端
CN106486127A (zh) * 2015-08-25 2017-03-08 中兴通讯股份有限公司 一种语音识别参数自动调整的方法、装置及移动终端
CN106443639A (zh) * 2016-09-26 2017-02-22 深圳市金立通信设备有限公司 一种距离校准方法和终端
CN106547638A (zh) * 2016-11-08 2017-03-29 广东欧珀移动通信有限公司 防止接近状态异常的方法、装置及移动终端
CN109343066A (zh) * 2018-09-18 2019-02-15 Oppo广东移动通信有限公司 接近传感器的控制方法、装置、存储介质及移动终端
CN111182115A (zh) * 2019-12-27 2020-05-19 北京华为数字技术有限公司 接近传感器的异常检测方法、装置及移动终端

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518133A (zh) * 2022-01-13 2022-05-20 首钢京唐钢铁联合有限责任公司 传感器数值跳变的检测方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN111182115B (zh) 2022-06-10
CN111182115A (zh) 2020-05-19

Similar Documents

Publication Publication Date Title
US11429276B2 (en) Method for displaying graphical user interface and mobile terminal
WO2021129147A1 (zh) 接近传感器的异常检测方法、装置及移动终端
CN106778585B (zh) 一种人脸关键点跟踪方法和装置
CN107943345B (zh) 接近传感器的校准方法、装置、存储介质和电子设备
CN106357897B (zh) 跌落信息的获取方法及装置
CN107942306B (zh) 接近传感器的校准方法、装置、存储介质和电子设备
US20200125229A1 (en) Display Processing Method and Apparatus
CN108463792A (zh) 一种防误触方法及终端
CN109891379A (zh) 一种防误触方法及终端
US10564694B2 (en) Power management method and power management apparatus for user equipment
CN106453829B (zh) 一种跌落高度检测方法及装置
CN108681498B (zh) 一种cpu占用率的监测方法、装置以及移动终端
WO2020077485A1 (zh) 电子围栏更新的方法和通信装置
CN109314727A (zh) 一种控制移动终端屏幕的方法及装置
CN103823626A (zh) 显示内容调节方法、装置和电子设备
CN105807908B (zh) 一种切换工作模式的方法和装置
CN109523977A (zh) 背光调节方法、装置、移动终端和存储介质
CN107528958B (zh) 移动终端控制方法、装置、可读存储介质和移动终端
CN109246233A (zh) 基于在线监控的数据处理方法、装置、设备及存储介质
CN111064842B (zh) 一种识别异形触摸的方法、终端及存储介质
CN106484141B (zh) 阈值的设置方法及移动终端
CN104765441B (zh) 一种基于眼动实现页面更新的方法和装置
CN111132282B (zh) 一种应用于移动终端的应用处理器唤醒方法及装置
CN112596980A (zh) ios性能收集方法及装置、移动终端、计算机可读存储介质
CN106896896B (zh) 省电方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20907933

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20907933

Country of ref document: EP

Kind code of ref document: A1