Disk space management method and device, equipment, storage medium and computer program
By implementing the disk space management method in the terminal device and entering different modes for optimization and cleaning according to the disk space usage, the problem of being unable to boot due to exhaustion of disk space is solved, ensuring the availability of disk space and system stability.
Patent Information
- Application Number
- CN202411441677.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-21
AI Technical Summary
All-in-one terminal devices based on lightweight operating systems such as Android systems cannot be turned on when disk space is exhausted, and the existing technology cannot effectively solve this problem.
Provides a disk space management method that determines disk space usage and enters different modes for optimization and cleanup. Specifically, it includes entering the first mode when the disk space is insufficient, and performs disk space optimization according to the optimization items selected by the user; entering the second mode when the disk space is exhausted, and performing automatic cleaning tasks to clean up the disk space.
Effectively solve the problem that the disk space is exhausted. Through the optimization items and automatic cleaning tasks selected by the user, the availability of the disk space is ensured, and the system can avoid the stricter model of the system.
Smart Images

Figure CN119336268A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data storage, and in particular to a disk space management method, apparatus, device, storage medium and computer program. Background Art
[0002] At present, once the disk space of terminal devices such as all-in-one computers based on lightweight operating systems such as Android and Hongmeng is exhausted, they will be unable to boot up.
[0003] The Android native system provides a disk space monitoring service, which notifies users of disk space status by broadcasting, but it does not really solve the problem of being unable to boot due to running out of disk space. Summary of the invention
[0004] The present invention provides a disk space management method, device, equipment, storage medium and computer program to solve the problem of being unable to boot due to disk space exhaustion.
[0005] In a first aspect, the present disclosure provides a disk space management method, comprising:
[0006] Determine disk space usage;
[0007] When it is determined that the disk space is insufficient, entering a first mode, in which the disk space is optimized according to the optimization items selected by the user;
[0008] When it is determined that the disk space is exhausted, the second mode is entered, and an automatic cleanup task is performed in the second mode to clean up the disk space.
[0009] In some embodiments, determining the disk space usage includes: monitoring the system's disk space broadcast, where the disk space broadcast includes insufficient disk space, exhausted disk space, and available disk space.
[0010] In some embodiments, before performing disk space optimization according to the optimization items selected by the user in the first mode, the method further includes:
[0011] In the first mode, a pop-up task is started to allow the user to choose whether to clean up the disk space;
[0012] If you choose to clean up disk space, a disk optimization task will be created and an optimization project selection page will be provided; if no action is taken on the pop-up window or you choose not to clean up disk space within the first duration, the pop-up window will disappear and the pop-up task will be started again after the second duration.
[0013] In some embodiments, the optimization items include at least one of cloud synchronization tasks, manual cleanup, file scanning, and path compression.
[0014] In some embodiments, when the optimization item selected by the user includes a cloud synchronization task, performing disk space optimization according to the optimization item selected by the user in the first mode includes:
[0015] Scan local media files;
[0016] Select a first target file from the scan results and upload it to the cloud sharing space of the target cloud account;
[0017] Release the disk space occupied by the first target file.
[0018] In some embodiments, when the optimization item selected by the user includes manual cleanup, performing disk space optimization according to the optimization item selected by the user in the first mode includes:
[0019] Jump to the File Manager app;
[0020] Clean up the second target file selected by the user in the file manager application.
[0021] In some embodiments, when the optimization item selected by the user includes file scanning, performing disk space optimization according to the optimization item selected by the user in the first mode includes:
[0022] Scan and display third target files that occupy disk space exceeding a threshold;
[0023] Acquire a target processing method selected by a user from candidate processing methods, and process the third target file based on the target processing method;
[0024] The candidate processing methods include deletion, compression and file migration.
[0025] In some embodiments, when the optimization item selected by the user includes path compression, performing disk space optimization according to the optimization item selected by the user in the first mode includes:
[0026] Scan and display compressible file paths;
[0027] When the user selects compression, at least one of the compression processes is performed on the compressible file path.
[0028] In some embodiments, freezing the screen and executing automatic cleanup tasks to clean up disk space in the second mode also includes: prompting through a permanent pop-up window that the current system is in the second mode.
[0029] In some embodiments, the automatic cleanup task includes at least one of a disk guard task, a forced migration task, and a cache cleanup task.
[0030] In some embodiments, when the automatic cleaning task includes a disk guard task, executing the automatic cleaning task in the second mode to clean up disk space includes:
[0031] Monitor all disk write actions;
[0032] Determine whether the disk write action is a user action;
[0033] If it is a user action, the current disk write action is terminated.
[0034] In some embodiments, when the automatic cleanup task includes a forced migration task, executing the automatic cleanup task in the second mode to clean up disk space includes:
[0035] Scan for files that can be migrated;
[0036] Migrate migratable files to external storage devices or cloud sharing spaces.
[0037] In some embodiments, when the automatic cleaning task includes a cache cleaning task, performing the automatic cleaning task in the second mode to clean up disk space includes:
[0038] Scan the system's cached data;
[0039] Clean up the scanned cache data;
[0040] The cache data includes at least one of a network cache and an installation package cache.
[0041] In some embodiments, when the automatic cleanup task includes a forced migration task and / or a cache cleanup task, after executing the automatic cleanup task in the second mode to clean up the disk space, the method further includes:
[0042] Simulate system restart behavior to verify whether the system can start;
[0043] If it can be started, then exit the second mode;
[0044] If it fails to start, restore the system to factory settings to forcefully clear all user data.
[0045] In some embodiments, a freeze screen process is also performed in the second mode.
[0046] In a second aspect, the present disclosure provides a disk space management device, comprising:
[0047] A determination module, used to determine disk space usage;
[0048] An optimization module, configured to enter a first mode when determining that the disk space is insufficient, and optimize the disk space according to the optimization items selected by the user in the first mode;
[0049] The cleaning module is used to enter the second mode when it is determined that the disk space is exhausted, and execute an automatic cleaning task in the second mode to clean up the disk space.
[0050] In a third aspect, the present disclosure provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the first aspect.
[0051] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when executed by a processor.
[0052] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect when executed by a processor.
[0053] The present invention provides a disk space management method, device, equipment, storage medium and computer program, which determine the disk space usage; when it is determined that the disk space is insufficient or the disk space is exhausted, enter different modes and adopt different disk space optimization processing strategies to solve the problem of being unable to boot due to disk space exhaustion. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The present disclosure will be described in more detail below based on embodiments and with reference to the accompanying drawings:
[0055] Figure 1 A schematic diagram of the life cycle process of the Android native system's disk space monitoring service provided in an embodiment of the present disclosure.
[0056] Figure 2 A flowchart of a disk space management method provided by an embodiment of the present disclosure.
[0057] Figure 3 A schematic diagram of the disk management service life cycle provided in an embodiment of the present disclosure.
[0058] Figure 4 A schematic diagram of the execution logic of the first mode provided for an embodiment of the present disclosure.
[0059] Figure 5 A schematic diagram of the execution logic of the second mode provided for an embodiment of the present disclosure.
[0060] In the drawings, the same reference numerals are used for the same components and the drawings are not drawn to scale. DETAILED DESCRIPTION
[0061] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, and to fully understand and implement how the present disclosure applies technical means to solve technical problems and achieve the corresponding technical effects, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all of the embodiments. The embodiments of the present disclosure and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure.
[0062] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0063] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0064] At present, once the disk space of terminal devices such as all-in-one computers based on lightweight operating systems such as Android and Hongmeng is exhausted, they will be unable to boot up.
[0065] The Android native system provides a disk space monitoring service, which notifies users of disk space status by broadcasting, but it does not really solve the problem of being unable to boot due to running out of disk space.
[0066] like Figure 1As shown, the Android native system's disk space monitoring service (Storage Sentry) includes: when the available disk space is lower than the threshold, a global broadcast is sent, the broadcast type is insufficient disk available space, and it is sent once a minute; when the disk space is exhausted, a global broadcast is sent, the broadcast type is exhausted disk space, and it is sent once a minute; when the disk space recovers to above the specified threshold, a global broadcast is sent, the broadcast type is disk space available, and it is sent once.
[0067] The embodiments of the present disclosure provide a disk space management method, apparatus, device, storage medium and computer program, which provide an effective disk space management solution based on a disk space monitoring mechanism to solve the problem of being unable to boot due to disk space exhaustion.
[0068] Embodiment 1
[0069] Figure 2 The following is a flowchart of a disk space management method provided by an embodiment of the present disclosure. Figure 2 As shown, a disk space management method includes:
[0070] Step S11, determining disk space usage.
[0071] Step S12: When it is determined that the disk space is insufficient, the first mode is entered, and in the first mode, the disk space is optimized according to the optimization items selected by the user.
[0072] Step S13: When it is determined that the disk space is exhausted, enter the second mode, and perform an automatic cleanup task in the second mode to clean up the disk space.
[0073] In some embodiments, the disk space management method may further include:
[0074] Step S14: When it is determined that the disk space is available, the normal mode is entered, and the disk space usage is continued to be determined, so as to enter the first mode, the second mode or maintain the current normal mode according to the disk space usage. When in the first mode or the second mode, if it is determined that the disk space is available, the first mode or the second mode is exited and switched back to the normal mode.
[0075] This method can be implemented as a disk management service (Storage Sentry) in a terminal device. When the system starts, the service can be started like other core services in the system and run in normal mode. Here, normal mode refers to a management mode that only obtains disk space usage without optimizing or cleaning disk space. In normal mode, the system's disk space usage is that the disk is available.
[0076] In some examples, insufficient disk space may mean that the remaining usable disk space is less than 20% of the total disk space, exhausted disk space may mean that there is no remaining disk space, and available disk space may mean that the remaining usable disk space reaches more than 20% of the total disk space.
[0077] In some embodiments, Figure 3 As shown, the terminal device uses the Android native system, so the terminal device has its own disk space monitoring service (Device Storage Monitor Service), which will send a broadcast of disk space usage. The disk space usage is determined in step S11, which can be to monitor the broadcast of the terminal device to obtain information on disk space usage. When Storage Sentry receives a broadcast of insufficient disk space, Storage Sentry will switch to friendly mode (ie, the first mode). When Storage Sentry receives a broadcast that the disk space is exhausted, it will switch to strict mode (ie, the second mode). Friendly mode and strict mode each have different disk slimming strategies. Similarly, when Storage Sentry receives a broadcast that disk space is available, it will switch to normal mode. Similarly, after executing the disk slimming strategy in friendly mode and strict mode, if Storage Sentry receives a broadcast that disk space is available, it will also switch to normal mode.
[0078] In some cases, the terminal device is not configured with a disk space monitoring service. A third-party application can be used to provide a disk space monitoring function and send a broadcast of disk space usage, or the disk space usage can be obtained by reading the storage space information of the terminal device, and then the disk space management mode can be switched according to the disk space usage.
[0079] In some embodiments, the execution logic diagram of the first mode is as follows: Figure 4 As shown. Figure 4 As shown, before performing disk space optimization according to the optimization items selected by the user in the first mode, the method further includes:
[0080] In the first mode, a pop-up task is started to allow the user to choose whether to clean up the disk space;
[0081] If you choose to clean up disk space, a disk optimization task will be created and an optimization project selection page will be provided; if no action is taken on the pop-up window or you choose not to clean up disk space within the first duration, the pop-up window will disappear and the pop-up task will be started again after the second duration.
[0082] In some cases, after entering the first mode, a pop-up window prompt task will be triggered, which can be but not limited to a pop-up window once a minute to friendly remind the user to clean up the disk space in time. The pop-up window provides the option of whether to clean up the disk space immediately. If the user does not operate the options provided in the pop-up window or chooses not to clean up the disk space immediately, the pop-up window disappears and pops up again after one minute. If the user chooses to start cleaning up the disk space immediately, a disk optimization task will be created, and the interface will jump to the page where the user selects the optimization project. Exemplarily, if the user does not choose to clean up the disk space immediately or does not clean up the disk space immediately within one minute, it is confirmed as no operation.
[0083] By prompting users with pop-up windows at a certain frequency, users can be prompted to clean up disk space in a timely manner, so that the disk space can be optimized to an available state when the disk space is insufficient, and the system can be prevented from entering the more stringent second mode to perform screen freezing and automatic cleaning operations as much as possible.
[0084] In some implementations, the optimization items provided in the first mode include at least one of cloud synchronization tasks, manual cleanup, file scanning, and path compression.
[0085] In the case where the optimization items selected by the user include cloud synchronization tasks, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0086] Scan local media files;
[0087] Selecting a first target file from the scan results and uploading it to a cloud sharing space of a target cloud account; and
[0088] Release the disk space occupied by the first target file.
[0089] Under the optimization project of cloud synchronization task, cloud account management is also included. After scanning local media files, users select files to be uploaded to the cloud sharing space of the target cloud account and start uploading synchronization. After the upload is completed, the local occupation is released. Here, users can select one or more first target files for cloud sharing according to the space release requirements. By backing up local files to the cloud sharing space to release disk space, disk space optimization can be achieved while effectively saving data.
[0090] When the optimization items selected by the user include manual cleanup, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0091] Jump to the file manager app; and
[0092] Clean up the second target file selected by the user in the file manager application.
[0093] Since the terminal device comes with a file manager application, this method can be used to automatically jump to the file manager application after the user selects the manual cleanup optimization item, and the user can independently select the second target file to be cleaned. Here, the user can select one or more second target files for manual cleanup according to the space optimization requirements.
[0094] In the case where the optimization items selected by the user include file scanning, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0095] Scan and display third target files that occupy a disk space exceeding a threshold; and
[0096] Obtaining a target processing method selected by a user from candidate processing methods, and processing the third target file based on the target processing method;
[0097] Among them, candidate processing methods include deletion, compression and file migration.
[0098] The file scanning in this method may refer to large file scanning, that is, scanning files that occupy disk space exceeding a threshold, thereby optimizing such files. The user's optimization processing for large files may include but is not limited to at least one of deletion, compression and file migration. The file migration here may further include migration to the cloud shared space of the target cloud account and migration to external storage. By selecting the processing method for large files, the user can effectively release the disk space of large files and increase the available disk space.
[0099] In the case where the optimization item selected by the user includes path compression, disk space optimization is performed according to the optimization item selected by the user in the first mode, including:
[0100] Scan and display compressible file paths; and
[0101] When the user selects compression, the folder in the compressible file path is compressed.
[0102] Here, path compression refers to folder compression. The system scans the compressible file paths and displays them to the user, allowing the user to choose whether to compress the corresponding folders to free up space.
[0103] In the first mode, the user can select one or more of the above optimization items to execute, so as to optimize the disk space according to the user's needs.
[0104] In some embodiments, the execution logic diagram of the second mode is as follows: Figure 5 As shown. Figure 5As shown, while executing the automatic cleanup task in the second mode to clean up the disk space, it also includes: prompting that the current system is in the second mode through a permanent pop-up window.
[0105] In the strict second mode, the system is basically unable to run safely. Therefore, users should be prohibited from continuing operations as much as possible. After entering the second mode, a pop-up window will inform the user that the system has entered the strict mode, and the pop-up window will remain and cannot be canceled, so as to continuously provide users with a striking disk space exhaustion reminder.
[0106] In some embodiments, a freeze screen process is also performed in the second mode to put the system into a freeze screen mode, in which UI (User Interface) tasks, multimedia tasks, and the screen are locked, so that the user cannot operate. Although the user cannot operate, the system background has actually started to execute the automatic cleaning task.
[0107] In some implementations, the automatic cleanup task includes at least one of a disk guard task, a forced migration task, and a cache cleanup task.
[0108] In the case where the automatic cleanup task includes the disk guard task, the automatic cleanup task is executed in the second mode to clean up the disk space, including:
[0109] Monitor all disk write actions;
[0110] Determine whether the disk write action is a user action;
[0111] If it is a user action, the current disk write action is terminated.
[0112] The disk guard task of this embodiment mainly runs to the bottom layer of the system, and can monitor all disk write actions. It only monitors disk write actions and determines whether they are user actions. If the current disk write action is a user action, the write action is terminated. In order to ensure system security, if the current disk write action is a system action, no restriction is made.
[0113] When the automatic cleanup task includes a forced migration task, the automatic cleanup task is executed in the second mode to clean up the disk space, including:
[0114] Scan for files that can be migrated; and
[0115] Migrate migratable files to external storage devices or cloud sharing spaces.
[0116] In the strict second mode, since there is no need to ask the user which files to migrate, the system automatically scans the files that can be migrated and migrates them to an external storage device or the cloud sharing space of the target cloud account. When scanning the files that can be migrated, it determines whether there is external storage (external storage device). If so, it is migrated to the external storage. If not, it is migrated to the cloud sharing space. In the case of external storage, it is preferred to migrate to the external storage. On the one hand, it can save the storage resources of the cloud sharing space. On the other hand, it can avoid the failure to download the required files in time due to network reasons, which affects the user experience.
[0117] When the automatic cleaning task includes a cache cleaning task, the automatic cleaning task is performed in the second mode to clean up the disk space, including:
[0118] Scan the system's cached data;
[0119] Clean up the scanned cache data;
[0120] The cache data includes at least one of a network cache and an installation package cache.
[0121] In the second mode, automatic cleaning of disk space can be achieved by executing one or more of the above automatic cleaning tasks. The automatic cleaning tasks to be executed can be pre-selected and configured in the service configuration according to requirements.
[0122] In some implementations, when the automatic cleanup task includes a forced migration task and / or a cache cleanup task, after executing the automatic cleanup task in the second mode to clean up the disk space, the method further includes:
[0123] Simulate system restart behavior to verify whether the system can start;
[0124] If it can be started, exit the second mode;
[0125] If it fails to start, restore the system to factory settings to forcefully clear all user data.
[0126] In the strict second mode, if the configured automatic cleanup tasks include forced migration tasks and / or cache cleanup tasks, after executing the corresponding tasks, the system starts the safety test task to verify whether the system can start normally by simulating the behavior of system restart. Specifically, it is necessary to simulate the stop and start of the framework. If the test is normal, exit the strict mode. If the test fails, the system directly triggers the factory reset and forces the cleanup of all user data. If the test passes, exit the second mode.
[0127] When exiting the second mode, under the premise of ensuring thread safety and system safety, the permanent pop-up window is first canceled, and then the frozen screen state is released so that the user can continue to operate.
[0128] The method of this embodiment supports multiple disk space cleaning implementation methods. In both the first mode and the second mode, local files can be backed up to the cloud shared space. In the strict second mode, users are effectively restricted from continuing to write to the disk after the disk is full. When the disk space is full, the space can be automatically cleaned up, and after the forced automatic cleaning of the space, the system can be automatically simulated to restart to verify whether the cleaning is effective. If the automatic simulation of the system restart verification fails after the forced automatic cleaning, the factory settings will be automatically restored to clean up all user data. By adopting different disk space management strategies for different disk space usage situations, the disk space can be effectively optimized to a normal usable state, effectively improving the user experience.
[0129] Embodiment 2
[0130] The present disclosure provides a disk space management device, including:
[0131] A determination module, used to determine disk space usage;
[0132] An optimization module, for entering a first mode when determining that the disk space is insufficient, and performing disk space optimization according to the optimization items selected by the user in the first mode;
[0133] The cleaning module is used to enter the second mode when it is determined that the disk space is exhausted, and execute an automatic cleaning task in the second mode to clean up the disk space.
[0134] When it is determined that the disk space is available, the normal mode is entered, and the disk space usage is continuously obtained, so as to enter the first mode, the second mode or maintain the current normal mode according to the disk space usage. When in the first mode or the second mode, if it is determined that the disk space is available, the first mode or the second mode is exited and switched back to the normal mode.
[0135] This device can be implemented as a disk management service (Storage Sentry) in a terminal device. When the system starts, the service can be started like other core services in the system and run in normal mode. Here, normal mode refers to a monitoring mode that only monitors the disk space usage broadcast without optimizing or cleaning the disk space. In normal mode, the system's disk space usage is disk available.
[0136] In some embodiments, the terminal device adopts the Android native system, so the terminal device has its own disk space monitoring service (Device Storage Monitor Service), which will send a broadcast of disk space usage. The monitoring of disk space usage in step S11 can be to monitor the broadcast of the terminal device to obtain information on disk space usage. When Storage Sentry receives a broadcast of insufficient disk space, Storage Sentry will switch to friendly mode (ie, the first mode). When Storage Sentry receives a broadcast of exhausted disk space, it will switch to strict mode (ie, the second mode). Friendly mode and strict mode each have different disk slimming strategies. Similarly, when Storage Sentry receives a broadcast of available disk space, it will switch to normal mode.
[0137] In some implementations, before performing disk space optimization according to the optimization items selected by the user in the first mode, the method further includes:
[0138] In the first mode, a pop-up task is started to allow the user to choose whether to clean up the disk space;
[0139] If you choose to clean up disk space, a disk optimization task will be created and an optimization project selection page will be provided; if no action is taken on the pop-up window or you choose not to clean up disk space within the first duration, the pop-up window will disappear and the pop-up task will be started again after the second duration.
[0140] In some cases, after entering the first mode, a pop-up window prompt task will be triggered, which can be but not limited to a pop-up window once a minute to friendly remind the user to clean up the disk space in time. The pop-up window provides the option of whether to clean up the disk space immediately. If the user does not operate the options provided in the pop-up window or chooses not to clean up the disk space immediately, the pop-up window disappears and pops up again after one minute. If the user chooses to start cleaning up the disk space immediately, a disk optimization task will be created, and the interface will jump to the page where the user selects the optimization project. Exemplarily, if the user does not choose to clean up the disk space immediately or does not clean up the disk space immediately within one minute, it is confirmed as no operation.
[0141] By prompting users with pop-up windows at a certain frequency, users can be prompted to clean up disk space in a timely manner, so that the disk space can be optimized to an available state when the disk space is insufficient, and the system can be prevented from entering the more stringent second mode to perform screen freezing and automatic cleaning operations as much as possible.
[0142] In some implementations, the optimization items provided in the first mode include at least one of cloud synchronization tasks, manual cleanup, file scanning, and path compression.
[0143] In the case where the optimization items selected by the user include cloud synchronization tasks, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0144] Scan local media files;
[0145] Selecting a first target file from the scan results and uploading it to a cloud sharing space of a target cloud account; and
[0146] Release the disk space occupied by the first target file.
[0147] Under the optimization project of cloud synchronization task, cloud account management is also included. After scanning local media files, users select files to be uploaded to the cloud sharing space of the target cloud account and start uploading synchronization. After the upload is completed, the local occupation is released. Here, users can select one or more first target files for cloud sharing according to the space release requirements. By backing up local files to the cloud sharing space to release disk space, disk space optimization can be achieved while effectively saving data.
[0148] When the optimization items selected by the user include manual cleanup, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0149] Jump to the file manager app; and
[0150] Clean up the second target file selected by the user in the file manager application.
[0151] Since the terminal device comes with a file manager application, after the user selects the manual cleanup optimization item, the application will automatically jump to the file manager application, and the user can independently select the second target file to be cleaned. Here, the user can select one or more second target files for manual cleanup according to space optimization requirements.
[0152] In the case where the optimization items selected by the user include file scanning, disk space optimization is performed according to the optimization items selected by the user in the first mode, including:
[0153] Scan and display third target files that occupy a disk space exceeding a threshold; and
[0154] Obtaining a target processing method selected by a user from candidate processing methods, and processing the third target file based on the target processing method;
[0155] The candidate processing methods include at least one of deletion, compression and file migration.
[0156] The file scanning here may refer to large file scanning, that is, scanning files that occupy disk space exceeding a threshold, thereby optimizing such files. The user's optimization processing for large files may include but is not limited to at least one of deletion, compression, and file migration. The file migration here may further include migration to the cloud shared space of the target cloud account and migration to external storage. By choosing a processing method for large files, the user can effectively release the disk space of large files and increase the available disk space.
[0157] In the case where the optimization item selected by the user includes path compression, disk space optimization is performed according to the optimization item selected by the user in the first mode, including:
[0158] Scan and display compressible file paths; and
[0159] When the user selects compression, the folder in the compressible file path is compressed.
[0160] Here, path compression refers to folder compression. The system scans the compressible file paths and displays them to the user, allowing the user to choose whether to compress the corresponding folders to free up space.
[0161] In the first mode, the user can select one or more of the above optimization items to execute, so as to optimize the disk space according to the user's needs.
[0162] In some implementations, while freezing the screen and executing an automatic cleanup task to clean up disk space in the second mode, it also includes: prompting through a permanent pop-up window that the current system is in the second mode.
[0163] In the strict second mode, the system is basically unable to run safely. Therefore, users should be prohibited from continuing operations as much as possible. After entering the second mode, a pop-up window will inform the user that the system has entered the strict mode, and the pop-up window will remain and cannot be canceled, so as to continuously provide users with a striking disk space exhaustion reminder.
[0164] In some embodiments, a freeze screen process is also performed in the second mode to put the system into a freeze screen mode, in which UI (User Interface) tasks, multimedia tasks, and the screen are locked, so that the user cannot operate. Although the user cannot operate, the system background has actually started to execute the automatic cleaning task.
[0165] In some implementations, the automatic cleanup task includes at least one of a disk guard task, a forced migration task, and a cache cleanup task.
[0166] In the case where the automatic cleanup task includes the disk guard task, the automatic cleanup task is executed in the second mode to clean up the disk space, including:
[0167] Monitor all disk write actions;
[0168] Determine whether the disk write action is a user action;
[0169] If it is a user action, the current disk write action is terminated.
[0170] The disk guard task of this embodiment mainly runs to the bottom layer of the system, and can monitor all disk write actions. It only monitors disk write actions and determines whether they are user actions. If the current disk write action is a user action, the write action is terminated. In order to ensure system security, if the current disk write action is a system action, no restriction is made.
[0171] When the automatic cleanup task includes a forced migration task, the automatic cleanup task is executed in the second mode to clean up the disk space, including:
[0172] Scan for files that can be migrated; and
[0173] Migrate migratable files to external storage devices or cloud sharing spaces.
[0174] In the strict second mode, since there is no need to ask the user which files to migrate, the system automatically scans the files that can be migrated and migrates them to an external storage device or the cloud sharing space of the target cloud account. When scanning the files that can be migrated, it determines whether there is external storage (external storage device). If so, it is migrated to the external storage. If not, it is migrated to the cloud sharing space. In the case of external storage, it is preferred to migrate to the external storage. On the one hand, it can save the storage resources of the cloud sharing space. On the other hand, it can avoid the failure to download the required files in time due to network reasons, which affects the user experience.
[0175] When the automatic cleaning task includes a cache cleaning task, the automatic cleaning task is performed in the second mode to clean up the disk space, including:
[0176] Scan the system's cached data;
[0177] Clean up the scanned cache data;
[0178] The cache data includes at least one of a network cache and an installation package cache.
[0179] In the second mode, automatic cleaning of disk space can be achieved by executing one or more of the above automatic cleaning tasks. The automatic cleaning tasks to be executed can be pre-selected and configured in the service configuration according to requirements.
[0180] In some embodiments, when the automatic cleanup task includes a forced migration task and / or a cache cleanup task, after freezing the screen in the second mode and executing the automatic cleanup task to clean up the disk space, the method further includes:
[0181] Simulate system restart behavior to verify whether the system can start;
[0182] If it can be started, exit the second mode;
[0183] If it fails to start, restore the system to factory settings to forcefully clear all user data.
[0184] In the strict second mode, if the configured automatic cleanup tasks include forced migration tasks and / or cache cleanup tasks, after executing the corresponding tasks, the system starts the safety test task to verify whether the system can start normally by simulating the behavior of system restart. Specifically, it is necessary to simulate the stop and start of the framework. If the test is normal, exit the strict mode. If the test fails, the system directly triggers the factory reset and forces the cleanup of all user data. If the test passes, exit the second mode.
[0185] When exiting the second mode, under the premise of ensuring thread safety and system safety, the permanent pop-up window is first canceled, and then the frozen screen state is released so that the user can continue to operate.
[0186] The device of this embodiment supports multiple disk space cleaning implementation methods. In both the first mode and the second mode, it supports backing up local files to the cloud shared space. In the strict second mode, it effectively limits the user's continued writing to the disk after the disk is full. When the disk space is full, it can force automatic cleaning of the space, and after forced automatic cleaning of the space, it can automatically simulate a system restart to verify whether the cleaning is effective. If the automatic simulation of the system restart verification fails after forced automatic cleaning, it will further automatically restore the factory settings and clean up all user data. By adopting different disk space management strategies for different disk space usage situations, the disk space can be effectively optimized to a normal and available state, effectively improving the user experience.
[0187] Embodiment 3
[0188] On the basis of the above embodiments, this embodiment provides a terminal device, including a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method described in the above embodiments.
[0189] In some implementations of this embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0190] In some implementations of this embodiment, a computer program product is provided, including a computer program, which implements the steps of the method described in the above embodiment when executed by a processor.
[0191] The processor may include, but is not limited to, one or more processors or microprocessors, etc. Each processor may be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components to execute the methods in the above embodiments.
[0192] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, and the computer-readable storage medium may include but is not limited to, for example, random access memory (RAM), read-only memory (ROM), flash memory, EPROM memory, EEPROM memory, registers, computer storage media (e.g., hard disk, floppy disk, solid-state drive, removable disk, CD-ROM, DVD-ROM, Blu-ray disc, etc.).
[0193] The computer-readable storage medium may also store at least one computer executable program / instruction, which may be, for example, a computer-readable instruction. The computer-readable storage medium includes, but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The computer-readable storage medium may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device runs the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0194] In addition, the computer device may also include (but not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.), etc.
[0195] The processor may communicate with external devices via an I / O bus via a wired or wireless network.
[0196] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0197] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0198] It should be noted that in the present disclosure, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element limited by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0199] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the technical field to which the present disclosure belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A disk space management method, characterized in that: include: Determine disk space usage; When it is determined that the disk space is insufficient, entering a first mode, in which the disk space is optimized according to the optimization items selected by the user; When it is determined that the disk space is exhausted, the second mode is entered, and an automatic cleanup task is performed in the second mode to clean up the disk space.
2. The disk space management method according to claim 1, characterized in that: The determining of the disk space usage includes: monitoring the disk space broadcast of the system, wherein the disk space broadcast includes insufficient disk space, exhausted disk space and available disk space.
3. The disk space management method according to claim 1, characterized in that: Before performing disk space optimization according to the optimization items selected by the user in the first mode, the method further includes: In the first mode, a pop-up task is started to allow the user to choose whether to clean up the disk space; If you choose to clean up disk space, a disk optimization task will be created and an optimization project selection page will be provided; If no action is taken on the pop-up window or if you choose not to clean up disk space within the first duration, the pop-up window will disappear and the pop-up window task will be started again after the second duration.
4. The disk space management method according to claim 1, characterized in that: The optimization project includes at least one of cloud synchronization tasks, manual cleaning, file scanning and path compression.
5. The method according to claim 4, characterized in that In the case where the optimization item selected by the user includes a cloud synchronization task, performing disk space optimization according to the optimization item selected by the user in the first mode includes: Scan local media files; Select a first target file from the scan results and upload it to the cloud sharing space of the target cloud account; Release the disk space occupied by the first target file.
6. The method according to claim 4, characterized in that In the case where the optimization item selected by the user includes manual cleanup, performing disk space optimization according to the optimization item selected by the user in the first mode includes: Jump to the File Manager app; Clean up the second target file selected by the user in the file manager application.
7. The method according to claim 4, characterized in that In the case where the optimization item selected by the user includes file scanning, performing disk space optimization according to the optimization item selected by the user in the first mode includes: Scan and display third target files that occupy disk space exceeding a threshold; Acquire a target processing method selected by a user from candidate processing methods, and process the third target file based on the target processing method; The candidate processing methods include at least one of deletion, compression and file migration.
8. The method according to claim 4, characterized in that In the case where the optimization item selected by the user includes path compression, performing disk space optimization according to the optimization item selected by the user in the first mode includes: Scan and display compressible file paths; When the user selects compression, the folder corresponding to the compressible file path is compressed.
9. The method according to claim 1, characterized in that: Also includes: A permanent pop-up window is used to prompt that the current system is in the second mode.
10. The method according to claim 1, characterized in that The automatic cleaning task includes at least one of a disk guard task, a forced migration task, and a cache cleaning task.
11. The method according to claim 10, characterized in that In the case where the automatic cleaning task includes a disk guard task, executing the automatic cleaning task in the second mode to clean up the disk space includes: Monitor all disk write actions; Determine whether the disk write action is a user action; If it is a user action, the current disk write action is terminated.
12. The method according to claim 10, characterized in that In a case where the automatic cleanup task includes a forced migration task, executing the automatic cleanup task in the second mode to clean up disk space includes: Scan for files that can be migrated; Migrate migratable files to external storage devices or cloud sharing spaces.
13. The method according to claim 10, characterized in that In the case where the automatic cleaning task includes a cache cleaning task, performing the automatic cleaning task in the second mode to clean up disk space includes: Scan the system's cached data; Clean up the scanned cache data; The cache data includes at least one of a network cache and an installation package cache.
14. The method according to claim 10, characterized in that In the case where the automatic cleanup task includes a forced migration task and / or a cache cleanup task, after executing the automatic cleanup task in the second mode to clean up the disk space, the method further includes: Simulate system restart behavior to verify whether the system can start; If it can be started, then exit the second mode; If it fails to start, restore the system to factory settings to forcefully clear all user data.
15. The method according to claim 1, characterized in that In the second mode, a screen freeze process is also performed.
16. A disk space management device, characterized in that: include: A determination module, used to determine disk space usage; An optimization module, configured to enter a first mode when determining that the disk space is insufficient, and optimize the disk space according to the optimization items selected by the user in the first mode; The cleaning module is used to enter the second mode when it is determined that the disk space is exhausted, and execute an automatic cleaning task in the second mode to clean up the disk space.
17. A terminal device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 15.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.
19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.
Citation Information
Patent Citations
Junk file cleaning method, intelligent terminal and computer readable storage medium
CN108021630A
Disk space cleaning method and device, equipment and storage medium
CN117270759A
System and method for intelligent system performance management
WO2021012748A1