Control method of a cellular network and electronic device
By detecting cellular network usage that the application is not generating data in the background, disconnecting the cellular network and switching to Wi-Fi, the problem of continuous power consumption in dual-network environments is solved, thus saving battery power.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2026-04-07
AI Technical Summary
On mobile phones, there is a problem of continuous power consumption caused by applications switching between different networks, especially when Wi-Fi and cellular networks are connected at the same time. Apps that are not using cellular networks continue to consume power.
If an application is detected to have not generated data within a preset background running time and is the last application to use the cellular network, the cellular network connection will be disconnected, and data interaction will be conducted via Wi-Fi until the application generates data again or the user reconnects to the cellular network.
By optimizing network usage strategies, the power consumption of mobile phones in dual-network environments is reduced, saving battery power and improving battery efficiency.
Smart Images

Figure CN116419372B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal device technology, and in particular to a control method and electronic device for a cellular network. Background Technology
[0002] With the development of communication technology, the variety of applications on electronic devices is increasing, making these applications more and more closely integrated into users' lives. Currently, most applications require internet access to provide services, and electronic devices can provide Wi-Fi and cellular networks to enable these connections.
[0003] In scenarios where different applications on a mobile phone use cellular networks and Wi-Fi networks to connect to the internet, this can cause the phone to continuously consume power. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides a cellular network control method and an electronic device. In this method, when an application that last applied for and used the cellular network is detected, switches from foreground to background operation, and remains running without generating application data for a certain period, the cellular network access can be disconnected. This prevents applications that did not apply for the cellular network from continuing to use the cellular network requested by the aforementioned application when the electronic device has a Wi-Fi connection, thereby saving battery power in a dual-network environment.
[0005] In a first aspect, embodiments of this application provide a control method for a cellular network, applied to an electronic device. The electronic device interacts with an application server via a Wi-Fi network and a cellular network. The cellular network is requested by a first application, and the first application and a second application interact with their respective application servers via the cellular network. The method includes:
[0006] In response to the first user operation received, the first application running in the foreground is switched to run in the background;
[0007] If it is detected that the first application has not generated application data within a preset time period of running in the background, and the first application is the last application to apply for and use the cellular network, the cellular network access of the electronic device is disconnected.
[0008] The second application's data is exchanged with the application server of the second application via the Wi-Fi network.
[0009] For example, if an application in an electronic device can interact with an application server using a network at the same time, then different applications in the electronic device can interact with their respective application servers via Wi-Fi and cellular networks respectively.
[0010] For example, the above data interaction can be used to represent uplink data interaction, downlink data interaction, or uplink and downlink data interaction.
[0011] For example, the first application uses the cellular network to indicate that before the electronic device detects that the first application has not generated application data within a preset period of time while running in the background, the first application can use the cellular network to interact with the application server of the first application.
[0012] In this embodiment of the application, in a scenario where an electronic device is connected to both Wi-Fi and cellular networks, the cellular network is requested by a first application and used by the first application and a second application that has not requested the cellular network. After switching the first application running in the foreground to the background in response to a user operation, if it is detected that the first application has not generated application data within a preset time period of running in the background and is the last application to request and use the cellular network, then the cellular network access can be disconnected. This prevents the second application that has not requested the cellular network from continuing to use the cellular network requested by the first application when the electronic device has a Wi-Fi connection, thereby saving the phone's battery power in a dual-network environment.
[0013] Optionally, in one possible implementation, after disconnecting the cellular network of the electronic device, the method further includes:
[0014] In response to the received second user operation, the first application that has not generated application data within the preset time period of running in the background is switched to run in the foreground;
[0015] The pathway of the cellular network connecting the electronic device.
[0016] Optionally, the method further includes: after establishing a path to the cellular network connecting the electronic device, interacting with the application server of the first application via the cellular network to exchange data of the first application.
[0017] For example, this application does not limit the timing of data interaction between the first application and the cellular network. The specific timing depends on the business needs of the first application. When the first application needs to connect to the network to interact with the application server, it can be done through the cellular network.
[0018] Optionally, in one possible implementation, after detecting that the first application has not generated application data within a preset period of time while running in the background, and that the first application is the last application to request and use the cellular network, the method further includes:
[0019] Delete the first cellular request of the first application from the first data structure;
[0020] Wherein, the first cellular request is used to apply for the cellular network, and the first data structure is used to store cellular requests of a preset application, wherein the preset application is an application that has applied for the cellular network.
[0021] Alternatively, in one possible implementation,
[0022] Before deleting the first cellular request of the first application from the first data structure, the method further includes:
[0023] Back up the first cellular request to the second data structure;
[0024] Prior to the path connecting the electronic device to the cellular network, the method further includes:
[0025] Write the first cellular request backed up in the second data structure into the first data structure.
[0026] Optionally, in one possible implementation, the method further includes:
[0027] In response to a received third user operation, the third application running in the foreground is switched to run in the background, wherein the cellular network is requested by the third application, and the third application interacts with its application server through the cellular network;
[0028] If it is detected that the third application has not generated application data within the preset time period during which it has been running in the background, and the third application is not the last application to apply for and use the cellular network, the second cellular request of the third application will be deleted from the first data structure.
[0029] The second cellular request is used to apply for the cellular network.
[0030] For example, when it is detected that the third application has not generated application data within the preset time period during which it remains running in the background, there are other applications besides the third application that have applied for and are using the cellular network.
[0031] Optionally, in one possible implementation, before deleting the second cellular request of the third application from the first data structure, the method further includes:
[0032] The second cellular request is backed up to the second data structure.
[0033] Optionally, in one possible implementation, after deleting the second cellular request of the third application from the first data structure, the method further includes:
[0034] In response to the received fourth user operation, the third application that has not generated application data within the preset time period of running in the background is switched to run in the foreground;
[0035] Write the second cellular request backed up in the second data structure into the first data structure.
[0036] Optionally, in one possible implementation, after writing the first cellular request backed up in the second data structure into the first data structure, the method further includes:
[0037] Remove the first cellular request from the second data structure.
[0038] Optionally, in one possible implementation, after writing the second cellular request backed up in the second data structure into the first data structure, the method further includes:
[0039] Remove the second cellular request from the second data structure.
[0040] Optionally, in one possible implementation, after disconnecting the cellular network access of the electronic device, the method further includes:
[0041] In response to the received fourth user operation, the first application that has not generated application data within a preset time period of background operation will be closed;
[0042] Remove the first cellular request from the second data structure.
[0043] Optionally, in one possible implementation, the electronic device displays a first icon representing the Wi-Fi network and a second icon representing the cellular network;
[0044] Before disconnecting the cellular network access of the electronic device, the second icon includes a second uplink identifier and / or a second downlink identifier;
[0045] The second uplink identifier is used to indicate that the electronic device uploads data to the application server through the cellular network;
[0046] The second downlink identifier is used to indicate that the electronic device downloads data from the application server via the cellular network.
[0047] Optionally, in one possible implementation, after disconnecting the cellular network access of the electronic device, the first icon includes the first uplink identifier and / or the first downlink identifier, and the second icon does not include the second uplink identifier and the second downlink identifier;
[0048] The first uplink identifier is used to indicate that the electronic device uploads data to the application server through the Wi-Fi network;
[0049] The first downlink identifier is used to indicate that the electronic device downloads data from the application server via the Wi-Fi network.
[0050] Optionally, in one possible implementation, after the path of the cellular network connecting the electronic device, the second icon includes the second uplink identifier and / or the second downlink identifier.
[0051] Secondly, embodiments of this application provide an electronic device. The electronic device includes: a memory and a processor, the memory and the processor being coupled; the memory stores program instructions, which, when executed by the processor, cause the electronic device to perform the method as described in the first aspect and any embodiment of the first aspect.
[0052] The technical effects corresponding to the second aspect can be found in the first aspect and the technical effects corresponding to any implementation of the first aspect, which will not be repeated here.
[0053] Thirdly, embodiments of this application provide a computer-readable medium for storing a computer program that, when run on an electronic device, causes the electronic device to perform the method as described in the first aspect and any embodiment of the first aspect.
[0054] The technical effects corresponding to the third aspect can be found in the first aspect and the technical effects corresponding to any implementation of the first aspect, which will not be repeated here.
[0055] Fourthly, embodiments of this application provide a chip including one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, it causes the electronic device to perform the method as described in the first aspect and any embodiment of the first aspect.
[0056] The technical effects corresponding to the fourth aspect can be found in the first aspect and the technical effects corresponding to any implementation of the first aspect, which will not be repeated here. Attached Figure Description
[0057] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is one of the schematic diagrams of the structure of an electronic device as an example.
[0059] Figure 2 A schematic diagram of the software structure of an electronic device as an example;
[0060] Figure 3a This is an example of a network interaction diagram of a mobile phone;
[0061] Figure 3b This is a schematic diagram illustrating the interaction flow of various modules of a mobile phone as an example.
[0062] Figure 4 This is a schematic diagram illustrating cellular status and application status as an example.
[0063] Figure 5a This is a schematic flowchart illustrating an exemplary cellular network control method;
[0064] Figure 5b This is a schematic flowchart illustrating an exemplary cellular network control method;
[0065] Figure 6 This is a schematic flowchart illustrating an exemplary cellular network control method;
[0066] Figure 7 This is a schematic flowchart illustrating an exemplary cellular network control method;
[0067] Figure 8 This is a schematic flowchart illustrating an exemplary cellular network control method;
[0068] Figure 9 This is a schematic diagram illustrating an application scenario;
[0069] Figure 10 This is a schematic diagram illustrating an application scenario;
[0070] Figure 11 This is a schematic diagram illustrating the cellular state and application state of one embodiment of this application;
[0071] Figure 12 This is a schematic diagram illustrating the cellular state and application state of one embodiment of this application;
[0072] Figure 13 This is a schematic diagram illustrating the cellular state and application state of one embodiment of this application;
[0073] Figure 14 This is a schematic diagram of the device provided in an embodiment of this application. Detailed Implementation
[0074] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0075] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0076] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects. For example, "first target object" and "second target object," etc., are used to distinguish different target objects, not to describe a specific order of target objects.
[0077] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0078] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more. For example, multiple processing units means two or more processing units; multiple systems means two or more systems.
[0079] Figure 1 A schematic diagram of the structure of the electronic device 100 is shown. It should be understood that... Figure 1 The electronic device 100 shown is merely an example of an electronic device. Optionally, the electronic device 100 can be a terminal, also referred to as a terminal device. The terminal can be a cellular phone, i.e., a mobile phone, which is not limited in this application. It should be further noted that the electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have different component configurations.Figure 1 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0080] Electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0081] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0082] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0083] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0084] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0085] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, or USB Type-C port. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0086] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0087] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0088] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0089] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0090] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0091] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0092] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0093] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0094] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. Electronic device 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to display screen 194 and application processor. The GPU performs mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0095] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0096] Electronic device 100 can perform shooting functions through an ISP, camera 193, video codec, GPU, display 194, and application processor. Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through a lens.
[0097] The external storage interface 120 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 storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0098] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications of electronic device 100 and the cellular network control method in this embodiment by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0099] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0100] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0101] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0102] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0103] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0104] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0105] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0106] Figure 2 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.
[0107] The layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0108] The application layer can include a series of application packages.
[0109] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0110] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0111] like Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, connectivity service module (CS), and power control module, etc.
[0112] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0113] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0114] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0115] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0116] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0117] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0118] The connectivity service module is used to manage the network connections of electronic devices. The specific processing procedures will be described in detail in the following embodiments.
[0119] The power consumption control module manages the state of the application and controls the connectivity service module, operating throughout the entire process from powering on to powering off the electronic device.
[0120] The system library and runtime layer include the system libraries and the Android Runtime. The system libraries can include multiple functional modules, such as the surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The 3D graphics library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The Android Runtime includes the core libraries and the virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system. The core libraries consist of two parts: one part contains the functionalities that the Java language needs to call, and the other part contains the core Android libraries. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0121] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0122] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0123] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0124] A 2D graphics engine is a graphics engine for 2D drawing.
[0125] The kernel layer is the layer between hardware and software. At a minimum, the kernel layer includes display drivers, camera drivers, audio drivers, sensor drivers, and a modem.
[0126] Understandable, Figure 2 The components included in the system framework layer, system library, and runtime layer shown do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or have different component arrangements.
[0127] Figure 3a This is an example of a network interaction diagram of a mobile phone. Figure 3b This is a schematic diagram illustrating the interaction flow of various modules of a mobile phone according to an embodiment of the present invention. Figure 4 For example, with Figure 3a and Figure 3b A diagram illustrating the associated cellular status and application status.
[0128] In the Figure 3a , Figure 3b as well as Figure 4 Before going into detail, here is... Figure 4 A brief description of the cellular status and application status shown:
[0129] Cellular disconnect status: This indicates that the cellular path between the mobile phone and the base station is disconnected.
[0130] Cellular connection status: indicates the state in which the cellular path between the mobile phone and the base station is connected;
[0131] Application is in an active state (or simply active state): This indicates that the application is in a running state, which may include, but is not limited to, running in the foreground or background.
[0132] Foreground operations may include, but are not limited to:
[0133] In scenarios where the only application running in the foreground is in a foreground context, for example... Figure 9 (1) The mobile phone front-end interface only includes the news interface 501 of the browser application, and the browser application is the only application running in the front end.
[0134] In scenarios where an application is one of at least two applications running in the foreground, such as an application interface within a picture-in-picture window or an application interface within a floating window, the application is running in the foreground.
[0135] An application is in a frozen state (or simply frozen state): One way to describe the frozen state is as a doze state; another way is to describe the state of the application as a state in which, after entering the background (as a background application), it does not interact with any modules for a predetermined period of time in the background and therefore does not generate any application data (e.g., it no longer calls the CPU).
[0136] Application data is used to represent any data generated by the application.
[0137] For example, after a music app switches from the foreground to the background, it can continue to interact with the audio driver and generate audio data. If the music app continues to play music in the background, it remains active and is considered to be running in the background.
[0138] For example, if a browser application does not generate application data for more than 30 seconds after switching from the foreground to the background, it can be determined that the browser application is in a frozen state in the background and is not running in the background.
[0139] The following is combined with Figure 3a , Figure 3b and Figure 4 The application's network usage process is explained in detail.
[0140] Reference Figure 3a (1) Taking a mobile phone as an example, when both the cellular data switch and the Wi-Fi data switch of the mobile phone are turned on, if the mobile phone connects to the router via Wi-Fi data, in order to save the problem of excessive data consumption caused by using the cellular network, the application installed on the mobile phone will by default use the Wi-Fi network connected to the mobile phone to interact with the server and will not request the cellular network, so that the cellular network of the mobile phone is in a cellular disconnected state.
[0141] Reference Figure 4 During the time period t0 to t1 (excluding time t1), the mobile phone follows... Figure 3a (1) The phone connects to the router via Wi-Fi data without establishing a cellular connection with the base station. During the time period t0 to t1, the phone's cellular status is disconnected. During this time, both application 1 and application 2 are active, for example, both are running in the foreground and communicating with the server via Wi-Fi.
[0142] Continue to refer to Figure 4 At time t1, although the mobile phone and the router are connected via Wi-Fi data, application 1 needs to apply for the use of the cellular network because it meets preset conditions. These preset conditions may include, but are not limited to: business needs, poor Wi-Fi signal quality, Wi-Fi channels being occupied, resulting in slow data transmission, and the need to transmit encrypted data.
[0143] When application 1 requests to use the cellular network, such as Figure 3b As shown, application 1 can send a first cellular request to the connection service module (hereinafter referred to as the connection service module).
[0144] For example, the connectivity service module can store the first cellular request received from application 1 in a first data structure, wherein the first data structure can be used to store cellular requests from applications that actively request cellular access. For example, each application's cellular request has a unique request sequence number, and the request sequence numbers of cellular requests from different applications are different.
[0145] The data structures described in this article (which may include the first data structure described here and the second data structure described below) may include, but are not limited to: linked lists, arrays, vectors, XML files, variables, key-value pairs, queues, stacks, trees, heaps, hash tables, etc.
[0146] For example, the first data structure here can be a linked list, and cellular requests can be stored in the linked list.
[0147] For example, the first cellular request may include, but is not limited to, the following parameters: the type of network requested (here, a cellular network), the application type identifier used to identify the application type of application 1 (e.g., whether it is a third-party application), the package name, etc.
[0148] like Figure 3b As shown, after receiving the first cellular request, the connection service module can instruct the modem to establish a cellular connection;
[0149] The modem can respond to this instruction to activate the cellular-related radio frequency (RF) to establish a cellular connection with the base station. For example, the modem can send a command to activate the cellular-related RF to a modem processor on the hardware side, which can then send RF signals to establish a cellular connection with the base station. Figure 3a As shown in (2), the mobile phone not only connects to the router via Wi-Fi data, but also establishes a cellular connection with the base station (i.e., the cellular path between the mobile phone and the base station is in a connected state) so that the mobile phone can support dual-network communication.
[0150] Reference Figure 4 After time t1, the mobile phone not only connects to the router via Wi-Fi data, but also establishes a cellular connection with the base station. For example, after application 1 requests cellular access at time t1, the mobile phone's cellular state switches from cellular disconnected to cellular connected.
[0151] Reference Figure 4 At time t1, application 1 requests cellular access, establishing a cellular connection between the phone and the base station. This means the cellular path between the phone's modem and the base station is activated and in a connected state. Correspondingly, the connection service module can control the switching of the network path used by application 1 from a Wi-Fi connection to a cellular connection. Application 1 can then use the cellular path for data communication starting at time t1.
[0152] Continue to refer to Figure 3b and Figure 4 After application 2 starts its activity, before time t2, application 2 can use the Wi-Fi channel for data communication. At time t2, application 2 meets preset conditions (e.g., poor Wi-Fi signal quality; these preset conditions may also include other conditions listed above, which will not be elaborated here) and uses the cellular network. However, application 2 does not send a cellular request to the connection service module; instead, it sends a listening request. This listening request is used to monitor whether the cellular channel between the modem and the base station is open, i.e., to monitor the cellular status. The connection service module can respond to this listening request by monitoring whether the cellular channel between the modem and the base station is open. If it is not open, the connection service module continues to monitor the modem. If the connection service module detects from the modem that the cellular-related radio frequency is turned on, it means that a cellular connection has been established between the modem and the base station, and the cellular channel between the mobile phone and the base station is open. In this example, since the cellular connection between the mobile phone and the base station has been established at time t1 due to application 1's cellular request, the connection service module can switch the network channel used by application 2 from the Wi-Fi channel to the cellular channel at time t2. Figure 4 As can be seen, application 2 starts using the cellular channel for data communication from time t2.
[0153] Alternatively, in another embodiment, application 2 may send a listening request to the connection service module after startup, so that application 2 can start using the cellular channel for data communication at time t1 when application 1 requests the cellular network.
[0154] Optionally, in another embodiment, after the modem establishes a cellular connection with the base station, a status value indicating a cellular connection state can be reported to the connection service module. The connection service module can then store the cellular status value and update it based on changes in the cellular status. So, at time t1, when application 1 requests cellular access, establishing a cellular connection between the mobile phone and the base station, the connection service module can determine whether the cellular path between the modem and the base station is open from the stored cellular status value. If the status value represents a cellular connection state, it indicates that the cellular path is open; if the status value represents a cellular disconnect state, it indicates that the cellular path is closed, i.e., not open. Therefore, the connection service module can obtain cellular status information without listening to the connection.
[0155] Reference Figure 4At time t3, application 1 switches from active state to frozen state. For example, if a browser application is running in the foreground and the user switches it to the background by clicking the home button on the phone, and the browser application does not generate any data in the background for more than 30 seconds, then application 1 is determined to be in frozen state at this moment (i.e., time t3).
[0156] from Figure 4 It can be seen that application 1 can use the cellular channel for data communication during the time period t1 to t3. After application 1 is frozen at time t3, application 1 no longer needs to use the cellular channel for data communication.
[0157] After application 1 requests cellular access at time t1, the phone's cellular status remains connected, even after application 1 switches from active to frozen state at time t3. Therefore, application 2 can continue using the cellular network for data communication after time t2, causing continuous power consumption due to application 2's continued use of the cellular network after time t3. In dual-network concurrent scenarios, when some applications request and use the cellular network, and the applications that requested cellular access become frozen, some applications that did not request cellular access will still use the cellular network to interact with the application server, leading to increased power consumption.
[0158] For example, map and video apps might both be using Wi-Fi for data communication. The map app, due to business needs, requests cellular access, switching the network it uses from Wi-Fi to cellular. If, after the user switches the map app from foreground to background, it doesn't generate any interactive data for a period—for example, it doesn't interact with the CPU or trigger any actions—it's considered to be in a frozen state, suspending cellular network use. However, since the cellular access is already enabled, the video app can switch from Wi-Fi to cellular without requesting cellular access. This means that while the map app is frozen, the video app can consume more cellular data, causing continuous battery drain.
[0159] In order to reduce unnecessary applications from using the cellular network in dual-network concurrent scenarios, thereby reducing power consumption caused by applications using the cellular network, this invention provides a cellular network control method.
[0160] Figure 5a This is a schematic diagram of the overall process of a cellular network control method provided in an embodiment of this application.
[0161] Reference Figure 5a Specifically, it includes:
[0162] The connection service module detects that application 1 has switched from active state to frozen state and executes S601;
[0163] S601, the connection service module detects that application 1 is the last application among the preset applications that have applied for cellular network access to switch from the active state to the frozen state.
[0164] In other words, Application 1 is the last application to apply for and use the cellular network. Application 1 may have applied for and used the cellular network in the active state before switching from active to frozen state.
[0165] Optionally, after S601 and before S604, the method may further include: S602.
[0166] S602, the connection service module backs up the first cellular request of application 1 in the first data structure.
[0167] Optionally, after S602 and before S604, the method may further include: S603.
[0168] S603, the connection service module deletes the first cellular request from the first data structure.
[0169] S604, the connectivity service module instructs the modem to disconnect the cellular connection.
[0170] After application 1 is in a frozen state, the connection service module detects that application 1 has switched from the frozen state to the active state and can execute S701.
[0171] S701, the connectivity service module instructs the modem to establish a cellular connection.
[0172] After application 1 is in a frozen state, the connection service module detects that application 1 has switched from the frozen state to the closed state (i.e., the process of application 1 is closed), and can execute S801.
[0173] S801, the connection service module deletes the first cellular request of the backup application 1.
[0174] After application 1 is in a frozen state, the power control module's self-test fails and S901 can be executed.
[0175] S901, the connection service module restores the backed-up cellular requests to the first data structure and deletes the backed-up cellular requests.
[0176] For example, the connection service module can rewrite the cellular requests of all applications that have applied for cellular networks (which have been backed up) into the first data structure, and delete the cellular requests of all applications that have applied for cellular networks (which have been backed up).
[0177] S902, the connection service module instructs the modem to establish a cellular connection.
[0178] Figure 5b to Figure 8 This is a flowchart illustrating the cellular network control method provided in various embodiments of this application.
[0179] The following is combined with Figure 5b to Figure 8 , to Figure 5a The method will be explained in detail.
[0180] Reference Figure 5b Specifically, it includes:
[0181] S100, the connection service module determines whether the mobile phone has a Wi-Fi data connection;
[0182] For example, the connection service module can determine whether the mobile phone is connected to the router via a modem.
[0183] For example, if a mobile phone is connected to a router via a modem, it means that the mobile phone has a Wi-Fi data connection. If the mobile phone's modem is not connected to the router, it means that the mobile phone does not have a Wi-Fi data connection.
[0184] When the phone has a Wi-Fi data connection, applications on the phone can interact with the application server via the Wi-Fi network. When the applications on the phone have applied for cellular network access, the phone can interact with the application server not only via Wi-Fi but also via cellular network, putting the phone in a dual-network connected environment.
[0185] For example, application 1 requests a cellular network, and application 1 interacts with its server via the cellular network. Applications 3 and 4 interact with their respective application servers via Wi-Fi networks.
[0186] When the mobile phone does not have a Wi-Fi data connection, considering that the mobile phone only connects to the cellular network for network communication, if the mobile phone uses the method of the embodiment of this application to control the cellular network, the cellular connection between the mobile phone and the base station will be disconnected due to the change in the state of the application that applied for cellular access (i.e., switching from active state to frozen state), which is not conducive to the user's use of the cellular network. Therefore, the mobile phone does not perform cellular network control, and the process ends directly.
[0187] For example, the connectivity service module can store Wi-Fi status values, including those indicating whether a Wi-Fi data connection exists between the phone and the router. These values may include status values indicating a Wi-Fi connection and status values indicating a Wi-Fi disconnection. The connectivity service module can then determine whether the phone has a Wi-Fi data connection by querying the stored Wi-Fi status values.
[0188] Of course, the methods by which the connection service module determines whether a mobile phone has a Wi-Fi data connection are not limited to the examples mentioned above, and may also include other known methods.
[0189] If the connection service module determines that the mobile phone has a Wi-Fi data connection, for example, if the mobile phone is connected to the home router and can access the Internet wirelessly, then the connection service module can proceed to execute S101 when application 1 switches from active state to frozen state; otherwise, it will terminate directly.
[0190] The connection service module can obtain information from the power consumption control module regarding the switching of application 1 from an active state to a frozen state. Furthermore, the connection service module can obtain various state information about the application from the power consumption control module.
[0191] For example, after the power consumption control module detects that application 1 has switched from running in the foreground to running in the background, application 1 can either continue running in the background or cease generating any action and application data, thus remaining in a frozen state. In this example, if the power consumption control module detects that application 1 has switched from the foreground to the background and has not generated any application data within a predetermined period of time (e.g., 30 seconds, which can be set according to actual needs and is not limited in this application), then it can determine that application 1 has switched from the active state to the frozen state. Of course, the way to determine whether an application has switched from the active state to the frozen state is not limited to this example.
[0192] Once the power control module detects that application 1 has switched from the active state to the frozen state, it can notify the connection service module of the state change of application 1.
[0193] The process of switching from an active to a frozen state for cellular applications. Figure 9 This is a schematic diagram illustrating an application scenario.
[0194] Reference Figure 9 (1) The mobile phone displays the news interface 501 of the browser application. The news interface 501 includes one or more controls. The implementation of the controls may include, but is not limited to, icons, buttons, windows, layers, etc.
[0195] like Figure 9As shown in (1), the controls in the news interface 501 include, but are not limited to, the network icon 502, the battery icon, and the time icon.
[0196] exist Figure 9 In the phone's system settings, both the Wi-Fi network switch and the 5G cellular network switch are turned on. Accordingly, network icon 502 can include 5G cellular network icon 5021 and Wi-Fi network icon 5022. Optionally, if the Wi-Fi network switch is turned off, Wi-Fi network icon 5022 will no longer be displayed in network icon 502; alternatively, if the 5G cellular network switch is turned off, 5G cellular network icon 5021 will no longer be displayed in network icon 502.
[0197] In other embodiments, the cellular network indicated by the cellular network icon may also be a 2G, 3G, 4G cellular network, or a cellular network of a level higher than 5G, and this application does not limit this.
[0198] In this application embodiment, for example, if a video application uses a Wi-Fi network for data communication, then in Figure 9 In (1), the Wi-Fi network icon 5022 includes the uplink / downlink identifier 50221 for Wi-Fi data; while the browser application, during its operation in the foreground of the mobile phone, requests and uses the cellular network due to business needs, thus establishing a cellular connection between the mobile phone and the 5G base station. Therefore, the 5G cellular network icon 5021 also includes the uplink / downlink identifier 50211 for the 5G cellular network. Of course, in other embodiments, both the uplink / downlink identifier 50211 for the 5G cellular network and the uplink / downlink identifier 50221 for the Wi-Fi network can be replaced with an uplink identifier or a downlink identifier.
[0199] The uplink identifier is used to indicate network data uploaded from the mobile phone to the application server, the downlink identifier is used to indicate network data downloaded from the application server to the mobile phone, and the uplink and downlink identifiers are used to identify the interaction of network data between the mobile phone and the application server.
[0200] exist Figure 9 In (1), the user can swipe up on the news interface 501 from the bottom edge in the direction of the arrow. The phone can receive this swipe operation and, in response, switch the phone's display interface from the news interface 501 to [the other interface]. Figure 9 (2) The program interface 503 is shown.
[0201] The program interface 503 may include one or more controls, and the specific implementation of the controls may include, but is not limited to, icons, buttons, windows, layers, etc.
[0202] The program interface 503 includes, but is not limited to: thumbnails 504 of the news interface 501 of a browser application and thumbnails 506 of the communication interface of an information application. Of course, the applications in the program interface 503 are not limited to the two examples given here, and may include more applications; a delete icon 505 displayed below each thumbnail in the program interface 503; application icons and application names displayed above the thumbnails, for example, the application name corresponding to thumbnail 504 is "Browser," and the application name corresponding to thumbnail 506 is "Information"; a floating window control 507 displayed above the thumbnails; and a network icon 502, a battery icon, and a time icon. For explanations of the network icon 502 and its internal icons, as well as the battery icon and time icon, please refer to... Figure 9 The description of (1) will not be repeated here.
[0203] like Figure 9 (2) As shown, the delete icon 505 displayed below the thumbnail 504 is used to close the processes of all running applications in the program interface 503 in response to user operation.
[0204] The floating window control 507 above the browser application thumbnail 504 is used to display the browser application's news interface 501 in the floating window in response to user operation.
[0205] Continue to refer to Figure 9 (2) In the program interface 503, if the user taps the thumbnail 506 of the messaging application's communication interface, the phone can respond to this tap by switching the messaging application from a background application to a foreground application, while the browser application switches from a foreground application to a background application. The phone's display interface changes from the program interface 503 to the thumbnail 506. Figure 9 (3) shows the communication interface 508 of the information application.
[0206] Background applications can be active by generating application data, such as a video application downloading a video; background applications can also be in a frozen state without generating any data streams, such as in... Figure 9 In (3), the browser application switches from a foreground application to a background application.
[0207] For example, the communication interface 508 may include one or more controls, and the specific implementation of the controls may include, but is not limited to, icons, buttons, windows, layers, etc.
[0208] The communication interface 508 includes, but is not limited to, a network icon 502, a battery icon, and a time icon. For explanations of the network icon 502 and its internal icons, as well as the battery and time icons, please refer to [link to relevant documentation]. Figure 9 The description of (1) will not be repeated here.
[0209] For example, a browser application, when running in the background, may not immediately switch from an active state to a frozen state. Figure 9 (1) Figure 9 (2) Figure 9 (3) It can be seen that the 5G cellular network icon 5021 still displays the uplink / downlink identifier 50211. For example, in a browser application... Figure 9 (1) is used as a foreground application in Figure 9 (3) After switching to a background application, if the power consumption control module detects that the browser application has entered the background (i.e., from the display), Figure 5b (3) If there is no action or data generated within 30 seconds after the communication interface 508 starts, the connection service module can determine that the browser application has switched from active state to frozen state.
[0210] Continue to refer to Figure 3b The flowchart illustrates that after application 1 switches from the active state to the frozen state, the method continues to include:
[0211] S101, The connection service module determines whether application 1 has applied for a cellular network;
[0212] Optionally, after application 1 switches from active to frozen state, the connection service module can also determine whether application 1 is a third-party application.
[0213] If application 1 is a third-party application and has applied for cellular network access, proceed to S102.
[0214] For example, the connection service module can determine whether application 1 is a third-party application based on a preset application list or based on the application's system-level application type identifier.
[0215] For example, the preset application list may include package name information of third-party applications or package name information of system applications, so that by comparing the package name of application 1 with the package name in the preset application list, it can be determined whether application 1 is a third-party application;
[0216] For example, third-party applications may also have the application type identifier described above, which is used to identify whether the application is a third-party application.
[0217] For example, pre-installed apps that cannot be deleted can be designated as system apps, while apps other than system apps can be designated as third-party apps.
[0218] For example, the connection service module can determine whether application 1 is a third-party application by obtaining the application type identifier of application 1.
[0219] For the connection service module to determine whether application 1 has applied for a cellular network, refer to the following... Figure 5b As can be seen from the process of application 1 applying for cellular data, after application 1 applies for cellular data with the connection service module, the connection service module can save application 1's first cellular request to a first data structure. The connection service module can then determine whether application 1 has applied for cellular data by querying whether application 1's first cellular request exists in the first data structure. If application 1's first cellular request exists in the first data structure, the connection service module determines that application 1 has applied for cellular network access; conversely, if application 1's first cellular request does not exist in the first data structure, the connection service module determines that application 1 has not applied for cellular network access.
[0220] Since each application's cellular request has a unique request sequence number, and different applications have different request sequence numbers, the connection service module can determine the cellular request initiated by application 1 based on the cellular request sequence number stored in the first data structure.
[0221] Optionally, in one implementation, if the connection service module determines that application 1 is not a third-party application, such as a system application, or that application 1 has not applied for a cellular network, or that application 1 is a system application and has not applied for a cellular network, then the process is directly switched to application 1 being in a frozen state, that is, the processing of the method in this application embodiment is not required.
[0222] In this embodiment, the connection service module will only reclaim the cellular network requested by a third-party application (non-system application) and disconnect the cellular connection if the application actively requests it for communication. This prevents other applications that have not requested cellular access from using the network and causing power consumption. Considering system applications, which deal with system-level business, this business is more critical. After a system application requests cellular access, the connection service module may not need to manage the reclamation or disconnection of the cellular connection. Specifically, the connection service module's handling of cellular connection reclamation may include deleting the cellular request from the original first data structure.
[0223] Alternatively, in another implementation, if the connection service module determines that application 1 is not only a third-party application, but also has applied for a cellular network, then proceed to execution S102;
[0224] Alternatively, in another implementation, the connection service module may not determine whether application 1 is a third-party application. In other words, regardless of whether application 1 is a third-party application, as long as the application has requested a cellular network in the active state before switching from the active state to the frozen state, the method of this application embodiment can reclaim the application's cellular requests and manage the disconnection of cellular connections.
[0225] Optionally, in S102, the connection service module backs up the first cellular request of application 1 from the original first data structure to the second data structure;
[0226] For example, the second data structure can be a linked list. The connection service module can back up the first cellular request from the original linked list to another linked list.
[0227] When application 1 requests cellular space from the connection service module while in an active state, the connection service module can save the first cellular request of application 1 to the original first data structure; then after application 1 switches from an active state to a frozen state, the connection service module can back up the first cellular request from the first data structure to the second data structure.
[0228] The purpose of the connectivity service module backing up the first cellular request to the second data structure is so that, after application 1 switches from a frozen state to an active state, the connectivity service module can use the backed-up first cellular request to restore the reclaimed cellular request and re-establish the disconnected cellular connection between the mobile phone and the base station. The connectivity service module's process for restoring the cellular connection may include: the connectivity service module rewriting the cellular request that was deleted from the original first data structure into the first data structure.
[0229] For example, the first data structure and the second data structure can be data structures of the same type or data structures of different types.
[0230] As mentioned above, data structures can include, but are not limited to: linked lists, arrays, vectors, XML files, variables, key-value pairs, queues, stacks, trees, heaps, hash tables, etc.
[0231] In one example, the first data structure and the second data structure are of different types; for example, the first data structure could be a linked list, and the second data structure could be a queue.
[0232] In another example, the first data structure and the second data structure are of the same type; for example, the first data structure could be a linked list, and the second data structure could be another linked list.
[0233] When an application actively requests cellular data, the connectivity service module can store the application's cellular request in a first data structure. A cellular connection will only be established between the phone and the base station if a cellular request is present in the first data structure; conversely, if no cellular request is present in the first data structure, the cellular connection between the phone and the base station needs to be disconnected.
[0234] Optionally, in step S103, the connection service module removes the first cellular request from the original first data structure;
[0235] In order to free up the cellular network, the connection service module can remove the first cellular request of application 1 from the first data structure.
[0236] Optionally, the first data structure in the connection service module may include one or more data structures.
[0237] Among them, the types of multiple first data structures can be the same or different.
[0238] For example, the first data structure can be a linked list. If multiple first data structures are of the same type, then the first cellular request can be stored in one or more linked lists.
[0239] For example, the multiple first data structures may include, but are not limited to: a first linked list in the connection service module, a nai (also a linked list) corresponding to the first cellular request, and a networkFactory (a linked list).
[0240] When the connection service module deletes the first cellular request from the original first data structure, it can delete the information about the first cellular request stored in the original multiple linked lists. For example, the connection service module can delete the first cellular request from the first linked list, remove the nai corresponding to the first cellular request from the second linked list, and remove the networkFactory containing the first cellular request from the third linked list.
[0241] S104, The connection service module determines whether the first cellular request is the last cellular request;
[0242] In different scenarios, one or more applications may actively request cellular access to the cellular network. When multiple applications actively request cellular access, each application can send its cellular request to the connection service module upon requesting cellular access, allowing the connection service module's first data structure to store multiple applications' cellular requests. Considering that in scenarios with multiple applications requesting cellular access, the cellular connection between the phone and the base station cannot be directly disconnected simply because a single application switches from an active state to a dormant state, the connection service module can perform the S104 judgment step before disconnecting the cellular connection.
[0243] For example, the connection service module can determine whether a cellular request exists in the first data structure by querying the first data structure. If no cellular request exists in the first data structure, the connection service module can determine that the first cellular request is the last cellular request; in other words, all applications that actively requested cellular networks have switched from active to frozen state. If at least one cellular request is found in the first data structure, the connection service module can determine that the first cellular request is not the last cellular request; in other words, there are other applications besides application 1 that have requested cellular networks in the active state and used cellular networks to interact with the application server, and these other applications are still in the active state.
[0244] Optionally, if there are multiple first data structures, the connection service module needs to traverse each first data structure to determine whether there is no cellular request in any of the first data structures. If there is no cellular request in any of the multiple first data structures, then the first cellular request is determined to be the last cellular request.
[0245] If the connectivity service module determines that the first cellular request is the last cellular request, meaning that all applications requesting cellular access have switched from active to frozen state, the connectivity service module can instruct the modem to shut down the cellular network, in other words, disconnect the cellular connection between the modem and the base station.
[0246] If the connection service module determines that there are other cellular requests in the first data structure besides the first cellular request, that is, not all applications applying for cellular networks are in a frozen state, then it directly enters the case that application 1 is in a frozen state, and this application will not be processed again.
[0247] In this embodiment, after all cellular applications have been frozen, the connection service module can disconnect the cellular connection between the mobile phone and the base station. This ensures that freezing some cellular applications does not affect the use of the cellular network by other active cellular applications that have applied for cellular access.
[0248] In this embodiment, if the connection service module determines that the first cellular request is the last cellular request, then S106 is executed;
[0249] Additionally, it should be noted that when multiple applications actively request cellular connectivity, a cellular path is established between the modem and the base station after the first application requests cellular connectivity. When other applications (such as application 3) subsequently request cellular connectivity from the connectivity service module, the connectivity service module does not need to instruct the modem to establish a cellular connection with the base station again. The connectivity service module can connect the network path used by application 3 to the established cellular path, enabling application 3 to use the cellular network to interact with the application server.
[0250] Optionally, in most scenarios, when most applications need to use the cellular network, if the application determines that the cellular path between the mobile phone and the base station has been opened, it will directly use the cellular path instead of actively requesting the cellular network from the connectivity service module. Accordingly, the number of applications that actively request the cellular network is generally no more than 3.
[0251] Optionally, prior to S106, the method according to the embodiments of this application may further include S105.
[0252] S105, The connection service module determines whether the network meets the first preset condition;
[0253] In this process, if the connection service module determines that the first cellular request is the last cellular request, before instructing the modem to disconnect the cellular connection with the base station, the connection service module may perform the network assessment represented in this step. Only if the network assessment meets the conditions will the connection service module execute S106; otherwise, it will directly jump to the application 1 being in a frozen state, and this application will not process it further.
[0254] When performing network evaluation, the connection service module here may evaluate the following, including but not limited to at least one of the following:
[0255] Evaluation Item 1: The connectivity service module determines whether the mobile network can switch from dual-connection (Wi-Fi and cellular) to single-connection (Wi-Fi). Considering that switching from dual-connection to single-connection might result in network switching failures, it is necessary to evaluate whether a normal network switching can be performed.
[0256] Evaluation Item 2: The connection service module determines whether a single Wi-Fi connection is available.
[0257] For example, the Wi-Fi signal quality might be extremely poor, preventing the phone from using the Wi-Fi connection for data communication. In other words, although the phone may be connected to a local area network's Wi-Fi, the Wi-Fi network itself might be unavailable, rendering the phone's Wi-Fi connection unusable.
[0258] For example, although the phone is connected to the Wi-Fi network when application 1 switches from active to frozen state, the connection service module may be executing... Figure 9 During the process, the Wi-Fi data switch in the system settings was turned off by the user, resulting in the Wi-Fi connection becoming unavailable.
[0259] Therefore, the connection service module will only execute S106 if it evaluates that the network can normally switch from dual connection to single connection and that single connection is available.
[0260] In this embodiment, before instructing the modem to disconnect the cellular connection between the mobile phone and the base station, the connection service module can perform a network assessment. Only if the network assessment shows that the network meets a first preset condition will the connection service module instruct the modem to disconnect the cellular connection with the base station. This ensures that when the mobile phone switches from dual Wi-Fi and cellular connectivity to Wi-Fi single connectivity, disconnecting the cellular connection will not affect communication on the Wi-Fi path, and the mobile phone can still use the Wi-Fi path for internet communication, guaranteeing that the mobile phone's internet access under Wi-Fi is not affected by the disconnection of the cellular connection.
[0261] S106, The connectivity service module instructs the modem to disconnect the cellular connection;
[0262] For example, the connectivity service module can call `rematch` to perform this step. `rematch` sends a command to the modem indicating that the cellular connection is disconnected.
[0263] In this way, after receiving the above command from the connection service module, the modem can turn off the cellular-related radio frequency, thereby disconnecting the cellular connection between the phone's modem and the base station.
[0264] After S106, the process transitions to application 1 being in a frozen state and ends.
[0265] For example, let's continue back to... Figure 9 Refer to in turn Figure 9 (1) Figure 9 (2) Figure 9 (3) Displayed when the browser application switches from the foreground application to the background application. Figure 5b (3) After the interface appears, if the browser application does not perform any operation within a predetermined time period (e.g., 30 seconds), it indicates that the browser application has entered a frozen state from an active state, thus executing...Figure 9 The process is shown below. From the user's perspective, it is displayed on the mobile phone. Figure 9 After the interface of (3) is displayed, it will switch to the interface after a period of time (e.g., 30 seconds). Figure 9 (4) The interface shown is compared with Figure 9 (3) and Figure 9 (4) It can be observed that when a browser application actively requests cellular network access switches from active to frozen state, the aforementioned modem disconnects from the base station. Therefore, there is no longer any 5G cellular data interaction between the mobile phone and the base station. Figure 5b (4) It can be seen that the uplink and downlink identifier 50211 in the 5G cellular network icon 5021 is no longer displayed.
[0266] Considering that in scenarios where Wi-Fi is enabled, if an application also connects to the cellular network, the cellular network will consume resources, leading to a significant increase in battery consumption due to the application's use of cellular connections. Therefore, to reduce unnecessary applications using the cellular network in dual-network concurrent scenarios and thus mitigate the increased power consumption caused by application cellular network usage, this embodiment of the application reclaims the cellular request of an application that actively requests cellular network access and disconnects the cellular connection between the phone and the base station after the application is frozen. This prevents other applications that have not requested cellular access from continuing to use the cellular connection, thereby saving power consumption caused by application cellular network usage and achieving the effect of saving phone battery power.
[0267] It should be noted that this application is for Figure 5b The execution order of S102 and S104 is not restricted.
[0268] In one possible implementation, the following can be adopted: Figure 11 The illustrated cellular network control method is used to control the cellular network of a mobile phone. Figure 5b The process shown as an example Figure 4 The diagram illustrates the cellular status and application status after cellular network control is performed using the method shown.
[0269] To make it easier to understand, we can compare it with Figure 11 Let's take a look. Figure 11 ,and Figure 4 and Figure 4 For similarities, you can refer directly. Figure 11 The description will not be elaborated further below. The following section introduces... Figure 11 Changes in cellular status and application status.
[0270] exist Figure 5b In this implementation, only one application (i.e., application 1) actively requests the cellular network during the time period t0 to t3.
[0271] During the time period t0 to t1, both application 1 and application 2 are active, such as running in the foreground or background. If application 1 and application 2 use the network to interact with their respective application servers, they can use the Wi-Fi channel for data communication during the time period t0 to t1. Therefore, during the time period t0 to t1, the cellular status is disconnected.
[0272] At time t1, application 1 requests a cellular connection, causing the cellular to be in a connected state at time t1. Therefore, application 1 can use the actively requested cellular channel for data communication starting at time t1.
[0273] At time t2, application 2 begins using the cellular connection requested by application 1 for data communication. Specifically, at time t2, application 2, which originally used Wi-Fi for data communication, begins using the established cellular connection between the modem and the base station to communicate with its application server without requesting a cellular connection. From time t2 onwards, application 2 can continuously use the cellular connection established by application 1 for data communication until application 1 switches from an active state to a frozen state.
[0274] At time t3, application 1 switches from an active state to a frozen state; for example, application 1 switches from running in the foreground to running in the background, and after running in the background for a period of time, more than 30 seconds pass without generating any application data. Then, refer to... Figure 11 As can be seen from the process, in this embodiment, the first cellular request of application 1 is the last cellular request. The connection service module can not only delete the first cellular request of application 1 from the original first data structure to achieve the purpose of reclaiming the cellular request, but also control the modem to disconnect the cellular connection with the base station. Correspondingly, in Figure 5b In this implementation, starting from time t3, the cellular connection is disconnected. Since the cellular path between the phone and the base station is broken, application 2 can only use the cellular path requested by application 1 for data communication during the time period t2 to t3. It cannot continue to use the cellular path for data communication after application 1 switches to a frozen state at time t3. If application 2 needs to use the network at time t3, it can use the Wi-Fi network to interact with its application server. In this embodiment, the phone can disconnect its cellular connection when application 1 switches from active to frozen state, avoiding power consumption caused by other applications that have not requested cellular access continuing to use the cellular connection, thus generating power savings.
[0275] In another possible implementation, it can be adopted Figure 12The illustrated cellular network control method is used to control the cellular network of a mobile phone. Figure 5b The process shown as an example Figure 4 The diagram illustrates the cellular status and application status after cellular network control is performed using the method shown.
[0276] To make it easier to understand, we can compare it with Figure 11 , Figure 12 Let's take a look Figure 12 The following is a detailed introduction. Figure 4 Changes in cellular status and application status.
[0277] First, it is different from Figure 11 and Figure 12 The implementation method, in Figure 11 In this context, Application 1 is not only considered as an application that actively requests cellular data, but Application 2 is also considered as an application that actively requests cellular data, while Application 3 is an application that uses the cellular network requested by other applications without requesting cellular data.
[0278] Secondly, in Figure 12 In the process, before application 1 was frozen (frozen at time t3), only one application (i.e., application 1) actively requested the cellular network. Figure 12 In this implementation, before application 1 is frozen (frozen at time t4), two applications (application 1 and application 2) actively request the cellular network.
[0279] The following is a detailed introduction. Figure 5b The process:
[0280] During the time period t0 to t1, applications 1, 2, and 3 are all active, for example, applications 1 and 2 are running in the foreground and application 3 is running in the background. If applications 1, 2, and 3 use the network, they can use Wi-Fi to communicate during the time period t0 to t1. Therefore, during the time period t0 to t1, the phone's cellular status is disconnected.
[0281] At time t1, application 1 requests cellular access, causing the phone's cellular status to be in cellular connection mode from time t1 onwards. Application 1 then uses the actively requested cellular access channel for data communication starting at time t1.
[0282] At time t2, application 2 requests a cellular connection. Since application 1 had already requested a cellular connection before time t2, a cellular connection is established between the modem and the base station. Furthermore, after application 2 requests a cellular connection at time t2, application 2 can reuse the cellular connection established between the modem and the base station due to application 1's cellular request for data communication.
[0283] At time t3, application 3 begins to use the aforementioned cellular connection for data communication;
[0284] At time t4, application 1 switches from active to frozen state, then the phone follows... Figure 5b During the processing of the process, since the phone also received a cellular request from application 2, it can determine that application 1's cellular request (i.e., the first cellular request) is not the last cellular request. Therefore, at time t4, the phone will not disconnect the cellular connection between the modem and the base station, but will only reclaim the first cellular request. Thus, application 3 can continue to use the cellular channel for data communication after time t4; while application 1 uses the cellular channel for data communication from time t1 when it requested cellular access until time t4 when it switches to a frozen state.
[0285] At time t5, application 2 switches from active to frozen state, then the phone follows... Figure 12 During the processing of the cellular data, since both Application 1 and Application 2, which actively requested cellular data, switched from active to frozen state during the time period t0 to t5, the phone can determine that Application 2's second cellular request is the last cellular request that has not yet been reclaimed. At time t5, the phone can disconnect the cellular connection between the modem and the base station. Specifically, the phone's cellular state is connected during the time period t1 to t5, but after time t5, the phone's cellular state is disconnected.
[0286] Starting from time t5, the phone's cellular status is set to cellular disconnected, meaning the cellular path between the phone and the base station is broken. Figure 11 It can be seen that application 3 uses the cellular network for data communication during the time period t3 to t5. After time t5, application 3 can no longer use the cellular network for data communication; application 2 uses the cellular network for data communication during the time period t2 to t5. The phone begins to generate power consumption gains at time t5 when application 2 switches from active to frozen state, until either application 1 or application 2 recovers from frozen state to active state.
[0287] It should be noted that, for Figure 4 and Figure 11 Similarities or resemblances Figure 4 You can refer to this. Figure 12 Similarly, for the explanation, Figure 4 and Figure 12 Similarities or resemblances Figure 4 You can refer to this. Figure 5b The explanation will not be repeated here.
[0288] In another embodiment, inFigure 6 Then, continue to refer to Figure 6 The flowchart of the cellular network control method of this embodiment of the invention shown is illustrated below. Figure 5b ,exist Figure 6 After the process, when application 1 switches from frozen state to active state, it can then execute... Figure 6 The process is shown below.
[0289] An application can enter the active state in several ways, including restarting the application process after it has been closed, or re-entering the foreground or background after being frozen in the background. Therefore, this embodiment of the invention... Figure 10 The process shown mainly involves restoring cellular connectivity and opening cellular pathways for applications switching from a frozen state to an active state.
[0290] For example, the power control module can obtain the status information of application 1. After application 1 switches from a frozen state to an active state, the power control module can notify the connection service module of the status change of application 1.
[0291] For example, if the power control module detects that application 1 has not interacted with other modules in the background for more than 30 seconds, and then detects that application 1 has switched to running in the foreground, it can determine that application 1 has switched from a frozen state to an active state.
[0292] For example, the process of an application requesting cellular data switching from a frozen state to an active state. Figure 9 This is an illustrative diagram of an application scenario. Figure 9 As can be seen from the application scenarios, browser applications are used in Figure 10 (4) It is then in a frozen state. Figure 10 middle, Figure 9 (1) To connect Figure 10 (4) Schematic diagram.
[0293] Reference Figure 9 (1) The mobile phone displays the communication interface 508 of the messaging application. For details on the controls included in the communication interface 508, please refer to [link / reference]. Figure 10 The description of (4) will not be repeated here.
[0294] exist Figure 10 In (1), the user slides upwards on the communication interface 508 from the bottom edge in the direction of the arrow. The phone receives this slide and, in response, switches the phone's display interface from the communication interface 508 to [other interface]. Figure 11 (2) The program interface 509 is shown.
[0295] The program interface 509 may include one or more controls, and the specific implementation of the controls may include, but is not limited to, icons, buttons, windows, layers, etc.
[0296] The program interface 509 includes, but is not limited to: thumbnails 510 of the communication interface of the information application and thumbnails 511 of the news interface of the browser application. Of course, the applications in the program interface 509 are not limited to the two examples given here, and may include more applications; a delete icon 505 displayed below each thumbnail in the program interface 509; and an application icon and application name displayed above the thumbnails. For example, the application name corresponding to thumbnail 510 is "Information," and the thumbnail... Figure 10 The corresponding application name is Browser; the floating window control 507 displayed above the thumbnail; and the network icon 502, battery icon, and time icon. For an explanation of the network icon 502 and its internal icons, battery icon, and time icon, please refer to... Figure 10 The description of (1) will not be repeated here.
[0297] like Figure 10 As shown in (2), the delete icon 505 displayed below the thumbnail 510 is used to close the processes of all running applications in the program interface 503 in response to user operation.
[0298] The floating window control 507 above the thumbnail of the information application 510 is used to display the display interface of the information application (here, the communication interface) in the floating window in response to user operation.
[0299] from Figure 10 (1) and Figure 10 (2) It can be seen that since the browser application requesting cellular data is in a frozen state, for example, the browser application is a background application and does not generate any action, the mobile phone, by executing the process of the method in the embodiment of Figure 5, disconnects the cellular connection between the mobile phone and the base station. Figure 10 (1) and Figure 10 (2) In the 5G cellular network icon 5021, there is no uplink / downlink identifier 50211.
[0300] Continue to refer to Figure 10 (2) In the program interface 509, if the user taps the thumbnail 511 of the news interface of the browser application, the phone can respond to the tapping operation by switching the browser application from a frozen state where it does not generate any data in the background to a foreground running state (i.e., an active state). The phone's display interface also switches from the program interface 509 to the current state. Figure 6 (3) shows the news interface 501 of the browser application.
[0301] After the browser application switches from a frozen state to an active state, the connection service module on the phone can execute... Figure 6 The illustrated process instructs the modem to establish a cellular connection with the base station. After the modem activates cellular-related radio frequencies, the cellular path between the mobile phone and the base station is opened. The mobile phone then executes... Figure 10 The process shown is executed very quickly; from the user's perspective, it is very fast. Figure 10 (2) Switch to Figure 10 (3) After that, the user can see the displayed Figure 10 (3) You can see directly that the 5G cellular network icon 5021 already displays the uplink and downlink identifier 50211. The uplink and downlink identifier 50211 can indicate that the mobile phone and the base station are exchanging 5G cellular data through the cellular connection established between them.
[0302] about Figure 9 (3) Refer to the specific controls included in the news interface 501. Figure 10 (1) A description of the control is sufficient; it will not be elaborated here.
[0303] In application 1 (in) Figure 6 In the example, after application 1 (a browser application) switches from frozen to active state, it continues to refer to... Figure 5b The mobile phone's connection service module can execute S201;
[0304] S201, The connection service module determines whether application 1 has backed up cellular requests;
[0305] Optionally, after application 1 switches from a frozen state to an active state, the connection service module can also determine whether application 1 is a third-party application.
[0306] The specific method by which the connection service module determines whether application 1 is a third-party application can be found in [reference needed]. Figure 5b The specific details are omitted here.
[0307] Regarding the specific method by which the connection service module determines whether it has backed up the cellular request of application 1, the connection service module can achieve this by querying whether the cellular request of application 1 exists in the second data structure. If the connection service module determines that the first cellular request of application 1 exists in the second data structure, it means that the connection service module has backed up the cellular request of application 1. If the first cellular request of application 1 does not exist in the second data structure of the connection service module, it means that the connection service module has not backed up the cellular request of application 1.
[0308] Optionally, in one implementation, if application 1 is a third-party application and the connection service module has backed up the cellular requests of application 1, then the connection service module executes S202; otherwise, it directly switches to the state where application 1 is active and ends the process.
[0309] Alternatively, in another implementation, if the connection service module has backed up the cellular requests of application 1, then the connection service module executes S202; otherwise, it directly switches to the state where application 1 is active and ends the process.
[0310] S202, The connection service module writes the backed-up first cellular request into the original first data structure;
[0311] Among them, reference Figure 6 As can be seen from the process, since the first cellular request written by application 1 to the first data structure when applying for cellular space has been deleted after application 1 switches from active state to frozen state, the connection service module can use the backup of the first cellular request in the second data structure to rewrite the first cellular request into the first data structure to restore the cellular request after application 1 recovers from frozen state to active state.
[0312] Optionally, S203, the connection service module deletes the first cellular request for backup;
[0313] The connection service module can delete the backup of the cellular requests for application 1, i.e., the first cellular requests, in the second data structure to save storage space.
[0314] Optionally, in S204, the connection service module determines whether the cellular network is in a connected state;
[0315] For example, the connectivity service module can store the cellular status value. A status value of 1 indicates that the cellular status is connected, while a status value of 0 indicates that the cellular status is disconnected (i.e., not connected). The connectivity service module can determine whether the cellular is currently connected by querying this status value.
[0316] The connectivity service module can obtain cellular status values from the modem. Specifically, when the modem activates its cellular-related radio frequency, establishing a cellular connection with the base station, the modem can report information indicating a connected cellular status to the connectivity service module. Similarly, when the modem deactivates its cellular-related radio frequency, disconnecting the cellular connection, the modem can report information indicating a disconnected cellular status to the connectivity service module. Furthermore, the modem can report the latest cellular status to the connectivity service module whenever the cellular status changes, allowing the connectivity service module to store the cellular status values.
[0317] In one possible implementation, when the connection service module determines that the cellular status is cellular connected, it means that after application 1 is frozen, there are other applications that actively request cellular access, which opens the cellular path between the modem and the base station, and the cellular status is cellular connected. In this case, the connection service module does not need to instruct the modem to establish a cellular connection with the base station.
[0318] In another possible implementation, when the connection service module determines that the cellular status is disconnected (i.e., not connected), it means that the cellular connection is still disconnected after the application 1 is frozen and has not been reconnected. Then the connection service module can execute S206 to instruct the modem to establish a cellular connection.
[0319] Optionally, after the connectivity service module determines that the cellular status is disconnected, and before S206, the connectivity service module may perform S205 to conduct a network assessment.
[0320] Optionally, in step S205, the connection service module determines whether the network meets the second preset condition;
[0321] For example, a network assessment can be performed before establishing a cellular connection between the modem and the base station. If the network assessment meets the requirements, the connection service module can execute S206; otherwise, it will directly jump to the point where application 1 is active, and this application will not perform any further processing and will end directly.
[0322] When performing network evaluation, the connection service module here may include, but is not limited to, at least one of the following:
[0323] The connectivity service module determines whether the network can switch from single cellular connectivity to dual Wi-Fi and cellular connectivity. Since there may be situations where the network cannot switch normally when switching from single connectivity to dual connectivity, it is necessary to assess whether a normal network switch can be performed.
[0324] For example, if the connection service module determines that the phone's network cannot switch from single cellular connection to dual Wi-Fi and cellular connection, then it determines that the network does not meet the second preset condition.
[0325] The connection service module determines whether the cellular switch in the system settings is turned on.
[0326] For example, if a user sets the cellular switch in their phone settings to off, then the network does not meet the second preset condition.
[0327] The connection service module determines whether the phone's data network is available.
[0328] For example, if the mobile phone's data network becomes unavailable due to reasons such as unpaid bills or service suspension, the connection service module will determine that the network does not meet the second preset condition.
[0329] In this embodiment, before establishing a cellular connection between the mobile phone and the base station, the connection service module can perform a network assessment. If the network assessment meets the second preset conditions, such as the connection service module determining that the mobile phone's network can switch from single cellular connection to dual Wi-Fi and cellular connection, and the cellular switch in the system settings is on, and the mobile phone's data network is available, then the connection service module can instruct the modem to establish a cellular connection between the modem and the base station so that the cellular connection can be established normally. When the mobile phone switches from single Wi-Fi connection to dual Wi-Fi and cellular connection, establishing a cellular connection will not affect the communication of the Wi-Fi path, and the mobile phone can continue to use the Wi-Fi path for network communication, ensuring that the mobile phone's internet access under Wi-Fi is not affected by the establishment of a cellular connection.
[0330] S206, The connectivity service module instructs the modem to establish a cellular connection;
[0331] For example, the connectivity service module can call `rematch` to implement this step. `rematch` sends a command to the modem indicating the establishment of a cellular connection. After receiving the command from the connectivity service module, the modem can activate the cellular-related radio frequency to establish a cellular connection between the phone's modem and the base station, thus initiating data communication via the cellular path between the phone and the base station.
[0332] After S206, the process transitions to application 1 being active and ends.
[0333] In this embodiment, after an application switches from an active state to a frozen state, the mobile phone can promptly reclaim the application's cellular requests. When all applications that have requested cellular access have switched from an active state to a frozen state, the mobile phone can close the cellular path with the base station to reduce power consumption caused by the application's use of the cellular path. After an application that has requested cellular access returns to an active state from a frozen state, the mobile phone can release the cellular requests reclaimed by that application. And when the cellular connection is not active, the mobile phone can re-establish the cellular connection with the base station to ensure that applications that have actively requested cellular access can continue to use the cellular network.
[0334] In one possible implementation, the following can be adopted: Figure 13 The illustrated cellular network control method is used to control the cellular network of a mobile phone. Figure 6 The process shown as an example Figure 11 The diagram illustrates the cellular status and application status after cellular network control is performed using the method shown.
[0335] To make it easier to understand, we can compare it with Figure 13 Let's take a look. Figure 11 ,and Figure 13 and Figure 13 Similarities and analogies exist in principle, which will not be elaborated upon further below. For example, in Figure 11 In the implementation method, the changes in application status and cellular status during the time period t0 to t3 are related to... Figure 11 Same, refer to the information about Figure 13 That's all for the introduction.
[0336] from Figure 6 It can be seen that application 1 switches from active state to frozen state at time t3, for example, application 1 switches from running in the foreground to running in the background and no longer generates application data; then, application 1 switches from frozen state to active state at time t4, for example, application 1 switches from not generating application data in the background to generating application data in the background.
[0337] Reference Figure 3a As shown in the flowchart, after application 1 switches from frozen state to active state at time t4, the mobile phone can reconnect to the cellular connection that was disconnected from the base station before time t4. For example, the connection service module can instruct the modem to establish a cellular connection with the base station. Then, after time t4, the cellular connection between the modem and the base station is re-established, and from time t4 onwards, the mobile phone's cellular state is cellular connected state.
[0338] Refer to the above text Figure 3b , Figure 4 and Figure 7As described above, Application 2 can monitor whether the Modem has established a cellular connection with the base station through the connection service module. Therefore, after the cellular connection between the Modem and the base station is established at time t4, Application 2 can continue to use the cellular connection for cellular data communication.
[0339] In this embodiment, from time t3 when application 1 switches from active to frozen state to time t4 when application 1 switches back to active state, the connection service module sets the cellular path between the mobile phone and the base station to a disconnected state, which can enable the mobile phone to generate power consumption benefits during the time period t3 to t4.
[0340] In another embodiment, refer to Figure 7 The flowchart of the cellular network control method of this embodiment of the invention shown is illustrated below. Figure 5b ,exist Figure 7 After the process, with application 1 closed, the phone can then execute... Figure 9 The process is shown below.
[0341] Application closure (also known as application being closed) indicates that the application process is in a closed state. Application closure can be triggered by the user, such as when the user actively closes the foreground or background application; or it can be triggered by the system, such as when the system automatically closes the process because it is unresponsive.
[0342] In addition, the state of an application before it is closed can be either active or frozen.
[0343] For example, after detecting that application 1 is in a closed state, the power control module can notify the connection service module of this status information; the connection service module can obtain the status information of application 1 from the power control module.
[0344] With application 1 closed, the connection service module can execute S301;
[0345] S301, The connection service module determines whether application 1 was in a frozen state before it was closed;
[0346] The connection service module can obtain the application's status information in real time from the power consumption control module. Based on the status information of application 1, the connection service module determines whether application 1 is in a frozen state before being shut down.
[0347] For example, if application 1 is active before being closed, the connection service module determines that application 1 is not in a frozen state before being closed. The method of this application does not perform cellular network control on applications that are closed after being active, and the process of this method ends directly.
[0348] For example, taking application 1 as a browser application, refer to... Figure 5b (2) The browser application runs in the background. If the user slides the thumbnail 504 from the bottom edge of the thumbnail 504 towards the top of the phone, the phone can respond to the sliding operation and close the process of the browser application corresponding to the thumbnail 504. Then the browser application can switch from the active state to the closed state. That is, the browser application is active before it is closed.
[0349] For example, if application 1 is in a frozen state before being closed, then proceed to execute S302.
[0350] For example, taking application 1 as a browser application, referring to 10(2), the browser application is currently in a frozen state in the background. If the user slides the thumbnail 511 from the bottom edge of the news interface of the browser application towards the top of the phone, the phone can respond to the sliding operation and close the process of the browser application corresponding to the thumbnail 511. Then the browser application switches from the frozen state to the closed state, that is, the browser application was in a frozen state before it was closed.
[0351] S302, The connection service module determines whether the first cellular request of application 1 has been backed up;
[0352] The connection service module can query the second data structure (wherein the second data structure can be used to back up the cellular requests sent by the application that actively requests cellular data to the connection service module) to see if the cellular request of application 1 exists. If it exists, it means that the connection service module has backed up the first cellular request of application 1. If it does not exist, it means that the connection service module has not backed up the first cellular request of application 1.
[0353] For example, although application 1 switches from a frozen state to a closed state, if application 1 did not request a cellular network before freezing, such as application 1 directly using a cellular network actively requested by another application, then the second data structure of the connection service module will not contain application 1's cellular request.
[0354] Optionally, if application 1 is not a third-party application, for example, if application 1 is a system application, then in an optional implementation, the phone executes... Figure 5b If the process does not involve cellular network control for Application 1, then the second data structure of the connection service module will not contain the first cellular request for Application 1. Therefore, if the first cellular request for Application 1 has not been backed up in the connection service module, the process terminates directly.
[0355] If Application 1 actively requested cellular data before freezing, the Connection Service Module may have backed up the first cellular request of Application 1. If the Connection Service Module has backed up the first cellular request of Application 1, then the Connection Service Module will proceed to execute S303.
[0356] Optionally, if Application 1 is a third-party application and has actively requested cellular data before freezing, the connection service module may have backed up the first cellular request of the application. In this case, if the first cellular request of Application 1 has been backed up in the connection service module, the connection service module will proceed to execute S303.
[0357] S303, the first cellular request from the connection service module to delete the backup.
[0358] After an application is closed, its data needs to be deleted and the resources it uses need to be released to ensure that the application can run normally when it is launched again.
[0359] In this embodiment, the data that application 1 needs to delete may include a first cellular request.
[0360] In this embodiment, the first cellular request can exist in the original first data structure. Application 1 is in a frozen state before being closed, and the phone executes... Figure 5b The process has already removed the first cellular request from Application 1 in the original first data structure. Therefore, after Application 1 switches from the closed state back to the active state, the connection service module will not establish a cellular connection between the mobile phone and the base station based on the first cellular request in the first data structure if Application 1 has not applied for cellular access.
[0361] In this embodiment, the first cellular request may also exist in the second data structure. Application 1 is in a frozen state before being closed; the phone executes... Figure 8 The process involves backing up the first cellular request of application 1 to a second data structure before application 1 is closed. Each cellular request from the application has a unique and unchanging sequence number. After application 1 is closed, the connection service module can delete the first cellular request with application 1's sequence number from the backup in the second data structure to ensure that application 1 can successfully request a cellular network when it becomes active again after being closed.
[0362] In this embodiment, after a third-party application that has actively requested cellular network access switches from a frozen state to a closed state, the phone can delete the cellular requests backed up for that application. These backed-up cellular requests are the ones created when the application switched from an active state to a frozen state. Therefore, by deleting the application's data and resources after the application is closed, the phone ensures that the application can still request cellular network access again when it becomes active again.
[0363] In another embodiment, refer to Figure 8 The flowchart of the cellular network control method of this embodiment of the invention shown is illustrated below. Figure 5b ,exist Figure 8 After the process, if the power consumption control module malfunctions, the phone can then execute... Figure 5b The process is shown below.
[0364] Application closure (also known as application being closed) indicates that the application process is in a closed state. Application closure can be triggered by the user, such as when the user actively closes the foreground or background application; or it can be triggered by the system, such as when the system automatically closes the process because it is unresponsive.
[0365] The power consumption control module can perform a self-check to see if any abnormality has occurred. If the power consumption control module finds an abnormality in itself, it will restart. After restarting, the power consumption control module can send a notification indicating that the power consumption control module is abnormal to the connection service module, which can then execute S400.
[0366] For example, the power consumption control module can determine that an anomaly has occurred by self-testing if it meets preset conditions. These preset conditions may include, but are not limited to, at least one of the following:
[0367] An illegal function call was detected;
[0368] High memory load detected;
[0369] A crash was detected in the power control module process.
[0370] The power consumption control module process was detected to have been manually shut down, etc.
[0371] In the above embodiments, after the power consumption control module is started, the power consumption control module can control the connection service module to perform. Figure 5b The steps of the cellular network control method are designed to save power consumption in the mobile phone. When the power control module malfunctions, the data in the mobile phone that has been processed by the connection service module needs to be restored to its state before the connection service module's operation. Therefore, after the power control module malfunctions, the connection service module can execute steps S400 to S403.
[0372] S400, the connection service module writes all the cellular requests of the backed-up applications into the original first data structure;
[0373] For example, when the connection service module queries the second data structure, if it finds an application's cellular request in the second data structure, it indicates that the application has switched from an active state to a frozen state, and the connection service module has executed [action] on that application. Figure 6 Therefore, the cellular requests of the application need to be restored, that is, the cellular requests of the application in the second data structure are rewritten to the original first data structure; when the cellular requests in the second data structure involve multiple applications, the cellular requests of multiple applications need to be restored one by one.
[0374] Optionally, in S401, the connection service module deletes all cellular requests for backup applications;
[0375] The second data structure can be used to back up the cellular requests sent to the connectivity service module by third-party applications when they actively request cellular networks after switching from an active state to a frozen state. If the power control module detects an anomaly during its self-test, it needs to clear the backup data generated by the cellular network control method executed by the connectivity service module under its control. Therefore, the connectivity service module can delete the cellular requests of each application stored in the second data structure.
[0376] Optionally, in S402, the connection service module determines whether the cellular network is in a connected state;
[0377] The specific implementation method of this step can be found in [reference]. Figure 6 S204 in the text will not be elaborated here.
[0378] If the cellular status is cellular connected, the process ends; if the cellular status is cellular disconnected, the connection service module proceeds to execute S403.
[0379] Optionally, in step S403, the connection service module determines whether the network meets the second preset condition;
[0380] The specific implementation method of this step can be found in [reference]. Figure 5b S205 in the text will not be elaborated here.
[0381] If the connection service module determines that the network does not meet the second preset condition, the process ends.
[0382] If the connection service module determines that the network meets the second preset condition, then the connection service module proceeds to execute S404.
[0383] S404, the connectivity service module instructs the modem to establish a cellular connection;
[0384] Because the power consumption control module controls the connection service module to perform Figure 6 The process can shut down the cellular connection. Therefore, after the power control module malfunctions, the network needs to be restored. When the cellular connection is not active, the connection service module instructs the modem to establish a cellular connection with the base station.
[0385] The specific implementation method of this step can be found in [reference]. Figure 14 S206 in the document will not be elaborated upon here.
[0386] After S404, the process ends.
[0387] In this embodiment, after the power consumption control module malfunctions, the mobile phone can restore the cellular requests and operations on the cellular network of the application after the application switches from active to frozen state. Specifically, this may include restoring the original first data structure using the backed-up cellular requests, deleting the backed-up cellular requests, and re-establishing the cellular network connection when the cellular network is turned off. This allows the operation performed by the application's cellular requests to be restored and the cellular network connection status to be restored after the power consumption control module malfunctions, ensuring that the original dual Wi-Fi and cellular network environment is not affected.
[0388] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithmic steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.
[0389] In one example, A schematic block diagram illustrating an embodiment of the present application shows an apparatus 300. The apparatus 300 may include a processor 301 and a transceiver / transceiver pin 302, and optionally, a memory 303.
[0390] The various components of device 300 are coupled together via bus 304, which includes a data bus, a power bus, a control bus, and a status signal bus. However, for clarity, all buses are referred to as bus 304 in the figure.
[0391] Optionally, the memory 303 can be used for the instructions in the foregoing method embodiments. The processor 301 can be used to execute the instructions in the memory 303, control the receive pin to receive signals, and control the transmit pin to transmit signals.
[0392] The device 300 may be an electronic device or a chip of an electronic device in the above method embodiments.
[0393] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0394] This embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the cellular network control method in the above embodiment.
[0395] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned related steps to implement the cellular network control method in the above embodiment.
[0396] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to execute the cellular network control method in the above-described method embodiments.
[0397] In this embodiment, the electronic device, computer storage medium, computer program product or chip are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding method provided above, and will not be repeated here.
[0398] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0399] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0400] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0401] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0402] Any content in the various embodiments of this application, as well as any content in the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.
[0403] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0404] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0405] The steps of the methods or algorithms described in conjunction with the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Additionally, the ASIC can reside in a network device. Alternatively, the processor and storage medium can exist as discrete components in the network device.
[0406] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0407] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A control method for a cellular network, applied to electronic devices, characterized in that, The electronic device interacts with the application server via Wi-Fi and cellular networks, wherein the cellular network is requested by a first application, and the first and second applications interact with their respective application servers via the cellular network. The method includes: In response to the first user operation received, the first application running in the foreground is switched to run in the background; If it is detected that the first application has not generated application data within a preset time period of running in the background, and the first application is the last application to use the cellular network among the applications that have applied for the cellular network, the cellular network access of the electronic device is disconnected. The second application's data is exchanged with the application server of the second application via the Wi-Fi network.
2. The method according to claim 1, characterized in that, After disconnecting the cellular network from the electronic device, the method further includes: In response to the received second user operation, the first application that has not generated application data within the preset time period of running in the background is switched to run in the foreground; The pathway of the cellular network connecting the electronic device.
3. The method according to claim 2, characterized in that, After detecting that the first application has not generated application data within a preset time period of running in the background, and that the first application is the last application to use the cellular network among those that have applied for it, the method further includes: Delete the first cellular request of the first application from the first data structure; Wherein, the first cellular request is used to apply for the cellular network, and the first data structure is used to store cellular requests of a preset application, wherein the preset application is an application that has applied for the cellular network.
4. The method according to claim 3, characterized in that, Before deleting the first cellular request of the first application from the first data structure, the method further includes: Back up the first cellular request to the second data structure; Prior to the path connecting the electronic device to the cellular network, the method further includes: Write the first cellular request backed up in the second data structure into the first data structure.
5. The method according to claim 3, characterized in that, The method further includes: In response to a received third user operation, the third application running in the foreground is switched to run in the background, wherein the cellular network is requested by the third application, and the third application interacts with its application server through the cellular network; If it is detected that the third application has not generated application data within the preset time period during which it has been running in the background, and the third application is not the last application to apply for and use the cellular network, the second cellular request of the third application will be deleted from the first data structure. The second cellular request is used to apply for the cellular network.
6. The method according to claim 5, characterized in that, Before deleting the second cellular request of the third application from the first data structure, the method further includes: The second cellular request is backed up to the second data structure.
7. The method according to claim 6, characterized in that, After deleting the second cellular request of the third application from the first data structure, the method further includes: In response to the received fourth user operation, the third application that has not generated application data within the preset time period of running in the background is switched to run in the foreground; Write the second cellular request backed up in the second data structure into the first data structure.
8. The method according to claim 7, characterized in that, After writing the target cellular request backed up in the second data structure into the first data structure, the method further includes: Remove the target cellular request from the second data structure; The target cellular request includes either the first cellular request or the second cellular request.
9. The method according to claim 4, characterized in that, After disconnecting the cellular network access of the electronic device, the method further includes: In response to the received fourth user operation, the first application that has not generated application data within a preset time period of background operation will be closed; Remove the first cellular request from the second data structure.
10. The method according to claim 2, characterized in that, The electronic device displays a first icon representing the Wi-Fi network and a second icon representing the cellular network; Before disconnecting the cellular network access of the electronic device, the second icon includes a second uplink identifier and / or a second downlink identifier; The second uplink identifier is used to indicate that the electronic device uploads data to the application server through the cellular network; The second downlink identifier is used to indicate that the electronic device downloads data from the application server via the cellular network.
11. The method according to claim 10, characterized in that, After the cellular network access of the electronic device is disconnected, the first icon includes a first uplink identifier and / or a first downlink identifier, and the second icon does not include the second uplink identifier and the second downlink identifier; The first uplink identifier is used to indicate that the electronic device uploads data to the application server through the Wi-Fi network; The first downlink identifier is used to indicate that the electronic device downloads data from the application server via the Wi-Fi network.
12. The method according to claim 10, characterized in that, Following the pathway of the cellular network connecting the electronic device, the second icon includes the second uplink identifier and / or the second downlink identifier.
13. An electronic device, characterized in that, include: A memory and a processor, wherein the memory and the processor are coupled; The memory stores program instructions that, when executed by the processor, cause the electronic device to perform the control method for a cellular network as described in any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that, The device includes a computer program that, when run on an electronic device, causes the electronic device to perform the control method for a cellular network as described in any one of claims 1 to 12.
15. A chip, characterized in that, The device includes one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device performs the control method of the cellular network according to any one of claims 1 to 12.
Citation Information
Patent Citations
Multi-application networked control method and system
CN106919417A
Networking control method, networking control device, electronic equipment and storage medium
CN112469099A