EP-4742001-A1 - MODE SWITCHING METHOD AND ELECTRONIC DEVICE
Abstract
This application provides a mode switching method and an electronic device. The mode switching method is applied to an electronic device. The electronic device includes a main processor, a coprocessor, and an internal memory. An operating mode of the electronic device includes a power saving mode and a working mode. In the power saving mode, the coprocessor works, and the main processor does not work. In the working mode, the main processor and the coprocessor work. The method includes: receiving a first operation, where the first operation is used to switch the operating mode of the electronic device from the power saving mode to the working mode; controlling the main processor to be powered on; and obtaining first data from the internal memory, where the first data is service data of the main processor stored when the operating mode of the electronic device is switched from the working mode to the power saving mode. According to this application, the operating mode of the electronic device is enabled to provide expected effect of a function, and to improve function availability, to improve user experience.
Inventors
- WANG, Huaiyong
Assignees
- Huawei Technologies Co., Ltd.
Dates
- Publication Date
- 20260513
- Application Date
- 20250108
Claims (12)
- A mode switching method, applied to an electronic device, wherein the electronic device comprises a main processor, a coprocessor, and an internal memory; an operating mode of the electronic device comprises a power saving mode and a working mode; in the power saving mode, the coprocessor works, and the main processor does not work; in the working mode, the main processor and the coprocessor work; and the method comprises: receiving a first operation, wherein the first operation is used to switch the operating mode of the electronic device from the power saving mode to the working mode; controlling the main processor to be powered on; and obtaining first data from the internal memory, wherein the first data is service data of the main processor stored when the operating mode of the electronic device is switched from the working mode to the power saving mode.
- The method according to claim 1, wherein after obtaining the first data from the internal memory, the method further comprises: performing a first initialization procedure on the main processor based on the first data.
- The method according to claim 1 or 2, wherein before receiving the first operation, the method further comprises: receiving a second operation, wherein the second operation is used to switch the operating mode of the electronic device from the working mode to the power saving mode; storing the first data in the internal memory; and controlling the main processor to be powered off.
- The method according to claim 3, wherein storing the first data in the internal memory comprises: obtaining the first data from a first area in the internal memory, wherein the first area is used for the main processor to store data; and storing the first data in a second area in the internal memory, wherein the second area is different from the first area.
- The method according to any one of claims 1 to 4, wherein a third area in the internal memory is used for the coprocessor to store data.
- The method according to claim 3, wherein after storing the first data in the internal memory, the method further comprises: sending, by the main processor, a first message to the coprocessor, wherein the first message comprises storage location information of the first data, and the storage location information of the first data is used to determine a refresh area of the internal memory during the power saving mode.
- The method according to claim 6, wherein the storage location information of the first data comprises location information of the second area, or location information of the first data stored in the second area.
- The method according to claim 6 or 7, wherein the first message comprises size information of the first data.
- The method according to any one of claims 3 to 8, wherein after controlling the main processor to be powered off, the method further comprises: adjusting an operating frequency of the internal memory to a first frequency, wherein the first frequency is less than a second frequency, and the second frequency is an operating frequency of the internal memory during the working mode.
- The method according to any one of claims 2 to 9, wherein the method further comprises: if the first data is not stored in the internal memory, performing a second initialization procedure, wherein duration of the second initialization procedure is greater than duration of the first initialization procedure.
- An electronic device, comprising a transceiver, a processor, and a memory, wherein the memory is configured to store a computer program, and the processor invokes the computer program to perform the method according to any one of claims 1 to 10.
- A computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Description
This application claims priority to Chinese Patent Application No. 202410041952.1, filed with the China National Intellectual Property Administration on January 10, 2024 and entitled "MODE SWITCHING METHOD AND ELECTRONIC DEVICE", which is incorporated herein by reference in its entirety. TECHNICAL FIELD This application relates to the field of computer technologies, and in particular, to a mode switching method and an electronic device. BACKGROUND Currently, a terminal device has various operating modes, for example, a working mode and a power saving mode. However, due to limited hardware computational power of the terminal device, and with continuous upgrade of a system of the terminal device and service expansion, the foregoing two operating modes cannot provide expected effect of a function for a user, and function availability is low, resulting in poor user experience. SUMMARY This application discloses a mode switching method and an electronic device, to enable an operating mode of the electronic device to provide expected effect of a function, and to improve function availability, to improve user experience. According to a first aspect, an embodiment of this application provides a mode switching method, applied to an electronic device, where the electronic device includes a main processor, a coprocessor, and an internal memory; an operating mode of the electronic device includes a power saving mode and a working mode; in the power saving mode, the coprocessor works, and the main processor does not work; in the working mode, the main processor and the coprocessor work, and the method includes: receiving a first operation, where the first operation is used to switch the operating mode of the electronic device from the power saving mode to the working mode; controlling the main processor to be powered on; and obtaining first data from the internal memory, where the first data is service data of the main processor stored when the operating mode of the electronic device is switched from the working mode to the power saving mode. In the foregoing method, when being in the power saving mode, the electronic device may receive the first operation, control, in response to the first operation, the main processor to be powered on, and obtain the first data from the internal memory, so that the electronic device is switched to the working mode. The first data is the service data of the main processor stored when the electronic device is switched from the working mode to the power saving mode, and the first data includes service data of a multi-layer software and hardware architecture of a system. When the electronic device is switched from the power saving mode to the working mode, the electronic device may directly complete initialization of the main processor based on content and a storage location of the first data. In this way, a problem of a long operating mode switching time is resolved, a waiting time and an anxiety of a user are reduced, and user experience is improved. In a possible implementation, after obtaining the first data from the internal memory, the method further includes: performing a first initialization procedure on the main processor based on the first data. In the foregoing method, after obtaining the first data, the electronic device may perform the first initialization procedure on the main processor based on the first data. In this manner, the electronic device can directly complete initialization of the main processor based on the first data without obtaining related data from the external memory and sequentially loading related data at each layer in the multi-layer software architecture. It may be understood that the electronic device uses the first data to complete loading of the service data of the multi-layer software and hardware architecture at a time. In this way, an operating mode switching time is greatly reduced, a waiting time of a user is reduced, and user experience is improved. In a possible implementation, before receiving the first operation, the method further includes: receiving a second operation, where the second operation is used to switch the operating mode of the electronic device from the working mode to the power saving mode; storing the first data in the internal memory; and controlling the main processor to be powered off. In the foregoing method, when being in the working mode, the electronic device may receive the second operation, and store, in the internal memory in response to the second operation, current service data (namely, the foregoing first data) of the main processor in the multi-layer software and hardware architecture, control the main processor to be powered off, and maintain the internal memory not powered off, so that the electronic device is switched to the power saving mode. In this way, when the electronic device is subsequently switched back to the working mode, the first data may be directly read from the internal memory to complete init