Network connection control method and device
By introducing a network connection proxy module in electronic devices, the proxy management and control of cellular network requests based on Wi-Fi network quality and other factors, the problem of increasing power consumption of cellular networks under Wi-Fi connection is solved, and the power consumption optimization is achieved and normal transmission of service data.
Patent Information
- Application Number
- CN202311205252.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2024-11-12
AI Technical Summary
When an electronic device connects to a Wi-Fi network, the cellular network may be unreasonably activated, resulting in an increase in power consumption. How to effectively control the network connection to reduce power consumption.
By introducing a network connection proxy module into electronic devices, it is reported to the power consumption management application after receiving a cellular network request, and decide whether to perform proxy management based on Wi-Fi network quality and other factors to avoid unnecessary cellular network activation, including non-responsiveness. Or remove cellular network requests and activate cellular network if necessary.
It effectively reduces the power consumption of electronic devices, avoids unreasonable cellular network activation, and ensures service data transmission while optimizing battery life.
Smart Images

Figure CN118945775A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent with application date of May 10, 2023, application number 202310517722.3, and invention name “Network connection control method and device”. Technical Field
[0002] The present application relates to the field of network communication technology, and in particular to a method and device for controlling network connection. Background Art
[0003] With the development of technology, most electronic devices support network connection via Wi-Fi and cellular networks. In order to save power consumption of electronic devices, if an electronic device is connected to a Wi-Fi network, the electronic device will usually give priority to the Wi-Fi network and temporarily not activate the cellular network. However, under the Wi-Fi network, the cellular network may sometimes be activated, resulting in increased power consumption of the electronic device. Therefore, how to control the network connection of electronic devices has become a technical problem that needs to be solved. Summary of the invention
[0004] The present application provides a network connection control method and device, which can achieve control of cellular network networking through proxy management of cellular network requests, especially when the electronic device is already connected to a Wi-Fi network, it can avoid unreasonable activation of the cellular network and reduce the power consumption of the electronic device.
[0005] In a first aspect, an embodiment of the present invention provides a method for controlling a network connection, comprising: activating a cellular network after receiving a cellular network request from a first application; sending first information to a second application, wherein the first information is used to report the cellular network request of the first application, and the second application is used to determine proxy control of the cellular network request of the first application; receiving proxy indication information from the second application; and performing proxy control on the cellular network request of the first application and releasing the cellular network according to the proxy indication information.
[0006] In the embodiment of the present invention, the first application may be any application installed on the electronic device that needs to request the use of a cellular network, such as an instant messaging application, a conference application, a short video application, or a news application. The second application may be a power consumption management application. In the embodiment of the present invention, the second application is used to decide whether to perform proxy control on the cellular network request of the first application.
[0007] In some embodiments, the above method is applied to the application framework layer of the electronic device. Optionally, the application framework layer of the electronic device may include a network connection proxy module, and the network connection proxy module is used to execute the method of the embodiment of the present invention.
[0008] In some embodiments, when the electronic device is already connected to a Wi-Fi network, the first application initiates a cellular network request. The network connection proxy module obtains the cellular network request of the first application and reports it to the second application. The second application is used to decide whether to perform proxy control on the cellular network request of the first application. Optionally, if the second application determines to perform proxy control on the cellular network request of the first application, the second application sends proxy indication information to the network connection proxy module. The network connection proxy module performs proxy control on the cellular network request of the first application according to the proxy indication information. Optionally, the network connection proxy module performing proxy control on the cellular network request of the first application may include: the network connection proxy module does not respond to the cellular network request of the first application. Optionally, the network connection proxy module can remove the cellular network request of the first application. Optionally, if the electronic device is already connected to a cellular network, the network connection proxy module can release the cellular network.
[0009] In some embodiments, when the electronic device is not connected to the Wi-Fi network, the first application can initiate a dual-stream network request for the Wi-Fi network and the cellular network. After the electronic device receives the dual-stream network request, the Wi-Fi network can be activated according to the network request of the Wi-Fi network. For the network request of the cellular network, the first information can be reported to the second application according to the method of the above embodiment, so that the second application can decide whether to perform proxy management on the cellular network request of the first application.
[0010] In some embodiments, the second application is used to determine whether to perform proxy control on the cellular network request of the first application according to the quality of the Wi-Fi network. In some embodiments, the second application can set a second threshold value for the quality of the Wi-Fi network. When the quality of the Wi-Fi network is greater than or equal to the second threshold, the second application determines to perform proxy control on the cellular network request of the first application. When the quality of the Wi-Fi network is less than the second threshold, the second application determines not to perform proxy control on the cellular network request of the first application. That is, when the cellular network request of the first application is received when the Wi-Fi network quality is good, the cellular network request of the first application is proxy controlled to avoid unreasonable activation of the cellular network and reduce the power consumption of the electronic device. In addition, if the cellular network request of the first application is received when the Wi-Fi network quality is poor, the cellular network request of the first application may not be proxy controlled, and the cellular network may be activated in time to ensure the normal business data transmission of the first application.
[0011] In some embodiments, in addition to deciding whether to perform proxy management on the cellular network request of the first application based on the Wi-Fi network quality, the second application may also determine whether to perform proxy management on the cellular network request of the first application based on a combination of one or more of the following, including: network sensitivity of the first application, data transmission status of the first application in the cellular network, running status of the first application, etc.
[0012] In some embodiments, after the proxy control of the cellular network request of the first application is performed according to the proxy indication information, if the cellular network request of the first application is received again, the received cellular network request is removed. That is, after the network connection proxy module performs proxy control on the cellular network request of the first application, if the cellular network request of the first application is received again, the network connection proxy module may not respond to the cellular network request.
[0013] In some embodiments, in addition to determining to perform proxy control on the cellular network request of the first application, the second application may also cancel the proxy control on the cellular network request of the first application. Specifically, after the network connection proxy module performs proxy control on the cellular network request of the first application according to the proxy indication information, if the proxy cancellation indication information of the second application is received, the proxy control on the cellular network request of the first application is canceled according to the proxy cancellation indication information.
[0014] In some embodiments, the proxy cancellation indication information is sent when the Wi-Fi network quality is less than the first threshold. That is, when the second application detects that the current Wi-Fi network quality is less than the first threshold, the second application can determine to cancel the proxy control of the cellular network request of the first application. Optionally, the first threshold and the second threshold can be set according to actual needs. The first threshold and the second threshold can be the same value or different values.
[0015] In some embodiments, after canceling the proxy control of the cellular network request of the first application according to the proxy cancellation indication information, the network connection proxy module can also activate the cellular network and send information that the cellular network is available to the first application, thereby ensuring that the first application can use the cellular network normally.
[0016] In some embodiments, after the cellular network request of the first application is subject to proxy control, the first application may also actively release the cellular network. In this case, the network connection proxy module receiving the proxy cancellation indication information of the second application may include: after receiving the cellular network release request of the first application, sending second information to the second application, and the second information is used to report the cellular network release request. After receiving the cellular network release request of the first application, the second application sends the proxy cancellation indication information to the network connection proxy module. The network connection proxy module receives the proxy cancellation indication information of the second application and cancels the proxy control of the cellular connection request of the first application.
[0017] In some embodiments, after receiving the cellular network request of the first application and sending the first information to the second application, if the second application determines not to perform proxy management on the cellular network request of the first application, the method further includes: if no data transmission is detected within the second time period or no cellular network request is detected again, releasing the cellular network. That is, in the embodiment of the present invention, the network connection proxy module can actively release the cellular network as needed to avoid the application from occupying the cellular network after entering the background.
[0018] In a second aspect, an embodiment of the present invention provides an electronic device, comprising a memory for storing program instructions and a processor for executing the program instructions, wherein when the program instructions are executed by the processor, the electronic device is triggered to execute the method as described in the first aspect or any one of the first aspects.
[0019] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on an electronic device, the electronic device executes the method described in the first aspect or any one of the first aspects.
[0020] It should be understood that the second to third aspects of the embodiments of the present invention are consistent with the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0022] Figure 2 A software structure block diagram of an electronic device provided by an embodiment of the present invention;
[0023] Figure 3 A schematic diagram of a network state conversion provided by an embodiment of the present invention;
[0024] Figure 4A flowchart of a method for controlling a network connection provided by an embodiment of the present invention;
[0025] Figure 5 A flowchart of another network connection control method provided by an embodiment of the present invention;
[0026] Figure 6 A flowchart of a method for controlling a network connection provided by an embodiment of the present invention;
[0027] Figure 7 A flowchart of canceling proxy control of cellular network requests provided by an embodiment of the present invention;
[0028] Figure 8 Another flowchart of canceling proxy control of cellular network requests provided by an embodiment of the present invention;
[0029] Fig. 9 A software structure diagram of another electronic device provided by an embodiment of the present invention;
[0030] Fig.10 A schematic diagram of a method for proxy management of a cellular network request of application A provided in an embodiment of the present invention;
[0031] Fig.11 A schematic diagram of another method of performing proxy management and control on a cellular network request of application A provided by an embodiment of the present invention;
[0032] Fig.12 A schematic diagram of canceling proxy control of cellular network requests of application A provided in an embodiment of the present invention;
[0033] Fig.13 A schematic diagram of a method for proxy management of cellular network requests of application B provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0035] See also Figure 1 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 1As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light 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.
[0036] Understandably, Figure 1 The electronic device shown is only one example of an electronic device. Figure 1 The structure of the electronic device shown does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0037] In the above electronic device, the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated in one or more processors.
[0038] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0039] In the above-mentioned electronic device 100, the wireless communication function can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0040] 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 a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0041] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0042] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate 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 the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0043] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. 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 the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0044] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0045] The external memory 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 memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0046] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor. In an embodiment of the present invention, the processor 110 can implement the network connection control method of the embodiment of the present invention by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0047] See also Figure 2 , is a software structure block diagram of an electronic device provided in an embodiment of the present invention. The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device.
[0048] like Figure 2 As shown, the layered architecture divides the electronic device into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android electronic device is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime), the system library system library, and the kernel layer.
[0049] The application layer can include a series of application packages. Application packages can include instant messaging, conference, short video, news and other applications. Figure 2 As shown, the application layer may also include the power consumption management application involved in the embodiment of the present invention. Optionally, the power consumption management application may be a development toolkit in the form of SDK.
[0050] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 2As shown, the application framework layer may include a window manager, a content provider, a phone manager, a resource manager, a notification manager, a view system, and a communication module. Figure 2 As shown, the application framework layer may also include a network connection proxy module involved in an embodiment of the present invention. The network connection proxy module may provide an interface for proxy control of cellular network requests (referred to as interface 1), and may also provide an interface for canceling proxy control of cellular network requests (referred to as interface 2).
[0051] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0052] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0053] The kernel layer is a layer between hardware and software. The kernel layer may include display drivers, camera drivers, audio drivers, or sensor drivers. Optionally, the kernel layer may also include a modem. When the network connection proxy module determines that a cellular network needs to be connected, the network connection proxy module activates the modem and activates the cellular network through the modem.
[0054] based on Figure 2 The electronic device software structure shown, an embodiment of the present invention provides a method for controlling network connection. A proxy control mechanism for cellular network requests is added to the method. When an application initiates a cellular network request, a decision can be made whether to perform proxy control on the cellular network request of the application. If it is determined that the cellular network request of the application is to be subject to proxy control, the cellular network request initiated by the application can be intercepted and cached. After the proxy control of the cellular network request of the application is canceled, the cellular network request of the application is restored. The embodiment of the present invention can achieve control over cellular networking through proxy control of cellular network requests, especially when the electronic device is already connected to a Wi-Fi network, it can avoid unreasonable activation of the cellular network as much as possible and reduce the power consumption of the electronic device.
[0055] exist Figure 2In the electronic device software structure shown, the power consumption management application is used to determine whether to perform proxy control on the cellular network request of the application, and to determine whether to cancel the proxy control of the cellular network request of the application. The network connection proxy module is used to report the cellular network request initiated by the application to the power consumption management application. The network connection proxy module is also used to provide an interface 1 for proxy control of the cellular network request and an interface 2 for canceling the proxy control of the cellular network request. Optionally, the network connection proxy module is also used to automatically release the cellular network when there is no cellular network request in the electronic device.
[0056] Figure 1 and Figure 2 The electronic device shown supports connecting to a cellular network and a WiFi network. The connection state transition of the cellular network in the electronic device may include: Figure 3 As shown in FIG. 1 , when an application at the application layer initiates a cellular network request (Request), the cellular network is activated to the connected (Connect) state. When there is no cellular network request on the cellular network, the cellular network is set to the idle (Linger) state. After the cellular network is in the idle state for 30 seconds, the cellular network is released.
[0057] The network connection control method provided by the present invention will be described in detail below in conjunction with embodiments.
[0058] See also Figure 4 , is a flow chart of a network connection control method provided by an embodiment of the present invention. The control method includes proxy control of cellular network requests and cancellation of proxy control of cellular network requests. Figure 4 As shown, the processing steps of the method include:
[0059] 201, the power consumption management application determines to perform proxy control on the cellular network request of application A. Application A can be any application installed on the electronic device that needs to request the use of the cellular network, such as the instant messaging application, conference application, short video application or news application mentioned above. Optionally, application A can initiate a cellular network request when the electronic device is already connected to the Wi-Fi network. Alternatively, when the electronic device is not connected to the Wi-Fi network, application A can initiate a dual-stream network request for the Wi-Fi network and the cellular network. If application A initiates a dual-stream network request for the Wi-Fi network and the cellular network, the Wi-Fi network can be activated according to the network request of the Wi-Fi network, and then the power consumption management application determines to perform proxy control on the cellular network request of application A.
[0060] 202, the power consumption management application sends proxy indication information to the interface 1 of the network connection proxy module. The network connection proxy module determines not to activate the cellular network according to the proxy indication information, and the network connection proxy module does not send a cellular network request to the Modem module.
[0061] 203 , the power consumption management application determines to cancel the proxy control of the cellular network request of the A application.
[0062] 204, the power consumption management application sends a proxy cancellation indication message to the interface 2 of the network connection proxy module. In addition, since the cellular network request previously initiated by application A has not been responded to, after canceling the proxy control of the cellular network of application A, the network connection proxy module can activate the cellular network according to the proxy cancellation indication message. Optionally, the network connection proxy module can activate the cellular network through a modem.
[0063] In an embodiment of the present invention, a power consumption management application is used to decide whether to perform proxy control on a cellular network request of application A, and to decide whether to cancel the proxy control on the cellular network request of application A after performing proxy control on the cellular network request of application A. The network connection proxy module is used to perform proxy control on the cellular network request of application A according to the instructions of the power consumption management application. Through the method of the embodiment of the present invention, control over the cellular network request of application A can be achieved, especially when the electronic device is already connected to a Wi-Fi network, unreasonable activation of the cellular network can be avoided as much as possible, thereby reducing the power consumption of the electronic device.
[0064] See also Figure 5 , is a flow chart of another network connection control method provided by an embodiment of the present invention. Figure 5 As shown, the processing steps of the method include:
[0065] 301, application A initiates a cellular network request.
[0066] 302, the network connection proxy module activates the cellular network after receiving the cellular network request of application A. Optionally, the network connection proxy module may activate the cellular network by converting the state of the cellular network request. Optionally, the network connection proxy module may activate the cellular network through a modem.
[0067] 303. The network connection proxy module sends information that the cellular network is available to application A.
[0068] 304, the network connection proxy module sends a first message to the power consumption management application, and the first message is used to report the cellular network request of application A. After receiving the first message, the power consumption management application decides whether to perform proxy control on the cellular network request of application A. If the power consumption management application determines to perform proxy control on the cellular network request of application A, continue to execute step 305. If the power consumption management application determines not to perform proxy control on the cellular network request of application A, the power consumption management application may also send information not to perform proxy control to the network connection proxy module. The network connection proxy module may not perform proxy control on the cellular network connection request of application A, and application A can use the cellular network normally.
[0069] 305 , the power consumption management application determines to perform proxy management on the cellular network request of application A.
[0070] 306 , the power consumption management application sends agent instruction information to the network connection agent module.
[0071] 307, the network connection proxy module performs proxy management on the cellular network request of application A according to the proxy indication information. The network connection proxy module removes the cellular network request of application A, sets the cellular network to an inactive state, and releases the cellular network after a delay of 10 seconds.
[0072] In an embodiment of the present invention, the network connection proxy module is used to monitor the cellular network requests of each application at the application layer. When the network connection proxy module monitors the cellular network request of application A, it reports the cellular network request of application A to the power consumption management application. The power consumption management application is used to decide whether to perform proxy control on the cellular network request of application A. If the power consumption management application determines to perform proxy control on the cellular network request of application A, the network connection proxy module performs proxy control on the cellular network request of application A.
[0073] After the network connection proxy module performs proxy management on the cellular network request of application A, if application A initiates a cellular network request again, Figure 6 As shown, subsequent steps 308-311 are performed.
[0074] 308, the network connection proxy module receives the cellular network request of application A again.
[0075] 309, the network connection proxy module determines whether proxy control has been performed on the cellular network request of application A. If so, execute step 310. If not, determine whether proxy control has been performed on the cellular network request of the application according to 302-307.
[0076] 310 , the network connection proxy module records the cellular network request of application A and removes the cellular network request of application A.
[0077] 311, the network connection proxy module reports the cellular network request of application A to the power consumption management application. The power consumption management application is used to record the cellular network requests initiated by application A all the time.
[0078] In the embodiment of the present invention, after the network connection proxy module performs proxy management on the cellular network request of application A, if a cellular network connection request of application A is received again, the cellular network connection request of application A can be directly removed, that is, the cellular network request of application A is not responded to. Optionally, the network connection proxy module and the power consumption management application will record the cellular network connection request received again to manage the cellular network connection request of application A.
[0079] In some embodiments, when the power consumption management application detects that the Wi-Fi network quality of the electronic device has changed, the power consumption management application can instruct the network connection proxy module to cancel the proxy control of the cellular network request of application A. Figure 7 As shown, the processing steps of the method include:
[0080] 401, the power consumption management application detects that the Wi-Fi network quality is less than a first threshold. In an embodiment of the present invention, when the power consumption management application detects that the Wi-Fi network quality is less than the first threshold, the power consumption management application may cancel the proxy control of the cellular network request of application A and execute step 402.
[0081] 402 , the power consumption management application sends a proxy cancellation instruction message to the network connection proxy module.
[0082] 403. The network connection proxy module cancels the proxy control of the cellular network request of application A.
[0083] 404, the network connection agent module activates the cellular network.
[0084] 405 , the network connection proxy module sends information that the cellular network is available to application A.
[0085] In an embodiment of the present invention, the power consumption management application can decide whether to cancel the proxy control of the cellular network request of application A based on the quality of the Wi-Fi network. If the quality of the Wi-Fi network is less than the first threshold, it means that the current Wi-Fi network quality is poor, and the power consumption management application determines that the proxy control of the cellular network request of application A can be canceled. When the network connection proxy module receives the proxy cancellation indication sent by the power consumption management application, the proxy control of the cellular network request of application A can be canceled. Optionally, since application A has previously initiated a cellular network request, the network connection proxy module can activate the cellular network and send information about the availability of the cellular network to application A after canceling the cellular network connection request to application A, so that application A can use the cellular network to connect to the Internet when the cellular network quality is poor.
[0086] In some embodiments, application A may also actively release the cellular network after initiating a cellular network request. When application A actively releases the cellular network, the power consumption management application may instruct the network connection proxy module to cancel the proxy control of application A's cellular network request. Figure 8 As shown, the processing steps of the method include:
[0087] 501, application A initiates a cellular network release request.
[0088] 502. After obtaining the cellular network release request of application A, the network connection proxy module sends second information to the power consumption management application. The second information is used to report the cellular network release request of application A to the power consumption management application.
[0089] 503 , after obtaining the cellular network release request of application A, the power consumption management application sends a proxy cancellation indication message to the network connection proxy module.
[0090] 504. After receiving the proxy cancellation instruction, the network connection proxy module can cancel the proxy control of the cellular network request of application A.
[0091] In the embodiment of the present invention, since it is the A application that actively initiates the cellular network release request, the cellular network does not need to be activated after the network connection proxy module cancels the proxy control of the cellular network request of the A application.
[0092] See also Fig. 9 , is a software structure block diagram of another electronic device provided by an embodiment of the present invention. Fig. 9 In the electronic device software structure shown, the communication module located in the application framework layer is used to obtain the Wi-Fi network quality and report it to the power consumption management application of the application layer. The network connection proxy module located in the application framework layer is used to monitor the cellular network request or cellular network release request initiated by each application in the application layer. The network connection proxy module is used to report the obtained cellular network request or cellular network release request to the power consumption management application of the application layer.
[0093] The power consumption management application at the application layer is used for business scenario identification, network request monitoring, network quality monitoring and network data collection. Among them, the network quality monitoring is used to obtain the Wi-Fi network quality reported by the communication module. The network request monitoring is used to obtain the cellular network request or cellular network release request reported by the network connection agent module. Business scenario identification is used to identify the network sensitivity of the application that initiates the cellular network request, and determine whether the corresponding application is a network-sensitive business or a non-network-sensitive business. Network data collection is used to determine whether the application that initiates the cellular network request has data transmission in the cellular network, the running status of the corresponding application, etc. Optionally, the running status of the corresponding application may include: whether the application is running in the foreground of the electronic device or in the background of the electronic device, etc.
[0094] The power consumption management application can make a decision on whether to perform proxy management on the cellular network request of the application based on the network sensitivity of the application initiating the cellular network request, the data transmission status on the cellular network and / or the running status of the corresponding application.
[0095] In some embodiments, when the application that initiates the cellular network request is a network-sensitive service, the cellular network request of the application may not be subject to proxy management and control, and the cellular network request of the application may be directly responded to.
[0096] In some embodiments, when the application that initiates the cellular network request is a network-sensitive service, it can also be determined whether to perform proxy control on the cellular network request of the application based on the Wi-Fi network quality. If the Wi-Fi network quality is greater than or equal to a pre-set third threshold, it is determined that the cellular network request of the corresponding application is subject to proxy control, that is, the Wi-Fi network quality is very good and the cellular network can be activated. If the Wi-Fi network quality is less than the third threshold, it can be determined that the cellular network request of the corresponding application is not subject to proxy control, that is, the Wi-Fi network quality is relatively poor and the cellular network can be activated in time.
[0097] In network-sensitive services, in addition to considering the quality of the Wi-Fi network, it is also possible to consider whether the electronic device is in a mobile state or a stationary state. In a stationary state and when the Wi-Fi network quality is very good, the cellular network request of the application can be proxy-controlled. If the electronic device is in a mobile state, the cellular network request of the application can be proxy-controlled to avoid affecting the data transmission of the application when switching the cellular network. In some embodiments, the setting of the above-mentioned third threshold can be used to distinguish whether the network state is in a very good state, and the third threshold can be set according to actual needs.
[0098] In some embodiments, when the application that initiates the cellular network request is a non-network sensitive service, the cellular network request of the application may be subject to proxy management.
[0099] In some embodiments, when the application that initiates the cellular network request is a non-network sensitive service, it is also possible to determine whether to perform proxy control on the cellular network request of the application based on the Wi-Fi network quality. If the Wi-Fi network quality is greater than or equal to a pre-set second threshold, it means that the Wi-Fi network quality is good, and the cellular network request of the corresponding application can be proxy controlled. If the Wi-Fi network quality is less than the second threshold, it means that the Wi-Fi network quality is not very good, and it can be determined not to perform proxy control on the cellular network request of the corresponding application, and to activate the cellular network immediately to avoid affecting the data transmission of the corresponding application. In some embodiments, the setting of the above-mentioned second threshold can be used to distinguish whether the network status is in a good state, and the second threshold can be set according to actual needs.
[0100] In some embodiments, when the application that initiates the cellular network request is a non-network sensitive service, it can also be decided whether to perform proxy control on the cellular network request of the application based on whether the application is running in the background or whether there is data transmitted in the cellular network. In some examples, the application that initiates the cellular network request is a non-network sensitive service and the application is running in the background, then the cellular network request of the application can be proxy controlled. In some examples, the application that initiates the cellular network request is a non-network sensitive service and the data transmission volume of the application in the cellular network is less than the set value, then the cellular network request of the application can be proxy controlled. In some examples, the application that initiates the cellular network request is a non-network sensitive service and the data transmission volume of the application in the cellular network is greater than or equal to the set value, then the cellular network request of the application is not proxy controlled. Of course, in each example, the decision factor of the Wi-Fi network quality can also be added, and other possible examples are not given one by one here. It should be noted that the power consumption management application can set a configuration file, and the configuration file may include policy information for determining whether to perform proxy control on the cellular network request or cancel the proxy control. The power consumption management application can update the configuration file through the cloud.
[0101] In the embodiment of the present invention, when the power consumption management application determines to perform proxy control on the cellular network request of a certain application, the proxy instruction information is sent to the network connection proxy module to perform proxy control on the cellular network request of the application. If the cellular network request of the application is not to be proxy controlled, the network connection proxy module connects to the cellular network through the Modem module.
[0102] In some embodiments, the power consumption management application can also cancel the proxy control of the application's cellular network request based on the Wi-Fi network quality or the cellular network release request initiated by the application. Figure 7 and Figure 8 Description.
[0103] The following will describe the network connection control method according to the embodiment of the present invention in combination with specific application scenarios.
[0104] like Fig.10 As shown, application A initiates non-network sensitive services, such as short video playback services, news browsing services, etc. 1. When already connected to the Wi-Fi network, application A initiates a cellular network request. After receiving the cellular network request from application A, the network connection proxy module activates the 5G network. 2. The network connection proxy module reports the cellular network request of application A to the power consumption management application through the first information. 3. The power consumption management application determines to perform proxy control on the cellular network request of application A, and sends a proxy indication message to the network connection proxy module. Fig.10 As shown, after receiving the proxy indication information, the network connection proxy module shuts down the 5G network.
[0105] like Fig.11 As shown, after the network connection proxy module performs proxy management on the cellular network request of application A, if application A initiates a cellular network request again, the network connection proxy module can directly intercept the cellular network request. 3. The network connection proxy module reports the cellular network request to the power consumption management application, so that the power consumption management application can record and manage the cellular network request of application A.
[0106] like Fig.12 As shown in the figure, after the network connection proxy module performs proxy control on the cellular network request of application A, if the quality of the Wi-Fi network deteriorates, 4. the power consumption management application can cancel the proxy control on the cellular network request of application A and send a proxy cancellation indication message to the network connection proxy module. After receiving the proxy cancellation indication message, the network connection proxy module activates the cellular network. 5. The network connection proxy module sends the information that the cellular network is available to application A. Fig.12 As shown, when the Wi-Fi network quality improves, the proxy control of the cellular network request of application A can be restored and the cellular network can be closed. In the embodiment of the present invention, whether the Wi-Fi network quality deteriorates can be determined by setting a first threshold.
[0107] like Fig.13 As shown, application B initiates network-sensitive services, such as live broadcasts, voice calls, video calls, games, etc. 1. When already connected to the Wi-Fi network, application A initiates a cellular network request. After receiving the cellular network request from application A, the network connection proxy module activates the 5G network. 2. The network connection proxy module reports the cellular network request of application B to the power consumption management application through the first information. 3. The power consumption management application determines that no proxy control will be performed on the cellular network request of application B, and then sends an instruction message to the network connection proxy module not to perform proxy control. As shown Fig.13As shown, after receiving the instruction information, the network connection proxy module does not shut down the 5G network. Application B can transmit data through the cellular network.
[0108] In some embodiments, when application A (which can be any application) is started, application A initiates a dual-stream network request for the Wi-Fi network and the cellular network. After receiving the dual-stream network request of application A, the network connection proxy module activates the Wi-Fi network according to the network request of the Wi-Fi network, and reports the network request of the cellular network to the power consumption management application through the first information, so as to decide whether to perform proxy management on the cellular network request of application A.
[0109] In some embodiments, application A may be an application running in the background. When application C initiates a cellular network request and activates the cellular network, application A may monitor that the cellular network is activated, and application A may transmit data on the cellular network. The network connection proxy module may determine whether to shut down the cellular network based on the amount of data transmitted by application A on the cellular network.
[0110] Corresponding to the above method, an embodiment of the present invention further provides an electronic device, which includes a memory for storing program instructions and a processor for executing the program instructions, wherein when the program instructions are executed by the processor, the electronic device is triggered to execute the above method.
[0111] The embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the network connection control method of the embodiment of the present invention.
[0112] The embodiment of the present invention further provides a computer program product including instructions, and when the computer program product is run on a computer or any at least one processor, the computer executes each step of the network connection control method of the embodiment of the present invention.
[0113] An embodiment of the present invention further provides a chip, including a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute corresponding operations and / or processes of the method of the embodiment of the present invention.
[0114] Optionally, the chip also includes a memory, which is connected to the processor via a circuit or wire, and the processor is used to read and execute the computer program in the memory. Further optionally, the chip also includes a communication interface, and the processor is connected to the communication interface. The communication interface is used to receive data and / or information to be processed, and the processor obtains the data and / or information from the communication interface and processes the data and / or information. The communication interface can be an input and output interface.
[0115] The memory can be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or it can also be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0116] The electronic device, computer storage medium or computer program product provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0117] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.
[0118] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0119] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0120] In several embodiments provided in the present application, any function can be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as an independent product. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for controlling a network connection, characterized in that: The method comprises: activating the cellular network after receiving the cellular network request from the first application; Sending first information to a second application, where the first information is used to report the cellular network request of the first application, the second application is a power consumption management application, the first application is an application that needs to use a cellular network, and the first application and the second application are different applications; receiving proxy indication information of the second application; Perform proxy control on the cellular network request of the first application according to the proxy indication information and release the cellular network; After performing proxy management and control on the cellular network request of the first application according to the proxy indication information, the method further includes: If the cellular network request of the first application is received again, the received cellular network request is not responded to.
2. The method according to claim 1, characterized in that The second application is used to determine whether to perform proxy management on the cellular network request of the first application according to the quality of the Wi-Fi network.
3. The method according to claim 2, characterized in that The second application is further used to determine whether to perform proxy control on the cellular network request of the first application according to a combination of one or more of the following, including: a network sensitivity of the first application; The data transmission status of the first application in the cellular network; the running status of the first application; The mobile status of the electronic device where the first application is located.
4. The method according to any one of claims 1 to 3, characterized in that: If the first application is a network-sensitive service, no proxy control is performed on the cellular network request of the first application; or, If the first application is a network-sensitive service and the electronic device where the first application is located is in a mobile state, no proxy control is performed on the cellular network request of the first application; or, If the first application is a network-sensitive service, the Wi-Fi network quality is greater than or equal to a third threshold, and the electronic device where the first application is located is in a stationary state, proxy control is performed on the cellular network request of the first application.
5. The method according to claim 3, characterized in that: If the first application is a non-network sensitive service, proxy control is performed on the cellular network request of the first application; or, If the first application is a non-network sensitive service and the Wi-Fi network quality is greater than or equal to a second threshold, proxy control is performed on the cellular network request of the first application; or, If the first application is a non-network sensitive service and the first application is running in the background of the electronic device, proxy control is performed on the cellular network request of the first application; or, If the first application is a non-network sensitive service and the data transmission volume of the first application in the cellular network is less than a set value, the cellular network request of the first application is subject to proxy control.
6. The method according to claim 1, characterized in that After the proxy control of the cellular network request of the first application according to the proxy indication information, the method further includes: receiving a proxy cancellation instruction message from the second application; The proxy control of the cellular network request of the first application is canceled according to the proxy cancellation indication information.
7. The method according to claim 6, characterized in that The proxy cancellation indication information is sent when the Wi-Fi network quality is less than a first threshold.
8. The method according to claim 7, characterized in that After canceling the proxy control of the cellular network request of the first application according to the proxy cancellation indication information, the method further includes: The cellular network is activated, and information indicating that the cellular network is available is sent to the first application.
9. The method according to claim 6, characterized in that The receiving the proxy cancellation indication information of the second application includes: After receiving the cellular network release request from the first application, sending second information to the second application, where the second information is used to report the cellular network release request; Receive the proxy cancellation indication information sent by the second application according to the cellular network release request.
10. The method according to claim 1, characterized in that After sending the first information to the second application, if the second application determines not to perform proxy management on the cellular network request of the first application, the method further includes: If no data transmission is detected within the second time period or no cellular network request is detected, the cellular network is released.
11. The method according to claim 1, characterized in that: The receiving a cellular network request of the first application includes: When the Wi-Fi network is already connected, a cellular network request of the first application is received; or, When the Wi-Fi network is not connected, dual-stream network requests of the Wi-Fi network and the cellular network are received by the first application, wherein the network request of the Wi-Fi network is used to activate the Wi-Fi network, and the network request of the cellular network is used to report to the second application through the first information.
12. An electronic device, characterized in that: include: The electronic device comprises a memory for storing program instructions and a processor for executing the program instructions, wherein when the program instructions are executed by the processor, the electronic device is triggered to execute the method as described in any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on an electronic device, enables the electronic device to execute the method according to any one of claims 1 to 11.
