Eye protection mode generation method and device in application program and related medium

By creating a top-level sub-window in the application and calculating the eye protection parameters based on user configuration and ambient light sensor data, the dynamic adjustment problem of the existing eye protection mode in complex interactive scenarios is solved, and the eye protection mode is accurately presented and the user experience is guaranteed in multi-window or split-screen scenarios.

CN120686997AActive Publication Date: 2025-09-23SHENZHEN KINGSUN SCIENCE & TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510809729.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-09-23
Estimated Expiration
2045-06-17

AI Technical Summary

Technical Problem

The existing eye protection mode cannot be dynamically adjusted in complex interactive scenarios and lacks personalized support, resulting in display abnormalities and functional conflicts.

Method used

By obtaining the main window of the application, creating the topmost child window, and combining user configuration data and ambient light sensor data to calculate eye protection parameters, the position and size of the child window are adjusted to adapt to multi-window or split-screen scenarios.

Benefits of technology

It realizes dynamic adjustment of the eye protection mode in complex interactive scenarios, improves the flexibility and adaptability of the user experience, and avoids display anomalies and functional conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120686997A_ABST
    Figure CN120686997A_ABST
Patent Text Reader

Abstract

The invention discloses an eye protection mode generation method and device in an application program and a related medium, and the method comprises the steps: obtaining a main window of a current application program through a window management interface, and creating a sub-window based on the main window; respectively acquiring user configuration data and ambient light sensor data, and calculating eye protection parameters in an eye protection mode based on the user configuration data and the ambient light sensor data; the eye protection parameters are used as rendering content to be overlaid in the sub-windows, and the sub-windows are adjusted to cover the main window; and adjusting the position and the size of the sub-window according to the window size change information so as to match the visible area of the main window, and generating new eye protection parameters at the same time. According to the invention, the eye protection parameters are superposed in the sub-window, the sub-window is adjusted to cover the main window, and the position and the size of the sub-window can be adjusted according to the window size change information in a multi-window or split-screen scene, so that the eye protection mode can be dynamically adjusted in a complex interaction scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart terminal technology, and in particular to a method and device for generating an eye protection mode within an application program, and related media. Background Art

[0002] Existing eye protection modes typically use a system-wide control approach, which prevents granular management of specific applications or interfaces (such as video playback pages). This makes it difficult for users to flexibly enable and disable eye protection in different usage scenarios, resulting in a relatively coarse control granularity. Furthermore, current eye protection modes lack support for user-defined preferences and cannot dynamically adjust based on user-defined color parameters or real-time ambient light intensity. This lack of flexibility is particularly prone to display anomalies or functional conflicts in complex interactive scenarios such as multi-window and split-screen displays. Summary of the Invention

[0003] The embodiments of the present invention provide a method, device and related medium for generating an eye protection mode within an application, aiming to solve the problem in the prior art that the eye protection mode cannot be dynamically adjusted in complex interactive scenarios.

[0004] In a first aspect, an embodiment of the present invention provides a method for generating an eye protection mode within an application, comprising:

[0005] Get the main window of the current application through the window management interface to determine the window where the eye protection effect is applied;

[0006] Create a sub-window based on the main window, and set the hierarchy attribute of the sub-window to the topmost layer;

[0007] Obtaining user configuration data and ambient light sensor data respectively, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data;

[0008] Overlaying the eye protection parameters as rendering content in the sub-window, and adjusting the sub-window to cover the main window;

[0009] In a multi-window or split-screen scenario, the position and size of the sub-window are adjusted according to the window size change information to match the visible area of ​​the main window, and new eye protection parameters are generated at the same time.

[0010] In a second aspect, an embodiment of the present invention provides an eye protection mode generation device within an application, comprising:

[0011] The main window establishment unit is used to obtain the main window of the current application through the window management interface to determine the window in which the eye protection effect is applied;

[0012] A sub-window creation unit, configured to create a sub-window based on the main window and set the hierarchy attribute of the sub-window to be the topmost layer;

[0013] a parameter configuration unit, configured to obtain user configuration data and ambient light sensor data respectively, and calculate eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data;

[0014] a parameter superimposing unit, configured to superimpose the eye protection parameters as rendering content on the sub-window, and adjust the sub-window to cover the main window;

[0015] The parameter output unit is used to adjust the position and size of the sub-window according to the window size change information in a multi-window or split-screen scenario to match the visible area of ​​the main window, and generate new eye protection parameters at the same time.

[0016] In a third aspect, an embodiment of the present invention provides a computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating an eye protection mode within an application according to the first aspect is implemented.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for generating an eye protection mode in an application according to the first aspect is implemented.

[0018] An embodiment of the present invention provides a method for generating an eye protection mode within an application, comprising obtaining the main window of the current application through a window management interface to determine the window in which the eye protection effect is applied; creating a subwindow based on the main window and setting the subwindow's hierarchy attribute to the topmost layer; obtaining user configuration data and ambient light sensor data, respectively, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data; overlaying the eye protection parameters as rendering content in the subwindow, and adjusting the subwindow to cover the main window; and in a multi-window or split-screen scenario, adjusting the position and size of the subwindow based on window size change information to match the visible area of ​​the main window, while simultaneously generating new eye protection parameters. The present invention overlays the eye protection parameters in the subwindow and adjusts the subwindow to cover the main window. In a multi-window or split-screen scenario, the position and size of the subwindow can also be adjusted based on window size change information. In this way, the eye protection mode can be dynamically adjusted in complex interactive scenarios.

[0019] An embodiment of the present invention also provides an eye protection mode generation device, a computer device, and a storage medium within an application program, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 A flowchart of a method for generating an eye protection mode within an application provided by an embodiment of the present invention;

[0022] Figure 2 A schematic block diagram of a device for generating an eye protection mode within an application provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0024] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0025] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0026] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0027] See below Figure 1 , Figure 1 A flowchart of a method for generating an eye protection mode within an application provided by an embodiment of the present invention specifically includes steps S101 to S105.

[0028] S101. Obtain the main window of the current application through the window management interface to determine the window in which the eye protection effect is applied;

[0029] S102, creating a sub-window based on the main window, and setting the hierarchy attribute of the sub-window to the topmost layer;

[0030] S103, respectively obtaining user configuration data and ambient light sensor data, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data;

[0031] S104, overlaying the eye protection parameters as rendering content in the sub-window, and adjusting the sub-window to cover the main window;

[0032] S105. In a multi-window or split-screen scenario, adjust the position and size of the sub-window according to the window size change information to match the visible area of ​​the main window, and generate new eye protection parameters.

[0033] The present invention takes the Hongmeng system as an example for introduction, and other systems can also be applied to this method (such as the Android system).

[0034] In step S101, when the application is started or the user enables the eye protection mode, the WindowStageAPI interface (i.e., window management interface) provided by the Hongmeng system can be called to obtain the main window windowStage instance of the current application. The window handle and its related properties can be further obtained through the windowStage instance as the basis for subsequent creation of child windows. The main window object, as the target of the eye protection effect, will be used to determine the additional scope and coverage priority of the eye protection layer.

[0035] In step S102, the createSubWindow method is called using the main window object to create a new subwindow (such as eye_windowClass). In addition, to ensure that the display priority of the eye protection subwindow is not blocked by other interface components, its level attribute is set to the top layer, i.e., top-level window.

[0036] In one embodiment, step S102 includes:

[0037] Creating a sub-window function through the window management interface, and creating a sub-window on the main window using the sub-window function;

[0038] Calling a touch interface to set the sub-window to be non-touchable;

[0039] The full-screen coverage layout interface is called to set the layout of the sub-window to full-screen coverage and adjust the level to the topmost level.

[0040] In this embodiment, the application first creates an eye protection subwindow function in the Ability entry class (e.g., EntryAbility) using the windowStage.createSubWindow() method. This method, provided by HarmonyOS, is a standard window management interface. When calling this method, you pass in the window name (e.g., "EyeWindow") and corresponding parameters. The system returns a subwindow object (e.g., eye_windowClass). This subwindow object is attached to the current main window, hosting the eye protection display layer. Its lifecycle is managed synchronously with the main window.

[0041] To ensure that users can continue to operate the original application interface normally after enabling eye comfort mode and to prevent the child window from blocking or intercepting touch events, call the setWindowTouchable(false) method of the child window object (the touch interface) to set its interactive properties to non-touchable. This setting ensures that the child window exists only as a visual overlay and cannot respond to user input, thereby ensuring that the original operational logic of the main window controls is not disrupted.

[0042] Subsequently, the application calls the setWindowLayoutFullScreen(true) method of the child window object (i.e., the full-screen coverage layout interface) to expand its layout range to the full-screen area of ​​the main window, achieving visual coverage of the entire application interface. At the same time, the system defaults to raising the display level of the child window to the top layer to ensure that its rendered content is not obscured by other window elements. To complete the final eye protection interface rendering, the application can also call setUIContent(path: string, callback: AsyncCallback <void>)ˋ method to set the specific content page for the child window.

[0043] In step S103, user-configured data, including color temperature preference, RGB color values, transparency, and coverage, is available through the graphical interface provided by the ArkUI component. Ambient light sensor data, including ambient light intensity and the system-calculated current color temperature, is acquired in real time by calling the sensor.on interface. The application uses this combined data to dynamically calculate optimal eye protection parameters for the current scenario. These parameters include the target color temperature, color channel values, and transparency of the eye protection layer.

[0044] In one embodiment, step S103 includes:

[0045] Read the light adaptation configuration and enable the ambient light sensor;

[0046] Enable the ambient light sensor monitoring function of the target device through the singleton management class and set the monitoring time interval;

[0047] Acquiring ambient light sensor data using the ambient light sensor, and fine-tuning the ambient light sensor data with the basic color parameters in the user configuration data to obtain color fine-tuning data;

[0048] The color fine-tuning data is dynamically adjusted based on a preset color temperature segmentation algorithm to generate eye protection parameters adapted to current ambient lighting conditions.

[0049] In this embodiment, when the user turns on eye protection mode, the application first determines whether the light sensing adaptive function is enabled. This function configuration can be operated through graphical controls (such as a switch button) in the user settings interface and is persistently stored in a distributed database (DistributedDataStore). When the eye protection mode is started or the application is restarted, the system reads the light sensing adaptive flag in the user configuration item. If it is detected that the user has turned on this function, the subsequent light sensing acquisition process is entered.

[0050] To avoid wasting system resources and ensure consistent data collection logic, the application initiates the ambient light sensor monitoring task through a singleton management class. Call the sensor.on(sensor.SensorId.AMBIENT_LIGHT, callback, options) method to register the ambient light sensor's event listener. The callback receives the ambient light data (LightResponse), and the options parameter sets an interval value (such as 200,000,000 nanoseconds) to control the sampling frequency. This mechanism ensures representative ambient data during storage and calculation without significantly impacting device performance.

[0051] After receiving the ambient light sensor data, it is verified for validity. Combined with the basic color parameters preset by the user in the eye protection mode, the color value is fine-tuned through the built-in color fusion algorithm. The adjustment content includes RGB channel intensity and transparency to generate a preliminary color expression result that is closer to the current ambient lighting conditions, namely the color fine-tuning data.

[0052] The system's built-in color temperature segmentation algorithm is used to perform secondary processing on the above color fine-tuning data to improve the adaptation accuracy. Specifically, when the collected color temperature value is ≤6600K (i.e., temp≤66), it is considered that the current light environment is warm or neutral, suitable for soft tones such as red and yellow. The system will appropriately reduce the proportion of the blue light channel to increase the temperature of the eye protection layer; when the color temperature value is >6600K (i.e., temp>66), it means that the current ambient light is strong or cold, suitable for cold tones such as white and blue. The system will enhance the proportion of the blue channel to match the requirements of strong light scenes. After the above segmentation processing, the generated eye protection parameters include the final RGB value, color temperature parameters, transparency level, etc., which are used to guide the real-time rendering of the eye protection sub-window.

[0053] In one embodiment, the color fine-tuning data is dynamically adjusted based on a preset color temperature segmentation algorithm to generate eye protection parameters adapted to current ambient lighting conditions, including:

[0054] Normalizing the color temperature value in the ambient light sensor data to obtain a color temperature normalized variable;

[0055] Based on the color temperature normalization variable and the color fine-tuning data, the value of each color channel is calculated according to a preset color temperature segmentation rule to obtain color temperature data;

[0056] When the color temperature data is less than or equal to a preset threshold, the red channel is kept unchanged, the green channel is adjusted using a logarithmic function, and the blue channel is determined based on the normalized variable whether to retain or perform logarithmic adjustment;

[0057] When the color temperature data is greater than the preset threshold, the red channel and the green channel are respectively adjusted using a power function, and the blue channel remains unchanged;

[0058] Combine the values of all the red channels, green channels, and blue channels as the eye protection parameters adapted to the current ambient light conditions.

[0059] In this embodiment, after obtaining the color temperature value in the ambient light sensor data, a normalization processing operation needs to be performed. This processing linearly maps the color temperature value to a preset normalization interval (such as 0 to 100) to obtain a unified color temperature normalization variable. When the ambient light sensor data is missing or abnormal, the system can set a default color temperature value (such as 4000K), and the corresponding normalization variable is 40.

[0060] The color temperature threshold can be preset to 6600K, and the corresponding normalization variable threshold is 66. According to this boundary, the color temperature data is divided into a low and medium range (temp ≤ 66) and a high color temperature range (temp > 66). The system takes the color fine-tuning data as the basic input and processes the three color channels (R, G, B) through different algorithm logics respectively to generate color temperature data that fits the actual environment.

[0061] When temp ≤ 66 (i.e., color temperature ≤ 6600K), the system believes that the ambient light is warm or a natural light source, suitable for night or reading scenarios, emphasizing soft tones (such as red and yellow). At this time, the red channel remains unchanged to maintain the soft light foundation; the green channel is adjusted using a logarithmic function to enhance visual softness; the blue channel is further judged whether to be adjusted according to the temp value: if temp ≤ 50, a logarithmic attenuation is applied to the blue channel to weaken the blue light intensity; if 50 < temp ≤ 66, the blue channel remains the original value or undergoes a slight smoothing process.

[0062] When temp > 66 (i.e., color temperature > 6600K), the system judges that the current is in a strong light or high-brightness environment, such as sunlight or an outdoor work scenario. At this time, the red channel is weakened using a power function to reduce the influence of warm colors; the green channel is also adjusted using a power function to balance the brightness perception; the blue channel remains unchanged to enhance the overall cold color tone adaptability and support the focus and high-brightness visual needs.

[0063] Finally, the adjusted values (R, G, B) of the above three color channels and the transparency parameter together form an eye protection parameter object for rendering in the eye protection sub-window. The generated eye protection parameters can automatically match the color tone preference according to the ambient light change, achieving an intelligent visual adaptation effect of being warmer at night and colder during the day, significantly enhancing the naturalness and comfort of the eye protection experience.

[0064] In step S104, after obtaining the eye protection parameters, the setUIContent method of the subwindow object is called to render the eye protection color value layer as graphical interface content, and its display style is set to a semi-transparent mask. By adjusting the color and transparency of the subwindow content, it forms a flexible cover for the main window's visual content, achieving an eye protection effect. The display interface can then be called to overlay the subwindow on the main window, without affecting the interaction and display logic of the original main window content.

[0065] In step S105, when the system is in multitasking or split-screen mode, the size of the main window may change dynamically as the user drags or splits the screen. To ensure that the eye protection effect always covers the visible area of ​​the main window, the position and size of the eye protection sub-window need to be dynamically adjusted. At the same time, the eye protection parameters are recalculated based on the new window size and environmental conditions to ensure that the presented eye protection layer still has good adaptability and visual comfort.

[0066] In one embodiment, step S105 includes:

[0067] When the main window is in multi-window or split-screen mode, monitoring the size change event of the main window;

[0068] Utilizing the size change event, obtaining the window size change information of the main window after being updated;

[0069] Based on the window size change information, calling a sub-window position adjustment interface to move the position of the sub-window to obtain position information;

[0070] Calling the sub-window size adjustment interface to reset the width and height of the sub-window to match the visible area of ​​the main window and obtain size information;

[0071] Based on the position information and the size information, the eye protection parameters are recalculated to adapt to the current display area, and new eye protection parameters are obtained.

[0072] In this embodiment, when an application runs in a multi-window environment (such as split-screen display or free-dragging window mode) of the Hongmeng system, the size of the main window may change in real time due to user operations. To promptly detect such changes, the application registers a size listening event through the main window instance (windowClass). This listening event can capture notification events of changes in window width, height, or position, ensuring that the system can respond to size updates and receive size change events in the first place.

[0073] When the above listener event is triggered, the system retrieves the updated size change information (width, height) from the callback function. This size change information, provided by the system event parameter 'data', represents the actual area occupied by the main window on the display screen and serves as the basis for adjusting the display range of subwindows. Based on this window size change information, the subwindow position adjustment API can be called to move the subwindow to the new position of the main window. This method is executed asynchronously to ensure smooth transitions between subwindows during interface refreshes. The resulting position information serves as a reference for subsequent rendering parameters.

[0074] Furthermore, calling the resizeAsync(width:number,height:number) method (the sub-window resizing API) resets the width and height of the eye protection sub-window to the current display range of the main window, maintaining full consistency between the eye protection layer and the main window's visible area. The resulting new size information (width,height) can be used to update the rendering layer size, preventing issues like mask boundary misalignment and missing parts.

[0075] After moving and resizing the subwindow, the eye protection parameters are re-evaluated based on the updated display area. For example, the color temperature adaptation value of the masked area is recalculated, and transparency or color intensity is fine-tuned based on the window scale. The regenerated eye protection parameters serve as input for the next round of UI rendering, ensuring consistent and comfortable eye protection across different window sizes.

[0076] To sum up, this embodiment effectively realizes the adaptive coverage of the eye protection sub-window in a multi-window environment by real-time monitoring of the changes in the main window size and dynamic adjustment of the sub-window position and size, and updates the eye protection parameters in combination with the position information and size information, thereby realizing the accurate presentation of the eye protection mode in complex window scenarios and ensuring user experience.

[0077] In one embodiment, the method for generating an eye protection mode in an application further includes:

[0078] Storing the new eye protection parameters in a distributed database;

[0079] Responding to eye protection mode configuration requests from users on different devices to synchronize eye protection parameters in the distributed database to target devices;

[0080] During the process of opening the eye protection mode, monitoring the creation status of the sub-window, and if a creation failure is detected, triggering the exception handling module to enable a downgrade solution or prompt the user;

[0081] When an eye protection mode closing instruction is received or the target device is detected to be in a low power consumption operation state, the data acquisition of the user configuration data and the ambient light sensor data is closed, and the sub-window is destroyed to release system resources.

[0082] In this embodiment, eye protection parameters generated based on user configuration data and ambient light sensor data are persistently stored in a distributed database (DistributedDataStore). Specifically, an application can create a distributed KV manager by calling the distributedKVStore.createKVManager method, define the eye protection configuration data structure schema, and write the eye protection parameters as key-value pairs to a specified namespace (such as "EyeWindowConfig"). This process ensures that the eye protection parameters are automatically restored or reused when the application is restarted on the current device or migrated to another device.

[0083] When a user enables eye protection mode in a cross-device scenario (such as switching from a phone to a tablet or PC), the system retrieves a list of available devices in the same network environment and performs distributed data synchronization based on the target device selected by the user. The application calls the kvStore.sync method and specifies the SyncMode.PUSH_ONLY mode to push the locally stored eye protection parameters to the target device. After receiving the data, the target device reads the eye protection parameters through the corresponding interface and creates or adjusts the eye protection sub-window accordingly, ensuring consistent visual protection across terminals.

[0084] To ensure the stable operation of the eye protection function under various system conditions, the application needs to monitor the status information during the sub-window creation process, such as whether the window object is successfully instantiated and whether the UI content is rendered normally. If a sub-window creation failure is detected (for example, insufficient system resources, abnormal window permissions), the exception handling module will be automatically called. On the one hand, the exception handling module can enable degradation solutions (such as adjusting display priority, trying partial masking methods), and on the other hand, it can prompt the user through the UI that the current eye protection function is limited, and record relevant error logs for subsequent troubleshooting and optimization.

[0085] When the user actively turns off eye protection mode through the settings interface, or the system detects that the device has entered low-power mode (for example, by calling power.getPowerMode to determine the current power consumption policy), the system will stop monitoring the ambient light sensor data (calling sensor.off) and stop reading user configuration data from the distributed database. Subsequently, the destroyWindow interface is called to destroy the eye protection sub-window, releasing related graphics resources and memory usage to reduce system energy consumption and optimize overall performance. At the same time, the system can record the shutdown behavior and cache the last eye protection parameters for subsequent restoration when re-enabled.

[0086] In one embodiment, storing the new eye protection parameters in a distributed database includes:

[0087] Create a data storage object and generate a database schema for storing protection parameters;

[0088] Setting an index field in the database schema for describing eye protection parameters;

[0089] Configuring database option parameters based on the index fields and preset security level requirements;

[0090] Calling a database acquisition interface to obtain a database instance, and assigning the database instance to the data storage object;

[0091] A data write operation is performed using the data storage object to store the new eye protection parameters in a distributed database.

[0092] In this example, a distributed database management object, kvManager (i.e., a data storage object), is created. This management object serves as a unified storage entry point, managing subsequent data structure initialization and database access processes. A new database schema is constructed to define the structure hierarchy and field configuration of the protection parameters. A parameter node is set in the schema to determine the root path of the protection parameter storage structure.

[0093] To improve data access efficiency and support multi-dimensional queries, the schema further defines index fields for eye protection parameters. These include, but are not limited to, color value parameters, brightness, color temperature, transparency, size, and position. These fields can be assigned to the schema as arrays, enabling structured management and efficient querying of eye protection parameters.

[0094] After the Schema object is constructed, the database options (Options) must be configured based on the data security level and automatic synchronization requirements. In this example, a distributedKVStore.Options object is created and the following parameters are set: autoSync is set to false (i.e., automatic synchronization mode is turned off to control synchronization timing); schema is the schema instance defined above; and securityLevel is set to distributedKVStore.SecurityLevel.S3, indicating the use of a higher level of storage encryption to ensure the security of user privacy data.

[0095] Furthermore, calling the kvManager.getKVStore() method, passing in the dataspace name (e.g., "EyeWindowConfig") and the configured options parameter, asynchronously retrieves the corresponding distributed database instance (store). When the callback function executes successfully, the store instance is assigned to the predefined data storage object (this.kvStore) for subsequent read and write operations.

[0096] After completing the above initialization steps, the application can call the `this.kvStore.put('EyeWindowConfig', userConfigData)` method to write the currently generated eye protection parameters to the distributed database. `userConfigData` is a structured, encoded object containing multiple fields such as color temperature, RGB values, and transparency. Once the data is written, the eye protection configuration can be read and reused during subsequent application launches or device synchronization, ensuring persistent and consistent eye protection mode across devices.

[0097] Combine Figure 2 As shown, Figure 2 This is a schematic block diagram of an apparatus for generating an eye protection mode within an application provided by an embodiment of the present invention. The apparatus 200 for generating an eye protection mode within an application includes:

[0098] The main window establishment unit 201 is used to obtain the main window of the current application through the window management interface to determine the window where the eye protection effect is applied;

[0099] A sub-window creation unit 202 is configured to create a sub-window based on the main window and set the hierarchy attribute of the sub-window to be the topmost layer;

[0100] a parameter configuration unit 203 for respectively acquiring user configuration data and ambient light sensor data, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data;

[0101] a parameter superimposing unit 204, configured to superimpose the eye protection parameters as rendering content on the sub-window, and adjust the sub-window to cover the main window;

[0102] The parameter output unit 205 is used to adjust the position and size of the sub-window according to the window size change information in a multi-window or split-screen scenario to match the visible area of ​​the main window, and generate new eye protection parameters.

[0103] In one embodiment, the eye protection mode generating device 200 in the application further includes:

[0104] A parameter storage unit, configured to store the new eye protection parameters in a distributed database;

[0105] a parameter sending unit, configured to respond to a user's eye protection mode configuration request on different devices, so as to synchronize the eye protection parameters in the distributed database to the target device;

[0106] A status monitoring unit is used to monitor the creation status of the sub-window during the activation of the eye protection mode, and if a creation failure is detected, trigger the exception handling module to enable a downgrade solution or prompt the user;

[0107] The resource release unit is used to close the data acquisition of the user configuration data and the ambient light sensor data and destroy the sub-window to release system resources when receiving the eye protection mode closing instruction or detecting that the target device is in a low-power operation state.

[0108] In one embodiment, the parameter storage unit is specifically used to:

[0109] Create a data storage object and generate a database schema for storing protection parameters;

[0110] Setting an index field in the database schema for describing eye protection parameters;

[0111] Configuring database option parameters based on the index fields and preset security level requirements;

[0112] Calling a database acquisition interface to obtain a database instance, and assigning the database instance to the data storage object;

[0113] A data write operation is performed using the data storage object to store the new eye protection parameters in a distributed database.

[0114] In one embodiment, the sub-window establishing unit 202 is specifically configured to:

[0115] Creating a sub-window function through the window management interface, and creating a sub-window on the main window using the sub-window function;

[0116] Calling a touch interface to set the sub-window to be non-touchable;

[0117] The full-screen coverage layout interface is called to set the layout of the sub-window to full-screen coverage and adjust the level to the topmost level.

[0118] In one embodiment, the parameter configuration unit 203 is specifically configured to:

[0119] Read the light adaptation configuration and enable the ambient light sensor;

[0120] Enable the ambient light sensor monitoring function of the target device through the singleton management class and set the monitoring time interval;

[0121] Acquiring ambient light sensor data using the ambient light sensor, and fine-tuning the ambient light sensor data with the basic color parameters in the user configuration data to obtain color fine-tuning data;

[0122] The color fine-tuning data is dynamically adjusted based on a preset color temperature segmentation algorithm to generate eye protection parameters adapted to current ambient lighting conditions.

[0123] In one embodiment, the parameter configuration unit 203 is further specifically configured to:

[0124] Normalizing the color temperature value in the ambient light sensor data to obtain a color temperature normalized variable;

[0125] Based on the color temperature normalization variable and the color fine-tuning data, the value of each color channel is calculated according to a preset color temperature segmentation rule to obtain color temperature data;

[0126] When the color temperature data is less than or equal to a preset threshold, the red channel is kept unchanged, the green channel is adjusted using a logarithmic function, and the blue channel is determined based on the normalized variable whether to retain or perform logarithmic adjustment;

[0127] When the color temperature data is greater than the preset threshold, the red channel and the green channel are adjusted respectively using a power function, while the blue channel remains unchanged;

[0128] The numerical combination of all red channels, green channels and blue channels is used as the eye protection parameter adapted to the current ambient lighting conditions.

[0129] In one embodiment, the parameter output unit 205 is specifically configured to:

[0130] When the main window is in multi-window or split-screen mode, monitoring the size change event of the main window;

[0131] Utilizing the size change event, obtaining the window size change information of the main window after being updated;

[0132] Based on the window size change information, calling a sub-window position adjustment interface to move the position of the sub-window to obtain position information;

[0133] Calling the sub-window size adjustment interface to reset the width and height of the sub-window to match the visible area of ​​the main window and obtain size information;

[0134] Based on the position information and the size information, the eye protection parameters are recalculated to adapt to the current display area, and new eye protection parameters are obtained.

[0135] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, and they will not be repeated here.

[0136] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When executed, the computer program can implement the steps provided in the above embodiments. The storage medium may include a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, among other media capable of storing program code.

[0137] The present invention also provides a computer device that may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, the steps provided in the above embodiment can be implemented. Of course, the computer device may also include various network interfaces, a power supply, and other components.

[0138] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

[0139] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.< / void>

Claims

1. A method for generating an eye protection mode in an application, characterized in that: include: Get the main window of the current application through the window management interface to determine the window where the eye protection effect is applied; Create a sub-window based on the main window, and set the hierarchy attribute of the sub-window to the topmost layer; Obtaining user configuration data and ambient light sensor data respectively, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data; Overlaying the eye protection parameters as rendering content in the sub-window, and adjusting the sub-window to cover the main window; In a multi-window or split-screen scenario, the position and size of the sub-window are adjusted according to the window size change information to match the visible area of ​​the main window, and new eye protection parameters are generated at the same time.

2. The method for generating an eye protection mode in an application according to claim 1, wherein: Also includes: Storing the new eye protection parameters in a distributed database; Responding to eye protection mode configuration requests from users on different devices to synchronize eye protection parameters in the distributed database to target devices; During the process of opening the eye protection mode, monitoring the creation status of the sub-window, and if a creation failure is detected, triggering the exception handling module to enable a downgrade solution or prompt the user; When an eye protection mode closing instruction is received or the target device is detected to be in a low power consumption operation state, the data acquisition of the user configuration data and the ambient light sensor data is closed, and the sub-window is destroyed to release system resources.

3. The method for generating an eye protection mode in an application according to claim 2, wherein: The storing of the new eye protection parameters in a distributed database includes: Create a data storage object and generate a database schema for storing protection parameters; Setting an index field in the database schema for describing eye protection parameters; Configuring database option parameters based on the index fields and preset security level requirements; Calling a database acquisition interface to obtain a database instance, and assigning the database instance to the data storage object; A data write operation is performed using the data storage object to store the new eye protection parameters in a distributed database.

4. The method for generating an eye protection mode in an application according to claim 1, wherein: The step of creating a sub-window based on the main window and setting the hierarchy attribute of the sub-window to the top layer includes: Creating a sub-window function through the window management interface, and creating a sub-window on the main window using the sub-window function; Calling a touch interface to set the sub-window to be non-touchable; The full-screen coverage layout interface is called to set the layout of the sub-window to full-screen coverage and adjust the level to the topmost level.

5. The method for generating an eye protection mode in an application according to claim 1, wherein: The acquiring of user configuration data and ambient light sensor data respectively, and calculating eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data, includes: Read the light adaptation configuration and enable the ambient light sensor; Enable the ambient light sensor monitoring function of the target device through the singleton management class and set the monitoring time interval; Acquiring ambient light sensor data using the ambient light sensor, and fine-tuning the ambient light sensor data with the basic color parameters in the user configuration data to obtain color fine-tuning data; The color fine-tuning data is dynamically adjusted based on a preset color temperature segmentation algorithm to generate eye protection parameters adapted to current ambient lighting conditions.

6. The method for generating an eye protection mode in an application according to claim 5, characterized in that: The color fine-tuning data is dynamically adjusted based on a preset color temperature segmentation algorithm to generate eye protection parameters adapted to current ambient lighting conditions, including: Normalizing the color temperature value in the ambient light sensor data to obtain a color temperature normalized variable; Based on the color temperature normalization variable and the color fine-tuning data, the value of each color channel is calculated according to a preset color temperature segmentation rule to obtain color temperature data; When the color temperature data is less than or equal to a preset threshold, the red channel is kept unchanged, the green channel is adjusted using a logarithmic function, and the blue channel is determined based on the normalized variable whether to retain or perform logarithmic adjustment; When the color temperature data is greater than the preset threshold, the red channel and the green channel are adjusted respectively using a power function, while the blue channel remains unchanged; The numerical combination of all red channels, green channels and blue channels is used as the eye protection parameter adapted to the current ambient lighting conditions.

7. The method for generating an eye protection mode in an application according to claim 1, wherein: The adjusting the position and size of the sub-window according to the window size change information to match the visible area of ​​the main window and generating new eye protection parameters at the same time includes: When the main window is in multi-window or split-screen mode, monitoring the size change event of the main window; Utilizing the size change event, obtaining the window size change information of the main window after being updated; Based on the window size change information, calling a sub-window position adjustment interface to move the position of the sub-window to obtain position information; Calling the sub-window size adjustment interface to reset the width and height of the sub-window to match the visible area of ​​the main window and obtain size information; Based on the position information and the size information, the eye protection parameters are recalculated to adapt to the current display area, and new eye protection parameters are obtained.

8. A device for generating an eye protection mode in an application, characterized in that: include: The main window establishment unit is used to obtain the main window of the current application through the window management interface to determine the window in which the eye protection effect is applied; A sub-window creation unit, configured to create a sub-window based on the main window and set the hierarchy attribute of the sub-window to be the topmost layer; a parameter configuration unit, configured to obtain user configuration data and ambient light sensor data respectively, and calculate eye protection parameters in the eye protection mode based on the user configuration data and the ambient light sensor data; a parameter superimposing unit, configured to superimpose the eye protection parameters as rendering content on the sub-window, and adjust the sub-window to cover the main window; The parameter output unit is used to adjust the position and size of the sub-window according to the window size change information in a multi-window or split-screen scenario to match the visible area of ​​the main window, and generate new eye protection parameters at the same time.

9. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating an eye protection mode in an application program as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating an eye protection mode in an application according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Image overlapping display method and device based on electronic whiteboard, equipment and medium

    CN118779056A

  • Page display method and device, equipment, medium and product

    CN119440348A