Detection method and device, electronic equipment, storage medium and computer program product

By obtaining the natural light intensity value and adjusting the target intensity threshold, the problem of the infrared distance sensor misjudging the display screen as blocked under natural light is solved, and the judgment accuracy is improved.

CN120610286APending Publication Date: 2025-09-09BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202410264072.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-07
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Infrared distance sensors are easily interfered by the infrared light components in natural light, which can lead to errors in judging the distance between the electronic device display and the target object, and mistakenly judge that the display is blocked.

Method used

By obtaining the natural light intensity value of the current environment of the electronic device, the light intensity level is determined, and when the light intensity level is greater than the preset level, the target intensity threshold of the distance sensor is adjusted, and the reflected light signal intensity value is compared to determine whether the display screen is blocked.

Benefits of technology

This effectively avoids distance sensor misjudgment caused by excessive infrared light in natural light, and improves the accuracy of judging whether the display is blocked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120610286A_ABST
    Figure CN120610286A_ABST
Patent Text Reader

Abstract

The invention relates to a detection method and device, electronic equipment, a storage medium and a computer program product, and the method comprises the steps: obtaining a natural light intensity value of an environment where the electronic equipment is located at present, and determining an illumination intensity grade corresponding to the natural light intensity value; under the condition that the illumination intensity grade is greater than a first preset grade, adjusting a target intensity threshold value based on the natural light intensity value; comparing an intensity value of a reflected light signal received by a distance sensor in the electronic equipment with a target intensity threshold value to obtain a first comparison result; when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold value, it is determined that the display screen of the electronic equipment is shielded, so that the problem that the display screen of the electronic equipment is misjudged to be shielded when the natural light intensity value is relatively large can be effectively avoided; and the accuracy of determining whether the display screen of the electronic equipment is shielded or not can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of electronic technology, and in particular to a detection method, device, electronic device, storage medium, and computer program product. Background Art

[0002] Distance sensors can be categorized into optical, infrared, and ultrasonic distance sensors based on their operating principles. Most distance sensors used on electronic devices are infrared distance sensors, which consist of an infrared transmitter and an infrared receiver. They can determine the distance between the electronic device's display and the target object based on the intensity of the infrared light energy received by the infrared receiver.

[0003] However, in some usage scenarios, infrared distance sensors are easily interfered with by infrared light components in natural light, resulting in errors in the distance judgment between the electronic device's display and the target object, thereby mistakenly judging that the electronic device's display is blocked. Summary of the Invention

[0004] In order to overcome the problems in the related art, the present disclosure provides a detection method, device, electronic device, storage medium and computer program product, which can effectively avoid the problem of misjudging whether the display screen of the electronic device is blocked due to the excessive infrared light component in the natural light when the natural light intensity value is large.

[0005] According to a first aspect of an embodiment of the present disclosure, a detection method is provided, including:

[0006] Obtaining a natural light intensity value of an environment in which the electronic device is currently located, and determining a light intensity level corresponding to the natural light intensity value;

[0007] When the light intensity level is greater than a first preset level, adjusting the target intensity threshold based on the natural light intensity value;

[0008] Comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result;

[0009] When the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0010] In some embodiments, the method further comprises:

[0011] Comparing the natural light intensity value with the preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level;

[0012] The illumination intensity level corresponding to the natural light intensity value is determined based on the preset intensity range within which the natural light intensity value falls.

[0013] In some embodiments, the method further comprises:

[0014] When the light intensity level is greater than a second preset level, determining that the display screen of the electronic device is not blocked;

[0015] The second preset level is higher than the first preset level.

[0016] In some embodiments, determining the illumination intensity level corresponding to the natural light intensity value based on the preset intensity range in which the natural light intensity value falls includes:

[0017] When the natural light intensity value is within a first preset intensity range, determining that the illumination intensity level is greater than the first preset level;

[0018] When the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level;

[0019] The minimum preset light intensity value in the second preset intensity range is greater than the maximum preset light intensity value in the first preset intensity range.

[0020] In some embodiments, when the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level includes:

[0021] If the natural light intensity value is continuously within the second preset intensity range within a first preset time period, it is determined that the illumination intensity level is greater than the second preset level.

[0022] In some embodiments, the method further comprises:

[0023] When the light intensity level is greater than the first preset level and it is detected that the natural light intensity value increases, starting a first timer;

[0024] When the first timer is turned on, comparing the natural light intensity value obtained when the first timer is turned on with the preset light intensity value within the second preset intensity range to determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range;

[0025] The timing duration of the first timer is the first preset duration.

[0026] In some embodiments, the method further comprises:

[0027] When the light intensity level is greater than the second preset level and it is detected that the natural light intensity value decreases, starting a second timer;

[0028] When the second timer is started and the timing duration of the second timer reaches a second preset duration, the light intensity level is re-determined based on the natural light intensity value obtained when the second preset duration is reached.

[0029] In some embodiments, the method further comprises:

[0030] When the light intensity level is less than or equal to the first preset level, comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with a preset intensity threshold to obtain a second comparison result;

[0031] Based on the second comparison result, determining whether the display screen of the electronic device is blocked;

[0032] The preset strength threshold is determined by historical test data.

[0033] In some embodiments, obtaining the natural light intensity value of the current environment of the electronic device includes:

[0034] In response to a detection event of whether the display screen of the electronic device is blocked, a natural light intensity value of an environment in which the electronic device is located is acquired.

[0035] According to a second aspect of an embodiment of the present disclosure, a detection device is provided, including:

[0036] an acquisition module configured to acquire a natural light intensity value of an environment in which the electronic device is currently located, and determine a light intensity level corresponding to the natural light intensity value;

[0037] an adjustment module configured to adjust a target intensity threshold based on the natural light intensity value when the light intensity level is greater than a first preset level;

[0038] a first comparison module configured to compare the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result;

[0039] The first judgment module is configured to determine that the display screen of the electronic device is blocked when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold.

[0040] In some embodiments, the apparatus further comprises:

[0041] a first determining module configured to compare the natural light intensity value with preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level;

[0042] The second determining module is configured to determine the illumination intensity level corresponding to the natural light intensity value based on the preset intensity range in which the natural light intensity value is located.

[0043] In some embodiments, the apparatus further comprises:

[0044] a third determining module, configured to determine that the display screen of the electronic device is not blocked when the light intensity level is greater than a second preset level;

[0045] The second preset level is higher than the first preset level.

[0046] In some embodiments, the second determining module includes:

[0047] a first submodule configured to determine that the illumination intensity level is greater than the first preset level when the natural light intensity value is within a first preset intensity range;

[0048] a second submodule configured to determine that the illumination intensity level is greater than the second preset level when the natural light intensity value is within a second preset intensity range;

[0049] The minimum preset light intensity value in the second preset intensity range is greater than the maximum preset light intensity value in the first preset intensity range.

[0050] In some embodiments, the second submodule is configured as follows:

[0051] If the natural light intensity value is continuously within the second preset intensity range within a first preset time period, it is determined that the illumination intensity level is greater than the second preset level.

[0052] In some embodiments, the apparatus further comprises:

[0053] a first activation module configured to activate a first timer when the light intensity level is greater than the first preset level and when it is detected that the natural light intensity value increases;

[0054] a first timer module configured to, when the first timer is turned on, compare the natural light intensity value obtained when the first timer is turned on with a preset light intensity value within the second preset intensity range, and determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range;

[0055] The timing duration of the first timer is the first preset duration.

[0056] In some embodiments, the apparatus further comprises:

[0057] a second activation module configured to activate a second timer when the illumination intensity level is greater than the second preset level and when it is detected that the natural light intensity value decreases;

[0058] The second timer module is configured to, when the second timer is started and the timing duration of the second timer reaches a second preset duration, re-determine the light intensity level based on the natural light intensity value obtained when the second preset duration is reached.

[0059] In some embodiments, the apparatus further comprises:

[0060] a second comparison module configured to compare the intensity value of the reflected light signal received by the distance sensor in the electronic device with a preset intensity threshold to obtain a second comparison result when the light intensity level is less than or equal to the first preset level;

[0061] a second judgment module configured to determine whether the display screen of the electronic device is blocked based on the second comparison result;

[0062] The preset strength threshold is determined by historical test data.

[0063] In some embodiments, the acquisition module is specifically configured as follows:

[0064] In response to a detection event of whether the display screen of the electronic device is blocked, a natural light intensity value of an environment in which the electronic device is located is acquired.

[0065] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0066] processor;

[0067] memory for storing computer programs or instructions;

[0068] The processor executes the computer program or instructions to implement the steps of any one of the detection methods in the first aspect above.

[0069] According to a fourth aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided, comprising:

[0070] When the computer program or instructions in the storage medium are executed by a processor, the steps in any one of the detection methods in the first aspect are implemented.

[0071] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program or instructions, which, when executed by a processor, implement the steps of any one of the detection methods in the first aspect above.

[0072] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:

[0073] In an embodiment of the present disclosure, the natural light intensity value of the environment in which the electronic device is currently located is first obtained, and the light intensity level corresponding to the natural light intensity value is determined; then, when the light intensity level is greater than a first preset level, the target intensity threshold is adjusted based on the natural light intensity value; then, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold to obtain a comparison result; finally, when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0074] In this way, in the embodiment of the present disclosure, when the light intensity level is greater than the first preset level, the target intensity threshold can be continuously adjusted based on the natural light intensity value so that the target intensity threshold corresponds to the natural light intensity value. This can effectively avoid the problem of judging that the display screen of the electronic device is blocked due to the excessive infrared light component in the natural light when the natural light intensity value is large. This is conducive to improving the accuracy of determining whether the display screen of the electronic device is blocked.

[0075] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0077] Figure 1 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 1 ;

[0078] Figure 2 is a schematic diagram of a scenario showing a detection method according to an exemplary embodiment;

[0079] Figure 3 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 2 ;

[0080] Figure 4 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 3 ;

[0081] Figure 5 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 4 ;

[0082] Figure 6 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 5 ;

[0083] Figure 7 is a block diagram of a detection device according to an exemplary embodiment;

[0084] Figure 8 is a structural block diagram of an electronic device 800 according to an exemplary embodiment;

[0085] Figure 9 is a block diagram showing a device 900 for detecting according to an exemplary embodiment. DETAILED DESCRIPTION

[0086] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0087] Figure 1 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 1 ,like Figure 1 As shown, the detection method mainly includes the following steps:

[0088] In step 101, the natural light intensity value of the environment in which the electronic device is currently located is obtained, and the light intensity level corresponding to the natural light intensity value is determined;

[0089] In step 102, when the light intensity level is greater than a first preset level, the target intensity threshold is adjusted based on the natural light intensity value;

[0090] In step 103, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold to obtain a first comparison result;

[0091] In step 104 , when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0092] It should be noted that the detection method proposed in this disclosure can be applied to electronic devices. Here, electronic devices may include: terminal devices, such as mobile terminals or fixed terminals. Mobile terminals may include: mobile phones, tablet computers, laptop computers, wearable electronic devices, and other devices. Fixed terminals may include: desktop computers, smart TVs, in-vehicle devices, and the like. In other embodiments, the detection method may also be applied to applications installed on electronic devices.

[0093] In other embodiments, the detection method in the embodiments of the present disclosure may be configured in a detection device, which may be provided in an electronic device, and the embodiments of the present disclosure are not limited thereto. It should be noted that the execution subject of the embodiments of the present disclosure may be a central processing unit (CPU) in the electronic device in terms of hardware, and may be a related background service in the electronic device in terms of software, and there is no limitation thereto.

[0094] In some embodiments, Figure 2 FIG. 1 is a schematic diagram of a detection method according to an exemplary embodiment. Figure 2 As shown, the scene is a distance detection scene between the display screen 201 of the electronic device and the target object 202. The distance sensor includes an infrared emitting tube 203 and an infrared receiving tube 204. The infrared emitting tube 203 emits infrared rays to the target object 202. After receiving the infrared rays emitted by the infrared emitting tube 203, the target object 202 will reflect the infrared rays. The infrared receiving tube 204 then receives the infrared rays reflected by the target object, thereby determining the distance between the display screen 201 of the electronic device and the target object 202.

[0095] Let's take a mobile phone as an example. When distance detection is required, for example, when a user is answering or making a call and holds the phone close to their head, the distance sensor calculates the intensity of the infrared light emitted by the infrared transmitter and the intensity of the infrared light reflected by the infrared receiver to generate distance detection information. The processor then sends a command to the controller based on this distance detection information, which in turn turns off the screen. When the phone is moved away from the head, the processor again sends a command to the controller based on the distance detection information fed back by the distance sensor, which in turn turns the screen back on.

[0096] However, in the actual application of distance sensors, such as in an outdoor environment with direct sunlight, the infrared light contained in sunlight will cause certain interference to the reflected light signal received by the distance sensor, resulting in an increase in the intensity value of the reflected light signal received by the distance sensor, which can easily cause the distance sensor to misjudge.

[0097] Based on the above problems, the embodiments of the present disclosure propose that it is necessary to obtain the natural light intensity value of the environment in which the electronic device is currently located, and judge the light intensity level corresponding to the natural light intensity value. When it is determined that the light intensity level is high, the detection strategy of the distance sensor is adjusted to reduce the possibility of misjudgment of the distance sensor.

[0098] Here, the natural light intensity value of the environment can be determined by detecting the light intensity of the environment in which the electronic device is currently located, for example, using an ambient light sensor to detect the light intensity of the environment; the natural light intensity value of the environment can also be determined by detecting the light brightness of the environment in which the electronic device is currently located, for example, by acquiring an image of the current environment to detect the light brightness of the environment; the natural light intensity value of the environment can also be determined by detecting a specific wavelength of the natural light in the environment in which the electronic device is currently located, for example, using a Newton ring or a Fabry-Perot interferometer to detect the specific wavelength of the natural light in the environment, and the embodiments of the present disclosure are not limited to this.

[0099] In some embodiments, using an ambient light sensor to detect ambient light intensity as an example, the ambient light sensor typically comprises a photoresistor and a measurement circuit. The measurement circuit indirectly measures light intensity by applying a current or voltage to the photoresistor and measuring the voltage or current across a thermistor. The resistance of the photoresistor is inversely proportional to the light intensity; that is, the resistance of the thermistor is smaller under strong light intensity and larger under weak light intensity.

[0100] In other embodiments, by acquiring an image of the current environment to detect the light brightness of the environment, for example, a camera can be used to acquire multiple frames of images of the current environment, and then the brightness value of the current environment is calculated based on the multiple frames of images to determine the light brightness of the environment.

[0101] It is understandable that the natural light intensity value of the current environment of the electronic device may be obtained in real time or according to a fixed sampling period, and this is not limited in the embodiments of the present disclosure.

[0102] It can be understood that the light intensity level is positively correlated with the natural light intensity value. The larger the natural light intensity value, the higher the light intensity level; the smaller the natural light intensity value, the lower the light intensity level.

[0103] Since when the natural light intensity value of the environment in which the electronic device is currently located is large, there are too many infrared light components in the natural light, which can easily cause inaccurate detection by the distance sensor. Therefore, in the embodiment of the present disclosure, a first preset level is set to judge the light intensity level so as to determine whether the infrared components in the natural light in the environment in which the electronic device is currently located will affect the detection of the distance sensor.

[0104] It should be noted that when the light intensity level is greater than the first preset level, it is determined that the natural light intensity value of the electronic device's environment is large, and the target intensity threshold can be adjusted based on the natural light intensity value to improve the misjudgment of the distance sensor.

[0105] Since the target intensity threshold corresponds to the natural light intensity value after being adjusted based on the natural light intensity value, the accuracy of the distance sensor detection can be guaranteed even if the intensity value of the reflected light signal received by the distance sensor increases due to excessive infrared light components in the natural light.

[0106] In some embodiments, a natural light intensity value may correspond to a target intensity threshold. When the natural light intensity value changes, the target intensity threshold may be adjusted according to a preset amplitude. For example, after determining the first target intensity threshold, the first target intensity threshold may be adjusted by 10 percent of the first target intensity threshold to obtain a second target intensity threshold corresponding to the changed natural light intensity value.

[0107] It should be noted that after determining the target intensity threshold, the intensity value of the reflected light signal received by the distance sensor in the electronic device can be compared with the target intensity threshold to obtain a first comparison result; then, based on the first comparison result, it is determined whether the display screen of the electronic device is blocked, thereby improving the accuracy of determining whether the display screen of the electronic device is blocked.

[0108] Specifically, when the intensity value of the reflected light signal received by the distance sensor is greater than the target intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is large, so that it can be determined that the distance between the display screen of the electronic device and the target object is close, and then it can be determined that the display screen of the electronic device is blocked; and when the intensity value of the reflected light signal received by the distance sensor is less than or equal to the target intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is small, so that it can be determined that the distance between the electronic device and the target object is far, and then it can be determined that the display screen of the electronic device is not blocked.

[0109] In some embodiments, if the electronic device is shaken or experiences device hysteresis, the intensity of the reflected light signal received by the distance sensor may fluctuate, making it impossible for the distance sensor to accurately determine whether a target object is approaching or moving away from the display screen of the electronic device. Therefore, when determining whether the electronic device is in motion, the natural light intensity value of the electronic device's current environment should be promptly obtained, and the corresponding light intensity level should be determined. If the light intensity level is greater than a first preset level, the target intensity threshold should be adjusted based on the natural light intensity value to further determine whether the display screen of the electronic device is obscured.

[0110] For example, when the electronic device is tilted at an angle of 30 degrees or more, the distance sensor is more likely to receive infrared light from the ambient light, significantly affecting the distance it can detect. Therefore, a preset angle threshold can be set. When the electronic device's tilt angle reaches the preset angle threshold, the intensity of the reflected light signal received by the distance sensor can be used to determine the distance between the target object and the electronic device, thereby determining whether the electronic device's display screen is obstructed.

[0111] Here, the tilt angle of the electronic device can be detected by a gravity sensor or a gyroscope sensor. At the same time, the specific data of the preset angle threshold can also be set according to actual conditions.

[0112] In some embodiments, after determining whether the display screen of the electronic device is blocked, the device parameters of the electronic device can be adjusted. The device parameters include but are not limited to the display parameters of the display screen, the touch parameters of the display screen, and the lock screen status of the device, etc. The embodiments of the present disclosure are not limited to this.

[0113] Specifically, when it is determined that the display screen of the electronic device is blocked, the display parameters of the display screen, such as display brightness, display frame rate, and display resolution, etc., can be increased; when it is determined that the display screen of the electronic device is not blocked, the display parameters of the display screen, such as display brightness, display frame rate, and display resolution, etc., can be reduced.

[0114] When it is determined that the display screen of the electronic device is blocked, the anti-mistouch function of the display screen can be turned on; when it is determined that the display screen of the electronic device is blocked, the anti-mistouch function of the display screen can be turned off.

[0115] When it is determined that the display screen of the electronic device is blocked, the screen of the display screen can be maintained in the on state; when it is determined that the display screen of the electronic device is blocked, the screen of the display screen can be adjusted to be in the off state.

[0116] Taking the display brightness as an example, if the display screen of the electronic device is blocked, it can be determined that the distance between the target object and the display screen is relatively close. To facilitate the target object's viewing of the displayed content, the display brightness can be increased, thereby improving the user's viewing experience. If the display screen of the electronic device is not blocked, it can be determined that the distance between the target object and the display screen is relatively far. To reduce the power consumption of the electronic device, the display brightness can be reduced, thereby extending the usage time of the electronic device.

[0117] In an embodiment of the present disclosure, the natural light intensity value of the environment in which the electronic device is currently located is first obtained, and the light intensity level corresponding to the natural light intensity value is determined; then, when the light intensity level is greater than a first preset level, the target intensity threshold is adjusted based on the natural light intensity value; then, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold to obtain a first comparison result; finally, when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0118] In this way, in the embodiment of the present disclosure, when the light intensity level is greater than the first preset level, the target intensity threshold can be continuously adjusted based on the natural light intensity value so that the target intensity threshold corresponds to the natural light intensity value. This can effectively avoid the problem that when the natural light intensity value is large, the intensity value of the reflected light signal received by the distance sensor is large due to the excessive infrared light component in the natural light, which leads to the misjudgment that the display screen of the electronic device is blocked. This is conducive to improving the accuracy of determining whether the display screen of the electronic device is blocked.

[0119] Figure 3 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 2 ,like Figure 3 As shown, the detection method mainly includes the following steps:

[0120] In step 301, the natural light intensity value of the current environment of the electronic device is obtained;

[0121] In step 302, the natural light intensity value is compared with the preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level;

[0122] In step 303, based on the preset intensity range of the natural light intensity value, the light intensity level corresponding to the natural light intensity value is determined;

[0123] In step 304, when the light intensity level is greater than the first preset level, the target intensity threshold is adjusted based on the natural light intensity value;

[0124] In step 305, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold to obtain a first comparison result;

[0125] In step 306 , if the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0126] It should be noted that in order to further improve the accuracy of determining the light intensity level, so as to better judge whether the light intensity level is greater than the first preset level, multiple preset intensity ranges can be set, and the obtained natural light intensity value can be compared with each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; then, based on the preset intensity range in which the natural light intensity value is located, the light intensity level corresponding to the natural light intensity value is determined.

[0127] Here, the number of preset intensity ranges can be set arbitrarily, for example, the number of preset intensity ranges can be 7.

[0128] In some embodiments, a preset intensity range is a range consisting of at least two preset light intensity values, namely, a maximum preset light intensity value and a minimum preset light intensity value. After obtaining a natural light intensity value, the natural light intensity value can be compared with the maximum preset light intensity value and the minimum preset light intensity value within each preset range to determine the preset intensity range within which the natural light intensity value falls.

[0129] It is understandable that in order to determine the light intensity level more quickly, each preset intensity range can be set to correspond to a light intensity level, so that after determining the preset intensity range in which the natural light intensity value is located, the light intensity level can be directly determined, which is beneficial to improve the detection efficiency of the distance sensor and enhance the user experience.

[0130] For example, there are five preset intensity ranges and five illumination intensity levels. The higher the illumination intensity level, the more infrared light components in the natural light. After obtaining the natural light intensity value, the natural light intensity value can be compared with the preset light intensity values ​​within the five preset intensity ranges. If it is determined that the natural light intensity value is within the third preset intensity range, the illumination intensity level corresponding to the natural light intensity value can be determined to be level three.

[0131] In the embodiment of the present disclosure, the natural light intensity value can be compared with the preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; then, based on the preset intensity range in which the natural light intensity value is located, the light intensity level corresponding to the natural light intensity value is determined, thereby facilitating the improvement of the accuracy of the light intensity level determination.

[0132] In some embodiments, the detection method further comprises:

[0133] When the light intensity level is greater than a second preset level, determining that the display screen of the electronic device is not blocked;

[0134] The second preset level is higher than the first preset level.

[0135] It should be noted that the higher the light intensity level, the more infrared light components in natural light, and the more likely it is to cause distance sensor detection errors. Therefore, a second preset level higher than the first preset level can be set to judge the light intensity level, thereby improving the accuracy of distance sensor detection.

[0136] Specifically, if the light intensity level is greater than a second preset level, it can be determined that the display screen of the electronic device is not obstructed. If the light intensity level is less than or equal to the second preset level, the target intensity threshold is adjusted based on the natural light intensity value; the intensity value of the reflected light signal received by the distance sensor in the electronic device is then compared with the target intensity threshold to further determine whether the display screen of the electronic device is obstructed.

[0137] Here, the second preset level can be set arbitrarily as long as it is higher than the first preset level. For example, the first preset level is level 4 and the second preset level is level 6.

[0138] Because when the light intensity level is greater than the second preset level, there is a large amount of infrared light in the natural light, which can easily cause the distance sensor to determine that the display screen of the electronic device is blocked. Therefore, in the embodiment of the present disclosure, there is no need to use the distance sensor for detection. It can directly determine that the display screen of the electronic device is not blocked, thereby avoiding misjudgment of the distance sensor while improving detection efficiency.

[0139] In the disclosed embodiment, the second preset level is higher than the first preset level. When the light intensity level is greater than the second preset level, it is determined that the display screen of the electronic device is not blocked. Thus, when it is determined that the light intensity level is greater than the second preset level, it can be directly determined that the display screen of the electronic device is not blocked, avoiding the problem of detecting whether the display screen of the electronic device is blocked due to excessive infrared light components in natural light. This improves the accuracy of determining whether the display screen of the electronic device is blocked and helps improve detection efficiency.

[0140] In some embodiments, determining the illumination intensity level corresponding to the natural light intensity value based on the preset intensity range in which the natural light intensity value falls includes:

[0141] When the natural light intensity value is within a first preset intensity range, determining that the illumination intensity level is greater than the first preset level;

[0142] When the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level;

[0143] The minimum preset light intensity value in the second preset intensity range is greater than the maximum preset light intensity value in the first preset intensity range.

[0144] It can be understood that in order to optimize the detection strategy of whether the display screen of the electronic device is blocked, a first preset intensity range and a second preset intensity range can be set, and an association relationship between the first preset intensity range and the first preset level and an association relationship between the second preset intensity range and the second preset level can be established. Therefore, after determining the preset intensity range in which the natural light intensity value is located, it is directly determined whether the light intensity level is greater than the first preset level or whether it is greater than the second preset level, so as to improve the detection efficiency of whether the display screen of the electronic device is blocked.

[0145] Here, since the second preset level is higher than the first preset level, the preset light intensity value within the second preset intensity range should be greater than the preset light intensity value within the first preset intensity range, that is, the minimum preset light intensity value within the second preset intensity range is greater than the maximum preset light intensity value within the first preset intensity range.

[0146] Since a detection strategy for whether the display screen of the electronic device is blocked when the light intensity level is greater than the first preset level and a detection strategy for whether the display screen of the electronic device is blocked when the light intensity level is greater than the first preset level are pre-set, after determining the light intensity level, detection can be performed according to the detection strategy corresponding to the level, which is conducive to improving detection accuracy and detection efficiency.

[0147] Specifically, when the light intensity level is greater than the first preset level, the target intensity threshold is first adjusted based on the natural light intensity value, and then the intensity value of the reflected light signal received by the distance sensor is compared with the target intensity threshold. Finally, based on the first comparison result, it is determined whether the display screen of the electronic device is blocked; when the light intensity level is greater than the second preset level, it is determined that the display screen of the electronic device is not blocked.

[0148] In the embodiment of the present disclosure, the minimum preset light intensity value within the second preset intensity range is greater than the maximum preset light intensity value within the first preset intensity range. When the natural light intensity value is within the first preset intensity range, it can be determined that the light intensity level is greater than the first preset level; when the natural light intensity value is within the second preset intensity range, it can be determined that the light intensity level is greater than the second preset level. In this way, by setting the first preset intensity range and the second intensity range, the level of the light intensity level can be directly determined, and according to the detection strategy corresponding to the level, whether the display screen of the electronic device is blocked can be determined. This improves the accuracy of determining whether the display screen of the electronic device is blocked, while also helping to improve the efficiency of detecting whether the display screen of the electronic device is blocked.

[0149] In some embodiments, when the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level includes:

[0150] If the natural light intensity value is continuously within the second preset intensity range within the first preset time period, it is determined that the illumination intensity level is greater than the second preset level.

[0151] It is understandable that in some usage scenarios, such as changes in the tilt angle of the electronic device or jitter of the components inside the electronic device, the detected natural light intensity value will fluctuate, which will lead to inaccurate determined light intensity level. Therefore, in the embodiment of the present disclosure, a first preset time length is first set, and then it is determined whether the natural light intensity value is continuously in the second preset intensity range within the first preset time length, and then the light intensity level is further determined, thereby improving the accuracy of judging the light intensity level.

[0152] Specifically, if the natural light intensity value remains within the second preset intensity range continuously for a first preset duration, it indicates that the natural light intensity value is in a stable state. Based on this natural light intensity value, it can be determined that the light intensity level is greater than the second preset level. However, if the natural light intensity value cannot remain within the second preset intensity range continuously for the first preset duration, it indicates that the natural light intensity value is in a fluctuating state. Based on this natural light intensity value, it cannot be determined that the light intensity level is greater than the second preset level.

[0153] Here, the first preset duration can be set arbitrarily, and is not limited in the embodiment of the present disclosure. For example, the second preset duration can be 5 milliseconds.

[0154] In the disclosed embodiment, if the natural light intensity value remains within the second preset intensity range for a first preset duration, then the light intensity level is determined to be greater than the second preset level. Thus, by setting the first preset duration, first determining whether the natural light intensity value remains within the second preset intensity range, and then further determining whether the light intensity level is greater than the second preset level, can improve the accuracy of determining the light intensity level and whether the display screen of the electronic device is obstructed.

[0155] In some embodiments, the detection method further comprises:

[0156] When the light intensity level is greater than the first preset level and the natural light intensity value is detected to be increasing, starting the first timer;

[0157] When the first timer is turned on, the natural light intensity value obtained when the first timer is turned on is compared with the preset light intensity value within the second preset intensity range to determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range;

[0158] The timing duration of the first timer is a first preset duration.

[0159] It should be noted that when the light intensity level is greater than the first preset level, the natural light intensity value of the environment in which the electronic device is located is large. When it is detected that the natural light intensity value becomes larger, it means that the natural light intensity value shows an upward trend, and the light intensity level will change, that is, it may rise from the first preset level to the second preset level. Therefore, it is necessary to re-judge the light intensity level.

[0160] However, due to the jitter of components within the electronic device, the acquired natural light intensity value of the electronic device's current environment may fluctuate, potentially causing the light intensity level to change. Therefore, to avoid this, the disclosed embodiment pre-sets a first timer. When the light intensity level is greater than a first preset level and the natural light intensity value is detected to increase, the first timer is activated. This provides delayed anti-shake when the light intensity level changes, thereby improving the accuracy of detecting whether the electronic device's display screen is obscured.

[0161] At the same time, since within the first preset range, only if the natural light intensity value continues to be in the second preset intensity range can it be determined that the light intensity level is greater than the second preset level, therefore, the timing duration of the first timer can be set to the first preset duration. On the one hand, delay anti-shake can be set when the light intensity level changes, and on the other hand, it can be accurately judged whether the light intensity level is greater than the second preset level.

[0162] It can be understood that when the first timer is turned on, the natural light intensity value at each moment can be obtained in real time. Therefore, the natural light intensity value obtained when the first timer is turned on can be compared with the preset light intensity value within the second preset intensity range to determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range. After the first timer ends, it is determined whether the light intensity level is greater than the second preset level to improve the accuracy of detecting whether the display screen of the electronic device is blocked.

[0163] In the embodiment of the present disclosure, when the light intensity level is greater than the first preset level and the natural light intensity value is detected to be increasing, the first timer is first turned on; then, when the first timer is turned on, the natural light intensity value obtained when the first timer is turned on is compared with the preset light intensity value within the second preset intensity range, and then it is determined whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range. In this way, by setting the first timer and setting the timing duration to the first preset duration, on the one hand, delay anti-shake can be set when the light intensity level changes, and on the other hand, it can be accurately determined whether the light intensity level is greater than the second preset level, thereby facilitating the improvement of the accuracy of detecting whether the display screen of the electronic device is blocked.

[0164] In some embodiments, the detection method further comprises:

[0165] When the light intensity level is greater than the second preset level and the natural light intensity value is detected to be decreasing, starting the second timer;

[0166] When the second timer is started and the timing duration of the second timer reaches the second preset duration, the light intensity level is re-determined based on the natural light intensity value obtained when the second preset duration is reached.

[0167] It should be noted that when the light intensity level is greater than the second preset level, the natural light intensity value of the environment in which the electronic device is located is very large. When it is detected that the natural light intensity value becomes smaller, it means that the natural light intensity value shows a downward trend, and the light intensity level will change, that is, it may drop from the second preset level to the first preset level. Therefore, the light intensity level needs to be re-judged.

[0168] However, due to the jitter of components within the electronic device, the acquired natural light intensity value of the electronic device's current environment may fluctuate, potentially causing the light intensity level to change. Therefore, to avoid this, the disclosed embodiment pre-sets a second timer. When the light intensity level is greater than a second preset level and the natural light intensity value is detected to be decreasing, the second timer is activated. This provides delayed anti-shake when the light intensity level changes, thereby improving the accuracy of detecting whether the electronic device's display screen is obscured.

[0169] Here, the second preset duration may be the same as or different from the first preset duration and may be set arbitrarily according to requirements. The embodiment of the present disclosure does not limit this. For example, the second preset duration may be 5 milliseconds.

[0170] It can be understood that when the second timer is turned on and the timing duration of the second timer reaches the second preset duration, it can be determined that the device jitter in the electronic device has ended. Therefore, the natural light intensity value obtained when the second preset duration is reached is the natural light intensity value of the actual change in the current environment of the electronic device, and is not the natural light intensity value caused by device jitter. Therefore, the light intensity level is re-determined based on the natural light intensity value obtained when the second preset duration is reached, which is conducive to improving the accuracy of distance sensor detection.

[0171] In the disclosed embodiment, when the light intensity level is greater than a second preset level and the natural light intensity value is detected to be decreasing, a second timer is first started; and when the second timer is started and the second timer duration reaches the second preset duration, the light intensity level is re-determined based on the natural light intensity value obtained when the second preset duration is reached. In this way, by setting the second timer, a delay anti-shake effect can be achieved when the light intensity level changes, effectively avoiding the problem of misjudgment of the distance sensor due to jitter of the components within the electronic device, thereby facilitating improved accuracy in detecting whether the electronic device display screen is blocked.

[0172] Figure 4 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 3 ,like Figure 4 As shown, the detection method mainly includes the following steps:

[0173] In step 401, the natural light intensity value of the environment in which the electronic device is currently located is obtained, and the light intensity level corresponding to the natural light intensity value is determined; wherein the light intensity level is positively correlated with the natural light intensity value;

[0174] In step 402, the natural light intensity value is compared with the preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level;

[0175] In step 403, based on the preset intensity range of the natural light intensity value, the light intensity level corresponding to the natural light intensity value is determined;

[0176] In step 404, when the light intensity level is less than or equal to the first preset level, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the preset intensity threshold to obtain a second comparison result;

[0177] In step 405, based on the second comparison result, it is determined whether the display screen of the electronic device is blocked;

[0178] The preset strength threshold is determined by historical test data.

[0179] It should be noted that when the light intensity level is less than or equal to the first preset level, it can be determined that the natural light intensity value of the environment in which the electronic device is located is small, and the infrared light component in the natural light is small, that is, the intensity value of the reflected light signal received by the distance sensor is not easily affected by the infrared light component in the natural light. Therefore, it is only necessary to set a preset intensity threshold to determine whether the display screen of the electronic device is blocked.

[0180] Here, the preset intensity threshold represents a threshold for judging the distance between the display screen of the electronic device and the target object, and further determining whether the display screen of the electronic device is blocked.

[0181] It can be understood that when the light intensity level is less than or equal to the first preset level, after determining the preset intensity threshold, the intensity value of the reflected light signal received by the distance sensor in the electronic device can be compared with the preset intensity threshold to obtain a second comparison result; then, based on the second comparison result, it is determined whether the display screen of the electronic device is blocked, thereby improving the accuracy of determining whether the display screen of the electronic device is blocked.

[0182] Specifically, when the intensity value of the reflected light signal received by the distance sensor is greater than the preset intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is large, so that it can be determined that the distance between the display screen of the electronic device and the target object is close, and then it can be determined that the display screen of the electronic device is blocked; and when the intensity value of the reflected light signal received by the distance sensor is less than or equal to the preset intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is small, so that it can be determined that the distance between the display screen of the electronic device and the target object is far, and then it can be determined that the display screen of the electronic device is not blocked.

[0183] In some embodiments, to further improve the accuracy of determining that the electronic device's display screen is unobstructed, a preset intensity threshold can be determined based on historical test data. For example, when the electronic device is in the production stage, an obstructing object is placed at a specified distance from the electronic device's display screen. When the distance exceeds the specified distance, the electronic device's display screen is determined to be unobstructed. Then, a distance sensor within the electronic device receives the intensity value of the reflected light signal from the obstructing object, thereby obtaining the preset intensity threshold.

[0184] In the disclosed embodiment, when the light intensity level is less than or equal to a first preset level, the intensity value of the reflected light signal received by the distance sensor in the electronic device can be compared with a preset intensity threshold to obtain a second comparison result; then, based on the second comparison result, a determination is made as to whether the display screen of the electronic device is obscured. Thus, by setting a preset intensity threshold, when the light intensity level is low, a determination as to whether the display screen of the electronic device is obscured can be made based on the second comparison result of the intensity value of the reflected light signal received by the distance sensor and the preset intensity threshold, thereby improving detection accuracy.

[0185] Figure 5 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 4 ,like Figure 5 As shown, the detection method mainly includes the following steps:

[0186] In step 501, in response to a detection event of whether a display screen of an electronic device is blocked, a natural light intensity value of an environment in which the electronic device is currently located is obtained, and a light intensity level corresponding to the natural light intensity value is determined;

[0187] In step 502, when the light intensity level is greater than a first preset level, the target intensity threshold is adjusted based on the natural light intensity value;

[0188] In step 503, the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold to obtain a first comparison result;

[0189] In step 504 , when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0190] It is understandable that in order to reduce the loss of electronic devices, after receiving a detection event from the electronic device controller indicating whether the display screen of the electronic device is blocked, the natural light intensity value of the environment in which the electronic device is located can be obtained and the light intensity level can be judged in response to the detection event.

[0191] In some embodiments, in response to a detection event regarding whether the display screen of an electronic device is blocked, after determining whether the display screen of the electronic device is blocked, a judgment event can be generated, and then the judgment event can be reported to a controller within the electronic device so that the controller can send instructions to the application to adjust the functional parameters of the electronic device, such as automatically adjusting the screen brightness.

[0192] In an embodiment of the present disclosure, in response to a detection event of whether the display screen of an electronic device is blocked, the natural light intensity value of the environment in which the electronic device is located is obtained, which is beneficial to reducing the loss of the electronic device and improving the user experience.

[0193] Figure 6 This is a flow diagram of a detection method according to an exemplary embodiment. Figure 5 ,like Figure 6 As shown, the detection method mainly includes the following steps:

[0194] In step 601, the natural light intensity value of the environment where the electronic device is currently located is obtained.

[0195] In some embodiments, the natural light intensity value of the environment in which the electronic device is currently located may be obtained in real time, or the natural light intensity value of the environment in which the electronic device is currently located may be obtained according to a fixed sampling period.

[0196] In step 602, it is determined whether the natural light intensity value is within a third preset intensity range.

[0197] In some embodiments, after obtaining the natural light intensity value of the current environment of the electronic device, it can be determined whether the natural light intensity value is within a third preset intensity range, thereby determining the light intensity level corresponding to the natural light intensity value.

[0198] Here, the third preset intensity range corresponds to a lower light intensity level, that is, the light intensity level can be less than or equal to the first preset level; after obtaining the natural light intensity value, the natural light intensity value can be compared with the preset light intensity value within the third preset intensity range to determine whether the natural light intensity value is within the third preset intensity range.

[0199] In some embodiments, when the natural light intensity value is within the third preset intensity range, it can be determined that the illumination intensity level corresponding to the natural light intensity value is less than or equal to the first preset level, and then step 608 is executed.

[0200] In other embodiments, when the natural light intensity value is not within the third preset intensity range, it is necessary to re-determine the illumination intensity level corresponding to the natural light intensity value, that is, execute step 603 .

[0201] In step 603, it is determined whether the natural light intensity value is within a second preset intensity range.

[0202] Here, the minimum preset light intensity value in the second preset intensity range is much greater than the maximum preset light intensity value in the third preset intensity range.

[0203] Meanwhile, the second preset intensity range corresponds to a higher light intensity level, i.e., the light intensity level may be greater than the second preset level, wherein the second preset level is higher than the first preset level. After obtaining the natural light intensity value, the natural light intensity value may be compared with the preset light intensity values ​​within the second preset intensity range to determine whether the natural light intensity value is within the second preset intensity range.

[0204] In some embodiments, when the natural light intensity value is within the second preset intensity range, it can be determined that the illumination intensity level corresponding to the natural light intensity value is greater than the second preset level, and step 604 is executed.

[0205] In other embodiments, when the natural light intensity value is not within the second preset intensity range, it can be determined that the illumination intensity level corresponding to the natural light intensity value is greater than the first preset level, and step 607 is executed.

[0206] In step 604, it is determined whether the first timer has expired.

[0207] Here, the timing duration of the first timer may be a first preset duration, for example, may be set to 5 milliseconds.

[0208] In some embodiments, due to some usage scenarios, such as changes in the tilt angle of the electronic device or jitter of the components in the electronic device, the detected natural light intensity value may fluctuate, thereby causing the determined light intensity level to be inaccurate. Therefore, a first timer can be set, and then it is determined whether the natural light intensity value is continuously within the second preset intensity range during the activation process of the first timer, that is, within the first preset time period, and then the light intensity level is further determined, thereby improving the accuracy of the judgment of the light intensity level.

[0209] In some embodiments, if the first timer expires, it can be determined that the natural light intensity value is continuously within the second preset intensity range within the first preset time period, and further determined that the light intensity level is greater than the second preset level, then step 605 is executed.

[0210] In other embodiments, if the first timer has not ended, it can be determined that the natural light intensity value is not continuously within the second preset intensity range within the first preset time period, then it can be determined that the light intensity level may be greater than the first preset level, rather than greater than the second preset level, and step 607 is executed.

[0211] In step 605, it is determined whether the display screen of the electronic device is not blocked.

[0212] Here, it is determined that the target object is far away from the display screen of the electronic device, so it can be determined that the display screen of the electronic device is not blocked.

[0213] In some embodiments, when the light intensity level is greater than a second preset level, it is determined that the display screen of the electronic device is not blocked.

[0214] In step 606 , a detection event is received regarding whether the display screen of the electronic device is blocked.

[0215] In some embodiments, the detection event of whether the display screen of the electronic device is blocked is a cyclic detection event. Therefore, whether the detection event of whether the display screen of the electronic device is blocked is received is set as a cyclic condition to determine whether to end the cyclic detection.

[0216] In some embodiments, when a detection event is received regarding whether the display screen of the electronic device is blocked, the natural light intensity value of the current environment of the electronic device is obtained and detected.

[0217] In other embodiments, if no detection event is received regarding whether the display screen of the electronic device is blocked, the detection is terminated.

[0218] In step 607 , the target intensity threshold is adjusted based on the natural light intensity value.

[0219] In some embodiments, when the natural light intensity value of the environment in which the electronic device is currently located is large, there are too many infrared light components in the natural light, which can easily cause inaccurate detection by the distance sensor. Therefore, it is necessary to adjust the target intensity threshold based on the natural light intensity value to improve the misjudgment of the distance sensor.

[0220] In some embodiments, the preset intensity threshold can be represented by thread0. After determining the natural light intensity value, thread0 can be adjusted by a preset amplitude to obtain the target intensity threshold thread1. For example, the preset amplitude can be 10% of thread, represented by data. Therefore, the calculation formula of the target intensity threshold can be as follows:

[0221] thread1 = thread0 + data (1);

[0222] In formula (1), thread1 is the target intensity threshold, thread0 is the preset intensity threshold, and data is the preset amplitude.

[0223] In step 608 , it is determined whether the intensity value of the reflected light signal received by the distance sensor in the electronic device is greater than a target intensity threshold.

[0224] In some embodiments, when the intensity value of the reflected light signal received by the distance sensor in the electronic device is greater than the target intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is large, thereby determining that the distance between the display screen of the electronic device and the target object is close, that is, executing step 609.

[0225] In other embodiments, when the intensity value of the reflected light signal received by the distance sensor is less than or equal to the target intensity threshold, it can be determined that the intensity value of the reflected light signal of the target object is small, thereby being able to determine that the distance between the electronic device and the target object is far, and further being able to determine that the display screen of the electronic device is not blocked, and then executing step 606.

[0226] In some embodiments, when the natural light intensity value is within a third preset intensity range, it can be determined that the light intensity level corresponding to the natural light intensity value can be less than or equal to the first preset level, then the intensity value of the reflected light signal received by the distance sensor in the electronic device is compared with the target intensity threshold, where the target intensity threshold is the preset intensity threshold thread0.

[0227] In step 609 , it is determined whether the display screen of the electronic device is blocked.

[0228] In the disclosed embodiment, when the light intensity level is greater than a first preset level, the target intensity threshold can be continuously adjusted based on the natural light intensity value so that the target intensity threshold corresponds to the natural light intensity value. When the light intensity level is greater than a second preset level, it can be determined that the display screen of the electronic device is not blocked. This effectively avoids the problem of determining that the display screen of the electronic device is blocked due to the excessive infrared light component in the natural light causing the intensity value of the reflected light signal received by the distance sensor to be large when the natural light intensity value is large, thereby improving the accuracy of determining whether the display screen of the electronic device is blocked.

[0229] Figure 7 is a block diagram of a detection device according to an exemplary embodiment. Figure 7 As shown, the device 700 includes:

[0230] An acquisition module 701 is configured to acquire a natural light intensity value of an environment in which the electronic device is currently located, and determine a light intensity level corresponding to the natural light intensity value;

[0231] An adjustment module 702 is configured to adjust a target intensity threshold based on the natural light intensity value when the light intensity level is greater than a first preset level;

[0232] a first comparison module 703 configured to compare the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result;

[0233] The first judgment module 704 is configured to determine that the display screen of the electronic device is blocked when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold.

[0234] In some embodiments, the apparatus 700 further includes:

[0235] a first determining module configured to compare the natural light intensity value with preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level;

[0236] The second determining module is configured to determine the illumination intensity level corresponding to the natural light intensity value based on the preset intensity range in which the natural light intensity value is located.

[0237] In some embodiments, the apparatus 700 further includes:

[0238] a third determining module, configured to determine that the display screen of the electronic device is not blocked when the light intensity level is greater than a second preset level;

[0239] The second preset level is higher than the first preset level.

[0240] In some embodiments, the second determining module includes:

[0241] a first submodule configured to determine that the illumination intensity level is greater than the first preset level when the natural light intensity value is within a first preset intensity range;

[0242] a second submodule configured to determine that the illumination intensity level is greater than the second preset level when the natural light intensity value is within a second preset intensity range;

[0243] The minimum preset light intensity value in the second preset intensity range is greater than the maximum preset light intensity value in the first preset intensity range.

[0244] In some embodiments, the second submodule is configured as follows:

[0245] If the natural light intensity value is continuously within the second preset intensity range within a first preset time period, it is determined that the illumination intensity level is greater than the second preset level.

[0246] In some embodiments, the apparatus 700 further includes:

[0247] a first activation module configured to activate a first timer when the light intensity level is greater than the first preset level and when it is detected that the natural light intensity value increases;

[0248] a first timer module configured to, when the first timer is turned on, compare the natural light intensity value obtained when the first timer is turned on with a preset light intensity value within the second preset intensity range, and determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range;

[0249] The timing duration of the first timer is the first preset duration.

[0250] In some embodiments, the apparatus 700 further includes:

[0251] a second activation module configured to activate a second timer when the illumination intensity level is greater than the second preset level and when it is detected that the natural light intensity value decreases;

[0252] The second timer module is configured to, when the second timer is started and the timing duration of the second timer reaches a second preset duration, re-determine the light intensity level based on the natural light intensity value obtained when the second preset duration is reached.

[0253] In some embodiments, the apparatus 700 further includes:

[0254] a second comparison module configured to compare the intensity value of the reflected light signal received by the distance sensor in the electronic device with a preset intensity threshold to obtain a second comparison result when the light intensity level is less than or equal to the first preset level;

[0255] a second judgment module configured to determine whether the display screen of the electronic device is blocked based on the second comparison result;

[0256] The preset strength threshold is determined by historical test data.

[0257] In some embodiments, the acquisition module 701 is specifically configured to:

[0258] In response to a detection event of whether the display screen of the electronic device is blocked, a natural light intensity value of an environment in which the electronic device is located is acquired.

[0259] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0260] Figure 8 8 is a block diagram showing a structure of an electronic device 800 according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0261] Reference Figure 8 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0262] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with at least one of display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.

[0263] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include at least one of the following: instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, and videos. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0264] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 800.

[0265] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0266] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0267] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, and buttons. These buttons may include, but are not limited to, a home button, volume buttons, a start button, and a lock button.

[0268] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800. The sensor assembly 814 can also detect changes in the position of the device 800 or a component thereof, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and changes in the temperature of the device 800. The sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 can also include an optical sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 can also include, but is not limited to, at least one of the following: an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, and a temperature sensor.

[0269] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0270] In an exemplary embodiment, the device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0271] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including executable instructions or a computer program. The instructions or computer program can be executed by the processor 820 of the apparatus 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0272] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of a mobile terminal, enables the mobile terminal to perform any of the above-mentioned detection methods of the embodiments of the present disclosure. For example, the method includes:

[0273] Obtaining the natural light intensity value of the environment in which the electronic device is currently located, and determining the light intensity level corresponding to the natural light intensity value;

[0274] When the light intensity level is greater than a first preset level, adjusting the target intensity threshold based on the natural light intensity value;

[0275] Comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result;

[0276] When the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0277] The present disclosure provides a computer program product comprising a computer program or executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or executable instructions from the computer-readable storage medium and executes the computer program or executable instructions, causing the computer device to perform any of the detection methods described above in the present disclosure.

[0278] Figure 9 1 is a block diagram of a device 900 for detecting according to an exemplary embodiment. For example, the device 900 can be provided as a server. Figure 9 The apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions executable by the processing component 922, such as an application. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above-mentioned detection method:

[0279] Obtaining the natural light intensity value of the environment in which the electronic device is currently located, and determining the light intensity level corresponding to the natural light intensity value;

[0280] When the light intensity level is greater than a first preset level, adjusting the target intensity threshold based on the natural light intensity value;

[0281] Comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result;

[0282] When the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

[0283] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0284] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.

[0285] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A detection method, characterized in that: The method comprises: Obtaining a natural light intensity value of an environment in which the electronic device is currently located, and determining a light intensity level corresponding to the natural light intensity value; and adjusting a target intensity threshold based on the natural light intensity value when the light intensity level is greater than a first preset level; Comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result; When the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold, it is determined that the display screen of the electronic device is blocked.

2. The method according to claim 1, characterized in that The method further comprises: Comparing the natural light intensity value with the preset light intensity values ​​within each preset intensity range to determine the preset intensity range in which the natural light intensity value is located; wherein one preset intensity range corresponds to one light intensity level; The illumination intensity level corresponding to the natural light intensity value is determined based on the preset intensity range within which the natural light intensity value falls.

3. The method according to claim 2, characterized in that The method further comprises: When the light intensity level is greater than a second preset level, determining that the display screen of the electronic device is not blocked; The second preset level is higher than the first preset level.

4. The method according to claim 3, characterized in that The determining, based on the preset intensity range of the natural light intensity value, the illumination intensity level corresponding to the natural light intensity value includes: When the natural light intensity value is within a first preset intensity range, determining that the illumination intensity level is greater than the first preset level; When the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level; The minimum preset light intensity value in the second preset intensity range is greater than the maximum preset light intensity value in the first preset intensity range.

5. The method according to claim 4, characterized in that When the natural light intensity value is within a second preset intensity range, determining that the illumination intensity level is greater than the second preset level includes: If the natural light intensity value is continuously within the second preset intensity range within a first preset time period, it is determined that the illumination intensity level is greater than the second preset level.

6. The method according to claim 5, characterized in that The method further comprises: When the light intensity level is greater than the first preset level and it is detected that the natural light intensity value increases, starting a first timer; When the first timer is turned on, comparing the natural light intensity value obtained when the first timer is turned on with the preset light intensity value within the second preset intensity range to determine whether the natural light intensity value obtained when the first timer is turned on is within the second preset intensity range; The timing duration of the first timer is the first preset duration.

7. The method according to claim 3, characterized in that The method further comprises: When the light intensity level is greater than the second preset level and it is detected that the natural light intensity value decreases, starting a second timer; When the second timer is started and the timing duration of the second timer reaches a second preset duration, the light intensity level is re-determined based on the natural light intensity value obtained when the second preset duration is reached.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When the light intensity level is less than or equal to the first preset level, comparing the intensity value of the reflected light signal received by the distance sensor in the electronic device with a preset intensity threshold to obtain a second comparison result; Based on the second comparison result, determining whether the display screen of the electronic device is blocked; The preset strength threshold is determined by historical test data.

9. The method according to any one of claims 1 to 7, characterized in that The obtaining of the natural light intensity value of the current environment of the electronic device includes: In response to a detection event of whether the display screen of the electronic device is blocked, a natural light intensity value of an environment in which the electronic device is located is acquired.

10. A detection device, characterized in that: The device comprises: an acquisition module configured to acquire a natural light intensity value of an environment in which the electronic device is currently located, and determine a light intensity level corresponding to the natural light intensity value; an adjustment module configured to adjust a target intensity threshold based on the natural light intensity value when the light intensity level is greater than a first preset level; a first comparison module configured to compare the intensity value of the reflected light signal received by the distance sensor in the electronic device with the target intensity threshold to obtain a first comparison result; The first judgment module is configured to determine that the display screen of the electronic device is blocked when the first comparison result indicates that the intensity value of the reflected light signal is greater than the target intensity threshold.

11. An electronic device, characterized in that: include: processor; memory for storing computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 10.

12. A non-transitory computer-readable storage medium storing a computer program or instruction, characterized in that: When the computer program or instructions in the storage medium are executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Display screen state control method and apparatus

    CN106850982A

  • Display screen state control method and device

    CN106850989A

  • Display screen status control method and device, storage medium and terminal

    CN107506049A

  • Method and device for controlling state of display screen, storage medium and terminal

    CN107665081A

  • Environment light detection method and device, storage medium and electronic equipment

    CN107966209A