Dynamic clock implementation method and device capable of intelligently preventing mistaken cleaning, and terminal
By increasing the priority of the clock application in smart terminals and adding it to the system exemption list, combined with intelligent status judgment and sleep mechanism, the problem of the clock application being easily deleted by mistake has been solved, and the stable operation and smooth display of the clock application have been achieved, improving user experience and system efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-24
AI Technical Summary
The one-click cleanup function of existing smart terminal systems can easily delete important clock applications by mistake, causing time management services to be interrupted, alarms to fail, or time progress to be lost, thus affecting the user experience.
By detecting when the clock application starts, it is promoted to a high-priority foreground service, added to the system-level battery optimization whitelist or protected application list, intelligently judges the active state and maintains the keep-alive mechanism, controls the real-time rendering of dynamic effects, and enters a dormant state when inactive.
Ensure the clock application runs stably and displays smoothly, avoids accidental cleanup, improves user experience and system efficiency, and maintains the continuity of core functions and the efficiency of resource management.
Smart Images

Figure CN121722210A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mobile terminal application technology, and in particular to a method, apparatus, smart terminal, and storage medium for implementing a dynamic clock with intelligent anti-mistake clearing. Background Technology
[0002] As smart devices such as smartphones become central to users' daily lives, running multiple applications simultaneously has become the norm. However, the one-click cleanup function of existing systems often causes problems due to its inflexible logic. Specifically, important time management applications may be accidentally closed due to user error or habitual cleanup, which not only interrupts ongoing time management but may also cause alarms to malfunction or time progress to be lost, greatly impacting the user experience and causing inconvenience.
[0003] Therefore, existing technologies still need improvement and development. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a method, apparatus, smart terminal, and storage medium for implementing a dynamic clock with intelligent anti-mistaken cleanup. This invention can prevent critical clock applications from being indiscriminately deleted by the system, ensuring stable operation and continuity of time management services. It has the advantages of effectively preventing clock applications from being mistakenly deleted by the system, ensuring stable operation and smooth display of the dynamic clock.
[0005] This application provides a method for implementing a dynamic clock with intelligent anti-mistake clearing, the technical solution of which is as follows: Upon detecting that the clock application has started, control the clock application to be elevated to a high-priority foreground service according to preset requirements; Follow the prompts to add the clock app to the system-level battery optimization whitelist or protected app list, and the clock app will gain system-level exemptions. When the clock application detects that it has received an active viewing or use of the clock function, it intelligently determines that it is currently active and maintains its keep-alive mechanism, controlling the dynamic effects of smooth sweeping of the second hand and precise movement of the hour and minute hands to be rendered in real time. When no screen interaction is detected for a predetermined period of time or the screen is detected to be off, the control clock application intelligently enters sleep mode.
[0006] Furthermore, this application also proposes that, before the step of detecting the launch of the clock application and controlling the clock application to be promoted to a high-priority foreground service according to preset requirements, the clock application is pre-set as a high-priority foreground service and displayed in the status bar.
[0007] Furthermore, this application also proposes that, prior to the step of detecting the startup of the clock application and controlling the clock application to be promoted to a high-priority foreground service according to preset requirements, the following steps are included: The clock app is pre-configured to have intelligent scene awareness capabilities, determining whether to enter active or sleep mode based on the current activity level.
[0008] Furthermore, this application also proposes a method for intelligently determining the current active state and maintaining its keep-alive mechanism when the clock application detects that it has received an active viewing or use of the clock function, and controlling the real-time rendering of dynamic effects such as smooth sweeping of the second hand and precise movement of the hour and minute hands, including: When the clock app detects events such as viewing the clock interface, setting an alarm, or using a timer, it intelligently senses and determines that it is currently active. It maintains its keep-alive mechanism, controls the smooth sweeping of the second hand and the precise movement of the hour and minute hands to render dynamic effects in real time, and controls the precise execution of alarm and timekeeping services.
[0009] Furthermore, this application also proposes a step in which the control clock application intelligently enters a sleep state when no screen interaction is detected for a predetermined time or when the screen is detected to be off, including: When the clock application detects that the user has exited the clock application interface, or when the smart terminal screen is turned off, and no interaction with the screen is detected for more than a predetermined time, or when the screen is turned off, the clock application intelligently determines that it is currently inactive and controls it to enter the smart sleep mode. When the screen is detected to be turned on again or the application is opened, the control wakes up from sleep mode and restores live display and interactive functions.
[0010] Furthermore, this application also proposes that when the clock application detects that it has received an active viewing or use of the clock function, it intelligently determines that it is currently in an active state and maintains its keep-alive mechanism. The steps of controlling the real-time rendering of the dynamic effects of the smooth sweeping of the second hand and the precise movement of the hour and minute hands also include: Continuously monitor system broadcasts or APIs to detect in real time whether the current smart terminal is in multitasking or split-screen mode; When the smart terminal is detected to be in multitasking or split-screen mode, the clock application further determines whether the clock application is currently visible; at the same time, it assesses whether the clock application is the currently focused application. Based on the current dynamic effects of the clock application, including the smooth animation effects of the second, minute, and hour hands, assess the required CPU and GPU rendering resources.
[0011] Furthermore, this application also proposes that when the clock application detects that it has received an active viewing or use of the clock function, it intelligently determines that it is currently in an active state and maintains its keep-alive mechanism. The steps of controlling the real-time rendering of the dynamic effects of the smooth sweeping of the second hand and the precise movement of the hour and minute hands also include: When the system is detected to be in multitasking or split-screen mode, and the clock application is visible but not in focus, the controller will intelligently upgrade the rendering priority of the clock application from the default background rendering priority to a medium to high priority. During the intelligent rendering priority boosting process, the control clock application sends a request to the system scheduler to reserve a predetermined amount of CPU and GPU time slices for the clock application's rendering thread. When system resources are extremely scarce, and stuttering still occurs even after increasing the rendering priority, the control clock application dynamically fine-tunes the animation frame rate based on the currently available rendering resources, performs adaptive frame rate adjustment, controls the overall stability of the clock operation, and ensures a smooth transition of animation effects. When it is detected that the user has exited multitasking or split-screen mode, or when the clock application is no longer visible, the clock rendering priority is automatically restored to the power-saving priority of the smart sleep mode.
[0012] Furthermore, this application also proposes a dynamic clock implementation device for intelligent anti-mistake clearing, comprising: The priority escalation control module is used to detect the startup of the clock application and control the clock application to be elevated to a high-priority foreground service according to preset requirements; The list includes a guide module that, based on the guide prompts, adds the clock app to the system-level battery optimization whitelist or protected app list, granting the clock app system-level exemptions. The clock active state intelligent judgment and rendering module is used to intelligently determine the current active state when the clock application receives an active viewing or use of the clock function, and maintain its keep-alive mechanism to control the dynamic effect of smooth sweeping of the second hand and precise movement of the hour and minute hands in real time rendering. The clock sleep control module is used to intelligently put the clock application into sleep mode when no interaction with the screen is detected for a predetermined time or when the screen is detected to be off.
[0013] Furthermore, this application also proposes a smart terminal, including a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors. One or more programs include the function of performing the above-described method.
[0014] Furthermore, this application also proposes a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the above-described method.
[0015] As can be seen from the above, the intelligent anti-mistaken cleanup dynamic clock implementation method, device, smart terminal and computer-readable storage medium provided in this application solve the problem of function interruption caused by system mistaken cleanup and resource limitation by detecting the clock application's priority when it starts, adding it to the system whitelist, intelligently judging the active state and controlling dynamic rendering, and intelligently entering the hibernation state. It has the advantages of effectively preventing the clock application from being mistakenly cleaned up by the system and ensuring the stable operation and smooth display of the dynamic clock. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the dynamic clock implementation method for intelligent anti-mistaken clearing according to Embodiment 1 of the present invention.
[0018] Figure 2 This is a schematic diagram of the resource preparation and loading process of the intelligent anti-mistake cleanup dynamic clock implementation method of Embodiment 2 of the present invention.
[0019] Figure 3 This is a schematic diagram of a dynamic icon group resource for the intelligent anti-mistaken clearing dynamic clock implementation method of a specific embodiment 2 of the present invention.
[0020] Figure 4 This is a schematic diagram of the icon replacement decision process of the intelligent anti-mistaken cleanup dynamic clock implementation method in specific embodiment 2 of the present invention.
[0021] Figure 5 This is a schematic diagram of the dynamic drawing and rendering process of the intelligent anti-mistake cleanup dynamic clock implementation method of embodiment 2 of the present invention.
[0022] Figure 6 The principle block diagram of the intelligent anti-mistaken cleanup dynamic clock implementation device provided by the present invention.
[0023] Figure 7 This is a block diagram illustrating the internal structure of a smart terminal provided in an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0025] It should be noted that if the embodiments of the present invention involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0026] In the multi-tasking environment of smart terminals, the system-level application cleanup mechanism lacks the ability to dynamically identify the priority of application services. This causes critical clock applications to be forcibly terminated when users perform routine cleanup operations, resulting in time management service interruptions, alarm clock malfunctions, and loss of timekeeping progress. Consequently, this affects the continuity of system services and the reliability of background tasks. This problem stems from the fact that the existing cleanup logic uses a uniform strategy to handle all application processes, failing to distinguish between foreground service status and user interaction intent. This renders the clock application's continuous operation guarantee mechanism ineffective, creating an inherent conflict between system resource scheduling strategies and the critical application's keep-alive requirements.
[0027] For example, when a user is using a smart terminal to time cooking, multiple application interfaces are displayed on the screen at the same time. Because the user habitually performs a swipe to clear memory resources, the system will include the clock application process in the recycling scope, causing the timing function to stop immediately and the cooking process to be interrupted. The user needs to reset the timing parameters and resume the operation process. At this time, the system cannot maintain the background service state of the clock application, the continuity of user interaction is disrupted, and the application process cannot resume on its own after the screen is turned off.
[0028] If the above problems are not resolved, the stability of critical system services will be continuously threatened, users' trust in terminal devices will be significantly reduced, service interruptions of time management applications may cause chaos in daily activity arrangements, and the unreliability of system-level cleanup mechanisms will further exacerbate resource scheduling conflicts in multi-tasking environments, leading to a continuous deterioration in the reliability of backend services.
[0029] To address the aforementioned technical problems, this invention provides a method for implementing a dynamic clock with intelligent anti-mistaken clearing, as detailed in the following embodiments.
[0030] Example 1 like Figure 1 As shown, an embodiment of the present invention provides a method for implementing a dynamic clock with intelligent anti-misoperation clearing, comprising the following steps: Step S100: Detecting the clock application to start, control the clock application to be promoted to a high-priority foreground service according to preset requirements; Step S200: According to the guidance prompts, add the clock application to the system-level battery optimization whitelist or protected application list, and the clock application obtains system-level exemption. Step S300: When the clock application is detected to receive an active view or use of the clock function, it intelligently determines that it is currently in an active state and maintains its keep-alive mechanism, controlling the dynamic effect of smooth sweeping of the second hand and precise movement of the hour and minute hands to be rendered in real time. Step S400: When no screen interaction is detected for a predetermined time or the screen is detected to be off, the clock application is controlled to intelligently enter a sleep state.
[0031] The intelligent anti-mistaken cleanup dynamic clock implementation method of this application aims to solve the problem that clock applications in smart terminals are easily mistakenly cleaned up. It ensures the stable operation of the clock application, real-time rendering of dynamic effects, and intelligent resource management in inactive states through a series of mechanisms, thereby improving the user experience.
[0032] In this embodiment, the high-priority foreground service refers to a service type with high system priority and resource guarantees in the smart terminal operating system. When an application is promoted to a high-priority foreground service, the operating system allocates a more stable operating environment and more abundant system resources to it, reducing the risk of it being reclaimed or cleaned up by the system.
[0033] The system-level battery optimization whitelist in this embodiment is a mechanism provided by the operating system that allows users or the system to add specific applications to an exemption list. Applications included in the whitelist will not be subject to the strict restrictions of the system's battery optimization policies, such as background activity restrictions and network access restrictions, to ensure the continuous operation of their critical functions.
[0034] The protected application list in this embodiment refers to a similar exemption mechanism to the battery optimization whitelist, provided by some smart terminal manufacturers or operating systems. Applications included in this list typically receive higher system privileges and stronger keep-alive capabilities, preventing them from being terminated by the system or third-party cleanup tools.
[0035] The system-level exemption in this embodiment refers to the special treatment that the clock application receives from the operating system in terms of resource scheduling, process management and background operation after being added to the battery optimization whitelist or the protected application list, enabling it to circumvent common system restrictions and cleanup strategies.
[0036] The keep-alive mechanism in this embodiment refers to a series of technical measures taken by the clock application to ensure that its process is not cleared by the system or the user. This includes, but is not limited to, raising service priority, registering with the system broadcast receiver, and utilizing the keep-alive interface provided by the system to maintain the continuous running state of the application.
[0037] Real-time rendering in this embodiment refers to the computer graphics system generating images at a sufficiently high speed so that users cannot perceive any delay, thus presenting a smooth and continuous visual effect. For dynamic clocks, real-time rendering ensures the smooth movement of the second, minute, and hour hands and the instantaneous updating of animation effects.
[0038] The intelligent sleep state in this embodiment refers to a low-power, low-resource-consumption operating mode that the clock application automatically enters when it detects that the user has not interacted for a long time or the screen is off. In this state, the application will pause unnecessary dynamic rendering and background activities, but will still maintain the core functions (such as alarm clock and timer) and can quickly respond to wake-up events.
[0039] This embodiment provides a method for implementing a dynamic clock with intelligent anti-misoperation features. First, it detects the startup of a clock application and controls the application to be elevated to a high-priority foreground service according to preset requirements. This step can be implemented in various ways. For example, one implementation involves requesting the operating system to set the application as a foreground service via an application programming interface (API) when the clock application first starts, and displaying a persistent notification icon to inform the user that the application is running in foreground mode. Another implementation involves declaring the clock application as a foreground service in its configuration file and automatically activating the service when the application starts, with the operating system automatically elevating its priority based on the configuration information.
[0040] Furthermore, this invention, based on guided prompts, adds the clock application to the system-level battery optimization whitelist or protected application list, thereby granting the clock application system-level exemptions. Specifically, one implementation involves the application displaying a dialog box when the user launches the clock application for the first time, prompting the user to manually access the battery optimization interface in system settings and remove the clock application from the optimization list. Another implementation involves the application providing a button; clicking this button directly redirects the system to the corresponding battery optimization or protected application settings page, where the user simply confirms the action to add the clock application to the whitelist.
[0041] Furthermore, when the clock application detects that it has received an active view or use of the clock function, this invention intelligently determines that it is currently in an active state and maintains its keep-alive mechanism, controlling the real-time rendering of the dynamic effects of the smooth sweeping of the second hand and the precise movement of the hour and minute hands. For example, one implementation is that the clock application listens to the lifecycle events of its main interface, and when the main interface is visible, it is determined to be in an active state. At this time, the application will start or maintain its internal timer and rendering thread to ensure that the animation effects of the second, minute, and hour hands are displayed smoothly. Another implementation is that the application not only listens to the main interface events, but also listens to the user's click events on the clock widget. When a click is detected on the widget, it is also determined to be in an active state, and the real-time rendering of the dynamic effects is triggered.
[0042] Furthermore, when no screen interaction is detected for a predetermined time or the screen is detected to be off, this embodiment of the application controls the clock application to intelligently enter a sleep state. Specifically, one implementation is that the clock application maintains a timer internally, which is reset every time a screen interaction (e.g., touch, swipe) occurs. When the timer reaches a preset threshold and no new interaction is detected, the application enters a sleep state. Another implementation is that the clock application registers a system broadcast receiver to listen for screen-off events. Once a screen-off broadcast is received, the application immediately enters a sleep state, stopping unnecessary rendering tasks but maintaining the operation of the core timing logic.
[0043] The following example will provide a more detailed explanation of the above technical solution: For example, User A owns a smart device and frequently uses its clock app to set alarms and check the time. User A has often encountered a problem where the clock app is terminated by the system after a system cleanup or after the smart device has been inactive for a long time, causing the alarm to fail to ring or the dynamic clock display to lag.
[0044] To address this issue, User A installed a clock application that employs the intelligent anti-mistake cleanup dynamic clock implementation method described above in this embodiment of the invention. When User A first launches the clock application, it immediately requests the smart terminal operating system to elevate it to a high-priority foreground service. The operating system responds to this request, marking the clock application as a foreground service and displaying a persistent notification icon in the status bar, indicating that the application is running stably.
[0045] Subsequently, the clock app displayed a prompt guiding user A to add it to the smart device's battery optimization whitelist. User A followed the prompts and added the clock app to the whitelist, thus granting the app system-level exemption and protecting it from the system's aggressive battery optimization strategies.
[0046] In daily use, when user A opens the clock app to check the current time, the app immediately detects user A's active viewing behavior. At this time, the app intelligently determines that it is in an active state and activates its keep-alive mechanism to ensure that the dynamic effects of the second, minute, and hour hands can be rendered smoothly and accurately in real time, providing user A with a smooth visual experience.
[0047] When user A checks the time, closes the clock app, and places the smart device aside without any screen interaction for a predetermined period, or when user A directly presses the power button to turn off the screen, the clock app intelligently detects these inactive states. Based on this detection, the app enters a smart sleep state. In sleep mode, the app pauses non-core tasks such as dynamic rendering to save system resources and battery power, but its core timing functions (such as set alarms) remain active.
[0048] When user A needs to be woken up by an alarm clock the next morning, the clock application has obtained a system-level exemption and maintained a keep-alive mechanism. Even though the smart device has not been used for a long time, the application has not been mistakenly deleted by the system. Therefore, the alarm clock can ring on time and successfully wake up user A.
[0049] As can be seen, the embodiments of the present invention effectively solve the problem of clock applications in smart terminals being easily deleted by mistake, leading to functional failure, through the above-mentioned series of collaborative technical features.
[0050] Based on the above examples, this invention demonstrates significant technical contributions in the smart terminal environment. Traditional clock applications, when faced with the "one-click cleanup" function or system background process management of smart terminals, are often unexpectedly terminated due to insufficient priority or lack of system exemption rights, causing critical functions such as alarms and timers to malfunction and severely impacting user experience. The technical solution of this application fundamentally solves the problem of clock applications being easily and accidentally cleaned up by elevating the clock application to a high-priority foreground service and guiding users to add it to the system-level battery optimization whitelist or protected application list, thus providing it with stable operation at the system level. Furthermore, this solution introduces a mechanism for intelligently judging active status and rendering dynamic effects in real time, ensuring a smooth and accurate visual experience for users when actively using the application. Simultaneously, through an intelligent hibernation mechanism, this solution effectively manages system resource consumption and avoids unnecessary power waste while ensuring uninterrupted core functions. This overall technical concept, combining system-level protection, intelligent status judgment, and resource management, enables clock applications to maintain high reliability while balancing user experience and system efficiency in the complex and ever-changing usage environment of smart terminals, significantly outperforming the vulnerabilities commonly found in existing clock applications.
[0051] In some of the embodiments described above in this application, the clock application is promoted to a high-priority foreground service after startup. However, at the moment the clock application starts, the system may not have responded to its priority promotion request in time, or in some extreme cases, the shortage of system resources may cause the clock application to be mistakenly cleaned up or fail to obtain sufficient resources in time before the priority promotion is completed, thereby affecting the user experience.
[0052] To address this, this application further proposes that before the step of detecting the clock application's startup and controlling the clock application to be elevated to a high-priority foreground service according to preset requirements, the following steps are included: pre-setting the clock application as a high-priority foreground service and displaying it in the status bar. Pre-setting the clock application as a high-priority foreground service aims to ensure that the clock application receives system-level priority protection from the outset. This can be achieved by declaring it as a foreground service through its manifest file during application installation and requesting the corresponding permissions, allowing the system to grant it higher priority upon application startup; or, after the user launches the clock application for the first time, the application guides the user to manually add it to the "foreground services" or "protected applications" list in system settings, thereby automatically obtaining high priority upon subsequent startups. Displaying it in the status bar clearly indicates to the user that the clock application is running as a high-priority foreground service, which is also a common requirement of the operating system for foreground services, to prevent applications from consuming resources unnoticed in the background. Specifically, a persistent notification icon and text can be displayed in the system notification bar to indicate that the clock app is running; or a specific icon, such as a small clock icon, can be displayed in the system status bar to indicate that the clock app is running at a high priority.
[0053] This application's solution addresses the aforementioned problem by pre-setting the clock application as a high-priority foreground service and displaying it in the status bar before detecting its startup and elevating it to a high-priority foreground service. Specifically, the basic solution elevates the clock application's priority only after startup, which can create a brief "window" during system resource constraints or startup, exposing the clock application to the risk of being cleaned up or receiving insufficient resource allocation. By pre-setting, the clock application possesses high-priority foreground service attributes from the very first moment of startup, allowing the system to immediately recognize its importance and reserve necessary resources. Furthermore, the status bar display not only conforms to the operating system's requirements for foreground services but also provides clear feedback on the application's running status, further reducing the possibility of application termination due to user or system errors. This pre-configuration mechanism, complementing the subsequent dynamic priority elevation mechanism, forms a more robust and seamless keep-alive strategy, ensuring the clock application runs stably and accurately at all times.
[0054] Through the above technical solution, the clock application is recognized as a high-priority foreground service by the system upon startup, accompanied by a status bar display. This significantly enhances the clock application's resistance to system cleanup and its resource acquisition priority during the startup phase. Compared to solutions that only prioritize the application after startup, this solution effectively eliminates the risk of the clock application being mistakenly cleaned up or receiving insufficient resources during startup, ensuring stable and smooth operation from the very beginning. This not only guarantees the real-time rendering of the smooth sweeping of the second hand and the precise movement of the hour and minute hands, but also provides a more reliable foundation for the accurate execution of alarm and timekeeping services, thereby greatly improving the consistency and reliability of the user experience.
[0055] In some implementations, once the clock application is detected as running, it is elevated to a high-priority foreground service, or pre-set as a high-priority foreground service and displayed in the status bar to ensure it is not mistakenly deleted by the system. However, this continuous high-priority running mode may lead to unnecessary system resource consumption, even when the user does not actively view or use the clock function, affecting the device's battery life and overall performance.
[0056] In response, this application further proposes to pre-configure the clock application with intelligent scene awareness capabilities, determining whether to enter active or sleep mode based on the current active state.
[0057] The pre-configured intelligent scene awareness capability of the clock application means that it can autonomously identify and judge various contextual information such as the current device environment, user behavior patterns, and system operating status. This capability allows the clock application to proactively understand and adapt to different usage scenarios, rather than simply passively responding to user commands. For example, it can sense environmental changes by integrating data from the device's built-in sensors (such as light sensors, accelerometers, and gyroscopes), or determine the device's usage context by analyzing information provided by the system API (such as screen on / off status, currently foreground applications, and network connection types). Furthermore, it can learn and analyze historical user interaction data and usage habits to build user behavior models, thereby more accurately predicting user intentions and scenario requirements. Determining whether to enter active or sleep mode based on the current active state means that, based on the aforementioned intelligent scene awareness capability, the clock application can dynamically assess whether it is in an "active" state where the user expects it to provide full functionality and real-time dynamic effects, or whether it can enter a "sleep" state for low-power operation. For example, a set of judgment rules can be set up to determine the active state when the screen is on, the clock app is displayed in the foreground, or the user is performing an interactive operation related to the clock function (such as setting an alarm or checking world time). Conversely, when the screen is off, the clock app has been in the background for a long time, or the device is idle, it is determined to be inactive and triggers the entry into sleep mode. This state switching can be handled by the application's internal state management module, which executes corresponding resource scheduling and function adjustment strategies based on the scene information provided by the intelligent scene perception module.
[0058] The solution proposed in this application pre-configures the clock application with intelligent scene awareness capabilities, enabling more refined management of its operational status, even when it is elevated to a high-priority foreground service or pre-set as such. Specifically, the clock application no longer simply maintains high priority; instead, it utilizes its intelligent scene awareness capabilities to continuously monitor the device's usage environment and user interaction behavior. For example, it acquires data such as screen on / off status, application foreground / background switching information, and user touch events in real time. Based on this perceived information, the clock application can intelligently determine whether it is in an "active" state where the user requires complete dynamic effects and real-time functionality. When determined to be in an active state, the clock application maintains its keep-alive mechanism and renders dynamic effects such as the smooth sweep of the second hand and the precise movement of the hour and minute hands in real time. When determined to be in an inactive state, such as when the screen is off or there is no interaction for a long time, the clock application intelligently enters a sleep state, thereby reducing resource consumption. This mechanism ensures that the clock application is not mistakenly deleted by the system and remains available at all times, while avoiding unnecessary resource waste and achieving a balance between reliability and energy efficiency.
[0059] Through the aforementioned technical solutions, the clock application, already elevated to a high-priority foreground service or preset as a high-priority foreground service, further gains intelligent operation and management capabilities. It no longer simply runs continuously at high priority, but can dynamically determine whether it needs to remain active based on intelligent scene perception. This allows the clock application to intelligently switch between active and dormant states, ensuring it is not mistakenly deleted by the system and always remains available. When the user does not actively view or use the application, it can enter a low-power dormant state, significantly reducing the consumption of CPU, GPU, and battery resources, thus effectively solving the resource waste problem that may result from simply running at high priority. Simultaneously, when the user needs it, the clock application can quickly wake up from dormancy, providing smooth, accurate dynamic display and full functionality, greatly improving the user experience and device energy efficiency.
[0060] In other embodiments, this application proposes a method for implementing a dynamic clock with intelligent anti-misoperation cleaning, including detecting the startup of a clock application and controlling the clock application to be elevated to a high-priority foreground service according to preset requirements; adding the clock application to a system-level battery optimization whitelist or protected application list according to guidance prompts, thereby granting the clock application system-level exemption; intelligently determining the current active state when the clock application receives an active viewing or use of the clock function and maintaining its keep-alive mechanism, controlling the dynamic effects of smooth second hand sweeping and precise hour and minute hand movement to be rendered in real time; and intelligently controlling the clock application to enter a sleep state when no screen interaction is detected for a predetermined time or when the screen is detected to be off.
[0061] In some of the embodiments described above in this application, a mechanism is proposed to intelligently determine the current active state when the clock application detects that it has received an active viewing or use of the clock function, and to maintain its keep-alive mechanism, controlling the real-time rendering of dynamic effects such as smooth sweeping of the second hand and precise movement of the hour and minute hands. However, in practical applications, how to specifically and accurately identify the user's active viewing or use intention, and ensure that the dynamic effects and core services (such as alarm clock and timer) of the clock application can be executed accurately and stably at these critical moments, are problems that need further refinement and resolution.
[0062] In response, this application further proposes a step-by-step approach to intelligently determine the current active state and maintain its keep-alive mechanism when the clock application detects that it has received an active viewing or use of the clock function. The steps include: when the clock application detects viewing the clock interface or setting an alarm or using a timer, it intelligently determines that it is currently active and maintains its keep-alive mechanism. The application also controls the real-time rendering of the dynamic effects of the smooth sweeping of the second hand and the precise movement of the hour and minute hands, as well as controlling the precise execution of the alarm and timekeeping services.
[0063] In this solution, detecting events such as viewing the clock interface, setting alarms, or using timers aims to identify users' proactive interactions with the clock application. Detecting viewing the clock interface can be done by listening to system UI events, such as the clock application's main interface being pulled up and displayed on the foreground; or by detecting user clicks on the clock application's icon or widget. Setting alarms can be done by listening for user actions such as entering the alarm settings page, changing the alarm time, or enabling or disabling the alarm within the clock application. Using timers can be done by listening for user actions such as starting, pausing, or resetting timers within the clock application. These events are key signals that clearly indicate the user's need for the clock functionality. The clock application's intelligent perception and determination of its current active state means that the clock application, based on detected user interaction events and system status (such as whether the screen is on, whether the application is in the foreground, etc.), comprehensively determines whether it is in an active state that the user is actively using or paying attention to. This intelligent perception and determination can be based on a preset set of rules; for example, immediately marking the state as active when any of the above events is detected; or using machine learning models to make more complex judgments based on user behavior patterns and contextual information. Maintaining its keep-alive mechanism refers to the measures the system takes to ensure that the clock application's process is not easily cleaned up or terminated by the operating system when it is determined to be active, thus guaranteeing its continued operation. This keep-alive mechanism can be achieved by registering as a foreground service with the operating system, periodically sending heartbeats to keep the process active, or using specific APIs provided by the system to request higher process priority. Real-time rendering of dynamic effects controlling the smooth sweep of the second hand and the precise movement of the hour and minute hands means that when the clock application is active, the animation effects of the second, minute, and hour hands on its interface can be updated and displayed in a smooth and accurate manner in real time. Smooth sweep typically refers to the continuous, uninterrupted animation effect of the second hand, rather than a jumpy update. Precise movement means that the hour and minute hands accurately reflect the current time, and their animation transitions are natural. Real-time rendering means that these dynamic effects can be updated instantly according to the precise changes in the system clock, ensuring visual accuracy and smoothness. Precise execution of alarm and timer services means that when the clock application is active, its core functions, namely alarm and timer services, can be triggered and run accurately according to the user-defined time points or durations. Precise execution means that these services will not experience delays, failures, or inaccuracies due to factors such as system resource constraints, application cleanup in the background, or hibernation. This typically requires clock applications to utilize reliable timer services or high-priority task scheduling mechanisms provided by the system to ensure accuracy.
[0064] This application's solution, building upon the aforementioned elevation of the clock application to a high-priority foreground service and granting it system-level exemption, further refines the determination of the clock application's active state and the maintenance of its keep-alive mechanism, ensuring the precise execution of core services. Specifically, when a user actively uses the clock application through explicit interactive actions such as viewing the clock interface, setting an alarm, or using a timer, the clock application can intelligently perceive these events and determine that it is in an active state. Once active, the clock application will proactively maintain its keep-alive mechanism, which not only includes the previously existing high-priority foreground service and system exemption but may also employ more proactive measures to ensure that its process is not terminated by the system. In this active state, the clock application will render the smooth sweeping of the second hand and the precise movement of the hour and minute hands in real time, providing users with an intuitive and accurate time display. More importantly, the maintenance of this active state and the strengthening of the keep-alive mechanism directly ensure the accurate execution of core services such as alarm clocks and timers, avoiding the failure or delay of key functions due to accidental cleanup or hibernation of the application. This solves the problem of how to ensure that the dynamic effects and core services can be executed accurately and stably when the user actively uses the clock function.
[0065] The following is a concrete example. When a user taps the clock app icon on a smart terminal, or enters the main clock interface by tapping the clock widget in the pull-down notification bar, the system of this invention detects the "view clock interface" operation event. At this time, the event listener inside the clock app captures this event and, combined with information such as the screen being on and the app being in the foreground, intelligently determines its active state. For example, the clock app can set an internal flag isActive to true. To maintain its keep-alive mechanism, the clock app can register a persistent foreground service notification with the operating system, ensuring its process priority is guaranteed even if the notification bar is not displayed. In this active state, the clock app's rendering engine calculates and draws the positions of the second, minute, and hour hands in real time at a frequency of 60 frames per second, ensuring the continuous sweep of the second hand and the smooth transition of the hour and minute hands. At the same time, if a user sets a new alarm in the clock app, such as for 7 a.m. tomorrow, or starts a countdown timer, such as for 5 minutes, the clock app will use high-precision timing services such as Android's `AlarmManager` or iOS's `UserNotifications` to schedule these tasks, ensuring that the alarm rings precisely at 7 a.m. and the countdown timer is triggered precisely 5 minutes later. Even if the app is temporarily moved to the background, these services can still be executed accurately.
[0066] Through the aforementioned technical solution, this application can more intelligently and accurately identify users' active intentions to use the clock application, and on this basis, specifically strengthen the clock application's keep-alive mechanism and resource protection. This not only ensures that the dynamic effects of the second, minute, and hour hands are rendered in real-time, smoothly, and accurately when users actively view the clock, greatly improving the user experience and avoiding issues such as lag or inaccurate display, but more importantly, by closely linking user-initiated interaction with the keep-alive mechanism and the precise execution of core services, this application effectively solves the technical problem that critical functions such as alarms and timers may fail or be delayed due to system resource management strategies in complex system environments, thereby significantly improving the functional reliability and user satisfaction of the clock application.
[0067] In some of the above embodiments, a scheme was proposed for the clock application to enter a sleep state when no screen interaction is detected or the screen is turned off. However, if the sleep mechanism is not refined enough, it may lead to display delays or slow resource recovery when the user reactivates the clock application, affecting the smoothness of the user experience; or, even if it enters sleep mode in an inactive state, it may not fully optimize resource consumption, resulting in unnecessary power consumption. In this regard, this application further proposes a step to control the clock application to intelligently enter a sleep state when no screen interaction is detected for a predetermined time or the screen is turned off, including: when it is detected that the clock application interface has been exited, or when it is detected that the smart terminal screen is turned off, and no screen interaction is detected for a predetermined time or the screen is turned off, the clock application intelligently determines that it is currently in an inactive state and controls it to enter a smart sleep mode; when it is detected that the screen is turned on again or the application is opened, it controls the wake-up from the sleep state to restore real-time display and interactive functions.
[0068] Detecting exit from the clock application interface means that the system or the clock application itself can recognize that the user is no longer on the main interface of the clock application. This can be achieved by listening to the application's lifecycle events. For example, when the application switches from the foreground to the background, or when the user leaves the current clock interface through navigation operations (such as the back button or home button), the system in this embodiment of the invention will trigger the corresponding callback function, and the clock application can capture these events. Another implementation is that the clock application can periodically check whether the current system focus application is itself; if not, it is determined that the user has exited the interface. Detecting the smart terminal screen is off means that the system can recognize that the smart terminal's display screen is in a closed state. This is usually achieved through the broadcast mechanism or API interface provided by the operating system. For example, when the user presses the power button to turn off the screen, or when the screen automatically turns off due to timeout, the operating system will issue a screen-off event notification, and the clock application can register a listener to receive such events. In addition, the status of the screen management service can also be queried to determine whether the screen is off. No screen interaction action detected for a predetermined time means that the system does not receive any screen touch, swipe, click, or other input operations from the user within a certain period of time. The "scheduled time" can be a configurable threshold, such as 30 seconds, 1 minute, or longer, which can be adjusted according to user habits or system settings. "Screen interaction actions" refer to any form of interaction between the user and the smart terminal via the touchscreen, such as determining whether interaction exists by listening for touch events or gesture recognition events. The clock application's intelligent determination of its inactive state means that the clock application comprehensively evaluates various detected conditions (exiting the interface, screen off, no interaction) to determine that it is not currently being actively used or viewed by the user. This "intelligent determination" can be based on a logic judgment module that receives input from different sensors and system events and makes decisions according to a preset set of rules (e.g., determining inactivity if any condition is met). Alternatively, this judgment module can use a machine learning model to more accurately predict inactivity by analyzing user behavior patterns. Controlling entry into intelligent sleep mode means that after determining an inactive state, the clock application proactively adjusts its operating state to reduce resource consumption and prepare for rapid wake-up. Unlike simply pausing or terminating a process, "Smart Sleep Mode" means that the application doesn't completely stop, but rather enters a low-power, low-resource-consumption state. For example, it can pause dynamic rendering threads, release some GPU resources, and reduce CPU usage frequency, while keeping core time synchronization logic and background functions such as alarm clock services running. Furthermore, application priorities can be adjusted to make it easier for the system to reclaim non-critical resources when system resources are strained. Detecting the screen being turned on again or the application being opened means that the system or the clock application can recognize the user's actions of reactivating the smart device screen or restarting the clock application.This can be achieved by listening for screen-on broadcast events from the operating system (e.g., when a user presses the power button to turn on the screen). Alternatively, when a user taps the clock app icon in the app list or reactivates the clock app through multitasking, application lifecycle callbacks (such as onResume()) are triggered, and the clock app can capture these events. Controlling wake-up from sleep mode refers to the clock app resuming from smart sleep mode to a fully active running state after detecting an activation event. This includes restarting previously paused dynamic rendering threads, reallocating necessary GPU and CPU resources, and resuming real-time rendering of dynamic effects. The wake-up process needs to ensure a smooth transition, avoiding noticeable delays or stutters for the user. Restoring real-time display and interactive functions means that after waking up, the clock app can immediately resume all its normal functions, including the smooth sweeping of the second hand, the precise movement of the hour and minute hands, and real-time rendering of dynamic effects, as well as responding to user touch and swipe interactions. This requires the wake-up mechanism to quickly restore the application state to its active state before sleep and ensure that all necessary system resources and rendering pipelines are ready.
[0069] This application's solution addresses resource management and user experience smoothness issues in inactive clock applications by introducing a refined sleep and wake-up mechanism. When the smart terminal's screen is off, the user exits the clock application interface, or no screen interaction is detected within a predetermined time, the clock application intelligently determines that it is currently inactive. This determination mechanism comprehensively considers various user behaviors and system states, ensuring accuracy. Once inactive, the clock application enters a smart sleep mode. This mode does not simply terminate the application process; instead, while maintaining the core time service and alarm clock functions, it pauses or significantly reduces the rendering frequency of dynamic effects, releasing unnecessary CPU and GPU resources, thereby significantly reducing power consumption. This strategic resource release allows the clock application to maximize power saving during inactive periods while avoiding the risk of being mistakenly cleared by the system. When the user turns on the screen again or actively opens the clock application, the system quickly detects these activation events. Upon receiving a wake-up signal, the clock application is immediately awakened from the smart sleep mode. During the wake-up process, the clock application quickly resumes its dynamic rendering thread, reacquires the necessary CPU and GPU resources, and restores real-time rendering of the smooth sweeping second hand and precise movement of the hour and minute hands. Simultaneously, its interactive functions are fully restored, ensuring users can seamlessly continue using all the clock's features. This intelligent sleep and wake-up mechanism not only optimizes the clock application's resource consumption in inactive states but also ensures a quick and smooth restoration of all its functions when needed, greatly improving the continuity of the user experience and the overall efficiency of the system.
[0070] Through the above technical solution, this application effectively solves the problem of improper resource management in clock applications during inactive states. By intelligently identifying inactive states and entering a refined intelligent sleep mode, the clock application can significantly reduce CPU and GPU resource consumption, thereby extending the battery life of smart terminals and avoiding unnecessary power consumption. Furthermore, this intelligent sleep mode is not a simple pause but retains the core time service, ensuring the accuracy of alarm and timekeeping functions. More importantly, when the user needs to use the clock function again, the intelligent wake-up mechanism ensures that the clock application quickly resumes from sleep state, displays dynamic effects in real time, and responds to interactions, avoiding the startup delays or display stutters that may occur with traditional sleep modes, greatly improving the smoothness and consistency of the user experience. This mechanism achieves an optimized balance between resource utilization efficiency and user experience while ensuring functional integrity.
[0071] In some of the embodiments described above in this application, a method for implementing a dynamic clock with intelligent anti-mistake cleanup was proposed. This embodiment elevates the clock application to a high-priority foreground service and adds it to a system-level whitelist, ensuring that the clock application can maintain a keep-alive mechanism and render dynamic effects in real time while active. However, in the increasingly popular multitasking or split-screen operation modes of smart terminals, the clock application may be in a visible but not focused state, or a partially visible state. Maintaining full-load dynamic effect rendering in such cases could lead to unnecessary CPU and GPU resource consumption, affecting the performance of other foreground applications or increasing device power consumption.
[0072] In response, this application further proposes that when a clock application detects that it has received an active viewing or use of the clock function, it intelligently determines that it is currently in an active state and maintains its keep-alive mechanism. The steps for controlling the real-time rendering of the dynamic effects of the smooth sweeping of the second hand and the precise movement of the hour and minute hands also include: continuously listening to system broadcasts or APIs to detect in real time whether the current smart terminal is in multitasking or split-screen mode; when the smart terminal is detected to be in multitasking or split-screen mode, the clock application further determines whether the clock application is currently visible; at the same time, it evaluates whether the clock application is the current focus application; and based on the current dynamic effects of the clock application, including the smooth animation effects of the second, minute, and hour hands, it evaluates the required CPU and GPU rendering resources.
[0073] This involves continuously listening to system broadcasts or APIs to detect in real time whether the smart terminal is in multitasking or split-screen mode. The aim is to enable the clock application to promptly detect changes in the system's operating environment, particularly whether the user is using multitasking or split-screen functionality. This can be achieved by registering a system broadcast receiver to receive notifications of system status changes, such as listening to the Intent.ACTION_CONFIGURATION_CHANGED broadcast in Android, or by calling APIs provided by the operating system, such as ActivityManager.isInMultiWindowMode() or isInPictureInPictureMode() methods in Android, to periodically query the current operating mode of the smart terminal.
[0074] When the smart terminal is detected to be in multitasking or split-screen mode, the clock application further determines whether the clock application is currently visible. This is to accurately determine whether the clock application needs dynamic rendering in multitasking or split-screen mode. An application may be in the background, partially visible, or fully visible. If it is not visible, no resources need to be consumed for rendering. This can be achieved by listening to application lifecycle callbacks, such as onStart(), onStop(), onPause(), and onResume() in Android, and combining this with visibility information provided by the window manager, such as `View.onWindowVisibilityChanged()`, to make a comprehensive judgment.
[0075] At the same time, assessing whether the clock app is the currently focused app allows for more granular resource management. The focused app is typically the app the user is currently interacting with directly, and it often requires the highest rendering priority and resource allocation. This can be determined by listening for system-provided focus change events, such as the `onWindowFocusChanged()` callback in Android, or by querying the Activity at the top of the stack using `ActivityManager`.
[0076] Based on the current dynamic effects of the clock application, including the smooth animation of the second, minute, and hour hands, the required CPU and GPU rendering resources are assessed to precisely quantify the system resource demands of different dynamic effects. For example, the smooth sweep of the second hand may require a higher frame rate and more frequent GPU rendering, while the jumping of the minute and hour hands has lower resource requirements. This can be achieved by pre-setting resource consumption models for different animation effects, or by conducting performance tests and benchmarks on different animation effects during the development phase, recording their CPU and GPU usage on typical hardware, and creating a resource requirement profile.
[0077] This application's solution continuously monitors system broadcasts or APIs to detect in real-time whether the smart terminal is in multitasking or split-screen mode, enabling the clock application to promptly perceive changes in the system environment. Once multitasking or split-screen mode is detected, the clock application no longer blindly maintains full-load dynamic rendering but intelligently determines its own visibility and whether it is the currently focused application. Based on this contextual information, and combined with the clock application's current dynamic effects (such as the smooth sweep of the second hand and the precise movement of the hour and minute hands), it accurately assesses the required CPU and GPU rendering resources. This mechanism allows the clock application to adaptively adjust its resource consumption according to actual user interaction and system status, thereby avoiding unnecessary resource waste while ensuring the smoothness of dynamic effects. Combined with the underlying solution of the clock application as a high-priority foreground service with system-level exemptions, this ensures the clock application can run stably in any complex scenario while intelligently managing resources, improving overall system efficiency and user experience.
[0078] Through the above technical solution, the clock application can intelligently assess and adjust the required CPU and GPU rendering resources based on its visibility, focus status, and specific dynamic effects in multitasking or split-screen mode. This effectively avoids unnecessary resource consumption in complex scenes, ensures the smoothness and accuracy of the clock's dynamic effects, and frees up valuable system resources for other foreground applications, thereby significantly improving the overall operating efficiency and user experience of smart terminals and extending battery life.
[0079] In some of the embodiments described above in this application, a clock application is proposed to determine its own visibility and assess rendering resource requirements in multi-tasking or split-screen mode in order to maintain real-time rendering of dynamic effects. However, in actual operation, when the system is in multi-tasking or split-screen mode and the clock application is visible but not the focus application, its rendering priority may still be at a low level, or when system resources are scarce, even if the priority is increased, animation stuttering may occur, affecting user experience and clock accuracy.
[0080] To address this, this application further proposes that when the system is detected to be in multitasking or split-screen mode, and the clock application is visible but not focused, the rendering priority of the clock application should be intelligently elevated from the default background rendering priority to a medium-high priority. Rendering priority refers to the resource scheduling weight assigned to a specific application or its rendering task by the operating system or graphics rendering engine. The default background rendering priority is usually low to conserve system resources. Intelligent elevation to a medium-high priority means that the system will dynamically increase the clock application's position in resource contention based on its visibility and importance, ensuring that its rendering tasks receive more timely processing. For example, operating systems (such as Android and iOS) typically provide APIs that allow application developers to request adjustments to the priority of their processes or rendering threads, which can be achieved by setting the process's `nice` value or the thread's `priority` attribute. Furthermore, graphics rendering engines (such as OpenGLES and Vulkan) may also provide related rendering queue or context priority settings, allowing the clock application's rendering instructions to be processed by the GPU before those of other non-focused applications.
[0081] During the intelligent rendering priority enhancement process, the clock application sends a request to the system scheduler to reserve a predetermined amount of CPU and GPU time slices for its rendering thread. The system scheduler is responsible for allocating computing resources such as CPU and GPU among multiple concurrent tasks. Reserved time slices refer to pre-allocating a certain amount of CPU and GPU processing time to a specific task (here, the clock application's rendering thread) to ensure it has sufficient resources at critical moments, avoiding rendering delays or stuttering due to insufficient resources. For example, in some operating systems, resource requests can be sent to the system scheduler through specific system services or frameworks (such as Android's ActivityManager or WindowManager services), declaring the minimum requirements for specific resources. Resource reservation requests can also be submitted to the CPU and GPU schedulers through lower-level kernel interfaces or driver interfaces, such as by setting real-time scheduling policies or requesting exclusive access to certain computing units.
[0082] When system resources are extremely strained, and stuttering still occurs despite increasing rendering priority, the clock application dynamically fine-tunes the animation's frame rate based on currently available rendering resources, performing adaptive frame rate adjustment. Animation frame rate refers to the number of image frames rendered per second, directly affecting the smoothness of the animation. Dynamic fine-tuning and adaptive frame rate adjustment mean that the clock application can monitor the system's current CPU and GPU load, memory usage, and other rendering resource status in real time, and intelligently adjust the animation's rendering frame rate based on these resource changes. When resources are sufficient, a high frame rate can be maintained to provide an extremely smooth experience; when resources are scarce, the frame rate is appropriately reduced to avoid stuttering, ensuring the continuity and stability of the animation, rather than stopping it completely. For example, the clock application can integrate a performance monitoring SDK or directly call the system API to obtain real-time CPU / GPU usage, temperature, and other information. Based on preset thresholds and strategies, for example, when GPU usage exceeds 80%, the frame rate is reduced from 60fps to 30fps. An adaptive frame rate controller can also be implemented internally within the rendering engine. This controller periodically evaluates the completion time of the rendering task and adjusts the rendering interval of the next frame according to the actual rendering capability, thereby achieving dynamic adjustment of the frame rate.
[0083] The above mechanisms control the overall stability of the clock's operation, ensuring smooth transitions in animation effects. Overall stability means that the clock's core functions (such as time display and alarm clock service) and user interface (such as dynamic animations) remain reliable, accurate, and smooth under various system loads and operating modes. Smooth transitions in animation effects mean that during frame rate adjustments and priority changes, the visual presentation of the animation will not exhibit abrupt jumps, flickering, or stuttering, but rather will change in a natural and continuous manner. For example, by introducing animation interpolation algorithms and buffering mechanisms, even when the frame rate changes, the frame rate difference can be compensated for by calculating intermediate frames or smooth transition curves, thus avoiding visual discontinuities. When adjusting the frame rate, a gradual adjustment strategy can be adopted; for example, instead of immediately reducing from 60fps to 30fps, it can be gradually reduced to 50fps, 40fps, giving the user a smoother visual experience.
[0084] When exiting multitasking or split-screen mode is detected, or the clock app becomes invisible, the clock's rendering priority automatically reverts to the power-saving priority of the smart sleep mode. The power-saving priority is typically the lowest rendering priority, designed to minimize resource consumption. Automatically reverting to the power-saving priority means that when the clock app no longer needs high-priority rendering (e.g., the user exits multitasking / split-screen mode, or the clock app is completely covered and invisible by other apps), the system automatically lowers its rendering priority back to the lowest level to free up previously occupied resources for other apps, thereby optimizing overall system performance and battery life. For example, the operating system broadcasts events indicating exit from multitasking / split-screen mode or changes in app visibility. The clock app can listen for these system events and, upon receiving the corresponding event, call the system API to reset its rendering priority to the default background or power-saving level. The rendering engine can also maintain a priority state machine that automatically triggers priority recovery logic when a change in app visibility or focus is detected.
[0085] This application's solution intelligently prioritizes the clock application's rendering when the smart terminal is in multitasking or split-screen mode and the clock application is visible but not focused. It also requests reserved CPU and GPU time slices from the system scheduler, ensuring sufficient rendering resources for the clock application's dynamic display even in complex multitasking environments. Furthermore, when system resources are extremely scarce, the clock application can dynamically fine-tune the animation's frame rate based on available rendering resources, performing adaptive frame rate adjustments to control the overall stability of the clock's operation and ensure smooth animation transitions. When exiting multitasking or split-screen mode, or when the clock application is no longer visible, the clock's rendering priority automatically reverts to the energy-saving priority of intelligent sleep mode, achieving efficient resource utilization. This comprehensive priority management and adaptive frame rate mechanism ensures that the clock application's dynamic effects remain smooth and accurate in multitasking scenarios, while avoiding unnecessary resource waste.
[0086] Through the above technical solution, this application effectively solves the problem of stuttering and unsmooth dynamic effects caused by insufficient rendering priority or system resource constraints when the clock application is visible but not in focus mode on a smart terminal in multitasking or split-screen mode. By intelligently increasing the rendering priority and requesting reserved CPU and GPU time slices, it ensures that the dynamic display of the clock application can still obtain sufficient rendering resources in complex multitasking environments, maintaining the real-time performance and smoothness of the smooth sweeping of the second hand and the precise movement of the hour and minute hands. In addition, the introduced frame rate adaptive adjustment mechanism allows the clock application to avoid stuttering by dynamically fine-tuning the frame rate when system resources are extremely tight, ensuring smooth transitions of animation effects and overall stability of clock operation. When high-priority rendering is no longer needed, the priority automatically reverts to energy-saving mode, effectively balancing user experience and system resource consumption, and significantly improving the user's perceived quality and satisfaction with the clock application in multitasking scenarios.
[0087] The present invention will be further described in detail below through specific application examples: like Figure 2 As shown in the second specific application embodiment, a dynamic clock implementation method for intelligent anti-mistake clearing includes the following steps: Step S10: Begin resource preparation and loading process, specifically including: S1.1 Define resource path rules, including: Set the default path for the built-in theme: system / media / config / theme / default.jar Set the online theme download path: / data / data / [application package name] / themes / [theme ID] / Then, a unified path access interface is established to support automatic switching between the two paths; S1.2. Establish a list of resource files, including: If the necessary core resource files are identified, they include: background image (bg_clock.png), hour hand (hour.png), minute hand (min.png), and second hand (sec.png). Figure 3 As shown; Identify the optional nighttime version resources: hour_n.png, min_n.png, sec_n.png, clock_n.png; Establish resource file naming conventions and verification mechanisms.
[0088] S1.3, Create a resource loader, specifically including: Develop a ResourceLoader utility class to implement a unified resource management interface; the ResourceLoader is a component or class used to load the resources required by the application (such as images, audio, configuration files, localized strings, etc.).
[0089] Implement the loadIcon() method, which is used to load application icons and supports reading image resources from JAR packages; Implement the loadFromFileSystem() method, which is a method for loading from the file system, and support loading resources from the file system. Provides a resource loading status callback interface.
[0090] S1.4 Loading and caching resources, including: Read the PNG image file stream and decode it into a Bitmap object using BitmapFactory (Bitmap generator); Implement an LRU (Least Recently Used) caching strategy and set a reasonable cache size limit; Establish a resource lifecycle management mechanism to ensure the timely release of resources that are no longer in use; Added resource preloading functionality to improve initial load performance; The resource preparation is now complete. Proceed to step S20, as follows: Figure 4 As shown; Step S20: Proceed to the icon replacement decision-making process and begin the icon decision-making process, which specifically includes: S2.1, Traverse the application list, including: The process is triggered when the application is loaded in the desktop launcher, and then the list of icon information for all installed applications is traversed; and the display attributes and metadata of each application icon are obtained to prepare for subsequent identity recognition.
[0091] S2.2 Extract application identity, including: Obtain the application's complete identity information through the ComponentName object; Extract packageName (package name) as the primary identification criterion; Extract className (class name) as auxiliary identification information; Construct a unique identifier string for the application, used for precise matching.
[0092] S2.3 Perform identity matching and judgment, including: It pre-defines a list of common clock application package names (e.g., com.android.deskclock, com.sec.android.app.clockpackage, etc.); then uses a string matching algorithm to compare the package names; returns a boolean matching result (true / false); and records the information of the successfully matched applications.
[0093] S2.4 makes decisions and routes; Specifically, if a match is successful: proceed with the dynamic icon processing flow and load the dynamic resource group from the theme package; if a match fails: follow the traditional static icon processing flow and load the default application icon; then set the corresponding processing flag based on the decision result.
[0094] S2.5 creates the corresponding view; specifically including: For dynamic icons, instantiate a PriDynamicBubbleTextView (custom class name) and set dynamic icon-specific properties; for static icons, instantiate a regular BubbleTextView (custom UI control class name) and set standard icon properties; then configure the view's layout parameters and display style.
[0095] After the clock icon decision is completed, proceed to step S30; Step S30: Enter the dynamic rendering process, as follows... Figure 5 As shown, the drawing and rendering process begins, specifically including: S3.1 Custom view initialization; In this embodiment, the custom initialization includes: creating a Paint object and setting the anti-aliasing flag (ANTI_ALIAS_FLAG); where Paint refers to a specific drawing tool or function used to create, modify, and process images.
[0096] Next, configure drawing parameters such as brush color, style, and line thickness; initialize the canvas and environment variables; and prepare the auxiliary utility classes needed for drawing.
[0097] S3.2 Override the drawing method, specifically including: overriding the drawDotIfNecessary() method and inserting custom drawing logic. The drawDotIfNecessary() method name refers to drawing a point when certain conditions are met, which means drawing a point on the graphical user interface or canvas.
[0098] Then, the `drawDynamic()` method is called to draw the dynamic content and implement the dynamic effect; then, the parent class's `super.drawDotIfNecessary()` is called to ensure the original logic, that is, the necessary point drawing operations are performed using the parent class's `drawDotIfNecessary()` method. Finally, the modified code is ensured to be backward compatible.
[0099] S3.3, Execute the condition check steps, which specifically include: checking whether the dynamic icon resource is effectively loaded and not recycled; checking whether the current view has focus (hasFocus); checking whether the view is visible (isShown); checking whether the current working mode is special; and then comprehensively judging whether dynamic drawing is required based on all conditions.
[0100] S3.4 Timer management steps, specifically including: when the view gains focus, create a timer instance and set a trigger interval of 1000 milliseconds; when the view loses focus, immediately stop the timer and release related resources; then handle the timer state management when the interface switches, and optimize the start and stop frequency of the timer.
[0101] S3.5, Real-time Clock Drawing Execution Steps, specifically including: First, obtain the current precise system time (hour, minute, second); then calculate the hour hand rotation angle: hour × 30° + minute × 0.5°; calculate the minute hand rotation angle: minute × 6°; and calculate the second hand rotation angle: second × 6°; control the drawing of layers in sequence: background → hour hand → minute hand → second hand.
[0102] As can be seen from the above, the embodiments of the present invention can achieve realistic timekeeping, with a smooth sweeping second hand and precise movement of the hour and minute hands, providing a visual experience comparable to a mechanical wristwatch. It also supports multiple themed dials, offering various dynamic themes such as classic watches, minimalist digital designs, and sci-fi floating themes. Furthermore, it allows for personalized customization, supporting custom backgrounds, hand colors, and marker styles, thus providing convenience for users.
[0103] Exemplary device like Figure 6 As shown, this embodiment of the invention provides a dynamic clock implementation device for intelligent anti-mistake clearing, the device comprising: The priority elevation control module 310 is used to detect the startup of the clock application and control the clock application to be elevated to a high-priority foreground service according to preset requirements. The list addition guidance module 320 is used to add the clock application to the system-level battery optimization whitelist or protected application list according to the guidance prompts, so that the clock application obtains system-level exemption. The clock active state intelligent judgment and rendering module 330 is used to intelligently determine the current active state when the clock application receives an active viewing or use of the clock function, and maintain its keep-alive mechanism to control the dynamic effect of smooth sweeping of the second hand and precise movement of the hour and minute hands in real time rendering. The clock sleep control module 340 is used to control the clock application to intelligently enter a sleep state when no interaction with the screen is detected for a predetermined time or when the screen is detected to be off, as described above.
[0104] This invention combines a priority-elevation control module with a list-addition guidance module for system-level protection, and introduces a clock activity status intelligent judgment and rendering module and a clock sleep control module for dynamic resource management. This effectively prevents the clock application from being accidentally shut down, solving the key problems of alarm clock failure and timekeeping progress loss, thus improving user experience and ensuring the reliability of the clock function. Specifically, the priority-elevation control module ensures that the clock application receives priority system resources during startup; the list-addition guidance module guides user operations to grant the clock application system-level exemptions, avoiding the risk of cleanup; simultaneously, the clock activity status intelligent judgment and rendering module maintains real-time rendering of dynamic effects during user interaction, ensuring a smooth visual experience; and the clock sleep control module intelligently switches to a low-power mode when inactive, saving system resources while retaining core timing functions. This overall technical concept, through the synergistic effect of the modules, constructs a complete technical chain from startup protection and system exemption to status awareness, significantly overcoming the vulnerability of clock applications caused by insufficient priority or lack of system exemptions in existing technologies.
[0105] Through the aforementioned technical solution, this device ensures that the clock application stably performs its critical functions in the complex operating environment of smart terminals. For example, when a user sets an alarm and performs a system cleanup operation, the clock application, having obtained system-level exemptions and maintaining a keep-alive mechanism, will not be unexpectedly terminated, thus ensuring the alarm is triggered on time. Simultaneously, when the user actively views the clock interface, the dynamic rendering mechanism provides a visual effect of smooth second hand movement and precise hour and minute hand movement. When the screen is off or there is no interaction for an extended period, it automatically enters a sleep state, effectively balancing functional reliability and resource consumption. Overall, this technical solution, through the organic combination of system-level protection and intelligent state management, fundamentally solves the technical problem of clock applications being easily and accidentally cleaned up, providing users with continuous and stable time management services.
[0106] Based on the above embodiments, the present invention also provides a smart terminal, the principle block diagram of which can be as follows: Figure 7 As shown. The intelligent terminal includes a processor, memory, network interface, display screen, and database connected via a system bus.
[0107] The memory stores one or more programs configured to be executed by a processor to implement the dynamic clock implementation method for intelligent anti-mistaken cleanup described in the above embodiments.
[0108] Here, "intelligent terminal" refers to a smart computer or similar device with data processing capabilities. The memory can be internal memory, flash memory, hard disk, or cloud storage space, used to store program code and various pre-set data for clock generation, such as the background image (bg_clock.png), hour hand image (hour.png), minute hand image (min.png), and second hand image (sec.png). The processor can be a central processing unit (CPU), used to execute the algorithmic logic in the program. The program includes a dynamic clock implementation method for intelligent error prevention and cleanup.
[0109] In a further embodiment, a smart terminal of this embodiment effectively avoids the problem of unexpected termination of the clock application caused by the system's "one-click cleanup" function in the prior art by deeply integrating the smart terminal hardware architecture with the dynamic clock anti-misoperation cleanup method. Specifically, by executing the above method, the smart terminal can detect the startup of the clock application and elevate it to a high-priority foreground service, while guiding the user to add the clock application to the system-level battery optimization whitelist or protected application list to obtain system-level exemption. In addition, the terminal can also intelligently judge the activity status of the clock application, maintain the keep-alive mechanism when the user actively views or uses the clock function, and control the dynamic effects of smooth second hand sweeping and precise hour and minute hand movement in real time; when no screen interaction is detected for a predetermined time or the screen is turned off, the terminal intelligently controls the clock application to enter a sleep state, thereby optimizing resource consumption while ensuring the accurate execution of alarm clock and timekeeping services.
[0110] Because smart terminals need to handle complex scenarios such as multitasking or split-screen modes during operation, this application further monitors the terminal status in real time by continuously listening to system broadcasts or APIs. When the clock application is detected to be in multitasking or split-screen mode and is visible but not focused, the smart terminal control raises the rendering priority of the clock application to a medium to high level and requests the system scheduler to reserve CPU and GPU time slices; if system resources are scarce, the animation frame rate is dynamically fine-tuned to ensure the stability of clock operation. Based on this technical logic, this solution, through the collaborative design of hardware and software, fundamentally solves the technical problem in the background technology of clock application failure or loss of timing progress due to accidental clearing. Compared with traditional terminals that only rely on basic process management mechanisms, the smart terminal of this application can actively maintain the system-level exemption state of the clock application, and dynamically adjust the resource allocation strategy according to actual interaction needs, thereby significantly reducing unnecessary power consumption while avoiding functional interruption.
[0111] Through the above technical solution, smart terminals achieve refined management of the entire lifecycle of clock applications. When a user launches the clock application for the first time, the terminal automatically guides the user to add it to the battery optimization whitelist or protected application list, granting it system-level exemptions. In active mode, the terminal ensures smooth rendering of the dynamic effects of the second, minute, and hour hands; in inactive mode, it enters a low-power sleep mode. This design not only avoids the risk of functional failure caused by a "one-size-fits-all" cleanup logic, but also balances user experience and system efficiency through an intelligent state judgment mechanism. Overall, this technical concept, through deep integration of terminal hardware and anti-misoperation cleanup methods, provides a reliable technical path to solve the stability problem of clock applications, significantly improving the practicality and reliability of smart terminals in time management scenarios.
[0112] This invention also provides a computer-readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to execute the dynamic clock implementation method for intelligent anti-mistake clearing described in any of the above embodiments.
[0113] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for implementing a dynamic clock with intelligent anti-mistake clearing, characterized in that, include: Upon detecting that the clock application has started, control the clock application to be elevated to a high-priority foreground service according to preset requirements; Following the prompts, add the clock application to the system-level battery optimization whitelist or protected application list, and the clock application will gain system-level exemption. When the clock application detects that it has received an active viewing or use of the clock function, it intelligently determines that it is currently active and maintains its keep-alive mechanism, controlling the dynamic effects of smooth sweeping of the second hand and precise movement of the hour and minute hands to be rendered in real time. When no screen interaction is detected for a predetermined period of time or the screen is detected to be off, the clock application is controlled to intelligently enter a sleep state.
2. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 1, characterized in that, Before the step of detecting that the clock application has started and controlling the clock application to be promoted to a high-priority foreground service according to preset requirements, the following steps are included: setting the clock application as a high-priority foreground service in advance and displaying it in the status bar.
3. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 2, characterized in that, Before the step of detecting that the clock application has started and controlling the clock application to be promoted to a high-priority foreground service according to preset requirements, the following are included: The clock app is pre-configured to have intelligent scene awareness capabilities, determining whether to enter active or sleep mode based on the current activity level.
4. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 1, characterized in that, The steps of intelligently determining the current active state and maintaining its keep-alive mechanism when the clock application detects that it has received an active viewing or use of the clock function, and controlling the real-time rendering of the dynamic effects of smooth second hand sweeping and precise hour and minute hand movement, include: When the clock app detects events such as viewing the clock interface, setting an alarm, or using a timer, it intelligently senses and determines that it is currently active. It maintains its keep-alive mechanism, controls the smooth sweeping of the second hand and the precise movement of the hour and minute hands to render dynamic effects in real time, and controls the precise execution of alarm and timekeeping services.
5. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 1, characterized in that, The step of controlling the clock application to intelligently enter a sleep state when no screen interaction is detected after a predetermined time or when the screen is detected to be off includes: When the clock application detects that the user has exited the clock application interface, or when the smart terminal screen is turned off, and no interaction with the screen is detected for more than a predetermined time, or when the screen is turned off, the clock application intelligently determines that it is currently inactive and controls it to enter the intelligent sleep mode. When the screen is detected to be turned on again or the application is opened, the control wakes up from sleep mode and resumes real-time display and interactive functions.
6. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 1, characterized in that, The step of intelligently determining the current active state and maintaining its keep-alive mechanism when the clock application detects that it has received an active viewing or use of the clock function, and controlling the real-time rendering of the dynamic effects of smooth sweeping of the second hand and precise movement of the hour and minute hands, further includes: Continuously monitor system broadcasts or APIs to detect in real time whether the current smart terminal is in multitasking or split-screen mode; When the smart terminal is detected to be in multitasking or split-screen mode, the clock application further determines whether the clock application is currently visible; at the same time, it assesses whether the clock application is the currently focused application. Based on the current dynamic effects of the clock application, including the smooth animation effects of the second, minute, and hour hands, assess the required CPU and GPU rendering resources.
7. The method for implementing a dynamic clock with intelligent anti-mistake clearing according to claim 6, characterized in that, The step of intelligently determining the current active state and maintaining its keep-alive mechanism when the clock application detects that it has received an active viewing or use of the clock function, and controlling the real-time rendering of the dynamic effects of smooth sweeping of the second hand and precise movement of the hour and minute hands, further includes: When the system is detected to be in multitasking or split-screen mode, and the clock application is visible but not in focus, the controller will intelligently upgrade the rendering priority of the clock application from the default background rendering priority to a medium to high priority. During the intelligent enhancement of rendering priority, the clock application is controlled to send a request to the system scheduler to reserve a predetermined amount of CPU and GPU time slices for the rendering thread of the clock application. When system resources are extremely scarce and stuttering still occurs even after increasing the rendering priority, the clock application controls the animation frame rate to dynamically fine-tune the frame rate based on the currently available rendering resources, performs adaptive frame rate adjustment, controls the overall stability of the clock operation, and ensures a smooth transition of animation effects. When it is detected that the multitasking or split-screen mode has been exited, or the clock application is no longer visible, the clock rendering priority is automatically restored to the power-saving priority of the smart sleep mode.
8. A dynamic clock implementation device for intelligent anti-mistake clearing, characterized in that, The device includes: The priority escalation control module is used to detect the startup of the clock application and control the clock application to be elevated to a high-priority foreground service according to preset requirements; The list includes a guidance module, which, based on guidance prompts, adds the clock application to the system-level battery optimization whitelist or protected application list, thereby granting the clock application system-level exemption. The clock active state intelligent judgment and rendering module is used to intelligently determine the current active state when the clock application receives an active viewing or use of the clock function, and maintain its keep-alive mechanism to control the dynamic effect of smooth sweeping of the second hand and precise movement of the hour and minute hands in real time rendering. The clock sleep control module is used to control the clock application to intelligently enter sleep mode when no interaction with the screen is detected for a predetermined time or when the screen is detected to be off.
9. A smart terminal, characterized in that, It includes a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors, wherein the one or more programs include methods for performing any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the method as described in any one of claims 1-7.