Method for entering transportation mode, electronic equipment and computer readable storage medium
By determining the off-air scene in the electronic device and switching to transportation mode or shutting down according to the SIM card and battery status, the battery consumption problem of the battery when it is not in use for a long time is solved, the battery life is extended and the rapid start-up is ensured.
Patent Information
- Application Number
- CN202311456207.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2025-01-07
AI Technical Summary
When electronic devices are not in use for a long time, the battery power will continue to be consumed, causing the battery to be in a state of power loss and affecting its service life.
By determining the off-air scene of the electronic device, obtain the SIM card's in-place status and battery power, switch to transportation mode or shut down to avoid battery loss.
Effectively extends the battery life and ensures a quick boot experience when the device reboots.
Smart Images

Figure CN119275956A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with application number 202310814490.8 submitted to the China Patent Office, application date July 5, 2023, and invention name “Battery protection method, electronic device and computer-readable storage medium”. Technical Field
[0002] The embodiments of the present application relate to the field of power management technology, and in particular to a method for entering a transport mode, an electronic device, and a computer-readable storage medium. Background Art
[0003] If an electronic device is not used for a long time, the battery power in the electronic device will continue to be consumed. Even if the electronic device is turned off, some components of the electronic device (for example, registers and system configuration) will still run, thereby continuously consuming the battery power, causing the battery to be in a low-power state. If the battery is in a low-power state for a long time, it will affect the battery life. Summary of the invention
[0004] The embodiments of the present application provide a method for entering a transport mode, an electronic device, and a computer-readable storage medium, which are intended to solve the problem of how to extend the battery life of an electronic device when it is not used for a long time.
[0005] The first aspect of the embodiment of the present application provides a method for entering a transport mode, which is applied to an electronic device, and the method includes: determining a shutdown scenario of the electronic device, where the shutdown scenario includes an active shutdown scenario or a passive shutdown scenario. According to the shutdown scenario, the presence status of a user identification module SIM card of the electronic device and the power level of a battery of the electronic device are obtained, where the presence status of the SIM card includes being in place or not in place. Switching to a transport mode or shutting down the device is performed according to the presence status of the SIM card and the power level of the battery.
[0006] In this embodiment, according to whether the shutdown scenario is an active shutdown scenario or a passive shutdown scenario, the presence status of the SIM card and the battery power are obtained, and then the mode is switched to the shipping mode or shutdown according to the presence status of the SIM card and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the presence status of the SIM card and the battery power corresponding to each of the two shutdown scenarios. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the shipping mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the shipping mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0007] In one embodiment, obtaining the presence status of a subscriber identity module SIM card of an electronic device and the power level of a battery of the electronic device according to a shutdown scenario includes: in response to the shutdown scenario being an active shutdown scenario, setting and starting a first scheduled startup task. In response to the electronic device being powered on when or before the first scheduled startup task expires, obtaining the presence status of the SIM card and the power level of the battery.
[0008] In another embodiment, switching to shipping mode or shutting down according to the SIM card in-place status and the battery power includes: switching to shipping mode in response to the SIM card in-place status being in-place and the battery power being less than a first power threshold.
[0009] In another embodiment, switching to a shipping mode or shutting down the device according to the in-place status of the SIM card and the battery power level includes: in response to the in-place status of the SIM card being in-place and the battery power level being greater than or equal to a first power level threshold, setting a first flag, the first flag being used to indicate that the battery power level is to be obtained when the electronic device is turned on next time. Shut down, set and start a second scheduled power-on task. In response to the electronic device being turned on at or before the expiration of the second scheduled power-on task, obtaining the battery power level according to the first flag. In response to the battery power level being less than a second power level threshold, switching to a shipping mode. Wherein, the second power level threshold is greater than the first power level threshold.
[0010] In another embodiment, switching to the shipping mode or shutting down according to the in-place status of the SIM card and the battery power includes: in response to the in-place status of the SIM card being in-place and the battery power being greater than or equal to the second power threshold, setting a second flag, the second flag being used to indicate switching to the shipping mode when the electronic device is turned on next time. Shut down, set and start a third scheduled power-on task. In response to the electronic device being turned on when or before the third scheduled power-on task expires, switching to the shipping mode according to the second flag.
[0011] In another embodiment, switching to shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: switching to shipping mode in response to the presence status of the SIM card being not in place and the battery power being less than a third power threshold.
[0012] In another embodiment, switching to a shipping mode or shutting down the device according to the presence status of the SIM card and the battery power level includes: in response to the presence status of the SIM card being not in place and the battery power level being greater than or equal to a third power level threshold, setting a first flag, the first flag being used to indicate that the battery power level is to be obtained when the electronic device is turned on next time. Shut down, set and start a second scheduled power-on task. In response to the electronic device being turned on at or before the expiration of the second scheduled power-on task, obtaining the battery power level according to the first flag. In response to the battery power level being less than a fourth power level threshold, switching to a shipping mode. Wherein, the fourth power level threshold is greater than the third power level threshold.
[0013] In another embodiment, switching to the shipping mode or shutting down the electronic device according to the presence status of the SIM card and the power level of the battery includes: in response to the power level of the battery being greater than or equal to a fourth power level threshold, setting a second flag, the second flag being used to indicate switching to the shipping mode when the electronic device is turned on next time. Shutting down the electronic device, setting and starting a third scheduled power-on task. In response to the electronic device being turned on when or before the third scheduled power-on task expires, switching to the shipping mode according to the second flag.
[0014] In another embodiment, obtaining the presence status of a user identification module SIM card of an electronic device and the power level of a battery of the electronic device according to a shutdown scenario includes: in response to the shutdown scenario being a passive shutdown scenario, obtaining the silent placement time of the electronic device. In response to the silent placement time reaching a preset time, obtaining the presence status of the SIM card and the power level of the battery.
[0015] In another embodiment, switching to the shipping mode or shutting down according to the SIM card in-place status and the battery power level includes: in response to the silent placement time reaching a first preset time, the SIM card in-place status being in-place, and the battery power level being less than a fifth power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on when or before the fourth scheduled power-on task expires, switching to the shipping mode.
[0016] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power level includes: in response to the silent placement time reaching a second preset time, the presence status of the SIM card being in place, and the battery power level being less than a sixth power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on when or before the fourth scheduled power-on task expires, switching to the shipping mode.
[0017] In another embodiment, switching to the shipping mode or shutting down according to the SIM card in-place status and the battery power level includes: in response to the silent placement time reaching a third preset time, the SIM card in-place status being in-place, and the battery power level being less than a seventh power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on when or before the fourth scheduled power-on task expires, switching to the shipping mode.
[0018] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: in response to the silent placement time reaching a first preset time, the presence status of the SIM card being not in place, and the battery power being less than an eighth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0019] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: in response to the silent placement time reaching a second preset time, the presence status of the SIM card being not in place, and the battery power being less than a ninth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0020] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power level includes: in response to the silent placement time reaching a third preset time, the presence status of the SIM card being not in place, and the battery power level being less than a tenth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0021] A second aspect of an embodiment of the present application provides an electronic device, which includes a memory and a processor, the memory is used to store instructions, and the processor is used to run the instructions stored in the memory, so that the electronic device executes the method for entering the transport mode of an embodiment of the present application.
[0022] A third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the method for entering a transport mode in an embodiment of the present application.
[0023] The technical effects brought about by the second and third aspects of the embodiments of the present application can be found in the relevant description of the method for entering the transport mode of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application.
[0025] Figure 2 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0026] Figure 3 This is a flowchart of a method for entering a transport mode provided by an embodiment of the present application.
[0027] Figure 4 This is a flowchart for determining a shutdown scenario of an electronic device provided by an embodiment of the present application.
[0028] Figure 5 This is a flowchart of a method for entering a transport mode in an active shutdown scenario provided by an embodiment of the present application.
[0029] Figure 6 This is a flowchart of a method for entering a transport mode in a passive shutdown scenario provided by an embodiment of the present application.
[0030] Figure 7 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is actively shut down and the SIM card is in place, provided by an embodiment of the present application.
[0031] Figure 8 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is actively shut down and a SIM card is not in place, provided by an embodiment of the present application.
[0032] Fig. 9 It is an interactive diagram of a method for entering transport mode in a scenario of passive shutdown and SIM card in place, provided by an embodiment of the present application.
[0033] Fig.10 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is passively shut down and the SIM card is not in place, provided by an embodiment of the present application.
[0034] Fig.11 It is a structural schematic diagram of a battery protection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] It should be noted that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0036] It should also be noted that the method disclosed in the embodiments of the present application or the method shown in the flowchart includes one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchangeable with each other, and some of the steps can also be deleted.
[0037] If an electronic device is not used for a long time, the battery power in the electronic device will continue to be consumed. Even if the electronic device is in the off state, some components of the electronic device (for example, registers and system configurations) will still run, thereby continuously consuming the battery power, causing the battery to be in a low-power state. For example, when the battery power is less than 3%, the electronic device starts the automatic shutdown process to enter the off state. However, when the electronic device is in the off state, some of its components are still running and will continue to consume the battery power, causing the battery to be in a low-power state. If the battery is in a low-power state for a long time, it will affect the battery life.
[0038] If the electronic device is not used for a long time, the electronic device is controlled to enter the ship mode, so that the electronic device can be completely powered off. That is, when the electronic device is in ship mode, all components of the electronic device will be powered off, so that the battery power can be kept almost unchanged. However, after the electronic device is switched to ship mode, if the electronic device is restarted, the relevant configuration of the startup needs to be loaded, resulting in a long startup delay, which will affect the user experience. Therefore, how to accurately identify the scenario where the electronic device is not used for a long time becomes the key to the problem.
[0039] Based on this, the embodiment of the present application provides a method for entering a shipping mode, an electronic device, and a computer-readable storage medium. First, the shutdown scene of the electronic device is determined, and then the presence status of the Subscriber Identity Module (SIM) card and the battery power are obtained according to whether the shutdown scene is an active shutdown scene or a passive shutdown scene, and then the device is switched to shipmode or shutdown according to the presence status of the SIM card and the battery power. Thus, it is possible to effectively distinguish whether the electronic device is in a long-term non-use scene or a short-term non-use scene according to the presence status of the SIM card and the battery power corresponding to the two shutdown scenes. When it is determined that the electronic device is in a long-term non-use scene, the electronic device is controlled to switch to shipmode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a power-deficient state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a short-term non-use scene, the electronic device is controlled to shut down instead of switching to shipmode, so that the electronic device can be quickly started when it is restarted, and the user experience will not be affected.
[0040] It can be understood that the method for entering the transport mode provided in the embodiment of the present application is not only applicable to electronic devices and computer-readable storage media, but also applicable to other battery-powered products, such as electric vehicles, drones, etc. The method for entering the transport mode provided in the embodiment of the present application is described below using an electronic device as an example.
[0041] Figure 1 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application.
[0042] See also Figure 1 , the electronic device 100 includes a processor 110 and a memory 120. The processor 110 can execute instructions stored in the memory 120, so that the electronic device 100 executes the method for entering the transport mode according to the embodiment of the present application.
[0043] The processor 110 may include one or more processing units. For example, the processor 110 may include, but is not limited to, an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, a neural network processor (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0044] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use an instruction or data again, it may be directly called from the memory.
[0045] The memory 120 may include an external memory interface and an internal memory. Among them, the external memory interface can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface to realize the data storage function. The internal memory can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory may include a storage program area and a storage data area. Among them, the storage program area may store an operating system, and at least one application required for a function (such as a camera, voice, map, etc.). The storage data area may store data (such as images, audio data, etc.) created by the electronic device 100 during use. In addition, the internal memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or a universal flash memory (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory, and / or instructions stored in a memory provided in the processor 110, such as executing the method for entering the transport mode of the embodiment of the present application.
[0046] Figure 2 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0047] See also Figure 2 The software system of the electronic device 100 can adopt a layered architecture, which divides the software into several layers, each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces. In this embodiment, the software system of the electronic device 100 is divided into three layers, namely, the application (APP) layer, the framework (Framework) layer and the kernel layer from top to bottom.
[0048] The APP layer includes a series of application packages. In this embodiment, the APP layer includes a battery safety module 1001, which is used to execute the method of entering the transport mode in the embodiment of the present application. The battery safety module 1001 can be a specific application or a functional module in certain applications. For example, the battery safety module 1001 is a functional module in the "Mobile Manager" application.
[0049] The Framework layer provides an application programming interface (API) and a programming framework for the application programs of the APP layer. In this embodiment, the Framework layer includes a shutdown module 1002, a SIM card module 1003, and a timed start module 1004. The shutdown module 1002 is used to perform a shutdown operation according to an instruction from the battery safety module 1001. The SIM card module 1003 is used to perform an operation of obtaining the in-place status of the SIM card according to an instruction from the battery safety module 1001. The timed start module 1004 is used to perform an operation of starting a timed start task according to an instruction from the battery safety module 1001.
[0050] The kernel layer includes kernel functions, which are used to perform different functions. In this embodiment, the kernel function includes an enable_shipmode node. The enable_shipmode node is used to execute the operation of switching to shipmode according to the instruction from the battery safety module 1001.
[0051] Understandably, Figure 1 and Figure 2 The structure shown does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented by hardware, software, or a combination of software and hardware.
[0052] Figure 3 This is a flowchart of a method for entering a transport mode provided by an embodiment of the present application.
[0053] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Figure 3 As shown, the method for entering the transport mode includes the following steps:
[0054] S301, determining a shutdown scenario of the electronic device, where the shutdown scenario includes an active shutdown scenario or a passive shutdown scenario.
[0055] In this embodiment, the electronic device can confirm the active shutdown scenario by monitoring the activity corresponding to the shutdown. The active shutdown scenario refers to the scenario in which the shutdown process is started when the power button of the electronic device is triggered. For example, when the user presses and holds the power button and clicks or touches the shutdown control, the shutdown process is started.
[0056] Electronic devices can confirm passive shutdown scenarios by monitoring the scheduled tasks corresponding to shutdown. Among them, the passive shutdown scenario refers to the scenario in which the shutdown process is started when the electronic device is left in silence for a long time. Silent placement refers to the state in which the electronic device is turned on and the screen is off (or turned off). For example, when the silent placement time of the electronic device reaches a preset time, the shutdown process is started. The preset duration of the scheduled task can be set as needed, for example, the preset duration can be set to 2 days, 3 days or 4 days, etc.
[0057] For example, Figure 4 FIG. 1 is a flowchart of determining a shutdown scenario of an electronic device provided by an embodiment of the present application. Figure 4 As shown, in step S401, the activities and scheduled tasks corresponding to shutdown are monitored. In step S402, in response to the activity corresponding to shutdown being that the power button is long pressed, and the shutdown control is clicked or touched, the shutdown process is started. In step S403, the shutdown scene is confirmed to be an active shutdown scene. In step S404, in response to the scheduled task corresponding to shutdown being that the silent placement time reaches a preset time, the shutdown process is started. In step S405, the shutdown scene is confirmed to be a passive shutdown scene.
[0058] S302, obtaining the presence status of a subscriber identity module SIM card of the electronic device and the power level of a battery of the electronic device according to a shutdown scenario, wherein the presence status of the SIM card includes being in place or not in place.
[0059] In this embodiment, the electronic device can monitor the presence status of the SIM card and the power level of the battery. This embodiment does not limit the implementation method of monitoring the presence status of the SIM card and the power level of the battery.
[0060] For example, the electronic device can obtain the presence status of the SIM card by monitoring the flag corresponding to the SIM card. The flag corresponding to the SIM card is used to indicate whether the presence status of the SIM card is in place or not in place. When the flag corresponding to the SIM card is enabled (enable), it indicates that the presence status of the SIM card is in place. When the flag corresponding to the SIM card is disabled (disable), it indicates that the presence status of the SIM card is not in place.
[0061] In addition, the electronic device can detect the battery power through the chip corresponding to the battery, and then obtain the battery power reported by the chip corresponding to the battery. The chip corresponding to the battery can be a built-in chip installed inside the battery, or it can be an external chip located outside the battery and connected to the battery.
[0062] S303, switching to a shipping mode or shutting down the device according to the presence status of the SIM card and the battery power.
[0063] It can be understood that the electronic device is not completely powered off when it is turned off, and is completely powered off when it is in ship mode.
[0064] In this embodiment, the electronic device obtains the presence status of the SIM card and the battery power according to whether the shutdown scenario is an active shutdown scenario or a passive shutdown scenario, and then switches to the shipping mode or shuts down according to the presence status of the SIM card and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the presence status of the SIM card and the battery power corresponding to each of the two shutdown scenarios. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the shipping mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a power-deficient state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the shipping mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0065] In one embodiment, obtaining the presence status of a subscriber identity module SIM card of an electronic device and the power level of a battery of the electronic device according to a shutdown scenario includes: in response to the shutdown scenario being an active shutdown scenario, setting and starting a first scheduled startup task. In response to the electronic device being powered on when or before the first scheduled startup task expires, obtaining the presence status of the SIM card and the power level of the battery.
[0066] It can be understood that the scheduled power-on task is used to start the power-on process when the power-off time reaches the preset time. The expiration of the scheduled power-on task means that the power-off time reaches the preset time. The electronic device can set the scheduled power-on task by calling the interface for setting the scheduled power-on task.
[0067] The preset duration of the first scheduled startup task can be set as needed, for example, the preset duration can be set to 1 day.
[0068] In this embodiment, when it is determined that the shutdown scenario is an active shutdown scenario, a first scheduled startup task is set and started. When the electronic device is powered on before or at the expiration of the first scheduled startup task, the presence status of the SIM card and the battery power level are obtained. In this way, it is possible to effectively distinguish whether the electronic device is in a long-term non-use scenario or a short-term non-use scenario based on the presence status of the SIM card and the battery power level in the active shutdown scenario.
[0069] In some scenarios, when the first scheduled startup task has not expired, and the power button of the electronic device is triggered and the startup process is started, the electronic device will also obtain the presence status of the SIM card and the battery power.
[0070] In another embodiment, switching to shipping mode or shutting down according to the SIM card in-place status and the battery power includes: switching to shipping mode in response to the SIM card in-place status being in-place and the battery power being less than a first power threshold.
[0071] The first power threshold is a preset low power threshold. The first power threshold can be set as needed, for example, the first power threshold can be set to 5%.
[0072] In this embodiment, in the active shutdown scenario, when the SIM card is in place and the battery power is less than the first power threshold, it means that the electronic device is likely to be unused for a long time. At this time, it is switched to the transportation mode to completely cut off the power of the electronic device, which is beneficial to avoid the battery being in a low power state, thereby protecting the battery and extending the battery life.
[0073] In another embodiment, switching to a shipping mode or shutting down the device according to the in-place status of the SIM card and the battery power level includes: in response to the in-place status of the SIM card being in-place and the battery power level being greater than or equal to a first power level threshold, setting a first flag, the first flag being used to indicate that the battery power level is to be obtained when the electronic device is turned on next time. Shut down, set and start a second scheduled power-on task. In response to the electronic device being turned on at or before the expiration of the second scheduled power-on task, obtaining the battery power level according to the first flag. In response to the battery power level being less than a second power level threshold, switching to a shipping mode. Wherein, the second power level threshold is greater than the first power level threshold.
[0074] The preset duration of the second scheduled startup task can be set as needed, for example, the preset duration can be set to 1 day.
[0075] In addition, the second power threshold is a low power threshold greater than the first power threshold. The second power threshold can be set as needed, for example, the second power threshold can be set to 8%. The reason why the second power threshold is greater than the first power threshold is that compared with the scenario of comparing the first power threshold, the accumulated shutdown time of the electronic device is greater in the scenario of comparing the second power threshold.
[0076] In this embodiment, in the active shutdown scenario, when the SIM card is in place and the battery power is greater than or equal to the first power threshold, it indicates that the electronic device is likely to be in a short-term non-use scenario. At this time, the first flag is set, the device is shut down, and the second scheduled power-on task is set and started. When the electronic device is turned on before or at the expiration of the second scheduled power-on task, the battery power is obtained according to the indication of the first flag. When the battery power is less than the second power threshold, it indicates that the electronic device is likely to be in a long-term non-use scenario. At this time, the device is switched to the transport mode so that the electronic device is completely powered off, which is beneficial to avoid the battery being in a low power state, thereby protecting the battery and extending the battery life.
[0077] It is understood that the electronic device can set flags corresponding to various functions in the setting database. The flag can be expressed as enable or disable. In some scenarios, the flag can also be expressed in other forms, such as specific numbers, letters or symbols. For example, when the first flag is 1, it means that the battery power will be obtained when the electronic device is turned on next time.
[0078] In another embodiment, switching to the shipping mode or shutting down according to the in-place status of the SIM card and the battery power includes: in response to the in-place status of the SIM card being in-place and the battery power being greater than or equal to the second power threshold, setting a second flag, the second flag being used to indicate switching to the shipping mode when the electronic device is turned on next time. Shut down, set and start a third scheduled power-on task. In response to the electronic device being turned on when or before the third scheduled power-on task expires, switching to the shipping mode according to the second flag.
[0079] The preset duration of the third scheduled startup task can be set as needed, for example, the preset duration can be set to 1 day.
[0080] In addition, in some scenarios, when the second flag is 2, it means that the electronic device will switch to the transportation mode when it is turned on next time.
[0081] In this embodiment, in the active shutdown scenario, when the SIM card is in place and the battery power is greater than or equal to the second power threshold, it indicates that the electronic device is likely to be in a short-term non-use scenario, and at this time, the second flag is set, the device is shut down, and the third scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the third scheduled startup task, it indicates that the electronic device is likely to be in a long-term non-use scenario, and at this time, the electronic device is directly switched to the transportation mode according to the indication of the second flag, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0082] In another embodiment, switching to shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: switching to shipping mode in response to the presence status of the SIM card being not in place and the battery power being less than a third power threshold.
[0083] It can be understood that, compared with the scenario where the SIM card is in place, the probability that the electronic device is not used for a long time is higher when the SIM card is not in place. Therefore, the third power threshold is usually set to a low power threshold greater than the first power threshold. The third power threshold can be set as needed, for example, the third power threshold can be set to 10%.
[0084] In this embodiment, in the active shutdown scenario, when the SIM card presence status is not in place and the battery power is less than the third power threshold, it indicates that the electronic device is likely to be unused for a long time. At this time, switching to the transportation mode completely cuts off the power to the electronic device, which helps to avoid the battery being in a low-power state, thereby protecting the battery and extending the battery life.
[0085] In another embodiment, switching to a shipping mode or shutting down the device according to the presence status of the SIM card and the battery power level includes: in response to the presence status of the SIM card being not in place and the battery power level being greater than or equal to a third power level threshold, setting a first flag, the first flag being used to indicate that the battery power level is to be obtained when the electronic device is turned on next time. Shut down, set and start a second scheduled power-on task. In response to the electronic device being turned on at or before the expiration of the second scheduled power-on task, obtaining the battery power level according to the first flag. In response to the battery power level being less than a fourth power level threshold, switching to a shipping mode. Wherein, the fourth power level threshold is greater than the third power level threshold.
[0086] The fourth power threshold can be set as needed, for example, the fourth power threshold can be set to 20%.
[0087] In this embodiment, in the active shutdown scenario, when the SIM card is not in place and the battery power is greater than or equal to the third power threshold, it indicates that the electronic device is likely to be in a short-term non-use scenario. At this time, the first flag is set, the device is shut down, and the second scheduled power-on task is set and started. When the electronic device is turned on before or at the expiration of the second scheduled power-on task, the battery power is obtained according to the indication of the first flag. When the battery power is less than the fourth power threshold, it indicates that the electronic device is likely to be in a long-term non-use scenario. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0088] In another embodiment, switching to the shipping mode or shutting down the electronic device according to the presence status of the SIM card and the power level of the battery includes: in response to the power level of the battery being greater than or equal to a fourth power level threshold, setting a second flag, the second flag being used to indicate switching to the shipping mode when the electronic device is turned on next time. Shutting down the electronic device, setting and starting a third scheduled power-on task. In response to the electronic device being turned on when or before the third scheduled power-on task expires, switching to the shipping mode according to the second flag.
[0089] In this embodiment, in the active shutdown scenario, when the SIM card in-place status is not in place, and the battery power is greater than or equal to the fourth power threshold, it indicates that the electronic device is likely to be in a short-term non-use scenario, and at this time, the second flag is set, the device is shut down, and the third scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the third scheduled startup task, it indicates that the electronic device is likely to be in a long-term non-use scenario, and at this time, the electronic device is directly switched to the transportation mode according to the indication of the second flag, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0090] In another embodiment, obtaining the presence status of a user identification module SIM card of an electronic device and the power level of a battery of the electronic device according to a shutdown scenario includes: in response to the shutdown scenario being a passive shutdown scenario, obtaining the silent placement time of the electronic device. In response to the silent placement time reaching a preset time, obtaining the presence status of the SIM card and the power level of the battery.
[0091] It is understandable that the electronic device can obtain the silent placement time by a timer. When the electronic device enters the screen-off (or off-screen) placement state, the timer is started.
[0092] In this embodiment, when it is determined that the shutdown scenario is a passive shutdown scenario, the silent placement time of the electronic device is obtained. When the silent placement time reaches a preset time, the presence status of the SIM card and the battery power are obtained. In this way, in the passive shutdown scenario, it is possible to effectively distinguish whether the electronic device is in a long-term non-use scenario or a short-term non-use scenario based on the presence status of the SIM card and the battery power.
[0093] In another embodiment, switching to the shipping mode or shutting down according to the SIM card in-place status and the battery power level includes: in response to the silent placement time reaching a first preset time, the SIM card in-place status being in-place, and the battery power level being less than a fifth power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on when or before the fourth scheduled power-on task expires, switching to the shipping mode.
[0094] The first preset duration can be set as needed, for example, the first preset duration can be set to 2 days. In addition, the fifth power threshold can be set as needed, for example, the fifth power threshold can be set to 5%. In addition, the preset duration of the fourth scheduled startup task can be set as needed, for example, the preset duration can be set to 2 days.
[0095] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the first preset time, the SIM card is in place, and the battery power is less than the fifth power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0096] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power level includes: in response to the silent placement time reaching a second preset time, the presence status of the SIM card being in place, and the battery power level being less than a sixth power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on when or before the fourth scheduled power-on task expires, switching to the shipping mode.
[0097] Among them, the second preset time is greater than the first preset time. The second preset time can be set as needed, for example, the second preset time can be set to 3 days. In addition, compared with the scenario where the silent placement time reaches the first preset time, in the scenario where the silent placement time reaches the second preset time, the probability that the electronic device is not used for a long time is greater. Therefore, the sixth power threshold is usually set to a low power threshold that is greater than the fifth power threshold. The sixth power threshold can be set as needed, for example, the sixth power threshold can be set to 8%.
[0098] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the second preset time, the SIM card is in place, and the battery power is less than the sixth power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0099] In another embodiment, switching to the shipping mode or shutting down according to the SIM card in-place status and the battery power level includes: in response to the silent placement time reaching a third preset time, the SIM card in-place status being in-place, and the battery power level being less than a seventh power threshold, shutting down, setting and starting a fourth scheduled power-on task. In response to the electronic device being turned on before or at the expiration of the fourth scheduled power-on task, switching to the shipping mode.
[0100] Among them, the third preset time is greater than the second preset time. The third preset time can be set as needed, for example, the third preset time can be set to 4 days. In addition, compared with the scenario where the silent placement time reaches the second preset time, in the scenario where the silent placement time reaches the third preset time, the probability that the electronic device is not used for a long time is greater. Therefore, the seventh power threshold is usually set to a low power threshold greater than the sixth power threshold. The seventh power threshold can be set as needed, for example, the seventh power threshold can be set to 10%.
[0101] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the third preset time, the SIM card is in place, and the battery power is less than the seventh power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0102] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: in response to the silent placement time reaching a first preset time, the presence status of the SIM card being not in place, and the battery power being less than an eighth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0103] The eighth power threshold is usually set as a low power threshold greater than the fifth power threshold. The eighth power threshold can be set as needed, for example, the eighth power threshold can be set to 10%.
[0104] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the first preset time, and the SIM card is not in place, and the battery power is less than the eighth power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0105] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power includes: in response to the silent placement time reaching a second preset time, the presence status of the SIM card being not in place, and the battery power being less than a ninth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0106] The ninth power threshold is usually set as a low power threshold greater than the eighth power threshold. The ninth power threshold can be set as required, for example, the ninth power threshold can be set to 20%.
[0107] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the second preset time, and the SIM card is not in place, and the battery power is less than the ninth power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0108] In another embodiment, switching to the shipping mode or shutting down according to the presence status of the SIM card and the battery power level includes: in response to the silent placement time reaching a third preset time, the presence status of the SIM card being not in place, and the battery power level being less than a tenth power threshold, shutting down, setting and starting a fourth scheduled startup task. In response to the electronic device being powered on when or before the fourth scheduled startup task expires, switching to the shipping mode.
[0109] The tenth power threshold is usually set as a low power threshold greater than the ninth power threshold. The tenth power threshold can be set as required, for example, the tenth power threshold can be set to 30%.
[0110] In this embodiment, in the passive shutdown scenario, when the silent placement time reaches the third preset time, and the SIM card is not in place, and the battery power is less than the tenth power threshold, the device is shut down, and the fourth scheduled startup task is set and started. When the electronic device is turned on before or at the expiration of the fourth scheduled startup task, it means that the electronic device is likely to be in a scenario where it is not used for a long time. At this time, it is switched to the transportation mode, so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low power state, thereby protecting the battery and extending the battery life.
[0111] Figure 5 This is a flowchart of a method for entering a transport mode in an active shutdown scenario provided by an embodiment of the present application.
[0112] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Figure 5 As shown, the method for entering the transport mode includes the following steps:
[0113] S501: In response to a shutdown scenario being an active shutdown scenario, setting and starting a first scheduled startup task.
[0114] S502, in response to the electronic device being powered on when or before the first scheduled power-on task expires, obtaining the presence status of the SIM card and the power level of the battery.
[0115] S503: Determine whether the SIM card is in place.
[0116] If the SIM card in-place status is in-place, execute step S504; if not, execute step S511.
[0117] S504: Determine whether the battery power is less than a first power threshold.
[0118] If the battery power is less than the first power threshold, step S505 is executed; if not, steps S506 to S508 are executed.
[0119] S505, switching to transport mode.
[0120] S506, setting a first flag, shutting down the computer, and setting and starting a second scheduled startup task.
[0121] S507, in response to the electronic device being powered on before or at the time when the second scheduled power-on task expires, obtaining the battery power according to the first flag.
[0122] S508: Determine whether the battery power is less than a second power threshold.
[0123] If the battery power is less than the second power threshold, step S505 is executed; if not, steps S509 to S510 are executed.
[0124] S509, setting a second flag, shutting down the computer, and setting and starting a third scheduled startup task.
[0125] S510: In response to the electronic device being powered on when or before the third scheduled power-on task expires, switching to a shipping mode according to a second flag.
[0126] S511, determining whether the battery power is less than a third power threshold.
[0127] If the battery power is less than the third power threshold, step S512 is executed; if not, steps S513 to S515 are executed.
[0128] S512, switching to transport mode.
[0129] S513, setting a first flag, shutting down the computer, and setting and starting a second scheduled startup task.
[0130] S514, in response to the electronic device being powered on before or at the time when the second scheduled power-on task expires, obtaining the battery power according to the first flag.
[0131] S515: Determine whether the battery power is less than a fourth power threshold.
[0132] If the battery power is less than the fourth power threshold, step S512 is executed; if not, steps S516 to S517 are executed.
[0133] S516, setting a second flag, shutting down the computer, and setting and starting a third scheduled startup task.
[0134] S517: In response to the electronic device being powered on when or before the third scheduled power-on task expires, switching to the shipping mode according to the second flag.
[0135] In this embodiment, the electronic device obtains the presence status of the SIM card and the battery power in the active shutdown scenario, and then switches to the shipping mode or shuts down according to the presence status of the SIM card and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the presence status of the SIM card and the battery power in the active shutdown scenario. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the shipping mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the shipping mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0136] Figure 6 This is a flowchart of a method for entering a transport mode in a passive shutdown scenario provided by an embodiment of the present application.
[0137] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Figure 6 As shown, the method for entering the transport mode includes the following steps:
[0138] S601: In response to the shutdown scenario being a passive shutdown scenario, obtaining a silent placement time of the electronic device.
[0139] S602: Determine whether the SIM card is in place.
[0140] If the SIM card presence status is present, execute step S603; if not, execute step S608.
[0141] S603, determining whether the silent placement time reaches a first preset time and whether the battery power is less than a fifth power threshold.
[0142] If the silent placement time reaches the first preset time and the battery power is less than the fifth power threshold, steps S604 to S605 are executed; if not, step S606 is executed.
[0143] S604, shut down the computer, set and start the fourth scheduled startup task.
[0144] S605: In response to the electronic device being powered on before or when the fourth scheduled power-on task expires, switching to a transportation mode.
[0145] S606, determining whether the silent placement time reaches a second preset time and whether the battery power is less than a sixth power threshold.
[0146] If the silent placement time reaches the second preset time and the battery power is less than the sixth power threshold, steps S604 to S605 are executed; if not, step S607 is executed.
[0147] S607, determining whether the silent placement time reaches a third preset time and whether the battery power is less than a seventh power threshold.
[0148] If the silent placement time reaches the third preset time and the battery power is less than the seventh power threshold, execute steps S604 to S605; if not, return to execute step S603.
[0149] S608, determining whether the silent placement time reaches a first preset time and whether the battery power is less than an eighth power threshold.
[0150] If the silent placement time reaches the first preset time and the battery power is less than the eighth power threshold, execute steps S609 to S610; if not, execute step S611.
[0151] S609, shut down the computer, set and start the fourth scheduled startup task.
[0152] S610: In response to the electronic device being powered on before or when the fourth scheduled power-on task expires, switching to a transportation mode.
[0153] S611, determining whether the silent placement time reaches a second preset time and whether the battery power is less than a ninth power threshold.
[0154] If the silent placement time reaches the second preset time and the battery power is less than the ninth power threshold, steps S609 to S610 are executed; if not, step S612 is executed.
[0155] S612, determining whether the silent placement time reaches a third preset time and whether the battery power is less than a tenth power threshold.
[0156] If the silent placement time reaches the third preset time and the battery power is less than the tenth power threshold, execute steps S609 to S610; if not, return to execute step S608.
[0157] In this embodiment, the electronic device obtains the silent placement time, the SIM card in-place status and the battery power in the passive shutdown scenario, and then switches to the transport mode or shuts down according to the silent placement time, the SIM card in-place status and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a long-term non-use scenario or a short-term non-use scenario according to the silent placement time, the SIM card in-place status and the battery power in the passive shutdown scenario. When it is determined that the electronic device is in a long-term non-use scenario, the electronic device is controlled to switch to the transport mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a short-term non-use scenario, the electronic device is controlled to shut down instead of switching to the transport mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0158] Figure 7 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is actively shut down and the SIM card is in place, provided by an embodiment of the present application.
[0159] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Figure 7 As shown, the method for entering the transport mode includes the following steps:
[0160] S701: In response to the shutdown scenario being an active shutdown scenario, the battery safety module of the application layer sends an instruction for a first scheduled startup task to the scheduled startup module of the framework layer.
[0161] S702: The scheduled startup module sets and starts the first scheduled startup task in response to an instruction of the first scheduled startup task.
[0162] S703: In response to the electronic device being powered on at or before the first scheduled power-on task expires, the battery safety module obtains the battery power.
[0163] S704, the battery safety module sends an instruction to query the in-place status of the SIM card to the SIM card module of the framework layer.
[0164] S705 : The SIM card module queries the in-place status of the SIM card in response to the instruction for querying the in-place status of the SIM card.
[0165] S706: The SIM card module sends a message about the SIM card presence status to the battery safety module.
[0166] S707: The battery safety module determines whether the SIM card in-place status is in-place according to the message about the SIM card in-place status.
[0167] S708: In response to the SIM card being in place, the battery safety module determines whether the battery power is less than a first power threshold.
[0168] S709: In response to the battery power level being less than a first power level threshold, the battery safety module sends an instruction to switch to a shipping mode to the kernel layer.
[0169] S710 , the kernel layer switches to the transport mode by calling an enable transport mode node in response to an instruction to switch to the transport mode.
[0170] S711: In response to the battery power being greater than or equal to a first power threshold, the battery safety module sets a first flag.
[0171] S712, the battery safety module sends a shutdown instruction to the shutdown module of the framework layer.
[0172] S713, the battery safety module sends an instruction for a second scheduled startup task to the scheduled startup module.
[0173] S714, the shutdown module shuts down in response to the shutdown instruction.
[0174] S715, the timed start module sets and starts the second scheduled start task in response to the instruction of the second scheduled start task.
[0175] S716: In response to the electronic device being powered on at or before the second scheduled power-on task expires, the battery safety module obtains the battery power according to the first flag.
[0176] S717: In response to the battery power level being less than a second power threshold, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0177] S718: In response to the instruction to switch to the transport mode, the kernel layer switches to the transport mode by calling the enable transport mode node.
[0178] S719: In response to the battery power being greater than or equal to a second power threshold, the battery safety module sets a second flag.
[0179] S720: The battery safety module sends a shutdown instruction to the shutdown module.
[0180] S721, the battery safety module sends an instruction for a third scheduled startup task to the scheduled startup module.
[0181] S722, the shutdown module shuts down in response to the shutdown instruction.
[0182] S723, the scheduled startup module sets and starts the third scheduled startup task in response to the instruction of the third scheduled startup task.
[0183] S724: In response to the electronic device being powered on when or before the third scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer according to the second flag.
[0184] S725 , the kernel layer switches to the transport mode by calling the enable transport mode node in response to the instruction to switch to the transport mode.
[0185] In this embodiment, the electronic device obtains the battery power in the scenario where the electronic device is actively shut down and the SIM card is in place, and then switches to the shipping mode or shuts down according to the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the battery power in the scenario where the electronic device is actively shut down and the SIM card is in place. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the shipping mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the shipping mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0186] Figure 8 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is actively shut down and a SIM card is not in place, provided by an embodiment of the present application.
[0187] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Figure 8 As shown, the method for entering the transport mode includes the following steps:
[0188] S801: In response to a shutdown scenario being an active shutdown scenario, a battery safety module at an application layer sends an instruction for a first scheduled startup task to a scheduled startup module at a framework layer.
[0189] S802, the scheduled startup module sets and starts the first scheduled startup task in response to an instruction of the first scheduled startup task.
[0190] S803: In response to the electronic device being powered on at or before the first scheduled power-on task expires, the battery safety module obtains the battery power.
[0191] S804, the battery safety module sends an instruction to query the in-place status of the SIM card to the SIM card module of the framework layer.
[0192] S805 , the SIM card module queries the in-place status of the SIM card in response to the instruction for querying the in-place status of the SIM card.
[0193] S806, the SIM card module sends a message about the SIM card presence status to the battery safety module.
[0194] S807: The battery safety module determines whether the SIM card is in place according to the message about the SIM card in place status.
[0195] S808: In response to the SIM card being in place being not in place, the battery safety module determines whether the battery power is less than a third power threshold.
[0196] S809: In response to the battery power level being less than a third power level threshold, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0197] S810: In response to the instruction to switch to the transport mode, the kernel layer switches to the transport mode by calling an enable transport mode node.
[0198] S811: In response to the battery power being greater than or equal to a third power threshold, the battery safety module sets a first flag.
[0199] S812, the battery safety module sends a shutdown instruction to the shutdown module of the framework layer.
[0200] S813, the battery safety module sends an instruction for a second scheduled startup task to the scheduled startup module.
[0201] S814, the shutdown module shuts down in response to the shutdown instruction.
[0202] S815, the timed start module sets and starts the second scheduled start task in response to the instruction of the second scheduled start task.
[0203] S816: In response to the electronic device being powered on at or before the second scheduled power-on task expires, the battery safety module obtains the battery power according to the first flag.
[0204] S817: In response to the battery power level being less than a fourth power level threshold, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0205] S818: In response to the instruction to switch to the transport mode, the kernel layer switches to the transport mode by calling the enable transport mode node.
[0206] S819: In response to the battery power being greater than or equal to a fourth power threshold, the battery safety module sets a second flag.
[0207] S820, the battery safety module sends a shutdown instruction to the shutdown module.
[0208] S821, the battery safety module sends an instruction for a third scheduled startup task to the scheduled startup module.
[0209] S822, the shutdown module shuts down in response to the shutdown instruction.
[0210] S823, the timed start module sets and starts the third scheduled start task in response to the instruction of the third scheduled start task.
[0211] S824: In response to the electronic device being powered on when or before the third scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer according to the second flag.
[0212] S825 , the kernel layer switches to the transport mode by calling the enable transport mode node in response to the instruction to switch to the transport mode.
[0213] In this embodiment, the electronic device obtains the battery power in a scenario where the electronic device is actively shut down and the SIM card is not in place, and then switches to the shipping mode or shuts down according to the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the battery power in a scenario where the electronic device is actively shut down and the SIM card is not in place. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the shipping mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the shipping mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0214] Fig. 9 It is an interactive diagram of a method for entering transport mode in a scenario of passive shutdown and SIM card in place, provided by an embodiment of the present application.
[0215] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Fig. 9 As shown, the method for entering the transport mode includes the following steps:
[0216] S901, in response to the shutdown scenario being a passive shutdown scenario, the battery safety module of the application program layer obtains the silent placement time of the electronic device.
[0217] S902, the battery safety module sends an instruction to query the in-place status of the SIM card to the SIM card module of the framework layer.
[0218] S903: The SIM card module queries the in-place status of the SIM card in response to the instruction for querying the in-place status of the SIM card.
[0219] S904, the SIM card module sends a message about the SIM card in-place status to the battery safety module.
[0220] S905: The battery safety module determines whether the SIM card is in place according to the message about the SIM card in place status.
[0221] S906: In response to the SIM card being in place, the battery safety module determines whether the silent placement time reaches a first preset time and whether the battery power is less than a fifth power threshold.
[0222] S907, in response to the silent placement time reaching the first preset time and the battery power being less than the fifth power threshold, the battery safety module sends a shutdown command to the shutdown module of the framework layer.
[0223] S908, the battery safety module sends an instruction for the fourth scheduled startup task to the scheduled startup module of the framework layer.
[0224] S909, the shutdown module shuts down the computer in response to the shutdown instruction.
[0225] S910, the scheduled startup module sets and starts the fourth scheduled startup task in response to an instruction of the fourth scheduled startup task.
[0226] S911, in response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0227] S912: In response to the instruction to switch to the transport mode, the kernel layer switches to the transport mode by calling an enable transport mode node.
[0228] S913, in response to the fact that the silent placement time does not reach the first preset time, or the battery power is greater than or equal to the fifth power threshold, the battery safety module determines whether the silent placement time reaches the second preset time and whether the battery power is less than the sixth power threshold.
[0229] S914: In response to the silent placement time reaching a second preset time and the battery power level being less than a sixth power threshold, the battery safety module sends a shutdown command to the shutdown module.
[0230] S915, the battery safety module sends an instruction for the fourth scheduled startup task to the scheduled startup module.
[0231] S916, the shutdown module shuts down in response to the shutdown instruction.
[0232] S917, the scheduled startup module sets and starts the fourth scheduled startup task in response to the instruction of the fourth scheduled startup task.
[0233] S918: In response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0234] S919, the kernel layer responds to the instruction to switch to the transport mode by calling the enable transport mode node to switch to the transport mode.
[0235] S920, in response to the silent placement time not reaching the second preset time or the battery power being greater than or equal to the sixth power threshold, the battery safety module determines whether the silent placement time reaches the third preset time and whether the battery power is less than the seventh power threshold.
[0236] S921, in response to the silent placement time reaching a third preset time and the battery power being less than a seventh power threshold, the battery safety module sends a shutdown command to the shutdown module.
[0237] S922, the battery safety module sends an instruction for a fourth scheduled startup task to the scheduled startup module.
[0238] S923, the shutdown module shuts down the computer in response to the shutdown instruction.
[0239] S924, the scheduled startup module sets and starts the fourth scheduled startup task in response to the instruction of the fourth scheduled startup task.
[0240] S925: In response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0241] S926 , the kernel layer switches to the transport mode by calling the enable transport mode node in response to the instruction to switch to the transport mode.
[0242] In this embodiment, the electronic device obtains the silent placement time and the battery power in the scenario where the electronic device is passively shut down and the SIM card is in place, and then switches to the transport mode or shuts down according to the silent placement time and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the silent placement time and the battery power in the scenario where the electronic device is passively shut down and the SIM card is in place. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the transport mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the transport mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0243] Fig.10 This is an interactive diagram of a method for entering a transport mode in a scenario where the device is passively shut down and the SIM card is not in place, provided by an embodiment of the present application.
[0244] The method for entering the transport mode is applied to an electronic device, for example, Figure 1 and Figure 2 The electronic device 100 shown. Fig.10 As shown, the method for entering the transport mode includes the following steps:
[0245] S1001, in response to a shutdown scenario being a passive shutdown scenario, a battery safety module of the application layer obtains a silent placement time of the electronic device.
[0246] S1002, the battery safety module sends an instruction to query the in-place status of the SIM card to the SIM card module of the framework layer.
[0247] S1003: The SIM card module queries the in-place status of the SIM card in response to the instruction for querying the in-place status of the SIM card.
[0248] S1004, the SIM card module sends a message about the SIM card in-place status to the battery safety module.
[0249] S1005: The battery safety module determines whether the SIM card is in place according to the message about the SIM card in place status.
[0250] S1006: In response to the SIM card being in-place state being not in-place, the battery safety module determines whether the silent placement time reaches a first preset time and whether the battery power is less than an eighth power threshold.
[0251] S1007: In response to the silent placement time reaching the first preset time and the battery power being less than an eighth power threshold, the battery safety module sends a shutdown command to the shutdown module of the framework layer.
[0252] S1008: The battery safety module sends an instruction for a fourth scheduled startup task to the scheduled startup module of the framework layer.
[0253] S1009, the shutdown module shuts down in response to the shutdown instruction.
[0254] S1010, the scheduled startup module sets and starts the fourth scheduled startup task in response to an instruction of the fourth scheduled startup task.
[0255] S1011, in response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0256] S1012: In response to the instruction to switch to the transport mode, the kernel layer switches to the transport mode by calling an enable transport mode node.
[0257] S1013, in response to the silent placement time not reaching the first preset time or the battery power being greater than or equal to the eighth power threshold, the battery safety module determines whether the silent placement time reaches the second preset time and whether the battery power is less than the ninth power threshold.
[0258] S1014: In response to the silent placement time reaching a second preset time and the battery power being less than a ninth power threshold, the battery safety module sends a shutdown command to the shutdown module.
[0259] S1015: The battery safety module sends an instruction for a fourth scheduled startup task to the scheduled startup module.
[0260] S1016, the shutdown module shuts down in response to the shutdown instruction.
[0261] S1017, the scheduled startup module sets and starts the fourth scheduled startup task in response to the instruction of the fourth scheduled startup task.
[0262] S1018: In response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0263] S1019, the kernel layer switches to the transport mode by calling the enable transport mode node in response to the instruction to switch to the transport mode.
[0264] S1020, in response to the silent placement time not reaching the second preset time or the battery power being greater than or equal to the ninth power threshold, the battery safety module determines whether the silent placement time reaches the third preset time and whether the battery power is less than the tenth power threshold.
[0265] S1021, in response to the silent placement time reaching a third preset time and the battery power being less than a tenth power threshold, the battery safety module sends a shutdown command to the shutdown module.
[0266] S1022: The battery safety module sends an instruction for a fourth scheduled startup task to the scheduled startup module.
[0267] S1023, the shutdown module shuts down in response to the shutdown instruction.
[0268] S1024: The scheduled startup module sets and starts the fourth scheduled startup task in response to the instruction of the fourth scheduled startup task.
[0269] S1025: In response to the electronic device being powered on when or before the fourth scheduled power-on task expires, the battery safety module sends an instruction to switch to the shipping mode to the kernel layer.
[0270] S1026 , the kernel layer switches to the transport mode by calling the enable transport mode node in response to the instruction to switch to the transport mode.
[0271] In this embodiment, the electronic device obtains the silent placement time and the battery power in a scenario where the electronic device is passively shut down and the SIM card is not in place, and then switches to the transport mode or shuts down according to the silent placement time and the battery power. In this way, it is possible to effectively distinguish whether the electronic device is in a scenario where it is not used for a long time or in a scenario where it is not used for a short time according to the silent placement time and the battery power in a scenario where the electronic device is passively shut down and the SIM card is not in place. When it is determined that the electronic device is in a scenario where it is not used for a long time, the electronic device is controlled to switch to the transport mode so that the electronic device is completely powered off, which is conducive to avoiding the battery from being in a low-power state, thereby protecting the battery and extending the battery life. When it is determined that the electronic device is in a scenario where it is not used for a short time, the electronic device is controlled to shut down instead of switching to the transport mode, so that the electronic device can start quickly when it is restarted, and will not affect the user's experience.
[0272] Fig.11 It is a structural schematic diagram of a battery protection device provided in an embodiment of the present application.
[0273] The battery protection device can be an electronic device or a component inside the electronic device. Fig.11The battery protection device 200 includes a shutdown scenario determination module 210 , a SIM card presence status monitoring module 220 , a battery power monitoring module 230 and a switching module 240 .
[0274] The shutdown scenario determination module 210 is used to determine a shutdown scenario of the electronic device, where the shutdown scenario includes an active shutdown scenario or a passive shutdown scenario.
[0275] The SIM card presence status monitoring module 220 is used to obtain the presence status of the SIM card of the electronic device according to the shutdown scenario, and the presence status of the SIM card includes being in place or not in place.
[0276] The battery power monitoring module 230 is used to obtain the power level of the battery of the electronic device according to the shutdown scenario.
[0277] The switching module 240 is used to switch to the shipping mode or shut down according to the presence status of the SIM card and the power level of the battery.
[0278] It can be understood that the module division described above is a logical function division, and there may be other division methods in actual implementation. In addition, the functional modules in each embodiment of the present application can be integrated in the same processing unit, or each module can exist physically separately, or two or more modules can be integrated in the same processing unit. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0279] An embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the method for entering the transport mode according to an embodiment of the present application.
[0280] Computer-readable storage media include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), flash memory or other memory, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), digital versatile disc (Digital Versatile Disc, DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0281] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. A method for entering a transport mode, characterized in that: The method is applied to an electronic device, and the method comprises: In response to a shutdown operation by a user, the electronic device sets a first scheduled startup task; In response to the first scheduled power-on task, the electronic device powers on; Based on the presence status of the SIM card and the power level of the battery, the electronic device is shut down or enters a shipping mode.
2. The method for entering transport mode according to claim 1, characterized in that: The electronic device shuts down or enters a transport mode based on the presence status of the SIM card and the power level of the battery, including: If the SIM card is in place, and the battery power is less than a first power threshold, the electronic device enters a shipping mode.
3. The method for entering transport mode according to claim 1, characterized in that: The electronic device shuts down or enters a transport mode based on the presence status of the SIM card and the power level of the battery, including: If the SIM card is in place, and the battery power is greater than or equal to the first power threshold, the electronic device is turned off and a second scheduled power-on task is set; In response to the second scheduled power-on task, the electronic device powers on; Based on the charge level of the battery, the electronic device shuts down or enters a shipping mode.
4. The method for entering transport mode according to claim 3, characterized in that: The electronic device shuts down or enters a shipping mode based on the power of the battery, comprising: If the power level of the battery is less than a second power level threshold, the electronic device enters a shipping mode, wherein the second power level threshold is greater than the first power level threshold.
5. The method for entering transport mode according to claim 3, characterized in that: The electronic device shuts down or enters a shipping mode based on the power of the battery, comprising: If the power level of the battery is greater than or equal to a second power level threshold, the electronic device is shut down and a third scheduled power-on task is set, wherein the second power level threshold is greater than the first power level threshold; In response to the third scheduled power-on task, the electronic device enters a shipping mode.
6. The method for entering transport mode according to claim 1, characterized in that: The electronic device shuts down or enters a transport mode based on the presence status of the SIM card and the power level of the battery, including: If the SIM card presence status is not present, and the battery power is less than a third power threshold, the electronic device enters a shipping mode.
7. The method for entering transport mode according to claim 1, characterized in that: The electronic device shuts down or enters a transport mode based on the presence status of the SIM card and the power level of the battery, including: If the SIM card is not in place, and the battery power is greater than or equal to a third power threshold, the electronic device is turned off and a second scheduled power-on task is set; In response to the second scheduled power-on task, the electronic device powers on; Based on the charge level of the battery, the electronic device shuts down or enters a shipping mode.
8. The method for entering transport mode according to claim 7, characterized in that: The electronic device shuts down or enters a shipping mode based on the power of the battery, comprising: If the power level of the battery is less than a fourth power level threshold, the electronic device enters a shipping mode, wherein the fourth power level threshold is greater than the third power level threshold.
9. The method for entering transport mode according to claim 7, characterized in that: The electronic device shuts down or enters a shipping mode based on the power of the battery, comprising: If the power level of the battery is greater than or equal to a fourth power level threshold, the electronic device is shut down and a third scheduled power-on task is set, wherein the fourth power level threshold is greater than the third power level threshold; In response to the third scheduled power-on task, the electronic device enters a shipping mode.
10. A method for entering a transport mode, characterized in that: The method is applied to an electronic device, and the method comprises: Based on the presence status of the SIM card, the silent placement time and the battery power, the electronic device is shut down or enters the transportation mode.
11. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the SIM card is in place, the silent placement time reaches a first preset time and the battery power is less than a fifth power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
12. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the in-place status of the SIM card is in-place, the silent placement time reaches a second preset time and the power of the battery is less than a sixth power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
13. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the in-place status of the SIM card is in-place, the silent placement time reaches a third preset time and the power of the battery is less than a seventh power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
14. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the SIM card is not in place, the silent placement time reaches a first preset time and the battery power is less than an eighth power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
15. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the SIM card is not in place, the silent placement time reaches a second preset time and the battery power is less than a ninth power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
16. The method for entering transport mode according to claim 10, characterized in that: The electronic device shuts down or enters the transport mode based on the presence status of the SIM card, the silent placement time and the battery power, including: If the SIM card is not in place, the silent placement time reaches a third preset time and the battery power is less than a tenth power threshold, the electronic device is turned off and a fourth scheduled startup task is set; In response to the fourth scheduled power-on task, the electronic device enters a shipping mode.
17. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store instructions, and the processor is used to run the instructions stored in the memory, so that the electronic device executes the method for entering the transport mode according to any one of claims 1 to 16.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to execute the method for entering a transport mode according to any one of claims 1 to 16.