Virtual system operation method and electronic equipment
By presetting physical network cards and bridges on the terminal device and setting up virtual network cards in the virtual system, the network and DNS address consistency between inside and outside the virtual system is solved, and the flexibility of network configuration when running multiple virtual systems on the terminal device is solved, achieving an efficient and economical Internet access experience.
Patent Information
- Application Number
- CN202311287830.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2043-09-28
AI Technical Summary
When running multiple virtual systems on terminal devices, how to flexibly and conveniently configure the network for the virtual system to ensure consistency of the internal and external networking of the container?
By presetting physical network cards and bridges on electronic devices and setting up virtual network cards in virtual systems, the association relationship between virtual network cards and physical network cards is realized. The bridge serves as an interactive channel and dynamically switches to connect different physical network cards to achieve flexibility and consistency in network configuration.
It realizes the consistency of network and DNS addresses inside and outside the virtual system, reduces data interaction inside and outside the virtual system, improves users' Internet access experience, and supports dynamic switching of various Internet access methods.
Smart Images

Figure CN119728639A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a virtual system operation method and electronic equipment. Background Art
[0002] As terminal devices become more and more popular, their functions and performance are becoming more and more powerful, and the need to run multiple systems on one terminal device has gradually emerged. Multiple virtual machines (VMs) or containers can be installed on one device to realize multi-system operation of terminal devices.
[0003] However, when the terminal device is running a virtual system, the applications running in the virtual system also need to access the Internet. The virtual system can access the Internet with the help of the network of the terminal device. How to flexibly and conveniently configure the network for the virtual system on the terminal device needs further research. Summary of the invention
[0004] The present application provides a virtual system operation method and an electronic device, which achieves networking consistency inside and outside the container.
[0005] In a first aspect, the present application provides a virtual system operation method, which is applied to an electronic device, wherein a first physical network card and a first network bridge are pre-installed on the electronic device, a virtual system is installed on the electronic device, a first application is run in the virtual system, a first virtual network card is run in the virtual system, the first virtual network card is connected to the first network bridge, the first network bridge is connected to the first physical network card, a preset DNS address is stored in the virtual system, and an IP address of the first DNS is stored in the first network bridge; the method comprises: the electronic device receives a first DNS data packet sent by the first application through the first network bridge, the first DNS data packet includes a source address and a destination address, wherein the source address is the IP address of the first virtual network card, the destination address is the preset DNS address, and the first A DNS data packet is used to request an Internet access IP address; the electronic device modifies the destination address in the first DNS data packet from a preset DNS address to the IP address of the first DNS through a first bridge, and obtains a second DNS data packet; the electronic device sends the second DNS data packet to the first DNS through the first bridge and the first physical network card; the electronic device receives a first response data packet sent by the first DNS through the first physical network card, and sends the second response data packet to the first application through the first bridge, the first response data packet and the second response data packet include a first Internet access IP address; the electronic device sends a first data packet through the first application, the first data packet includes first Internet access data, and the destination address of the first data packet is the first Internet access IP address.
[0006] Optionally, the first DNS data packet and the second DNS data packet carry a first domain name, and the first domain name is used to obtain a first Internet access IP address.
[0007] Through this method, a preset DNS address can be preset in the virtual system, and the first bridge stores the IP address of the first DNS, which can be a real address and can be determined based on the operator network and / or geographical location. When obtaining the Internet access IP address, the bridge can modify the preset DNS address in the DNS data packet to the IP address of the first DNS, so that the first application can access the DNS.
[0008] In combination with the first aspect, in a possible implementation, the first bridge stores an IP address of a second DNS, which is different from the first DNS; the electronic device receives a third DNS data packet sent by the first application through the first bridge, the third DNS data packet includes a source address and a destination address, wherein the source address is the IP address of the first virtual network card, the destination address is a preset DNS address, and the third DNS data packet is used to request an Internet access IP address; the electronic device modifies the destination address in the third DNS data packet from the preset DNS address to the IP address of the second DNS through the first bridge, and obtains a fourth DNS data packet; the electronic device sends the fourth DNS data packet to the second DNS through the first bridge and the first physical network card; the electronic device receives a third response data packet sent by the second DNS through the first physical network card, and sends the fourth response data packet to the first application through the first bridge, the third response data packet and the fourth response data packet include a second Internet access IP address; the electronic device sends a second data packet through the first application, the second data packet includes second Internet access data, and the destination address of the second data packet is the second Internet access IP address.
[0009] In this way, after the DNS changes, only the updated DNS address needs to be stored in the bridge, and no update is required in the virtual system. This can reduce data interaction inside and outside the virtual system, and can also ensure that the first application accesses the DNS based on the updated DNS address, and then obtains the Internet IP address.
[0010] In other embodiments, after the DNS changes, the DNS address at the bridge may not be updated, but the updated DNS address is sent to the virtual system, and the virtual system stores the updated DNS address. When the first application generates a DNS data packet, the DNS data packet carries the updated DNS address, and the bridge does not need to update the DNS address in the DNS data packet.
[0011] In combination with the first aspect, in a possible implementation manner, the first data packet is used to request Internet access data corresponding to the first Internet access IP address.
[0012] In combination with the first aspect, in a possible implementation, before obtaining the second DNS data packet, the method also includes: when the IP address of the first virtual network card is a local area network IP address, the electronic device modifies the source address in the first DNS data packet from the IP address of the first virtual network card to the IP address of the first physical network card through the first network bridge.
[0013] Because DNS does not recognize the LAN IP address, when the IP address of the first virtual network card is the LAN IP address, the source address in the first DNS data packet is modified from the IP address of the first virtual network card to the IP address of the first physical network card through the first bridge, so that DNS can recognize the DNS data packet, ensuring that DNS can successfully obtain the Internet access IP address.
[0014] In combination with the first aspect, in a possible implementation method, the electronic device receives a first response data packet sent by the first DNS through the first physical network, and sends a second response data packet to the first application through the first network bridge, specifically including: the electronic device receives the first response data packet sent by the first physical network card through the first network bridge; the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge, to obtain a second response data packet; the electronic device sends the second response data packet to the first application through the first network bridge.
[0015] In combination with the first aspect, in a possible implementation method, a preset DNS address is stored in the first network bridge; the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge to obtain a second response data packet, specifically including: the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge, and modifies the source address in the first response data packet from the IP address of the first DNS to the preset DNS address through the first network bridge to obtain a second response data packet.
[0016] In combination with the first aspect, in a possible implementation, a second physical network card and a second network bridge are pre-installed on the electronic device, a second virtual network card runs in the virtual system, the second virtual network card is connected to the second network bridge, the second network bridge is connected to the second physical network card, and the IP address of the first DNS is stored in the second network bridge.
[0017] In this way, the applications in the virtual system can perceive the real network status outside the system, achieving consistent networking inside and outside the container.
[0018] In combination with the first aspect, in a possible implementation manner, the first physical network card corresponds to a first Internet access method, the second physical network card corresponds to a second Internet access method, and the first Internet access method and the second Internet access method are different.
[0019] In combination with the first aspect, in a possible implementation manner, the first Internet access method or the second Internet access method includes any one of the following: a mobile cellular network, a WiFi network, and Bluetooth.
[0020] In a second aspect, the present application provides an electronic device, characterized in that the electronic device includes a memory and a processor; wherein the memory and the processor are coupled, the memory is used to store a computer program, and when the processor executes and calls the computer program, the electronic device executes a virtual system operation method provided in any possible implementation of the first aspect.
[0021] In a third aspect, the present application provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, enables the electronic device to execute a virtual system operation method provided in any possible implementation of the first aspect.
[0022] In a fourth aspect, the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes a virtual system operation method provided in any possible implementation of the first aspect.
[0023] For the description of the beneficial effects of the second to fourth aspects, reference may be made to the description of the beneficial effects in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of a first application running in a virtual system on an electronic device 100 provided by the present application accessing the Internet through a physical network card;
[0025] Figure 2 A system architecture diagram provided for this application;
[0026] Figure 3A-3E A set of schematic diagrams are shown;
[0027] Figure 4A-4D Another set of schematic diagrams is shown;
[0028] Figure 5 A schematic diagram showing network configuration information corresponding to each virtual network card;
[0029] Figure 6 A schematic diagram showing network configuration information corresponding to another virtual network card;
[0030] Fig. 7A A schematic diagram showing updated network configuration information of a virtual network card;
[0031] Figure 7B A schematic diagram showing another type of updated network configuration information of a virtual network card;
[0032] Figure 8 A schematic diagram showing another updated network configuration information of a virtual network card;
[0033] Fig.9A and Fig. 9B A schematic diagram showing how a first application in a virtual system obtains a first Internet access IP address;
[0034] Fig.10 A schematic flow chart of a method for a first application in a virtual system to obtain a first Internet access IP address is shown;
[0035] Fig.11 A schematic diagram showing network configuration information corresponding to each virtual network card;
[0036] Fig.12 Another schematic diagram showing network configuration information corresponding to a virtual network card;
[0037] Figure 13-Figure 16 Another schematic diagram is shown;
[0038] Fig.17 and Fig.18 A schematic diagram showing how a first application in a virtual system obtains a first Internet access IP address;
[0039] Fig.19 A schematic flow chart of another method for a first application in a virtual system to obtain a first Internet access IP address is shown;
[0040] Fig. 20 A flowchart of a virtual system operation method provided in this application;
[0041] Fig.21 Schematic diagram of the electronic device;
[0042] Fig. 22 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0044] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0045] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. A common form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0046] First, the technical terms involved in this application are explained.
[0047] 1. Main system and virtual system
[0048] The main system can be a computer program that manages and controls the hardware resources and software resources on the electronic device. The electronic device can run applications corresponding to the main system on the main system. The electronic device cannot run applications unrelated to the main system on the main system.
[0049] For example, the host system could be operating system, then the electronic device can The electronic device cannot run HarmonyOS applications on the operating system. Run Android applications on the operating system.
[0050] In some embodiments, in order to run applications unrelated to the main system on the electronic device, the electronic device may run a virtual system on the main system based on a virtual machine or a container. The operating system type of the virtual system may be different from the operating system type of the main system. This allows the electronic device to run applications unrelated to the main system in the virtual system, but the applications running in the virtual system need to be related to the virtual system.
[0051] For example, a virtual system can be operating system, then the applications that the electronic device can run on the virtual system need to be Android applications.
[0052] Both the main system and the virtual system can use the hardware resources and software resources on the electronic device. The hardware resources on the electronic device include but are not limited to: CPU, memory, graphics card, sound card, network card, etc. The software resources on the electronic device include but are not limited to: driver, library file, interface file, etc.
[0053] 2. DNS (domain name server) address
[0054] DNS is a server that converts domain names and their corresponding IP addresses.
[0055] The IP address of the application server is usually a long string of numbers, which is difficult to remember. In order to make it easier to remember the IP address of the application server, you can apply for the domain name of the application server and establish a corresponding relationship between the IP address and the domain name of the application server. For example, the domain name of the application server can be "huawei.com".
[0056] Before an application on an electronic device accesses an application server, the electronic device first obtains the URL of the application data that the application needs to access. The URL of the application data can be understood as the storage location or storage path of the application data in the application server. The URL of the application data can be obtained based on the storage location or storage path of the application data in the application server, the domain name of the application server, and the transmission protocol information. For example, the URL of the application data can be "http: / / www.huawei.com.s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn".
[0057] Before the electronic device accesses the application server, the electronic device can obtain the domain name of the application server. In some embodiments, the electronic device can obtain the domain name of the application server from the URL of the application data, and the electronic device can also obtain the domain name of the application server in other ways, which is not limited in this application. Afterwards, the electronic device sends the domain name of the application server to the DNS, and the DNS obtains the IP address of the application server based on the domain name of the application server, and the DNS sends the IP address of the application server to the application. The application can access the application server based on the IP address of the application server, and then obtain the corresponding application data from the application server based on the URL of the application data.
[0058] There are many DNS addresses, and the DNS address may be related to the geographical location of the electronic device and / or the type of operator network used by the electronic device. The geographical location of the electronic device and / or the type of operator network used by the electronic device are different, and the DNS address is also different.
[0059] The geographic location of the electronic device may be a city-level location, or a region-level location within a city.
[0060] In the case where the electronic device supports a data network, the DNS address may be related to the geographic location of the electronic device and the type of operator network used by the electronic device.
[0061] It should be noted that, when the electronic device supports data network, the DNS address may also be only related to the geographical location of the electronic device, and this application does not limit this.
[0062] For example, when the electronic device uses a mobile cellular network and is in a first location, the DNS address is the address of the first DNS. When the electronic device uses a mobile cellular network and is in a second location, the DNS address is the address of the second DNS.
[0063] Exemplarily, the first location may be Beijing, and the second location may be Shanghai.
[0064] Illustratively, the first location may be Haidian District, Beijing, and the second location may be Dongcheng District, Beijing.
[0065] For another example, when the electronic device uses a mobile cellular network and is in the first location, the DNS address is the address of the first DNS. When the electronic device uses a Unicom network and is in the first location, the DNS address is the address of the second DNS.
[0066] Optionally, when the electronic device supports a data network, the DNS address may also be only related to the operator network type used by the electronic device.
[0067] For example, when the electronic device uses a first operator network, the DNS address is the address of the first DNS. When the electronic device uses a second operator network, the DNS address is the address of the second DNS.
[0068] Exemplarily, the first operator network may be China Mobile, and the second operator network may be China Unicom.
[0069] In the case where the electronic device does not support data networks, the DNS address may be associated with the geographic location of the electronic device.
[0070] For example, when the electronic device is in the first position, the DNS address is the address of the first DNS, and when the electronic device is in the second position, the DNS address is the address of the second DNS.
[0071] Exemplarily, the first location may be Beijing, and the second location may be Shanghai.
[0072] Illustratively, the first location may be Haidian District, Beijing, and the second location may be Dongcheng District, Beijing.
[0073] In some embodiments, there can be multiple DNSs at the same location, and there can be multiple DNS addresses at the same location. Among the multiple DNSs, there can be one primary DNS and one or more backup DNSs. After the primary DNS fails, the electronic device can obtain the IP address of the application server through one or more backup DNSs, and then access the application server based on the IP address of the application server and obtain application data, avoiding the situation where there is only one DNS and a failure leads to a failure in obtaining application data.
[0074] 3. Network card and bridge
[0075] Among them, a network card is a device in an electronic device used to receive data, send data, and temporarily store data.
[0076] The types of network cards may include but are not limited to mobile cellular network cards, WiFi network cards, Bluetooth network cards, etc. Among them, the mobile cellular network card is used to receive network data, send network data, and temporarily store network data through the mobile cellular network when the electronic device accesses the Internet through the mobile cellular network. The WiFi network card is used to receive network data, send network data, and temporarily store network data through the WiFi network when the electronic device accesses the Internet through the WiFi network. The Bluetooth network card is used to receive network data, send network data, and temporarily store network data through Bluetooth when the electronic device accesses the Internet through Bluetooth.
[0077] An electronic device may be equipped with one or more types of network cards, or may be equipped with multiple network cards of the same type at the same time.
[0078] In this application, network cards can be divided into physical network cards and virtual network cards. Among them, the physical network card can be a real network card on the electronic device.
[0079] Applications running on the main system can access the Internet through the physical network card to sense the network of the electronic device.
[0080] In some embodiments, a virtual system can be run on an electronic device. The virtual system is isolated from the main system. The virtual system cannot sense the physical network card on the electronic device, and the application in the virtual system cannot access the Internet. In order to enable the application running in the virtual system to access the Internet, it is necessary to set up a virtual network card in the virtual system. The application in the virtual system can establish an association relationship with the physical network card on the electronic device through the virtual network card. Then perceive the network of the electronic device and access the Internet through the network of the electronic device.
[0081] In the present application, the virtual network card in the virtual system can establish an association relationship with the physical network card on the electronic device through the bridge. In other words, the bridge is a channel for the virtual network card in the virtual system to interact with the physical network card on the electronic device. For example, the application in the virtual system can send data to the virtual network card, and the virtual network card sends the data to the bridge, and the bridge sends the data to the physical network card on the electronic device. The physical network card on the electronic device then sends the data through the mobile cellular network / WiFi network / Bluetooth. For another example, the physical network card on the electronic device can receive data through the mobile cellular network / WiFi network / Bluetooth, and the physical network card on the electronic device sends the data to the bridge, and the bridge sends the data to the virtual network card on the virtual system. Through the bridge, the application in the virtual system can access the Internet through the physical network card on the electronic device.
[0082] Figure 1 A schematic diagram of a first application running in a virtual system on an electronic device 100 provided in the present application accessing the Internet through a physical network card.
[0083] like Figure 1 As shown, the virtual system runs in the container of the electronic device 100. A virtual network card is configured in the virtual system.
[0084] A network bridge, a first physical network card, a second physical network card, and a third physical network card are pre-installed outside the container of the electronic device 100. The network card types of the first physical network card, the second physical network card, and the third physical network card may be the same or different.
[0085] Exemplarily, the first physical network card may be a mobile cellular network card, the second physical network card may be a WiFi network card, and the third physical network card may be a Bluetooth network card.
[0086] In order to enable the application in the virtual system to perceive the network status of the electronic device 100, it is necessary to allocate network configuration information to the virtual network card in the virtual system, and the network configuration information is statically configured. The network configuration information can be the network configuration information corresponding to the first physical network card, the network configuration information corresponding to the second physical network card, or the network configuration information corresponding to the third physical network card. And the network configuration information of the virtual network card is fixed.
[0087] For example, Figure 1The network configuration information of the virtual network card may be the network configuration information corresponding to the first physical network card. Then the network perceived by the first application in the virtual system is limited to the mobile cellular network. No matter how the network status of the electronic device 100 changes, the first application in the virtual system can always perceive the mobile cellular network. The IP address "10.0.0.2" in the network configuration information may be the IP address of the first physical network card. The DNS address "1.1.1.1" in the network configuration information may be a preset DNS address.
[0088] The bridge can sense network changes of the electronic device 100. When the mobile cellular network, WiFi network and Bluetooth of the electronic device 100 are all turned on, the bridge can be connected to any one of the first physical network card, the second physical network card and the third physical network card. When the mobile cellular network of the electronic device 100 is turned on, the WiFi network and Bluetooth are all turned off, the bridge can be connected to the first physical network card. When the mobile cellular network of the electronic device 100 is turned off, the WiFi network is turned on, and the Bluetooth is turned off, the bridge can be connected to the second physical network card. When the mobile cellular network of the electronic device 100 is turned off, the WiFi network is turned off, and the Bluetooth is turned on, the bridge can be connected to the third physical network card. In other words, the bridge can dynamically switch to connect to different physical network cards.
[0089] However, no matter which physical network card the bridge is connected to, the network perceived by the first application in the virtual system is limited to the mobile cellular network.
[0090] When the first application in the virtual system needs to access the first application server, the virtual system can determine through the network configuration information of the virtual network card that the first application can access the first application server through the mobile cellular network of the electronic device 100 .
[0091] The first application in the virtual system can send an Internet access request to the virtual network card, and the virtual network card then sends the Internet access request to the bridge. The bridge can send the Internet access request to the physical network card connected thereto based on the connected physical network card.
[0092] When the network bridge is connected to the first physical network card, the network bridge can send an Internet access request of the first application in the virtual system to the first physical network card, and the first physical network card then sends the Internet access request to the first application server.
[0093] When the network bridge is connected to the second physical network card, the network bridge can send the Internet access request of the first application in the virtual system to the second physical network card, and the second physical network card then sends the Internet access request to the first application server.
[0094] When the network bridge is connected to the third physical network card, the network bridge can send the Internet access request of the first application in the virtual system to the third physical network card, and the third physical network card then sends the Internet access request to the first application server.
[0095] Figure 1 The approach shown with static network configuration has the following problems:
[0096] Problem 1: The first application-aware network in the virtual system is always the mobile cellular network. However, the bridge can dynamically switch to connect to different physical network cards based on the network status of the electronic device 100, resulting in inconsistency between the network inside and outside the container.
[0097] When the network bridge is connected to the second physical network card or the third physical network card, the first application in the virtual system accesses the Internet through the WiFi network or Bluetooth of the electronic device 100. However, the first application in the virtual system perceives the mobile cellular network, resulting in inconsistency between the networks inside and outside the container.
[0098] Problem 2: In some embodiments, the first application in the virtual system needs to use a designated network to access the Internet. If the network perceived by the first application in the virtual system is inconsistent with the designated network, it cannot switch to the designated network to access the Internet, resulting in Internet access failure.
[0099] For example, when the first application in the virtual system is an application store, the first application needs to download the application installation package. However, the application installation package can only be downloaded under the WiFi network. If the bridge is also connected to the second physical network card, and the first application in the virtual system senses the mobile cellular network, the virtual system cannot download the application installation package, resulting in Internet access failure.
[0100] Question 3: The network configuration information in the virtual system is statically configured, that is, the IP address of the physical network card and the DNS address of the DNS in the network configuration information are fixed.
[0101] However, the DNS can be changed based on the geographical location of the electronic device 100, or based on the geographical location of the electronic device 100 and the type of operator network used by the electronic device 100, so that the electronic device 100 can use a DNS with faster Internet access speed. However, the DNS address in the virtual system is fixed and cannot be changed, so the applications in the virtual system can only access the DNS based on the fixed DNS address, resulting in the DNS used in the virtual system deviating from the real DNS, which reduces the user's Internet experience.
[0102] Based on the above analysis, the present application provides a virtual system operation method, through which the application within the virtual system can perceive the real network and real DNS address of the electronic device 100, and achieve consistency of the network and DNS address inside and outside the container.
[0103] Figure 2 A system architecture diagram provided for this application.
[0104] like Figure 2 As shown, the electronic device 100 runs a virtual system in the container, and the type of the virtual system is different from the main system of the electronic device 100. For example, the main system of the electronic device 100 may be operating system, a virtual system can be operating system.
[0105] Outside the container, there can be service frameworks, daemons, services, and cross-container communication modules.
[0106] The container may include a first application, a virtual subsystem network service agent module, a virtual network card agent module, a container management service, a container engine, a cross-container communication module and a virtual network card.
[0107] Among them, the service framework is a software framework of system capabilities and interfaces provided by the main system outside the container.
[0108] Services are the software implementations of system capabilities and interfaces provided by the main system outside the container to applications.
[0109] The daemon process is a basic process in the main system outside the container that controls hardware operations, kernel and other underlying devices.
[0110] The cross-container communication module outside the container is used to communicate with the cross-container communication module inside the container, obtain the key information of each physical network card, and send the key information of each physical network card to the cross-container communication module inside the container. The key information of the physical network card includes but is not limited to: the on or off status of the mobile cellular network / WiFi network / Bluetooth, DNS address, bandwidth, routing information, etc.
[0111] The first application in the container needs to match the virtual system. The first application and the virtual system match can mean that the first application and the virtual system are developed by the same developer. For example, when the virtual system is When the operating system is running, the first application may be an Android application.
[0112] The virtual subsystem network service proxy module is used to proxy the management of network priority and provide an ecological interface within the virtual system for the first application. There is no need to implement real services in the virtual system. The implemented virtual services only need to be proxied to services outside the container, so that the first application in the virtual system can use services outside the container.
[0113] The virtual network card proxy module is used to configure a virtual network card in the container that corresponds one-to-one to the physical network card outside the container based on the physical network card outside the container.
[0114] The cross-container communication module in the container is used to communicate with the cross-container communication module outside the container and obtain key information of each physical network card.
[0115] The container management service and container engine within the container are used to implement basic capabilities such as starting, initializing, shutting down and exiting the virtual system within the container.
[0116] Next, Embodiment 1 and Embodiment 2 describe in detail a virtual system operation method provided by the present application.
[0117] Embodiment 1
[0118] A virtual system operation method provided in implementation one includes but is not limited to the following steps: creating a virtual network card corresponding to a physical network card, obtaining network configuration information of the virtual network card, and a first application in the virtual system obtaining a first Internet access IP address.
[0119] A network bridge corresponding to the physical network card is created based on the physical network card, and a virtual network card corresponding to the physical network card is created in the virtual system.
[0120] One or more types of physical network cards may be configured on the electronic device 100. Multiple physical network cards of the same type may also be configured on the electronic device at the same time.
[0121] Exemplarily, if the electronic device 100 supports a mobile cellular network, a WiFi network, and Bluetooth, the electronic device 100 may be configured with a first physical network card corresponding to the mobile cellular network, a second physical network card corresponding to the WiFi network, and a third physical network card corresponding to Bluetooth.
[0122] The electronic device 100 needs to be configured with three bridges, for example, a first bridge, a second bridge and a third bridge.
[0123] Among them, the first network bridge corresponds to the first physical network card one-to-one, the second network bridge corresponds to the second physical network card one-to-one, and the third network bridge corresponds to the third physical network card one-to-one.
[0124] When the Internet access function corresponding to the physical network card is turned on, the physical network card can be connected to the corresponding network bridge. When the Internet access function corresponding to the physical network card is turned off, the physical network card can be disconnected from the corresponding network bridge.
[0125] For example, Figure 3A As described above, when the mobile cellular network, WiFi network and Bluetooth of the electronic device 100 are all turned on, the first bridge is connected to the first physical network card, the second bridge is connected to the second physical network card, and the third bridge is connected to the third physical network card.
[0126] For example, Figure 3B As described above, when the mobile cellular network, WiFi network and Bluetooth of the electronic device 100 are all turned off, the first network bridge is disconnected from the first physical network card, the second network bridge is disconnected from the second physical network card, and the third network bridge is disconnected from the third physical network card.
[0127] For example, Figure 3C As described above, when the mobile cellular network of the electronic device 100 is turned on and the WiFi network and Bluetooth are turned off, the first network bridge is connected to the first physical network card, the second network bridge is disconnected from the second physical network card, and the third network bridge is disconnected from the third physical network card.
[0128] For example, Figure 3D As described above, when the mobile cellular network of the electronic device 100 is turned off and the WiFi network and Bluetooth are turned on, the first bridge is disconnected from the first physical network card, the second bridge is connected to the second physical network card, and the third bridge is connected to the third physical network card.
[0129] For example, Figure 3E Described, when the mobile cellular network and WiFi network of the electronic device 100 are turned off and Bluetooth is turned on, the first bridge is disconnected from the first physical network card, the second bridge is disconnected from the second physical network card, and the third bridge is connected to the third physical network card.
[0130] When there are three physical network cards outside the container, three virtual network cards corresponding to the three physical network cards need to be created in the container. For example, the three virtual network cards are the first virtual network card, the second virtual network card, and the third virtual network card.
[0131] Among them, the first virtual network card is connected to the first network bridge, the second virtual network card is connected to the second network bridge, and the third virtual network card is connected to the third network bridge.
[0132] In this way, a correspondence is established between the first virtual network card and the first physical network card, a correspondence is established between the second virtual network card and the second physical network card, and a correspondence is established between the third virtual network card and the third physical network card.
[0133] The first virtual network card is used to inform the first application that the first application can access the Internet through the mobile cellular network. The second virtual network card is used to inform the first application that the first application can access the Internet through the WiFi network. The third virtual network card is used to inform the first application that the first application can access the Internet through Bluetooth.
[0134] In this way, multiple Internet access methods outside the container of the electronic device 100 can be mapped to the container through multiple virtual network cards and bridges, so that applications in the virtual system can perceive the status of multiple networks outside the container and network changes.
[0135] Optional, in Figure 3B In the case where the first network bridge is disconnected from the first physical network card, the second network bridge is disconnected from the second physical network card, and the third network bridge is disconnected from the third physical network card, as Figure 4A As shown, the first network bridge may also be disconnected from the first virtual network card, the second network bridge may also be disconnected from the second virtual network card, and the third network bridge may also be disconnected from the third virtual network card, thereby indicating that the first application in the virtual system cannot access the Internet.
[0136] Optional, in Figure 3C In the case where the second network bridge is disconnected from the second physical network card and the third network bridge is disconnected from the third physical network card, Figure 4B As shown, the second network bridge can also be disconnected from the second virtual network card, and the third network bridge can also be disconnected from the third virtual network card. This indicates that the first application in the virtual system cannot access the Internet through the WiFi network and Bluetooth, but can access the Internet through the mobile cellular network.
[0137] Optional, in Figure 3D In the case where the first network bridge is disconnected from the first physical network card, Figure 4C As shown, the first network bridge can also be disconnected from the first virtual network card. This indicates that the first application in the virtual system cannot access the Internet through the mobile cellular network. This indicates that the first application in the virtual system cannot access the Internet through the mobile cellular network, but can access the Internet through the WiFi network and Bluetooth.
[0138] Optional, in Figure 3E In the case where the first network bridge is disconnected from the first physical network card and the second network bridge is disconnected from the second physical network card, Figure 4D As shown, the first network bridge can also be disconnected from the first virtual network card, and the second network bridge can also be disconnected from the second virtual network card. This indicates that the first application in the virtual system cannot access the Internet through the mobile cellular network and WiFi network, but can access the Internet through Bluetooth.
[0139] It should be noted that this application only uses three physical network cards as an example for explanation. In other embodiments, more or fewer physical network cards may be included, and this application does not limit this.
[0140] Get the network configuration information of the virtual network card.
[0141] The network configuration information of the virtual network card includes key information of the physical network card corresponding to the virtual network card.
[0142] In some embodiments, the network configuration information may also include the IP address of the bridge corresponding to the virtual network card, which is not limited in this application.
[0143] The key information of the physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the physical network card, the on / off status of the Internet access method corresponding to the physical network card, the IP address of the physical network card, the bandwidth of the Internet access method corresponding to the physical network card, the route of the Internet access method corresponding to the physical network card, the DNS address, etc. Among them, the DNS address may be determined based on the type of mobile cellular network used by the electronic device 100 and / or the geographical location of the electronic device 100. The operator network types include but are not limited to China Mobile, China Unicom, and China Telecom.
[0144] The key information of different physical network cards is different.
[0145] The key information of the first physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the first physical network card, the on / off state of the Internet access method corresponding to the first physical network card, the IP address of the first physical network card, the bandwidth of the Internet access method corresponding to the first physical network card, the route of the Internet access method corresponding to the first physical network card, the first DNS address, etc. For example, the Internet access method corresponding to the first physical network card may be a mobile cellular network, and the on / off state of the Internet access method corresponding to the first physical network card may be the on / off state of the mobile cellular network.
[0146] The key information of the second physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the second physical network card, the on / off state of the Internet access method corresponding to the second physical network card, the IP address of the second physical network card, the bandwidth of the Internet access method corresponding to the second physical network card, the route of the Internet access method corresponding to the second physical network card, the first DNS address, etc. For example, the Internet access method corresponding to the second physical network card may be a WiFi network, and the on / off state of the Internet access method corresponding to the second physical network card may be the on / off state of the WiFi network.
[0147] The key information of the third physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the third physical network card, the on / off state of the Internet access method corresponding to the third physical network card, the IP address of the third physical network card, the bandwidth of the Internet access method corresponding to the third physical network card, the route of the Internet access method corresponding to the third physical network card, the first DNS address, etc. For example, the Internet access method corresponding to the third physical network card may be Bluetooth, and the on / off state of the Internet access method corresponding to the third physical network card may be the on / off state of Bluetooth.
[0148] The IP addresses of different bridges are different. For example, the IP address of the first bridge, the IP address of the second bridge, and the IP address of the third bridge are different from each other.
[0149] The network configuration information of the virtual network card can be obtained based on the IP address of the network bridge corresponding to the virtual network card and the key information of the physical network card corresponding to the virtual network card.
[0150] For example, the electronic device 100 may obtain the network configuration information of the first virtual network card based on the key information of the first physical network card and the IP address of the first network bridge.
[0151] The electronic device 100 can obtain the network configuration information of the second virtual network card based on the key information of the second physical network card and the IP address of the second network bridge.
[0152] The electronic device 100 can obtain the network configuration information of the third virtual network card based on the key information of the third physical network card and the IP address of the third network bridge.
[0153] After obtaining the network configuration information of each virtual network card, the electronic device 100 sends the network configuration information of each virtual network card to the virtual system, so that the virtual system can obtain the network configuration information corresponding to each virtual network card.
[0154] Optionally, the DNS address may change with the geographical location of the electronic device 100 and / or the operator network used by the electronic device 100, so the key information of the physical network card may also change. The electronic device 100 may periodically / irregularly update the network configuration information of the virtual network card and send the updated network configuration information to the corresponding virtual network card, so that the virtual network card obtains the latest network configuration information.
[0155] Figure 5 A schematic diagram showing network configuration information corresponding to each virtual network card is shown.
[0156] Figure 5 Only part of the network configuration information corresponding to each virtual network card is shown, such as the IP address and DNS address corresponding to the virtual network card.
[0157] like Figure 5 As shown, the network configuration information corresponding to the first virtual network card may include: the IP address "192.168.2.0" and the DNS address "8.8.8.8" of the first virtual network card.
[0158] like Figure 5 As shown, the network configuration information corresponding to the second virtual network card may include: the IP address "192.168.2.1" and the DNS address "8.8.8.8" of the second virtual network card.
[0159] like Figure 5 As shown, the network configuration information corresponding to the third virtual network card may include: the IP address "192.168.2.2" and the DNS address "8.8.8.8" of the third virtual network card.
[0160] The DNS address “8.8.8.8” may be the address of the first DNS. The address of the first DNS may be determined by the electronic device 100 based on the first operator network used by the electronic device 100 and / or the first geographical location of the electronic device 100.
[0161] Optionally, the address of the first DNS may be determined based on the first operator network.
[0162] Optionally, the address of the first DNS may be determined based on the first operator network and the first geographical location of the electronic device 100 .
[0163] Optionally, the address of the first DNS may be determined based on the first geographical location.
[0164] In some embodiments, there can be multiple DNSs determined based on the first operator network used by the electronic device 100 and / or the first geographic location of the electronic device 100. The electronic device 100 can obtain the addresses of multiple DNSs and, based on the addresses of multiple DNSs, obtain the network configuration information of each virtual network card, so that applications within the virtual system can obtain Internet access IP addresses based on multiple DNSs, avoiding the situation where there is only one DNS and a failure occurs, resulting in a failure to obtain an Internet access IP address.
[0165] Optionally, when the DNS addresses of multiple DNSs are obtained, the electronic device 100 can divide the multiple DNSs into a primary DNS and a backup DNS. The speed at which the electronic device 100 obtains the Internet access IP address from the primary DNS is greater than the speed at which the electronic device 100 obtains the Internet access IP address from the backup DNS. For example, the electronic device 100 can divide the multiple DNSs into a primary DNS and a backup DNS based on the distance relationship between the multiple DNSs and the electronic device 100. When an application in the virtual system accesses the Internet, it is preferred to access the Internet based on the primary DNS address, and can access the Internet based on the backup DNS when the primary DNS is unavailable.
[0166] Figure 6 A schematic diagram showing network configuration information corresponding to another virtual network card.
[0167] Figure 6 It also only shows part of the network configuration information corresponding to each virtual network card, such as the IP address and DNS address corresponding to the virtual network card.
[0168] like Figure 6 As shown, the network configuration information corresponding to the first virtual network card may include: the IP address of the first virtual network card "192.168.2.0", the primary DNS address "8.8.8.8", and the backup DNS address "8.8.4.4".
[0169] like Figure 6 As shown, the network configuration information corresponding to the second virtual network card may include: the IP address of the second virtual network card "192.168.2.1", the primary DNS address "8.8.8.8", and the backup DNS address "8.8.4.4".
[0170] like Figure 6 As shown, the network configuration information corresponding to the third virtual network card may include: the IP address of the third virtual network card "192.168.2.2", the primary DNS address "8.8.8.8", and the backup DNS address "8.8.4.4".
[0171] Among them, the DNS address "8.8.8.8" may be the address of the first DNS, which may also be called the primary DNS, and the DNS address "8.8.4.4" may be the address of the backup DNS.
[0172] Not limited to one backup DNS, the electronic device 100 can also obtain the DNS addresses of multiple backup DNSs, which is not limited in this application.
[0173] When the geographical location of the electronic device 100 changes and / or the operator network used by the electronic device 100 changes, the electronic device 100 needs to update the network configuration information of each virtual network card and send the updated network configuration information to each virtual network card so that the virtual system can obtain the latest network configuration information.
[0174] The DNS address is related to the geographical location of the electronic device 100 and / or the type of network operator used by the electronic device 100. When the geographical location of the electronic device 100 and / or the type of network operator used by the electronic device 100 changes, the DNS address will also change, causing the key information of the physical network card to change, and then causing the network configuration information of the virtual network card to change.
[0175] In some embodiments, the DNS address may change based on the geographic location of the electronic device 100 .
[0176] For example, the geographical location of the electronic device 100 changes from the first geographical location to the second geographical location, and the DNS switches from the first DNS to the second DNS, then the DNS address changes from the address of the first DNS to the address of the second DNS.
[0177] In some embodiments, the DNS address may vary based on the type of carrier network being used.
[0178] For example, the electronic device 100 switches from the first operator network to the second operator network, and the DNS switches from the first DNS to the second DNS, then the DNS address changes from the address of the first DNS to the address of the second DNS.
[0179] Exemplarily, the first operator network may be a mobile cellular network, and the second operator network may be a China Unicom network.
[0180] In some embodiments, the DNS address may vary based on the geographic location of the electronic device 100 and the type of carrier network used by the electronic device 100 .
[0181] For example, the electronic device 100 switches from the first operator network to the second operator network, the electronic device 100 is still in the first geographical location, and the DNS switches from the first DNS to the second DNS, then the DNS address changes from the address of the first DNS to the address of the second DNS.
[0182] For another example, the electronic device 100 switches from the first geographical location to the second geographical location, the operator network used by the electronic device 100 is still the first operator network, and the DNS is switched from the first DNS to the second DNS, then the DNS address changes from the address of the first DNS to the address of the second DNS.
[0183] For another example, the electronic device 100 switches from a first geographical location to a second geographical location, the operator network used by the electronic device 100 switches from a first operator network to a second operator network, and the DNS switches from a first DNS to a second DNS, then the DNS address changes from the address of the first DNS to the address of the second DNS.
[0184] The first geographical location is different from the second geographical location, and the first operator network is different from the second operator network.
[0185] In some embodiments, after the electronic device 100 determines that the DNS address has changed, for example, from the first DNS address to the second DNS address, the IP address of the physical network card, the IP address of the bridge, and the IP address of the virtual network card have not changed, and the electronic device 100 only needs to send the second DNS address to the virtual network card. The virtual network card can obtain updated network configuration information based on the second DNS address.
[0186] In other embodiments, after the electronic device 100 determines that the DNS address has changed, for example, from the first DNS address to the second DNS address, the electronic device 100 can obtain updated network configuration information based on the second DNS address, and the electronic device 100 then sends the updated network configuration information to the virtual network card, so that the virtual network card can obtain the updated network configuration information.
[0187] Fig. 7A A schematic diagram showing updated network configuration information of a virtual network card is shown.
[0188] Fig. 7A Only part of the updated network configuration information corresponding to each virtual network card is shown, such as the IP address of the bridge corresponding to the virtual network card, the IP address of the physical network card corresponding to the virtual network card, and the DNS address.
[0189] like Fig. 7A As shown, the updated network configuration information corresponding to the first virtual network card may include: the IP address "192.168.2.0" and the DNS address "7.7.7.7" of the first virtual network card.
[0190] like Fig. 7A As shown, the updated network configuration information corresponding to the second virtual network card may include: the IP address "192.168.2.0" and the DNS address "7.7.7.7" of the first virtual network card.
[0191] like Fig. 7A As shown, the updated network configuration information corresponding to the third virtual network card may include: the IP address "192.168.2.0" and the DNS address "7.7.7.7" of the first virtual network card.
[0192] The DNS address “7.7.7.7” may be the address of the second DNS. The address of the second DNS may be determined by the electronic device 100 based on the second operator network used by the electronic device 100 and / or the second geographical location of the electronic device 100.
[0193] Figure 7B A schematic diagram showing another type of updated network configuration information of a virtual network card is shown.
[0194] Figure 7B Only part of the updated network configuration information corresponding to each virtual network card is shown, such as the IP address of the bridge corresponding to the virtual network card, the IP address of the physical network card corresponding to the virtual network card, and the DNS address.
[0195] like Figure 7B As shown, the updated network configuration information corresponding to the first virtual network card may include: the IP address of the first virtual network card "192.168.2.0", the primary DNS address "7.7.7.7", and the backup DNS address "7.7.4.4".
[0196] like Figure 7B As shown, the updated network configuration information corresponding to the second virtual network card may include: the IP address "192.168.2.0" of the first virtual network card, the primary DNS address "7.7.7.7", and the backup DNS address "7.7.4.4".
[0197] like Figure 7B As shown, the updated network configuration information corresponding to the third virtual network card may include: the IP address "192.168.2.0" of the first virtual network card, the primary DNS address "7.7.7.7", and the backup DNS address "7.7.4.4".
[0198] The primary DNS address "7.7.7.7" may be the address of the second DNS, and the backup DNS address "7.7.4.4" may be the address of the fourth DNS. The address of the second DNS and the address of the fourth DNS may be determined by the electronic device 100 based on the second operator network used by the electronic device 100 and / or the second geographical location of the electronic device 100.
[0199] Based on this method, the virtual system can timely update the network configuration information of the virtual network card, so that the virtual network card can perceive the real DNS, and the applications in the virtual system can match the DNS address in the network configuration information to obtain the nearest DNS of the Internet IP address, so as to improve the Internet speed of the applications in the virtual system.
[0200] Optional, such as Figure 8As shown in the figure, when the LAN IP address is used in the virtual system and the public IP address is used outside the virtual system, the bridge also needs to store the correspondence between the IP address of the virtual network card and the IP address of the physical network card. Because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the LAN IP address needs to be changed to the public IP address at the bridge to avoid failure in obtaining the Internet IP address.
[0201] Table 1
[0202] Virtual network card identifier IP address of the virtual network card Physical network card ID IP address of the physical network card First virtual network card 192.168.2.0 First physical network card 10.1.1.0 Second virtual network card 192.168.2.1 Second physical network card 10.1.1.1 The third virtual network card 192.168.2.2 The third physical network card 10.1.1.2
[0203] Table 1 shows the correspondence between the IP address of the virtual network card stored at the bridge and the IP address of the physical network card.
[0204] Among them, the IP address of the first virtual network card is "192.168.2.0", the first virtual network card corresponds to the first physical network card, and the IP address of the first physical network card is "10.1.1.0".
[0205] The IP address of the second virtual network card is "192.168.2.1". The second virtual network card corresponds to the second physical network card, and the IP address of the second physical network card is "10.1.1.1".
[0206] The IP address of the third virtual network card is "192.168.2.2". The third virtual network card corresponds to the third physical network card, and the IP address of the third physical network card is "10.1.1.2".
[0207] Optionally, it is not limited to storing the correspondence between the IP address of the virtual network card and the IP address of the physical network card at the bridge, but the correspondence between the IP address of the virtual network card and the IP address of the physical network card can also be stored at the physical network card, and the physical network card can modify the LAN IP address to the public IP address. This application does not limit this.
[0208] In other embodiments, if a public IP address is used in the virtual system, then the correspondence between the IP address of the virtual network card and the IP address of the physical network card does not need to be stored at the bridge, and the LAN IP address does not need to be modified to a public IP address.
[0209] The first application in the virtual system obtains the first Internet access IP address.
[0210] Fig.9A and Fig. 9B The diagram shows how the first application in the virtual system obtains the first Internet access IP address.
[0211] Before the first application in the virtual system accesses the Internet, the first application needs to obtain an Internet access IP address from the DNS server. When the first application determines to access the Internet through the first Internet access method, the virtual system can determine whether the first Internet access method is available from multiple Internet access methods. If available, the virtual system determines the virtual network card corresponding to the first Internet access method. The first application can generate a third DNS data packet based on the network configuration information of the virtual network card corresponding to the first Internet access method, and the third DNS data packet is used to obtain the first Internet access IP address.
[0212] Specifically, Fig.9A As shown, before the first application in the virtual system accesses the Internet, it is necessary to obtain the first Internet access IP address. Before obtaining the first Internet access IP address, the virtual system can determine the first Internet access method of the first application. The first application can determine to access the Internet through the first virtual network card from among multiple virtual network cards based on the first Internet access method.
[0213] For example, the first Internet access is Internet access through a mobile cellular network. The virtual system can determine that the Internet access method corresponding to the first virtual network card is a mobile cellular network. The virtual system can determine that the first application accesses the Internet through the first virtual network card.
[0214] For another example, the first Internet access is Internet access through a WiFi network. The virtual system can determine that the Internet access method corresponding to the second virtual network card is a WiFi network. The virtual system can determine that the first application accesses the Internet through the second virtual network card.
[0215] Through the virtual system operation method provided in the present application, the virtual system can perceive the real network outside the container and select the corresponding network to access the Internet as needed.
[0216] Exemplarily, when the first application determines to access the Internet through the first virtual network card, before the first application obtains the first Internet access data through the first virtual network card, the first application can obtain the first Internet access IP address, and then obtain the first Internet access data based on the first Internet access IP address.
[0217] First, the virtual system needs to generate a third DNS data packet based on the first Internet access request, and the third DNS data packet is used to obtain the first Internet access IP address. The third DNS data packet may include multiple fields, such as a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0218] The source IP address field is used to indicate the source address of the third DNS data packet, the destination IP address field is used to indicate the destination address of the third DNS data packet, and the PAYLOAD field is used to indicate the function of the third DNS data packet.
[0219] For example, the source IP address field can be filled with the IP address "192.168.2.0" of the first virtual network card, the destination IP address field can be filled with the IP address "8.8.8.8" of the first DNS, the source port field can be filled with "65535", the destination port field can be filled with "53", and the PAYLOAD field can be filled with a request message, which can include a first domain name, the first domain name corresponds to a first Internet IP address, and the first DNS stores the correspondence between the first domain name and the first Internet IP address.
[0220] The first virtual network card can obtain the third DNS data packet and send the third DNS data packet to the first network bridge outside the container.
[0221] After the first network bridge obtains the third DNS data packet, when the source IP address in the third DNS data packet is a LAN IP address, the first network bridge needs to modify the source IP address in the third DNS data packet to the IP address "10.1.1.0" of the first physical network card. The IP address "10.1.1.0" of the first physical network card can be a public IP address, so that the first DNS can identify the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address through the public IP address.
[0222] For example, the first bridge may generate based on the third DNS packet Fig.9A The fourth DNS packet shown in the figure is sent to the first physical network card. The first physical network card can send the fourth DNS packet to the first DNS based on the destination IP address in the fourth DNS packet, so that the first DNS can obtain the first Internet access IP address based on the first domain name in the fourth DNS packet.
[0223] After the first DNS obtains the first Internet IP address based on the first domain name in the fourth DNS data packet, the first DNS can generate a first response data packet based on the first Internet IP address, the source IP address in the fourth DNS data packet, the destination IP address in the fourth DNS data packet, the source port in the fourth DNS data packet, and the destination port in the fourth DNS data packet, and the first DNS then sends the first response data packet to the first physical network card.
[0224] The first response data packet may include multiple fields, such as a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0225] like Fig. 9BAs shown, the source IP address field in the first response data packet can be filled with the IP address "8.8.8.8" of the first DNS, the destination IP address field can be filled with the IP address "10.1.1.0" of the first physical network card, the source port field can be filled with "53", the destination port field can be filled with "65535", the PAYLOAD field can be filled with the response message, and the request message can include the first Internet access IP address.
[0226] After receiving the first response data packet sent by the first DNS, the first physical network card sends the first response data packet to the first network bridge.
[0227] After receiving the first response data packet, the first bridge needs to modify the destination IP address in the first response data packet to the IP address "192.168.2.0" of the first virtual network card to obtain a second response data packet. The IP address "192.168.2.0" of the first virtual network card can be a local area network IP address, so that the virtual system can identify the local area network IP address and send the obtained first Internet access IP address to the first application in the virtual system.
[0228] according to Fig.9A and Fig. 9B In the embodiment, the first application in the virtual system can obtain the first Internet access IP address, and obtain the first Internet access data based on the first Internet access IP address.
[0229] Fig.10 A schematic flow chart of a method for a first application in a virtual system to obtain a first Internet access IP address is shown.
[0230] S1001. A first virtual network card is associated with a first network bridge.
[0231] S1002. The first network bridge and the first physical network card are connected to each other.
[0232] S1003. The second virtual network card is associated with the second network bridge.
[0233] S1004. The second network bridge is connected to the second physical network card.
[0234] S1005. The third virtual network card is associated with the third network bridge.
[0235] S1006. The third network bridge and the third physical network card are connected to each other.
[0236] One or more types of physical network cards may be configured on the electronic device 100. Multiple physical network cards of the same type may also be configured on the electronic device at the same time.
[0237] Exemplarily, if the electronic device 100 supports a mobile cellular network, a WiFi network, and Bluetooth, the electronic device 100 may be configured with a first physical network card corresponding to the mobile cellular network, a second physical network card corresponding to the WiFi network, and a third physical network card corresponding to Bluetooth.
[0238] In order to make the applications in the container aware of the real network outside the container, it is necessary to create a virtual network card in the container that corresponds to the physical network card.
[0239] The number of virtual network cards needs to be the same as the number of physical network cards. For example, the electronic device 100 needs to create a first virtual network card, a second virtual network card, and a third virtual network card in the virtual system.
[0240] Among them, the first virtual network card corresponds to the first physical network card, the second virtual network card corresponds to the second physical network card, and the third virtual network card corresponds to the third physical network card.
[0241] In order to enable the virtual network card in the container to transmit data with the physical network card outside the container, a bridge needs to be pre-installed outside the container. The bridge can realize communication between the virtual network card in the container and the physical network card outside the container.
[0242] The number of bridges is the same as the number of physical network cards. For example, a first bridge, a second bridge, and a third bridge may be pre-installed outside the container, wherein the first bridge corresponds to the first physical network card, the second bridge corresponds to the second physical network card, and the third bridge corresponds to the third physical network card.
[0243] The first virtual network card is associated with the first network bridge, and the first network bridge can be connected to the first physical network card. The first virtual network card can communicate with the first physical network card through the first network bridge.
[0244] The second virtual network card is associated with the second network bridge, and the second network bridge can be connected to the second physical network card. The second virtual network card can communicate with the second physical network card through the second network bridge.
[0245] The third virtual network card is associated with a third network bridge, and the third network bridge can be connected to a third physical network card. The third virtual network card can communicate with the third physical network card through the third network bridge.
[0246] S1007. The first virtual network card corresponds to first network configuration information.
[0247] S1008. The second virtual network card corresponds to the second network configuration information.
[0248] S1009. The third virtual network card corresponds to the third network configuration information.
[0249] After the electronic device 100 creates a virtual network card in the container, it is necessary to obtain the network configuration information of the virtual network card. The network configuration information of the virtual network card may include but is not limited to one or more of the following: the Internet access method corresponding to the physical network card, the on / off status of the Internet access method corresponding to the physical network card, the IP address of the physical network card, the bandwidth of the Internet access method corresponding to the physical network card, the route of the Internet access method corresponding to the physical network card, the IP address of the bridge, the DNS address, etc. Among them, the DNS address can be determined based on the type of mobile cellular network used by the electronic device 100 and / or the geographical location of the electronic device 100. Operator network types include but are not limited to mobile, Unicom and Telecom.
[0250] The network configuration information of the virtual network card is not displayed.
[0251] For example, the key information of the first physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the first physical network card, the on / off state of the Internet access method corresponding to the first physical network card, the IP address of the first physical network card, the bandwidth of the Internet access method corresponding to the first physical network card, the route of the Internet access method corresponding to the first physical network card, the IP address of the first bridge, the first DNS address or the first DNS address and the third DNS address, etc. For example, the Internet access method corresponding to the first physical network card may be a mobile cellular network, and the on / off state of the Internet access method corresponding to the first physical network card may be the on / off state of the mobile cellular network.
[0252] The key information of the second physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the second physical network card, the on / off state of the Internet access method corresponding to the second physical network card, the IP address of the second physical network card, the bandwidth of the Internet access method corresponding to the second physical network card, the route of the Internet access method corresponding to the second physical network card, the IP address of the second bridge, the first DNS address or the first DNS address and the third DNS address, etc. For example, the Internet access method corresponding to the second physical network card may be a WiFi network, and the on / off state of the Internet access method corresponding to the second physical network card may be the on / off state of the WiFi network.
[0253] The key information of the third physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the third physical network card, the on / off state of the Internet access method corresponding to the third physical network card, the IP address of the third physical network card, the bandwidth of the Internet access method corresponding to the third physical network card, the route of the Internet access method corresponding to the third physical network card, the IP address of the third bridge, the first DNS address or the first DNS address and the third DNS address, etc. For example, the Internet access method corresponding to the third physical network card may be Bluetooth, and the on / off state of the Internet access method corresponding to the third physical network card may be the on / off state of Bluetooth.
[0254] The network configuration information of different virtual network cards is used by the first application installed in the virtual system to determine whether the network of the virtual network card is available and determine the DNS address used to obtain the Internet IP address before the first application installed in the virtual system goes online based on the network configuration information of the virtual network card.
[0255] S1010. The first network bridge / the second network bridge / the third network bridge stores a mapping relationship between the IP address of the virtual network card and the IP address of the physical network card.
[0256] Optionally, when the LAN IP address is used in the virtual system and the public IP address is used outside the virtual system, the bridge also needs to store the correspondence between the IP address of the virtual network card and the IP address of the physical network card. Because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to modify the LAN IP address to the public IP address to avoid failure in obtaining the Internet IP address.
[0257] Specifically, the first network bridge stores a mapping relationship between the IP address of the first virtual network card and the IP address of the first physical network card.
[0258] The second network bridge stores a mapping relationship between the IP address of the second virtual network card and the IP address of the second physical network card.
[0259] The third network bridge stores a mapping relationship between the IP address of the third virtual network card and the IP address of the third physical network card.
[0260] Optionally, when the IP address of the virtual network card in the container is also a public network IP address, the network bridge may not store the mapping relationship between the IP address of the virtual network card and the IP address of the physical network card, that is, S1010 is not executed.
[0261] S1011. The first application determines to access the Internet through a first virtual network card based on a first Internet access method.
[0262] When the first application needs to access the Internet, for example, needs to obtain first Internet access data, the first application can determine a first Internet access method, and then determine a first virtual network card from multiple virtual network cards based on the first Internet access method, and access the Internet through the first virtual network card.
[0263] Optionally, the first Internet access method may be preset by the first application, may be selected by the user, or may be a system default, which is not limited in the present application.
[0264] For example, when the first application is an application store and the first Internet access data is an application installation package, the first application needs to download the application installation package through a WiFi network, so the first Internet access method can be a WiFi network. If the second virtual network card corresponds to a WiFi network Internet access method, the first application can determine to access the Internet through the first virtual network card.
[0265] In other possible implementations,
[0266] S1012. The first application generates a third DNS data packet based on the first network configuration information of the first virtual network card.
[0267] The third DNS data packet may include multiple fields, such as but not limited to a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0268] When the first application determines to access the Internet through the first virtual network card, the first application can obtain the first network configuration information of a virtual network card, and obtain the attribute values of multiple fields from the first network configuration information of the virtual network card to obtain a third DNS data packet. The third DNS data packet is used by the first DNS to obtain the first Internet access IP address.
[0269] For example, Fig.9A As shown, the source IP address field in the third DNS data packet can be filled with the IP address "192.168.2.0" of the first virtual network card, the destination IP address field can be filled with the IP address "8.8.8.8" of the first DNS, the source port field can be filled with "65535", the destination port field can be filled with "53", and the PAYLOAD field can be filled with a request message, which can include a first domain name, the first domain name corresponds to a first Internet access IP address, and the first DNS stores the correspondence between the first domain name and the first Internet access IP address.
[0270] S1013. The first application sends the third DNS data packet to the first virtual network card.
[0271] S1014. The first virtual network card sends the third DNS data packet to the first network bridge.
[0272] After the first application generates the third DNS data packet, the first application sends the third DNS data packet to the first virtual network card, and the first virtual network card then sends the third DNS data packet to the first network bridge.
[0273] S1015. The first network bridge modifies the IP address of the first virtual network card in the third DNS data packet to the IP address of the first physical network card to obtain a fourth DNS data packet.
[0274] After the first network bridge obtains the third DNS data packet, if the source IP address in the third DNS data packet is a local area network IP address, the first network bridge needs to modify the source IP address in the third DNS data packet to the IP address "10.1.1.0" of the first physical network card, and the IP address "10.1.1.0" of the first physical network card can be a public network IP address. In this way, the first DNS can identify the public network IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public network IP address through the public network IP address.
[0275] Optionally, in other embodiments, if the source IP address in the third DNS data packet is a public IP address, the first bridge may not modify the source IP address in the third DNS data packet to the IP address "10.1.1.0" of the first physical network card, that is, S1015 is not executed.
[0276] S1016. The first network bridge sends the fourth DNS data packet to the first physical network card.
[0277] S1017. The first physical network card sends the fourth DNS data packet to the first DNS.
[0278] After receiving the first physical network card, the first physical network card can obtain the destination IP address "8.8.8.8" from the fourth DNS data packet, and the first physical network card can send the fourth DNS data packet to the DNS server based on the destination IP address "8.8.8.8".
[0279] Exemplarily, the destination IP address "8.8.8.8" may be the IP address of the first DNS, and the DNS may be the first DNS.
[0280] S1018. In response to the fourth DNS data packet, the first DNS obtains the first Internet access IP address based on the first domain name.
[0281] S1019. The first DNS generates a first response data packet of four DNS data packets based on the first Internet access IP address.
[0282] In response to the fourth DNS data packet, the first DNS can obtain the first domain name from the PAYLOAD field of the fourth DNS data packet. The first DNS stores the correspondence between the first domain name and the first Internet IP address. The first DNS can obtain the first Internet IP address based on the first domain name.
[0283] The first response data packet may include multiple fields, such as a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0284] After the first DNS obtains the first Internet IP address based on the first domain name in the fourth DNS data packet, the first DNS can generate a first response data packet based on the first Internet IP address, the source IP address in the fourth DNS data packet, the destination IP address in the fourth DNS data packet, the source port in the fourth DNS data packet, and the destination port in the fourth DNS data packet.
[0285] like Fig. 9B As shown, the source IP address field in the first response data packet can be filled with the IP address "8.8.8.8" of the first DNS, the destination IP address field can be filled with the IP address "10.1.1.0" of the first physical network card, the source port field can be filled with "53", the destination port field can be filled with "65535", the PAYLOAD field can be filled with the response message, and the request message can include the first Internet access IP address.
[0286] S1020. The first DNS sends a first response data packet to the first physical network card.
[0287] S1021. The first physical network card sends a first response data packet to the first network bridge.
[0288] S1022. The first network bridge modifies the IP address of the first physical network card in the first response data packet to the IP address of the first virtual network card to obtain a second response data packet.
[0289] like Fig. 9B As shown, after the first physical network card receives the first response data packet sent by the first DNS, the first physical network card sends the first response data packet to the first network bridge. After the first network bridge receives the first response data packet, the first network bridge needs to modify the destination IP address in the first response data packet to the IP address "192.168.2.0" of the first virtual network card to obtain a second response data packet. The IP address "192.168.2.0" of the first virtual network card can be a local area network IP address, so that the virtual system can identify the local area network IP address and send the obtained first Internet access IP address to the first application in the virtual system.
[0290] Optionally, when the IP address of the virtual network card in the container is also a public IP address, the bridge may not modify the IP address of the first physical network card in the first response data packet to the IP address of the first virtual network card, that is, S1022 is not executed.
[0291] S1023. The first network bridge sends the second response data packet to the first virtual network card.
[0292] S1024. The first virtual network card sends the second response data packet to the first application.
[0293] S1025. The first application obtains the first Internet access IP address from the second response data packet.
[0294] After the first network bridge obtains the second response data packet based on the second response data packet, the first network bridge sends the second response data packet to the first virtual network card. The first virtual network card then sends the second response data packet to the first application. The first application can obtain the first Internet access IP address from the PAYLOAD field of the second response data packet.
[0295] After the first application obtains the first Internet access IP address, the first application can obtain the first Internet access data based on the first Internet access IP address, thereby realizing the process of the first application accessing the Internet through the first virtual network card.
[0296] Embodiment 2
[0297] A virtual system operation method provided in Implementation 2 includes but is not limited to the following steps: creating a virtual network card corresponding to the physical network card based on the physical network card, obtaining network configuration information of the virtual network card, and the first application in the virtual system obtaining a first Internet access IP address.
[0298] The specific implementation of creating a corresponding virtual network card based on a physical network card in Example 2 is similar to the specific implementation of creating a corresponding virtual network card based on a physical network card in Example 1. For details, please refer to Example 1. Figure 3A-3E as well as Figure 4A-4D The description of is not repeated here in this application.
[0299] Get the network configuration information of each virtual network card.
[0300] For the specific implementation of the network configuration information of each virtual network card, please refer to the description in Example 1, and this application will not go into details here.
[0301] It should be noted that the preset DNS address is fixed and can be a virtual address of the DNS. No matter how the DNS address outside the container changes, there is no need to update the DNS address in the virtual system to reduce data interaction between the container and outside the container.
[0302] The IP addresses of different bridges are different. For example, the IP address of the first bridge, the IP address of the second bridge, and the IP address of the third bridge are different from each other.
[0303] The network configuration information of the virtual network card can be obtained based on the IP address of the network bridge corresponding to the virtual network card and the key information of the physical network card corresponding to the virtual network card.
[0304] For example, the electronic device 100 may obtain the network configuration information of the first virtual network card based on the key information of the first physical network card and the IP address of the first network bridge.
[0305] The electronic device 100 can obtain the network configuration information of the second virtual network card based on the key information of the second physical network card and the IP address of the second network bridge.
[0306] The electronic device 100 can obtain the network configuration information of the third virtual network card based on the key information of the third physical network card and the IP address of the third network bridge.
[0307] After obtaining the network configuration information of each virtual network card, the electronic device 100 sends the network configuration information of each virtual network card to the virtual system, so that the virtual system can obtain the network configuration information corresponding to each virtual network card.
[0308] In other embodiments, the electronic device 100 does not need to obtain the network configuration information of the virtual network card based on the IP address of the bridge and the key information of the physical network card corresponding to the virtual network card. The virtual system can obtain the network configuration information of the virtual network card based on the preset DNS address and the IP address of the virtual network card, further reducing the data interaction between the container and the outside of the container.
[0309] Fig.11 A schematic diagram showing network configuration information corresponding to each virtual network card is shown.
[0310] Fig.11 Only part of the network configuration information corresponding to each virtual network card is shown, such as the IP address and DNS address corresponding to the virtual network card.
[0311] like Fig.11 As shown, the network configuration information corresponding to the first virtual network card may include: the IP address "192.168.2.0" and the DNS address "192.168.2.100" of the first virtual network card.
[0312] like Fig.11 As shown, the network configuration information corresponding to the second virtual network card may include: the IP address "192.168.2.1" and the DNS address "192.168.2.100" of the second virtual network card.
[0313] like Fig.11 As shown, the network configuration information corresponding to the third virtual network card may include: the IP address "192.168.2.2" and the DNS address "192.168.2.100" of the third virtual network card.
[0314] The DNS address "192.168.2.100" may be a virtual address of the DNS. In this way, the DNS address in the virtual system may be preset to a preset value. No matter how the DNS address outside the container changes, there is no need to update the DNS address in the virtual system, thereby reducing data interaction between the container and outside the container.
[0315] For example, if the electronic device 100 determines the first DNS based on the geographic location of the electronic device 100 and / or the operator network type used by the electronic device 100, for example, the first DNS address may be "8.8.8.8", the DNS address in the container is still "192.168.2.100", and the DNS address in the container will not change.
[0316] In some embodiments, if the geographical location of the electronic device 100 and / or the operator network used by the electronic device 100 changes, causing the DNS to change from the first DNS to the second DNS, for example, the second DNS address may be "7.7.7.7", then the DNS address in the configuration information of the virtual network card in the container is still "192.168.2.100", and the DNS address in the container will not change with the change of the DNS address outside the container.
[0317] In some embodiments, there can be multiple DNSs determined based on the first operator network used by the electronic device 100 and / or the first geographic location of the electronic device 100. The electronic device 100 can obtain the addresses of multiple DNSs and, based on the addresses of multiple DNSs, obtain the network configuration information of each virtual network card, so that applications within the virtual system can obtain Internet access IP addresses based on multiple DNSs, avoiding the situation where there is only one DNS and a failure occurs, resulting in a failure to obtain an Internet access IP address.
[0318] Optionally, when multiple DNS addresses are obtained outside the container, multiple DNS addresses also need to be preset inside the container, and the multiple DNS addresses may be virtual addresses.
[0319] Optionally, the multiple DNS addresses can be divided into a primary DNS address and a backup DNS address. When an application in the virtual system accesses the Internet, it is preferentially accessed based on the primary DNS, and then based on the backup DNS when the primary DNS is unavailable.
[0320] Fig.12 Another schematic diagram of network configuration information corresponding to a virtual network card is shown.
[0321] Fig.12 It also only shows part of the network configuration information corresponding to each virtual network card, such as the IP address and DNS address corresponding to the virtual network card.
[0322] like Fig.12 As shown, the network configuration information corresponding to the first virtual network card may include: the IP address of the first virtual network card "192.168.2.0", the primary DNS address "192.168.2.100", and the backup DNS address "192.168.2.101".
[0323] like Fig.12 As shown, the network configuration information corresponding to the second virtual network card may include: the IP address of the second virtual network card "192.168.2.1", the primary DNS address "192.168.2.100", and the backup DNS address "192.168.2.101".
[0324] like Fig.12 As shown, the network configuration information corresponding to the third virtual network card may include: the IP address of the third virtual network card "192.168.2.2", the primary DNS address "192.168.2.100", and the backup DNS address "192.168.2.101".
[0325] Among them, the primary DNS address "192.168.2.100" and the backup DNS address "192.168.2.101" can be virtual addresses of DNS. In this way, the DNS address in the virtual system can be preset to a preset value. No matter how the DNS address outside the container changes, there is no need to update the DNS address in the virtual system, so as to reduce data interaction between the container and outside the container.
[0326] Not limited to one backup DNS, the electronic device 100 can also obtain the DNS addresses of multiple backup DNSs, which is not limited in this application.
[0327] The bridge stores the mapping relationship between the DNS address inside the container and the DNS address outside the container.
[0328] Because the DNS address in the network configuration information of each virtual network card in the container is a virtual address, not a real DNS address. Before the application in the virtual system accesses the Internet, the bridge needs to modify the virtual DNS address to the real DNS address. Therefore, the bridge needs to store the mapping relationship between the DNS address in the container and the DNS address outside the container.
[0329] Optionally, when the LAN IP address is used in the virtual system and the public IP address is used outside the virtual system, the bridge also needs to store the correspondence between the IP address of the virtual network card and the IP address of the physical network card. Because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to modify the LAN IP address to the public IP address to avoid failure in obtaining the Internet IP address.
[0330] For example, Fig.13 As shown, the first network bridge stores the IP address of the first virtual network card, the IP address of the first physical network card, and the DNS address.
[0331] Among them, the IP address of the first virtual network card is "192.168.2.0", the first virtual network card corresponds to the first physical network card, the IP address of the first physical network card is "10.1.1.0", and the real DNS address obtained outside the container can be "8.8.8.8".
[0332] The IP address of the second virtual network card is "192.168.2.1". The second virtual network card corresponds to the second physical network card. The IP address of the second physical network card is "10.1.1.1". The real DNS address obtained outside the container can be "8.8.8.8".
[0333] The IP address of the third virtual network card is "192.168.2.2". The third virtual network card corresponds to the third physical network card. The IP address of the third physical network card is "10.1.1.2". The real DNS address obtained outside the container can be "8.8.8.8".
[0334] The DNS address “8.8.8.8” may be a first DNS address, and the first DNS address may be determined by the electronic device 100 based on a first operator network used by the electronic device 100 and / or a first geographical location of the electronic device 100 .
[0335] For example, Fig.14 As shown, the first network bridge stores the IP address of the first virtual network card, the IP address of the first physical network card, and the DNS address.
[0336] Among them, the IP address of the first virtual network card is "192.168.2.0", the first virtual network card corresponds to the first physical network card, the IP address of the first physical network card is "10.1.1.0", and the real DNS address obtained outside the container can be "8.8.8.8" and "8.8.4.4".
[0337] The IP address of the second virtual network card is "192.168.2.1". The second virtual network card corresponds to the second physical network card. The IP address of the second physical network card is "10.1.1.1". The real DNS address obtained outside the container can be "8.8.8.8" and "8.8.4.4".
[0338] The IP address of the third virtual network card is "192.168.2.2". The third virtual network card corresponds to the third physical network card. The IP address of the third physical network card is "10.1.1.2". The real DNS address obtained outside the container can be "8.8.8.8" and "8.8.4.4".
[0339] Among them, the DNS address "8.8.8.8" can be the first DNS address, the DNS address "8.8.4.4" can be the third DNS address, and both the first DNS address and the second DNS address can be determined by the electronic device 100 based on the first operator network used by the electronic device 100 and / or the first geographic location of the electronic device 100.
[0340] The first DNS address may be a primary DNS address, and the third DNS address may be a backup DNS address. The first DNS address may correspond to a primary virtual DNS address in the container, and the third DNS address may correspond to a backup virtual DNS address in the container. In this way, an association relationship between the DNS address in the container and the DNS address outside the container is established.
[0341] Optionally, it is not limited to the correspondence between the DNS address in the container and the DNS address outside the container, and the correspondence between the IP address of the virtual network card and the IP address of the physical network card at the bridge. The correspondence between the DNS address in the container and the DNS address outside the container, and the correspondence between the IP address of the virtual network card and the IP address of the physical network card can also be stored at the physical network card. The physical network card modifies the DNS address in the container to the DNS address outside the container, and modifies the LAN IP address to the public IP address to avoid the failure of obtaining the Internet IP address. This application does not limit this.
[0342] In some embodiments, after the geographic location of the electronic device 100 changes and / or the operator network used by the electronic device 100 changes, the DNS address obtained by the electronic device 100 changes. The electronic device 100 needs to update the DNS address at the bridge, without updating the DNS address in the container.
[0343] The DNS address is related to the geographical location of the electronic device 100 and / or the type of network operator used by the electronic device 100. When the geographical location of the electronic device 100 and / or the type of network operator used by the electronic device 100 changes, the DNS address will also change, causing the key information of the physical network card to change, and then causing the network configuration information of the virtual network card to change.
[0344] In some embodiments, if the geographic location of the electronic device 100 and / or the operator network used by the electronic device 100 changes, the electronic device 100 obtains the second DNS address, and the second DNS address may be the IP address of the second DNS.
[0345] Accordingly, the electronic device 100 needs to update the real DNS address stored at the bridge.
[0346] For example, Fig.15As shown, the IP address of the first virtual network card is "192.168.2.0", the first virtual network card corresponds to the first physical network card, the IP address of the first physical network card is "10.1.1.0", and the real DNS address obtained outside the container can be "7.7.7.7".
[0347] The IP address of the second virtual network card is "192.168.2.1". The second virtual network card corresponds to the second physical network card. The IP address of the second physical network card is "10.1.1.1". The real DNS address obtained outside the container can be "7.7.7.7".
[0348] The IP address of the third virtual network card is "192.168.2.2". The third virtual network card corresponds to the third physical network card. The IP address of the third physical network card is "10.1.1.2". The real DNS address obtained outside the container can be "7.7.7.7".
[0349] The DNS address "7.7.7.7" may be a second DNS address, and the second DNS address may be determined by the electronic device 100 based on a second operator network used by the electronic device 100 and / or a second geographical location of the electronic device 100. In this way, after the DNS address changes, the electronic device 100 only needs to update the DNS address stored at the bridge, and does not need to update the DNS address stored in the container, thereby reducing the amount of data interaction inside and outside the container.
[0350] For example, Fig.16 As shown, the IP address of the first virtual network card is "192.168.2.0", the first virtual network card corresponds to the first physical network card, the IP address of the first physical network card is "10.1.1.0", and the real DNS address obtained outside the container can be "7.7.7.7" and "7.7.4.4".
[0351] The IP address of the second virtual network card is "192.168.2.1". The second virtual network card corresponds to the second physical network card. The IP address of the second physical network card is "10.1.1.1". The real DNS address obtained outside the container can be "7.7.7.7" and "7.7.4.4".
[0352] The IP address of the third virtual network card is "192.168.2.2". The third virtual network card corresponds to the third physical network card. The IP address of the third physical network card is "10.1.1.2". The real DNS address obtained outside the container can be "7.7.7.7" and "7.7.4.4".
[0353] Among them, the DNS address "7.7.7.7" may be the second DNS address, the DNS address "7.7.4.4" may be the fourth DNS address, and the second DNS address and the fourth DNS address may be determined by the electronic device 100 based on the second operator network used by the electronic device 100 and / or the second geographical location of the electronic device 100. In this way, after the DNS address changes, the electronic device 100 only needs to update the DNS address stored at the bridge, and does not need to update the DNS address stored in the container, thereby reducing the amount of data interaction inside and outside the container.
[0354] The first application in the virtual system obtains the first Internet access IP address.
[0355] Fig.17 and Fig.18 The diagram shows how the first application in the virtual system obtains the first Internet access IP address.
[0356] Before the first application in the virtual system accesses the Internet, the first application needs to obtain an Internet access IP address from the DNS server. When the first application determines to access the Internet through the first Internet access method, the virtual system can determine whether the first Internet access method is available from multiple Internet access methods. If available, the virtual system then determines the virtual network card corresponding to the first Internet access method. Then, based on the network configuration information of the virtual network card corresponding to the first Internet access method, a first DNS data packet is generated, and the first DNS data packet is used to obtain the first Internet access IP address.
[0357] Specifically, Fig.17 As shown, before the first application in the virtual system accesses the Internet, it is necessary to obtain the first Internet access IP address. Before obtaining the first Internet access IP address, the virtual system can determine the first Internet access method of the first application. The virtual system then determines to access the Internet through the first virtual network card from among multiple virtual network cards based on the first Internet access method.
[0358] For example, the first Internet access is to access the Internet through a mobile cellular network. The virtual system can determine that the Internet access method corresponding to the first virtual network card is a mobile cellular network. The virtual system can determine that the first application accesses the Internet through the first virtual network card.
[0359] For another example, the first Internet access is Internet access through a WiFi network. The virtual system can determine that the Internet access method corresponding to the second virtual network card is a WiFi network. The virtual system can determine that the first application accesses the Internet through the second virtual network card.
[0360] Through the virtual system operation method provided in the present application, the virtual system can perceive the real network outside the container and select the corresponding network to access the Internet as needed.
[0361] Exemplarily, when the first application determines to access the Internet through the first virtual network card, before the first application obtains the first Internet access data through the first virtual network card, the first application can obtain the first Internet access IP address, and then obtain the first Internet access data based on the first Internet access IP address.
[0362] First, the virtual system needs to generate a first DNS data packet based on the first Internet access request, and the first DNS data packet is used to obtain the first Internet access IP address. The first DNS data packet may include multiple fields, such as a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0363] The source IP address field is used to indicate the source address of the first DNS data packet, the destination IP address field is used to indicate the destination address of the first DNS data packet, and the PAYLOAD field is used to indicate the function of the first DNS data packet.
[0364] For example, the source IP address field can be filled with the IP address "192.168.2.0" of the first virtual network card, the destination IP address field can be filled with the preset DNS address "192.168.2.100", the source port field can be filled with "65535", the destination port field can be filled with "53", and the PAYLOAD field can be filled with a request message, which can include a first domain name, the first domain name corresponds to a first Internet IP address, and the first DNS stores the correspondence between the first domain name and the first Internet IP address.
[0365] The first virtual network card can obtain the first DNS data packet and send the first DNS data packet to the first network bridge outside the container.
[0366] After the first network bridge obtains the first DNS data packet, if the source IP address in the first DNS data packet is a LAN IP address, the first network bridge needs to modify the source IP address in the first DNS data packet to the IP address "10.1.1.0" of the first physical network card. The IP address "10.1.1.0" of the first physical network card can be a public IP address, so that the first DNS can identify the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address through the public IP address.
[0367] The first network bridge also needs to modify the DNS address in the first DNS data packet to the real DNS address "8.8.8.8". The DNS address "8.8.8.8" may be the address of the first DNS, so that the first physical network card can access the DNS based on the real DNS address in the DNS data packet.
[0368] For example, the first bridge may generate based on the first DNS packet Fig.17 The second DNS packet shown in the figure is sent to the first physical network card. The first physical network card can send the second DNS packet to the first DNS based on the destination IP address in the second DNS packet, so that the first DNS can obtain the first Internet access IP address based on the first domain name in the second DNS packet.
[0369] After the first DNS obtains the first Internet IP address based on the first domain name in the second DNS data packet, the first DNS can generate a first response data packet based on the first Internet IP address, the source IP address in the second DNS data packet, the destination IP address in the second DNS data packet, the source port in the second DNS data packet, and the destination port in the second DNS data packet, and the first DNS then sends the first response data packet to the first physical network card.
[0370] The first response data packet may include multiple fields, such as a source IP address field, a destination IP address field, a source port field, a destination port field, a PAYLOAD field, etc.
[0371] like Fig.18 As shown, the source IP address field in the first response data packet can be filled with the IP address "8.8.8.8" of the first DNS, the destination IP address field can be filled with the IP address "10.1.1.0" of the first physical network card, the source port field can be filled with "53", the destination port field can be filled with "65535", the PAYLOAD field can be filled with the response message, and the request message can include the first Internet access IP address.
[0372] After receiving the first response data packet sent by the first DNS, the first physical network card sends the first response data packet to the first network bridge.
[0373] After receiving the first response data packet, the first bridge needs to modify the destination IP address in the first response data packet to the IP address "192.168.2.0" of the first virtual network card to obtain a second response data packet. The IP address "192.168.2.0" of the first virtual network card can be a local area network IP address, so that the virtual system can identify the local area network IP address and send the obtained first Internet access IP address to the first application in the virtual system.
[0374] Optionally, after receiving the first response data packet, the first bridge not only needs to modify the destination IP address in the first response data packet to the IP address of the first virtual network card, but also needs to modify the source IP address in the first response data packet to a preset DNS address, for example, modifying the source IP address "8.8.8.8" in the second response data packet to "192.168.2.100" to obtain the second response data packet.
[0375] according to Fig.17 and Fig.18 In the embodiment, the first application in the virtual system can obtain the first Internet access IP address, and obtain the first Internet access data based on the first Internet access IP address.
[0376] Fig.19 A schematic flow chart of another method for a first application in a virtual system to obtain a first Internet access IP address is shown.
[0377] For the description of S1901-S1906, please refer to Fig.10 The description of S1001-S1006 in the embodiments will not be repeated in this application.
[0378] S1907. The first virtual network card corresponds to the first network configuration information.
[0379] S1908. The second virtual network card corresponds to the second network configuration information.
[0380] S1909. The third virtual network card corresponds to the third network configuration information.
[0381] After the electronic device 100 creates a virtual network card in the container, it is necessary to obtain the network configuration information of the virtual network card. The network configuration information of the virtual network card may include but is not limited to one or more of the following: the Internet access method corresponding to the physical network card, the on / off status of the Internet access method corresponding to the physical network card, the IP address of the physical network card, the bandwidth of the Internet access method corresponding to the physical network card, the route of the Internet access method corresponding to the physical network card, the IP address of the bridge, the preset DNS address, etc.
[0382] The network configuration information of the virtual network card is not displayed.
[0383] The key information of the first physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the first physical network card, the on / off state of the Internet access method corresponding to the first physical network card, the IP address of the first physical network card, the bandwidth of the Internet access method corresponding to the first physical network card, the route of the Internet access method corresponding to the first physical network card, the preset DNS address, etc. For example, the Internet access method corresponding to the first physical network card may be a mobile cellular network, and the on / off state of the Internet access method corresponding to the first physical network card may be the on / off state of the mobile cellular network.
[0384] The key information of the second physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the second physical network card, the on / off state of the Internet access method corresponding to the second physical network card, the IP address of the second physical network card, the bandwidth of the Internet access method corresponding to the second physical network card, the route of the Internet access method corresponding to the second physical network card, the preset DNS address, etc. For example, the Internet access method corresponding to the second physical network card may be a WiFi network, and the on / off state of the Internet access method corresponding to the second physical network card may be the on / off state of the WiFi network.
[0385] The key information of the third physical network card may include but is not limited to one or more of the following: the Internet access method corresponding to the third physical network card, the on / off state of the Internet access method corresponding to the third physical network card, the IP address of the third physical network card, the bandwidth of the Internet access method corresponding to the third physical network card, the route of the Internet access method corresponding to the third physical network card, the preset DNS address, etc. For example, the Internet access method corresponding to the third physical network card may be Bluetooth, and the on / off state of the Internet access method corresponding to the third physical network card may be the on / off state of Bluetooth.
[0386] It should be noted that the preset DNS address is fixed and can be a virtual address of the DNS. No matter how the DNS address outside the container changes, there is no need to update the DNS address in the virtual system to reduce data interaction between the container and outside the container.
[0387] The IP addresses of different bridges are different. For example, the IP address of the first bridge, the IP address of the second bridge, and the IP address of the third bridge are different from each other.
[0388] The network configuration information of the virtual network card can be obtained based on the IP address of the network bridge corresponding to the virtual network card and the key information of the physical network card corresponding to the virtual network card.
[0389] For example, the electronic device 100 may obtain the network configuration information of the first virtual network card based on the key information of the first physical network card and the IP address of the first network bridge.
[0390] The electronic device 100 can obtain the network configuration information of the second virtual network card based on the key information of the second physical network card and the IP address of the second network bridge.
[0391] The electronic device 100 can obtain the network configuration information of the third virtual network card based on the key information of the third physical network card and the IP address of the third network bridge.
[0392] After obtaining the network configuration information of each virtual network card, the electronic device 100 sends the network configuration information of each virtual network card to the virtual system, so that the virtual system can obtain the network configuration information corresponding to each virtual network card.
[0393] In other embodiments, the electronic device 100 does not need to obtain the network configuration information of the virtual network card based on the IP address of the bridge and the key information of the physical network card corresponding to the virtual network card. The virtual system can obtain the network configuration information of the virtual network card based on the preset DNS address and the IP address of the virtual network card, further reducing the data interaction between the container and the outside of the container.
[0394] S1910. The first bridge, the second bridge, and the third bridge store a mapping relationship between the DNS address in the container and the first DNS address outside the container, and a mapping relationship between the IP address of the virtual network card and the IP address of the physical network card.
[0395] Since the DNS address in the network configuration information of each virtual network card in the container is a virtual address, not a real DNS address, before the application in the virtual system accesses the Internet, the bridge needs to modify the virtual DNS address to the real DNS address. Therefore, the bridge needs to store the correspondence between the DNS address in the container and the first DNS address outside the container.
[0396] The first DNS address may be a real DNS address.
[0397] Optionally, when the LAN IP address is used in the virtual system and the public IP address is used outside the virtual system, the bridge also needs to store the correspondence between the IP address of the virtual network card and the IP address of the physical network card. Because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to modify the LAN IP address to the public IP address to avoid failure in obtaining the Internet IP address.
[0398] Specifically, the first network bridge stores a mapping relationship between a DNS address in the container and a first DNS address outside the container, and a mapping relationship between an IP address of the first virtual network card and an IP address of the first physical network card.
[0399] The second network bridge stores a mapping relationship between the DNS address in the container and the first DNS address outside the container, and a mapping relationship between the IP address of the second virtual network card and the IP address of the second physical network card.
[0400] The third network bridge stores a mapping relationship between the DNS address in the container and the first DNS address outside the container, and a mapping relationship between the IP address of the third virtual network card and the IP address of the third physical network card.
[0401] Optionally, when the IP address of the virtual network card in the container is also a public network IP address, the network bridge may not store the mapping relationship between the IP address of the virtual network card and the IP address of the physical network card.
[0402] For the description of S1911-S1914, please refer to Fig.10 The description of S1011-S1014 in the embodiments will not be repeated in this application.
[0403] S1915. The first network bridge modifies the IP address of the first virtual network card in the first DNS data packet to the IP address of the first physical network card, and modifies the destination IP address to the first DNS address, to obtain a second DNS data packet.
[0404] After the first network bridge obtains the first DNS data packet, if the source IP address in the first DNS data packet is a LAN IP address, the first network bridge needs to modify the source IP address in the first DNS data packet to the IP address "10.1.1.0" of the first physical network card. The IP address "10.1.1.0" of the first physical network card can be a public IP address, so that the first DNS can identify the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address through the public IP address.
[0405] The first network bridge also needs to modify the DNS address in the first DNS data packet to a real DNS address, such as the first DNS address, which may be "8.8.8.8", so that the first physical network card can access the DNS based on the real DNS address in the DNS data packet.
[0406] Optionally, in other embodiments, if the source IP address in the first DNS data packet is a public IP address, the first network bridge may not modify the source IP address in the first DNS data packet to the IP address of the first physical network card.
[0407] S1916. The first network bridge sends the second DNS data packet to the first physical network card.
[0408] S1917. The first physical network card sends the second DNS data packet to the first DNS.
[0409] After receiving the first physical network card, the first physical network card can obtain the destination IP address "8.8.8.8" from the second DNS data packet, and the first physical network card can send the second DNS data packet to the DNS server based on the destination IP address "8.8.8.8".
[0410] Exemplarily, the destination IP address "8.8.8.8" may be the IP address of the first DNS, and the DNS may be the first DNS.
[0411] S1918. In response to the second DNS data packet, the first DNS obtains the first Internet access IP address based on the first domain name.
[0412] S1919. The first DNS generates a first response data packet for the second DNS data packet based on the first Internet access IP address.
[0413] For the description of S1916-S1919, please refer to Fig.10 The introduction of S1016-S1019 in the embodiments will not be repeated in this application.
[0414] S1920. The first DNS sends a first response data packet to the first physical network card.
[0415] S1921. The first physical network card sends a first response data packet to the first network bridge.
[0416] S1922. The first network bridge modifies the IP address of the first physical network card in the first response data packet to the IP address of the first virtual network card to obtain a second response data packet.
[0417] like Fig.18 As shown, after the first physical network card receives the first response data packet sent by the first DNS, the first physical network card sends the first response data packet to the first network bridge. After the first network bridge receives the first response data packet, the first network bridge needs to modify the destination IP address in the first response data packet to the IP address "192.168.2.0" of the first virtual network card to obtain a second response data packet. The IP address "192.168.2.0" of the first virtual network card can be a local area network IP address, so that the virtual system can identify the local area network IP address and send the obtained first Internet access IP address to the first application in the virtual system.
[0418] Optionally, after receiving the first response data packet, the first bridge not only needs to modify the destination IP address in the first response data packet to the IP address of the first virtual network card, but also needs to modify the source IP address in the first response data packet to the DNS address preset in the container, for example, modify the source IP address "8.8.8.8" in the first response data packet to "192.168.2.100" to obtain a second response data packet.
[0419] Optionally, when the IP address of the virtual network card in the container is also a public IP address, the bridge may not modify the IP address of the first physical network card in the first response data packet to the IP address of the first virtual network card.
[0420] S1923. The first network bridge sends the second response data packet to the first virtual network card.
[0421] S1924. The first virtual network card sends the second response data packet to the first application.
[0422] S1925. The first application obtains the first Internet access IP address from the second response data packet.
[0423] After the first network bridge obtains the second response data packet based on the first response data packet, the first network bridge sends the second response data packet to the first virtual network card. The first virtual network card then sends the second response data packet to the first application. The first application can obtain the first Internet access IP address from the PAYLOAD field of the second response data packet.
[0424] After the first application obtains the first Internet access IP address, the first application can obtain the first Internet access data based on the first Internet access IP address, thereby realizing the process of the first application accessing the Internet through the first virtual network card.
[0425] Fig. 20 A flowchart of a virtual system operation method provided in this application.
[0426] S2001. The electronic device receives a first DNS data packet sent by a first application through a first network bridge. The first DNS data packet includes a source address and a destination address. The source address is the IP address of the first virtual network card, the destination address is a preset DNS address, and the first DNS data packet is used to request an Internet access IP address.
[0427] S2002. The electronic device modifies the destination address in the first DNS data packet from the preset DNS address to the IP address of the first DNS through the first network bridge, and obtains a second DNS data packet.
[0428] S2003. The electronic device sends the second DNS data packet to the first DNS through the first network bridge and the first physical network card.
[0429] S2004. The electronic device receives a first response data packet sent by the first DNS through the first physical network card, and sends a second response data packet to the first application through the first network bridge. The first response data packet and the second response data packet include a first Internet access IP address.
[0430] S2005. The electronic device sends a first data packet through a first application. The first data packet includes first Internet access data. The destination address of the first data packet is a first Internet access IP address.
[0431] The method is applied to an electronic device, wherein a first physical network card and a first network bridge are pre-installed on the electronic device, a virtual system is installed on the electronic device, a first application runs in the virtual system, a first virtual network card runs in the virtual system, the first virtual network card is connected to the first network bridge, the first network bridge is connected to the first physical network card, a preset DNS address is stored in the virtual system, and the IP address of the first DNS is stored in the first network bridge.
[0432] Optionally, the first DNS data packet and the second DNS data packet carry a first domain name, and the first domain name is used to obtain a first Internet access IP address.
[0433] Through this method, a preset DNS address can be preset in the virtual system, and the first bridge stores the IP address of the first DNS, which can be a real address and can be determined based on the operator network and / or geographical location. When obtaining the Internet access IP address, the bridge can modify the preset DNS address in the DNS data packet to the IP address of the first DNS, so that the first application can access the DNS.
[0434] In a possible implementation, the first bridge stores the IP address of the second DNS, which is different from the first DNS; the electronic device receives a third DNS data packet sent by the first application through the first bridge, the third DNS data packet includes a source address and a destination address, wherein the source address is the IP address of the first virtual network card, the destination address is a preset DNS address, and the third DNS data packet is used to request an Internet access IP address; the electronic device modifies the destination address in the third DNS data packet from the preset DNS address to the IP address of the second DNS through the first bridge, and obtains a fourth DNS data packet; the electronic device sends the fourth DNS data packet to the second DNS through the first bridge and the first physical network card; the electronic device receives a third response data packet sent by the second DNS through the first physical network card, and sends the fourth response data packet to the first application through the first bridge, the third response data packet and the fourth response data packet include a second Internet access IP address; the electronic device sends a second data packet through the first application, the second data packet includes second Internet access data, and the destination address of the second data packet is the second Internet access IP address.
[0435] In this way, after the DNS changes, only the updated DNS address needs to be stored in the bridge, and no update is required in the virtual system. This can reduce data interaction inside and outside the virtual system, and can also ensure that the first application accesses the DNS based on the updated DNS address, and then obtains the Internet IP address.
[0436] In other embodiments, after the DNS changes, the DNS address at the bridge may not be updated, but the updated DNS address is sent to the virtual system, and the virtual system stores the updated DNS address. When the first application generates a DNS data packet, the DNS data packet carries the updated DNS address, and the bridge does not need to update the DNS address in the DNS data packet.
[0437] In a possible implementation manner, the first data packet is used to request Internet access data corresponding to the first Internet access IP address.
[0438] In one possible implementation, before obtaining the second DNS data packet, the method also includes: when the IP address of the first virtual network card is a local area network IP address, the electronic device modifies the source address in the first DNS data packet from the IP address of the first virtual network card to the IP address of the first physical network card through the first network bridge.
[0439] Because DNS does not recognize the LAN IP address, when the IP address of the first virtual network card is the LAN IP address, the source address in the first DNS data packet is modified from the IP address of the first virtual network card to the IP address of the first physical network card through the first bridge, so that DNS can recognize the DNS data packet, ensuring that DNS can successfully obtain the Internet access IP address.
[0440] In a possible implementation, the electronic device receives a first response data packet sent by the first DNS through the first physical network, and sends a second response data packet to the first application through the first bridge, specifically including: the electronic device receives the first response data packet sent by the first physical network card through the first bridge; the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first bridge, to obtain a second response data packet; the electronic device sends the second response data packet to the first application through the first bridge.
[0441] In one possible implementation, a preset DNS address is stored in the first bridge; the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first bridge to obtain a second response data packet, specifically including: the electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first bridge, and modifies the source address in the first response data packet from the IP address of the first DNS to the preset DNS address through the first bridge to obtain a second response data packet.
[0442] In one possible implementation, a second physical network card and a second network bridge are pre-installed on the electronic device, a second virtual network card runs in the virtual system, the second virtual network card is connected to the second network bridge, the second network bridge is connected to the second physical network card, and the IP address of the first DNS is stored in the second network bridge.
[0443] In this way, the applications in the virtual system can perceive the real network status outside the system, achieving consistent networking inside and outside the container.
[0444] In a possible implementation, the first physical network card corresponds to a first Internet access method, the second physical network card corresponds to a second Internet access method, and the first Internet access method and the second Internet access method are different.
[0445] In a possible implementation manner, the first Internet access method or the second Internet access method includes any one of the following: a mobile cellular network, a WiFi network, or Bluetooth.
[0446] The present application provides an electronic device, characterized in that the electronic device includes a memory and a processor; wherein the memory and the processor are coupled, the memory is used to store a computer program, and when the processor executes and calls the computer program, the electronic device executes Fig. 20 A virtual system operation method is shown.
[0447] The present application provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, cause the electronic device to execute Fig. 20 A virtual system operation method is shown.
[0448] The present application provides a computer program product, when the computer program product is run on an electronic device, the electronic device executes Fig. 20 A virtual system operation method is shown.
[0449] refer to Fig.21 , Fig.21 A schematic structural diagram of an electronic device is shown.
[0450] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.
[0451] 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.
[0452] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown 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.
[0453] 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 into one or more processors.
[0454] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0455] 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.
[0456] In some embodiments, the processor 110 may include one or more interfaces. The interface 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.
[0457] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0458] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0459] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0460] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0461] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0462] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0463] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0464] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0465] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0466] The power management module 141 is used to connect 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, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0467] The wireless communication function of the electronic device 100 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.
[0468] 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.
[0469] 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.
[0470] 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.
[0471] 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.
[0472] 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).
[0473] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0474] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0475] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0476] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0477] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0478] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0479] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0480] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0481] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0482] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0483] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.
[0484] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0485] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0486] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0487] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0488] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0489] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0490] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0491] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0492] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0493] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0494] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0495] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0496] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0497] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0498] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0499] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0500] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0501] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0502] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0503] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0504] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
[0505] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0506] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0507] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0508] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 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, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. 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.
[0509] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.
[0510] Fig. 22 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0511] The layered architecture divides the software into several layers, each with clear roles and division of labor. The 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 library, and the kernel layer.
[0512] The application layer can include a series of application packages.
[0513] like Fig. 22 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0514] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0515] like Fig. 22 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0516] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0517] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0518] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0519] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0520] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0521] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0522] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0523] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0524] The application layer and the application framework layer run in a 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 functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0525] 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.
[0526] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0527] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0528] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0529] A 2D graphics engine is a drawing engine for 2D drawings.
[0530] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0531] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.
[0532] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer to capture static images or videos through the camera 193.
[0533] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0534] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0535] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0536] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A virtual system operation method, characterized in that: The method is applied to an electronic device, wherein a first physical network card and a first network bridge are pre-installed on the electronic device, a virtual system is installed on the electronic device, a first application is run in the virtual system, a first virtual network card is run in the virtual system, the first virtual network card is connected to the first network bridge, the first network bridge is connected to the first physical network card, a preset DNS address is stored in the virtual system, and an IP address of a first DNS is stored in the first network bridge; the method comprises: The electronic device receives a first DNS data packet sent by the first application through the first network bridge, the first DNS data packet including a source address and a destination address, wherein the source address is the IP address of the first virtual network card, the destination address is the preset DNS address, and the first DNS data packet is used to request an Internet access IP address; The electronic device modifies the destination address in the first DNS data packet from the preset DNS address to the IP address of the first DNS through the first network bridge to obtain a second DNS data packet; The electronic device sends the second DNS data packet to the first DNS through the first network bridge and the first physical network card; The electronic device receives a first response data packet sent by the first DNS through the first physical network card, and sends a second response data packet to the first application through the first network bridge, wherein the first response data packet and the second response data packet include a first Internet access IP address; The electronic device sends a first data packet through the first application, the first data packet includes first Internet access data, and the destination address of the first data packet is the first Internet access IP address.
2. The method according to claim 1, characterized in that The first network bridge stores an IP address of a second DNS, and the second DNS is different from the first DNS; The electronic device receives a third DNS data packet sent by the first application through the first network bridge, the third DNS data packet includes a source address and a destination address, wherein the source address is the IP address of the first virtual network card, the destination address is the preset DNS address, and the third DNS data packet is used to request an Internet access IP address; The electronic device modifies the destination address in the third DNS data packet from the preset DNS address to the IP address of the second DNS through the first network bridge, thereby obtaining a fourth DNS data packet; The electronic device sends the fourth DNS data packet to the second DNS through the first network bridge and the first physical network card; The electronic device receives a third response data packet sent by the second DNS through the first physical network card, and sends a fourth response data packet to the first application through the first network bridge, wherein the third response data packet and the fourth response data packet include a second Internet access IP address; The electronic device sends a second data packet through the first application, the second data packet includes second Internet access data, and the destination address of the second data packet is the second Internet access IP address.
3. The method according to claim 1 or 2, characterized in that: The first data packet is used to request the Internet access data corresponding to the first Internet access IP address.
4. The method according to any one of claims 1 to 3, characterized in that: Before obtaining the second DNS data packet, the method further includes: When the IP address of the first virtual network card is a local area network IP address, the electronic device modifies the source address in the first DNS data packet from the IP address of the first virtual network card to the IP address of the first physical network card through the first network bridge.
5. The method according to any one of claims 1 to 4, characterized in that: The electronic device receives a first response data packet sent by the first DNS through the first physical network, and sends a second response data packet to the first application through the first bridge, specifically including: The electronic device receives the first response data packet sent by the first physical network card through the first network bridge; The electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge, thereby obtaining the second response data packet; The electronic device sends the second response data packet to the first application through the first network bridge.
6. The method according to claim 5, characterized in that The preset DNS address is stored in the first network bridge; The electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge to obtain the second response data packet, specifically including: The electronic device modifies the destination address in the first response data packet from the IP address of the first physical network card to the IP address of the first virtual network card through the first network bridge, and modifies the source address in the first response data packet from the IP address of the first DNS to the preset DNS address through the first network bridge, thereby obtaining the second response data packet.
7. The method according to any one of claims 1 to 6, characterized in that: The electronic device is also pre-installed with a second physical network card and a second network bridge. A second virtual network card runs in the virtual system. The second virtual network card is connected to the second network bridge. The second network bridge is connected to the second physical network card. The IP address of the first DNS is stored in the second network bridge.
8. The method according to claim 7, characterized in that The first physical network card corresponds to a first Internet access method, and the second physical network card corresponds to a second Internet access method, and the first Internet access method and the second Internet access method are different.
9. The system according to claim 8, characterized in that The first Internet access method or the second Internet access method includes any one of the following: a mobile cellular network, a WiFi network, or Bluetooth.
10. An electronic device, characterized in that: The electronic device comprises a memory and a processor; wherein the memory is coupled to the processor, and the memory is used to store a computer program. When the processor executes and calls the computer program, the electronic device executes the method described in any one of claims 1 to 7.
11. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Virtual machine online migration method and data package transmission method and device
CN104243427A
Method, apparatus and system for domain name resolution in data center system
CN111213348A
Domain name resolution method based on cloud computing network and related system and device
CN113726918A
Path establishing method and electronic equipment
CN115707154A