Ambient light intensity detection method, electronic device, storage medium and chip
By setting up an optical channel in an electronic device with an ambient light sensor installed under the screen, and using the parameters of the optical channel and the glass cover to process the ambient light intensity, the problems of screen light interference and light loss are solved, achieving more accurate ambient light intensity detection and a better user experience.
Patent Information
- Application Number
- CN202410533923.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-04-29
AI Technical Summary
Electronic devices that use an under-screen ambient light sensor may experience inaccurate ambient light intensity detection due to interference from screen light and loss of incoming light, thereby reducing user experience.
By setting up an optical channel on the screen and utilizing the relationship between the geometric parameters of the optical channel, the optical parameters of the glass cover, and the screen light intensity of the current screen light, the interference of the screen light is removed and/or the loss of incoming light is compensated to process the ambient light intensity detection value and ensure the accuracy of the detection.
Improves the accuracy of the ambient light sensor in detecting ambient light intensity, enhancing the user experience and ensuring appropriate adjustment of screen brightness and color temperature.
Smart Images

Figure CN119252159B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a method for detecting ambient light intensity, an electronic device, a storage medium, and a chip. Background Art
[0002] In order to make electronic devices have better screen display effects, electronic devices can replace the hole-punch method to install ambient light sensors by using the under-screen method. After installing the sensor under the screen, the screen of the electronic device can display the complete picture, thereby improving the screen display effect.
[0003] However, for electronic devices that use an under-screen ambient light sensor, the ambient light intensity detected by the ambient light sensor is inaccurate due to factors such as interference from screen light and loss of incoming light, thereby reducing the user experience. Summary of the Invention
[0004] The present application provides a method for detecting ambient light intensity, an electronic device, a storage medium, and a chip, which can eliminate interference from screen light and / or compensate for the loss of incoming light, and can make the ambient light intensity detected by the ambient light sensor more accurate, thereby improving the user experience.
[0005] In a first aspect, a method for detecting ambient light intensity is provided, which is applied to an electronic device. The electronic device includes a glass cover plate, a screen, and a front ambient light sensor, which are sequentially arranged along the thickness direction of the electronic device. The screen is provided with an optical channel, and ambient light and screen light refracted by the glass cover plate can be illuminated on the front ambient light sensor through the optical channel. The method includes: in response to a trigger event, detecting a first ambient light intensity by the front ambient light sensor; processing the first ambient light intensity based on a first relationship between geometric parameters of the optical channel, optical parameters of the glass cover plate, and current screen light intensity to obtain a second ambient light intensity;
[0006] Among them, the second ambient light intensity is the ambient light intensity after removing the interference light intensity and / or adding the loss light intensity from the first ambient light intensity, the interference light intensity is the ambient light intensity of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and the loss light intensity is the ambient light intensity lost when the ambient light is refracted through the glass cover plate and passes through the optical channel. The first relationship includes a correspondence between multiple first distances and multiple first screen light intensities, the first distance is the distance between the position where the screen light enters the optical channel through the glass cover plate and the center position of the optical channel, one first distance corresponds to one first screen light intensity, and when the first distance is the radius of the optical channel, the first screen light intensity is the screen light intensity of the current screen light.
[0007] In related solutions, when the front ambient light sensor is installed under the screen, the ambient light is refracted by the glass cover and can illuminate the front ambient light sensor through the optical channel, which will cause the loss of ambient light. Also, the screen light is refracted by the glass cover and can illuminate the front ambient light sensor through the optical channel, which will interfere with the value detected by the front ambient light sensor. Due to the above factors, the ambient light intensity detected by the front ambient light sensor is inaccurate. The embodiment of the present application can process the first ambient light intensity based on the first relationship corresponding to the radius of the optical channel, the refractive index and reflectivity of the glass cover, and the screen light intensity of the current screen light, to obtain a second ambient light intensity after removing the interference light intensity of the screen light refracted by the glass cover and irradiated on the front ambient light sensor through the optical channel, and / or adding the lost light intensity of the ambient light lost when the ambient light is refracted by the glass cover and passes through the optical channel. Compared with related solutions, the interference of the screen light can be removed and / or the loss can be compensated, so that the value detected by the front ambient light sensor can be more accurate, thereby improving the user experience.
[0008] In combination with the first aspect, in certain implementations of the first aspect, the first ambient light intensity is processed based on a first relationship corresponding to the geometric parameters of the light channel, the optical parameters of the glass cover, and the screen light intensity of the current screen light to obtain a second ambient light intensity, including: determining a first light input amount of the front ambient light sensor based on the first ambient light intensity and the geometric parameters of the light channel; and determining the second ambient light intensity based on the first light input amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship.
[0009] In an embodiment of the present application, the electronic device can first determine the first amount of light entering the front ambient light sensor based on the first ambient light intensity and the geometric parameters of the optical channel, and then accurately determine the second ambient light intensity based on the first amount of light entering, the geometric parameters of the optical channel, the optical parameters of the glass cover and the first relationship.
[0010] In conjunction with the first aspect, in certain implementations of the first aspect, the second ambient light intensity is the ambient light intensity obtained by removing the interference light intensity from the first ambient light intensity; and determining the second ambient light intensity based on the first incoming light amount, geometric parameters of the light channel, optical parameters of the glass cover, and the first relationship includes:
[0011] Based on the optical parameters of the glass cover, the geometric parameters of the optical channel and the first relationship, a second amount of light input is determined, where the second amount of light input is the amount of light input when the screen light is refracted through the glass cover and illuminates the front ambient light sensor through the optical channel; the first amount of light input and the second amount of light input are differenced to obtain a third amount of light input; based on the third amount of light input and the geometric parameters of the optical channel, the second ambient light intensity is determined.
[0012] In an embodiment of the present application, the second light input amount determined based on the optical parameters of the glass cover plate, the geometric parameters of the optical channel and the first relationship is the light input amount of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and the first light input amount is the light input amount corresponding to the first ambient light intensity detected by the front ambient light sensor. The electronic device performs difference processing on the first light input amount and the second light input amount to obtain a third light input amount, which is the light input amount after deducting the light input amount of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel from the first light input amount. Therefore, based on the third light input amount and the geometric parameters of the optical channel, the second ambient light intensity determined refers to the ambient light intensity after deducting the interference light intensity from the first ambient light intensity. Since the interference light intensity is removed, the second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme.
[0013] In conjunction with the first aspect, in certain implementations of the first aspect, the second ambient light intensity is the ambient light intensity obtained by adding the loss light intensity to the first ambient light intensity; and determining the second ambient light intensity based on the first incoming light amount, geometric parameters of the light channel, optical parameters of the glass cover, and the first relationship includes:
[0014] Based on the first light input amount, the optical parameters of the glass cover, the geometric parameters of the optical channel and the first relationship, a fourth light input amount is determined, where the fourth light input amount is the amount of light input lost when the ambient light is refracted through the glass cover and passes through the optical channel; the first light input amount and the fourth light input amount are summed to obtain a fifth light input amount; based on the fifth light input amount and the geometric parameters of the optical channel, the second ambient light intensity is determined.
[0015] In an embodiment of the present application, the fourth light input amount determined based on the first light input amount, the optical parameters of the glass cover plate, the geometric parameters of the optical channel and the first relationship is the light input amount lost when the ambient light passes through the optical channel after being refracted by the glass cover plate. The first light input amount is the light input amount corresponding to the first ambient light intensity detected by the front ambient light sensor. The electronic device sums the first light input amount and the fourth light input amount, and the obtained fifth light input amount is the light input amount after compensating for the light input amount lost when the ambient light passes through the optical channel after being refracted by the glass cover plate in the first light input amount. Therefore, based on the fifth light input amount and the geometric parameters of the optical channel, the second ambient light intensity determined refers to the ambient light intensity after the lost light intensity is added to the first ambient light intensity. Due to the addition of the lost light intensity, the second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme.
[0016] In conjunction with the first aspect, in certain implementations of the first aspect, the second ambient light intensity is the ambient light intensity obtained by removing the interference light intensity and adding the loss light intensity from the first ambient light intensity; and determining the second ambient light intensity based on the first incoming light amount, geometric parameters of the light channel, optical parameters of the glass cover, and the first relationship includes:
[0017] Based on the optical parameters of the glass cover plate, the geometric parameters of the optical channel and the first relationship, a second amount of light input is determined, where the second amount of light input is the amount of light input when the screen light is refracted through the glass cover plate and then shines on the front ambient light sensor through the optical channel; based on the first amount of light input, the second amount of light input and the optical parameters of the glass cover plate, a sixth amount of light input is determined, where the sixth amount of light input is the amount of light input obtained by subtracting the amount of light input when the screen light is refracted through the glass cover plate and then shines on the front ambient light sensor through the optical channel, and the amount of light input lost when the ambient light is refracted through the glass cover plate and then shines on the optical channel; based on the sixth amount of light input and the geometric parameters of the optical channel, a second ambient light intensity is determined.
[0018] In an embodiment of the present application, due to the first light input amount, the second light input amount and the optical parameters of the glass cover plate, the determined sixth light input amount is the light input amount obtained by deducting the screen light from the first light input amount and then refracting through the glass cover plate and irradiating the front ambient light sensor through the optical channel, and the light input amount lost when the ambient light is refracted through the glass cover plate and then passes through the optical channel. Therefore, based on the sixth light input amount and the geometric parameters of the optical channel, the determined second ambient light intensity refers to the ambient light intensity after deducting the interference light intensity and adding the lost light intensity from the first ambient light intensity. The second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme because the interference light intensity is removed and the lost light intensity is added.
[0019] In combination with the first aspect, in certain implementations of the first aspect, the geometric parameters of the light channel include the radius of the light channel, and the optical parameters of the glass cover include the refractive index and reflectivity of the glass cover.
[0020] In combination with the first aspect, in certain implementations of the first aspect, the second ambient light intensity is the ambient light intensity obtained by the front ambient light sensor for the i-th time detecting the first ambient light intensity, where i is an integer greater than 1; and the method further includes:
[0021] When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, the temperature or color temperature of the screen is adjusted.
[0022] In conjunction with the first aspect, in certain implementations of the first aspect, the electronic device further includes a first ambient light sensor; and when it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, adjusting the temperature or color temperature of the screen includes:
[0023] When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, the temperature or color temperature of the screen is adjusted.
[0024] In an embodiment of the present application, the electronic device can accurately determine whether the ambient light intensity in the current environment has changed, and accurately determine whether the front ambient light sensor is blocked, based on the values detected by the front ambient light sensor and the first ambient light sensor. When the ambient light intensity in the current environment changes, the brightness or color temperature of the screen is adjusted according to the value detected by the front ambient light sensor, thereby avoiding adjusting the brightness or color temperature of the screen when the front ambient light sensor is blocked but the ambient light intensity in the current environment has not changed, thereby improving the user experience.
[0025] In conjunction with the first aspect, in certain implementations of the first aspect, when it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the (i-1)th time, adjusting the temperature or color temperature of the screen includes:
[0026] When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time and the second ambient light intensity obtained by the front ambient light sensor for the i-th time meet the first condition, the temperature or color temperature of the screen is adjusted, and the first condition is used to indicate that the front ambient light sensor is not blocked.
[0027] In an embodiment of the present application, the electronic device can accurately determine whether the ambient light intensity in the current environment has changed, and accurately determine whether the front ambient light sensor is blocked based on the values detected by the front ambient light sensor, the first ambient light sensor and the first condition.
[0028] In combination with the first aspect, in some implementations of the first aspect, the first condition is that the third ambient light intensity obtained by the first ambient light sensor for the i-th time has a linear relationship with the second ambient light intensity obtained by the front ambient light sensor for the i-th time.
[0029] In combination with the first aspect, in some implementations of the first aspect, the first ambient light sensor is a rear ambient light sensor.
[0030] In a second aspect, an electronic device is provided, wherein the electronic device is configured to execute the method provided in the first aspect. Specifically, the electronic device may include a processing unit configured to execute any possible implementation of the first aspect.
[0031] In a third aspect, an electronic device is provided, comprising: one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs comprising instructions, which, when executed by the one or more processors, enable the electronic device to execute a method in any possible implementation of the first aspect.
[0032] In a fourth aspect, a computer-readable storage medium is provided, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect.
[0033] In a fifth aspect, a chip is provided, comprising a memory for storing instructions; and a processor for calling and executing instructions from the memory, so that an electronic device equipped with the chip executes the method described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 An example diagram of an electronic device detecting ambient light intensity is provided.
[0035] Figure 2 1 is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application.
[0036] Figure 3 Schematic diagram of the software structure of the electronic device 100 according to an embodiment of the present application.
[0037] Figure 4 This is a schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0038] Figure 5 This is another schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0039] Figure 6 This is another schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0040] Figure 7 This is a timing diagram of a method 200 for detecting ambient light intensity provided in an embodiment of the present application.
[0041] Figure 8 This is an example diagram of the relationship between screen light intensity and position provided in an embodiment of the present application.
[0042] Figure 9 This is an example diagram of the amount of light entering from a screen light provided in an embodiment of the present application.
[0043] Figure 10 This is an example diagram of light input loss provided in an embodiment of the present application.
[0044] Figure 11 This is an example diagram of a front ambient light sensor and a rear ambient light sensor provided in an embodiment of the present application.
[0045] Figure 12 This is a schematic diagram provided by an embodiment of the present application for determining whether the ambient light intensity of the current environment has changed. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0047] In order to make electronic devices have better screen display effects, electronic devices can replace the hole-punch method to install ambient light sensors by using the under-screen method. After installing the sensor under the screen, the screen of the electronic device can display the complete picture, thereby improving the screen display effect.
[0048] However, electronic devices that use an under-screen ambient light sensor may experience inaccurate detection of ambient light intensity due to factors such as interference from screen light and loss of incoming light, thereby reducing the user experience. For example, due to inaccurate detection of ambient light intensity by the ambient light sensor, the electronic device may be unable to adjust the screen to an appropriate brightness or color temperature, affecting the user experience.
[0049] For example, please refer to Figure 1 , Figure 1 An example diagram of an electronic device detecting ambient light intensity is provided. Figure 1 (a) in FIG. 1 shows an example of an electronic device detecting ambient light intensity by installing an ambient light sensor in a hole-punch manner. Figure 1As shown in (a), when an electronic device uses a hole-digging method to install an ambient light sensor, holes can be drilled in both the glass cover and the screen. The ambient light sensor is installed directly below the hole. Ambient light can directly illuminate the ambient light sensor through the hole (the hole can be called an optical channel for light to pass through the glass cover and the screen). The value detected by the ambient light sensor is close to the ambient light intensity of the surrounding environment.
[0050] Figure 1 (b) in FIG. 1 shows an example of an electronic device detecting ambient light intensity using an ambient light sensor installed under the screen. Figure 1 As shown in (b), when an electronic device uses an under-screen installation of an ambient light sensor, only a hole is made in the screen, not in the glass cover. The ambient light sensor is installed directly below the hole in the screen. Therefore, ambient light first strikes the glass cover, which refracts and reflects it. After this refracted and reflected light, it passes through the hole in the screen (which can be called the light channel through the screen) and strikes the ambient light sensor. This refracting and reflecting light from the glass cover results in a loss of light that ultimately reaches the ambient light sensor. Furthermore, the screen also generates screen light, which first strikes the glass cover and then, through reflection and refraction from the glass cover, strikes the ambient light sensor. This interferes with the values detected by the ambient light sensor.
[0051] From the above Figure 1 As shown in (b), the value detected by the ambient light sensor deviates too much from the ambient light intensity of the surrounding environment due to factors such as interference from screen light and loss of incoming light, and the ambient light intensity detected by the ambient light sensor is inaccurate.
[0052] An embodiment of the present application provides a method for detecting ambient light intensity, which can remove interference from screen light and / or compensate for the loss of incoming light after the ambient light sensor detects the ambient light intensity, thereby making the ambient light intensity detected by the ambient light sensor more accurate and improving the user experience.
[0053] The method for detecting ambient light intensity provided in the embodiments of the present application is applied to electronic devices. The electronic device may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The electronic device may be a mobile phone, a smart TV, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) electronic device, an augmented reality (AR) electronic device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a wearable device, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the electronic device.
[0054] In order to better understand the embodiments of the present application, the structure of the electronic device according to the embodiments of the present application is introduced below.
[0055] Figure 2 1 is a schematic diagram of the structure of an electronic device 100 (taking a mobile phone as an example) provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, an antenna 1, an antenna 2, a mobile communication module 140, a wireless communication module 150, a sensor module 160, an ambient light sensor 160A, a touch sensor 160B, a display 170, a camera 180, and the like.
[0056] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0057] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (App), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0058] In an embodiment of the present application, the processor 110 can remove interference from screen light in the ambient light intensity detected by the front ambient light sensor and / or compensate for the loss of incoming light. The processor 110 can also determine whether the ambient light intensity in the current environment has changed based on the values detected by the front ambient light sensor and the rear ambient light sensor, and whether the front ambient light sensor is blocked.
[0059] The processor 110 may also include a memory for storing instructions and data.
[0060] The wireless communication module 150 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 140, wireless communication module 150, modem processor and baseband processor.
[0061] The display screen 170 is used to display images, videos, etc.
[0062] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
[0063] The internal memory 121 may be used to store computer executable program codes, where the executable program codes include instructions.
[0064] Ambient light sensor 160A is used to sense ambient light brightness. In some embodiments, the ambient light sensor may also be referred to as a photosensor, a light sensor, a brightness sensor, etc., which is not limited in this embodiment of the present application. Electronic device 100 can adaptively adjust the brightness of display screen 170 based on the perceived ambient light brightness. Ambient light sensor 160A can also be used to automatically adjust white balance when taking photos. Ambient light sensor 160A can also detect whether electronic device 100 is in a pocket to prevent accidental touches.
[0065] The touch sensor 160B, also known as a "touch panel," can be disposed on the display screen 170. The touch sensor 160B and the display screen 170 form a touch screen, also known as a "touch screen." The touch sensor 160B is used to detect touch operations applied to or near the touch sensor 160B.
[0066] This concludes the introduction to the hardware structure of the electronic device 100. It is understood that Figure 2 The components included in the illustrated hardware structure do not constitute a specific limitation on the electronic device 100. The electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have a different component configuration.
[0067] Furthermore, operating systems run on the above components, such as the iOS operating system developed by Apple, the Android open-source operating system developed by Google, and the Windows operating system developed by Microsoft. Application programs can be installed and run on these operating systems.
[0068] The operating system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present application, the Android system with a layered architecture is used as an example to illustrate the operating system of the electronic device 100.
[0069] Figure 3 Figure 1 is a schematic diagram of the software architecture of electronic device 100 according to an embodiment of the present application. The software architecture comprises several layers, each with distinct roles and responsibilities, and communication between layers via software interfaces. The software architecture may include an application layer, an application framework layer, a hardware abstraction layer, a kernel layer, and a hardware layer.
[0070] The application layer, referred to as the application layer, can include a series of application packages. Figure 3As shown, the application package may include an application for detecting the intensity of ambient light. Of course, in other embodiments, it may also include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
[0071] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0072] like Figure 3 As shown, the application framework layer may include sensor services, a window manager, etc. In other embodiments, the application framework layer may also include a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
[0073] The sensor service receives detection requests from the application layer and sends detection notifications to lower layers. For example, the sensor service receives a detection request from an application in the application layer to detect ambient light intensity, and then sends a detection notification to the hardware abstraction layer.
[0074] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0075] The Hardware Abstraction Layer (HAL) encapsulates Linux kernel drivers and provides an interface to the kernel. It hides the platform-specific hardware interface details and provides a virtual hardware platform for the operating system, making it hardware-independent and portable across multiple platforms. The kernel uses file descriptors to access files. File descriptors are non-negative integers. When opening an existing file or creating a new file, the kernel returns a file descriptor. File descriptors are also used to specify the file to be read or written.
[0076] The Hardware Abstraction Layer (HAL) includes an ambient light intensity detection module and an ambient light intensity algorithm module.
[0077] The ambient light intensity detection module is used to send an instruction to detect the ambient light intensity to the kernel layer after receiving the notification of detecting the ambient light intensity from the sensor service. The ambient light intensity algorithm module is used to process the ambient light intensity reported by the kernel layer. The ambient light intensity after processing is as follows: Figure 3 The ambient light intensity 2 is shown, and then the ambient light intensity 2 is reported to the application layer through the framework layer.
[0078] The kernel layer is the layer between hardware and software. The kernel layer contains at least camera driver and sensor driver. The sensor driver is used to send detection instructions to the ambient light sensor in the hardware layer, so that the ambient light sensor detects the ambient light intensity. For example, the ambient light intensity detected by the ambient light sensor is Figure 3 The ambient light intensity is shown as 1.
[0079] The hardware layer includes ambient light sensors, cameras, etc.
[0080] It should be understood that the technical solutions in the embodiments of the present application can be used in Android, IOS, Hongmeng and other systems.
[0081] The above embodiments introduce the hardware structure and software architecture of the electronic device in conjunction with the accompanying drawings. The following embodiments introduce the application scenarios of the method for detecting ambient light intensity provided in the embodiments of the present application in conjunction with the accompanying drawings.
[0082] For example, please refer to Figure 4 , Figure 4 This is a schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0083] Please refer to Figure 4 , the electronic device includes a power button 4011, Figure 4 The user interface shown in (a) is an interface 401 displayed when the electronic device is powered on. When the electronic device is powered on, the user presses the power button for a preset time, for example, 3 seconds. In response to the user's operation, the electronic device displays the following information: Figure 4 The user interface 402 shown in (b) is as follows: Figure 4 As shown in (b), the interface includes a "restart" control 4021 and a "shutdown" control 4022. When the user clicks the "restart" control 4021, the electronic device responds to the user's operation of clicking the control 4021 by detecting the ambient light intensity through the ambient light sensor, and then adaptively adjusts the brightness or color temperature of the display screen in the electronic device according to the detected ambient light intensity.
[0084] Please refer to Figure 5 , Figure 5 This is another schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0085] Please refer to Figure 5 , Figure 5 The user interface 501 shown in (a) includes a series of application icons, including "Camera", "Gallery", "Settings", etc. The user clicks the "Settings" icon 5011. In response to the user clicking the icon 5011, the electronic device displays the following Figure 5The user interface 502 shown in (b) includes controls such as "flight mode", "wireless LAN", "cellular network", and "display and brightness". The user clicks the "display and brightness" control 5021. In response to the user's operation, the electronic device displays the following Figure 5 The user interface 503 shown in (c) includes an "automatic adjustment" control 5031. When a user clicks the "automatic adjustment" control 5031, the electronic device detects the ambient light intensity through the ambient light sensor in response to the user's operation of clicking the control 5031, and then adaptively adjusts the brightness of the display screen in the electronic device according to the detected ambient light intensity.
[0086] Please refer to Figure 6 , Figure 6 This is another schematic diagram of detecting ambient light intensity provided in an embodiment of the present application.
[0087] Please refer to Figure 6 , Figure 6 The user interface 601 shown in (a) includes a series of application icons, including "camera", "gallery", "game", etc. The user clicks the "game" icon 6011. In response to the user clicking the icon 6011, the electronic device displays the following Figure 6 The user interface 602 shown in (b) of FIG. Figure 6 The electronic device shown in (b) is in landscape mode. The user can perform game operations through user interface 602, such as moving the "game character" in user interface 602 forward or backward. While the user is performing game operations through user interface 602, the ambient light sensor in the electronic device can detect the ambient light intensity in real time. When a change in ambient light intensity is detected, the screen color temperature or brightness can be adjusted in real time.
[0088] The above embodiments are combined with the accompanying drawings to introduce the application scenarios of detecting ambient light intensity provided by the present application. Figure 3 The software architecture in the embodiment of the present application introduces the implementation process of detecting the ambient light intensity.
[0089] Please refer to Figure 7 , Figure 7 8 is a timing diagram of a method 200 for detecting ambient light intensity provided by an embodiment of the present application. The method 200 includes steps 810 to 890.
[0090] Step 810: The application layer generates a request 1 for detecting the ambient light intensity in response to a user operation.
[0091] It should be understood that user operations can be Figure 4 The operation of the user clicking the control 4021 shown in (b) can also be Figure 5(c) shows the operation of the user clicking the control 5031. Of course, the user operation can also be other operations that can trigger the ambient light sensor to detect the ambient light intensity, and the embodiment of the present application is not limited to this.
[0092] It should also be understood that user operations may also be touch, slide, voice commands and other operations, which are not limited in the embodiments of the present application.
[0093] Step 820: The application layer sends a request 1 to the sensor service in the framework layer.
[0094] Step 830: After receiving the request 1, the sensor service sends a notification 1 of detecting the ambient light intensity to the ambient light intensity detection module in the HAL layer.
[0095] In step 840 , after receiving the notification 1 , the ambient light intensity detection module sends an instruction 1 for detecting the ambient light intensity to the ambient light sensor driver in the kernel layer, and then the ambient light sensor driver sends the instruction 1 to the ambient light sensor.
[0096] In step 850 , the ambient light sensor in the hardware layer detects the ambient light intensity.
[0097] In step 860 , the ambient light sensor reports the detected ambient light intensity 1 to the ambient light intensity algorithm module in the HAL layer through the ambient light sensor driver.
[0098] It should be understood that the ambient light sensor in the embodiment of the present application is installed in the electronic device via an under-screen method. For an explanation of the under-screen method, please refer to the above embodiment and will not be repeated here. Therefore, the ambient light intensity 1 detected by the ambient light sensor may be inaccurate due to factors such as interference from screen light and loss of incoming light.
[0099] Step 870 : The ambient light intensity algorithm module processes the ambient light intensity 1 to obtain the ambient light intensity 2 .
[0100] It should be understood that the role of the ambient light intensity algorithm module is to remove the interference of screen light in the ambient light intensity 1 and / or compensate for the loss of incoming light, so as to make the ambient light intensity detected by the ambient light sensor more accurate.
[0101] The specific implementation process of step 870 can be referred to the following embodiment and will not be described here in detail.
[0102] In step 880 , the ambient light intensity algorithm module reports the ambient light intensity 2 to the application layer through the sensor service in the framework layer.
[0103] In step 890 , the application layer adjusts the brightness or color temperature of the screen according to the ambient light intensity 2 .
[0104] During implementation, the application layer can send a request to adjust the brightness or color temperature of the screen to the lower layer (such as the framework layer, HAL, etc.), and the lower layer (such as the display driver in the kernel layer) can send an instruction to adjust the screen to the display in the hardware layer, thereby realizing functions such as adjusting the brightness or color temperature of the screen. The embodiment of the present application does not limit the implementation process of the application layer adjusting the brightness or color temperature of the screen according to the ambient light intensity 2.
[0105] It should be understood that because the ambient light sensor is installed in an electronic device through an under-screen method, the ambient light intensity 1 detected by the ambient light sensor may be inaccurate due to factors such as interference from screen light and loss of incoming light. In the embodiments of the present application, the ambient light intensity algorithm module can remove the interference of screen light in the ambient light intensity 1 and / or compensate for the loss of incoming light, thereby making the ambient light intensity detected by the ambient light sensor more accurate.
[0106] The above embodiments are combined with the attached Figure 7 The implementation process of the method 200 for detecting ambient light intensity provided in an embodiment of the present application is introduced. The following embodiment introduces the implementation process of step 870 in the method 200 with reference to the accompanying drawings.
[0107] Before specifically introducing the implementation process of step 870, the principle by which the ambient light intensity algorithm module can remove the interference of screen light in the ambient light intensity 1 and / or compensate for the loss of incoming light is introduced.
[0108] It should be understood that the ambient light intensity detected by the ambient light sensor is related to the amount of incoming light. The relationship between the two can be referred to the following formula 1:
[0109]
[0110] Among them, I represents the amount of light entering, which refers to the amount of light passing through the glass cover (such as Figure 1 The amount of light emitted by the glass cover shown in (b) onto the ambient light sensor, πd 2 Refers to the area of the light channel (for example Figure 1 (b) shows the cross-sectional area of the light channel formed by the opening process in the screen), d refers to the diameter of the light channel, L refers to the ambient light intensity, Refers to the conversion coefficient between ambient light intensity and incoming light amount.
[0111] The following sections detail the principles of the ambient light intensity algorithm module in three ways.
[0112] Method 1: The ambient light intensity algorithm module can remove the interference of screen light in ambient light intensity 1 and compensate for the loss of incoming light.
[0113] It should be understood that the ambient light sensor is installed in the electronic device in an under-screen manner, which may cause the ambient light intensity 1 detected by the ambient light sensor to be inaccurate due to factors such as interference from the screen light and loss of incoming light. Therefore, the ambient light intensity algorithm module can remove the interference of the screen light from the incoming light detected by the ambient light sensor, and compensate for the loss of the incoming light, and obtain the incoming light amount A1, which is less interfered by the screen light and has less loss after reflection and refraction through the glass cover. Afterwards, the ambient light intensity algorithm module can substitute the incoming light amount A1 into the above formula 1 for calculation, and obtain ambient light intensity 2, which is closer to the ambient light intensity of the surrounding environment than the ambient light intensity 1. The ambient light intensity algorithm module can calculate the incoming light amount A1 through the following formula 2.1.
[0114] I A1 =I B -I C +I D .
[0115] Among them, I A1 Refers to the amount of light entering A1, I B It refers to the amount of light entering the room according to the ambient light intensity detected by the ambient light sensor. C Refers to the amount of light entering due to the interference of screen light, I D Refers to the amount of light lost.
[0116] It should also be understood that in the above formula 2.1, I B It can be obtained by the above formula 1, for example:
[0117]
[0118] Here, L1 refers to the ambient light intensity 1 detected by the ambient light sensor.
[0119] I in Formula 2.1 C It can be obtained by the following formula 3, for example:
[0120]
[0121] in, Refers to the conversion coefficient between ambient light intensity and incoming light amount. Refers to the reflectivity of the glass cover (such as Figure 1 (b) shows the reflectivity of the glass cover), Refers to the refractive index of the glass cover (e.g. Figure 1 (b) shows the refractive index of the glass cover), r i Refers to the position where the screen light shines on the light channel, L(r i) refers to the screen light intensity at different positions of the light channel when the screen light is irradiated. The screen light intensity refers to the intensity of the light emitted by the light source in the screen, which can also be called screen brightness. It should be understood that the position where the screen light is irradiated on the light channel can be characterized by the distance from the center position of the light channel. For example, the position where the screen light is irradiated on the light channel is the radius r of the light channel, and the distance from the center position of the light channel to the radius r is the radius r. For example, L(r i ) and the position of the screen light in the light channel can be referred to Figure 8 , Figure 8 This is an example diagram of the relationship between screen light intensity and position provided by an embodiment of the present application. Figure 8 It can be seen that: the greater the value of the position where the screen light shines on the light channel, the greater the screen light intensity, and the smaller the value of the position where the screen light shines on the light channel, the smaller the screen light intensity. When the position where the screen light shines on the light channel is the radius r of the light channel, the screen light intensity is the screen light intensity of the current screen. It should also be understood that when the screen light intensity of the current screen changes, for example, Figure 8 The screen light intensity L corresponding to the position where the screen light is irradiated on the light channel is the radius r of the light channel. A The value of changes, then the screen light shines on other positions on the light channel (such as Figure 8 The values of r1 and r2 shown) corresponding to the screen light intensity (such as Figure 8 L shown B and L C ) will also change.
[0122] For example, the above formula 3 can be obtained by the following method, please refer to Figure 9 , Figure 9 This is an example diagram of the amount of light entering a screen provided by an embodiment of the present application. Figure 9 As shown, assuming that the screen light generated by the screen has two beams that interfere with the amount of ambient light entering, including the first beam of screen light and the second beam of screen light, the first beam of screen light enters the light channel from position O1 on the glass cover after reflection and refraction. The distance between position O1 and the center position O3 of the light channel is the radius r of the light channel. Then the amount of light entering the first beam of screen light can be calculated by the following formula 3.1:
[0123]
[0124] Among them, I C1 Refers to the amount of light entering the first beam of screen light. L A It refers to the screen light intensity corresponding to the distance between the position where the first beam of screen light enters the light channel and the center position of the light channel is the radius r of the light channel. A The size can be referenced Figure 8 .
[0125] The second beam of screen light is reflected and refracted by the glass cover and enters the light channel from position O2 on the glass cover. The distance between position O2 and the center position O3 of the light channel is the radius r1 of the light channel. The amount of light entering the second beam of screen light can be calculated by the following formula 3.2:
[0126]
[0127] Among them, I C2 Refers to the amount of light entering the second beam of screen light. L B It refers to the screen light intensity when the distance between the position where the second beam of screen light enters the light channel and the center position of the light channel is r1. B The size can be referenced Figure 8 .
[0128] It should be understood that the calculation method of the amount of light entering other beams of screen light can refer to the calculation method of the amount of light entering the first beam of screen light and the second beam of screen light mentioned above, which will not be repeated here. For example, the third beam of screen light can be calculated by the following formula 3.3:
[0129]
[0130] Among them, I C3 Refers to the amount of light entering the third beam of screen light. r2 refers to the distance between the position where the third beam of screen light enters the light channel and the center position of the light channel. L C It refers to the screen light intensity when the distance between the position where the screen light enters the light channel and the center position of the light channel is r2. c The size can be referenced Figure 8 .
[0131] From the above Figure 9 It can be seen that the amount of light entering the light channel from multiple screen lights is I C It can be obtained by the following formula:
[0132]
[0133] Here, i is an integer greater than 1.
[0134] The following section describes the amount of ambient light remaining after the amount of light entering is lost due to refraction and reflection from the glass cover.
[0135] For example, please refer to Figure 10 , Figure 10 This is an example diagram of light loss provided by an embodiment of the present application. Figure 10As shown in (a) in the figure, when the ambient light first hits the upper surface of the glass cover, it is reflected and refracted for the first time. The refracted ambient light passes through the upper surface of the glass cover and hits the lower surface of the glass cover. Therefore, the amount of ambient light entering after the first refraction can be calculated using the following formula 4.1:
[0136]
[0137] Among them, I D1 Represents the amount of ambient light entering after the first refraction.
[0138] like Figure 10 As shown in (b), the ambient light refracted for the first time hits the lower surface of the glass cover and is reflected for the second time. The ambient light reflected for the second time hits the upper surface of the glass cover. The amount of ambient light after the second reflection can be calculated using the following formula 4.2:
[0139]
[0140] Among them, I D2 Represents the amount of ambient light entering after being reflected for the second time.
[0141] The ambient light refracted for the first time hits the lower surface of the glass cover and is refracted a second time. The ambient light refracted for the second time passes through the optical channel and hits the ambient light sensor. The amount of ambient light refracted for the second time can be calculated using the following formula 4.3:
[0142]
[0143] Among them, I D3 Represents the amount of ambient light entering after the second refraction.
[0144] like Figure 10 As shown in (c), the ambient light reflected for the second time hits the upper surface of the glass cover and is reflected for the third time. The ambient light reflected for the third time hits the lower surface of the glass cover. The amount of ambient light reflected for the third time can be calculated using the following formula 4.4:
[0145]
[0146] Among them, I D4 Represents the amount of ambient light entering after being reflected for the second time.
[0147] like Figure 10As shown in (d) in the figure, the third reflected ambient light hits the lower surface of the glass cover and is refracted for the third time. The third refracted ambient light passes through the optical channel and hits the ambient light sensor. The amount of the third refracted ambient light can be calculated using the following formula 4.5:
[0148]
[0149] Among them, I D5 Represents the amount of ambient light entering after the third refraction.
[0150] above Figure 10 The calculation method for the amount of ambient light entering the ambient light sensor through the optical channel after the first to third refractions is shown in the figure. The calculation method for the amount of light entering after other refractions can refer to the above method. For example, the amount of ambient light entering after the fourth refraction can be calculated using the following formula 4.6:
[0151]
[0152] Among them, I D6 Represents the amount of ambient light entering after the fourth refraction.
[0153] Depend on Figure 10 From (d) in the figure, we can see that the ambient light refracted for the first time will not pass through the optical channel to illuminate the ambient light sensor. However, each subsequent refracted ambient light will pass through the optical channel to illuminate the ambient light sensor. Therefore, the amount of ambient light entering after multiple refractions can be calculated using the following formula 4.7:
[0154]
[0155] Wherein, n and k are integers greater than 0.
[0156] It can be understood that the amount of light entering in the above formula 4.7 represents the amount of light entering after the amount of ambient light entering is lost due to refraction and reflection of the glass cover, and does not include the amount of light entering from the screen. That is, the amount of light entering in formula 4.7 can represent the I in formula 2.1. A1 -I D Combining the above formula 2.1 and formula 4.7, we can get the following formula 5:
[0157]
[0158] Processing formula 5 can get formula 6:
[0159]
[0160] Among them, I B It can be obtained from the above formula 1, IC It can be obtained from the above formula 3, and is a constant, from which we can obtain I A1 . After getting I A1 Afterwards, I A1 Substituting into formula 1, we can get the ambient light intensity 2.
[0161] Therefore, the implementation process of step 870 in the embodiment of the present application can be: exemplarily, after the ambient light intensity algorithm module receives the ambient light intensity 1, it can process the ambient light intensity 1 based on the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the screen light channel to obtain ambient light intensity 2.
[0162] Specifically, after the ambient light intensity algorithm module receives the ambient light intensity 1, the ambient light intensity 1, the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the light channel when the screen light is irradiated are substituted into the above formula 6. The formula 6 can be used to obtain I A1 , will I A1 Substituting this into Formula 1 yields the ambient light intensity 2. This ambient light intensity 2 compensates for the loss of incoming light due to reflection and refraction from the glass cover, and eliminates interference from screen light. This ambient light intensity 2 is closer to the ambient light intensity in the surrounding environment than the ambient light intensity 1.
[0163] Method 2: The ambient light intensity algorithm module can remove the interference of screen light in ambient light intensity 1.
[0164] In some embodiments, the ambient light intensity algorithm module can remove the interference of screen light from the amount of incoming light detected by the ambient light sensor to obtain the amount of incoming light A2, which is less affected by the screen light. The ambient light intensity algorithm module can then substitute the amount of incoming light A2 into the above formula 1 to calculate the ambient light intensity 2, which is closer to the ambient light intensity of the surrounding environment than the ambient light intensity 1. The ambient light intensity algorithm module can calculate the amount of incoming light A2 using the following formula 2.2.
[0165] I A2 =I B -I C .
[0166] Among them, I A2 Refers to the amount of light entering A2. B and I C The definition of can refer to the above embodiment and will not be repeated here.
[0167] Combining the above formulas 1 and 3, we can know that the amount of light entering A2 can also be obtained by the following formula 7:
[0168]
[0169] The meaning of each parameter in Formula 7 can be referred to the above embodiment and will not be repeated here.
[0170] Therefore, in some embodiments, the implementation process of step 870 can be: For example, after the ambient light intensity algorithm module receives the ambient light intensity 1, it can process the ambient light intensity 1 based on the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the screen light in the light channel to obtain ambient light intensity 2.
[0171] Specifically, after the ambient light intensity algorithm module receives the ambient light intensity 1, the ambient light intensity 1, the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the light channel when the screen light is irradiated are substituted into the above formula 7 to obtain I A2 , will I A2 Substituting into formula 1, we can get ambient light intensity 2. The ambient light intensity 2 removes the interference of screen light and is closer to the ambient light intensity in the surrounding environment than the ambient light intensity 1.
[0172] Method 3: The ambient light intensity algorithm module can remove and compensate for the loss of incoming light.
[0173] In some embodiments, the ambient light intensity algorithm module can compensate for the loss of incoming light detected by the ambient light sensor to obtain an amount of incoming light A3, which has less loss after reflection and refraction from the glass cover. The ambient light intensity algorithm module can then substitute the incoming light A3 into the above formula 1 to calculate ambient light intensity 2, which is closer to the ambient light intensity of the surrounding environment than ambient light intensity 1. The ambient light intensity algorithm module can calculate the incoming light amount A3 using the following formula 2.3.
[0174] I A3 =I B +I D .
[0175] Among them, I B It can be calculated by the above formula 1, namely:
[0176]
[0177] Among them, I D It can be obtained from the above formula 5 and formula 6:
[0178] From formula 5, we can see that:
[0179]
[0180] Then based on the above formula 5, I D It can be obtained by the following formula 8:
[0181]
[0182] And because I A1 It can be obtained by the above formula 6, that is:
[0183]
[0184] Then, the above formula 8 can also be:
[0185]
[0186] Finally, combining the above formula 1, formula 8 and formula 2.3, we can get formula 9:
[0187]
[0188] The meaning of each parameter in Formula 9 can be referred to the above embodiment and will not be repeated here.
[0189] Therefore, in some embodiments, the implementation process of step 870 can be: For example, after the ambient light intensity algorithm module receives the ambient light intensity 1, it can process the ambient light intensity 1 based on the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the screen light in the light channel to obtain ambient light intensity 2.
[0190] Specifically, after the ambient light intensity algorithm module receives the ambient light intensity 1, the ambient light intensity 1, the diameter of the light channel in the screen, the reflectivity and refractive index of the glass cover, and the screen light intensity at different positions of the light channel when the screen light is irradiated are substituted into the above formula 9 to obtain I A3 , will I A3 Substituting into formula 1, we can obtain ambient light intensity 2, which compensates for the loss of incoming light due to reflection and refraction of the glass cover. Compared with ambient light intensity 1, ambient light intensity 2 is closer to the ambient light intensity in the surrounding environment.
[0191] The above embodiments are combined Figures 7 to 10 This paper introduces the implementation process of detecting the ambient light intensity provided by the embodiment of the present application, which can be applied to Figures 4 to 6 In the application scenario shown above, Figures 4 to 6In the scenarios shown, electronic devices all detect the ambient light intensity through the front ambient light sensor, and then adaptively adjust the color temperature or brightness of the screen based on the detected ambient light intensity. The installation location of the front ambient light sensor can be referred to Figure 11 , Figure 11 This is an example diagram of a front ambient light sensor and a rear ambient light sensor provided in an embodiment of the present application.
[0192] However, in other scenarios, when the front ambient light sensor, such as Figure 11 The front ambient light sensor 701 is shown to be temporarily blocked by an obstruction (e.g., Figure 11 701 is blocked by the user's finger. Figure 6 When the user's finger blocks the front ambient light sensor when the electronic device in landscape mode is in operation (as shown in (b) in the figure), the front ambient light sensor will think that the ambient light intensity has changed, but the ambient light intensity in the current environment has not changed. In this case, the electronic device will adjust the color temperature or brightness of the screen to a color temperature or brightness that does not match the ambient light intensity in the surrounding environment. In order to avoid the above situation, the electronic device can combine Figure 11 (a) shows the ambient light intensity detected by the front ambient light sensor 701, and Figure 11 The ambient light intensity detected by the rear ambient light sensor 702 shown in (b) determines whether the ambient light intensity of the current environment has changed, and then the electronic device decides whether to adjust the color temperature or brightness of the screen based on the result of determining whether the ambient light intensity of the current environment has changed.
[0193] The following embodiments introduce an implementation process of an electronic device determining whether the ambient light intensity of a current environment has changed.
[0194] For example, please refer to Figure 12 , Figure 12 This is a schematic diagram of determining whether the ambient light intensity of the current environment has changed, provided by an embodiment of the present application. The schematic diagram includes steps 120 to 127.
[0195] In step 120 , the electronic device detects ambient light intensity 2 through the front ambient light sensor and detects ambient light intensity 3 through the rear ambient light sensor. The front ambient light sensor and the rear ambient light sensor report the detected ambient light intensities to the electronic device processor for processing.
[0196] It should be understood that the front ambient light sensor can refer to Figure 11 701 shown in (a) of FIG. When the electronic device adopts the under-screen installation of the ambient light sensor, the ambient light intensity 2 can be the above Figure 11In the embodiment shown in (a), the ambient light intensity 2 is of course also the ambient light intensity detected by an electronic device that uses a hole-punch method to install an ambient light sensor, which is not limited in this embodiment of the present application.
[0197] The rear ambient light sensor can refer to Figure 11 (b) in FIG. 702 shows a rear-mounted ambient light sensor. Typically, an electronic device may be equipped with a rear-mounted ambient light sensor when a rear-mounted camera is installed. The rear-mounted ambient light sensor is mounted on the back of the electronic device. For ease of description, this embodiment of the application refers to the value detected by the rear-mounted ambient light sensor as ambient light intensity 3.
[0198] It should also be understood that the front ambient light sensor and the rear ambient light sensor can detect the ambient light intensity once every time duration 1, and report the detected ambient light intensity to the processor each time. The embodiment of the present application does not limit the time duration 1.
[0199] In step 121 , the processor in the electronic device determines whether the ambient light intensity 2 at the i-th time is the same as the ambient light intensity 2 at the (i-1)th time.
[0200] It should be understood that the i-th ambient light intensity 2 can be understood as the ambient light intensity 2 obtained by the ambient light intensity 1 detected by the front ambient light sensor at the current moment, and the i-1-th ambient light intensity 2 can be understood as the ambient light intensity 2 obtained by the ambient light intensity 1 detected by the front ambient light sensor at the previous moment before the current moment. The time interval between the i-1-th and the i-th times can be a duration of 1, where i is an integer greater than 1.
[0201] It is also understandable that the processor can adjust the color temperature or brightness of the screen based on the i-th ambient light intensity 2. In implementation, the processor can adjust the color temperature or brightness of the screen according to the corresponding relationship 1 and the ambient light intensity 2. For example, the corresponding relationship 1 can refer to Table 1:
[0202] Table 1
[0203] Ambient light intensity Screen brightness Screen color temperature Value 1 Brightness 1 Color Temperature 1 Value 2 Brightness 2 Color Temperature 2 Value 3 Brightness 3 Color Temperature 3
[0204] In Table 1, value 1 is smaller than value 2, and value 2 is smaller than value 3. Brightness 1 is smaller than brightness 2, and brightness 2 is smaller than brightness 3. Color temperature 1 is smaller than color temperature 2, and color temperature 2 is smaller than color temperature 3.
[0205] For example, assuming that the ambient light intensity 2 detected by the front ambient light sensor at the current moment is the value 1 shown in Table 1, the processor can adjust the screen brightness to brightness 1, or adjust the screen color temperature to color temperature 1 according to Table 1. assuming that the ambient light intensity 2 detected by the front ambient light sensor at the current moment is the value 2 shown in Table 1, the processor can adjust the screen brightness to brightness 2, and / or adjust the screen color temperature to color temperature 2 according to Table 1.
[0206] From the implementation process of the above-mentioned processor adjusting the color temperature or brightness of the screen, it can be seen that when the ambient light intensity 2 of the i-th time is the same as the ambient light intensity 2 of the i-1-th time (for example, the ambient light intensity 2 of the i-th time and the ambient light intensity 2 of the i-1-th time are both the value 1 in Table 1), the processor can assume that the ambient light intensity of the current environment has not changed, and the processor does not need to adjust the screen brightness or color temperature.
[0207] When the i-th ambient light intensity 2 is different from the i-1-th ambient light intensity 2, the processor may determine that the ambient light intensity of the current environment has changed, and the processor may adjust the screen brightness or color temperature based on the i-th ambient light intensity 2. However, the difference between the i-th ambient light intensity 2 and the i-1-th ambient light intensity 2 may be caused not only by a change in the ambient light intensity of the current environment but also by an obstruction of the front ambient light sensor. Therefore, after determining that the i-th ambient light intensity 2 is different from the i-1-th ambient light intensity 2, the processor needs to further determine whether the ambient light intensity of the current environment has changed through subsequent steps.
[0208] In step 122 , when the processor determines that the ambient light intensity 2 at the i-th time is the same as the ambient light intensity 2 at the (i-1)-th time, the processor indicates that the ambient light intensity of the current environment has not changed.
[0209] In step 123 , when the processor determines that the i-th ambient light intensity 2 is different from the (i-1)-th ambient light intensity 2 , the processor determines whether the i-th ambient light intensity 3 is the same as the (i-1)-th ambient light intensity 3 .
[0210] It should be understood that the i-th ambient light intensity 3 can be understood as the ambient light intensity 3 detected by the rear ambient light sensor at the current moment, the i-1-th ambient light intensity 3 can be understood as the ambient light intensity 3 detected by the rear ambient light sensor at the previous moment before the current moment, and the time interval between the i-1-th and the i-th times can be a duration of 1, where i is an integer greater than 1.
[0211] It should also be understood that the rear ambient light sensor can detect the ambient light intensity 3 every time interval 1, and report the ambient light intensity 3 detected each time to the processor.
[0212] In step 124 , when the processor determines that the ambient light intensity 3 at the i-th time is the same as the ambient light intensity 3 at the (i-1)-th time, the processor determines that the ambient light intensity of the current environment has not changed and the front ambient light sensor is blocked.
[0213] It should be understood that if the value detected by the front ambient light sensor changes but the value detected by the rear ambient light sensor does not change, it can be assumed that the ambient light intensity in the current environment has not changed and the front ambient light sensor is blocked. In this case, the processor does not need to adjust the screen brightness or color temperature.
[0214] In step 125 , when the processor determines that the i-th ambient light intensity 3 is different from the i-1-th ambient light intensity 3 , the processor determines whether the i-th ambient light intensity 2 and the i-th ambient light intensity 3 meet condition 1 .
[0215] It should be understood that condition 1 is a condition obtained through test data and data analysis for determining whether the front ambient light sensor is blocked when the value detected by the front ambient light sensor changes. For example, condition 1 can be:
[0216] lux 2i =k×lux 3i +b.
[0217] Among them, lux 2i Represents the ambient light intensity 2, lux for the i-th time 2i represents the ambient light intensity 3 for the i-th time, k and b are coefficients.
[0218] It should also be understood that, through test data and data analysis, it was found that when the ambient light intensity of the current environment changes and the front ambient light sensor and the rear ambient light sensor are not blocked, the ambient light intensity 2 and the ambient light intensity 3 meet the above-mentioned condition 1. Therefore, in implementation, when the processor determines that the i-th ambient light intensity 3 is different from the i-1-th ambient light intensity 3, the i-th ambient light intensity 2 and the i-th ambient light intensity 3 can be substituted into the above-mentioned condition 1. If the above-mentioned condition 1 is met, the processor determines that the ambient light intensity of the current environment has changed and that both the front ambient light sensor and the rear ambient light sensor are not blocked, and the processor adjusts the brightness or color temperature of the screen according to the i-th ambient light intensity 2. If condition 1 is not met, the processor determines that the ambient light intensity of the current environment has not changed and the front ambient light sensor is blocked, and the processor does not adjust the brightness or color temperature of the screen.
[0219] In step 126, when the processor determines that the i-th ambient light intensity 2 and the i-th ambient light intensity 3 meet condition 1, it indicates that the ambient light intensity of the current environment has changed and the front ambient light sensor and the rear ambient light sensor are not blocked, and the processor adjusts the brightness or color temperature of the screen according to the i-th ambient light intensity 2.
[0220] In step 127 , when the processor determines that the i-th ambient light intensity 2 and the i-th ambient light intensity 3 do not satisfy condition 1 , it indicates that the ambient light intensity of the current environment has not changed and the front ambient light sensor is blocked.
[0221] The embodiment of the present application can accurately determine whether the ambient light intensity in the current environment has changed, and accurately determine whether the front ambient light sensor is blocked, based on the values detected by the front ambient light sensor and the rear ambient light sensor. When the ambient light intensity in the current environment changes, the brightness or color temperature of the screen is adjusted according to the value detected by the front ambient light sensor, thereby avoiding adjusting the brightness or color temperature of the screen when the front ambient light sensor is blocked but the ambient light intensity in the current environment has not changed, thereby improving the user experience.
[0222] The above embodiments describe the implementation process of an electronic device determining whether the ambient light intensity of the current environment has changed. The following embodiments describe the method for detecting the ambient light intensity provided by the embodiment of the present application. Figure 2 The electronic device 100 shown here may also be executed by a processor or chip in the electronic device 100, and this embodiment of the application does not impose any limitation thereto. For ease of description, the method is described in detail using an electronic device as an example.
[0223] The method is applied to an electronic device, which includes a glass cover, a screen, and a front ambient light sensor arranged in sequence along the thickness direction of the electronic device. The screen is provided with a light channel, and ambient light and screen light refracted by the glass cover can be irradiated on the front ambient light sensor through the light channel. The method includes:
[0224] In response to a trigger event, the electronic device detects a first ambient light intensity using a front ambient light sensor; processes the first ambient light intensity based on a first relationship between geometric parameters of the light channel, optical parameters of the glass cover, and the screen light intensity of the current screen light to obtain a second ambient light intensity;
[0225] Among them, the second ambient light intensity is the ambient light intensity after removing the interference light intensity and / or adding the loss light intensity from the first ambient light intensity, the interference light intensity is the ambient light intensity of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and the loss light intensity is the ambient light intensity lost when the ambient light is refracted through the glass cover plate and passes through the optical channel. The first relationship includes a correspondence between multiple first distances and multiple first screen light intensities, the first distance is the distance between the position where the screen light enters the optical channel through the glass cover plate and the center position of the optical channel, one first distance corresponds to one first screen light intensity, and when the first distance is the radius of the optical channel, the first screen light intensity is the screen light intensity of the current screen light.
[0226] It should be understood that the glass cover, screen and front ambient light sensor included in the electronic device, as well as the positional relationship of these three components can be referred to Figure 1 In (b), the light channel refers to the hole obtained by digging the screen, through which ambient light and screen light can illuminate the ambient light sensor.
[0227] It should also be understood that a trigger event refers to an event that triggers the ambient light sensor to detect the ambient light intensity, for example, Figure 4 The user is shown clicking on the "Restart" control 4021. Figure 5 As shown, the user clicks the “auto adjust” control 5031 , etc. The embodiment of the present application does not limit the triggering event.
[0228] It should also be understood that the light path of ambient light in the electronic device is: Please refer to Figure 10 When the ambient light first hits the upper surface of the glass cover, it is reflected and refracted for the first time. The refracted ambient light passes through the upper surface of the glass cover and hits the lower surface of the glass cover. The refracted ambient light hits the lower surface of the glass cover and is refracted for the second time. The refracted ambient light hits the ambient light sensor through the optical channel. The refracted ambient light hits the lower surface of the glass cover and is reflected for the second time. The reflected ambient light hits the upper surface of the glass cover. The reflected ambient light hits the upper surface of the glass cover and is reflected for the third time. The reflected ambient light hits the lower surface of the glass cover. The reflected ambient light hits the lower surface of the glass cover and is refracted for the third time. The refracted ambient light hits the ambient light sensor through the optical channel. Figure 10 Only the ambient light after being refracted for the first to third times and then irradiated onto the ambient light sensor through the optical channel is shown in the figure. The ambient light after being refracted for other times can refer to the above method.
[0229] It can also be understood that the light path of the screen light in the electronic device is: assuming that the screen light generated by the screen has two beams of light that interfere with the amount of ambient light entering, including the first beam of screen light and the second beam of screen light. The first beam of screen light enters the light channel after reflection and refraction by the glass cover, and then shines on the ambient light sensor. The second beam of screen light enters the light channel after reflection and refraction by the glass cover, and then shines on the ambient light sensor. The paths of other beams of screen light can refer to the paths of the first beam of screen light and the second beam of screen light, and will not be repeated here.
[0230] The front ambient light sensor can refer to Figure 11In 701, the first ambient light intensity refers to the value detected by the front ambient light sensor. The geometric parameters of the optical channel may include the diameter and radius of the optical channel, and the optical parameters of the glass cover may include the reflectivity and refractive index of the glass cover.
[0231] It should also be understood that the meaning of the first relationship can be referred to the above embodiment, wherein the first distance in the first relationship can be Figure 8 Shown are r, r1, r2, etc. The screen light intensity can be Figure 8 LA, LB and LC shown, the current screen light intensity refers to Figure 8 LA shown. It should be understood Figure 8 The screen light intensity L corresponding to the position where the screen light is irradiated on the light channel is the radius r of the light channel. A The value of changes, then the screen light shines on other positions on the light channel (such as Figure 8 The values of r1 and r2 shown) corresponding to the screen light intensity (such as Figure 8 L shown B and L C ) will also change. During implementation, the electronic device will configure multiple correspondences between screen light intensities and multiple first relationships, such as screen light intensity 1 corresponding to first relationship 1, screen light intensity 2 corresponding to first relationship 2, and screen light intensity 3 corresponding to first relationship 3. The electronic device can use the first relationship corresponding to the screen light intensity of the current screen light to process the first ambient light intensity to obtain the second ambient light intensity, such as the first relationship corresponding to the screen light intensity of the current screen light is first relationship 2.
[0232] In implementation, after the electronic device detects the first ambient light intensity through the front ambient light sensor, it can process the first ambient light intensity based on the first relationship corresponding to the radius of the optical channel, the refractive index and reflectivity of the glass cover plate, and the screen light intensity of the current screen light, to obtain a second ambient light intensity by removing the interference light intensity of the screen light that is refracted by the glass cover plate and irradiated on the front ambient light sensor through the optical channel, or by adding the loss light intensity of the ambient light that is lost when the ambient light is refracted by the glass cover plate and passes through the optical channel, or by removing the interference light intensity of the screen light that is refracted by the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and by adding the loss light intensity of the ambient light that is lost when the ambient light is refracted by the glass cover plate and passes through the optical channel.
[0233] In related solutions, when the front ambient light sensor is installed under the screen, the ambient light is refracted by the glass cover and can illuminate the front ambient light sensor through the optical channel, which will cause the loss of ambient light. Also, the screen light is refracted by the glass cover and can illuminate the front ambient light sensor through the optical channel, which will interfere with the value detected by the front ambient light sensor. Due to the above factors, the ambient light intensity detected by the front ambient light sensor is inaccurate. The embodiment of the present application can process the first ambient light intensity based on the first relationship corresponding to the radius of the optical channel, the refractive index and reflectivity of the glass cover, and the screen light intensity of the current screen light, to obtain a second ambient light intensity after removing the interference light intensity of the screen light refracted by the glass cover and irradiated on the front ambient light sensor through the optical channel, and / or adding the lost light intensity of the ambient light lost when the ambient light is refracted by the glass cover and passes through the optical channel. Compared with related solutions, the interference of the screen light can be removed and / or the loss can be compensated, so that the value detected by the front ambient light sensor can be more accurate, thereby improving the user experience.
[0234] In some embodiments, the electronic device processes the first ambient light intensity based on a first relationship between geometric parameters of the light channel, optical parameters of the glass cover, and screen light intensity of current screen light to obtain the second ambient light intensity, including:
[0235] The electronic device determines a first light input amount of the front ambient light sensor based on the first ambient light intensity and the geometric parameters of the optical channel; and determines a second ambient light intensity according to the first light input amount, the geometric parameters of the optical channel, the optical parameters of the glass cover and the first relationship.
[0236] It should be understood that the ambient light intensity detected by the ambient light sensor is related to the amount of incoming light. The relationship between the ambient light intensity and the amount of incoming light can be referred to Formula 1 in the above embodiment.
[0237] In an embodiment of the present application, the interference light input amount can be removed from the light input amount (first light input amount) corresponding to the ambient light intensity detected by the ambient light sensor, and / or the lost light input amount can be compensated. The interference light input amount is caused by the reflection and refraction of the screen light, and the lost light input amount is caused by the reflection and refraction of the ambient light. Then, based on the relationship between the ambient light intensity and the light input amount, the second ambient light intensity in the above embodiment can be obtained.
[0238] In implementation, after the front ambient light sensor detects the first ambient light intensity, the first ambient light intensity and the diameter of the light channel can be substituted into Formula 1 in the above embodiment to obtain the first light input amount of the front ambient light sensor. Thereafter, the second ambient light intensity is determined based on the first light input amount, the radius and diameter of the light channel, the refractive index and reflectivity of the glass cover, and the first relationship.
[0239] In an embodiment of the present application, the electronic device can first determine the first amount of light entering the front ambient light sensor based on the first ambient light intensity and the geometric parameters of the optical channel, and then accurately determine the second ambient light intensity based on the first amount of light entering, the geometric parameters of the optical channel, the optical parameters of the glass cover and the first relationship.
[0240] In some embodiments, the electronic device determines the second ambient light intensity based on the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship, including:
[0241] The electronic device determines a second amount of light input based on the optical parameters of the glass cover, the geometric parameters of the optical channel, and the first relationship. The second amount of light input is the amount of light input when the screen light is refracted through the glass cover and illuminates the front ambient light sensor through the optical channel. The electronic device performs difference processing on the first amount of light input and the second amount of light input to obtain a third amount of light input. The electronic device determines the second ambient light intensity based on the third amount of light input and the geometric parameters of the optical channel.
[0242] It should be understood that the second ambient light intensity in the embodiment of the present application is the ambient light intensity obtained by removing the interference light intensity from the first ambient light intensity.
[0243] In implementation, the electronic device can substitute the refractive index and reflectivity of the glass cover, the radius of the light channel, and the first relationship into Formula 3 in the above embodiment to obtain the second amount of light entering. Subsequently, the electronic device can substitute the first and second amounts of light entering into Formula 2.2 in the above embodiment to obtain the third amount of light entering. Subsequently, the electronic device substitutes the third amount of light entering and the diameter of the light channel into Formula 1 to obtain the second ambient light intensity.
[0244] In an embodiment of the present application, the second light input amount determined based on the optical parameters of the glass cover plate, the geometric parameters of the optical channel and the first relationship is the light input amount of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and the first light input amount is the light input amount corresponding to the first ambient light intensity detected by the front ambient light sensor. The electronic device performs difference processing on the first light input amount and the second light input amount to obtain a third light input amount, which is the light input amount after deducting the light input amount of the screen light after being refracted through the glass cover plate and irradiated on the front ambient light sensor through the optical channel from the first light input amount. Therefore, based on the third light input amount and the geometric parameters of the optical channel, the second ambient light intensity determined refers to the ambient light intensity after deducting the interference light intensity from the first ambient light intensity. Since the interference light intensity is removed, the second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme.
[0245] In some embodiments, the electronic device determines the second ambient light intensity based on the first light input amount, the geometric parameters of the optical channel, the optical parameters of the glass cover, and the first relationship, including: determining a fourth light input amount based on the first light input amount, the optical parameters of the glass cover, the geometric parameters of the optical channel, and the first relationship, the fourth light input amount being the amount of light input lost when the ambient light is refracted through the glass cover and passes through the optical channel; summing the first light input amount and the fourth light input amount to obtain a fifth light input amount; and determining the second ambient light intensity based on the fifth light input amount and the geometric parameters of the optical channel.
[0246] It should be understood that the second ambient light intensity in the embodiment of the present application is the ambient light intensity obtained by adding the loss light intensity to the first ambient light intensity.
[0247] In implementation, after the electronic device determines the first amount of light entering, it can substitute the first amount of light entering, the radius of the light channel, the refractive index and reflectivity of the glass cover, and the first relationship into Formula 9 in the above embodiment to obtain the fourth amount of light entering. Then, the first amount of light entering and the fourth amount of light entering are substituted into Formula 2.3 to obtain the fifth amount of light entering. Then, the fifth amount of light entering and the diameter of the light channel are substituted into Formula 1 to obtain the second ambient light intensity.
[0248] In an embodiment of the present application, the fourth light input amount determined based on the first light input amount, the optical parameters of the glass cover plate, the geometric parameters of the optical channel and the first relationship is the light input amount lost when the ambient light passes through the optical channel after being refracted by the glass cover plate. The first light input amount is the light input amount corresponding to the first ambient light intensity detected by the front ambient light sensor. The electronic device sums the first light input amount and the fourth light input amount, and the obtained fifth light input amount is the light input amount after compensating for the light input amount lost when the ambient light passes through the optical channel after being refracted by the glass cover plate in the first light input amount. Therefore, based on the fifth light input amount and the geometric parameters of the optical channel, the second ambient light intensity determined refers to the ambient light intensity after the lost light intensity is added to the first ambient light intensity. Due to the addition of the lost light intensity, the second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme.
[0249] In some embodiments, the electronic device determines the second ambient light intensity based on the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship, including:
[0250] The electronic device determines a second amount of light input based on the optical parameters of the glass cover, the geometric parameters of the optical channel and the first relationship, where the second amount of light input is the amount of light input when the screen light is refracted through the glass cover and illuminates the front ambient light sensor through the optical channel; determines a sixth amount of light input based on the first amount of light input, the second amount of light input and the optical parameters of the glass cover, where the sixth amount of light input is the amount of light input obtained by subtracting the amount of light input when the screen light is refracted through the glass cover and illuminates the front ambient light sensor through the optical channel from the first amount of light input, and the amount of light input lost when the ambient light is refracted through the glass cover and passes through the optical channel; determines a second ambient light intensity based on the sixth amount of light input and the geometric parameters of the optical channel.
[0251] It should be understood that in the embodiment of the present application, the second ambient light intensity is the ambient light intensity obtained by removing the interference light intensity and adding the loss light intensity from the first ambient light intensity.
[0252] In implementation, after obtaining the first amount of incoming light, the electronic device can substitute the refractive index and reflectivity of the glass cover, the radius of the light channel, and the first relationship into Formula 3 in the above embodiment to obtain the second amount of incoming light. The electronic device can then substitute the first amount of incoming light, the second amount of incoming light, the refractive index and reflectivity of the glass cover into Formula 6 to obtain the sixth amount of incoming light. Substituting the sixth amount of incoming light and the diameter of the light channel into Formula 1 can obtain the second ambient light intensity.
[0253] In an embodiment of the present application, due to the first light input amount, the second light input amount and the optical parameters of the glass cover plate, the determined sixth light input amount is the light input amount obtained by deducting the screen light from the first light input amount and then refracting through the glass cover plate and irradiating the front ambient light sensor through the optical channel, and the light input amount lost when the ambient light is refracted through the glass cover plate and then passes through the optical channel. Therefore, based on the sixth light input amount and the geometric parameters of the optical channel, the determined second ambient light intensity refers to the ambient light intensity after deducting the interference light intensity and adding the lost light intensity from the first ambient light intensity. The second ambient light intensity is more accurate than the ambient light intensity detected by the front ambient light sensor in the related scheme because the interference light intensity is removed and the lost light intensity is added.
[0254] In some embodiments, the second ambient light intensity is the ambient light intensity obtained by the front ambient light sensor for the i-th time detecting the first ambient light intensity, where i is an integer greater than 1; and the method further includes:
[0255] The electronic device adjusts the temperature or color temperature of the screen when determining that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time.
[0256] Regarding the meanings of the i-th time and the i-1-th time, please refer to the above embodiment and will not be repeated here.
[0257] In implementation, when the electronic device determines that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, the temperature or color temperature of the screen can be adjusted according to the second ambient light intensity obtained by the front ambient light sensor for the i-th time.
[0258] In some embodiments, the electronic device further includes a first ambient light sensor; and when the electronic device determines that a second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from a second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, adjusting the temperature or color temperature of the screen includes:
[0259] When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, the temperature or color temperature of the screen is adjusted.
[0260] It should be understood that the first ambient light sensor may be Figure 11 In some embodiments, the first ambient light sensor may also be a front ambient light sensor, which is installed at a different position in the electronic device than the front ambient light sensor in the above embodiment.
[0261] It is also understandable that when the front ambient light sensor mentioned in the above embodiment is temporarily blocked by an obstruction, the front ambient light sensor will perceive that the ambient light intensity has changed, but the ambient light intensity in the current environment has not changed. In this way, the electronic device will also adjust the color temperature or brightness of the screen to a color temperature or brightness that does not match the ambient light intensity in the surrounding environment. To avoid the above situation, the embodiment of the present application can use multiple sensors to collaboratively determine whether, when the value of the front ambient light sensor changes, the change is caused by a change in the ambient light intensity of the current environment or by the temporary obstruction of the front ambient light sensor by an obstruction.
[0262] In implementation, when the electronic device determines that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and determines that the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, at this time, it is determined that the change in the second ambient light intensity obtained by the front ambient light sensor is caused by a change in the ambient light intensity of the current environment, rather than by the front ambient light sensor being temporarily blocked by an obstruction. At this time, the electronic device can adjust the temperature or color temperature of the screen based on the second ambient light intensity obtained by the front ambient light sensor for the i-th time.
[0263] In some embodiments, when the electronic device determines that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the (i-1)th time, adjusting the temperature or color temperature of the screen includes:
[0264] The electronic device adjusts the temperature or color temperature of the screen when it determines that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time and the second ambient light intensity obtained by the front ambient light sensor for the i-th time meet a first condition, where the first condition is used to indicate that the front ambient light sensor is not blocked.
[0265] It should be understood that the first condition is that the third ambient light intensity obtained by the first ambient light sensor for the i-th time has a linear relationship with the second ambient light intensity obtained by the front ambient light sensor for the i-th time. For example, the first condition can refer to condition 1 in the above embodiment.
[0266] In implementation, when the electronic device determines that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time and the second ambient light intensity obtained by the front ambient light sensor for the i-th time meet the first condition, at this time, it is determined that the change in the second ambient light intensity obtained by the front ambient light sensor is caused by a change in the ambient light intensity of the current environment, rather than by the front ambient light sensor being temporarily blocked by an obstruction. At this time, the electronic device can adjust the temperature or color temperature of the screen based on the second ambient light intensity obtained by the front ambient light sensor for the i-th time.
[0267] In an embodiment of the present application, the electronic device can accurately determine whether the ambient light intensity in the current environment has changed, and accurately determine whether the front ambient light sensor is blocked, based on the values detected by the front ambient light sensor and the first ambient light sensor. When the ambient light intensity in the current environment changes, the brightness or color temperature of the screen is adjusted according to the value detected by the front ambient light sensor, thereby avoiding adjusting the brightness or color temperature of the screen when the front ambient light sensor is blocked but the ambient light intensity in the current environment has not changed, thereby improving the user experience.
[0268] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0269] The present application provides a computer program product that, when executed on an electronic device, enables the electronic device to execute the technical solution in the above embodiment. The implementation principle and technical effects are similar to those of the above method-related embodiments and will not be described in detail here.
[0270] The embodiment of the present application provides a readable storage medium, which contains instructions. When the instructions are executed on an electronic device, the electronic device executes the technical solution of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0271] The present application provides a chip for executing instructions. When the chip is running, the technical solution of the above embodiment is executed. The implementation principle and technical effect are similar and will not be described here.
[0272] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0273] It should be understood that the “embodiment” mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the various embodiments in the entire specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0274] Those skilled in the art will understand that the various numerical numbers such as first and second involved in this application are only for the convenience of description and are not used to limit the scope of the embodiments of this application, and also indicate the order of precedence.
[0275] In this application, elements expressed in the singular are intended to mean "one or more" rather than "one and only one" unless otherwise specified. In this application, unless otherwise specified, "at least one" is intended to mean "one or more" and "a plurality" is intended to mean "two or more."
[0276] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. A can be singular or plural, and B can be singular or plural.
[0277] The term "at least one of..." in this document refers to all or any combination of the listed items. For example, "at least one of A, B and C" can mean: A exists alone, B exists alone, C exists alone, A and B exist at the same time, B and C exist at the same time, and A, B and C exist at the same time. A can be singular or plural, B can be singular or plural, and C can be singular or plural.
[0278] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0279] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0280] The same or similar parts between the various embodiments in this application can refer to each other. In the various embodiments in this application, and the various implementation methods / implementation methods / implementation methods in each embodiment, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment are consistent and can be referenced to each other. The technical features in different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment can be combined to form new embodiments, implementation methods, implementation methods, or implementation methods according to their inherent logical relationships. The above-described implementation methods of this application do not constitute a limitation on the scope of protection of this application.
[0281] The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims. In short, the above is only a preferred embodiment of the technical solution of the present application, and is not used to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for detecting ambient light intensity, applied to an electronic device, the electronic device comprising a glass cover, a screen, and a front ambient light sensor, arranged sequentially along the thickness direction of the electronic device. The screen is provided with an optical channel, through which ambient light and screen light refracted by the glass cover can be illuminated by the front ambient light sensor. The method comprises: In response to a trigger event, detecting a first ambient light intensity by the front ambient light sensor; processing the first ambient light intensity based on a first relationship between the geometric parameters of the light channel, the optical parameters of the glass cover, and the screen light intensity of the current screen light to obtain a second ambient light intensity; Among them, the second ambient light intensity is the ambient light intensity after removing the interference light intensity and / or adding the loss light intensity from the first ambient light intensity, the interference light intensity is the ambient light intensity of the screen light after being refracted by the glass cover plate and irradiated on the front ambient light sensor through the optical channel, and the loss light intensity is the ambient light intensity lost when the ambient light is refracted by the glass cover plate and passes through the optical channel, the first relationship includes a correspondence between multiple first distances and multiple first screen light intensities, the first distance is the distance between the position where the screen light enters the optical channel through the glass cover plate and the center position of the optical channel, one first distance corresponds to one first screen light intensity, and when the first distance is the radius of the optical channel, the first screen light intensity is the screen light intensity of the current screen light.
2. The method according to claim 1, characterized in that The processing of the first ambient light intensity based on a first relationship between the geometric parameters of the light channel, the optical parameters of the glass cover, and the screen light intensity of the current screen light to obtain a second ambient light intensity includes: determining a first light input amount of the front ambient light sensor based on the first ambient light intensity and the geometric parameters of the optical channel; The second ambient light intensity is determined according to the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship.
3. The method according to claim 2, characterized in that The second ambient light intensity is the ambient light intensity obtained by removing the interference light intensity from the first ambient light intensity; and determining the second ambient light intensity based on the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship includes: determining, based on optical parameters of the glass cover plate, geometric parameters of the light channel, and the first relationship, a second amount of light input, where the second amount of light input is an amount of screen light that is refracted by the glass cover plate and illuminates the front ambient light sensor through the light channel; performing difference processing on the first light input amount and the second light input amount to obtain a third light input amount; The second ambient light intensity is determined based on the third incoming light quantity and the geometric parameters of the light channel.
4. The method according to claim 2, characterized in that The second ambient light intensity is the ambient light intensity obtained by adding the loss light intensity to the first ambient light intensity; and determining the second ambient light intensity according to the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship includes: determining a fourth light intake amount based on the first light intake amount, the optical parameters of the glass cover plate, the geometric parameters of the light channel, and the first relationship, where the fourth light intake amount is the amount of light intake lost when the ambient light is refracted by the glass cover plate and passes through the light channel; performing summation processing on the first light input amount and the fourth light input amount to obtain a fifth light input amount; The second ambient light intensity is determined based on the fifth incoming light quantity and the geometric parameters of the light channel.
5. The method according to claim 2, characterized in that The second ambient light intensity is the ambient light intensity obtained by removing the interference light intensity and adding the loss light intensity from the first ambient light intensity; and determining the second ambient light intensity based on the first incoming light amount, the geometric parameters of the light channel, the optical parameters of the glass cover, and the first relationship, includes: determining, based on optical parameters of the glass cover plate, geometric parameters of the light channel, and the first relationship, a second amount of light input, where the second amount of light input is an amount of screen light that is refracted by the glass cover plate and illuminates the front ambient light sensor through the light channel; Determine a sixth amount of light incoming based on the first amount of light incoming, the second amount of light incoming, and optical parameters of the glass cover plate, where the sixth amount of light incoming is the amount of light incoming after deducting from the first amount of light incoming the amount of screen light that is refracted by the glass cover plate and illuminates the front ambient light sensor through the light channel, and the amount of light incoming that is lost when the ambient light is refracted by the glass cover plate and passes through the light channel; The second ambient light intensity is determined based on the sixth incoming light quantity and the geometric parameters of the light channel.
6. The method according to any one of claims 1 to 5, characterized in that The geometric parameters of the light channel include the radius of the light channel, and the optical parameters of the glass cover plate include the refractive index and reflectivity of the glass cover plate.
7. The method according to any one of claims 1 to 5, characterized in that The second ambient light intensity is the ambient light intensity obtained by the front ambient light sensor detecting the first ambient light intensity for the i-th time, where i is an integer greater than 1; and the method further includes: When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, the temperature or color temperature of the screen is adjusted.
8. The method according to claim 7, characterized in that The electronic device further includes a first ambient light sensor; and, when it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, adjusting the temperature or color temperature of the screen includes: When it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the i-1-th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the i-1-th time, the temperature or color temperature of the screen is adjusted.
9. The method according to claim 8, characterized in that The adjusting the temperature or color temperature of the screen, when it is determined that the second ambient light intensity obtained by the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by the front ambient light sensor for the (i-1)th time, and the third ambient light intensity obtained by the first ambient light sensor for the i-th time is different from the third ambient light intensity obtained by the first ambient light sensor for the (i-1)th time, includes: When it is determined that the second ambient light intensity obtained by passing through the front ambient light sensor for the i-th time is different from the second ambient light intensity obtained by passing through the front ambient light sensor for the i-1th time, and the third ambient light intensity obtained by passing through the first ambient light sensor for the i-1th time is different from the third ambient light intensity obtained by passing through the first ambient light sensor for the i-1th time, and the third ambient light intensity obtained by passing through the first ambient light sensor for the i-th time and the second ambient light intensity obtained by passing through the front ambient light sensor for the i-th time meet a first condition, the temperature or color temperature of the screen is adjusted, and the first condition is used to indicate that the front ambient light sensor is not blocked.
10. The method according to claim 9, characterized in that The first condition is that the third ambient light intensity obtained by the first ambient light sensor for the i-th time has a linear relationship with the second ambient light intensity obtained by the front ambient light sensor for the i-th time.
11. The method according to any one of claims 8 to 10, characterized in that The first ambient light sensor is a rear ambient light sensor.
12. An electronic device, characterized in that: include: one or more processors; one or more memories; The one or more memories store one or more computer programs, and the one or more computer programs include instructions, which, when executed by the one or more processors, enable the electronic device to perform the method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 11.
14. A chip, characterized in that: The chip includes: a memory for storing instructions; A processor, configured to call and execute the instructions from the memory, so that an electronic device equipped with the chip executes the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Environment light detection method and device and electronic equipment
CN108051370A
Terminal device with ambient light detection function and ambient light detection method
CN115705788A