Application management method, device, electronic device and storage medium
By obtaining and analyzing the characteristic information of applications running on electronic devices in the foreground, and using the random forest model to predict the usage time, the background application management problem is solved, and automatic management and user experience improvement is achieved.
Patent Information
- Application Number
- CN202110898459.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-08-05
AI Technical Summary
The existing technology is difficult to effectively manage applications running in the background, resulting in high memory usage and large power consumption, reducing the battery life of electronic devices, and poor user experience.
By obtaining the characteristic information of the electronic device when running the target application in the foreground, and using the trained random forest model to predict the usage time of the target application, it is managed based on the predicted duration when the application switches to the background operation.
It realizes automatic management of background running programs without manual operation by users, improves user experience and reduces memory usage and power consumption.
Smart Images

Figure CN113672366B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of application management technology, and more specifically, to an application management method, device, electronic device and storage medium. Background Art
[0002] With the large-scale popularization of electronic devices, various applications (Application, APP for short) have appeared on the market. In order to meet the diverse needs of users, multiple applications are installed in the same electronic device. When using an electronic device, a user may open multiple applications, so multiple applications may run in the background of the electronic device at the same time. On the one hand, multiple applications running in the background occupy a high memory, and on the other hand, they consume a lot of electricity, reducing the battery life of the electronic device. At present, to clean up the applications running in the background, the user usually manually selects the applications to be cleaned, or cleans up all the applications running in the background with one click. The manual selection or one-click cleaning method does not provide a good user experience. Summary of the invention
[0003] In view of the above problems, the present application proposes an application management method, device, electronic device and storage medium, which can solve the above technical problems.
[0004] In a first aspect, an embodiment of the present application provides an application management method, which is applied to an electronic device, and the method includes: when a target application is running in the foreground of the electronic device, obtaining characteristic information of the electronic device; inputting the target application and the characteristic information into a trained random forest model, and obtaining a target usage time corresponding to the target application output by the trained random forest model; when the target application switches from the foreground of the electronic device to the background, managing the target application based on the target usage time.
[0005] In a second aspect, an embodiment of the present application provides an application management device, the device comprising: an acquisition module, used to acquire characteristic information of the electronic device when the target application is running in the foreground of the electronic device; an output module, used to input the target application and the characteristic information into a trained random forest model, and obtain the target usage time corresponding to the target application output by the trained random forest model; a management module, used to manage the target application based on the target usage time when the target application switches from the foreground of the electronic device to the background.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the above method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above method.
[0008] The present application provides an application management method, device, electronic device and storage medium. By acquiring characteristic information of a target application when the electronic device is running in the foreground, and processing the target application and the characteristic information by a trained random forest model, a target usage time corresponding to the target application is obtained, so that when the target application switches from the foreground of the electronic device to the background, the target application is managed based on the target usage time, so that the target application can be kept running within the usage time and managed after the time is reached, thereby realizing automatic management of background running programs without manual operation by the user, thereby improving the user experience.
[0009] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A schematic diagram of a process flow of an application management method provided by an embodiment of the present application is shown;
[0012] Figure 2 A schematic diagram showing a flow chart of an application management method provided by another embodiment of the present application;
[0013] Figure 3 A schematic diagram showing a flow chart of an application management method provided by yet another embodiment of the present application;
[0014] Figure 4 This application shows Figure 3 A flowchart of step S330 of the application management method shown;
[0015] Figure 5A block diagram of an application management device provided by an embodiment of the present application is shown;
[0016] Figure 6 is a block diagram of an electronic device for executing an application management method according to an embodiment of the present application;
[0017] Figure 7 A storage unit for storing or carrying program codes for implementing the application management method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0019] With the large-scale popularization of electronic devices, various applications have emerged on the market. In order to meet the diverse needs of users, multiple applications are installed in the same electronic device. When using an electronic device, a user may open multiple applications, so multiple applications may run in the background of the electronic device at the same time. On the one hand, multiple applications running in the background occupy a high memory, and on the other hand, they consume a lot of power, reducing the battery life of the electronic device. At present, to clean up the applications running in the background, the user usually manually selects the application to be cleaned, or cleans up all the background running applications with one click. Manual selection or one-click cleaning methods do not provide a good user experience.
[0020] Most current electronic devices that do not require manual cleaning adopt a "one-size-fits-all" management strategy for applications, that is, the same management strategy is adopted for all applications, such as cleaning all applications running in the background at the same time, or not cleaning all applications running in the background. This will cause problems with poor user experience, such as untimely cleaning of backend applications, or cleaning of backend applications when users briefly exit the background, which also leads to poor user experience.
[0021] In response to the above technical problems, the inventor has discovered and proposed an application management method, device, electronic device and storage medium after long-term research. When the target application is running in the foreground of the electronic device, the characteristic information of the electronic device is obtained; the target application and the characteristic information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model; when the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time, and the automatic management of the background running program is realized without manual operation by the user, thereby improving the user experience. Among them, the specific application management method is specifically described in the subsequent embodiments.
[0022] Figure 1 The flowchart of the application management method provided by an embodiment of the present application is shown. When the target application is running in the foreground of the electronic device, the characteristic information of the electronic device is obtained; then the target usage time corresponding to the application is obtained according to the characteristic information; when the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time, so as to realize automatic management of the background running program without manual operation by the user, thereby improving the user experience. In a specific embodiment, the application management method is applied to Figure 5 The application management device 100 shown in FIG. Figure 6 The electronic device 200 is configured with the application management device 100. This embodiment will take the application management method applied to an electronic device as an example to illustrate the specific process of this embodiment. The electronic device can be, but is not limited to, a computer, a smart phone, a tablet computer, a smart wearable device, etc. Figure 1 The process shown is described in detail, and the application management method may specifically include the following steps:
[0023] Step S110: When the target application is running in the foreground of the electronic device, characteristic information of the electronic device is obtained.
[0024] When the target application is running in the foreground of the electronic device, the characteristic information of the electronic device is obtained and stored. The characteristic information of the electronic device can be collected at any time period when the target application is running in the foreground, for example, when the target application is switched to the foreground, and for another example, when the target application is running in the foreground for 1 minute. The characteristic information can reflect the user's usage habits when using the electronic device.
[0025] Optionally, the characteristic information includes state information and time information.
[0026] The state information includes at least one of power state information, charging state information, network connection state information, peripheral connection state information, and application switching state information. The power state information is used to characterize the remaining power of the battery. For example, the battery state information can be 75%, that is, the remaining power of the battery is 75% of the full power of the battery. The charging state information is used to characterize the charging state of the battery. For example, when the charging state information is Y, it indicates that the electronic device is in a charging state; when the charging state information is N, it indicates that the electronic device is in a non-charging state. The network connection state information is used to characterize the connection status of the network. For example, when the network connection state information is 1, it indicates that the electronic device is in a networked state and is using the network; when the network connection state information is 0, it indicates that the electronic device is in a non-networked state and is not using the network. The network connection state information includes at least one of the connection state information of Wireless Fidelity (WIFI), the connection state information of cellular traffic, and the connection state information of Bluetooth (BLE). The connection state of WIFI, the connection state information of cellular traffic, and the connection state of BLE all include two states: connection and non-connection. The peripheral connection status information is used to indicate whether the electronic device is connected to a peripheral, wherein the peripheral includes a headset, a microphone, a keyboard, a mouse, a speaker, etc. When the peripheral connection status information is Y, it indicates that the electronic device is connected to a peripheral; when the peripheral connection status information is N, it indicates that the electronic device is not connected to the peripheral. The application switching status information may be an application relationship jump matrix, wherein the application relationship jump matrix records the applications switched by the user at different times in chronological order. For example, the application relationship jump matrix A may be used to indicate that the applications switched in sequence are: a first instant messaging application - a timekeeping application - a food delivery application - a second instant messaging application.
[0027] The time information includes at least one of date information and time information, wherein the date information is, for example, February 3, 2021, and the time information is, for example, 14:00.
[0028] In one implementation, the characteristic information of the electronic device may be collected by a sensor of the electronic device. For example, whether a peripheral device is connected may be collected by a sensor installed on the electronic device.
[0029] In another embodiment, multiple registration broadcasts are generated to obtain multiple characteristic information of electronic devices collected in response to the multiple registration broadcasts. For example, the first registration broadcast registerReceiver(receiver, IntentFilter().addAction(Intent.ACTION_BATTERY_CHANGED)), after receiving the first registration broadcast, use getIntExtra("level") and getIntExtra("scale"), getIntExtra("status") to obtain the battery status information and charging status information, and store them in the database in chronological order. The second registration broadcast registerReceiver(receiver, IntentFilter().addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION)), after receiving the second registration broadcast, use getIntExtra("status") to obtain the current WIFI connection status information, and store it in the database in chronological order. The third registration broadcast is BluetoothDevice.ACTION_ACL_CONNECTED. When getIntExtra().equals(BluetoothDevice.ACTION_ACL_CONNECTED), after receiving the third registration broadcast, getIntExtra("status") obtains the connection status information of BLE and stores it in the database in chronological order. The fourth registration broadcast is getSystemService(CONNECTIVITY_SERVICE). After receiving the fourth registration broadcast, the connection status information of cellular traffic is obtained and stored in the database in chronological order. The fifth registration broadcast is Intent.ACTION_HEADSET_PLUG. After receiving the fifth registration broadcast, the application switching status information is obtained and stored in the database in chronological order.
[0030] When the characteristic information of the electronic device collected is abnormal, the abnormality needs to be processed. In one embodiment, the characteristic information of the electronic device at the first moment is collected. When the characteristic information at the first moment is abnormal, the characteristic information of the electronic device at the second moment is obtained. As a way, the threshold range corresponding to the characteristic information is pre-set. When the characteristic information at the first moment is not within the threshold range, it is considered that the characteristic information at the first moment is abnormal. For example, when the characteristic information is battery status information and the threshold range corresponding to the battery status information is 0-100%, when the battery status information corresponding to the first moment is 102%, the battery status information corresponding to the first moment is not within the threshold range, it is considered that the battery status information corresponding to the first moment is abnormal, wherein the second moment is before the first moment, and optionally, the second moment and the first moment are two adjacent moments when the characteristic information is collected, for example, the characteristic information is collected at 8:00, 8:02, and 8:05. When the first moment is 8:05, the first moment is 8:02. The characteristic information at the first moment is replaced by the characteristic information at the second moment, and the characteristic information at the second moment is used as the characteristic information of the electronic device. It is understandable that when the characteristic information at the first moment is abnormal, the normal characteristic information before the first moment is used as the characteristic information corresponding to the first moment. For example, if the battery status information corresponding to the second moment is 82%, the battery status information 82% corresponding to the second moment replaces the battery status information 102% corresponding to the first moment, that is, the battery status information corresponding to the first moment after replacement is 82%, and the battery status information 82% is used as the battery status information of the electronic device.
[0031] In another embodiment, when the data anomaly is data missing, the characteristic information of the electronic device at the third moment is collected; when the characteristic information of the third moment is missing, the characteristic information collected by the electronic device at the fourth moment is obtained, wherein the third moment is before the fourth moment; according to the characteristic information collected at the fourth moment, the characteristic information of the first moment is supplemented, and it can be understood that the characteristic information corresponding to the third moment is inferred according to the characteristic information corresponding to the fourth moment. For example, the characteristic information corresponding to the fourth moment with only two states is negated, such as the charging state information, network connection state information and peripheral connection state information in the characteristic information corresponding to the fourth moment are negated, that is, when the charging state information corresponding to the fourth moment is the charging state, the charging state information corresponding to the third moment is the non-charging state; the network connection state information corresponding to the fourth moment is the connection state, the network connection state information corresponding to the third moment is the non-connection state; the peripheral connection state information corresponding to the fourth moment is the non-connection state, and the peripheral connection state information corresponding to the third moment is the connection state. For another example, the characteristic information with multiple states is taken to the maximum value, such as the power state information corresponding to the fourth moment is 81% and 82%, and the power state information corresponding to the third moment is 82%.
[0032] Optionally, the collected characteristic information can also be labeled. For example, when the characteristic information includes date information, the date information includes Monday to Sunday, and each day of the week corresponds to a label, for example, Monday corresponds to label a, Tuesday corresponds to label b, and Wednesday corresponds to label c; the characteristic information includes time information, and each of the multiple time information corresponds to a label, for example, 1:00 corresponds to label 1, and 12:00 corresponds to label 12; the characteristic information includes battery status information, and each of the multiple power status information corresponds to a label, for example, the power status information of 10%-20% corresponds to label B, and the power status information of 20%-30% corresponds to label C.
[0033] Step S120: input the target application and the feature information into a trained random forest model to obtain a target usage time corresponding to the target application output by the trained random forest model.
[0034] Optionally, multiple decision trees are pre-built in the trained random forest model, and the target application and feature information are input into the multiple decision trees. Each of the multiple decision trees outputs a decision duration, and multiple decision durations are obtained. The target usage duration is obtained based on the multiple decision durations. In one method, the average of the multiple decision durations can be used as the target usage duration. In another method, the decision duration with the most occurrences can be selected from the multiple decision durations as the target usage duration.
[0035] In one embodiment, after the target application and feature information are collected, the target application and feature information are input into a trained random forest model to obtain a target usage time corresponding to the target application output by the trained random forest model.
[0036] In another embodiment, when a preset trigger event is monitored, the target application and the characteristic information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model.
[0037] Optionally, the preset trigger event includes: the target application switches from the foreground of the electronic device to the background; the display screen of the electronic device switches from a screen-on state to a screen-off state; the electronic device switches from a charging state to a non-charging state; or the remaining power of the electronic device is less than a preset power.
[0038] Step S130: When the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time.
[0039] In one embodiment, the running time of the target application running in the background of the electronic device is obtained; when the running time is greater than the target usage time, for example, the running time is 40 minutes and the target usage time is 30 minutes, then the running time is greater than the target usage time. It is understandable that when the target usage time is exceeded, the user has not used the target application, and the target application is automatically cleaned up. Optionally, the cleaning may include completely closing the target application, and after closing, the target application does not run in the background; it may also include closing some functions of the target application, for example, closing the video playback page previously located by the target application, restoring to the initial interface of the target application, and the target application runs in the background in a low-power, low-memory manner. Automatic cleaning of the target application improves the user experience without manual operation, and reduces memory usage after cleaning, while reducing battery power consumption.
[0040] In another embodiment, when the target application is running in the background, a preset usage time is obtained. When the target usage time is greater than the preset usage time, the target application is considered to be an application that is frequently used by the user. In order to facilitate the user to open the target application in time, the background running status of the target application is continued; when the target usage time is less than the preset usage time, the target application is considered to be an application that is not frequently used by the user. In order to save power and reduce memory, the target application is cleaned up.
[0041] In the application management method provided in this embodiment, when the target application is running in the foreground of the electronic device, the characteristic information of the electronic device is obtained; then the target application and the characteristic information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model; when the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time to realize automatic management of the background running programs, and the control strategy is simple and does not require manual operation by the user, thereby improving the user experience.
[0042] This embodiment provides an application management method based on the previous embodiment, which outputs different levels of duration through a two-layer random forest model to prevent different levels of duration from interfering with each other, so as to improve the accuracy of the output results, wherein different levels of duration include short duration, medium duration and long duration. Figure 2 A flowchart of an application management method provided by another embodiment of the present application is shown. Figure 2 The application management method may specifically include the following steps:
[0043] Step S210: When the target application is running in the foreground of the electronic device, characteristic information of the electronic device is obtained.
[0044] For the detailed description of step S210, please refer to step S110, which will not be repeated here.
[0045] Step S220: input the target application and the characteristic information into the trained first random forest model to obtain a first usage duration corresponding to the target application output by the trained first random forest model.
[0046] The trained first random forest model is used to output short durations and non-short durations. When the first usage duration is less than the preset duration, that is, the first duration is a short duration, the first usage duration is used as the target usage duration. For example, if the preset duration is 2 minutes and the first usage duration is less than 5 minutes, it is a short duration and can be directly output by the trained first random forest model.
[0047] When the first duration is greater than the preset duration, it is considered that the first duration is not a short duration, and the non-short duration is a medium duration or a long duration, which requires a trained second random forest model to make a judgment.
[0048] Step S230: When the first usage time is greater than the preset time, the target application and the characteristic information are input into the trained second random forest model to obtain a second usage time corresponding to the target application output by the trained second random forest model, and the second usage time is used as the target usage time.
[0049] Among them, the trained second random forest model is used to output medium duration and long duration. The first duration output by the trained first random forest model determines that the target application corresponds to a non-short duration, and the target application and feature information are re-input into the trained second random forest model to obtain the second usage duration corresponding to the target application output by the trained second random forest model. For example, when the second usage duration is greater than 5 minutes and less than 10 minutes, the second usage duration is considered to be medium duration, and when the second usage duration is greater than 10 minutes, the second usage duration is considered to be long duration.
[0050] It should be noted that when the durations at different levels are not limited to the above three types, a multi-layer random forest model can be set, in which each layer of the random forest model outputs one level of duration to improve the accuracy of the duration output.
[0051] Step S240: When the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time.
[0052] For the detailed description of step S240, please refer to step S130, which will not be repeated here.
[0053] In the application management method provided in this embodiment, a two-layer random forest model is used to input the duration corresponding to the target application. The two-layer random forest algorithm model can realize the mutual interference of data with different output performances in the same task to the model, thereby improving the accuracy of the output.
[0054] Since the input is multi-dimensional information (target application and feature information, and the number of feature information is multiple), and there are uncertain connections between multiple dimensions, the random forest model (random forest algorithm) is very efficient in classifying data sets with multi-dimensional features. Therefore, the use of random forest can better meet the needs of time prediction. In addition, in the output task, the importance and influence of the input feature information are unclear. The model further clarifies the mutual influence relationship between variables and the importance of the final result. The operating efficiency and accuracy are high, and it is relatively simple to implement. In particular, for the classification problem of electronic devices that are Android devices, there are certain requirements for prediction time, response speed and loss. The random forest model can take into account the trade-off between the operating efficiency and accuracy of the algorithm that is finally implemented on the Android side. Optionally, based on the above embodiment, this embodiment provides an application management method for training a selected random forest model. Figure 3 A flowchart of an application management method provided by another embodiment of the present application is shown. Figure 3 The application management method may specifically include the following steps:
[0055] Step S310: When the target application is running in the foreground of the electronic device, characteristic information of the electronic device is obtained.
[0056] The specific description of step S310 can be found in step S110 , which will not be repeated here.
[0057] Step S320: Obtain a sample application.
[0058] The sample application may be obtained based on the user's historical usage data. Optionally, the sample application may be collected locally by the electronic device or obtained from a local log recorder, or may be the user's historical usage data downloaded by the electronic device from a server.
[0059] Step S330: Obtain the time that the sample application is in the foreground under each sample characteristic information of the electronic device as the sample usage time.
[0060] Similarly, the sample usage duration may be collected locally by the electronic device or obtained from a local log recorder, or may be historical usage data of the user downloaded by the electronic device from a server.
[0061] In one implementation, the historical usage data may be filtered, aggregated, and the like to obtain the sample usage duration corresponding to the sample application. Specifically, Figure 4 This application shows Figure 3 A flow chart of step S330 of the application management method shown in FIG. Figure 4, step S330 includes the following sub-steps:
[0062] Sub-step S331: obtaining a first duration of the sample application running in the foreground under each sample characteristic information of the electronic device.
[0063] From the local or server historical data of the electronic device, the first duration of the sample application running in the foreground under each sample characteristic information of the electronic device is obtained. For example, if the sample application runs in the foreground between 8:01 and 8:10, the first duration obtained is 9 minutes.
[0064] Sub-step S332: when the sample application is switched to the preset application, obtaining a second time duration that the preset application is running in the foreground.
[0065] Optionally, the preset application can be an application system that comes with the system, such as an alarm clock, timer, calculator, etc.; the preset application can also be an application with low usage frequency, such as an application that is used once every six months; the preset application can also be an application with a low usage time each time, such as an alarm clock, timer, etc.
[0066] Similarly, from the historical data of the local electronic device or the server, when the sample application is switched to the preset application, the second duration of the preset application being in the foreground is obtained. For example, at 8:10, the application running in the foreground is switched from the sample application to the preset application, and the preset application is in the foreground between 8:10 and 8:12, then the second duration of the foreground operation is 2 minutes.
[0067] Sub-step S333: when the preset application is switched to the sample application, a third time duration that the sample application is running in the foreground is obtained.
[0068] Similarly, the third duration is obtained from the historical data of the electronic device or the server. When the preset application is switched to the sample application, the third duration of the sample application being in the foreground is obtained. For example, at 8:12, the application running in the foreground is switched from the preset application to the sample application, and the sample application is in the foreground between 8:12 and 8:30, then the third duration of the foreground operation is 18 minutes.
[0069] Sub-step S334: taking the sum of the first duration, the second duration and the third duration as the sample usage duration.
[0070] The sum of the first duration, the second duration, and the third duration is calculated to obtain the sample usage duration. It is understandable that the sample usage duration is the duration between the first time the sample application is in the foreground and the second time it exits the background after filtering the preset application. The sample usage duration obtained after filtering and combining can more accurately reflect the user's usage habits.
[0071] Continuing with the above example, the sample usage duration is the sum of the first duration of 9 minutes, the second duration of 2 minutes and the third duration of 18 minutes, that is, the sample usage duration is 29 minutes. It can be understood that the sample usage duration is the duration between the first start of the sample program at 8:01 and the second end of the sample program at 8:30, which is 29 minutes.
[0072] Step S340: Use the sample application and the sample feature information as input parameters and the sample usage duration as an output parameter to train the random forest model to obtain the trained random forest model.
[0073] When the time interval from the last training completion of the random forest model reaches a preset time length, the sample application and the sample feature are used as input parameters, and the sample usage time is used as an output parameter to train the random forest model to obtain the trained random forest model. For example, the time interval can be, but is not limited to, 80 minutes, 1 day, one month, etc. The model is trained regularly, and the user's application usage habits in different periods can be used to improve the accuracy of model prediction; or when the electronic device is turned on, the sample application and the sample feature are used as input parameters, and the sample usage time is used as an output parameter to train the random forest model to obtain the trained random forest model.
[0074] According to the training data set, the random forest model is trained with sample applications and sample feature information as input parameters and sample usage time as output parameters to establish a corresponding relationship between the application, sample feature information and sample usage time.
[0075] By training the above model with multiple sets of sample applications and sample feature information, a trained random forest model with higher accuracy can be obtained. After the model is trained, the trained model can be tested with test data. Optionally, the data set can be randomly allocated in a ratio of 9 to 1 between sample data and test data. The sample data is stored in the sample data set, and the test data is stored in the test data set.
[0076] In one embodiment, the trained random forest model can be pre-trained and stored locally in the electronic device. When using the trained random forest model, the model can be quickly called. And because the model is stored locally in the electronic device, it can also effectively avoid the influence of network factors that reduce the speed of outputting the target usage time of the trained random forest model, and has the advantages of fast response speed, further improving the user experience.
[0077] In another embodiment, the trained random forest model can be pre-trained and stored in a server that is in communication with the electronic device. When using the trained random forest model, the target application and feature information are sent to the trained random forest model of the server to instruct the trained random forest model to output the target usage time, and obtain the target usage time sent by the server, thereby reducing the storage space occupied by the electronic device and reducing the impact on the normal operation of the electronic device by storing the trained random forest model in the server.
[0078] Step S350: input the target application and the feature information into a trained random forest model to obtain a target usage time corresponding to the target application output by the trained random forest model.
[0079] Step S360: When the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time.
[0080] For the detailed description of step S350 to step S360, please refer to step S120 to step S130, which will not be repeated here.
[0081] In the application management method provided in this embodiment, when the target application is running in the foreground of the electronic device, the characteristic information of the electronic device is obtained; then the target application and the characteristic information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model; when the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time to realize automatic management of the background running programs, and the control strategy is simple and does not require manual operation by the user, thereby improving the user experience.
[0082] To implement the above method embodiment, this embodiment provides an application management device, which is applied to an electronic device. Figure 5 A block diagram of an application management device provided by an embodiment of the present application is shown. Figure 5 The application management device 100 includes: an acquisition module 110, an output module 120 and a management module 130.
[0083] An acquisition module 110, configured to acquire characteristic information of the electronic device when the target application is running in the foreground of the electronic device;
[0084] An output module 120, configured to input the target application and the feature information into a trained random forest model, and obtain a target usage duration corresponding to the target application output by the trained random forest model;
[0085] The management module 130 is used to manage the target application based on the target usage time when the target application is switched from the foreground of the electronic device to the background.
[0086] Optionally, the trained random forest model includes a trained first random forest model and a trained second random forest model, and the output module 120 includes: a first output submodule, a determination submodule and a second output submodule.
[0087] A first output submodule, configured to input the target application and the feature information into the trained first random forest model, and obtain a first usage duration corresponding to the target application output by the trained first random forest model;
[0088] a determination submodule, configured to use the first usage time as the target usage time when the first usage time is less than a preset time; or
[0089] The second output submodule is used to input the target application and the characteristic information into the trained second random forest model when the first usage time is greater than the preset time, obtain the second usage time corresponding to the target application output by the trained second random forest model, and use the second usage time as the target usage time.
[0090] Optionally, the output module 120 includes: a third output submodule.
[0091] The third output submodule is used to input the target application and the feature information into the trained random forest model when a preset trigger event is monitored, and obtain the target usage time corresponding to the target application output by the trained random forest model.
[0092] Optionally, the preset trigger event includes: the target application switches from the foreground of the electronic device to the background; the display screen of the electronic device switches from a screen-on state to a screen-off state; the electronic device switches from a charging state to a non-charging state; or the remaining power of the electronic device is less than a preset power.
[0093] Optionally, the acquisition module 110 includes: a first acquisition submodule, a second acquisition submodule and an acquisition submodule.
[0094] A first collection submodule, used to collect characteristic information of the electronic device at a first moment;
[0095] A second acquisition submodule is used to obtain the characteristic information of the electronic device at a second moment when there is an abnormality in the characteristic information at the first moment, wherein the second moment is before the first moment;
[0096] The acquisition submodule is used to replace the characteristic information at the first moment with the characteristic information at the second moment, and use the characteristic information at the second moment as the characteristic information of the electronic device.
[0097] Optionally, the application management device 100 further includes: a first sample collection module, a second sample collection module and a training module.
[0098] A first sample collection module, used to obtain a sample application;
[0099] A second sample collection module is used to obtain the time that the sample application is in the foreground under each sample feature information of the electronic device as the sample usage time;
[0100] The training module is used to train the random forest model by taking the sample application and the sample feature information as input parameters and the sample usage duration as output parameter to obtain the trained random forest model.
[0101] Optionally, the second sample collection module includes: a first duration collection submodule, a second duration collection submodule, a third duration collection submodule and a summing submodule.
[0102] A first duration acquisition submodule, used for acquiring a first duration that the sample application is in the foreground under each sample characteristic information of the electronic device;
[0103] A second duration acquisition submodule, for acquiring a second duration during which the preset application is running in the foreground when the sample application is switched to the preset application;
[0104] A third duration acquisition submodule, for acquiring a third duration that the sample application is running in the foreground when the preset application is switched to the sample application;
[0105] The summing submodule is used to take the sum of the first duration, the second duration and the third duration as the sample usage duration.
[0106] Optionally, the training module includes: a first training submodule and a second training submodule.
[0107] A first training submodule is configured to train the random forest model by using the sample application and the sample feature as input parameters and the sample usage time as an output parameter when the time interval from the last training completion of the random forest model reaches a preset time length, so as to obtain the trained random forest model; or
[0108] The second training submodule is used to train the random forest model by using the sample application and the sample features as input parameters and the sample usage time as an output parameter when the electronic device is turned on, so as to obtain the trained random forest model.
[0109] Optionally, the management module 130 includes: a background running time acquisition submodule and a cleaning submodule.
[0110] A background running time acquisition submodule, used to acquire the running time of the target application running in the background of the electronic device;
[0111] The cleaning submodule is used to clean up the target application when the running time is greater than the target usage time.
[0112] Optionally, the characteristic information includes status information and time information, wherein the status information includes at least one of power status information, charging status information, network connection status information, peripheral connection status information, and application switching status information, and the time information includes at least one of date information and time information.
[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0114] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0115] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0116] Figure 6 is a block diagram of an electronic device for executing a network optimization method according to an embodiment of the present application, please refer to Figure 6, which shows a structural block diagram of an electronic device 200 provided in an embodiment of the present application. The electronic device 200 may be an electronic device capable of running applications, such as a smart phone, a tablet computer, an e-book, etc. The electronic device 200 in the present application may include one or more of the following components: a processor 210, a memory 220, and one or more applications, wherein the one or more applications may be stored in the memory 220 and configured to be executed by one or more processors 210, and the one or more applications are configured to execute the method described in the aforementioned method embodiment.
[0117] Among them, the processor 210 may include one or more processing cores. The processor 210 uses various interfaces and lines to connect various parts within the entire electronic device 200, and executes various functions and processes data of the electronic device 200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 220, and calling data stored in the memory 220. Optionally, the processor 210 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 210 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing components to be displayed; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 210, but may be implemented separately through a communication chip.
[0118] The memory 220 may include a random access memory (RAM) or a read-only memory (ROM). The memory 220 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a historical configuration file) created by the electronic device 200 during use.
[0119] Figure 7The storage unit for storing or carrying the program code for implementing the network optimization method according to the embodiment of the present application is shown in FIG7 , which shows a block diagram of a computer-readable storage medium provided by the embodiment of the present application. The computer-readable medium 300 stores program code, which can be called by the processor to execute the method described in the above method embodiment.
[0120] The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer readable storage medium 300 has storage space for program code 310 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 310 can be compressed, for example, in an appropriate form.
[0121] In summary, the application management method, device, electronic device and storage medium provided by the present application obtain characteristic information of the target application when the electronic device runs in the foreground, and process the target application and the characteristic information by a trained random forest model to obtain the target usage time corresponding to the target application, so that when the target application switches from the foreground of the electronic device to the background, the target application is managed based on the target usage time, so that the target application can be kept running within the usage time and managed after the time is reached, thereby realizing automatic management of background running programs without the need for manual operation by the user, further improving the user experience.
[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An application management method, characterized in that: Applied to electronic equipment, the method comprises: When the target application is running in the foreground of the electronic device, acquiring characteristic information of the electronic device; Inputting the target application and the feature information into a trained random forest model to obtain a target usage duration corresponding to the target application output by the trained random forest model; When the target application is switched from the foreground of the electronic device to the background, the target application is managed based on the target usage time; Wherein, when the trained random forest model includes a trained first random forest model and a trained second random forest model, the trained first random forest model is used to output short duration and non-short duration, and the trained second random forest model is used to output medium duration and long duration, the short duration is less than a preset duration, the non-short duration is greater than the preset duration, the non-short duration is the medium duration or the long duration, the medium duration is greater than the preset duration and less than the specified duration, the long duration is greater than the specified duration, the preset duration is the lower limit of the medium duration, the specified duration is the upper limit of the medium duration, and the preset duration is less than the specified duration, and the target application and the feature information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model, including: Inputting the target application and the characteristic information into the trained first random forest model, and obtaining a first usage duration corresponding to the target application output by the trained first random forest model; When the first usage duration is less than a preset duration, taking the first usage duration as the target usage duration; or When the first usage time is greater than the preset time, the target application and the feature information are input into the trained second random forest model to obtain a second usage time corresponding to the target application output by the trained second random forest model, and the second usage time is used as the target usage time.
2. The method according to claim 1, characterized in that The step of inputting the target application and the feature information into a trained random forest model to obtain a target usage duration corresponding to the target application output by the trained random forest model includes: When a preset trigger event is monitored, the target application and the characteristic information are input into the trained random forest model to obtain the target usage time corresponding to the target application output by the trained random forest model.
3. The method according to claim 2, characterized in that The preset triggering events include: The target application is switched from the foreground of the electronic device to the background; The display screen of the electronic device switches from a screen-on state to a screen-off state; The electronic device is switched from a charging state to a non-charging state; or The remaining power of the electronic device is less than the preset power.
4. The method according to claim 1, characterized in that: The acquiring characteristic information of the electronic device includes: Collecting characteristic information of the electronic device at a first moment; When there is an abnormality in the characteristic information at the first moment, acquiring characteristic information of the electronic device at a second moment, wherein the second moment is before the first moment; The characteristic information at the first moment is replaced by the characteristic information at the second moment, and the characteristic information at the second moment is used as the characteristic information of the electronic device.
5. The method according to any one of claims 1 to 4, characterized in that: Before inputting the target application and the feature information into the trained random forest model and obtaining the target usage time corresponding to the target application output by the trained random forest model, the method further includes: Get the sample application; Obtaining the time that the sample application is in the foreground under each sample characteristic information of the electronic device as the sample usage time; The sample application and the sample feature information are used as input parameters, and the sample usage duration is used as an output parameter to train the random forest model to obtain the trained random forest model.
6. The method according to claim 5, characterized in that The obtaining of the time duration of the sample application being in the foreground under each sample characteristic information of the electronic device as the sample usage time duration includes: Obtaining a first duration of the sample application being in the foreground under each sample characteristic information of the electronic device; When the sample application is switched to a preset application, obtaining a second time duration during which the preset application is running in the foreground; When the preset application is switched to the sample application, obtaining a third time duration during which the sample application is running in the foreground; The sum of the first duration, the second duration and the third duration is used as the sample usage duration.
7. The method according to claim 5, characterized in that The method of using the sample application and the sample features as input parameters and the sample usage duration as an output parameter to train the random forest model to obtain the trained random forest model includes: When the time interval from the last training completion of the random forest model reaches a preset time length, the sample application and the sample feature are used as input parameters, and the sample usage time length is used as an output parameter to train the random forest model to obtain the trained random forest model; or When the electronic device is turned on, the sample application and the sample features are used as input parameters, and the sample usage time is used as an output parameter to train the random forest model to obtain the trained random forest model.
8. The method according to any one of claims 1 to 4, characterized in that: The managing the target application based on the target usage duration includes: Obtaining the running time of the target application running in the background of the electronic device; When the running time is greater than the target usage time, the target application is cleaned up.
9. The method according to any one of claims 1 to 4, characterized in that: The characteristic information includes status information and time information, wherein the status information includes at least one of power status information, charging status information, network connection status information, peripheral connection status information, and application switching status information, and the time information includes at least one of date information and time information.
10. An application management device, characterized in that: Applied to electronic equipment, the device comprises: An acquisition module, used for acquiring characteristic information of the electronic device when the target application is running in the foreground of the electronic device; An output module, used to input the target application and the feature information into a trained random forest model, and obtain a target usage time corresponding to the target application output by the trained random forest model; A management module, configured to manage the target application based on the target usage duration when the target application is switched from the foreground of the electronic device to the background; Wherein, when the trained random forest model includes a trained first random forest model and a trained second random forest model, the trained first random forest model is used to output a short duration and a non-short duration, and the trained second random forest model is used to output a medium duration and a long duration, the short duration is less than a preset duration, the non-short duration is greater than the preset duration, the non-short duration is the medium duration or the long duration, the medium duration is greater than the preset duration and less than the specified duration, the long duration is greater than the specified duration, the preset duration is the lower limit of the medium duration, the specified duration is the upper limit of the medium duration, the preset duration is less than the specified duration, and the output module includes: A first output submodule, configured to input the target application and the feature information into the trained first random forest model, and obtain a first usage duration corresponding to the target application output by the trained first random forest model; a determination submodule, configured to use the first usage time as the target usage time when the first usage time is less than a preset time; or The second output submodule is used to input the target application and the characteristic information into the trained second random forest model when the first usage time is greater than the preset time, obtain the second usage time corresponding to the target application output by the trained second random forest model, and use the second usage time as the target usage time.
11. An electronic device, characterized in that: include: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1-9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method for predicting parallel program running time based on historical running data
CN111522644A