Task running method and electronic equipment
By adjusting the task scheduling conditions to meet user habits, the problems of task timeout and resource waste in electronic devices are solved, and more reasonable task scheduling is achieved.
Patent Information
- Application Number
- CN202410168550.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-05
- Publication Date
- 2025-08-12
AI Technical Summary
In electronic devices, the same application scheduling conditions cannot meet the usage habits of different users, causing tasks to run over time in the background or not triggered, resulting in waste of resources and disorderly scheduling.
By obtaining historical user habit data and task scheduling information, predict user habits on the day, adjust the task scheduling conditions to meet user habits, and avoid timeout and task not being triggered.
It effectively avoids the problem of task timeout and not being triggered, improves the rationality of task scheduling, and reduces resource consumption.
Smart Images

Figure CN120469770A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a task execution method and electronic device. Background Art
[0002] As the performance of electronic devices continues to improve, in addition to running an application (hereinafter referred to as a task) in the foreground of the electronic device, other applications can also be run in the background of the electronic device. Electronic devices usually have pre-set scheduling conditions for running applications in the background. When the electronic device detects that the scheduling conditions are met, it can start the application in the background.
[0003] Usually, the scheduling conditions for the same application are the same. However, different users have different habits of using electronic devices, which results in some applications in the electronic device not being started, or some applications being started in the background after reaching the timeout conditions; when the application times out in the background, the electronic device is not in an idle state, which will cause a large amount of resources of the electronic device (such as power consumption, data traffic, etc.) to be consumed, resulting in disordered application scheduling. Summary of the Invention
[0004] In order to solve the above technical problems, the present application provides a method for task execution and an electronic device, which can adjust the scheduling conditions for the tasks of the day so that the adjusted scheduling conditions are consistent with the user's habits of using electronic devices, avoiding the problem of tasks not being triggered or running overtime, resulting in disordered scheduling.
[0005] In the first aspect, the present application provides a method for task execution, including: obtaining historical user habit data of an electronic device and scheduling information of each task of the electronic device on that day, the historical user data including user habit data within a first preset time period before that day, and the user habit data including the time period when the electronic device is in various operating states; the scheduling information including information on whether the task is set to have an overtime operation; predicting the user habit data of the electronic device on that day based on the historical user habit data; determining the target scheduling conditions of each task of the electronic device on that day from preset scheduling conditions based on the user habit data of that day and the scheduling information of each task, wherein the predicted user habit data contains a target scheduling time at which the electronic device meets the target scheduling conditions, or the predicted user habit data contains a target scheduling time and the target scheduling time is earlier than the timeout time of the overtime operation set for the task; adjusting the scheduling conditions of each task to the target scheduling conditions, and starting the corresponding task according to the target scheduling conditions.
[0006] In this way, electronic devices (such as mobile phones and computers) can predict the user habit data of the day based on historical user habit data. The user habit data includes information about the time periods when the electronic device is in different operating states. Based on the predicted user habit data of the day and the scheduling information of the electronic device's tasks on that day, the electronic device can select the scheduling condition that the electronic device can meet on that day from the preset scheduling conditions as the target scheduling condition. Since there is a moment on that day that meets the scheduling condition, the electronic device will not trigger an overtime operation, thereby avoiding the problem of disordered scheduling tasks due to overtime operation. In addition, since there is a moment on that day that meets the scheduling condition, the problem of tasks not being triggered to run can also be avoided.
[0007] According to the first aspect, based on the user habit data of the day and the scheduling information of each task, the target scheduling conditions of each task of the electronic device on the day are determined from the preset scheduling conditions, including: based on the user habit data of the day and the preset first-class scheduling conditions, obtaining the moment when the electronic device on the day meets each first-class scheduling condition, and using the obtained moment as the predicted scheduling moment of the first-class scheduling condition, the first-class scheduling condition includes at least two condition items of the operating state of the electronic device; performing the following processing on each task of the electronic device on the day: judging whether the task is set with an overtime running condition based on the scheduling information of the task; when it is detected that the task is set with an overtime running condition, determining the target scheduling condition of the task based on the timeout moment of the task and each predicted scheduling moment; when it is detected that the task is not set with an overtime running condition, determining the target scheduling condition of the task based on each predicted scheduling moment.
[0008] In this way, the electronic device obtains the predicted scheduling time corresponding to each first-class scheduling condition, determines whether the task whose scheduling condition is currently to be adjusted is set with a start-up method for overtime operation, and for the task set with overtime operation, determines the target scheduling condition based on the timeout moment of the overtime operation and the predicted scheduling time; because the predicted scheduling moment has a corresponding scheduling condition, the predicted scheduling moment earlier than the timeout moment can be obtained as the moment to trigger the task to run, and the scheduling task corresponding to the triggering task running moment is obtained as the target scheduling task, which can avoid the task from running overtime. When the task is not set with a start-up method for overtime operation, the scheduling condition that can be determined based on the predicted scheduling moment can ensure that there is a moment that meets the scheduling condition on the same day, avoiding the task from not being triggered.
[0009] According to the first aspect, when it is detected that a task is set with a timeout condition, the target scheduling condition of the task is determined according to the timeout moment of the task and each predicted scheduling moment, including: judging in descending order of priority whether the predicted scheduling moment corresponding to the current first-class scheduling condition is earlier than the timeout moment and the value of the predicted scheduling moment corresponding to the current first-class scheduling condition is not 0, and the priority of the first-class scheduling condition is proportional to the number of condition items in the first-class scheduling condition; wherein, when the number of condition items in two first-class scheduling conditions is the same, the priority of the first-class scheduling condition including that the electronic device has accessed a Wi-Fi network is higher than the priority of the first-class scheduling condition including that the electronic device has accessed a cellular network, and the priority of the first-class scheduling condition including that the electronic device has accessed a cellular network is higher than the priority of the first-class scheduling condition including that the electronic device has accessed a cellular network; when it is detected that the predicted scheduling moment corresponding to the current first-class scheduling condition is earlier than the timeout moment, When the predicted scheduling moment corresponding to the current first-class scheduling condition is detected to be later than the timeout moment or the value of the predicted scheduling moment corresponding to the current first-class scheduling condition is detected to be 0, determine whether the predicted scheduling moment corresponding to the next first-class scheduling condition is earlier than the timeout moment and the value of the predicted scheduling moment corresponding to the current first-class scheduling condition is not 0; when it is detected that there is no predicted scheduling moment corresponding to the first-class scheduling condition earlier than the timeout moment and the value of the predicted scheduling moment corresponding to the first-class scheduling condition is not 0, determine that the target scheduling condition of the task is the second-class scheduling condition, and the second-class scheduling condition includes receiving a heartbeat detection packet sent by the server corresponding to the task. When the predicted scheduling condition of the task is determined to be the second-class scheduling condition, and the second-class scheduling condition includes receiving a heartbeat detection packet sent by the server corresponding to the task.
[0010] In this way, the electronic device gives priority to judging the predicted scheduling moment corresponding to the first-class scheduling condition with a high priority. The more condition items contained in the first-class scheduling condition with a high priority, the more it meets the needs of the user if there is a moment that satisfies the first-class scheduling condition with a high priority. Afterwards, the difficulty of satisfying the first-class scheduling condition is reduced in turn, thereby avoiding the problem of the task timeout due to the large number of condition items in the target scheduling condition, and reducing the difficulty of setting the target scheduling condition. When it is detected that there is no predicted scheduling moment earlier than the timeout moment and the value of the predicted scheduling moment is not 0, the reception of the heartbeat detection packet is used as the target scheduling condition, which can reduce the number of times the task is repeatedly started, reduce the power consumption of the electronic device, and avoid the task timeout.
[0011] According to the first aspect, when it is detected that the task is not set with a timeout condition, the target scheduling condition of the task is determined according to each predicted scheduling moment, including: judging whether the value of the predicted scheduling moment corresponding to the current first-class scheduling condition is not 0 in order of priority from high to low, and the priority of the first-class scheduling condition is proportional to the number of condition items in the first-class scheduling condition; wherein, when the number of condition items in two first-class scheduling conditions is the same, the priority of the first-class scheduling condition including that the electronic device has been connected to Wi-Fi is higher than the priority of the first-class scheduling condition including that the electronic device has been connected to a cellular device, and the first-class scheduling condition including that the electronic device has been connected to a cellular device is higher than the priority of the first-class scheduling condition including that the electronic device has been connected to a cellular device. The priority of the speed condition is higher than the priority of the first-class scheduling condition that the electronic device does not access the network; when it is detected that the value of the predicted scheduling time corresponding to the current first-class scheduling condition is not 0, the current first-class scheduling condition is obtained as the target scheduling condition of the task; when it is detected that the value of the predicted scheduling time corresponding to the current first-class scheduling condition is 0, it is determined whether the value of the predicted scheduling time corresponding to the next first-class scheduling condition is not 0; when it is detected that the values of the predicted scheduling time corresponding to each first-class scheduling condition are all 0, it is determined that the target scheduling condition of the task is the second-class scheduling condition, and the second-class scheduling condition includes receiving a heartbeat detection packet sent by the server corresponding to the task.
[0012] In this way, the electronic device gives priority to judging the predicted scheduling time corresponding to the first-class scheduling condition with a high priority. The more condition items the first-class scheduling condition with a high priority contains, the more it meets the user's needs if there is a moment that meets the first-class scheduling condition with a high priority. Afterwards, the difficulty of meeting the first-class scheduling condition is reduced in turn, thereby avoiding the problem of not being able to find the moment that meets the scheduling condition, which causes the task to be unable to run. When the electronic device detects that the value of the predicted scheduling moment is not 0, the problem of the task being unable to be started can be avoided by using the received heartbeat detection packet as the target scheduling condition.
[0013] According to the first aspect, the first type of scheduling conditions include: a first condition, a second condition, a third condition and a fourth condition; the first condition includes that the electronic device is in a charging state and the electronic device is connected to a Wi-Fi network and the electronic device is in a first standby state, and the first standby state is that the electronic device is in a screen-off state and the duration of entering the screen-off state reaches a second preset duration; the second condition includes that the electronic device is in a charging state and the electronic device is connected to a Wi-Fi network; the third condition includes that the electronic device is in a charging state and the electronic device is connected to a cellular network; the fourth condition includes that the electronic device is in a charging state and the electronic device is not connected to the network; wherein, the priority of the first condition is higher than the priority of the second condition, the priority of the second condition is higher than the priority of the third condition, and the priority of the third condition is higher than the priority of the fourth condition.
[0014] According to the first aspect, obtaining the moment when the electronic device meets each first-category scheduling condition on that day includes: querying the moment when the electronic device meets the first condition in the user habit data of that day, and using the obtained moment as the predicted scheduling moment of the first condition; querying the moment when the electronic device meets the second condition in the user habit data of that day, and using the obtained moment as the predicted scheduling moment of the second condition; querying the moment when the electronic device meets the third condition in the user habit data of that day, and using the obtained moment as the predicted scheduling moment of the third condition; querying the moment when the electronic device meets the fourth condition in the user habit data of that day, and using the obtained moment as the predicted scheduling moment of the fourth condition.
[0015] According to the first aspect, before determining the target scheduling conditions for each task, the method further includes: judging whether there is a task in the electronic device's tasks on that day that requires adjustment of the scheduling priority based on historical task data and the electronic device's tasks on that day, wherein the historical task data includes information about the first task, information about the second task, and information about tasks with timeout conditions set in the electronic device within a first preset period before that day, wherein the first task is set with a timeout condition and the first task is started by the electronic device at the time of the timeout of the first task, and the second task is a task that has not been started; when it is detected that there is a task that requires adjustment of the scheduling priority, obtaining the task that requires adjustment of the scheduling priority as the first target task; and increasing the scheduling priority of the first target task. In this way, by modifying the scheduling priority of the first target task, the electronic device can further avoid the problem of the first target task running overtime or failing to start on that day.
[0016] According to the first aspect, based on historical task data and the tasks of the electronic device on the day, it is determined whether there is a task that requires adjustment of the scheduling priority among the tasks of the electronic device on the day, including: obtaining a first task and a second task from the historical task data; determining whether there is a task that is the same as the first task or the second task among the tasks of the electronic device on the day; when it is detected that there is a task that is the same as the first task or the second task among the tasks of the electronic device on the day, it is determined that there is a task that requires adjustment of the scheduling priority. In this way, by determining whether there is a task that requires adjustment of the scheduling priority among the tasks of the electronic device on the day, the electronic device increases the scheduling priority of the task that requires adjustment of the scheduling priority, thereby avoiding the problem of the task running overtime or failing to run due to the scheduling priority.
[0017] According to the first aspect, the first target task includes a third task and / or a fourth task; obtaining a task that requires adjustment of scheduling priority as the first target task includes: when there is a task identical to the first task among the tasks of the electronic device on the day, judging whether the electronic device meets the scheduling conditions of the first task and the scheduling priority of the first task is less than a preset priority threshold value based on historical task data and historical user data; when it is determined that the electronic device meets the scheduling conditions of the first task and the scheduling priority of the first task is less than the priority threshold value within the first preset period before the day, obtaining the task identical to the first task from the tasks of the electronic device on the day as the third task; when there is a task identical to the second task among the tasks of the electronic device on the day, judging whether the electronic device does not meet the scheduling conditions of the second task and the second task is not set with a timeout condition within the first preset period before the day based on historical task data and historical user data; when it is determined that the electronic device does not meet the scheduling conditions of the second task and the second task is not set with a timeout condition within the first preset period before the day, obtaining the task identical to the second task from the tasks of the electronic device on the day as the fourth task.
[0018] In this way, the electronic device can obtain the reason why the first task ran overtime and the reason why the second task could not run through historical task data. According to the reason why the first task ran overtime and the reason why the second task could not run, the first task that ran overtime due to scheduling priority and the second task that could not run due to low scheduling priority can be obtained, and the tasks that need to adjust the scheduling priority can be determined from the tasks of the day.
[0019] According to a first aspect, predicting the current day's user habit data for an electronic device based on historical user habit data includes: inputting the historical user habit data into a prediction model, and obtaining the current day's user habit data for the electronic device as output by the prediction model. The prediction model is generated and trained based on a user habit sample dataset. The user habit sample dataset includes the current day's user habit data for the electronic device and user habit data for users within a preset period before the current day. In this way, the electronic device can quickly and accurately predict the current day's user habit data based on historical user habits using the prediction model.
[0020] In a second aspect, the present application provides a chip system comprising a processor for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes a task execution method corresponding to the first aspect and any implementation method of the first aspect.
[0021] In a third aspect, the present application provides an electronic device comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs a method for executing tasks corresponding to the first aspect and any one of the implementation methods of the first aspect.
[0022] The third aspect and any implementation of the third aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the third aspect and any implementation of the third aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0023] In a fourth aspect, the present application provides a computer-readable medium for storing a computer program, which, when the computer program is run on an electronic device, enables the electronic device to perform a method for executing tasks corresponding to the above-mentioned first aspect and any one of the implementation methods of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1 is a schematic diagram illustrating an exemplary scenario of background tasks running in an electronic device;
[0026] Figure 2 is a schematic diagram illustrating an exemplary scenario in which an electronic device triggers the execution of application A;
[0027] Figure 3 is a schematic structural diagram of an electronic device;
[0028] Figure 4 is a software structure block diagram of an electronic device shown as an example;
[0029] Figure 5 is an exemplary diagram of a task scheduling architecture;
[0030] Figure 6 is an illustrative diagram illustrating the interaction between modules in a method for executing task scheduling by an electronic device;
[0031] Figure 7 is a flowchart exemplarily illustrating a process of adjusting a scheduling condition of a task;
[0032] Figure 8 is a scene diagram showing an example of changing the scheduling conditions of task A;
[0033] Figure 9 FIG. 1 is a scene diagram showing an example of an electronic device changing the scheduling conditions of task A. FIG. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0036] In the description and claims of the embodiments of this application, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of objects. For example, the terms "first target object" and "second target object" are used to distinguish different objects, rather than to describe a specific order of objects.
[0037] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0038] In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more. For example, "multiple processing units" means two or more processing units; "multiple systems" means two or more systems.
[0039] Before explaining the embodiments of the present application in detail, the application scenarios of the present application are first explained. When an electronic device runs some applications in the foreground, it can also run other applications in the background. In this example, the electronic device takes a mobile phone as an example. Figure 1As shown in 1a, the mobile phone runs a music application in the foreground, and enables the function of playing music when the screen is off. After the mobile phone ends the music application, it can start the video application. While the mobile phone is running the music application and the video application in the foreground, it runs the task of large-scale image calculation in the gallery application in the background. This task can be used to identify the target person in the image (for example, to identify the face of the user of the electronic device for classification and storage, etc.). For example Figure 1 As shown in 1b, the phone is currently in the screen-off standby state, that is, the phone has no tasks running in the foreground, and the Honor Health app is running in the background, so that the Health app can synchronize the health data monitored by the bracelet with the phone. The bracelet is bound to the Health app.
[0040] Some applications will occupy a large amount of device resources of the electronic device when running. For example, the large-scale calculation task of the gallery in 1a consumes a lot of computing resources, and the health synchronization process in 1b increases the power consumption of the mobile phone.
[0041] To reduce the high power consumption of background apps, electronic devices currently delay the execution of apps. The Android system provides a job mechanism for delayed execution, allowing you to pre-set scheduling conditions for tasks requiring delayed execution. For example, an app's scheduling conditions might include the phone being charged and connected to a Wi-Fi network; the app will launch when the phone detects it's charging and connected to a Wi-Fi network.
[0042] Figure 1 The flowchart of triggering an application to run in the background shown in 1c is as follows. The process of triggering an application to run in the background includes:
[0043] ①: Application A initiates a create request to Jobinfo.
[0044] Specifically, the application may include multiple tasks that need to be run in the background. The task in this application can be an application (the application can be called a task) or a function in the application. In this example, Task A is used as an example to illustrate that Task A initiates a request to Jobinfo to create a task delay.
[0045] ②: Jobinfo sets the scheduling conditions for task A through the builder based on the received request.
[0046] Specifically, Jobinfo is a data container passed to the JobScheduler class, which encapsulates the various constraints required for scheduling tasks for calling applications. It can also be understood that one Jobinfo object corresponds to one task. The Jobinfo object is created through Jobinfo.Builder, and the Builder passes the parameters to JobScheduler. Optionally, the scheduling conditions may include that the phone is in a charging state, the phone is in a Deviceidle state, and the phone is connected to Wi-Fi. A timeout can also be set in the constraints. Timeout means that when the phone does not meet the scheduling conditions, the task is started when the set timeout moment is reached. Currently, there are other scheduling conditions, for example, the electronic device is in flight mode, the power of the electronic device exceeds a threshold (such as 80% power), etc., which are not listed one by one in this example.
[0047] ③: Builder passes parameters to JobSchedulerService and JobStore, waiting for the task to be scheduled.
[0048] The Builder passes the constraints of the task set by parameters to the JobSchedulerService and JobStore. At the same time, the JobStore stores the scheduling conditions of the task.
[0049] ④: When JobSchedulerService detects that the preset constraints are met, it starts the task in the background.
[0050] Specifically, when JobSchedulerService detects that the electronic device meets the set scheduling conditions, it starts the task in the background.
[0051] Figure 2 The diagram is a schematic diagram of a scenario in which an electronic device triggers the execution of application A.
[0052] Take mobile phones as an example of electronic devices, such as Figure 2 As shown in 2a, the mobile phone can pre-set the scheduling conditions that trigger application A to run in the background. The scheduling conditions include: the mobile phone is in charging state, the mobile phone is in Deviceidle state, and the mobile phone is connected to Wi-Fi. The application A is also provided with a timeout start mode, and the timeout start mode requires setting a timeout time, such as the timeout time of application A is 24:00 every day. When the mobile phone detects that the mobile phone meets all the scheduling conditions of task A (that is, the electronic device meets the three conditions in the scheduling conditions), it can trigger application A to run in the background of the mobile phone. When the mobile phone detects that the mobile phone does not meet any of the scheduling conditions and reaches the set 24:00, it triggers the running of application A. As Figure 2As shown in 2b, the actual user's habit of using mobile phones includes: to prevent phone interruptions and reduce the radiation of the mobile phone. This results in the third condition in the first category of conditions being not met, and application A cannot be started. Assuming that the mobile phone does not detect that all three conditions in the scheduling conditions are met on that day, and the detection time reaches the preset 24:00, application A is triggered to run in the background. Since application A is running overtime, it is possible that when the application is started, the state of the electronic device does not meet the conditions for the application to run. For example, application A needs to be updated. Because the user has turned on the flight mode and the mobile phone is not connected to the Wi-Fi network, the update task is started, but the data to be updated cannot be obtained. In other words, when the timing of the application's timeout does not conform to the user's habit of using the electronic device, the timing of starting the task is unreasonable.
[0053] For another example, if the scheduling conditions for Task B on a mobile phone include: the phone is in a charging state, the phone is in a Device state, and the phone is connected to the network. Task B is also set to a timeout startup method, such as setting the timeout to 12:00 every day. The user's actual use of the phone is: the user will charge the phone before going to bed at night and turn on the airplane mode on the phone. Because the scheduling conditions for Task B are not met at night, the user uses the phone on the subway at 12 o'clock. Since the phone does not detect that there is no time that meets the three conditions in the scheduling conditions of Task B, at 12 o'clock, the phone starts Application A. If Application A is a large-scale calculation for the image library, it will increase the power consumption of the phone and accelerate the reduction of the phone's battery. Running Application A in this scenario does not meet the user's needs, that is, the task scheduling is unreasonable and disorderly.
[0054] From the above two examples, it can be seen that since the corresponding scheduling conditions for the same task are usually the same, the scheduling conditions may not meet the user's habits of using electronic devices. When the task is also set with an overtime startup method, the time when the task overtimes may not be the time the user wants (such as the mobile phone is not in a charging state when running an application), the power consumption of the electronic device increases, and the power consumption is accelerated, or the overtime operation does not meet the requirements of the task, such as no network, resulting in the failure of the task to run. In other words, the scheduling conditions currently set for the task by the electronic device are unreasonable, resulting in unreasonable task scheduling and increased power consumption of the electronic device.
[0055] The present application provides a task scheduling method, which is executed by an electronic device. The electronic device can be a mobile phone, tablet computer, smart watch, wristband, car computer, intelligent robot, etc.
[0056] The electronic device can obtain the user's usage habit data of the electronic device and information on the scheduling of each task (such as information on unscheduled tasks, information on tasks that have timed out, and information on tasks that have timed out, etc.) within a first preset time period before the current day (such as 7 days or 14 days before the current day); the electronic device can predict the user habit data for the current day based on the user habit data within the first preset time period; based on the predicted user habit data for the current day and the information on the scheduling of each task, the scheduling conditions of each task are re-determined, and the tasks are scheduled according to the new scheduling conditions. The user habit data may include the time periods when the electronic device is in different operating states, and the user habit data may also include device status information of the electronic device under different operating states, such as temperature information, memory distribution information, storage space, and other information of the electronic device.
[0057] In this example, since the electronic device can predict the user habit data of the day, the new scheduling conditions are re-determined based on the user habit data of the day and the scheduling information of each task. Since the time periods when the electronic device is in different operating states on the day have been known, the scheduling conditions that the electronic device can meet on the day can be selected from the preset scheduling conditions as the target scheduling conditions through the predicted user habit data of the day and the scheduling information of the electronic device's tasks on the day; since there is a moment on the day that meets the scheduling conditions, the electronic device will not trigger an overtime operation, thereby avoiding the problem of disordered scheduling tasks due to overtime operation; in addition, since there is a moment on the day that meets the scheduling conditions, the problem of tasks not being triggered to run can also be avoided; the timing of task scheduling is more in line with user needs, and the situation where tasks cannot run can be avoided, thereby improving the rationality of task scheduling.
[0058] Figure 3 This is a schematic diagram of the structure of an electronic device 100 shown in an embodiment of the present application. It should be understood that, Figure 3 The illustrated electronic device 100 is merely one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the drawings, may combine two or more components, or may have a different configuration of components. Figure 3 The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits. In this example, the electronic device 100 is taken as an example of a mobile phone.
[0059] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0060] Figure 4 This is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into three layers, from top to bottom, namely the application layer, the application framework layer, and the system Native library (i.e. Figure 4 Native layer in ).
[0061] The application layer can include a series of application packages. Figure 4 As shown, the application package can include task scheduling system, camera, gallery, calendar, video and other applications.
[0062] The task scheduling system may include: a user habit statistics module, a task statistics module and an adjustment module.
[0063] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0064] like Figure 4 As shown, the application framework layer includes: Job Scheduler Service and Job Store. Job Store is used to store the scheduling conditions of each task. Job Scheduler Service can start the task that meets the scheduling conditions.
[0065] The application framework layer can also include window manager, power manager, system services, notification manager, phone manager, view system, resource manager, etc. (not listed in Figure 4 shown in ).
[0066] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc. In this application, the window manager is used to manage the interface display of applications (such as smart table).
[0067] The power manager is used to manage the DreamService in the low power mode of the Android system. For example, the power manager can control the electronic device to start the DreamService and exit the DreamService.
[0068] The system service (SystemServer) can monitor the status of each item to be monitored, and determine whether the electronic device meets the conditions for starting the smart display according to the status of each item to be detected.
[0069] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).
[0070] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0071] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction.
[0072] The system native library includes an interface for Java to call C++ code. The native layer can include an information collection module that can collect the time the electronic device is in various states, such as the time the electronic device is in the screen on, the time the screen is off, the time the electronic device is charging, and the time the electronic device is connected to Wi-Fi. The information collection module can also collect the temperature of each component, the status information of the electronic device, and the status of the electronic device's environment (such as temperature and lighting information).
[0073] It is understandable that Figure 4The components included in the application layer, application framework layer, and system native library shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine or split some components, or arrange the components differently.
[0074] Figure 5 This is an exemplary task scheduling architecture diagram. The task scheduling process includes:
[0075] Step 501: The information collection module transmits the collected user habit data to the user habit statistics module.
[0076] Specifically, the electronic device includes a task scheduling system, which adjusts the scheduling conditions of the task. The task scheduling system includes a user habit statistics module, a task statistics module, and an adjustment module. The information collection module can upload the collected user habit data to the user habit statistics module in real time. The user habit statistics module can store user habit data within a first preset period before the day, and the first preset period can be 7 days, 14 days, 30 days, etc. The user habit data includes the period when the electronic device is in operation, and the operation status can include: charging status, Wi-Fi access status, standby status, and sleep status (i.e., sleep mode in the mobile phone), etc.
[0077] For example, assuming that the current time is January 19, 2024, and the first preset period is 14 days. The information collection module can upload the collected user habit data in real time, and the user habit statistics module can store the user habit data from January 5, 2024 to January 18, 2024. User habit data include: the time when the mobile phone is connected to the Wi-Fi network, the period when the mobile phone is charging, the period when the mobile phone is on standby during the day, the period when the mobile phone is in flight mode, the period when the mobile phone is in do not disturb mode, etc. The user habit data can also include: sleep information. Sleep information can include information such as the time when the user falls asleep and the time when the user ends sleep (hereinafter referred to as the sleep time period), the network status of the mobile phone during the sleep time period, etc. In this example, daytime refers to the period from sunrise to sunset on that day.
[0078] Step 502: The task statistics module obtains task data from the job storage and the job scheduler service.
[0079] Specifically, the job memory is usually used to store the scheduling conditions of each task, and the JobSchedulerService obtains the scheduling conditions of each task from the JobStore. When the JobSchedulerService detects that the scheduling conditions are met, it triggers the task corresponding to the scheduling condition to run. JobStore can also store information about task timeouts (such as whether the task is set with a startup method for timeout and information about the timeout moment). The task statistics module can obtain information about tasks that have timeouts through the JobSchedulerService. Timeout means that there is no electronic device that meets the scheduling conditions of the task on that day and the electronic device reaches the timeout moment to trigger the corresponding task to run. The task statistics module can obtain tasks with scheduling conditions set from the JobStore and all tasks that are triggered to run through the JobSchedulerService, and determine the tasks that have not been triggered to run based on the tasks with scheduling conditions set and all tasks that are triggered to run (including tasks that have timed out).
[0080] Optionally, the task statistics module can also obtain task data within the first preset period before the current day. The task data includes: tasks that have been overtimed, tasks set to be overtimed in the electronic device, and tasks that have not been triggered to run within the first preset period.
[0081] Step 503: The user habit statistics module transmits the collected user habit data to the prediction submodule in the adjustment module; and the task statistics module obtains task statistics data from the job scheduler service and the job storage.
[0082] Specifically, the electronic device can pre-store a user habit data prediction model, which can be generated through deep learning training based on a sample set. The input samples in the sample set can be 14 days of user habit data. The output value of the prediction model is the predicted user habit data for the user on that day, and the true value is the user habit data for the user on that day. Based on the difference between the output value and the true value, the parameters in the prediction model are adjusted until the prediction model converges.
[0083] The user habit statistics module transmits the user habit data for the first preset period to the prediction submodule. The prediction submodule inputs the user habit data for the first preset period into a prediction model, which outputs the user habit data for the day. The prediction submodule transmits the predicted user habit data to the condition adjustment submodule.
[0084] The task statistics module transmits the task data within the first preset period to the condition adjustment submodule of the adjustment module. The condition adjustment submodule obtains the task data within the first preset period before the current day.
[0085] Step 504: The condition adjustment submodule in the adjustment module determines the triggering conditions of each task based on the prediction data input by the prediction submodule and the task statistics input by the task statistics module, and transmits the re-determined triggering conditions to the job memory.
[0086] Specifically, the condition adjustment submodule determines whether a time that satisfies the preset scheduling conditions exists based on the acquired predicted user habit data. If a time that satisfies the preset scheduling conditions exists, the time is recorded. If the condition adjustment submodule detects that a time that satisfies any scheduling condition does not exist, the time corresponding to each scheduling condition may be recorded as 0.
[0087] The condition adjustment submodule analyzes task data to determine whether the task for which the scheduling condition is to be determined has an overtime start method. If so, the target scheduling condition for the task is determined based on the timeout time and the scheduling time corresponding to each scheduling condition (i.e., the predicted scheduling time). If it is determined that the overtime start method is not set, the target scheduling condition for the task is determined directly based on the scheduling time corresponding to each scheduling condition.
[0088] Figure 6 The following is a flowchart illustrating an exemplary process of adjusting the scheduling conditions of a task. The specific process includes:
[0089] Step 601: The condition adjustment submodule obtains the earliest time T1 that satisfies the first condition on the day.
[0090] Specifically, the condition adjustment submodule obtains the predicted user habit data of the day, that is, information such as the user's charging period, sleeping period, period of access to the Wi-Fi network, and period in the Deviceeidle state on the day. The condition adjustment submodule can determine whether there is a moment that meets the first condition on the day based on the predicted user habit data of the day. The first condition is that the mobile phone is in a charging state and the mobile phone has been connected to the Wi-Fi network and is in the Deviceeidle state. If the condition adjustment submodule detects that there is a moment that meets the first condition on the day, the moment that meets the first condition is obtained. If the condition adjustment submodule detects that there are multiple moments that meet the first condition, the earliest moment can be obtained as the first moment (the first moment is recorded as T1). If the condition adjustment submodule detects that there is only one moment that meets the first condition, the moment that meets the first condition is taken as the first moment. If the condition adjustment submodule detects that there is no moment that meets the first condition, the value of the first moment is determined to be 0.
[0091] For example, the prediction submodule predicts user habit data for that day (i.e., January 19, 2024). The user habit data for that day includes: the time period when the phone is charging (13:00-14:00, 23:00-6:00), the time period when the phone is connected to Wi-Fi (6:00-23:00), the time period when the user is sleeping (23:00-6:00), and the time period when the phone is in the Device state (9:00-11:40, 13:00-18:00, 23:00-6:00). The condition adjustment submodule obtains the user habit data for that day and can detect that there is a time period that meets the first condition, which is 13:00-14:00. The earliest time in this time period can be obtained as the first time T1 (i.e., the predicted scheduling time corresponding to the first condition), i.e., T1 = 13:00.
[0092] For another example, the prediction submodule predicts user habit data for the current day (i.e., January 19, 2024). The user habit data for that day includes: the time period when the phone is charging (12:00-13:00, 23:00-6:00), the time period when the phone is connected to Wi-Fi (6:00-23:00), the time period when the user is sleeping (23:00-6:00), and the time period when the phone is in the Device state (9:00-11:40, 13:00-18:00, 23:00-6:00). The condition adjustment submodule obtains the user habit data for that day and can detect that there is no time period that meets the first condition, then determines the first moment T1=0, and T1=0 is used to indicate that the first moment does not exist.
[0093] Step 602: The condition adjustment submodule obtains the time T2 that satisfies the second condition on the day.
[0094] Specifically, the condition adjustment submodule can determine whether there is a time period that satisfies the second condition based on the predicted user habit data for the day, where the second condition is that the mobile phone is in a charging state and connected to a Wi-Fi network. If the condition adjustment submodule detects that there is a time period that satisfies the second condition on the day, it can detect whether there are multiple time periods that satisfy the second condition; when multiple time periods that satisfy the second condition are detected, the starting time of the earliest time period can be obtained as the second time period. When it is detected that there is only one time period that satisfies the second condition, the starting time of the time period is obtained as the second time period. If the condition adjustment submodule detects that there is no time period that satisfies the second condition, the value of the second time period is determined to be 0.
[0095] For example, the prediction submodule predicts user habit data for that day (i.e., January 19, 2024). The user habit data for that day includes: the time period when the phone is charging (13:00-14:00, 23:00-6:00), the time period when the phone is connected to Wi-Fi (6:00-23:00), the time period when the user is sleeping (23:00-6:00), and the time period when the phone is in the Device state (9:00-11:40, 13:00-18:00, 23:00-6:00). The condition adjustment submodule obtains the user habit data for that day and can detect that there is a time period that meets the second condition, which is 13:00-14:00. The earliest time in this time period can be obtained as the second time T2, that is, T2 = 13:00.
[0096] Step 603: The condition adjustment submodule obtains the time T3 that satisfies the third condition on the day.
[0097] Specifically, the condition adjustment submodule can determine whether there is a time period that satisfies the third condition based on the predicted user habit data for that day, where the third condition is that the phone is charging and connected to the cellular network. If the condition adjustment submodule detects that there is a time period that satisfies the third condition, it can detect whether there are multiple time periods that satisfy the third condition. If multiple time periods that satisfy the third condition are detected, the starting time of the earliest time period can be obtained as the third time period. If only one time period is detected that satisfies the third condition, the starting time of that time period is obtained as the third time period. If the condition adjustment submodule detects that there is no time period that satisfies the third condition, the value of the third time period is determined to be 0.
[0098] For example, the prediction submodule predicts user habit data for that day (i.e., January 19, 2024). The user habit data for that day includes: the time period when the phone is charging (13:00-14:00, 23:00-6:00), the time period when the phone is connected to the cellular network (7:30-9:30, 18:00-19:00), the user's sleep time (23:00-6:00), and the time period when the phone is in the Device state (9:00-11:40, 13:00-18:00, 23:00-6:00). The condition adjustment submodule obtains the user habit data for that day and can detect that there is no time period that meets the third condition, and can determine that the third time T3 = 0.
[0099] Step 604: The condition adjustment submodule obtains the time T4 that satisfies the fourth condition on the day.
[0100] Specifically, the condition adjustment submodule can determine whether there is a time period that satisfies the fourth condition based on the predicted user habit data for that day, where the fourth condition is that the phone is charging and not connected to the network. If the condition adjustment submodule detects that there is a time period that satisfies the fourth condition, it can detect whether there are multiple time periods that satisfy the fourth condition. If multiple time periods are detected that satisfy the fourth condition, the starting time of the earliest time period can be obtained as the fourth time period. If only one time period is detected that satisfies the fourth condition, the starting time of that time period is obtained as the fourth time period. If the condition adjustment submodule detects that there is no time period that satisfies the fourth condition, the value of the fourth time period is determined to be 0.
[0101] For example, the prediction submodule predicts the user habit data for that day (i.e., January 19, 2024). The user habit data for that day includes: the time period when the phone is charging (13:00-14:00, 23:00-6:00), the time period when the phone is connected to the cellular network (7:30-9:30, 18:00-19:00), the time period when the phone is not connected to the network (23:00-6:00), the user's sleep time (23:00-6:00), and the time period when the phone is in the Device state (9:00-11:40, 13:00-18:00, 23:00-6:00). The condition adjustment submodule obtains the user habit data for that day and can detect that there is a time period that meets the fourth condition of 23:00-6:00, and can determine the fourth time T4 = 23:00.
[0102] In some embodiments, there may be multiple preset scheduling conditions, and the condition adjustment submodule may determine the time on that day when the electronic device meets the scheduling conditions based on the predicted user habit data for that day. For example, the fifth condition may include: the phone is in a charging state, connected to a Wi-Fi network, in a DeviceIdle state, and the phone's storage space is greater than a space threshold (e.g., 30%).
[0103] Step 605: The condition adjustment submodule obtains tasks that have timed out or have not been triggered from the historical task data.
[0104] Specifically, the condition adjustment submodule can obtain historical task data from the task statistics module. The historical task data can be task information of the mobile phone that has overtime run within the first preset time period before the day, task information that has not been triggered to run, and task information with timeout conditions set.
[0105] If there is a high probability that tasks will be scheduled out of order due to overtime, in this example, the condition adjustment submodule can obtain tasks that have timed out within the first preset period before the current day (hereinafter referred to as first tasks). In addition, if tasks were not triggered to run within the first preset period before the current day, it means that the scheduling conditions of the tasks that were not triggered to run are unreasonable and need to be adjusted. In this example, the condition adjustment submodule can also obtain tasks that were not triggered to run (hereinafter referred to as second tasks).
[0106] In this example, the first task acquired by the condition adjustment submodule may refer to the task identifier of the first task, and acquiring the second task refers to acquiring the task identifier of the second task.
[0107] Step 606: The condition adjustment submodule determines whether there is a task that is the same as the first task or the second task. If it is predicted that there is no task, step 609 is executed; if it is predicted that there is a task, step 607 is executed.
[0108] Specifically, the condition adjustment submodule can obtain the task list of the electronic device for the day (hereinafter referred to as the first task list). The task list of the electronic device for the day can be obtained from the JobStore by the task statistics module. The condition adjustment submodule queries whether there is a task that is the same as the first task or the second task in the first task list. If it is found to exist, step 607 is executed; if it is found not to exist, the scheduling conditions of the tasks of the electronic device for the day can be adjusted, that is, step 609 is executed.
[0109] In this example, the first task list stores the task identifiers of each task with scheduling conditions, so the condition adjustment submodule can query whether there is a task identifier of the first task in the first task list, or query whether there is a task identifier of the second task. If the task identifier of the first task or the task identifier of the second task is queried, it can be determined that there is a task identical to the first task or the second task in the first list.
[0110] Step 607: The condition adjustment submodule obtains the factors causing the first task to timeout or the factors causing the second task to not be triggered to run.
[0111] Specifically, the condition adjustment submodule may obtain factors causing the first task to timeout or factors causing the second task to not be triggered based on historical task data and historical user habit data.
[0112] In some embodiments, the electronic device may have multiple tasks that meet the first type of trigger conditions at a certain moment. Due to the limited computing resources of the electronic device, the number of tasks running in the background at the same time cannot exceed the number threshold (such as the number threshold is 5). Each task is also set with a scheduling priority, and tasks with high priority are scheduled first. For example, at time t6, the electronic device has 10 tasks that meet the scheduling conditions at the same time, and the number of tasks to be run in the background exceeds the number threshold. According to the scheduling priority level of each task, the 5 tasks with high priority levels are scheduled first. This will also cause the low-priority task trigger to timeout or fail to be triggered to run.
[0113] In this example, the condition adjustment submodule can obtain tasks that have timed out or have not been triggered to run due to low priority based on historical task data and historical user habit data, so as to modify the priority level of the scheduling priority of the task.
[0114] For example, the electronic device can obtain Task A that is running overtime and detect the time when Task A ran overtime (e.g., Task A triggered to run overtime at 13:00 on the second day). The electronic device obtains the scheduling conditions of Task A through historical task data and detects whether there is a time before 13:00 on the second day that meets the scheduling conditions based on historical user habit data. If so, it is determined that the factor that triggered Task A to run overtime is that the lowered priority of Task A is lower than the priority threshold.
[0115] For another example, the electronic device may obtain Task B that was not triggered to run, and obtain the time when Task B was not triggered to run (e.g., it was not triggered to run on the third day). The electronic device obtains the scheduling conditions of Task B from historical task data, and detects whether there is a time on the third day that meets the scheduling conditions for Task B based on historical user habit data. If so, it is determined that the factor that Task B was not triggered to run is that the lowered priority of Task B is lower than the priority threshold.
[0116] Step 608 : The condition adjustment submodule changes the scheduling priority of the task, and then executes step 709 .
[0117] Specifically, the condition adjustment submodule obtains a task identical to the first task, and obtains a task that has timed out due to a low scheduling priority from the obtained tasks as a third task. The condition adjustment submodule obtains a task identical to the second task, and obtains a task that has not been triggered to run due to a low scheduling priority from the obtained tasks as a fourth task.
[0118] When the condition adjustment submodule detects the existence of a third task, it increases the scheduling priority of the third task from the first priority to the second priority, where the first priority is lower than the second priority. Optionally, the second priority can be one level higher than the first priority. For example, the first priority level is 10, and the scheduling priority of the task ranges from 1 to 10, where 1 is the highest priority and 10 is the lowest priority. The condition adjustment submodule can increase the scheduling priority of the third task from 10 to 9. Similarly, when the condition adjustment submodule detects the existence of a fourth task, it can adjust the scheduling priority of the fourth task from the third priority to the fourth priority, where the third priority is lower than the fourth priority.
[0119] Optionally, when the condition adjustment submodule detects the third task, it can also obtain the number of times the third task has overtimed due to a low scheduling priority. If it is detected that the number of times the third task has overtimed due to a low scheduling priority exceeds a number threshold (such as 5 times), it is determined that the scheduling priority of the third task is increased by at least 2 levels. Optionally, the greater the difference between the number of times the third task has overtimed and the number threshold, the greater the difference between the first priority and the second priority. For example, if the number of times the third task has overtimed is greater than the number threshold and the difference between the number threshold and the number threshold is less than the first difference (such as the first difference is 3), the difference between the second priority and the first priority can be determined to be 2; if the number of times the third task has overtimed is greater than the number threshold and the difference between the number threshold and the number threshold is greater than the first difference (such as the first difference is 3), the difference between the second priority and the first priority can be determined to be 4. That is, when the condition adjustment submodule detects that the number of times the third task has overtimed is greater than the number threshold, it can set different priority increase levels according to the difference between the number of times the third task has overtimed and the number threshold.
[0120] Optionally, when the condition adjustment submodule detects the fourth task, it can also obtain the duration (hereinafter referred to as the first duration) during which the fourth task is not triggered to run due to the low priority, wherein the first duration refers to the time from the moment when the fourth task meets the trigger condition to the moment when it is counted that the task is not triggered to run.
[0121] The condition adjustment submodule can detect whether the first duration exceeds a duration threshold (such as a duration threshold of 7 days). If it exceeds the duration threshold, the scheduling priority of the fourth task can be increased by at least 2 levels. Optionally, the greater the difference between the first duration and the duration threshold, the greater the difference between the fourth priority and the third priority. For example, if the first duration is greater than the duration threshold and the difference between the first duration and the duration threshold is less than a first preset duration (such as a first preset duration is 3 days), the difference between the fourth priority and the third priority can be determined to be 2; if the first duration is greater than the duration threshold and the difference between the first duration and the duration threshold is greater than the first preset duration, the difference between the fourth priority and the third priority can be determined to be 4. In other words, when the condition adjustment submodule detects that the duration of the fourth task that has not been triggered to run is greater than the duration threshold, it can set different priority increase levels according to the difference between the first duration and the duration threshold.
[0122] After the condition adjustment submodule adjusts the priority of the third task and / or the fourth task, the scheduling conditions of the third task and / or the fourth task may also be adjusted, that is, the scheduling conditions of the tasks of the day are adjusted in sequence, and steps 609 to 623 are executed.
[0123] Step 609: The condition adjustment submodule obtains the timeout moment of the Deadline.
[0124] In one embodiment, when the condition adjustment submodule detects that there is no task that is the same as the first task and the second task in the tasks of the day, the condition adjustment submodule may adjust the scheduling conditions of the tasks of the day in sequence, that is, the condition adjustment submodule executes steps 609 to 623.
[0125] The following details the process of adjusting the scheduling conditions for any task on the day.
[0126] The condition adjustment submodule may send a first request to the task statistics module to request the timeout moment of the deadline of the task. After receiving the result returned by the task statistics module, the condition adjustment submodule may execute step 610.
[0127] It should be noted that when the result obtained by the condition adjustment submodule is empty, the task may not have a deadline set. When the result obtained by the condition adjustment submodule is not empty, the timeout moment of the deadline of the task is saved.
[0128] Step 610: The condition adjustment submodule determines whether the task has a deadline set. If yes, execute step 611; otherwise, execute step 615.
[0129] Specifically, the condition adjustment submodule obtains a task list of tasks set with timeout from the task statistics module, and can detect whether there is a current task in the task list. When it is detected that the current task exists in the task list, it is determined that the task has a deadline set, and step 611 is executed; when it is detected that the current task does not exist in the task list, it is determined that the task does not have a deadline set, and step 615 is executed.
[0130] It should be noted that the more condition items there are in the preset scheduling conditions, the higher the priority of the scheduling conditions. When the number of condition items in two preset scheduling conditions is the same, the priority of the scheduling condition that includes the electronic device having access to Wi-Fi is higher than the priority of the scheduling condition that includes the electronic device having access to a cellular connection, and the priority of the scheduling condition that includes the electronic device having access to a cellular connection is higher than the priority of the scheduling condition that includes the electronic device not having access to a network. When the condition adjustment submodule determines the new scheduling conditions (i.e., the target scheduling conditions) for the task, it is prioritized to determine whether there is a moment on the day that meets the high-priority scheduling conditions.
[0131] In addition, step 610 can be executed before step 609, that is, first determine whether the task has a deadline set, and if so, execute step 609. In this way, it can be ensured that the timeout moment of the obtained deadline is not empty.
[0132] Step 611: The condition adjustment submodule determines whether the deadline is later than T1 and T1 is not 0. If it is detected that the deadline is earlier than or equal to T1, step 612 is executed; if it is detected that the deadline is later than T1 and T1 is not 0, step 619 is executed, that is, the scheduling condition of the task is changed to the first condition.
[0133] Specifically, the condition adjustment submodule detects whether the timeout moment of the deadline of the task is later than the first moment and the value of the first moment is not 0. When the condition adjustment submodule detects that the timeout moment of the task is later than the first moment and the first moment is not 0, step 619 is executed, that is, the condition adjustment submodule changes the scheduling condition of the task to the first condition, and the first condition is that the electronic device is in a charging state and the mobile phone is in a DeviceIdle state and the mobile phone is connected to a Wi-Fi network. For example, assuming that the timeout moment of the deadline of task A is 24:00 and the first moment is 23:00, the condition adjustment submodule detects that the timeout moment of the deadline of task A is later than the first moment, then the scheduling condition of the task is changed to the first condition.
[0134] When the condition adjustment submodule detects that the timeout moment of the task is earlier than the first moment or the value of the first moment is 0, it can continue to detect whether the timeout moment is later than the second moment and the value of the second moment is not 0, that is, execute step 612.
[0135] Step 612: The condition adjustment submodule determines whether the deadline is later than T2 and T2 is not 0. If it is detected that the deadline is earlier than or equal to T2, step 613 is executed; if it is detected that the deadline is later than T2 and T2 is not 0, step 720 is executed, that is, the scheduling condition of the task is changed to the second condition.
[0136] Specifically, the condition adjustment submodule detects whether the timeout moment of the deadline of the task is later than the second moment and the value of the second moment is not 0. When the condition adjustment submodule detects that the timeout moment of the task is later than the second moment and the second moment is not 0, step 620 is executed, that is, the condition adjustment submodule changes the scheduling condition of the task to the second condition, and the second condition is that the electronic device is in a charging state and the mobile phone is connected to the Wi-Fi network. For example, assuming that the timeout moment of the deadline of task A is 22:30, the first moment is 23:00, and the second moment is 22:00; the condition adjustment submodule detects that the timeout moment of the deadline of task A is earlier than the first moment and later than the second moment, then the scheduling condition of the task is changed to the second condition.
[0137] When the condition adjustment submodule detects that the timeout moment of the task is earlier than the second moment or the value of the second moment is 0, it can continue to detect whether the timeout moment is later than the third moment and the value of the third moment is not 0, that is, execute step 613.
[0138] Step 613: The condition adjustment submodule determines whether the deadline is later than T3 and T3 is not 0. If it is detected that the deadline is earlier than or equal to T3, step 614 is executed. If it is detected that the deadline is later than T3 and T3 is not 0, step 621 is executed, that is, the scheduling condition of the task is changed to the third condition.
[0139] Specifically, the condition adjustment submodule detects whether the timeout moment of the deadline of the task is later than the third moment and the value of the third moment is not 0. When the condition adjustment submodule detects that the timeout moment of the task is later than the third moment and the value of the third moment is not 0, step 621 is executed, that is, the condition adjustment submodule changes the scheduling condition of the task to the third condition, and the third condition is that the electronic device is in a charging state and the mobile phone has been connected to the cellular network (the cellular network can be a 4G / 5G network). For example, assuming that the timeout moment of the deadline of task A is 22:20, the first moment is 23:00, the second moment is 22:30, and the third moment is 22:00; the condition adjustment submodule detects that the timeout moment of the deadline of task A is earlier than the second moment and later than the third moment, then the scheduling condition of the task is changed to the third condition.
[0140] When the condition adjustment submodule detects that the timeout moment of the task is earlier than the third moment or the value of the third moment is 0, it can continue to detect whether the timeout moment is later than the fourth moment and the value of the fourth moment is not 0, that is, execute step 614.
[0141] Step 614: The condition adjustment submodule determines whether the deadline is later than T4 and T4 is not 0. If it is detected that the deadline is later than T4 and T4 is not 0, step 622 is executed to change the scheduling condition of the task to the fourth condition; if it is detected that the deadline is earlier than or equal to T4, step 623 is executed to change the scheduling condition to receiving a heartbeat packet.
[0142] Specifically, the condition adjustment submodule detects whether the timeout moment of the deadline of the task is later than the fourth moment and the value of the fourth moment is not 0. When the condition adjustment submodule detects that the timeout moment of the task is later than the fourth moment and the value of the fourth moment is not 0, step 622 is executed, that is, the condition adjustment submodule changes the scheduling condition of the task to the fourth condition, and the fourth condition is that the electronic device is in a charging state and the mobile phone is not connected to the network (such as the mobile phone is not connected to a Wi-Fi network, a hotspot network, a cellular network, etc.). For example, assuming that the timeout moment of the deadline of task A is 22:00, the first moment is 23:00, the second moment is 22:30, the third moment is 22:10, and the fourth moment is 21:50; the condition adjustment submodule detects that the timeout moment of the deadline of task A is earlier than the third moment and later than the fourth moment, then the scheduling condition of the task is changed to the fourth condition.
[0143] When the condition adjustment submodule detects that the timeout moment of the task is earlier than the fourth moment or the value of the fourth moment is 0, step 623 may be executed, ie, the scheduling condition is changed to receiving a heartbeat packet sent by the server of the task.
[0144] Step 615: The condition adjustment submodule determines whether the time T1 is not 0. If so, step 616 is executed; if not, step 619 is executed, that is, the scheduling condition is changed to the first condition.
[0145] Specifically, when the condition adjustment submodule detects that the task has no deadline, it can determine whether the first moment is not 0. If it is detected that the first moment is not 0, step 619 is executed; if it is detected that the first moment is 0, it indicates that there is no moment that meets the first condition on that day, and step 616 can be executed.
[0146] Step 616: The condition adjustment submodule determines whether the time T2 is not 0. If so, step 617 is executed; if not, step 620 is executed, i.e., the scheduling condition is changed to the second condition.
[0147] Specifically, when the condition adjustment submodule detects that the first moment is 0, it can determine whether the second moment is not 0. If it is detected that the second moment is not 0, execute step 620; if it is detected that the second moment is 0, it indicates that there is no moment that meets the second condition on that day, and step 617 can be executed.
[0148] Step 617: The condition adjustment submodule determines whether the time T3 is not 0. If so, step 618 is executed; if not, step 621 is executed, i.e., the scheduling condition is changed to the third condition.
[0149] Specifically, when the condition adjustment submodule detects that the second moment is 0, it can determine whether the third moment is not 0. If it is detected that the third moment is not 0, execute step 621; if it is detected that the third moment is 0, it indicates that there is no moment that meets the third condition on that day, and step 618 can be executed.
[0150] Step 618: The condition adjustment submodule determines whether T4 is not 0. If so, step 622 is executed to change the scheduling condition to the fourth condition. If T4 is 0, step 623 is executed to change the scheduling condition to receiving a heartbeat packet.
[0151] Specifically, when the condition adjustment submodule detects that the third moment is 0, it can determine whether the fourth moment is not 0. If it is detected that the fourth moment is not 0, step 622 is executed; if it is detected that the fourth moment is 0, it indicates that there is no moment that meets the fourth condition on that day, and step 623 can be executed.
[0152] Step 619: The condition adjustment submodule changes the scheduling condition to the first condition.
[0153] Specifically, the first condition is that the mobile phone is in a charging state, in a DeviceIdle state, and has access to a Wi-Fi network.
[0154] Step 620: The condition adjustment submodule changes the scheduling condition to a second condition.
[0155] Specifically, the second condition is that the mobile phone is in charging state and has been connected to a Wi-Fi network.
[0156] Step 621: The condition adjustment submodule changes the scheduling condition to the third condition.
[0157] Specifically, the third condition is that the mobile phone is in charging state and has been connected to a cellular network, which may include a 4G / 5G network.
[0158] Step 622: The condition adjustment submodule changes the scheduling condition to the fourth condition.
[0159] Specifically, the third condition is that the mobile phone is in a charging state and is not connected to the Internet, such as the mobile phone is in airplane mode.
[0160] Step 623: The condition adjustment submodule changes the scheduling condition to receiving a heartbeat packet.
[0161] Specifically, the mobile phone can periodically send heartbeat detection packets to the server corresponding to Task A at fixed intervals. The mobile phone determines whether it has received a heartbeat response packet from the server within a preset time period. If not, the mobile phone determines that the network connection with the server has deteriorated (for example, timed out, interrupted, or blocked) and is no longer suitable for providing network services. In this example, the condition adjustment submodule changes the scheduling condition to receiving a heartbeat packet (i.e., a heartbeat response packet).
[0162] In an example, when task A is not set with a deadline and the value at the first moment is 0, the value at the second moment is 0, the value at the third moment is 0, and the value at the fourth moment is 0, the condition adjustment submodule changes the scheduling condition to receiving a heartbeat packet, which can avoid the problem that task A cannot be triggered to run.
[0163] In one example, when task A is set with a deadline and the timeout moment of the deadline is earlier than the fourth moment, the condition adjustment submodule changes the scheduling condition to receiving a heartbeat packet, which can avoid being triggered subsequently due to the time reaching the timeout moment, reduce the number of times task A is triggered to run, and avoid the problem of disorderly scheduling caused by the task being triggered due to reaching the timeout moment.
[0164] Figure 7 The diagram is an interaction diagram between modules in a method for executing task scheduling in an electronic device.
[0165] Step 701: The information collection module transmits user habit data to the user habit statistics module.
[0166] This step is substantially the same as step 501, and the relevant description in step 501 may be referred to, and will not be repeated here. The user habit statistics module may store the user habit data transmitted by the information collection module, and the user habit statistics module may store the user habit data within a first preset period before the current day (hereinafter also referred to as historical user habit data), and execute step 702, i.e., transmit the user habit data within the first preset period before the current day to the prediction submodule.
[0167] User habit data may include: the start and end time of charging of the electronic device; the start and end time of the electronic device accessing the Wi-Fi network; the start and end time of the electronic device entering the DeviceIdle; the Mac address of the Wi-Fi network accessed by the electronic device; the start and end time of the electronic device accessing the cellular network, etc.; the user habit data may also include the temperature of the electronic device when in use; the distribution information of the memory in the electronic device (such as the memory usage rate) and the storage space information (such as the remaining amount of storage space).
[0168] Step 702: The user habit statistics module transmits the collected historical user habit data to the prediction submodule.
[0169] This step is substantially the same as step 503 , and reference may be made to the relevant description in step 503 , which will not be repeated here.
[0170] Step 703: The prediction submodule predicts the user habit data for the day based on the received user habit data.
[0171] Specifically, the prediction submodule pre-stores a user habit data prediction model. The input data of the prediction model can be historical user habit data, and the output data of the prediction model is the user habit data of the current day. Optionally, the types of user habit data output by the prediction model are the same as the types of user habit data input. For example, the input historical user habit data include: the start and end time of the electronic device entering the DeviceIdle; the Mac address of the Wi-Fi network accessed by the electronic device; the start and end time of the electronic device accessing the cellular network, etc. The user habit data of the current day output by the prediction model include: the start and end time of the electronic device entering the DeviceIdle; the Mac address of the Wi-Fi network accessed by the electronic device on the current day; the start and end time of the electronic device accessing the cellular network, etc.
[0172] Step 704: JobSchedulerService obtains the scheduling conditions of each task from JobStore.
[0173] Specifically, the JobStore stores the scheduling conditions of each task, and the JobSchedulerService can obtain the scheduling conditions of each task from the JobStore, so that when the JobSchedulerService detects that the scheduling conditions of a task are met, it indicates that the task has met the scheduling conditions.
[0174] It should be noted that if a task has both scheduling conditions and a timeout, and the task is scheduled to run because the scheduling conditions are met, the task will no longer trigger a timeout. If at a certain moment, the number of tasks that meet the scheduling conditions exceeds the threshold, the highest N tasks will be scheduled in descending order of scheduling priority, where N is the number of tasks that the electronic device supports running simultaneously in the background, such as N is 5.
[0175] Step 705: When the JobSchedulerService detects that the electronic device meets the scheduling condition, it runs the task corresponding to the scheduling condition.
[0176] In this example, when the JobSchedulerService detects that the electronic device meets the scheduling condition and the scheduling priority meets the scheduling requirements, it runs the task corresponding to the scheduling condition.
[0177] Step 706: The task statistics module obtains the running data of each task from the JobSchedulerService.
[0178] The task statistics module can obtain tasks that have reached the timeout (hereinafter referred to as timed-out tasks) through the JobSchedulerService and tasks with timeout settings through the JobStore. The task statistics module can obtain tasks with scheduling conditions from the JobStore and all triggered tasks through the JobSchedulerService. Based on the tasks with scheduling conditions and all triggered tasks, it determines the tasks that have not been triggered. The running data includes: information on whether a task has a timeout setting, whether it has timed out, and whether it has not been triggered.
[0179] The task statistics module stores tasks that are set to run with timeout, tasks that have timed out, and tasks that have not been triggered to run.
[0180] Step 707: The condition adjustment submodule requests to obtain the running data of each task from the task statistics module.
[0181] The condition adjustment submodule sends a first request to the task statistics module to request to obtain information of tasks set to run overtime, tasks that have run overtime, and tasks that have not been triggered to run within a first preset period before the current day.
[0182] Step 708: The task statistics module returns the first data to the condition adjustment submodule.
[0183] The first data includes: task information set to run overtime, task information that has run overtime, and task information that has not been triggered to run.
[0184] Step 709: The condition adjustment submodule requests the prediction submodule for the user habit data for the day.
[0185] Specifically, the condition adjustment submodule sends a second request to the prediction submodule to request to obtain the predicted user habit data for the day.
[0186] Step 710: The prediction submodule returns the second data to the condition adjustment submodule.
[0187] Specifically, the prediction submodule returns the predicted current user habit data to the condition adjustment submodule.
[0188] Step 711: The condition adjustment submodule adjusts the first data and the second data to adjust the scheduling conditions of each task.
[0189] This process can refer to Figure 6 The process will not be described in detail here.
[0190] Step 712: The condition adjustment submodule transmits the scheduling conditions of each task to the JobStore.
[0191] Step 713: JobStore stores the scheduling conditions of each task.
[0192] The following is a specific example to illustrate the task scheduling process. Figure 8 The diagram is a schematic diagram showing an exemplary scenario of changing the scheduling conditions of task A.
[0193] In this example, the user's mobile phone is used as an example of an electronic device. Application A (e.g., a health app) is activated. Application A's original trigger conditions include three scheduling conditions. Application A also has a timeout set at 24:00. The user's actual usage of the electronic device is as follows: 1. While at work, the user's phone is off-screen for 20 minutes to charge. 2. The user activates airplane mode on the phone while sleeping and charges it.
[0194] like Figure 9As shown in Figure 9a, the phone is in the daytime and in the DeviceIdle state (i.e. the screen is off and the phone is idle for 30 seconds). The phone does not detect the time that meets the above three conditions before 24:00, and application A will not be triggered. Figure 9 As shown in Figure 9b, at 23:00, the user pulls down the navigation bar 901 and clicks the flight mode icon 902; in response to the user clicking the icon 902, the phone enters flight mode. When the phone is in flight mode, the network connection is disconnected. That is, the third scheduling condition in the phone is not met, and the phone cannot be triggered to run before 24:00. When the phone reaches 24:00, the timeout operation is triggered. Since the phone is in flight mode, application A in the phone detects that there is no network and cannot run normally, that is, application A cannot synchronize health data with the bracelet, such as Figure 9 As shown in Figure 9c.
[0195] The prediction submodule of the mobile phone inputs the user habit data of the 14 days before the current day into the prediction model, which outputs the user habit data of the current day. The predicted user habit data includes: the phone charging period (12:00-14:00, 23:00-6:00), the phone connected to Wi-Fi period (9:00-17:00, 18:00-23:00), the phone is not connected to the network period (23:00-6:00), the user's sleep period (23:00-6:00), the phone is in the Device state period (9:00-11:40, 14:00-18:00, 23:00-6:00). The conditional submodule obtains the first time (such as T1 = 0), the second time (T2 = 12:00), the third time (T3 = 0), and the fourth time (T4 = 23:00). The condition adjustment submodule detects the tasks that have timed out in the first preset period before the day, and detects that task A belongs to the tasks that have timed out in the first preset period before the day. The condition adjustment submodule detects that the factor of the timed out operation is that the scheduling conditions are not met (regardless of the scheduling priority), and the timeout time of the timed out operation of task A can be obtained as 24:00. The condition adjustment submodule detects that task A is set to timeout operation, and detects that T1=0; then detects whether the timeout time is later than T2. When it is detected that the timeout time is later than T2, and T2 is not 0, the scheduling condition of task A is adjusted to: the mobile phone is in charging state and the mobile phone is connected to the Wi-Fi network (such as Figure 8 ). The condition adjustment submodule does not adjust the timeout operation.
[0196] After the condition adjustment submodule changes the scheduling conditions of Task A, at 12:00 on the same day, the phone enters the charging state and has connected to the Wi-Fi network, and the number of tasks triggered simultaneously at 12:00 is less than the threshold, the phone triggers Task A to run in the background, such as Figure 9 As shown in 9d (the timeout moment of the timeout operation is not shown in 9d).
[0197] It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules that perform the corresponding functions. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of this application.
[0198] An embodiment of the present application further provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected via lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.
[0199] This embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method for executing the tasks in the above-mentioned embodiment. The storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0200] This embodiment further provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the above-mentioned related steps to implement the method for executing the task in the above-mentioned embodiment.
[0201] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding task operation method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0202] Any content of each embodiment of this application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.
[0203] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for executing a task, characterized in that: include: Obtaining historical user habit data of an electronic device and scheduling information for each task of the electronic device on the current day, the historical user data including user habit data within a first preset time period before the current day, the user habit data including time periods when the electronic device was in various operating states; the scheduling information including information on whether the task is set to have an overtime execution time; predicting user habit data of the electronic device on that day based on the historical user habit data; Determining, based on the user habit data for the day and the scheduling information of each task, a target scheduling condition for each task of the electronic device for the day from preset scheduling conditions, wherein the predicted user habit data contains a target scheduling time at which the electronic device meets the target scheduling condition, or the predicted user habit data contains the target scheduling time and the target scheduling time is earlier than a timeout time set for the timeout operation of the task; The scheduling conditions of each task are adjusted to the target scheduling conditions, and the corresponding tasks are started according to the target scheduling conditions.
2. The method according to claim 1, characterized in that The step of determining target scheduling conditions for each task of the electronic device on the day from preset scheduling conditions based on the user habit data of the day and the scheduling information of each task includes: Obtaining, based on the user habit data for the day and preset first-category scheduling conditions, a time at which the electronic device satisfies each first-category scheduling condition on the day, and using the obtained time as a predicted scheduling time for the first-category scheduling condition, wherein the first-category scheduling condition includes at least two conditional items of the operating state of the electronic device; The following processing is performed on each task of the electronic device on that day: based on the scheduling information of the task, it is determined whether the task is set with a condition for overtime operation; when it is detected that the task is set with a condition for overtime operation, the target scheduling condition of the task is determined according to the timeout moment of the task and each predicted scheduling moment; when it is detected that the task is not set with a condition for overtime operation, the target scheduling condition of the task is determined according to each predicted scheduling moment.
3. The method according to claim 2, characterized in that When it is detected that the task is set with an overtime condition, determining the target scheduling condition of the task according to the timeout moment of the task and each predicted scheduling moment, including: Determining, in descending order of priority, whether the predicted scheduling time corresponding to the current first-category scheduling condition is earlier than the timeout time and the value of the predicted scheduling time corresponding to the current first-category scheduling condition is not 0, wherein the priority of the first-category scheduling condition is proportional to the number of condition items in the first-category scheduling condition; wherein, when the number of condition items in two first-category scheduling conditions is the same, the priority of the first-category scheduling condition including that the electronic device has accessed a Wi-Fi network is higher than the priority of the first-category scheduling condition including that the electronic device has accessed a cellular network, and the priority of the first-category scheduling condition including that the electronic device has accessed a cellular network is higher than the priority of the first-category scheduling condition including that the electronic device has accessed a cellular network; When it is detected that the predicted scheduling time corresponding to the current first-class scheduling condition is earlier than the timeout time and the value of the predicted scheduling time corresponding to the current first-class scheduling condition is not 0, obtaining the current first-class scheduling condition as the target scheduling condition of the task; When it is detected that the predicted scheduling time corresponding to the current first-class scheduling condition is later than the timeout time or it is detected that the value of the predicted scheduling time corresponding to the current first-class scheduling condition is 0, it is determined whether the predicted scheduling time corresponding to the next first-class scheduling condition is earlier than the timeout time and the value of the predicted scheduling time corresponding to the current first-class scheduling condition is not 0; When it is detected that there is no predicted scheduling time corresponding to the first type of scheduling condition that is earlier than the timeout time and the value of the predicted scheduling time corresponding to the first type of scheduling condition is not 0, it is determined that the target scheduling condition of the task is the second type of scheduling condition, and the second type of scheduling condition includes receiving a heartbeat detection packet sent by the server corresponding to the task.
4. The method according to claim 2, characterized in that When it is detected that the task is not set with an overtime condition, the target scheduling condition of the task is determined according to each predicted scheduling moment, including: Determining, in descending order of priority, whether the value of the predicted scheduling time corresponding to the current first-category scheduling condition is not 0, where the priority of the first-category scheduling condition is proportional to the number of condition items in the first-category scheduling condition; wherein, when the number of condition items in two first-category scheduling conditions is the same, the priority of the first-category scheduling condition including that the electronic device has access to Wi-Fi is higher than the priority of the first-category scheduling condition including that the electronic device has access to a cellular network, and the priority of the first-category scheduling condition including that the electronic device has access to a cellular network is higher than the priority of the first-category scheduling condition including that the electronic device has access to a cellular network; When it is detected that the value of the predicted scheduling time corresponding to the current first-class scheduling condition is not 0, obtaining the current first-class scheduling condition as the target scheduling condition of the task; When it is detected that the value of the predicted scheduling time corresponding to the current first-class scheduling condition is 0, it is determined whether the value of the predicted scheduling time corresponding to the next first-class scheduling condition is not 0; When it is detected that the value of the predicted scheduling time corresponding to each first-type scheduling condition is 0, the target scheduling condition of the task is determined to be a second-type scheduling condition, and the second-type scheduling condition includes receiving a heartbeat detection packet sent by the server corresponding to the task.
5. The method according to claim 3 or 4, characterized in that The first type of scheduling conditions includes: first condition, second condition, third condition and fourth condition; The first condition includes that the electronic device is in a charging state, the electronic device is connected to a Wi-Fi network, and the electronic device is in a first standby state, where the first standby state is that the electronic device is in a screen-off state and the duration of entering the screen-off state reaches a second preset duration; The second condition includes that the electronic device is in a charging state and the electronic device has been connected to a Wi-Fi network; The third condition includes that the electronic device is in a charging state and the electronic device has been connected to a cellular network; The fourth condition includes that the electronic device is in a charging state and is not connected to a network; The priority of the first condition is higher than that of the second condition, the priority of the second condition is higher than that of the third condition, and the priority of the third condition is higher than that of the fourth condition.
6. The method according to claim 5, characterized in that The obtaining of the time when the electronic device satisfies each first-category scheduling condition on the day includes: querying the user habit data of the day for the time when the electronic device meets the first condition, and using the obtained time as the predicted scheduling time for the first condition; querying the user habit data of the day for the time when the electronic device meets the second condition, and using the obtained time as the predicted scheduling time for the second condition; querying the user habit data of the day for the time when the electronic device meets the third condition, and using the obtained time as the predicted scheduling time for the third condition; The time when the electronic device meets the fourth condition is searched in the user habit data of the day, and the obtained time is used as the predicted scheduling time of the fourth condition.
7. The method according to claim 2, characterized in that Before determining the target scheduling condition for each task, the method further includes: determining, based on historical task data and the tasks of the electronic device on the current day, whether there is a task in the tasks of the electronic device on the current day that requires adjustment of the scheduling priority, the historical task data including information of a first task, information of a second task, and information of a task with a timeout condition set in the electronic device within a first preset time period before the current day, the first task with the timeout condition set and the first task being started by the electronic device at the time of the timeout of the first task, and the second task being a task that has not been started; When it is detected that there is a task that needs to adjust the scheduling priority, the task that needs to adjust the scheduling priority is obtained as the first target task; Increase the scheduling priority of the first target task.
8. The method according to claim 7, characterized in that Determining, based on historical task data and the tasks of the electronic device on the current day, whether there is a task requiring adjustment of the scheduling priority among the tasks of the electronic device on the current day, includes: Acquire a first task and a second task from the historical task data; Determining whether there is a task in the electronic device's tasks for the day that is the same as the first task or the second task; When it is detected that there is a task identical to the first task or the second task among the tasks of the electronic device on that day, it is determined that there is a task requiring adjustment of scheduling priority.
9. The method according to claim 8, characterized in that The first target task includes the third task and / or the fourth task; The acquiring of the task requiring adjustment of scheduling priority as the first target task includes: If there is a task identical to the first task among the tasks of the electronic device on that day, determining, based on the historical task data and the historical user data, whether the electronic device meets the scheduling conditions of the first task and the scheduling priority of the first task is less than a preset priority threshold value within a first preset time period before that day; when it is determined that the electronic device meets the scheduling conditions of the first task and the scheduling priority of the first task is less than the priority threshold value within the first preset time period before that day, obtaining the task identical to the first task from the tasks of the electronic device on that day as a third task; In the case that there is a task identical to the second task in the tasks of the electronic device on that day, based on the historical task data and the historical user data, determine whether the electronic device has not met the scheduling conditions of the second task and the second task has not been set with a timeout condition within a first preset time period before that day; when it is determined that the electronic device has not met the scheduling conditions of the second task and the second task has not been set with a timeout condition within the first preset time period before that day, obtain the task identical to the second task from the tasks of the electronic device on that day as the fourth task.
10. The method according to claim 1, characterized in that Predicting the user habit data of the electronic device on the current day based on the historical user habit data includes: The historical user habit data is input into a prediction model to obtain the user habit data of the electronic device on that day output by the prediction model. The prediction model is generated based on training of a user habit sample data set, and the user habit sample data set includes: the user habit data of the electronic device on that day, and the user habit data of users in a preset time period before that day.
11. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the task execution method according to any one of claims 1 to 10.
12. A computer-readable storage medium comprising a computer program, characterized in that When the computer program is run on an electronic device, the electronic device is enabled to execute the task execution method according to any one of claims 1 to 10.
13. A chip system, characterized in that: The method comprises a processor for calling and running a computer program from a memory so that an electronic device equipped with the chip system executes the task execution method described in any one of claims 1 to 10.