Virtual system running method and electronic device
By setting up virtual network cards within the virtual system and dynamically updating network configurations using a bridge, the problem of network inconsistency between the virtual and physical systems is resolved, achieving network consistency inside and outside the container and a better internet browsing experience.
Patent Information
- Application Number
- CN202311287830.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-09-28
AI Technical Summary
When multiple virtual systems are running on a terminal device, the inconsistency in network access between the virtual and physical systems results in static network configurations that cannot be flexibly adjusted, affecting the internet browsing experience and success rate.
By setting up virtual network interface cards (NICs) within a virtual system and using a bridge to associate them with physical NICs, network configuration information can be dynamically updated, ensuring that applications within the virtual system can perceive the real network conditions and DNS addresses, thus achieving consistency between the network inside and outside the container.
It achieves consistency of network and DNS addresses inside and outside the virtual system, improves the internet browsing experience and success rate, and solves the problems caused by static network configuration.
Smart Images

Figure CN119728639B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for operating a virtual system and an electronic device. Background Technology
[0002] As terminal devices become increasingly widespread, their functions and performance also become more powerful, leading to a growing demand for running multiple systems on a single device. This can be achieved by installing multiple virtual machines (VMs) or containers on a single device, enabling the running of multiple systems on that terminal.
[0003] However, when a terminal device is running a virtual system, the applications running within that virtual system also need to access the internet. The virtual system can access the internet by leveraging the terminal device's network. How to flexibly and conveniently configure the network for the virtual system on the terminal device requires further research. Summary of the Invention
[0004] This application provides a virtual system operation method and electronic device that achieves network consistency between inside and outside the container.
[0005] In a first aspect, this application provides a method for operating a virtual system. The method is applied to an electronic device, which has a first physical network interface card (NIC) and a first network bridge pre-installed on it. A virtual system is installed on the electronic device, and a first application runs within the virtual system. A first virtual NIC runs within the virtual system and is connected to a first network bridge. The first network bridge is connected to the first physical NIC. The virtual system stores a preset DNS address, and the first network bridge stores the IP address of the first DNS. The method includes: the electronic device receiving 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 NIC, and the destination address is the preset DNS address. A DNS packet is used to request an internet IP address; the electronic device modifies the destination address in the first DNS packet from a preset DNS address to the IP address of the first DNS through a first bridge, thus obtaining a second DNS packet; the electronic device sends the second DNS packet to the first DNS through the first bridge and the first physical network card; the electronic device receives the first response packet sent by the first DNS through the first physical network card, and sends the second response packet to the first application through the first bridge, the first response packet and the second response packet include the first internet IP address; the electronic device sends a first packet through the first application, the first packet includes first internet data, and the destination address of the first packet is the first internet IP address.
[0006] Optionally, the first DNS packet and the second DNS packet carry a first domain name, which is used to obtain the first Internet IP address.
[0007] Using this method, a preset DNS address can be configured within the virtual system. The first bridge stores the IP address of the first DNS, which can be a real address or determined based on the operator's network and / or geographical location. When obtaining an internet IP address, the bridge can modify the preset DNS address in the DNS data packet to the IP address of the first DNS, thereby enabling the first application to access the DNS.
[0008] In conjunction with the first aspect, in one 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, where the source address is the IP address of the first virtual network card, and the destination address is a preset DNS address. 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, obtaining 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 and fourth response data packets include the 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, the updated DNS address only needs to be stored at the bridge, and no updates are needed within the virtual system. This reduces data interaction between the virtual system and the outside world, and also ensures that the first application accesses the DNS based on the updated DNS address, thereby obtaining an internet IP address.
[0010] In other embodiments, after a DNS change, the DNS address at the bridge may not be updated. Instead, the updated DNS address is sent to the virtual system, where it is stored. When the first application generates DNS packets, the DNS packets already contain the updated DNS address, eliminating the need for the bridge to update the DNS address in the DNS packets.
[0011] In conjunction with the first aspect, in one possible implementation, the first data packet is used to request internet access data corresponding to the first internet IP address.
[0012] In conjunction with the first aspect, in one possible implementation, before obtaining the second DNS data packet, the method further includes: if 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 bridge.
[0013] Because DNS does not recognize LAN IP addresses, when the IP address of the first virtual network card is a 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. This allows DNS to recognize the DNS data packet and ensures that DNS can successfully obtain the Internet IP address.
[0014] In conjunction with the first aspect, in one possible implementation, the electronic device receives a first response data packet sent by a first DNS through a first physical network, and sends a second response data packet to a first application through a first bridge. Specifically, this includes: the electronic device receiving a first response data packet sent by a first physical network card through the first bridge; the electronic device modifying 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; and the electronic device sending the second response data packet to the first application through the first bridge.
[0015] In conjunction with the first aspect, in one possible implementation, the first bridge stores a preset DNS address; 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 the second response data packet. Specifically, 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 the second response data packet.
[0016] In conjunction with the first aspect, in one possible implementation, the electronic device also has a second physical network card and a second bridge pre-installed, a second virtual network card running within the virtual system, the second virtual network card being connected to the second bridge, the second bridge being connected to the second physical network card, and the second bridge storing the IP address of the first DNS.
[0017] In this way, applications within the virtual system can perceive the real network conditions outside the system, achieving consistent networking inside and outside the container.
[0018] In conjunction with the first aspect, in one possible implementation, the first physical network card corresponds to the first internet access method, and the second physical network card corresponds to the second internet access method. The first internet access method and the second internet access method are different.
[0019] In conjunction with the first aspect, in one possible implementation, the first or second internet access method includes any one of the following: mobile cellular network, WiFi network, or Bluetooth.
[0020] In a second aspect, this 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] Thirdly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform a virtual system operation method provided in any possible implementation of the first aspect.
[0022] Fourthly, this application provides a computer program product that, when run on an electronic device, causes the electronic device to execute a virtual system operation method provided in any possible implementation of the first aspect.
[0023] For a description of the beneficial effects in aspects two through four, please refer to the description of the beneficial effects in aspect one. Attached Figure Description
[0024] Figure 1 A schematic diagram illustrating how a first application running within a virtual system on an electronic device 100, as provided in this application, accesses the internet via a physical network card;
[0025] Figure 2 A system architecture diagram provided for this application;
[0026] Figures 3A-3E A set of schematic diagrams is shown;
[0027] Figures 4A-4D Another set of schematic diagrams is shown;
[0028] Figure 5 This diagram illustrates the network configuration information corresponding to each virtual network interface card (NIC).
[0029] Figure 6 A schematic diagram showing network configuration information corresponding to another virtual network interface card is provided.
[0030] Figure 7A This diagram illustrates the network configuration information after a virtual network interface card (NIC) has been updated.
[0031] Figure 7B This diagram illustrates the updated network configuration information for another virtual network interface card.
[0032] Figure 8 This diagram illustrates the network configuration information after another virtual network card update.
[0033] Figure 9A and Figure 9B This diagram illustrates how the first application within a virtual system obtains the first internet IP address.
[0034] Figure 10 This diagram illustrates a method for a first application within a virtual system to obtain a first internet IP address.
[0035] Figure 11 This diagram illustrates the network configuration information corresponding to each virtual network interface card (NIC).
[0036] Figure 12 This diagram illustrates the network configuration information corresponding to another type of virtual network interface card.
[0037] Figures 13-16 Another schematic diagram is shown;
[0038] Figure 17 and Figure 18 This diagram illustrates how the first application within a virtual system obtains the first internet IP address.
[0039] Figure 19 This illustrates a flowchart of another method for a first application within a virtual system to obtain a first internet IP address.
[0040] Figure 20 A flowchart illustrating a virtual system operation method provided in this application;
[0041] Figure 21 Schematic diagram of the electronic device;
[0042] Figure 22 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention. Detailed Implementation
[0043] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0044] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0045] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The commonly used form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation that is displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of an electronic device.
[0046] First, the technical terms used in this application will be explained.
[0047] 1. Main system and virtual system
[0048] The main system can be a computer program that manages and controls the hardware and software resources of an electronic device. Electronic devices can run applications that are compatible with the main system. Electronic devices cannot run applications unrelated to the main system.
[0049] For example, the main system could be Operating system, then electronic devices can The operating system is running HarmonyOS applications. The electronic device cannot... Running Android applications on the operating system.
[0050] In some embodiments, to enable applications independent of the main system to run on an electronic device, the electronic device can run a virtual system on the main system based on a virtual machine or container. The operating system type of the virtual system can be different from that of the main system. This allows the electronic device to run applications independent of 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 If the operating system is an Android system, then the applications that can run on the virtual system on electronic devices need to be Android applications.
[0052] Both the host system and the virtual system can utilize the hardware and software resources of the electronic device. Hardware resources on the electronic device include, but are not limited to: CPU, memory, graphics card, sound card, network card, etc. Software resources on the electronic device include, but are not limited to: drivers, library files, interface files, etc.
[0053] 2. DNS (Domain Name Server) address
[0054] DNS is a server that translates domain names into their corresponding IP addresses.
[0055] Application server IP addresses are typically long strings of numbers, which are difficult to remember. To make them easier to remember, you can register a domain name for the application server, establishing a mapping between the IP address and the domain name. For example, the application server's domain name could be "huawei.com".
[0056] Before an application on an electronic device accesses an application server, the device first obtains the URL of the application data it needs to access. The URL of the application data can be understood as the storage location or path of the application data on the application server. The URL of the application data can be derived from the storage location or path of the application data on the application server, the domain name of the application server, and the transmission protocol information. For example, the URL of the application data could be "http: / / www.huawei.com.s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn".
[0057] Before an electronic device accesses an application server, it can obtain the application server's domain name. In some embodiments, the electronic device can obtain the application server's domain name from the URL of the application data; however, it can also obtain the application server's domain name through other means, which are not limited in this application. Afterward, the electronic device sends the application server's domain name to the DNS, which then obtains the application server's IP address based on the domain name and sends the application server's IP address to the application. The application can then access the application server based on its IP address and retrieve the corresponding application data from the application server based on the URL of the application data.
[0058] There are many DNS servers, and DNS addresses can be related to the geographical location of an electronic device and / or the type of network operator it uses. Different geographical locations and / or types of network operators result in different DNS addresses for different electronic devices.
[0059] The geographical location of an electronic device can be at the city level, or it can be at the level of different areas within a city.
[0060] When an electronic device supports data networks, the DNS address can be related to the geographical location of the electronic device and the type of network used by the operator.
[0061] It should be noted that, when an electronic device supports data networks, the DNS address may also be solely related to the geographical location of the electronic device, and this application does not impose any limitations on this.
[0062] For example, when the electronic device is using a mobile cellular network and is in a first location, the DNS address is the address of the first DNS. When the electronic device is using a mobile cellular network and is in a second location, the DNS address is the address of the second DNS.
[0063] For example, the first location could be Beijing, and the second location could be Shanghai.
[0064] For example, the first location could be Haidian District in Beijing, and the second location could be Dongcheng District in Beijing.
[0065] For example, when the electronic device is using a mobile cellular network and is in the first location, the DNS address is the address of the first DNS. When the electronic device is using a China Unicom network and is in the first location, the DNS address is the address of the second DNS.
[0066] Optionally, if the electronic device supports data networks, the DNS address may also be related only to the type of operator network used by the electronic device.
[0067] For example, when an electronic device uses the first operator's network, the DNS address is the address of the first DNS. When the electronic device uses the second operator's network, the DNS address is the address of the second DNS.
[0068] For example, the first operator network could be China Mobile, and the second operator network could be China Unicom.
[0069] In cases where electronic devices do not support data networks, DNS addresses can be related to the geographical location of the electronic device.
[0070] For example, when the electronic device is in the first location, the DNS address is the address of the first DNS. When the electronic device is in the second location, the DNS address is the address of the second DNS.
[0071] For example, the first location could be Beijing, and the second location could be Shanghai.
[0072] For example, the first location could be Haidian District in Beijing, and the second location could be Dongcheng District in Beijing.
[0073] In some embodiments, there can be multiple DNS servers at the same location, and thus multiple DNS addresses at the same location. Among these multiple DNS servers, there can be a primary DNS server and one or more backup DNS servers. If the primary DNS server fails, the electronic device can obtain the IP address of the application server through one or more backup DNS servers, and then access the application server and obtain application data based on the IP address of the application server, thus avoiding the situation where there is only one DNS server and it fails, resulting in the failure to obtain application data.
[0074] 3. Network interface card and bridge
[0075] A network interface card (NIC) is a device within an electronic device used to receive, send, and temporarily store data.
[0076] Network interface cards (NICs) can include, but are not limited to, mobile cellular network NICs, Wi-Fi NICs, and Bluetooth NICs. Mobile cellular network NICs are used to receive, send, and temporarily store network data when electronic devices access the internet via a mobile cellular network. Wi-Fi NICs are used to receive, send, and temporarily store network data when electronic devices access the internet via a Wi-Fi network. Bluetooth NICs are used to receive, send, and temporarily store network data when electronic devices access the internet via Bluetooth.
[0077] An electronic device can be configured with one or more types of network interface cards (NICs). Multiple NICs of the same type can also be configured simultaneously on an electronic device.
[0078] In this application, network interface cards (NICs) can be divided into physical NICs and virtual NICs. A physical NIC can be a real NIC that exists on an electronic device.
[0079] Applications running on the main system can access the internet by sensing the network of the electronic device through the physical network card.
[0080] In some embodiments, a virtual system can run on the electronic device. This virtual system is isolated from the main system and cannot detect the physical network card on the electronic device. Applications within the virtual system cannot access the internet. To enable applications running within the virtual system to access the internet, a virtual network card needs to be configured within the virtual system. Applications within the virtual system can establish an association with the physical network card on the electronic device through the virtual network card. This allows them to detect the network of the electronic device and access the internet through it.
[0081] In this application, a virtual network interface card (NIC) within a virtual system can establish an association with a physical NIC on an electronic device via a network bridge. In other words, the network bridge serves as the channel for interaction between the virtual NIC within the virtual system and the physical NIC on the electronic device. For example, an application within the virtual system can send data to the virtual NIC, which then sends the data to the network bridge, which in turn sends the data to the physical NIC on the electronic device. The physical NIC on the electronic device then transmits the data out via a mobile cellular network / WiFi network / Bluetooth. Alternatively, the physical NIC on the electronic device can receive data via a mobile cellular network / WiFi network / Bluetooth, which then sends the data to the network bridge, which in turn sends the data to the virtual NIC on the virtual system. Through the network bridge, applications within the virtual system can access the internet via the physical NIC on the electronic device.
[0082] Figure 1 This is a schematic diagram illustrating how a first application running within a virtual system on an electronic device 100, as provided in this application, accesses the internet via a physical network card.
[0083] like Figure 1 As shown, the virtual system runs within the container of electronic device 100. A virtual network interface card (NIC) is configured within the virtual system.
[0084] The electronic device 100 has a pre-installed network bridge, a first physical network interface card (NIC), a second physical NIC, and a third physical NIC outside its container. The NIC types of the first physical NIC, the second physical NIC, and the third physical NIC can be the same or different.
[0085] For example, the first physical network card can be a mobile cellular network card, the second physical network card can be a WiFi network card, and the third physical network card can be a Bluetooth network card.
[0086] To enable applications within the virtual system to perceive the network status of electronic device 100, network configuration information needs to be assigned to the virtual network interface card (NIC) within the virtual system. This network configuration information is statically configured. This network configuration information can be the network configuration information corresponding to the first physical NIC, the second physical NIC, or the third physical NIC. Furthermore, the network configuration information of the virtual NIC remains unchanged.
[0087] For example, Figure 1The network configuration information of the virtual network interface card (NIC) can be the same as that of the first physical NIC. Therefore, the network perceived by the first application within the virtual system is limited to the mobile cellular network. Regardless of changes in the network status of the electronic device 100, the first application within the virtual system will always perceive the mobile cellular network. The IP address "10.0.0.2" in the network configuration information can be the IP address of the first physical NIC. The DNS address "1.1.1.1" in the network configuration information can be a preset DNS address.
[0088] The bridge can sense network changes in electronic device 100. When the mobile cellular network, WiFi network, and Bluetooth of electronic device 100 are all enabled, the bridge can connect to any one of the first, second, and third physical network cards. When the mobile cellular network of electronic device 100 is enabled, and the WiFi network and Bluetooth are both disabled, the bridge can connect to the first physical network card. When the mobile cellular network of electronic device 100 is disabled, the WiFi network is enabled, and Bluetooth is disabled, the bridge can connect to the second physical network card. When the mobile cellular network of electronic device 100 is disabled, the WiFi network is disabled, and Bluetooth is enabled, the bridge can connect to the third physical network card. In other words, the bridge can dynamically switch between connecting to different physical network cards.
[0089] However, regardless of which physical network card the bridge connects to, the network perceived by the first application within the virtual system is limited to the mobile cellular network.
[0090] When the first application within 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 within the virtual system can send an internet access request to the virtual network interface card (NIC), which then forwards the request to the bridge. The bridge can then forward internet access requests to the physical NIC it is connected to.
[0092] When the bridge is connected to the first physical network card, the bridge can send the Internet access request of the first application in the virtual system to the first physical network card, and the first physical network card can then send the Internet access request to the first application server.
[0093] When the bridge is connected to the second physical network card, the 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 can then send the Internet access request to the first application server.
[0094] When the bridge is connected to a third physical network interface card (NIC), the bridge can send the internet access request of the first application in the virtual system to the third physical NIC, and the third physical NIC can then send the internet access request to the first application server.
[0095] Figure 1 The method shown, which uses static network configuration, has the following problems:
[0096] Question 1: The primary network perceived by the application within the virtual system is always the mobile cellular network. However, the bridge can dynamically switch connections to different physical network cards based on the network status of the electronic device 100, resulting in inconsistencies between the network inside and outside the container.
[0097] When the bridge is connected to the second or third physical network card, the first application in the virtual system accesses the Internet via the WiFi network or Bluetooth of the electronic device 100. However, the first application in the virtual system is sensing the mobile cellular network, resulting in a problem of inconsistent networks inside and outside the container.
[0098] Question 2: In some embodiments, the first application within the virtual system needs to access the internet using a designated network. If the network sensed by the first application within 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, if the first application within the virtual system is an app store, it needs to download the app's installation package. However, downloading the app's installation package requires a Wi-Fi network. If the bridge is also connected to a second physical network card, but the first application within the virtual system is sensing a mobile cellular network, the virtual system will also be unable to download the app's installation package, resulting in internet access failure.
[0100] Question 3: The network configuration information within the virtual system is statically configured, meaning that the IP address of the physical network card and the DNS address of the DNS in the network configuration information are fixed.
[0101] However, DNS can change based on the geographical location of electronic device 100, or based on changes in the geographical location of electronic device 100 and the type of network operator used by electronic device 100, allowing electronic device 100 to use a faster DNS. In contrast, the DNS address within a virtual system is fixed and cannot be changed. Therefore, applications within the virtual system can only access the DNS based on this fixed DNS address, causing the DNS used within the virtual system to deviate from the real DNS, thus reducing the user's internet experience.
[0102] Based on the above analysis, this application provides a virtual system operation method. Through this method, applications within the virtual system can perceive the real network and real DNS address of the electronic device 100, thereby achieving network and DNS address consistency inside and outside the container.
[0103] Figure 2 A system architecture diagram is provided for this application.
[0104] like Figure 2 As shown, electronic device 100 runs a virtual system within a container, and the type of the virtual system is different from the main system of electronic device 100. For example, the main system of electronic device 100 could be... Operating systems and virtual systems can be operating system.
[0105] Outside of a 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 proxy module, a virtual network interface proxy module, a container management service, a container engine, a cross-container communication module, and a virtual network interface.
[0107] Among them, the service framework is the software framework that provides system capabilities and interfaces to the main system outside the container.
[0108] A service is a software implementation of the system capabilities and interfaces provided by the main system outside the container to an application.
[0109] Daemon processes are the foundational processes in the main system outside of containers that control hardware operations, kernels, and other low-level devices.
[0110] The cross-container communication module outside the container communicates with the cross-container communication module inside the container to obtain key information about each physical network interface card (NIC), and then sends this key information back to the cross-container communication module inside the container. Key information about the physical NICs includes, but is not limited to: the on / off status of the mobile cellular network / WiFi network / Bluetooth, DNS address, bandwidth, routing information, etc.
[0111] The first application within the container needs to be compatible with the virtual system. Compatibility can mean that the first application and the virtual system were developed by the same developer. For example, when the virtual system is... When using an operating system, the first application can be an Android application.
[0112] The Virtual Subsystem Network Service Proxy Module is used to proxy the management of network priorities and provide the first application with the ecological interface within the virtual system. The virtual system does not need to implement real services; it only needs to proxy the implemented virtual services to services outside the container, so that the first application within the virtual system can use services outside the container.
[0113] The virtual network interface proxy module is used to configure virtual network interfaces inside the container that correspond one-to-one with the physical network interfaces outside the container, based on the physical network interfaces outside the container.
[0114] The cross-container communication module inside the container is used to communicate with the cross-container communication module outside the container and obtain key information about each physical network interface 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] The following Examples 1 and 2 will describe in detail a virtual system operation method provided in this application.
[0117] Example 1
[0118] The virtual system operation method provided in Implementation 1 includes, but is not limited to, the following steps: creating a virtual network card corresponding to a physical network card, obtaining the network configuration information of the virtual network card, and obtaining the first Internet IP address for the first application in the virtual system.
[0119] Create a bridge corresponding to the physical network card based on the physical network card, and create a virtual network card corresponding to the physical network card within the virtual system.
[0120] The electronic device 100 can be configured with one or more types of physical network interface cards (NICs). Multiple physical NICs of the same type can also be configured on the electronic device simultaneously.
[0121] For example, if the electronic device 100 supports mobile cellular networks, WiFi networks 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, such as a first bridge, a second bridge, and a third bridge.
[0123] Among them, the first bridge corresponds one-to-one with the first physical network card, the second bridge corresponds one-to-one with the second physical network card, and the third bridge corresponds one-to-one with the third physical network card.
[0124] When the internet access function corresponding to a physical network card is enabled, the physical network card can connect to its corresponding network bridge. When the internet access function corresponding to a physical network card is disabled, the physical network card can disconnect from its corresponding network bridge.
[0125] For example, such as Figure 3A 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, such as Figure 3B When the mobile cellular network, WiFi network and Bluetooth of the electronic device 100 are all turned off, 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 disconnected from the third physical network card.
[0127] For example, such as Figure 3C When the mobile cellular network of the electronic device 100 is turned on and the WiFi network and Bluetooth are turned off, the first bridge is connected to the first physical network card, the second bridge is disconnected from the second physical network card, and the third bridge is disconnected from the third physical network card.
[0128] For example, such as Figure 3D 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, such as Figure 3E 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] If there are three physical network interfaces outside the container, you also need to create three virtual network interfaces inside the container, each corresponding to one of the three physical network interfaces. For example, the three virtual network interfaces could be designated as Virtual Network Interface 1, Virtual Network Interface 2, and Virtual Network Interface 3, respectively.
[0131] The first virtual network card is connected to the first bridge, the second virtual network card is connected to the second bridge, and the third virtual network card is connected to the third 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 adapter informs the first application that it can access the internet via cellular network. The second virtual network adapter informs the first application that it can access the internet via Wi-Fi. The third virtual network adapter informs the first application that it can access the internet via Bluetooth.
[0134] In this way, multiple internet access methods outside the container of electronic device 100 can be mapped into the container through multiple virtual network cards and bridges, enabling applications within the virtual system to be aware of the status and changes of multiple networks outside the container.
[0135] Optional, in Figure 3B In the process of disconnecting the first bridge from the first physical network interface card (NIC), the second bridge from the second physical NIC, and the third bridge from the third physical NIC, as follows: Figure 4A As shown, the first bridge can also disconnect from the first virtual network adapter, the second bridge can also disconnect from the second virtual network adapter, and the third bridge can also disconnect from the third virtual network adapter. This indicates that the first application within the virtual system cannot access the internet.
[0136] Optional, in Figure 3C In the process, when the second bridge disconnects from the second physical network card and the third bridge disconnects from the third physical network card, such as Figure 4B As shown, the second bridge can also disconnect from the second virtual network card, and the third bridge can also disconnect from the third virtual network card. This indicates that the first application within the virtual system cannot access the internet via WiFi and Bluetooth, but can access the internet via mobile cellular networks.
[0137] Optional, in Figure 3D In the process, when the first bridge is disconnected from the first physical network card, such as Figure 4C As shown, the first bridge can also disconnect from the first virtual network card. This indicates that the first application within the virtual system cannot access the internet via mobile cellular networks, but can access the internet via Wi-Fi and Bluetooth.
[0138] Optional, in Figure 3E In the process, when the first bridge disconnects from the first physical network card and the second bridge disconnects from the second physical network card, such as Figure 4D As shown, the first bridge can also disconnect from the first virtual network card, and the second bridge can also disconnect from the second virtual network card. This indicates that the first application within the virtual system cannot access the internet via mobile cellular networks and WiFi networks, but can access the internet via Bluetooth.
[0139] It should be noted that this application only uses three physical network cards as an example for illustration. In other embodiments, more or fewer physical network cards may be included, and this application does not limit this.
[0140] Obtain the network configuration information of the virtual network adapter.
[0141] The network configuration information of a virtual network interface card (NIC) includes key information about the physical NIC that corresponds to the virtual NIC.
[0142] In some embodiments, network configuration information may also include the IP address of the bridge corresponding to the virtual network card, and this application does not limit this.
[0143] Key information about the physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the physical NIC, the on / off status of the internet access method corresponding to the physical NIC, the IP address of the physical NIC, the bandwidth of the internet access method corresponding to the physical NIC, the routing of the internet access method corresponding to the physical NIC, and the DNS address. 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 network operator type includes, but is not limited to, China Mobile, China Unicom, and China Telecom.
[0144] Different physical network cards have different key information.
[0145] Key information about the first physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the first physical network interface card, the on / off status of the internet access method corresponding to the first physical network interface card, the IP address of the first physical network interface card, the bandwidth of the internet access method corresponding to the first physical network interface card, the routing of the internet access method corresponding to the first physical network interface card, and the first DNS address. For example, the internet access method corresponding to the first physical network interface card may be a mobile cellular network, and the on / off status of the internet access method corresponding to the first physical network interface card may be the on / off status of the mobile cellular network.
[0146] Key information about the second physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the second physical network interface card, the on / off status of the internet access method corresponding to the second physical network interface card, the IP address of the second physical network interface card, the bandwidth of the internet access method corresponding to the second physical network interface card, the routing of the internet access method corresponding to the second physical network interface card, and the primary DNS address. For example, the internet access method corresponding to the second physical network interface card may be a WiFi network, and the on / off status of the internet access method corresponding to the second physical network interface card may be the on / off status of the WiFi network.
[0147] Key information about the third physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the third physical network interface card, the on / off status of the internet access method corresponding to the third physical network interface card, the IP address of the third physical network interface card, the bandwidth of the internet access method corresponding to the third physical network interface card, the routing of the internet access method corresponding to the third physical network interface card, and the primary DNS address. For example, the internet access method corresponding to the third physical network interface card may be Bluetooth, and the on / off status of the internet access method corresponding to the third physical network interface card may be the on / off status of Bluetooth.
[0148] Different bridges have different IP addresses; for example, the IP addresses of the first bridge, the second bridge, and the third bridge are all different.
[0149] The network configuration information of a virtual network interface card (NIC) can be obtained based on the IP address of the bridge corresponding to the virtual NIC and key information of the physical NIC corresponding to the virtual NIC.
[0150] For example, electronic device 100 can 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] 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 bridge.
[0152] 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 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 depending on the geographical location of the electronic device 100 and / or the network operator used by the electronic device 100, thus the key information of the physical network card will 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 of network configuration information corresponding to each virtual network interface card is shown.
[0156] Figure 5 This only shows a portion of the network configuration information for each virtual network interface card (NIC), such as the IP address and DNS address of the virtual NIC.
[0157] like Figure 5 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" and the DNS address "8.8.8.8".
[0158] like Figure 5 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" and the DNS address "8.8.8.8".
[0159] like Figure 5 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" and the DNS address "8.8.8.8".
[0160] The DNS address "8.8.8.8" can be the address of a first DNS. The address of the first DNS can 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 can be determined based on the first carrier's network.
[0162] Optionally, the address of the first DNS may be determined based on the first geographical location of the first operator network and electronic device 100.
[0163] Optionally, the address of the first DNS can be determined based on the first geographical location.
[0164] In some embodiments, the number of DNS determined based on the first operator network used by the electronic device 100 and / or the first geographical location of the electronic device 100 can be multiple. The electronic device 100 can obtain the addresses of multiple DNS and obtain the network configuration information of each virtual network card based on the addresses of these multiple DNS, so that the application in the virtual system can obtain the Internet IP address based on multiple DNS, avoiding the situation where there is only one DNS and the failure occurs, resulting in the failure to obtain the Internet IP address.
[0165] Optionally, when multiple DNS addresses are obtained, the electronic device 100 can divide these DNS addresses into primary DNS and backup DNS. The speed at which the electronic device 100 obtains an internet IP address from the primary DNS is greater than the speed at which it obtains an internet IP address from the backup DNS. For example, the electronic device 100 can divide the multiple DNS addresses into primary DNS and backup DNS based on their distance from the electronic device 100. When applications within the virtual system access the internet, they preferentially use the primary DNS address; if the primary DNS is unavailable, they can use the backup DNS.
[0166] Figure 6 This diagram illustrates the network configuration information for another type of virtual network card.
[0167] Figure 6 It only shows a portion of the network configuration information corresponding to each virtual network interface card, such as the IP address and DNS address of the virtual network interface 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] In this context, the DNS address "8.8.8.8" can be the address of the primary DNS, which can also be called the main DNS, and the DNS address "8.8.4.4" can be the address of the backup DNS.
[0172] Not limited to one backup DNS, the electronic device 100 may also obtain the DNS addresses of multiple backup DNS, and this application does not limit this.
[0173] When the geographical location of electronic device 100 changes and / or the operator network used by electronic device 100 changes, 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 electronic device 100 and / or the type of network operator used by electronic device 100. When the geographical location of electronic device 100 and / or the type of network operator used by electronic device 100 change, the DNS address will also change. This causes changes to key information of the physical network interface card, which in turn leads to changes in the network configuration information of the virtual network interface card.
[0175] In some embodiments, the DNS address may change based on changes in the geographical location of the electronic device 100.
[0176] For example, if the geographical location of electronic device 100 changes from a first geographical location to a second geographical location, and the DNS changes 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.
[0177] In some embodiments, the DNS address may vary based on the type of carrier network used.
[0178] For example, if 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.
[0179] For example, the first operator network can be a mobile cellular network, and the second operator network can 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 operator network used by the electronic device 100.
[0181] For example, if electronic device 100 switches from a first operator network to a second operator network, and 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 example, if electronic device 100 changes from a first geographical location to a second geographical location, but the operator network used by electronic device 100 is still the first operator network, and the DNS changes 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 example, if electronic device 100 changes from a first geographical location to a second geographical location, the operator network used by electronic device 100 changes from the first operator network to the second operator network, and the DNS changes 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.
[0184] Among them, 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 a first DNS address to a second DNS address, but the IP address of the physical network card, the IP address of the bridge, and the IP address of the virtual network card remain unchanged, the electronic device 100 only needs to send the second DNS address to the virtual network card. The virtual network card can obtain the 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 the updated network configuration information based on the second DNS address. 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] Figure 7A This diagram illustrates the network configuration information after a virtual network card has been updated.
[0188] Figure 7A This only shows a portion of the updated network configuration information for each virtual network interface card (NIC), such as the IP address of the bridge corresponding to the virtual NIC, the IP address of the physical NIC corresponding to the virtual NIC, and the DNS address.
[0189] like Figure 7A 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" and the DNS address "7.7.7.7".
[0190] like Figure 7A As shown, the updated network configuration information corresponding to the second virtual network card may include: the IP address of the first virtual network card "192.168.2.0" and the DNS address "7.7.7.7".
[0191] like Figure 7A As shown, the updated network configuration information corresponding to the third virtual network card may include: the IP address of the first virtual network card "192.168.2.0" and the DNS address "7.7.7.7".
[0192] The DNS address "7.7.7.7" can be the address of a second DNS. The address of the second DNS can 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 This diagram illustrates the network configuration information after another virtual network card update.
[0194] Figure 7B This only shows a portion of the updated network configuration information for each virtual network interface card (NIC), such as the IP address of the bridge corresponding to the virtual NIC, the IP address of the physical NIC corresponding to the virtual NIC, 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 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".
[0197] like Figure 7B As shown, the updated network configuration information corresponding to the third 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".
[0198] The primary DNS address "7.7.7.7" can be the address of the secondary DNS, and the backup DNS address "7.7.4.4" can be the address of the fourth DNS. The addresses of the secondary and fourth DNS can be determined by the electronic device 100 based on the secondary operator network used by the electronic device 100 and / or the secondary geographical location of the electronic device 100.
[0199] Based on this method, the virtual system can update the network configuration information of the virtual network card in a timely manner, enabling the virtual network card to perceive the real DNS. This allows applications within the virtual system to match the DNS address in the network configuration information to the nearest DNS for obtaining the Internet IP address, thereby improving the Internet speed of applications within the virtual system.
[0200] Optional, such as Figure 8As shown, when a local area network (LAN) IP address is used within the virtual system and a public IP address is used outside the virtual system, the bridge also needs to store the mapping between the virtual network adapter's IP address and the physical network adapter's IP address. This is because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the LAN IP address needs to be changed to a public IP address at the bridge to avoid failures in obtaining an internet IP address.
[0201] Table 1
[0202] Virtual network adapter identifier Virtual network adapter IP address Physical network card identifier IP address of 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 Third virtual network card 192.168.2.2 Third physical network card 10.1.1.2
[0203] Table 1 shows the correspondence between the IP addresses of the virtual network interface cards (NICs) stored at the bridge and the IP addresses of the physical NICs.
[0204] 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, the mapping between the IP addresses of the virtual network interface cards (NICs) and the IP addresses of the physical NICs can be stored not only at the bridge, but also at the physical NIC, whereby the physical NIC can modify the LAN IP address to a public IP address. This application does not limit this.
[0208] In other embodiments, if public IP addresses are used within the virtual system, then the bridge does not need to store the mapping between the IP addresses of the virtual network cards and the IP addresses of the physical network cards, nor does it need to modify the local area network IP addresses to public IP addresses.
[0209] The first application within the virtual system obtains the first internet IP address.
[0210] Figure 9A and Figure 9B This diagram illustrates how the first application within a virtual system obtains the first internet IP address.
[0211] Before the first application within the virtual system can access the internet, it needs to obtain an IP address from a DNS server. Once the first application determines it will access the internet via a specific method, the virtual system can determine if that method is available from among various options. If available, the virtual system identifies the virtual network adapter corresponding to that method. The first application can then generate a third-party DNS packet based on the network configuration information of the virtual network adapter. This third-party DNS packet is used to obtain the first application's IP address.
[0212] Specifically, such as Figure 9A As shown, before the first application within the virtual system can access the internet, it needs to obtain a primary internet IP address. Before obtaining the primary internet IP address, the virtual system can determine the primary internet access method for the first application. Based on this primary internet access method, the first application can determine whether to access the internet through the first virtual network adapter from among multiple virtual network adapters.
[0213] For example, the first internet access is via mobile cellular network. The virtual system can determine that the internet access method corresponding to the first virtual network card is mobile cellular network. The virtual system can determine that the first application accesses the internet via the first virtual network card.
[0214] For example, the first internet access is via WiFi. The virtual system can determine that the second virtual network adapter's internet access method is WiFi. The virtual system can then determine that the first application accesses the internet via the second virtual network adapter.
[0215] The virtual system operation method provided in this application enables the virtual system to perceive the real network outside the container and select the corresponding network for internet access as needed.
[0216] For example, when the first application determines that it is accessing 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-party DNS packet based on the first internet access request. This third-party DNS packet is used to obtain the IP address of the first internet access request. The third-party DNS packet can include multiple fields, such as the source IP address field, destination IP address field, source port field, destination port field, and PAYLOAD field.
[0218] The source IP address field indicates the source address of the third-party DNS packet, and the destination IP address field indicates the destination address of the third-party DNS packet. The PAYLOAD field indicates the purpose of the third-party DNS packet.
[0219] For example, the source IP address field can be filled with the IP address of the first virtual network card, "192.168.2.0", the destination IP address field can be filled with the IP address of the first DNS, "8.8.8.8", 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 may include the first domain name, which corresponds to the first Internet IP address. The first DNS stores the mapping relationship between the first domain name and the first Internet IP address.
[0220] The first virtual network interface card can obtain third DNS packets and send them to the first bridge outside the container.
[0221] After obtaining 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 of the first physical network card, "10.1.1.0". The IP address of the first physical network card, "10.1.1.0", can be a public IP address, so that the first DNS can recognize the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address.
[0222] For example, the first bridge can be generated based on third DNS packets. Figure 9A The fourth DNS packet shown is sent to the first physical network interface card (NIC). The first NIC can send the fourth DNS packet to the first DNS server based on the destination IP address in the fourth DNS packet, so that the first DNS server can obtain the first Internet 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 packet, the first DNS can generate a first response packet based on the first Internet IP address, the source IP address in the fourth DNS packet, the destination IP address in the fourth DNS packet, the source port in the fourth DNS packet, and the destination port in the fourth DNS packet. The first DNS then sends the first response packet to the first physical network card.
[0224] The first response packet may include multiple fields, such as the source IP address field, destination IP address field, source port field, destination port field, PAYLOAD field, etc.
[0225] like Figure 9BAs shown, the source IP address field in the first response packet can be filled with the IP address of the first DNS, "8.8.8.8", the destination IP address field can be filled with the IP address of the first physical network card, "10.1.1.0", the source port field can be filled with "53", the destination port field can be filled with "65535", and the PAYLOAD field can be filled with the response message, which may include the first Internet IP address.
[0226] After receiving the first response data packet sent by the first DNS, the first physical network card then sends the first response data packet to the first 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 of the first virtual network interface card, "192.168.2.0", to obtain the second response data packet. The IP address of the first virtual network interface card, "192.168.2.0", can be a local area network (LAN) IP address, allowing the virtual system to recognize LAN IP addresses and send the obtained first internet access IP address to the first application within the virtual system.
[0228] according to Figure 9A and Figure 9B In this embodiment, a first application within the virtual system can obtain a first internet IP address and obtain first internet data based on that first internet IP address.
[0229] Figure 10 A flowchart illustrating a method for a first application within a virtual system to obtain a first internet IP address is shown.
[0230] S1001, the first virtual network card is associated with the first network bridge.
[0231] S1002, the first bridge and the first physical network card are interconnected.
[0232] S1003, the second virtual network card is associated with the second bridge.
[0233] S1004, the second bridge and the second physical network card are interconnected.
[0234] S1005, the third virtual network card is associated with the third bridge.
[0235] S1006, the third bridge, and the third physical network card are interconnected.
[0236] The electronic device 100 can be configured with one or more types of physical network interface cards (NICs). Multiple physical NICs of the same type can also be configured on the electronic device simultaneously.
[0237] For example, if the electronic device 100 supports mobile cellular networks, WiFi networks 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 for applications inside a container to be aware of the real network outside the container, virtual network interfaces need to be created inside the container that correspond one-to-one with the physical network interfaces.
[0239] The number of virtual network cards needs to be the same as the number of physical network cards. For example, 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 for the virtual network interface card inside the container to transmit data with the physical network interface card outside the container, a bridge needs to be pre-configured outside the container. The bridge enables communication between the virtual network interface card inside the container and the physical network interface card outside the container.
[0242] The number of bridges is the same as the number of physical network interface cards (NICs). For example, a first bridge, a second bridge, and a third bridge can be pre-installed outside the container, where the first bridge corresponds to the first physical NIC, the second bridge corresponds to the second physical NIC, and the third bridge corresponds to the third physical NIC.
[0243] The first virtual network interface card (NIC) is associated with the first network bridge, which can be connected to the first physical NIC. The first virtual NIC can communicate with the first physical NIC through the first network bridge.
[0244] The second virtual network interface card (NIC) is associated with a second bridge, which in turn connects to a second physical NIC. The second virtual NIC can communicate with the second physical NIC through the second bridge.
[0245] The third virtual network interface card (NIC) is associated with a third network bridge, which can connect to the third physical NIC. The third virtual NIC can communicate with the third physical NIC through the third network bridge.
[0246] S1007, The first virtual network card has corresponding first network configuration information.
[0247] S1008, the second virtual network card has corresponding second network configuration information.
[0248] S1009, the third virtual network card has corresponding third network configuration information.
[0249] After creating a virtual network interface card (NIC) within the container, the electronic device 100 needs to obtain the network configuration information of the virtual NIC. The network configuration information of the virtual NIC may include, but is not limited to, one or more of the following: the internet access method corresponding to the physical NIC, the on / off status of the internet access method corresponding to the physical NIC, the IP address of the physical NIC, the bandwidth of the internet access method corresponding to the physical NIC, the routing of the internet access method corresponding to the physical NIC, the IP address of the bridge, and the DNS address. 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. The operator network type includes, but is not limited to, China Mobile, China Unicom, and China Telecom.
[0250] Network configuration information for non-virtual network adapters.
[0251] For example, key information about the first physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the first physical NIC, the on / off status of the internet access method corresponding to the first physical NIC, the IP address of the first physical NIC, the bandwidth of the internet access method corresponding to the first physical NIC, the routing of the internet access method corresponding to the first physical NIC, 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 NIC may be a mobile cellular network, and the on / off status of the internet access method corresponding to the first physical NIC may be the on / off status of the mobile cellular network.
[0252] Key information about the second physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the second physical NIC, the on / off status of the internet access method corresponding to the second physical NIC, the IP address of the second physical NIC, the bandwidth of the internet access method corresponding to the second physical NIC, the routing of the internet access method corresponding to the second physical NIC, 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 NIC may be a WiFi network, and the on / off status of the internet access method corresponding to the second physical NIC may be the on / off status of the WiFi network.
[0253] Key information about the third physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the third physical network interface card, the on / off status of the internet access method corresponding to the third physical network interface card, the IP address of the third physical network interface card, the bandwidth of the internet access method corresponding to the third physical network interface card, the routing of the internet access method corresponding to the third physical network interface card, the IP address of the third bridge, the primary DNS address, or both the primary and secondary DNS addresses. For example, the internet access method corresponding to the third physical network interface card may be Bluetooth, and the on / off status of the internet access method corresponding to the third physical network interface card may be the on / off status of Bluetooth.
[0254] The network configuration information of different virtual network cards is used to determine whether the network of the virtual network card is available and the DNS address used to obtain the Internet IP address before the first application installed in the virtual system accesses the Internet.
[0255] S1010, the first bridge / second bridge / third bridge stores the mapping relationship between the IP addresses of virtual network cards and the IP addresses of physical network cards.
[0256] Optionally, if the virtual system uses a local area network (LAN) IP address while the external system uses a public IP address, the bridge also needs to store the mapping between the virtual network adapter's IP address and the physical network adapter's IP address. This is because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to change the LAN IP address to a public IP address to avoid failures in obtaining an internet IP address.
[0257] Specifically, the first bridge stores the 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 bridge stores the 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 bridge stores the 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 interface card inside the container is also a public IP address, the bridge may not store the mapping relationship between the IP address of the virtual network interface card and the IP address of the physical network interface card, that is, S1010 is not executed.
[0261] S1011, The first application determines that it will access the Internet through the first virtual network card based on the first Internet access method.
[0262] When the first application needs to access the internet, for example, to obtain the first piece of internet data, the first application can determine the first internet access method. Based on the first internet access method, the first application then determines the first virtual network card from multiple virtual network cards and accesses the internet through the first virtual network card.
[0263] Optionally, the first internet access method can be preset by the first application, selected by the user, or set by the system default; this application does not limit this.
[0264] For example, if the first application is an app store and the first internet access data is the application's installation package, the first application needs to download the installation package via a WiFi network, so the first internet access method can be a WiFi network. Since the second virtual network adapter corresponds to the WiFi network access method, the first application can determine that it will access the internet through the first virtual network adapter.
[0265] Among 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] Third DNS packets may include multiple fields, such as, but not limited to, source IP address field, destination IP address field, source port field, destination port field, PAYLOAD field, etc.
[0268] When the first application determines that it is accessing the Internet through the first virtual network card, the first application can obtain the first network configuration information of the virtual network card and obtain the attribute values of multiple fields from the first network configuration information of the virtual network card to obtain the third DNS data packet. The third DNS data packet is used by the first DNS to obtain the first Internet IP address.
[0269] For example, such as Figure 9A As shown, the source IP address field in the third DNS packet can be filled with the IP address of the first virtual network card, "192.168.2.0", the destination IP address field can be filled with the IP address of the first DNS, "8.8.8.8", 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 may include the first domain name. The first domain name corresponds to the first Internet IP address, and the first DNS stores the mapping relationship between the first domain name and the first Internet 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 bridge.
[0272] After generating the third DNS data packet, the first application sends the third DNS data packet to the first virtual network interface card (NIC). The first virtual NIC then sends the third DNS data packet to the first bridge.
[0273] S1015. The first 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, thus obtaining the fourth DNS data packet.
[0274] After obtaining the third-party DNS data packet, if the source IP address in the third-party DNS data packet is a local area network (LAN) IP address, the first network bridge needs to modify the source IP address in the third-party DNS data packet to the IP address of the first physical network interface card (NIC), "10.1.1.0". The IP address of the first physical NIC, "10.1.1.0", can be a public IP address. In this way, the first DNS can recognize the public IP address and send the obtained first internet access IP address to the device or apparatus corresponding to that public IP address.
[0275] Optionally, in other embodiments, if the source IP address in the third DNS packet is a public IP address, the first bridge may not modify the source IP address in the third DNS packet to the IP address of the first physical network card, "10.1.1.0", that is, it may not execute S1015.
[0276] S1016, The first 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 data, the first physical network card can obtain the destination IP address "8.8.8.8" from the fourth DNS data packet. The first physical network card can then send the fourth DNS data packet to the DNS server based on the destination IP address "8.8.8.8".
[0279] For example, the destination IP address "8.8.8.8" can be the IP address of the first DNS, which can be the first DNS.
[0280] S1018. In response to the fourth DNS packet, the first DNS obtains the first Internet IP address based on the first domain name.
[0281] S1019. The first DNS generates the first response data packet of the four DNS data packets based on the first Internet IP address.
[0282] In response to the fourth DNS packet, the first DNS can obtain the first domain name from the PAYLOAD field of the fourth DNS packet. The first DNS stores the correspondence between the first domain name and the first Internet IP address, and can obtain the first Internet IP address based on the first domain name.
[0283] The first response packet may include multiple fields, such as the source IP address field, destination IP address field, source port field, destination port field, PAYLOAD field, etc.
[0284] After the first DNS obtains the first Internet IP address based on the first domain name in the fourth DNS packet, the first DNS can generate a first response packet based on the first Internet IP address, the source IP address in the fourth DNS packet, the destination IP address in the fourth DNS packet, the source port in the fourth DNS packet, and the destination port in the fourth DNS packet.
[0285] like Figure 9B As shown, the source IP address field in the first response packet can be filled with the IP address of the first DNS, "8.8.8.8", the destination IP address field can be filled with the IP address of the first physical network card, "10.1.1.0", the source port field can be filled with "53", the destination port field can be filled with "65535", and the PAYLOAD field can be filled with the response message, which may include the first Internet IP address.
[0286] S1020, the first DNS sends the first response data packet to the first physical network card.
[0287] S1021, The first physical network card sends the first response data packet to the first bridge.
[0288] S1022, The first 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, and obtains the second response data packet.
[0289] like Figure 9B As shown, after receiving the first response data packet from the first DNS, the first physical network card (NIC) then forwards the first response data packet to the first bridge. Upon receiving the first response data packet, the first bridge modifies the destination IP address in the first response data packet to the IP address of the first virtual NIC, "192.168.2.0", to obtain the second response data packet. The IP address of the first virtual NIC, "192.168.2.0", can be a local area network (LAN) IP address, allowing the virtual system to recognize LAN IP addresses and send the obtained first internet access IP address to the first application within the virtual system.
[0290] Optionally, if the IP address of the virtual network card inside 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, it may not execute S1022.
[0291] S1023, The first 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 IP address from the second response data packet.
[0294] After obtaining the second response packet based on the second response packet, the first bridge then sends the second response packet to the first virtual network interface card (NIC). The first virtual NIC then sends the second response packet to the first application. The first application can obtain the first internet IP address from the PAYLOAD field of the second response packet.
[0295] After the first application obtains the first Internet IP address, the first application can obtain the first Internet data based on the first Internet IP address, thus realizing the process of the first application accessing the Internet through the first virtual network card.
[0296] Example 2
[0297] The 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, obtaining the network configuration information of the virtual network card, and obtaining the first Internet IP address for the first application in the virtual system.
[0298] The specific implementation of creating a corresponding virtual network interface card based on a physical network interface card in Example 2 is similar to the specific implementation of creating a corresponding virtual network interface card based on a physical network interface card in Example 1. For details, please refer to Example 1. Figures 3A-3E as well as Figures 4A-4D The description of the subject matter will not be repeated here.
[0299] Obtain the network configuration information for each virtual network interface card.
[0300] For details on how to implement the network configuration information for each virtual network card, please refer to the description in Embodiment 1. This application will not repeat the details here.
[0301] It should be noted that the default DNS address is fixed and can be a virtual DNS address. Regardless of how the DNS address outside the container changes, there is no need to update the DNS address inside the virtual system, so as to reduce data interaction between the inside and outside of the container.
[0302] Different bridges have different IP addresses; for example, the IP addresses of the first bridge, the second bridge, and the third bridge are all different.
[0303] The network configuration information of a virtual network interface card (NIC) can be obtained based on the IP address of the bridge corresponding to the virtual NIC and key information of the physical NIC corresponding to the virtual NIC.
[0304] For example, electronic device 100 can 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] 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 bridge.
[0306] 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 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 also 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. This further reduces data interaction between inside and outside the container.
[0309] Figure 11 A schematic diagram of network configuration information corresponding to each virtual network interface card is shown.
[0310] Figure 11 This only shows a portion of the network configuration information for each virtual network interface card (NIC), such as the IP address and DNS address of the virtual NIC.
[0311] like Figure 11 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" and the DNS address "192.168.2.100".
[0312] like Figure 11 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" and the DNS address "192.168.2.100".
[0313] like Figure 11 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" and the DNS address "192.168.2.100".
[0314] The DNS address "192.168.2.100" can be a virtual DNS address. This allows the DNS address within the virtual system to be preset to a default value. Regardless of changes in the DNS address outside the container, there is no need to update the DNS address within the virtual system, thereby reducing data interaction between the container and the outside.
[0315] For example, if the electronic device 100 determines the first DNS based on the geographical location of the electronic device 100 and / or the type of operator network used by the electronic device 100, for example, the first DNS address may be "8.8.8.8", and the DNS address inside the container is still "192.168.2.100", the DNS address inside 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 inside the container is still "192.168.2.100", and the DNS address inside the container will not change with the change of the DNS address outside the container.
[0317] In some embodiments, the number of DNS determined based on the first operator network used by the electronic device 100 and / or the first geographical location of the electronic device 100 can be multiple. The electronic device 100 can obtain the addresses of multiple DNS and obtain the network configuration information of each virtual network card based on the addresses of these multiple DNS, so that the application in the virtual system can obtain the Internet IP address based on multiple DNS, avoiding the situation where there is only one DNS and the failure occurs, resulting in the failure to obtain the Internet IP address.
[0318] Optionally, when multiple DNS addresses are obtained outside the container, multiple DNS addresses also need to be pre-configured inside the container. These multiple DNS addresses can be virtual addresses.
[0319] Optionally, these multiple DNS addresses can be divided into primary DNS addresses and backup DNS addresses. When applications within the virtual system access the internet, they should prioritize accessing the internet via the primary DNS, and only access the internet via the backup DNS when the primary DNS is unavailable.
[0320] Figure 12 This diagram illustrates the network configuration information corresponding to another type of virtual network card.
[0321] Figure 12 It only shows a portion of the network configuration information corresponding to each virtual network interface card, such as the IP address and DNS address of the virtual network interface card.
[0322] like Figure 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 Figure 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 Figure 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] The primary DNS address "192.168.2.100" and the backup DNS address "192.168.2.101" can be virtual DNS addresses. This allows the DNS addresses within the virtual system to be preset to default values. Regardless of changes in the DNS addresses outside the container, there is no need to update the DNS addresses within the virtual system, thereby reducing data interaction between the container and the outside.
[0326] Not limited to one backup DNS, the electronic device 100 may also obtain the DNS addresses of multiple backup DNS, and this application does not limit this.
[0327] The bridge stores the mapping relationship between DNS addresses inside the container and DNS addresses outside the container.
[0328] Because the DNS addresses in the network configuration information of each virtual network interface card within the container are virtual addresses, not real DNS addresses, the bridge needs to modify the virtual DNS addresses to real DNS addresses before applications within the virtual system can access the internet. Therefore, the bridge needs to store the mapping relationship between the DNS addresses inside the container and the DNS addresses outside the container.
[0329] Optionally, if the virtual system uses a local area network (LAN) IP address while the external system uses a public IP address, the bridge also needs to store the mapping between the virtual network adapter's IP address and the physical network adapter's IP address. This is because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to change the LAN IP address to a public IP address to avoid failures in obtaining an internet IP address.
[0330] For example, such as Figure 13 As shown, the first 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] The IP address of the first virtual network interface card is "192.168.2.0". The first virtual network interface card corresponds to the first physical network interface card, and the IP address of the first physical network interface card is "10.1.1.0". The real DNS address obtained outside the container can be "8.8.8.8".
[0332] The IP address of the second virtual network interface is "192.168.2.1". The second virtual network interface corresponds to the second physical network interface, and the IP address of the second physical network interface 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 interface is "192.168.2.2". The third virtual network interface corresponds to the third physical network interface, and the IP address of the third physical network interface 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” can be a first DNS address, which can 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.
[0335] For example, such as Figure 14 As shown, the first 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] 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". The real DNS address obtained outside the container can be "8.8.8.8" or "8.8.4.4".
[0337] The IP address of the second virtual network interface card is "192.168.2.1". The second virtual network interface card corresponds to the second physical network interface card, and the IP address of the second physical network interface card is "10.1.1.1". The real DNS address obtained outside the container can be "8.8.8.8" or "8.8.4.4".
[0338] The IP address of the third virtual network interface is "192.168.2.2". The third virtual network interface corresponds to the third physical network interface, and the IP address of the third physical network interface is "10.1.1.2". The real DNS address obtained outside the container can be "8.8.8.8" or "8.8.4.4".
[0339] The DNS address “8.8.8.8” can be the first DNS address, and the DNS address “8.8.4.4” can be the third DNS address. 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 geographical location of the electronic device 100.
[0340] In this context, the first DNS address can be the primary DNS address, and the third DNS address can be a backup DNS address. The first DNS address can correspond to the primary virtual DNS address within the container, and the third DNS address can correspond to the backup virtual DNS address within the container. This establishes the association between DNS addresses inside and outside the container.
[0341] Optionally, the mapping between DNS addresses inside and outside the container, and between the IP addresses of virtual network interface cards (NICs) and physical NICs, can be stored at the physical NIC. The physical NIC can then modify the DNS addresses inside and outside the container to the DNS addresses outside the container, and the IP addresses of virtual NICs to the IP addresses of physical NICs. This allows the physical NIC to change the DNS addresses inside and outside the container to the DNS addresses outside the container, and to change the LAN IP addresses to public IP addresses, thus preventing failures in obtaining internet IP addresses. This application does not limit this specific approach.
[0342] In some embodiments, the DNS address obtained by the electronic device 100 changes after 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 DNS address at the bridge, but does not need to update the DNS address within the container.
[0343] The DNS address is related to the geographical location of electronic device 100 and / or the type of network operator used by electronic device 100. When the geographical location of electronic device 100 and / or the type of network operator used by electronic device 100 change, the DNS address will also change. This causes changes to key information of the physical network interface card, which in turn leads to changes in the network configuration information of the virtual network interface card.
[0344] In some embodiments, if the geographical location of the electronic device 100 and / or the operator network used by the electronic device 100 changes, the electronic device 100 obtains a second DNS address, which may be the IP address of the second DNS.
[0345] Accordingly, electronic device 100 needs to update the real DNS address stored at the bridge.
[0346] For example, such as Figure 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, and the IP address of the first physical network card is "10.1.1.0". The real DNS address obtained outside the container can be "7.7.7.7".
[0347] The IP address of the second virtual network interface is "192.168.2.1". The second virtual network interface corresponds to the second physical network interface, and the IP address of the second physical network interface 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 interface is "192.168.2.2". The third virtual network interface corresponds to the third physical network interface, and the IP address of the third physical network interface 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" can be a second DNS address, which can 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, without having to update the DNS address stored inside the container, thus reducing the amount of data exchanged between the container and the outside.
[0350] For example, such as Figure 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, and the IP address of the first physical network card is "10.1.1.0". The real DNS address obtained outside the container can be "7.7.7.7" or "7.7.4.4".
[0351] The IP address of the second virtual network interface card is "192.168.2.1". The second virtual network interface card corresponds to the second physical network interface card, and the IP address of the second physical network interface card is "10.1.1.1". The real DNS address obtained outside the container can be "7.7.7.7" or "7.7.4.4".
[0352] The IP address of the third virtual network interface is "192.168.2.2". The third virtual network interface corresponds to the third physical network interface, and the IP address of the third physical network interface is "10.1.1.2". The real DNS address obtained outside the container can be "7.7.7.7" or "7.7.4.4".
[0353] In this configuration, the DNS address "7.7.7.7" can be a second DNS address, and the DNS address "7.7.4.4" can be a fourth DNS address. Both the second and fourth DNS addresses can 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. Thus, when the DNS address changes, the electronic device 100 only needs to update the DNS address stored at the bridge, without needing to update the DNS address stored inside the container, reducing the amount of data exchanged between the container and the outside world.
[0354] The first application within the virtual system obtains the first internet IP address.
[0355] Figure 17 and Figure 18 This diagram illustrates how the first application within a virtual system obtains the first internet IP address.
[0356] Before the first application within the virtual system can access the internet, it needs to obtain an IP address from a DNS server. Once the first application determines it will access the internet via a specific method, the virtual system can determine if that method is available from among various options. If available, the virtual system then identifies the virtual network adapter corresponding to that method. Based on the network configuration information of this virtual network adapter, a first DNS packet is generated, which is used to obtain the first internet IP address.
[0357] Specifically, such as Figure 17 As shown, before the first application within the virtual system can access the internet, it needs to obtain the first internet IP address. Before obtaining the first internet IP address, the virtual system can determine the first application's first internet access method. Based on the first internet access method, the virtual system then determines whether to access the internet through the first virtual network card from among multiple virtual network cards.
[0358] For example, the first internet access is via mobile cellular network. The virtual system can determine that the internet access method corresponding to the first virtual network card is mobile cellular network. The virtual system can determine that the first application accesses the internet via the first virtual network card.
[0359] For example, the first internet access is via WiFi. The virtual system can determine that the second virtual network adapter's internet access method is WiFi. The virtual system can then determine that the first application accesses the internet via the second virtual network adapter.
[0360] The virtual system operation method provided in this application enables the virtual system to perceive the real network outside the container and select the corresponding network for internet access as needed.
[0361] For example, when the first application determines that it is accessing 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 packet based on the first internet access request. The first DNS packet is used to obtain the first internet access IP address. The first DNS packet may include multiple fields, such as source IP address field, destination IP address field, source port field, destination port field, PAYLOAD field, etc.
[0363] The source IP address field indicates the source address of the first DNS packet, the destination IP address field indicates the destination address of the first DNS packet, and the PAYLOAD field indicates the purpose of the first DNS packet.
[0364] For example, the source IP address field can be filled with the IP address of the first virtual network card, "192.168.2.0", 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", the PAYLOAD field can be filled with a request message, which may include the first domain name, the first domain name corresponds to the first Internet IP address, and the first DNS stores the mapping relationship between the first domain name and the first Internet IP address.
[0365] The first virtual network interface card can obtain the first DNS packet and send the first DNS packet to the first bridge outside the container.
[0366] After obtaining the first DNS data packet, if the source IP address in the first DNS data packet is a local area network IP address, the first network bridge needs to modify the source IP address in the first DNS data packet to the IP address of the first physical network card, "10.1.1.0". The IP address of the first physical network card, "10.1.1.0", can be a public IP address, so that the first DNS can recognize the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address.
[0367] The first bridge also needs to modify the DNS address in the first DNS packet to the actual DNS address "8.8.8.8". The DNS address "8.8.8.8" can be the address of the first DNS server. This allows the first physical network card to access the DNS server based on the actual DNS address in the DNS packet.
[0368] For example, the first bridge can be generated based on the first DNS packet. Figure 17 The second DNS packet shown is sent to the first physical network interface card (NIC). The first NIC can send the second DNS packet to the first DNS server based on the destination IP address in the second DNS packet, so that the first DNS server can obtain the first Internet 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 packet, the first DNS can generate a first response packet based on the first Internet IP address, the source IP address in the second DNS packet, the destination IP address in the second DNS packet, the source port in the second DNS packet, and the destination port in the second DNS packet. The first DNS then sends the first response packet to the first physical network card.
[0370] The first response packet may include multiple fields, such as the source IP address field, destination IP address field, source port field, destination port field, PAYLOAD field, etc.
[0371] like Figure 18 As shown, the source IP address field in the first response packet can be filled with the IP address of the first DNS, "8.8.8.8", the destination IP address field can be filled with the IP address of the first physical network card, "10.1.1.0", the source port field can be filled with "53", the destination port field can be filled with "65535", and the PAYLOAD field can be filled with the response message, which may include the first Internet IP address.
[0372] After receiving the first response data packet sent by the first DNS, the first physical network card then sends the first response data packet to the first 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 of the first virtual network interface card, "192.168.2.0", to obtain the second response data packet. The IP address of the first virtual network interface card, "192.168.2.0", can be a local area network (LAN) IP address, allowing the virtual system to recognize LAN IP addresses and send the obtained first internet access IP address to the first application within 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, the source IP address "8.8.8.8" in the second response data packet is modified to "192.168.2.100" to obtain the second response data packet.
[0375] according to Figure 17 and Figure 18 In this embodiment, a first application within the virtual system can obtain a first internet IP address and obtain first internet data based on that first internet IP address.
[0376] Figure 19 This diagram illustrates a method for a first application within a virtual system to obtain a first internet IP address.
[0377] For descriptions of S1901-S1906, please refer to... Figure 10 The descriptions of S1001-S1006 in the embodiments will not be repeated here.
[0378] S1907, The first virtual network card has corresponding first network configuration information.
[0379] S1908, the second virtual network card has corresponding second network configuration information.
[0380] S1909, the third virtual network card has corresponding third network configuration information.
[0381] After creating a virtual network interface card (NIC) within the container, the electronic device 100 needs to obtain the network configuration information of the virtual NIC. The network configuration information of the virtual NIC may include, but is not limited to, one or more of the following: the internet access method corresponding to the physical NIC, the on / off status of the internet access method corresponding to the physical NIC, the IP address of the physical NIC, the bandwidth of the internet access method corresponding to the physical NIC, the routing of the internet access method corresponding to the physical NIC, the IP address of the bridge, and the preset DNS address, etc.
[0382] Network configuration information for non-virtual network adapters.
[0383] Key information about the first physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the first physical network interface card, the on / off status of the internet access method corresponding to the first physical network interface card, the IP address of the first physical network interface card, the bandwidth of the internet access method corresponding to the first physical network interface card, the routing of the internet access method corresponding to the first physical network interface card, and the preset DNS address. For example, the internet access method corresponding to the first physical network interface card may be a mobile cellular network, and the on / off status of the internet access method corresponding to the first physical network interface card may be the on / off status of the mobile cellular network.
[0384] Key information about the second physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the second physical network interface card, the on / off status of the internet access method corresponding to the second physical network interface card, the IP address of the second physical network interface card, the bandwidth of the internet access method corresponding to the second physical network interface card, the routing of the internet access method corresponding to the second physical network interface card, and the preset DNS address. For example, the internet access method corresponding to the second physical network interface card may be a WiFi network, and the on / off status of the internet access method corresponding to the second physical network interface card may be the on / off status of the WiFi network.
[0385] Key information about the third physical network interface card (NIC) may include, but is not limited to, one or more of the following: the internet access method corresponding to the third physical network interface card, the on / off status of the internet access method corresponding to the third physical network interface card, the IP address of the third physical network interface card, the bandwidth of the internet access method corresponding to the third physical network interface card, the routing of the internet access method corresponding to the third physical network interface card, and the preset DNS address. For example, the internet access method corresponding to the third physical network interface card may be Bluetooth, and the on / off status of the internet access method corresponding to the third physical network interface card may be the on / off status of Bluetooth.
[0386] It should be noted that the default DNS address is fixed and can be a virtual DNS address. Regardless of how the DNS address outside the container changes, there is no need to update the DNS address inside the virtual system, so as to reduce data interaction between the inside and outside of the container.
[0387] Different bridges have different IP addresses; for example, the IP addresses of the first bridge, the second bridge, and the third bridge are all different.
[0388] The network configuration information of a virtual network interface card (NIC) can be obtained based on the IP address of the bridge corresponding to the virtual NIC and key information of the physical NIC corresponding to the virtual NIC.
[0389] For example, electronic device 100 can 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] 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 bridge.
[0391] 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 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 also 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. This further reduces data interaction between inside and outside the container.
[0394] The mapping relationship between the DNS address inside the storage container and the first DNS address outside the container, and the mapping relationship between the IP address of the virtual network card and the IP address of the physical network card, are stored at S1910, the first bridge, the second bridge, and the third bridge.
[0395] Because the DNS addresses in the network configuration information of each virtual network interface card within the container are virtual addresses, not real DNS addresses, the bridge needs to modify the virtual DNS addresses to real DNS addresses before applications within the virtual system can access the internet. Therefore, the bridge needs to store the mapping between the DNS addresses inside the container and the primary DNS address outside the container.
[0396] The first DNS address can be a real DNS address.
[0397] Optionally, if the virtual system uses a local area network (LAN) IP address while the external system uses a public IP address, the bridge also needs to store the mapping between the virtual network adapter's IP address and the physical network adapter's IP address. This is because DNS can only recognize public IP addresses. Therefore, before accessing DNS, the bridge needs to change the LAN IP address to a public IP address to avoid failures in obtaining an internet IP address.
[0398] Specifically, the first bridge stores the mapping relationship between the DNS address inside the container and the first DNS address outside the container, as well as the mapping relationship between the IP address of the first virtual network card and the IP address of the first physical network card.
[0399] The second bridge stores the mapping relationship between the DNS address inside the container and the first DNS address outside the container, as well as the 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 bridge stores the mapping relationship between the DNS address inside the container and the first DNS address outside the container, as well as the 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 interface card inside the container is also a public IP address, the bridge may not store the mapping relationship between the IP address of the virtual network interface card and the IP address of the physical network interface card.
[0402] For descriptions of S1911-S1914, please refer to... Figure 10 The descriptions of S1011-S1014 in the embodiments will not be repeated here.
[0403] S1915. The first 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 the second DNS data packet.
[0404] After obtaining the first DNS data packet, if the source IP address in the first DNS data packet is a local area network IP address, the first network bridge needs to modify the source IP address in the first DNS data packet to the IP address of the first physical network card, "10.1.1.0". The IP address of the first physical network card, "10.1.1.0", can be a public IP address, so that the first DNS can recognize the public IP address and send the obtained first Internet access IP address to the device or apparatus corresponding to the public IP address.
[0405] The first bridge also needs to modify the DNS address in the first DNS packet to the actual DNS address, such as the first DNS address, which could be "8.8.8.8". This allows the first physical network card to access DNS based on the actual DNS address in the DNS packet.
[0406] Optionally, in other embodiments, if the source IP address in the first DNS packet is a public IP address, the first bridge may not modify the source IP address in the first DNS packet to the IP address of the first physical network card.
[0407] S1916, The first 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 data, the first physical network card can obtain the destination IP address "8.8.8.8" from the second DNS data packet. The first physical network card can then send the second DNS data packet to the DNS server based on the destination IP address "8.8.8.8".
[0410] For example, the destination IP address "8.8.8.8" can be the IP address of the first DNS, which can be the first DNS.
[0411] S1918, In response to the second DNS packet, the first DNS obtains the first Internet IP address based on the first domain name.
[0412] S1919, The first DNS generates the first response data packet of the second DNS data packet based on the first Internet IP address.
[0413] For descriptions of S1916-S1919, please refer to... Figure 10 The descriptions of S1016-S1019 in the embodiments will not be repeated here.
[0414] S1920, the first DNS sends the first response packet to the first physical network card.
[0415] S1921, The first physical network card sends the first response data packet to the first bridge.
[0416] S1922, The first 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, and obtains the second response data packet.
[0417] like Figure 18 As shown, after receiving the first response data packet from the first DNS, the first physical network card (NIC) then forwards the first response data packet to the first bridge. Upon receiving the first response data packet, the first bridge modifies the destination IP address in the first response data packet to the IP address of the first virtual NIC, "192.168.2.0", to obtain the second response data packet. The IP address of the first virtual NIC, "192.168.2.0", can be a local area network (LAN) IP address, allowing the virtual system to recognize LAN IP addresses and send the obtained first internet access IP address to the first application within 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 preset DNS address 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 the second response data packet.
[0419] Optionally, if the IP address of the virtual network interface card inside the container is also a public IP address, the bridge may not modify the IP address of the first physical network interface card in the first response data packet to the IP address of the first virtual network interface card.
[0420] S1923, The first 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 IP address from the second response data packet.
[0423] After obtaining the second response data packet based on the first response data packet, the first bridge sends the second response data packet to the first virtual network interface card (NIC). The first virtual NIC then sends the second response data packet to the first application. The first application can obtain the first internet IP address from the PAYLOAD field of the second response data packet.
[0424] After the first application obtains the first Internet IP address, the first application can obtain the first Internet data based on the first Internet IP address, thus realizing the process of the first application accessing the Internet through the first virtual network card.
[0425] Figure 20 This is a flowchart illustrating 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 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, and the destination address is a preset DNS address. The first DNS data packet is used to request an Internet 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 bridge, and obtains the second DNS data packet.
[0428] S2003. The electronic device sends the second DNS data packet to the first DNS through the first bridge and the first physical network card.
[0429] S2004. The electronic device receives the 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 the first Internet 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, and the destination address of the first data packet is the first Internet access IP address.
[0431] This method is applied to electronic devices, which are pre-installed with a first physical network card and a first network bridge. The electronic devices are equipped with a virtual system, in which a first application runs. The virtual system also runs a first virtual network card, which is connected to a first network bridge. The first network bridge is connected to the first physical network card. The virtual system stores a preset DNS address, and the first network bridge stores the IP address of the first DNS.
[0432] The first DNS packet and the second DNS packet contain the first domain name, which is used to obtain the first Internet IP address.
[0433] Using this method, a preset DNS address can be configured within the virtual system. The first bridge stores the IP address of the first DNS, which can be a real address or determined based on the operator's network and / or geographical location. When obtaining an internet IP address, the bridge can modify the preset DNS address in the DNS data packet to the IP address of the first DNS, thereby enabling the first application to access the DNS.
[0434] In one possible implementation, the first bridge stores the IP address of the second DNS, which is different from the first DNS. An electronic device receives a third DNS data packet sent by a first application via the first bridge. The third DNS data packet includes a source address and a destination address, where the source address is the IP address of the first virtual network interface card (NIC), and the destination address is a preset DNS address. 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 via the first bridge, obtaining a fourth DNS data packet. The electronic device sends the fourth DNS data packet to the second DNS via the first bridge and the first physical NIC. The electronic device receives a third response data packet sent by the second DNS via the first physical NIC and sends the fourth response data packet to the first application via the first bridge. The third and fourth response data packets include the second internet access IP address. The electronic device sends a second data packet via 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, the updated DNS address only needs to be stored at the bridge, and no updates are needed within the virtual system. This reduces data interaction between the virtual system and the outside world, and also ensures that the first application accesses the DNS based on the updated DNS address, thereby obtaining an internet IP address.
[0436] In other embodiments, after a DNS change, the DNS address at the bridge may not be updated. Instead, the updated DNS address is sent to the virtual system, where it is stored. When the first application generates DNS packets, the DNS packets already contain the updated DNS address, eliminating the need for the bridge to update the DNS address in the DNS packets.
[0437] In one possible implementation, the first data packet is used to request internet access data corresponding to the first internet IP address.
[0438] In one possible implementation, before obtaining the second DNS packet, the method further includes: if 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 packet from the IP address of the first virtual network card to the IP address of the first physical network card through the first bridge.
[0439] Because DNS does not recognize LAN IP addresses, when the IP address of the first virtual network card is a 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. This allows DNS to recognize the DNS data packet and ensures that DNS can successfully obtain the Internet IP address.
[0440] In one possible implementation, the electronic device receives a first response data packet sent by a first DNS through a first physical network, and sends a second response data packet to a first application through a first bridge. Specifically, the electronic device receives a first response data packet sent by a first physical network card through a 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; and the electronic device sends the second response data packet to the first application through the first bridge.
[0441] In one possible implementation, the first bridge stores a preset DNS address; 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 the second response data packet. Specifically, 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 the second response data packet.
[0442] In one possible implementation, the electronic device is also pre-installed with a second physical network card and a second bridge. A second virtual network card runs within the virtual system. The second virtual network card is connected to the second bridge, and the second bridge is connected to the second physical network card. The IP address of the first DNS is stored in the second bridge.
[0443] In this way, applications within the virtual system can perceive the real network conditions outside the system, achieving consistent networking inside and outside the container.
[0444] In one possible implementation, the first physical network card corresponds to the first internet access method, and the second physical network card corresponds to the second internet access method. The first internet access method and the second internet access method are different.
[0445] In one possible implementation, the first or second internet access method includes any of the following: mobile cellular network, WiFi network, or Bluetooth.
[0446] This 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 computer programs, and when the processor executes and calls the computer programs, the electronic device performs... Figure 20 This illustrates a method for operating a virtual system.
[0447] This application provides a computer-readable storage medium, including instructions that, when executed on an electronic device, cause the electronic device to perform... Figure 20 This illustrates a method for operating a virtual system.
[0448] This application provides a computer program product that, when run on an electronic device, causes the electronic device to perform... Figure 20 This illustrates a method for operating a virtual system.
[0449] refer to Figure 21 , Figure 21 A schematic diagram of the electronic device is shown.
[0450] Electronic device 100 may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device and / or smart city device. The embodiments of this application do not impose any special restrictions on the specific type of electronic device.
[0451] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0452] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0453] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0454] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0455] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0456] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[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 I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate 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 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls 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 the 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, enabling the function of answering phone calls through 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 used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically 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 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.
[0461] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.
[0462] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a 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] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0464] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0465] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0466] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0467] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[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 one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0469] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0470] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0471] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0472] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. 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 technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0473] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0474] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0475] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0476] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0477] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0478] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0479] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0480] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0481] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM).
[0482] Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), and double data rate synchronous dynamic random access memory (DDR SDRAM, such as fifth-generation DDR SDRAM, which is generally called DDR5 SDRAM). Non-volatile memory can include disk storage devices and flash memory.
[0483] Flash memory can be classified according to its operating principle, including NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.; according to the level of the storage cell, including single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc.; and according to the storage specification, including universal flash storage (UFS) and embedded multimedia card (eMMC), etc.
[0484] The random access memory can be directly read and written by the processor 110. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.
[0485] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110.
[0486] The external memory interface 120 can be used to connect to external non-volatile memory, thereby expanding 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 perform data storage functions. For example, music, video, and other files can be stored in the external non-volatile memory.
[0487] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0488] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0489] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.
[0490] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0491] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0492] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0493] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the intensity of the touch operation based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.
[0494] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.
[0495] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in 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 cover. 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 using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.
[0497] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.
[0498] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, electronic device 100 can utilize the distance sensor 180F to measure distance for rapid focusing.
[0499] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the 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 may use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.
[0500] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed 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 work with the proximity 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 utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.
[0502] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
[0503] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit 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 display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.
[0504] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.
[0505] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0506] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0507] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0508] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0509] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0510] Figure 22 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0511] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0512] The application layer can include a series of application packages.
[0513] like Figure 22 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0514] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0515] like Figure 22 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0516] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0517] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0518] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0519] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0520] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0521] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0522] The Android runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0523] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0524] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0525] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0526] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0527] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[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 graphics engine for 2D drawing.
[0530] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0531] The following example, using a scene of capturing a photograph, illustrates the workflow of the software and hardware of the electronic device 100.
[0532] When touch sensor 180K receives a touch operation, a 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, etc.). The raw input event is stored in the kernel layer. The application framework layer retrieves the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking a touch click as an example, where the corresponding control is the camera application icon, the camera application calls the application framework layer's interface to launch the camera application, and then calls the kernel layer to launch the camera driver, capturing still images or videos through camera 193.
[0533] The various embodiments of this application can be combined arbitrarily to achieve different technical effects.
[0534] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as 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, all or part of the processes or functions described in this application are generated. 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. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0535] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0536] In summary, the above description is merely an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made according to the disclosure of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for operating a virtual system, characterized in that, The method is applied to an electronic device, which has a pre-installed first physical network card and a first network bridge. The electronic device has a virtual system installed, a first application running within the virtual system, and a first virtual network card running within the virtual system. The first virtual network card is connected to the first network bridge, and the first bridge is connected to the first physical network card. The virtual system stores a preset DNS address, and the first bridge stores the IP address of the first DNS. The method includes: The electronic device receives a first DNS data packet sent by the first application through the first 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, and the destination address is the preset DNS address. The first DNS data packet is used to request an Internet 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 bridge, thereby obtaining a second DNS data packet; The electronic device sends the second DNS data packet to the first DNS via the first bridge and the first physical network card; The electronic device receives the 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 the first Internet 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 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, and the destination address is the preset DNS address. The third DNS data packet is used to request an Internet 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, thereby obtaining the fourth DNS data packet; The electronic device sends the fourth DNS data packet to the second DNS via the first bridge and the first physical network card; The electronic device receives the 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 the second Internet 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 internet access data corresponding to the first internet IP address.
4. The method according to any one of claims 1-3, characterized in that, Before obtaining the second DNS 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 bridge.
5. The method according to any one of claims 1-4, characterized in that, The electronic device receives the 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, 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, and obtains the second response data packet; The electronic device sends the second response data packet to the first application via the first bridge.
6. The method according to claim 5, characterized in that, The first bridge stores the preset DNS address; 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, thereby obtaining the second response data packet, which specifically includes: 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, thereby obtaining the second response data packet.
7. The method according to any one of claims 1-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 within the virtual system. The second virtual network card is connected to the second network bridge, and 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 the first internet access method, and the second physical network card corresponds to the second internet access method. 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 or second internet access method includes any one of the following: mobile cellular network, WiFi network, or Bluetooth.
10. 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 the computer program, the electronic device performs the method of any one of claims 1-7.
11. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device performs the method of any one of claims 1-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