A method and apparatus for acquiring maximum brightness of a screen support

By determining the initial value of user-space variables when a screen state change command is detected, and directly or from kernel space obtaining and caching the maximum screen brightness value, the problem of excessively long acquisition time of the maximum screen brightness under high device load is solved, thus improving the performance and stability of the display system.

CN120279820BActive Publication Date: 2026-05-29HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2023-12-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When the device is under high load, the execution time of calling the maximum screen brightness acquisition interface is too long, which causes the thread to be unable to process subsequent composite display tasks, or even causes it to freeze.

Method used

By detecting screen state change instructions, it determines whether the first variable in user space is the initial value. If not, it directly obtains the cached maximum screen brightness value. If it is, it obtains it from kernel space and caches it in user space to avoid repeatedly accessing kernel space.

Benefits of technology

This significantly reduces the time required to obtain the maximum screen brightness, improving the robustness and efficiency of the display system under high load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279820B_ABST
    Figure CN120279820B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a method and device for obtaining the maximum brightness supported by a screen, which are applied to an electronic terminal based on a high-pass chip platform. When a screen state change instruction is detected, it is judged whether a first variable in a user space is an initial value. If not, the value of the first variable is obtained to obtain a maximum brightness value of the screen. If yes, the maximum brightness value of the screen is obtained from a kernel space, and the maximum brightness value of the screen is assigned to the first variable. It can be seen that after the maximum brightness value of the screen is obtained for the first time, the maximum brightness value of the screen is cached for subsequent use, so that repeated access to the kernel space is avoided. The time length for obtaining the maximum brightness supported by the current screen is reduced, and the stability and performance of the system under a high load state are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of display technology, and more specifically to a method and apparatus for obtaining the maximum brightness supported by a screen. Background Technology

[0002] When the device is under high load, calling the maximum screen brightness acquisition interface to obtain the maximum brightness currently supported by the screen can result in a long execution time. In this situation, the thread cannot process subsequent composite display tasks, leading to dropped frames or even freezing. Summary of the Invention

[0003] In view of this, this application provides a method and apparatus for obtaining the maximum brightness supported by the screen, which reduces the time required to call the interface to obtain the current maximum brightness supported by the screen.

[0004] In a first aspect of this application, a method for obtaining the maximum supported brightness of a screen is provided, applied to an electronic terminal device based on a Qualcomm chip platform, the method comprising:

[0005] When a screen state change command is detected, it is determined whether the first variable in user space is at its initial value;

[0006] If not, obtain the value of the first variable to get the maximum screen brightness value;

[0007] If so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

[0008] In this embodiment, when a screen state change instruction is detected, it is first determined whether the maximum screen brightness value is cached in the user space. If the maximum screen brightness value is cached, it can be obtained directly without accessing the kernel space. If the maximum screen brightness value is not cached, it means that this is the first time the electronic device requests the maximum screen brightness value, so it needs to access the kernel space to obtain the maximum screen brightness value. After obtaining the maximum screen brightness value, the value is assigned to the first variable in the user space, thus caching the maximum screen brightness value in the user space. In this way, when the maximum screen brightness value is requested again in the future, the value of the first variable can be used directly, avoiding access to the kernel space. The solution of this application only needs to access the kernel space once, which reduces the time required to obtain the maximum brightness currently supported by the screen.

[0009] In one possible embodiment, the electronic terminal device includes a SurfaceFlinger module and a Composer module. The step of determining whether a first variable in the user space is an initial value when a screen state change instruction is detected includes:

[0010] After receiving the screen state change instruction sent by the SurfaceFlinger module via Binder, the Composer module calls the screen maximum brightness acquisition interface.

[0011] The Composer module determines whether the first variable in the user space is an initial value through the screen maximum brightness acquisition interface;

[0012] The step of obtaining the value of the first variable to obtain the maximum screen brightness value includes:

[0013] The Composer module obtains the value of the first variable and gets the maximum screen brightness value.

[0014] In this embodiment of the application, when a screen state change instruction is detected, the Composer module calls the screen maximum brightness acquisition interface and determines whether the first variable in the user space is the initial value through the screen maximum brightness acquisition interface. If the first variable is not the initial value, the value of the first variable is obtained to get the screen maximum brightness value, thus avoiding access to the kernel space and effectively reducing the time to obtain the screen maximum brightness value.

[0015] In one possible embodiment, obtaining the maximum screen brightness value from the kernel space includes:

[0016] After calling the screen maximum brightness acquisition interface, the Composer module obtains a pre-created file descriptor;

[0017] The Composer module accesses the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0018] In this embodiment of the application, when the first variable in the user space is an initial value, the Composer module will access the kernel space through the file descriptor to obtain the maximum screen brightness value, so that the maximum screen brightness acquisition interface receives a correct response.

[0019] In one possible embodiment, the kernel space includes a virtual file system, the virtual file system includes a maximum screen brightness value, and the step of accessing the kernel space through the file descriptor to obtain the maximum screen brightness value includes:

[0020] The Composer module accesses the virtual file system in the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0021] In this embodiment of the application, when the first variable in the user space is an initial value, the Composer module accesses the virtual file system through the file descriptor to obtain the maximum screen brightness value, so that the maximum screen brightness acquisition interface receives a correct response.

[0022] In one possible embodiment, the method further includes:

[0023] After obtaining the maximum screen brightness value, the Composer module releases a signal to reclaim the file descriptor.

[0024] In this embodiment of the application, the file descriptor is promptly reclaimed after the maximum screen brightness value is obtained, which can save system resources.

[0025] In one possible embodiment, the initial value of the first variable is a non-positive number.

[0026] In one possible embodiment, the method further includes:

[0027] The Composer module receives the preprocessed layer units sent by the SurfaceFlinger module;

[0028] The Composer module changes the screen display state based on the layer unit and the maximum screen brightness value.

[0029] In this embodiment, through the collaborative action of the Composer module and the SurfaceFlinger module, the Composer module receives the layer units sent by the SurfaceFlinger module and changes the screen display state according to the layer units and the maximum screen brightness value.

[0030] Secondly, this application provides a device for obtaining the maximum brightness supported by a screen, applied to electronic terminal devices based on a Qualcomm chip platform, the device comprising:

[0031] The judgment module is used to determine whether the first variable in user space is the initial value when a screen state change command is detected;

[0032] The first variable access module is used to obtain the value of the first variable and get the maximum screen brightness value if no;

[0033] The kernel space access module is used to, if so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

[0034] In one possible embodiment, the electronic terminal device includes a SurfaceFlinger module and a Composer module, and the determination module includes:

[0035] The calling module is used so that after the Composer module receives the screen state change instruction sent by the SurfaceFlinger module through Binder, the Composer module calls the screen maximum brightness acquisition interface.

[0036] The sub-judgment module is used by the Composer module to determine whether the first variable in the user space is an initial value through the screen maximum brightness acquisition interface;

[0037] The first variable access module is specifically used by the Composer module to obtain the value of the first variable and thus obtain the maximum screen brightness value.

[0038] In one possible embodiment, the kernel space access module includes:

[0039] The file descriptor acquisition module is used by the Composer module to acquire a pre-created file descriptor after calling the screen maximum brightness acquisition interface.

[0040] The file descriptor access module is used by the Composer module to access the kernel space through the file descriptor and obtain the maximum screen brightness value.

[0041] In one possible embodiment, the kernel space includes a virtual file system, which includes a maximum screen brightness value. The file descriptor access module is specifically used by the Composer module to access the virtual file system under the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0042] In one possible embodiment, the device further includes:

[0043] The file descriptor release module is used by the Composer module to release a signal to reclaim the file descriptor after obtaining the maximum screen brightness value.

[0044] In one possible embodiment, the initial value of the first variable is a non-positive number.

[0045] In one possible embodiment, the device further includes:

[0046] A layer unit receiving module is used for the Composer module to receive preprocessed layer units sent by the SurfaceFlinger module;

[0047] The display module is used by the Composer module to change the screen display state according to the layer unit and the maximum screen brightness value.

[0048] In a third aspect of this application, an electronic device is provided, comprising:

[0049] One or more processors and memory;

[0050] The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, which the one or more processors call to cause the electronic device to perform the steps of the method described in the first aspect above.

[0051] In a fourth aspect of this application, a computer-readable storage medium is provided, including a computer program that, when run on an electronic device, causes the electronic device to perform the steps of the method described in the first aspect.

[0052] Using the technical solution provided in this application, when a screen state change instruction is detected, it is determined whether the first variable in the user space is an initial value; if not, the value of the first variable is obtained to get the maximum screen brightness value; if so, the maximum screen brightness value is obtained from the kernel space and assigned to the first variable. It can be seen that after obtaining the maximum screen brightness value, this application caches the maximum screen brightness value in the user space. Subsequent requests to obtain the maximum screen brightness value can directly retrieve it from the user space. This solution only requires accessing the kernel space once, reducing the time required to obtain the maximum brightness currently supported by the screen. Attached Figure Description

[0053] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 A schematic diagram of the structure of an electronic device;

[0055] Figure 2 A schematic diagram of the system architecture of an electronic device;

[0056] Figure 3 A flowchart illustrating a method for obtaining the maximum supported brightness of a screen according to an embodiment of this application;

[0057] Figure 4 This is another flowchart illustrating a method for obtaining the maximum supported brightness of a screen, as provided in an embodiment of this application.

[0058] Figure 5 A flowchart illustrating the process of obtaining the maximum screen brightness value;

[0059] Figure 6Another flowchart for obtaining the maximum screen brightness value;

[0060] Figure 7 This is a schematic diagram of a device for obtaining the maximum brightness supported by the screen, provided in an embodiment of this application. Detailed Implementation

[0061] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0062] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0063] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0064] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0065] See Figure 1 , Figure 1 The diagram shown is a hardware structure diagram of an electronic device provided in an embodiment of this application. The electronic device can be a mobile phone, a tablet computer, or other user terminals.

[0066] The electronic device includes a processor 110, a transceiver 120, and a display unit 170. The display unit 170 may include a display screen.

[0067] Optionally, the electronic device may also include a memory 130. The processor 110, transceiver 120 and memory 130 can communicate with each other through internal connection paths to transmit control and / or data signals. The memory 130 is used to store computer programs, and the processor 110 is used to call and run the computer programs from the memory 130.

[0068] Optionally, the electronic device may also include an antenna 140 for transmitting wireless signals output by the transceiver 120.

[0069] The processor 110 and memory 130 can be combined into a single processing device, but more commonly they are independent components. The processor 110 executes the program code stored in the memory 130 to achieve the aforementioned functions. In specific implementations, the memory 130 can be integrated into the processor 110, or it can be independent of the processor 110.

[0070] In addition, to further enhance the functionality of the electronic device, it may also include one or more of an input unit 160, an audio circuit 180, a camera 190, and a sensor 101. The audio circuit may also include a speaker 182, a microphone 184, etc.

[0071] Optionally, the above-mentioned electronic device may also include a power supply 150 for providing power to various devices or circuits in the electronic device.

[0072] Understandable, Figure 1 The operation and / or function of each module in the illustrated electronic device are respectively for implementing the corresponding processes in the following method embodiments. For details, please refer to the descriptions in the following method embodiments; detailed descriptions are omitted here to avoid repetition.

[0073] Understandable, Figure 1 The processor 110 in the illustrated electronic device may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, 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. The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or is reusing. If the processor 110 needs to reuse the instruction or data, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves system efficiency.

[0074] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0075] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0076] Understandable, Figure 1 The power supply 150 shown provides power to the processor 110, memory 130, display unit 170, camera 190, input unit 160, and transceiver 120, etc. The antenna 140 is used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 140 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in conjunction with a tuning switch.

[0077] Transceiver 120 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. Transceiver 120 can be one or more devices integrating at least one communication processing module. Transceiver 120 receives electromagnetic waves via antenna 140, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. Transceiver 120 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 140.

[0078] In some embodiments, the antenna 140 of the electronic device and the transceiver 120 are coupled, enabling the electronic device to communicate with a network and other devices via wireless communication technologies. The wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).

[0079] The electronic device implements display functions through a GPU, a display unit 170, and an application processor. The GPU is a microprocessor for image processing, connecting the display unit 170 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0080] Display unit 170 is used to display images, videos, etc. Display unit 170 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N display units 170, where N is a positive integer greater than 1.

[0081] Electronic devices can achieve shooting functions through ISP, camera 190, video codec, GPU, display unit 170 and application processor.

[0082] The ISP (Image Signal Processor) processes data fed back from the camera. For example, when recording video, the camera is turned on, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then transmitted to the ISP for processing, transforming it into a visible image. The ISP can also perform algorithmic optimizations on image noise, brightness, and skin tone.

[0083] The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 190. The camera 190 is used to capture still images or videos. An object generates an optical image through the lens and projects it onto a photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, and other formats. In some embodiments, the electronic device may include one or N cameras 190, where N is a positive integer greater than 1. The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform Fourier transforms on the frequency point energy, etc.

[0084] Video codecs are used to compress or decompress digital video. Electronic devices can support one or more video codecs. This allows the electronic device to play or record video in various encoded formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0085] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0086] The memory 130 can be used to store computer executable program code, which includes instructions. The memory 130 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phonebook, etc.). Furthermore, the memory 130 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the memory 130 and / or instructions stored in memory disposed within the processor.

[0087] Electronic devices can implement audio functions through audio circuitry 180, speakers 182, microphones 184, and application processors, such as music playback and recording.

[0088] The audio circuit 180 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal. The audio circuit 180 can also be used for encoding and decoding audio signals. In some embodiments, the audio circuit 180 may be located in the processor 110, or some functional modules of the audio circuit 180 may be located in the processor 110.

[0089] The speaker 182, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. Electronic devices can listen to music or make hands-free calls through the speaker 182.

[0090] Microphone 184, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their voice close to microphone 184, inputting the sound signal into microphone 184. An electronic device may have at least one microphone 184. In some embodiments, the electronic device may have two microphones 184, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, the electronic device may have three, four, or more microphones 184, enabling sound signal collection, noise reduction, sound source identification, and directional recording, among other functions.

[0091] The method for obtaining the maximum supported brightness of the screen in this embodiment can be achieved through... Figure 2 The system architecture implementation shown is described in [reference]. Figure 2 The system architecture of an electronic device includes a kernel, a framework layer, and an application layer. The kernel includes a driver layer and a real-time operating system. The driver layer includes a GPU (Graphics Processing Unit), a display driver (specifically an LCD driver in the diagram), a TP (touchscreen driver), and buttons. The real-time operating system includes interrupt management, task scheduling, and MEM (Memory Management). The framework layer includes basic system capabilities, underlying software services, and hardware service capabilities. The application layer includes system applications (such as calendar, camera, contacts, and browser) and third-party applications (such as third-party social applications and video applications). In this application embodiment, the method for obtaining the maximum brightness supported by the screen is performed in the kernel layer and the framework layer. When operations such as swiping or switching screens are performed on the screen of an electronic device, it means that a new display screen needs to be synthesized, which will trigger the execution of the method in this application. It is understood that the display screen of an electronic device has a refresh rate parameter, which requires refreshing the screen display content every second. If the screen display content is refreshed at a preset period, the method in this application can also be triggered. During the process of the screen turning from off to on, the method in this application will also be triggered because a new screen needs to be displayed.

[0092] When the device is under high load, calling the API to obtain the maximum brightness currently supported by the screen can result in long execution times. In this situation, the thread cannot handle subsequent composite display tasks, leading to dropped frames or even freezing.

[0093] Currently, when the business layer and framework layer of electronic devices obtain the maximum screen brightness value through the maximum screen brightness acquisition interface, they both need to access the virtual file system. This process involves not only transferring data from kernel space to user space, but also the allocation, mapping, and destruction of file descriptors. If the system load is high at this time, and memory read / write blocking is severe, the thread performing memory access-related operations internally by the maximum screen brightness acquisition interface will remain in an Uninterrupted Sleep state, severely blocking the execution of the composite display task.

[0094] Based on this, this application provides a method for obtaining the maximum supported brightness of a screen, applicable to any electronic device with a display screen, including but not limited to mobile phones and tablets. The maximum screen brightness is related to the device model, but the maximum screen brightness of a specific device is fixed and will not change. See also... Figure 3 Methods for obtaining the maximum supported screen brightness include:

[0095] S201. When a screen state change command is detected, determine whether the first variable in the user space is the initial value.

[0096] The electronic device mentioned in this application embodiment can be an electronic terminal device based on a Qualcomm chip platform. Screen state change instructions can include changes to the screen display content and changes to the screen display brightness. It is understood that when operations such as swiping are performed on the screen of an electronic device, a new display image needs to be synthesized for display. Furthermore, the display screen of an electronic device has a specific refresh rate, that is, the number of times the screen is updated per second. The electronic device needs to update the screen display content according to a predetermined refresh rate. When the screen frame rate is switched, a new display image needs to be synthesized for display. A user's swiping operation on the screen can trigger a screen state change instruction, as can switching the screen frame rate. Of course, screen state change instructions can also be set to trigger at a preset period. In one example, screen state change instructions can be triggered in real time to refresh the screen. Additionally, since screen state change instructions can include changes to the screen display content and changes to the screen display brightness, screen state change instructions are also triggered during the screen's on / off transition. When the electronic terminal device detects a screen state change instruction, it needs to determine whether the first variable in the user space is an initial value. This initial value is any non-positive number; in one example, the initial value of the first variable can be set to -1. The first variable is a member variable of the corresponding object in user space.

[0097] S202. If not, obtain the value of the first variable to get the maximum screen brightness value.

[0098] If the value of the first variable in user space is not the initial value, then the value of the first variable is obtained to get the maximum screen brightness value.

[0099] S203. If so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

[0100] If the value of the first variable in user space is the initial value, then kernel space needs to be accessed to obtain the maximum screen brightness value from the virtual file system in kernel space. Specifically, the electronic device will obtain the maximum screen brightness value from the virtual file node / sys / class / backlight / panelx-backlight / max_brightness under the sysfs system, and after obtaining the maximum screen brightness value, assign this value to the first variable.

[0101] In this embodiment, when a screen state change instruction is detected, it is first determined whether the maximum screen brightness value is cached in the user space. If the maximum screen brightness value is cached, it can be obtained directly without accessing the kernel space. If the maximum screen brightness value is not cached, it means that this is the first time the electronic terminal device has requested the maximum screen brightness value, so it is necessary to access the kernel space to obtain the maximum screen brightness value. After obtaining the maximum screen brightness value, the value is assigned to the first variable in the user space, thus caching the maximum screen brightness value in the user space. In this way, when the maximum screen brightness value is requested again in the future, the value of the first variable can be used directly, avoiding access to the kernel space. The solution of this application only needs to access the kernel space once, which reduces the time required to obtain the maximum brightness currently supported by the screen.

[0102] In one example, the electronic terminal device includes a SurfaceFlinger module and a Composer module. When a screen state change command is detected, it determines whether the first variable in the user space is at its initial value. (See [link to relevant documentation]). Figure 4 ,include:

[0103] S301. After receiving the screen state change instruction sent by the SurfaceFlinger module through Binder, the Composer module calls the screen maximum brightness acquisition interface.

[0104] The SurfaceFlinger module can perform operations such as switching screen frame rates to change screen states. After performing these operations, it notifies the Composer module via Binder, triggering the Composer module to call the maximum screen brightness acquisition interface. Binder is an inter-process communication mechanism, and the Composer module is a crucial component of the Android operating system, responsible for managing the composition of the graphical user interface. It composites, scales, and blends images from various applications, displaying them on the screen to ensure a smooth user interface experience. Layers corresponding to the status bar, wallpaper, navigation bar, and notification bar can all become objects manipulated by the Composer module. When a screen state change instruction is detected, the Composer module calls the maximum screen brightness acquisition interface, which can be `getHWPanelMaxBrightness()`, a function that retrieves the maximum screen brightness value.

[0105] S302, The Composer module determines whether the first variable in the user space is an initial value through the screen maximum brightness acquisition interface.

[0106] After the Composer module calls the screen maximum brightness acquisition interface, it uses the screen maximum brightness acquisition interface to determine whether the first variable in the user space is the initial value.

[0107] The above-mentioned method of obtaining the value of the first variable to obtain the maximum screen brightness value includes:

[0108] S303. The Composer module obtains the value of the first variable and gets the maximum screen brightness value.

[0109] When the screen maximum brightness acquisition interface determines that the first variable in the user space is not the initial value, the Composer module obtains the value of the first variable and gets the screen maximum brightness value.

[0110] In this embodiment of the application, when a screen state change instruction is detected, the Composer module calls the screen maximum brightness acquisition interface and determines whether the first variable in the user space is the initial value through the screen maximum brightness acquisition interface. If the first variable is not the initial value, the value of the first variable is obtained to get the screen maximum brightness value, thus avoiding access to the kernel space and greatly reducing the time to obtain the screen maximum brightness value.

[0111] In one example, obtaining the maximum screen brightness value from kernel space includes:

[0112] Step 1: After calling the screen maximum brightness acquisition interface, the Composer module obtains the pre-created file descriptor;

[0113] Step 2: The Composer module accesses the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0114] After the Composer module calls the screen maximum brightness acquisition interface, the system will allocate an fd (file descriptor) for this system call to access the virtual file system in kernel space.

[0115] In this embodiment of the application, when the first variable in the user space is an initial value, the Composer module will access the kernel space through the file descriptor to obtain the maximum screen brightness value, so that the maximum screen brightness acquisition interface receives a correct response.

[0116] In one example, the kernel space includes a virtual file system, which includes a maximum screen brightness value. Accessing the kernel space through the file descriptor to obtain the maximum screen brightness value includes:

[0117] The Composer module accesses the virtual file system in the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0118] The virtual file system can be a sysfs system, in which the maximum screen brightness value is stored in the directory / sys / class / backlight / panelx-backlight / max_brightness. The Composer module can access the / sys / class / backlight / panelx-backlight / max_brightness node through the file descriptor to obtain the maximum screen brightness value.

[0119] In this embodiment of the application, when the first variable in the user space is an initial value, the Composer module accesses the virtual file system through the file descriptor to obtain the maximum screen brightness value, so that the maximum screen brightness acquisition interface receives a correct response.

[0120] In one example, the Composer module releases a signal to reclaim the file descriptor after obtaining the maximum screen brightness value.

[0121] After obtaining the maximum screen brightness value, the Composer module no longer needs file descriptors. Therefore, it can release a signal to reclaim the file descriptors. Upon receiving this signal, the system can reclaim and destroy the file descriptors.

[0122] In this embodiment of the application, the file descriptor is promptly reclaimed after the maximum screen brightness value is obtained, which can save system resources.

[0123] In one example, the above method also includes:

[0124] The Composer module receives the preprocessed layer units sent by the SurfaceFlinger module;

[0125] The Composer module changes the screen display state based on the layer unit and the maximum screen brightness value.

[0126] The electronic terminal device includes a SurfaceFlinger module and a Composer module. The SurfaceFlinger module can perform screen state change operations such as switching frame rates and informs the Composer module via Binder, triggering the Composer module to execute a call to the screen maximum brightness acquisition interface. Binder is an inter-process communication mechanism. SurfaceFlinger is responsible for preprocessing display layer information and sending it to the Composer module for compositing. The SurfaceFlinger module sends the selected layer units (which may include the status bar, navigation bar, wallpaper, and launcher icon layer) to the Composer module. The Composer module can adjust the screen display content or screen brightness based on the layer units and the screen maximum brightness value, thereby changing the screen display state.

[0127] In this embodiment, through the collaborative action of the Composer module and the SurfaceFlinger module, the Composer module performs image composition based on the layer units sent by the SurfaceFlinger module and the maximum screen brightness value, thereby changing the screen display state.

[0128] In one example, the relevant technology obtains the maximum screen brightness value in the following way: Figure 5As shown, after calling the `getHWPanelMaxBrightness` interface to obtain the maximum screen brightness, the virtual file node ` / sys / class / backlight / panelx-backlight / max_brightness` is opened, the maximum screen brightness value is read and used, and finally the ` / sys / class / backlight / panelx-backlight / max_brightness` virtual file node is closed. If the maximum screen brightness acquisition interface is called again, the above steps are repeated. It can be seen that in related technologies, obtaining the maximum screen brightness value requires accessing the virtual file system. If the system load is high at this time, it will cause severe memory read / write blocking. When accessing the virtual file system, the thread remains in an Uninterrupted Sleep state, severely blocking the execution of the composite display task.

[0129] In one example, the method for obtaining the maximum screen brightness value in this application embodiment is as follows: Figure 6 As shown, after calling the `getHWPanelMaxBrightness` interface to obtain the maximum screen brightness, it first checks whether the variable used for caching is an initial value. If it is not an initial value, the cached maximum brightness value is used directly. If it is an initial value, the virtual file system is accessed, the ` / sys / class / backlight / panelx-backlight / max_brightness` virtual file node is opened, the maximum screen brightness value is read and used, and the maximum screen brightness value is assigned to the cached variable. Finally, the ` / sys / class / backlight / panelx-backlight / max_brightness` virtual file node is closed. If the maximum screen brightness acquisition interface is called again, since the result of the check for whether the cached variable is an initial value is no, the cached maximum brightness value can be used directly without accessing the virtual file system. This embodiment avoids performance instability caused by excessive access to the virtual file system by caching the maximum screen brightness value obtained from the virtual file node. This application embodiment only needs to access the virtual file system once. After accessing the virtual file system, the maximum screen brightness value is cached in the user space. When there is a need to obtain the maximum screen brightness value again, it can be obtained directly from the cache, which greatly reduces the time to obtain the maximum screen brightness value. The running efficiency of calling the maximum screen brightness acquisition interface is significantly improved, and the robustness of the display subsystem under high system load is effectively improved.

[0130] Secondly, this application provides a device for obtaining the maximum brightness supported by the screen, applied to electronic terminal devices based on Qualcomm chip platforms, see [link to relevant documentation]. Figure 7 The device includes:

[0131] The judgment module 401 is used to determine whether the first variable in the user space is the initial value when a screen state change instruction is detected;

[0132] The first variable access module 402 is used to obtain the value of the first variable if no, and then obtain the maximum screen brightness value.

[0133] The kernel space access module 403 is used to, if so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

[0134] In one possible embodiment, the electronic terminal device includes a SurfaceFlinger module and a Composer module, and the determination module includes:

[0135] The calling module is used so that after the Composer module receives the screen state change instruction sent by the SurfaceFlinger module through Binder, the Composer module calls the screen maximum brightness acquisition interface.

[0136] The sub-judgment module is used by the Cmposer module to determine whether the first variable in the user space is an initial value through the screen maximum brightness acquisition interface;

[0137] The first variable access module is specifically used by the Composer module to obtain the value of the first variable and thus obtain the maximum screen brightness value.

[0138] In one possible embodiment, the kernel space access module includes:

[0139] The file descriptor acquisition module is used by the Composer module to acquire a pre-created file descriptor after calling the screen maximum brightness acquisition interface.

[0140] The file descriptor access module is used by the Composer module to access the kernel space through the file descriptor and obtain the maximum screen brightness value.

[0141] In one possible embodiment, the kernel space includes a virtual file system, which includes a maximum screen brightness value. The file descriptor access module is specifically used by the Composer module to access the virtual file system under the kernel space through the file descriptor to obtain the maximum screen brightness value.

[0142] In one possible embodiment, the device further includes:

[0143] The file descriptor release module is used by the Composer module to release a signal to reclaim the file descriptor after obtaining the maximum screen brightness value.

[0144] In one possible embodiment, the initial value of the first variable is a non-positive number.

[0145] In one possible embodiment, the device further includes:

[0146] A layer unit receiving module is used for the Composer module to receive preprocessed layer units sent by the SurfaceFlinger module;

[0147] The display module is used by the Composer module to change the screen display state according to the layer unit and the maximum screen brightness value.

[0148] In a third aspect of this application, an electronic device is provided, comprising:

[0149] One or more processors and memory;

[0150] The memory is coupled to the one or more processors. The memory stores computer program code, including computer instructions. The one or more processors invoke the computer instructions to cause the electronic device to perform any of the steps of the method described above for obtaining the maximum brightness supported by the screen. The structure of this electronic device can be found in [reference needed]. Figure 1 This will not be elaborated upon here.

[0151] In a fourth aspect of this application, a computer-readable storage medium is provided, including a computer program that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described above for obtaining the maximum brightness supported by the screen.

[0152] This application also provides a computer program product that, when run on a computer, causes the computer to perform the method steps for obtaining the maximum brightness supported by the screen as described in any of the above embodiments.

[0153] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0154] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and electronic device embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0155] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A method for obtaining the maximum supported brightness of a screen, characterized in that, An electronic terminal device based on a Qualcomm chip platform, the electronic terminal device including a SurfaceFlinger module and a Composer module, the method comprising: After receiving the screen state change instruction sent by the SurfaceFlinger module via Binder, the Composer module calls the screen maximum brightness acquisition interface; the Composer module uses the screen maximum brightness acquisition interface to determine whether the first variable in the user space is an initial value; the initial value is a non-positive number; If not, the Composer module obtains the value of the first variable and gets the maximum screen brightness value; If so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

2. The method according to claim 1, characterized in that, Obtaining the maximum screen brightness value from the kernel space includes: After calling the screen maximum brightness acquisition interface, the Composer module obtains a pre-created file descriptor; The Composer module accesses the kernel space through the file descriptor to obtain the maximum screen brightness value.

3. The method according to claim 2, characterized in that, The kernel space includes a virtual file system, which includes a maximum screen brightness value. Accessing the kernel space through the file descriptor to obtain the maximum screen brightness value includes: The Composer module accesses the virtual file system in the kernel space through the file descriptor to obtain the maximum screen brightness value.

4. The method according to claim 3, characterized in that, The method further includes: After obtaining the maximum screen brightness value, the Composer module releases a signal to reclaim the file descriptor.

5. The method according to claim 3, characterized in that, The method further includes: The Composer module receives the preprocessed layer units sent by the SurfaceFlinger module; The Composer module changes the screen display state based on the layer unit and the maximum screen brightness value.

6. A device for obtaining the maximum brightness supported by a screen, characterized in that, An electronic terminal device based on a Qualcomm chip platform, the electronic terminal device including a SurfaceFlinger module and a Composer module, the device comprising: The judgment module includes: a calling module, used to call the Composer module to call the screen maximum brightness acquisition interface after the Composer module receives the screen state change instruction sent by the SurfaceFlinger module through Binder; and a sub-judgment module, used to call the Composer module to determine whether the first variable in the user space is an initial value through the screen maximum brightness acquisition interface; wherein the initial value is a non-positive number. The first variable access module is used to call the Composer module to obtain the value of the first variable and get the maximum screen brightness value if no. The kernel space access module is used to, if so, obtain the maximum screen brightness value from the kernel space and assign the maximum screen brightness value to the first variable.

7. An electronic device, characterized in that, include: One or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors calling the computer instructions to cause the electronic device to perform the method of obtaining the maximum brightness supported by the screen as claimed in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, Includes a computer program that, when run on an electronic device, causes the electronic device to perform the method for obtaining the maximum brightness supported by the screen as described in any one of claims 1 to 5.