Method and apparatus for performing network access by application in intelligent terminal device
Through the collaborative work of system services and network drivers, smart terminal devices can determine the network connection method based on the application interface type, solving the problem of not being able to specify the network connection method in existing technologies, and ensuring secure access and operation of applications under the specified network connection method.
Patent Information
- Application Number
- PCT/CN2024/128833
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-14
- Filing Date
- 2024-10-31
- Publication Date
- 2026-02-19
AI Technical Summary
Existing smart terminal devices cannot specify a particular application to use a particular network connection method during the network connection process, resulting in insecure network access and requiring merchants to manually switch connections.
Through the collaborative work of system services and network drivers, the network connection method is determined based on the application's interface type, and the application's specified network connection method is set through custom routing settings tables and routing rule tables, including the configuration and deletion of IP information and network connection methods.
It enables secure access for applications under specified network connection methods, avoids the risk of data leakage caused by network security issues, and ensures the security and controllability of network access.
Smart Images

Figure CN2024128833_19022026_PF_FP_ABST
Abstract
Description
Method and device for network access by application in intelligent terminal equipment
[0001] Cross-reference to Related Applications
[0002] This application claims priority from the Chinese patent application No. 202411112922.1 filed on August 14, 2024, and entitled "Method and device for network access by application in intelligent terminal equipment", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0003] The present application relates to the field of intelligent terminal security, and in particular to a method and device for network access by application in intelligent terminal equipment. BACKGROUND
[0004] An intelligent terminal is a kind of embedded computer system device. With the rapid development of information technology, intelligent terminal products have emerged in the payment field, such as intelligent POS machines and other devices. An intelligent POS machine is a kind of intelligent terminal device integrating payment, settlement, identification, printing and other functions. By integrating various advanced technologies and software, the intelligent POS machine provides more efficient and convenient services and brings a new experience to merchants and consumers.
[0005] At present, with the popularization of network connection methods, existing intelligent terminals can also provide multiple network connection methods to meet the diversified needs of merchants. Merchants can freely choose network connection methods and data paths, such as Ethernet, mobile data, Wi-Fi, etc. However, in the existing mobile terminal network connection process, network connection has priority, and a specific application cannot be specified to use a specific network connection method, resulting in unsafe problems in the process of accessing the background service by the specific application. If the merchant needs to use a specific network connection method for the specific application to access the background service, the merchant often needs to manually switch the connection. Therefore, how to solve the network access of the intelligent terminal equipment application according to the specified network connection method has become a technical problem to be solved at present.
[0006] SUMMARY
[0007] To solve the above technical problems, the present application provides a method and device for network access by application in intelligent terminal equipment. The technical solution is as follows:
[0008] According to a first aspect of the present application, a method for network access by application in intelligent terminal equipment is provided, the intelligent terminal equipment comprising a system service and a network driver, the method comprising:
[0009] Step S1, the system service determines an application network connection mode setting type according to a type of the called interface, and if the application network connection mode setting type is a first type, step S2 is performed;
[0010] Step S2, the system service acquires application configuration information input through a first preset interface called, and judges whether there is user permission information according to the application configuration information, and if yes, step S3 is performed, and if not, the process is ended;
[0011] Step S3, the system service acquires a custom routing setting table, saves network connection configuration information in the application configuration information into the custom routing setting table, and transmits the network connection configuration information into the network driver, wherein the network connection configuration information includes IP information and a network connection mode corresponding to the IP information;
[0012] Step S4, the network driver configures the network connection configuration information into a routing rule table through a configuration instruction, and the process is ended;
[0013] The method further comprises:
[0014] Step F1, when the system service receives a network connection request initiated by an application in the intelligent terminal device, the system service sends the network connection request to the network driver;
[0015] Step F2, the network driver acquires IP information in the network connection request, judges whether there is network connection configuration information matching the IP information in a routing rule table, and if yes, step F3 is performed, and if not, step F4 is performed;
[0016] Step F3, the network driver determines a network connection mode corresponding to the IP information through the routing rule table, sends a network request data packet to a server corresponding to the IP information according to the network connection mode, and performs step F5;
[0017] Step F4, the network driver sends a network request data packet to a server corresponding to the IP information according to a default network connection mode, and performs step F5;
[0018] Step F5, the network driver receives a network response data packet, and returns the network response data packet to the system service;
[0019] Step F6, the system service returns the network response data packet to the application.
[0020] According to a second aspect of the present application, an application access network setting device in an intelligent terminal device is provided, and the device comprises a system service and a network driver, and the system service comprises:
[0021] The first determining module is configured to determine an application network connection mode setting type according to a type of the called interface, and trigger the first obtaining and judging module if the application network connection mode setting type is a first type.
[0022] The first obtaining and judging module is configured to obtain application configuration information transmitted through the called first preset interface, and judge whether there is user permission information according to the application configuration information.
[0023] The obtaining and saving module is configured to obtain a custom routing setting table when the first obtaining and judging module judges that there is user permission information, save network connection configuration information in the application configuration information into the custom routing setting table, and transmit the network connection configuration information into the network driver.
[0024] The network driver comprises:
[0025] The configuration module is configured to configure the network connection configuration information into a routing rule table through a configuration instruction.
[0026] The system service further comprises:
[0027] The receiving module is configured to receive a network connection request initiated by an application in the intelligent terminal device, and receive a network response data packet.
[0028] The sending module is configured to send the network connection request received by the receiving module to the network driver, and return the network response data packet to the application.
[0029] The network driver further comprises:
[0030] The first judging module is configured to receive and obtain IP information in the network connection request.
[0031] The second judging module is configured to judge whether there is network connection configuration information matching the IP information in a routing rule table, and trigger a first processing module if yes, or trigger a second processing module if no.
[0032] The first processing module is configured to determine a network connection mode corresponding to the IP information through the routing rule table, send a network request data packet to a server corresponding to the IP information according to the network connection mode, receive a network response data packet, and return the network response data packet to the system service.
[0033] The second processing module is configured to send a network request data packet to a server corresponding to the IP information according to a default network connection mode, receive a network response data packet, and return the network response data packet to the system service.
[0034] According to a third aspect of the present application, the embodiments of the present application provide a computer device, comprising a memory, a processor and a computer program stored in the memory, the processor executes the computer program to implement the method for network access of an application in a smart terminal device according to the first aspect.
[0035] According to a fourth aspect of the present application, the embodiments of the present application provide a computer readable storage medium, having stored thereon a computer program / instruction, which, when executed by a processor, implements the method for network access of an application in a smart terminal device according to the first aspect.
[0036] According to a fifth aspect of the present application, the embodiments of the present application provide a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the method for network access of an application in a smart terminal device according to the first aspect.
[0037] The technical scheme provided by the embodiments of the present application has at least the following beneficial effects:
[0038] The present application provides a method and device for network access of an application in a smart terminal device, which sets the network connection mode specified by the application according to the determined network connection mode setting type of the system service and the network driver, solves the problem of network access security caused by the inability to set the network connection mode due to the lack of application permission, realizes the function of safe access and safe operation processing of the application under the specified network connection mode, and avoids the risk of data leakage caused by network security problems. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0040] Fig. 1 is a flow diagram of network setting in a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0041] Fig. 2 is a flow diagram of a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0042] Fig. 3 is a flow diagram of application installation package generation in a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0043] Figure 4 is a flow diagram of a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0044] Figures 5A-5B are flow diagrams of a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0045] Figures 6A-6B are flow diagrams of a method for network access of an application in a smart terminal device according to an embodiment of the present application;
[0046] Figures 7A-7B are flow diagrams of a method for network access of an application in a smart terminal device according to an embodiment of the present application. DETAILED DESCRIPTION
[0047] For the purpose of making the purpose, technical scheme and advantages of the present application more clear, the following will make a further detailed description of the embodiments of the present application in connection with the drawings.
[0048] The following description refers to the accompanying drawings. Unless otherwise indicated, like numbers in the different figures represent the same or similar elements. The following example embodiments described are not meant to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0049] For the purpose of making the purpose, technical scheme and advantages of the present application more clear, the following will make a further detailed description of the embodiments of the present application in connection with the drawings.
[0050] Embodiment One
[0051] The present embodiment provides a method for network access of an application in a smart terminal device, as shown in Figures 1 and 2, the smart terminal device comprises a system service and a network driver, and the method comprises:
[0052] Step 101, the system service determines the application network connection mode setting type according to the type of the called interface, and if the application network connection mode setting type is the first type, then step 102 is executed;
[0053] Step 102, the system service obtains the application configuration information transmitted through the first preset interface, and determines whether there is user permission information according to the application configuration information, and if yes, then step 103 is executed, otherwise, the process ends;
[0054] Step 103, the system service acquires the custom routing setting table, saves the network connection configuration information in the application configuration information into the custom routing setting table, and transmits the network connection configuration information into the network driver;
[0055] Step 104, the network driver configures the network connection configuration information into the routing rule table through a configuration instruction, and ends;
[0056] The method further comprises:
[0057] Step 201, when the system service receives a network connection request initiated by an application in a smart terminal device, the system service transmits the network connection request to the network driver;
[0058] Step 202, the network driver acquires IP information in the network connection request, judges whether there is network connection configuration information matching the IP information in the routing rule table, if yes, step 203 is executed, otherwise, step 204 is executed;
[0059] Step 203, the network driver determines a network connection mode corresponding to the IP information through the routing rule table, transmits a network request data packet to a server corresponding to the IP information according to the determined network connection mode, and executes step 205;
[0060] Step 204, the network driver transmits a network request data packet to a server corresponding to the IP information according to a default network connection mode, and executes step 205;
[0061] Step 205, the network driver receives a network response data packet, and returns the network response data packet to the system service;
[0062] Step 206, the system service returns the network response data packet to the application.
[0063] An implementable mode, the method further comprises the following steps executed by the system service when the application network connection mode setting type is determined as the second type according to the called interface type:
[0064] Step 105, the system service acquires application configuration information transmitted through a called second preset interface, judges whether there is user permission information according to the application configuration information, if yes, step 106 is executed, otherwise, the method ends;
[0065] Step 106, the system service acquires the custom routing setting table, judges whether there is network connection configuration information in the custom routing setting table, if yes, transmits the network connection configuration information into the network driver, deletes the network connection configuration information in the custom routing setting table, and executes step 107, otherwise, the method ends;
[0066] Step 107, the network driver deletes the network connection configuration information from the routing rule table through a deletion instruction, and the method ends.
[0067] In an implementable manner, the system service determines the application network connection mode setting type according to the type of the interface called. Specifically, when a first preset interface of the system service is called, the system service determines that the application network connection mode setting type is a first type; and when a second preset interface of the system service is called, the system service determines that the application network connection mode setting type is a second type.
[0068] In an implementable manner, the system service includes a package management service, and before step 101, the method further includes:
[0069] Step 1101, the package management service acquires an application to-be-installed APK file.
[0070] Step 1102, the package management service calls an application programming interface (API) to parse a manifest file in the application to-be-installed APK file, and acquires configuration startup item information.
[0071] Step 1103, the package management service determines a network connection configuration type according to the configuration startup item information, and calls an interface of the system service according to the network connection configuration type.
[0072] Specifically, in step 1103, calling the interface of the system service specifically includes: the package management service acquires user permission information and network connection configuration information in the manifest file, organizes the network connection configuration information and the user permission information to obtain application configuration information, and calls the interface of the system service to pass the application configuration information as a parameter.
[0073] Specifically, in an implementable manner, the method further includes generating an application to-be-installed APK file. Generating the application to-be-installed APK file specifically includes:
[0074] Step D1, determining a network connection configuration type.
[0075] Step D2, writing configuration startup item information corresponding to the network connection configuration type, network connection configuration information and user permission information into a manifest file according to a predetermined format to obtain the application to-be-installed APK file.
[0076] Specifically, in an implementable manner, before step 103, saving the network connection configuration information in the application configuration information into a custom routing setting table, the method further includes:
[0077] Step M21, the system service determines whether the network connection configuration information exists in the custom routing setting table. If yes, step M22 is performed; otherwise, the network connection configuration information in the application configuration information is saved into the custom routing setting table.
[0078] Step M22, the system service acquires the network connection configuration information in the application configuration information, judges whether the network connection configuration information in the custom routing setting table is same as the network connection configuration information in the application configuration information, if yes, ends, if not, executes step M23;
[0079] Step M23, the system service transmits the network connection configuration information in the custom routing setting table into the network driver, deletes the network connection configuration information in the custom routing setting table from the custom routing setting table, saves the network connection configuration information in the application configuration information into the custom routing setting table, and executes step M24;
[0080] Step M24, the network driver deletes the network connection configuration information in the custom routing setting table from the routing rule table through a deletion instruction.
[0081] In an embodiment, the intelligent terminal device comprises a POS management service.
[0082] Before step 101, the method further comprises: the POS management service determines the interface type of the system service according to the interface type called by the third-party application, and calls the interface of the system service according to the determined interface type.
[0083] Specifically, in an embodiment, calling the interface of the system service according to the determined interface type specifically comprises: the POS management service acquires the network connection configuration information and the application package name, organizes the network connection configuration information and the application package name to obtain the application configuration information, and transmits the application configuration information as a parameter into the interface of the system service.
[0084] Further, in an embodiment, judging whether the user permission information exists according to the application configuration information specifically comprises: the system service judges whether the third-party application corresponding to the application package name in the application configuration information exists the user permission information according to the application package name.
[0085] In an embodiment, when it is judged that the user permission information exists according to the application configuration information, the method further comprises: the system service acquires the signature data in the application configuration information to perform code signature, acquires the network configuration permission when the signature passes, executes step 103, and ends when the signature fails.
[0086] Specifically, the signature data comprises a specified parameter, a verification key and signature data.
[0087] In an embodiment, the method further comprises: when the intelligent terminal device is powered off, the network driver deletes all the network connection configuration information in the routing rule table through a deletion instruction.
[0088] An implementable manner, the method further comprises: when the smart terminal device is restarted, the system service acquires the saved custom routing setting table, traverses the custom routing setting table, sequentially acquires the network connection configuration information in the custom routing setting table and transmits the network connection configuration information into the network driver, and executes step 104.
[0089] An implementable manner, in step 102, when it is judged according to the application configuration information that there is user permission information, the system service further comprises: setting the permission group information corresponding to the application according to the user permission information in the application configuration information.
[0090] The network driver further comprises: before acquiring the IP information in the network request, the network driver judges whether the application initiating the network connection request has permission information, if yes, step 202 is executed, otherwise, step 204 is executed.
[0091] The application provides a method and device for network access of an application in a smart terminal device, the system service determines an application network connection mode setting type according to an interface type called, and verifies the permission of the application according to parameters transmitted by the application, and if the verification is passed, the network connection mode setting permission is acquired, and the network driver sets the network connection mode specified by the application according to the determined application network connection mode setting type, thereby solving the problem of network access security caused by the inability to set the connection mode due to the lack of permission of the application in the prior art, realizing the function that the application can be safely accessed and safely operated under a specified network type, and avoiding the risk of data leakage caused by network security problems.
[0092] Embodiment two
[0093] The embodiment two of the application provides a method for network access of an application in a smart terminal device, wherein, in the embodiment, a third-party application sets the network by installing an application installation package, as shown in FIG. 3, the method for network access of the application comprises the following steps of generating an application to-be-installed APK file:
[0094] Step 301, determining a network connection configuration type;
[0095] In the embodiment, the network connection configuration type comprises configuration and deconfiguration.
[0096] Specifically, the network connection configuration type is defined as a preset value of configuration start item information, a first preset value is true, indicating that the network connection configuration type is configuration, and a second preset value is false, indicating that the network connection configuration type is deconfiguration.
[0097] For example, the value corresponding to the configuration startup item coexist is true / false, and the value corresponding to the IP information is 192.168.8.102; the user permission information is defined as android.permission.CONTROL_FIREWALL_RULED.
[0098] In step 302, the configuration startup item information, the network connection configuration information and the user permission information corresponding to the network connection configuration type are written into the manifest file according to a predetermined format to obtain an application to-be-installed APK file.
[0099] Specifically, APK (Android application package) refers to an Android application package, which is a file format in an Android system. The APK file contains all files of an application, including static resource files (assets), library files (lib), signature files (META-INF), compiled resource files (res), a manifest file (AndroidManifest.xml), core code files (classes.Dex) and resource mapping files (resources.arsc), and the like. For example, the manifest file is as follows:
[0100] Specifically, the manifest file (AndroidManifest.xml) is a compiled file used to describe the manifest information of an application, including important information such as a package name, an application name, permissions, four components of Android, a version and the like. When an application is packaged, the AndroidManifest.xml file is automatically generated and packaged into the APK file. When the application is installed, the Android system reads this file to determine the basic information and permission requirements of the application.
[0101] In an implementable manner, the predetermined format in step 302 is a key-value pair format.
[0102] For example, the network connection configuration information is as follows:
[0103] name: coexist value: true / false
[0104] name: mobile value: 192.168.8.102
[0105] name: Wi-Fi value: 192.168.7.12
[0106] name: ethernet value: 192.168.333.5
[0107] An implementable manner, the manifest file further includes verification parameters, a key and signature data;
[0108] The verification parameters can be a random number, and the signature data is obtained by MD5 calculation of the verification parameters by the key.
[0109] Further, the method for network access of an application in a smart terminal device provided by the embodiment of the application is shown in FIGS. 4, 5A and 5B, and the method includes an installation process of the application through an installation package. Before the installation process of the application in the method is executed, the first preset interface, the second preset interface and the preset methods are written and updated into an Android system. Specifically, the Android system includes a system service and a network driver. Further, the system service includes a package management service (PKMS), a first connection service, and a second connection service.
[0110] An implementable manner, as shown in FIG. 4, the network access in the embodiment is performed during the first installation process of the application. The method specifically includes:
[0111] Step 401, the package management service acquires an application to be installed APK file;
[0112] In the Android system, the package management service (PKMS) is started by the system service (System Server) when the system is started, and the package management service performs the installation process of the application;
[0113] Specifically, the system starts the package management service by calling the preset method, and the preset method is PackageManagerService.installPackage.
[0114] An implementable manner, the application can be installed through the adb install mode.
[0115] Step 402, the package management service calls the first API interface to parse the manifest file in the application to be installed APK file, and acquires configuration startup item information;
[0116] Specifically, the first API interface is install Package ().
[0117] An implementable manner, calling the first API interface to parse the manifest file in the application to be installed APK file specifically includes: parsing the manifest file in the application to be installed APK file through a function object, and acquiring the configuration startup item information in the manifest file.
[0118] Specifically, the function object is a Package Parser;
[0119] In an implementable manner, step 402 further includes that the package management service judges whether the manifest file contains user permission information, and if yes, adds the application corresponding to the APK file to be installed to a preset permission group, and executes step 403, otherwise, executes step 403.
[0120] Specifically, adding the application corresponding to the APK file to be installed to the preset permission group specifically includes adding AID_CONTROL_FIREWALL 1098 in UIDMap and Android_filesystem_config.h.
[0121] Step 403 includes that the package management service determines a network connection configuration type according to the configuration startup item information, and if the network connection configuration type is configuration, executes step 404.
[0122] In an implementable manner, the configuration startup item is coexist, and the first preset value is true.
[0123] Specifically, if the value corresponding to the configuration startup item is the first preset value, it indicates that the network accessed by the application in the terminal device is configured, and after the configuration is completed, the IP / domain name specified in the network connection configuration information is only allowed to be accessed in a specified network connection mode, and other unspecified network connection modes are not allowed to be accessed.
[0124] Step 404 includes that the package management service obtains user permission information and network connection configuration information in the manifest file, organizes the network connection configuration information and the user permission information to obtain application configuration information, and calls a first preset interface to pass the application configuration information as a parameter into a first connection service.
[0125] In an implementable manner, step 404 specifically includes that the package management service obtains user permission information, network connection configuration information and signature verification data in the manifest file, organizes the network connection configuration information, the user permission information and the signature verification data to obtain application configuration information, and calls a first preset interface to pass the application configuration information as a parameter into a first connection service.
[0126] Specifically, the first preset interface is CS.addRoute.
[0127] Step 405 includes that the first connection service determines that the application network connection mode setting type is a first type according to the type of the called interface, obtains the application configuration information, and judges whether the user permission information exists according to the application configuration information, and if yes, executes step 406, otherwise, ends.
[0128] In an implementable mode, the first connection service comprises a network connectivity service (CS) and a network management service (NMS), and in step 404, the package management service calls the first preset interface to pass the application configuration information as a parameter into the first connection service, specifically, the package management service calls the first preset interface to pass the application configuration information as a parameter into the network connectivity service;
[0129] Specifically, step 405 specifically comprises: the network connectivity service determines the application network connection mode setting type as the first type according to the type of the called interface, acquires the application configuration information, and judges whether there is user permission information according to the application configuration information; if yes, step 406 is performed; otherwise, the process ends.
[0130] Further, judging whether there is user permission information according to the application configuration information specifically comprises: judging whether there is a corresponding value in android.permission.CONTROL_FIREWALL_RULED in the application configuration information; if yes, it indicates that there is user permission information; otherwise, there is no user permission information.
[0131] In an implementable mode, when it is judged according to the application configuration information that there is user permission information, the system service further acquires signature data in the application configuration information to perform code signature, acquires network configuration permission if the signature passes, performs step 406, and ends if the signature fails; the signature data comprises a specified parameter, a verification key and signature data.
[0132] Specifically, the system service acquires the signature data in the application configuration information to perform code signature specifically comprises: the system service acquires the specified parameter, the verification key and the signature data, calculates a first data by calculating the specified parameter through the verification key, judges whether the first data is consistent with the signature data; if yes, the signature passes; otherwise, the signature fails.
[0133] Step 406: the first connection service acquires a custom routing setting table, saves the network connection configuration information in the application configuration information into the custom routing setting table, and passes the network connection configuration information into a network driver.
[0134] Specifically, step 406 specifically comprises: the network connectivity service acquires the custom routing setting table, saves the network connection configuration information in the application configuration information into the custom routing setting table, calls the first preset method to pass the network connection configuration information as a parameter into the network management service, and the network management service calls the second preset method to pass the network connection configuration information as a parameter into the network driver.
[0135] Specifically, the first preset method is NMS.enableRoute, and the second preset method is INetd.enableRoute.
[0136] In step 407, the network driver configures the network connection configuration information into the routing rule table through the configuration instruction, and the process ends.
[0137] In an implementable manner, step 407 specifically comprises that the network driver sends the configuration instruction to the routing tool, and the routing tool configures the incoming network connection configuration information into the routing rule table after receiving the instruction.
[0138] Specifically, the network driver comprises a Netd native service and a route controller.
[0139] Further, the network management service calls the second preset method to pass the network connection configuration information as a parameter into the network driver, specifically: the network management service calls the second preset method to pass the network connection configuration information as a parameter into the Netd native service.
[0140] Further, step 407 specifically comprises that the Netd native service passes the network connection configuration information as a parameter into the route controller by calling the third preset method, the route controller sends the configuration instruction to the routing tool, and the routing tool configures the incoming IP information and network connection mode into the routing rule table after receiving the configuration instruction.
[0141] Specifically, the Netd native service is NetdNativeService (NNS for short), and the third preset method is RC.enableRoute; the route controller is Route Controller (RC for short); and the configuration instruction specifically comprises adding the incoming network connection configuration information into the routing rule table.
[0142] In an implementable manner, the routing tool executes the configuration instruction, which specifically uses the technology of the Linux network driver, specifically: executing the IP rule instruction can add the network connection mode specified by the IP information to the routing rule table.
[0143] For example, the route controller sends an ip rule command:
[0144] Usage: ip rule [list|add|del] SELECTOR ACTION (add to add; del to delete; list to list) instruction, and the routing tool adds the network connection mode specified by the IP information to the routing rule table according to the instruction.
[0145] In the embodiment, a method for network access in an intelligent terminal device is provided, as shown in FIGS. 5A-5B. Specifically, the method is used for network access during the upgrade of an installed application. The method specifically includes the following steps:
[0146] In step 501, the package management service acquires an APK file to be installed.
[0147] In the Android system, the system starts the package management service (PKMS) to perform the upgrade and installation of the application.
[0148] In an embodiment, the application can be installed or upgraded by pushing the APK file remotely.
[0149] In step 502, the package management service calls a second API interface to parse the manifest file in the APK file to be installed to acquire configuration startup item information.
[0150] Specifically, the second API interface is updatePackage().
[0151] In an embodiment, the second API interface is used to parse the manifest file in the APK file to be installed, specifically by using a function object to parse the manifest file in the APK file to be installed to acquire the configuration startup item information.
[0152] Specifically, the function object is Package Parser.
[0153] In step 502, the package management service determines whether the manifest file contains user permission information. If yes, the application corresponding to the APK file to be installed is added to a preset permission group, and step 503 is performed. If no, step 503 is performed.
[0154] Specifically, the application corresponding to the APK file to be installed is added to the preset permission group by adding AID_CONTROL_FIREWALL 1098 in UIDMap and Android_filesystem_config.h.
[0155] In step 503, the package management service determines the network connection configuration type according to the configuration startup item information. If the network connection configuration type is configuration, step 504 is performed. If the network connection configuration type is unconfiguration, step 512 is performed.
[0156] In an embodiment, the first preset value is true.
[0157] Specifically, the value corresponding to the configuration start item is a first preset value, indicating that the network accessed by the application in the terminal device is configured, and after the configuration is completed, the IP / domain name specified in the network connection configuration information is only allowed to be accessed in a specified network connection mode, and other unspecified network connection modes are inaccessible.
[0158] In an implementable mode, the value corresponding to the configuration start item can also be a second preset value; the second preset value is false.
[0159] Specifically, the value corresponding to the configuration start item is the second preset value, indicating that the network connection mode accessed by the application in the terminal device does not need to be configured.
[0160] In step 504, the package management service obtains the user permission information and the network connection configuration information in the manifest file, organizes the network connection configuration information and the user permission information to obtain application configuration information, and calls a first preset interface to pass the application configuration information as a parameter into a first connection service.
[0161] Specifically, the first preset interface is CS.addRoute.
[0162] In step 505, the first connection service determines, according to the type of the called interface, that the application network connection mode setting type is a first type, obtains the application configuration information, and determines, according to the application configuration information, whether the user permission information exists; if yes, step 506 is performed; otherwise, the process ends.
[0163] In this embodiment, the first connection service includes a network connection service and a network management service.
[0164] Specifically, step 505 is specifically that the network connection service determines, according to the type of the called interface, that the application network setting type is the first type, obtains the application configuration information, and determines, according to the application configuration information, whether the user permission information exists; if yes, step 506 is performed; otherwise, the process ends.
[0165] In step 506, the first connection service obtains a custom route setting table, and determines whether the network connection configuration information exists in the custom route setting table; if yes, step 507 is performed; otherwise, step 510 is performed.
[0166] Specifically, step 506 is specifically that the network connection service obtains the custom route setting table, and determines whether the network connection configuration information exists in the custom route setting table; if yes, step 507 is performed; otherwise, step 510 is performed.
[0167] In step 507, the first connection service obtains the network connection configuration information in the application configuration information, and determines whether the network connection configuration information in the custom route setting table is the same as the network connection configuration information in the application configuration information; if yes, the process ends; if no, step 508 is performed.
[0168] Specifically, step 507 is specifically: the network connection service acquires the network connection configuration information in the application configuration information, judges whether the network connection configuration information in the custom route setting table is same as the network connection configuration information in the application configuration information, if yes, ends, if not, executes step 508;
[0169] Step 508, the first connection service transmits the network connection configuration information in the custom route setting table into the network driver, deletes the network connection configuration information in the custom route setting table from the custom route setting table, and executes step 509;
[0170] Specifically, step 508 is specifically: the network connection service deletes the network connection configuration information in the custom route setting table from the custom route setting table, calls the fourth preset method to transmit the network connection configuration information in the custom route setting table into the network management service as a parameter, and the network management service calls the fifth preset method to transmit the network connection configuration information into the network driver as a parameter;
[0171] Specifically, the fourth preset method is NMS.disableRoute, and the fifth preset method is INetd.disableRoute.
[0172] Step 509, the network driver deletes the network connection configuration information in the custom route setting table from the route rule table through a deletion instruction, and executes step 510;
[0173] In an implementable manner, step 509 is specifically that the network driver sends a deletion instruction to the routing tool, and the routing tool deletes the transmitted network connection configuration information from the route rule table after receiving the instruction;
[0174] Specifically, the network driver includes a Netd local service and a routing controller;
[0175] Further, the network management service calling the fifth preset method to transmit the network connection configuration information into the network driver as a parameter is specifically: the network management service calling the fifth preset method to transmit the network connection configuration information into the Netd local service as a parameter;
[0176] Further, step 509 is specifically: the Netd local service transmits the network connection configuration information into the routing controller as a parameter by calling a sixth preset method, the routing controller sends a deletion instruction to the routing tool, and the routing tool deletes the transmitted network connection configuration information from the route rule table after receiving the instruction;
[0177] Specifically, the sixth preset method is RC.disableRoute.
[0178] Step 510, the first connection service saves the network connection configuration information in the application configuration information into a custom route setting table, and transmits the network connection configuration information in the application configuration information into a network driver, and step 511 is executed;
[0179] Specifically, step 510 specifically is that the network connection service saves the network connection configuration information in the application configuration information into the custom route setting table, calls a first preset method to transmit the network connection configuration information in the application configuration information into a network management service as a parameter, and the network management service calls a second preset method to transmit the network connection configuration information into the network driver as a parameter.
[0180] The first preset method is NMS.enableRoute, and the second preset method is INetd.enableRoute.
[0181] Step 511, the network driver configures the network connection configuration information in the application configuration information into a route rule table through a configuration instruction, and ends.
[0182] In an implementable manner, step 511 specifically is that the network driver sends a configuration instruction to a route tool, and the route tool configures the transmitted network connection configuration information into the route rule table after receiving the instruction.
[0183] Specifically, the network driver includes a Netd native service and a route controller.
[0184] Further, the network management service calling the second preset method to transmit the network connection configuration information into the network driver specifically is that the network management service calls the second preset method to transmit the network connection configuration information into the Netd native service as a parameter.
[0185] Further, step 511 specifically is that the Netd native service transmits the network connection configuration information into the route controller as a parameter by calling a third preset method, the route controller sends a configuration instruction to the route tool, and the route tool configures the transmitted network connection configuration information into the route rule table after receiving the instruction.
[0186] Specifically, the Netd native service is NetdNativeService (NNS for short), the third preset method is RC.enableRoute, the route controller is Route Controller (RC for short), and the configuration instruction specifically is to add the transmitted network connection configuration information into the route rule table.
[0187] In step 512, the package management service acquires the user permission information and the network connection configuration information in the manifest file, organizes the network connection configuration information and the user permission information to obtain application configuration information, and calls a second preset interface to pass the application configuration information as a parameter into the first connection service;
[0188] Specifically, the second preset interface is CS.RemoveRoute.
[0189] In step 513, the first connection service determines, according to the type of the called interface, that the application network connection mode setting type is the second type, acquires the application configuration information, and determines, according to the application configuration information, whether the user permission information exists. If yes, step 514 is performed; otherwise, the process ends.
[0190] In an implementable manner, the first connection service includes a network connection service and a network management service. In step 512, the package management service calls the second preset interface to pass the application configuration information as a parameter into the first connection service, specifically, the package management service calls the second preset interface to pass the application configuration information as a parameter into the network connection service.
[0191] Specifically, in step 513, the network connection service determines, according to the type of the called interface, that the application network connection mode setting type is the second type, acquires the application configuration information, and determines, according to the application configuration information, whether the user permission information exists. If yes, step 514 is performed; otherwise, the process ends.
[0192] Further, the determination, according to the application configuration information, of whether the user permission information exists is specifically a determination of whether a corresponding value exists in android.permission.CONTROL_FIREWALL_RULED in the application configuration information. If yes, it indicates that the user permission information exists; otherwise, the user permission information does not exist.
[0193] In step 514, the first connection service acquires a custom route setting table, passes network connection configuration information in the custom route setting table into a network driver, deletes the network connection configuration information in the custom route setting table, and performs step 515.
[0194] In an implementable manner, step 514 specifically includes that the first connection service acquires network connection configuration information in the application configuration information, acquires a custom route setting table, determines whether the network connection configuration information exists in the custom route setting table, and if yes, passes the network connection configuration information into the network driver, deletes the network connection configuration information from the custom route setting table, and performs step 515; otherwise, the process ends.
[0195] Specifically, step 514 is specifically: the network connection service acquires the custom route setting table, calls a fourth preset method to pass the network connection configuration information in the custom route setting table into the network management service as a parameter, deletes the network connection configuration information in the custom route setting table, and the network management service calls a fifth preset method to pass the network connection configuration information into the network driver as a parameter;
[0196] Specifically, the fourth preset method is NMS.disableRoute, and the fifth preset method is INetd.disableRoute.
[0197] Step 515, the network driver deletes the network connection configuration information from the route rule table through a deletion instruction, and ends.
[0198] In an implementable manner, step 515 is specifically that the network driver sends a configuration instruction to the routing tool, and the routing tool deletes the incoming network connection configuration information from the route rule table after receiving the instruction;
[0199] Specifically, the network driver includes a Netd local service and a routing controller.
[0200] Further, the network management service calling a sixth preset method to pass the network connection configuration information into the network driver is specifically: the network management service calling a sixth preset method to pass the network connection configuration information into the Netd local service as a parameter;
[0201] Further, step 515 is specifically: the Netd local service calling a sixth preset method to pass the network connection configuration information into the routing controller as a parameter, the routing controller sending a deletion instruction to the routing tool, and the routing tool deleting the incoming network connection configuration information from the route rule table after receiving the instruction.
[0202] In an implementable manner, when there are multiple network connection configuration information in the custom route setting table, the passing of the network connection configuration information into the network driver in step 514 is specifically: traversing to acquire the network connection configuration information, sequentially passing the network connection configuration information into the network driver, and sequentially executing step 515 until the list is empty.
[0203] In an implementable manner, the application configuration information further includes signature data, and when the system service determines that there is user permission information according to the application configuration information, the system service further includes: the system service acquires the signature data in the application configuration information to perform code signature, the signature data includes specified parameters, verification keys and signature data, the signature passes, the network configuration permission is acquired, the signature does not pass, an error is reported, and the process ends.
[0204] In the embodiment, when the intelligent terminal device is powered off, the network driver deletes all the network connection configuration information configured in the routing rule table through the routing tool.
[0205] In the embodiment, when the intelligent terminal device is powered on and restarted, the system service acquires the saved custom routing setting table by calling the CS.systemReady() method, traverses the custom routing setting table, sequentially acquires the network connection configuration information in the list, and performs steps 510 to 511.
[0206] The method for an application in an intelligent terminal device to perform network access provided in the embodiment is suitable for an intelligent terminal device installed with an Android system. In the embodiment, the intelligent terminal device includes an application, and the application in the intelligent terminal device connects a network through a specified network connection mode to complete a specific operation of a user. The scheme sets the network connection mode of the application access according to the network connection configuration information during the installation process of an application installation package or an upgrade package, realizes the function that the application can perform safe operation processing under the specified network connection mode, and avoids the risk of data leakage caused by network security problems.
[0207] Embodiment Three
[0208] The method for an application in an intelligent terminal device to perform network access provided in the third embodiment of the application is set by a third-party application through an interface function. Before the method is executed, an interface function SDK is provided for the third-party application to call, and a preset interface is written into and updated to the Android system of the intelligent terminal device. Specifically, the intelligent terminal device includes a system service and a network driver, and further includes a POS management service (application process). Further, the system service includes a connectivity service (CS) and a network management service (NMS). Further, an ICM interface is defined in the POS management service in advance, and the ICM interface includes a first ICM interface and a second ICM interface. The first ICM interface represents a configuration network access type, and the second ICM interface represents a clearing configured network access type.
[0209] As shown in FIGS. 6A-6B, the method for an application in an intelligent terminal device to perform network access provided in the embodiment specifically includes:
[0210] When the POS management service is called by the third-party application through the first ICM interface, step 601 is performed, and when the POS management service is called by the third-party application through the second ICM interface, step 605 is performed;
[0211] In the embodiment, the method further includes: generating an interface function SDK, the third-party application binds the POS management service through an AIDL mode, establishes a connection and an initialization operation, and calls the POS management service through an interface in the SDK, and passes in network connection configuration information and application information to be configured as parameters; for example, when the first ICM interface is called, the passed-in parameters are: enableRoute (String IP, String packageName), and when the second ICM interface is called, the passed-in parameters are: disableRoute (String IP, String packageName).
[0212] Specifically, the first ICM interface is: enable.RouteFromCustomer, and the second ICM interface is: disable.RouteFromCustomer.
[0213] Step 601: The POS management service calls a first preset interface, and passes in network connection configuration information and application information input by the third-party application as application configuration information into a system service.
[0214] In the embodiment, the application information is specifically an application package name, for example, String packageName.
[0215] Step 602: The system service determines, according to a type of the called interface, that an application network connection mode setting type is a first type, and step 603 is performed.
[0216] In an implementable manner, the system service includes a network connection service and a network management service, and step 601 is specifically: the POS management service calls the first preset interface, and passes in network connection configuration information and application information input by the third-party application as application configuration information into the network connection service.
[0217] Specifically, step 602 is specifically: the network connection service determines, according to a type of the called interface, that the application network connection mode setting type is the first type.
[0218] The first preset interface is CS.addRoute.
[0219] In step 603, the system service determines whether the application has user permission information according to the application configuration information, and if yes, acquires the custom route setting table, saves the network connection configuration information in the application configuration information into the custom route setting table, and transmits the network connection configuration information into the network driver to execute step 604, otherwise, the process ends.
[0220] In an implementable manner, the system service determines whether the third-party application corresponding to the application package name has user permission information according to the application package name in the application configuration information.
[0221] Specifically, step 603 is specifically that the network connection service determines whether the application has user permission information according to the application configuration information, and if yes, acquires the custom route setting table, saves the network connection configuration information in the application configuration information into the custom route setting table, and calls the first preset method to transmit the network connection configuration information as a parameter into the network management service, and the network management service calls the second preset method to transmit the network connection configuration information as a parameter into the network driver.
[0222] Specifically, the first preset method is NMS.enableRoute, and the second preset method is INetd.enableRoute.
[0223] In step 604, the network driver configures the transmitted network connection configuration information into the route rule table through a configuration instruction, and the process ends.
[0224] In an implementable manner, step 604 is specifically that the network driver sends a configuration instruction to the routing tool, and the routing tool configures the transmitted network connection configuration information into the route rule table after receiving the instruction.
[0225] Specifically, the network driver includes a Netd local service and a routing controller, and further, the network management service calls the second preset method to transmit the network connection configuration information as a parameter into the network driver is specifically that the network management service calls the second preset method to transmit the network connection configuration information as a parameter into the Netd local service.
[0226] Further, step 604 is specifically that the Netd local service transmits the network connection configuration information as a parameter into the routing controller by calling a third preset method, the routing controller sends a configuration instruction to the routing tool, and the routing tool configures the transmitted network connection configuration information into the route rule table after receiving the instruction.
[0227] Specifically, the Netd native service is a NetdNativeService (NNS for short), the third preset method is RC.enableRoute, the route controller is a Route Controller (RC for short), and the configuration instruction specifically refers to adding the incoming network connection configuration information to a routing rule table.
[0228] In step 605, the POS management service calls a second preset interface and inputs the application information input by the third-party application into the system service as application configuration information.
[0229] In an implementable manner, step 605 specifically refers to the POS management service obtaining an application package name and network connection configuration information, organizing the application package name and the network connection configuration information to obtain the application configuration information, and calling a second preset interface of the system service to input the application configuration information into the system service as a parameter.
[0230] Alternatively, step 605 specifically refers to the POS management service obtaining an application package name and network connection configuration information, organizing the application package name and the network connection configuration information to obtain the application configuration information, and calling a second preset interface of the system service to input the application configuration information into the system service as a parameter.
[0231] In step 606, the system service determines, according to the type of the called interface, that the application network connection mode setting type is the second type, and step 607 is performed.
[0232] In an implementable manner, the system service includes a network connection service and a network management service, and step 605 specifically refers to the POS management service calling a second preset interface and inputting the application information input by the third-party application into the network connection service as application configuration information.
[0233] Specifically, step 606 specifically refers to the network connection service determining, according to the type of the called interface, that the application network connection mode setting type is the second type.
[0234] The second preset interface is CS.RemoveRoute.
[0235] In step 607, the system service determines, according to the application configuration information, whether the application has user permission information, and if yes, step 608 is performed, and if not, the process ends.
[0236] In an implementable manner, the system service determining, according to the application configuration information, whether the application has user permission information specifically refers to the system service determining, according to the application package name in the application configuration information, whether the third-party application corresponding to the application package name has corresponding user permission information.
[0237] Specifically, step 607 is specifically: the network connection service determines whether the application exists user permission information according to the application configuration information, if yes, step 608 is executed, if not, the end.
[0238] Step 608, the system service acquires the custom routing setting table, and determines whether the network connection configuration information exists in the custom routing setting table, and if yes, step 609 is executed, and if not, the end.
[0239] In an implementable mode, the determination of whether the network connection configuration information exists in the custom routing setting table is specifically: the system service determines whether the network connection configuration information in the application configuration information exists in the custom routing setting table, if yes, step 609 is executed, and if not, the end.
[0240] Specifically, step 608 is specifically: the network connection service acquires the custom routing setting table, and determines whether the network connection configuration information exists in the custom routing setting table, and if yes, step 609 is executed, and if not, the end.
[0241] Step 609, the system service transmits the network connection configuration information into the network driver, deletes the network connection configuration information in the custom routing setting table, and executes step 610.
[0242] Specifically, step 609 is specifically: the network connection service deletes the network connection configuration information in the custom routing setting table, calls a fourth preset method to transmit the network connection configuration information as a parameter into the network management service, and the network management service calls a fifth preset method to transmit the network connection configuration information as a parameter into the network driver.
[0243] Step 610, the network driver deletes the network connection configuration information from the routing rule table through a deletion instruction, and the end.
[0244] In this embodiment, in an implementable mode, step 610 is specifically: the network driver sends a deletion instruction to the routing tool, and the routing tool deletes the transmitted network connection configuration information from the routing rule table after receiving the instruction.
[0245] Specifically, the network driver includes a Netd local service and a routing controller, and the network management service calling the fifth preset method to transmit the network connection configuration information as a parameter into the network driver is specifically: the network management service calls the fifth preset method to transmit the network connection configuration information as a parameter into the Netd local service.
[0246] Further, step 610 is specifically: the Netd local service transmits the network connection configuration information as a parameter into the routing controller by calling a sixth preset method; the routing controller sends a deletion instruction to the routing tool, and the routing tool deletes the transmitted network connection configuration information from the routing rule table after receiving the instruction.
[0247] Specifically, the Netd native service is NetdNativeService; the sixth preset method is RC.disableRoute; and the route controller is Route Controller.
[0248] In an implementable manner, the application configuration information further includes signature data, and the system service further includes the following steps of: the system service acquires the signature data in the application configuration information to perform code signature, the signature data includes specified parameters, verification keys and signature data, the network configuration permission is acquired when the signature passes, and an error is reported and the process is ended when the signature does not pass.
[0249] The method for an application in a smart terminal device to perform network access provided by the embodiment of the present application is suitable for a smart terminal device installed with an Android system. In the embodiment, the smart terminal device includes a third-party application, the third-party application in the smart terminal device calls a POS management service in the smart terminal device through an interface function SDK to complete an application network connection mode setting operation, and a network type specified by the application is set according to a determined application network connection mode setting type through a system service and a network driver, thereby solving the problem that an application cannot be set to perform secure network access due to no permission in the prior art, realizing the function that the application can perform secure operation processing under a specified network type, and avoiding the risk of data leakage caused by network security problems.
[0250] Embodiment Four
[0251] The embodiment four of the present application provides a method for an application in a smart terminal device to perform network access on the basis of the embodiment one, as shown in FIGS. 7A-7B, the embodiment four of the present application provides a method for an application in a smart terminal device to perform network access, and the method includes the following steps.
[0252] Step 701, the application initiates a network connection request;
[0253] Specifically, the application uses a WebView or a Chrome browser to enter a domain name to access the Internet, or directly initiates an http request.
[0254] Step 702, when the system service receives the network connection request, the network request is sent to the network driver;
[0255] Step 703, the network driver acquires IP information in the network connection request, judges whether there is network connection configuration information matched with the IP information in a route rule table, if yes, step 704 is executed, otherwise, step 706 is executed;
[0256] Step 704, the network driver determines the network connection mode corresponding to the IP information through the routing rule table, and sends the network request data packet to the server corresponding to the IP information according to the determined network connection mode, and executes step 705;
[0257] Step 705, the network driver judges whether the network response data packet returned by the server corresponding to the IP information is received, if yes, the network response data packet is returned to the system service, step 709 is executed, if not, the error information is returned to the system service, and step 710 is executed;
[0258] Step 706, the network driver sends the network request data packet to the server corresponding to the IP information according to the default network connection mode, and executes step 707;
[0259] Step 707, the network driver judges whether the network response data packet returned by the server is received, if yes, the network response data packet is returned to the system service, step 709 is executed, if not, step 708 is executed;
[0260] Step 708, the network driver determines whether there is a switchable network connection mode, if yes, the network connection mode is switched, and the network request data packet is sent to the server corresponding to the IP information, and step 707 is executed, if not, the error information is returned to the system service, and step 710 is executed;
[0261] Step 709, the system service returns the network response data packet to the application, and ends;
[0262] Step 710, the system service returns the error information to the application, and ends.
[0263] In the prior art, if the IP in the network connection request cannot be requested to access in the default network connection mode, when the data packet is received and sent, the network driver will switch the default network connection mode priority, and in the present scheme, when the network connection request in the IP specifies the network connection mode, the data packet must be received and sent by the specified network connection mode, and other connection modes cannot access and receive and send the data packet, by adopting such a mode, the exclusive network is ensured, and the data security in the access process is ensured.
[0264] Specifically, the network driver listens to the network request through the routing tool, the main function of the routing tool Android iprule is to determine which routing table sends the request data packet according to the destination IP in the network request; the iprule routing tool maintains the routing rule table.
[0265] An implementable mode, the embodiment step 102 further comprises: the system service sets the permission group corresponding to the application according to the user permission information in the application configuration information;
[0266] Specifically, before step 704 is performed, the network driver further determines whether the permission information applied in the network response data packet is the same as the permission group information in the routing rule table, and if yes, step 704 is performed, otherwise, step 705 is performed.
[0267] Specifically, in an implementable manner, if the application does not receive a response within a preset time length, an error is prompted, and the process ends.
[0268] In an implementable manner, in the embodiment, icons corresponding to all network connection modes are displayed on the display interface of the smart terminal device, and when any network connection mode is used, the icon corresponding to the connected network connection mode further includes a connection flashing icon.
[0269] Specifically, when the network driver determines that there is a switchable network connection mode, the network connection mode is switched, and after the network connection mode is switched, the network connection mode connection flashing icon is further displayed on the display interface of the smart terminal device.
[0270] The method for an application in a smart terminal device to access a network provided in the application solves the problem that an application cannot be set for secure network access due to a lack of permission in the prior art, realizes the function that the application can access and operate securely in a specified network environment, and avoids the risk of data leakage caused by network security problems.
[0271] The following is an apparatus embodiment of the application, which can be used to execute the method embodiments of the application. For details not disclosed in the apparatus embodiments of the application, reference can be made to the method embodiments of the application.
[0272] An apparatus for an application in a smart terminal device to access a network provided in an example embodiment of the application, the apparatus comprising: the apparatus comprises a system service and a network driver;
[0273] The system service comprises:
[0274] A first determination module is configured to determine an application network connection mode setting type according to an interface type called, and trigger a first acquisition and judgment module if the application network connection mode setting type is determined to be a first type.
[0275] The first acquisition and judgment module is configured to acquire application configuration information transmitted through a first preset interface called, and determine whether there is user permission information according to the application configuration information.
[0276] The obtaining storage module is configured to, when the first obtaining judgment module judges that the user permission information exists, obtain the custom route setting table, save the network connection configuration information in the application configuration information into the custom route setting table, and transmit the network connection configuration information into the network driver.
[0277] The network driver comprises a configuration module configured to configure the network connection configuration information into the route rule table through a configuration instruction.
[0278] The system service further comprises a receiving module configured to receive a network connection request initiated by an application in the intelligent terminal device.
[0279] The sending module is configured to, when the network connection request is received, send the network request to the network driver, and further configured to return a network response data packet to the application.
[0280] The network driver further comprises a first judgment module configured to obtain IP information in the network request, judge whether the network connection configuration information matching the IP information exists in the route rule table, trigger the first processing module if yes, or trigger the second processing module if no.
[0281] The first processing module is configured to determine the network connection mode corresponding to the IP information through the route rule table, send a network request data packet to the IP information according to the network connection mode, receive a network response data packet, and return the network response data packet to the system service.
[0282] The second processing module is configured to send a network request data packet to the IP information according to a default network connection mode, receive a network response data packet, and return the network response data packet to the system service.
[0283] Optionally, the system service further comprises a second obtaining judgment module and an obtaining deletion module.
[0284] The first determination module triggers the second obtaining judgment module when the application network connection mode setting type is determined to be the second type.
[0285] The obtaining deletion module is configured to, when the second obtaining judgment module judges that the user permission information exists, obtain the custom route setting table, judge whether the network connection configuration information exists in the custom route setting table, transmit the network connection configuration information into the network driver if yes, and delete the network connection configuration information from the custom route setting table.
[0286] The network driver further comprises a first deleting module configured to delete the network connection configuration information from the routing rule table by a configuration instruction.
[0287] Optionally, the system service further comprises a package management service, and the package management service comprises a first obtaining module and a first calling module.
[0288] The first calling module is configured to determine a network connection configuration type according to the configuration startup item information and to call an interface of the system service according to the network connection configuration type.
[0289] Further optionally, the first calling module is specifically configured to obtain user permission information and network connection configuration information in the manifest file, to organize the network connection configuration information and the user permission information to obtain application configuration information, and to call the interface of the system service to input the application configuration information as a parameter.
[0290] Further optionally, the system service further comprises a generating module configured to generate the application to-be-installed APK file.
[0291] Optionally, the obtaining and saving module further comprises a first judging unit and a second judging unit.
[0292] The first judging unit is configured to judge whether the network connection configuration information exists in the custom routing setting table, and if yes, to trigger the second judging unit, and if not, to save the network connection configuration information in the application configuration information to the custom routing setting table.
[0293] The second judging unit is configured to obtain the network connection configuration information in the application configuration information, to judge whether the network connection configuration information in the custom routing setting table is the same as the network connection configuration information in the application configuration information, and if yes, to end, and if not, to trigger the first processing unit.
[0294] The first processing unit is configured to input the network connection configuration information in the custom routing setting table into the network driver, to delete the network connection configuration information from the custom routing setting table, to save the network connection configuration information in the application configuration information to the custom routing setting table, and to trigger the first deleting module.
[0295] Optionally, the apparatus comprises a POS management service; the POS management service comprises a second calling module configured to determine an interface type of calling a system service according to an interface type called by the third-party application, and call the interface of the system service according to the determined interface type.
[0296] Further optionally, the second calling module is specifically configured to obtain network connection configuration information and an application package name, organize the network connection configuration information and the application package name to obtain application configuration information, and call the interface of the system service with the application configuration information as a parameter.
[0297] Further, the first obtaining and judging module or the second obtaining and judging module is configured to judge whether the user permission information exists according to the application configuration information, and specifically configured to judge whether the third-party application corresponding to the application package name exists the user permission information according to the application package name in the application configuration information.
[0298] Optionally, the system service further comprises a signature verification module configured to obtain signature verification data in the application configuration information to perform code signature verification, and if the signature verification passes, obtain network configuration permission, trigger the obtaining and saving module, and if the signature verification fails, end.
[0299] Optionally, the first deleting module is further configured to delete all the network connection configuration information in the routing rule table by the deleting instruction when the intelligent terminal device is powered off.
[0300] Optionally, the system service further comprises an obtaining and processing module configured to obtain the saved custom routing setting table when the intelligent terminal device is powered on or restarted, traverse the custom routing setting table, sequentially obtain the network connection configuration information in the custom routing setting table, and transmit the network connection configuration information to the network driver.
[0301] Optionally, the obtaining and saving module is further configured to set the permission group information corresponding to the application according to the user permission information in the application configuration information when the first obtaining and judging module judges that the user permission information exists.
[0302] The network driver further comprises a second judging module configured to judge whether the application initiating the network connection request has permission information, and if yes, trigger the first judging module, and if no, trigger the second processing module.
[0303] It should be noted that the apparatus for enabling an application in a smart terminal device to access a network provided in the above-described embodiments is only used for illustrating the method for enabling an application to access a network, and in actual application, the above-described functions can be distributed and completed by different function modules according to requirements, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the apparatus for enabling an application in a smart terminal device to access a network and the method for enabling an application in a smart terminal device to access a network provided in the above-described embodiments belong to the same concept, and the implementation process is embodied in the method embodiments, which will not be described here.
[0304] The serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0305] The method and apparatus for enabling an application in a smart terminal device to access a network provided in the present application set network access setting information specified by an application according to a determined application network connection mode setting type by a system service and a network driver, solve the problem that an application cannot be set to access a secure network due to no permission in the prior art, and achieve the function that an application can access and operate safely in a specified network environment, thereby avoiding the risk of data leakage caused by network security problems.
[0306] The embodiments of the present application further provide a computer device, including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the method for enabling an application in a smart terminal device to access a network disclosed in any of the preceding embodiments. The embodiments of the present application further provide a computer readable storage medium having a computer program / instruction stored thereon, which is executed by a processor to implement the method for enabling an application in a smart terminal device to access a network disclosed in any of the preceding embodiments. The computer readable storage medium can include but is not limited to any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nano system (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0307] The embodiments of the present application provide a computer program product, including a computer program / instruction, wherein the computer program / instruction is executed by a processor to implement the method for enabling an application in a smart terminal device to access a network disclosed in any of the preceding embodiments.
[0308] In the present application, the terms "first", "second" and the like are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or sequence; the term "multiple" refers to two or more, unless otherwise explicitly limited. The term "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the front and rear associated objects are in an "or" relationship. The terms "mounting", "connecting", "connecting", "fixing" and the like should be understood in a broad sense, for example, "connecting" can be fixed connection, or detachable connection, or integral connection; "connected" can be directly connected, or indirectly connected through an intermediate medium. For those skilled in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0309] In the description of the present application, it should be understood that the orientation or position relationship indicated by the terms "upper", "lower" and the like is based on the orientation or position relationship shown in the drawings, and is only for the purpose of facilitating the description of the present application and simplifying the description, and does not indicate or imply that the device or unit referred to must have a particular direction, be constructed and operated in a particular orientation, therefore, it cannot be understood as a limitation on the present application.
[0310] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, any equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
A method for network access by an application in a smart terminal device, the smart terminal device comprising a system service and a network driver, wherein, The method comprises: Step S1, the system service determines an application network connection mode setting type according to a type of an interface called, and if the application network connection mode setting type is a first type, step S2 is executed; Step S2, the system service acquires application configuration information input through a first preset interface called, and judges whether there is user permission information according to the application configuration information, and if yes, step S3 is executed, and if not, the method ends; Step S3, the system service acquires a custom route setting table, saves network connection configuration information in the application configuration information into the custom route setting table, and inputs the network connection configuration information into the network driver, wherein the network connection configuration information comprises IP information and a network connection mode corresponding to the IP information; Step S4, the network driver configures the network connection configuration information into a route rule table through a configuration instruction, and the method ends; The method further comprises: Step F1, when the system service receives a network connection request initiated by an application in the intelligent terminal device, the system service sends the network connection request to the network driver; Step F2, the network driver acquires IP information in the network connection request, judges whether there is network connection configuration information matched with the IP information in a route rule table, and if yes, step F3 is executed, and if not, step F4 is executed; Step F3, the network driver determines a network connection mode corresponding to the IP information through the route rule table, sends network request data packets to a server corresponding to the IP information according to the network connection mode, and executes step F5; Step F4, the network driver sends network request data packets to a server corresponding to the IP information according to a default network connection mode, and executes step F5; Step F5, the network driver receives network response data packets returned by the server corresponding to the IP information, and returns the network response data packets to the system service; Step F6, the system service returns the network response data packets to the application. The method of claim 1, wherein, When the system service determines that the application network connection mode setting type is a second type according to a type of an interface called, the method further comprises the following steps: Step S5, the system service acquires application configuration information input through a second preset interface called, and judges whether there is user permission information according to the application configuration information, and if yes, step S6 is executed, and if not, the method ends; Step S6, the system service acquires a custom route setting table, judges whether there is network connection configuration information in the custom route setting table, and if yes, deletes the network connection configuration information in the custom route setting table, inputs the network connection configuration information into the network driver, and executes step S7, and if not, the method ends; Step S7, the network driver deletes the network connection configuration information from the route rule table through a deletion instruction, and the method ends. The method of claim 2, wherein, The system service determines the application network connection mode setting type according to a type of an interface called, specifically, when a first preset interface of the system service is called, The system service determines an application network connection mode setting type as a first type, and determines the application network connection mode setting type as a second type when a second preset interface of the system service is called. The method of claim 1, wherein, The system service comprises a package management service, and the step S1 further comprises: Step P1, the package management service acquires an application to-be-installed APK file; Step P2, the package management service calls an API interface to parse a manifest file in the application to-be-installed APK file, and acquires configuration startup item information; Step P3, the package management service determines a network connection configuration type according to the configuration startup item information, and calls an interface of the system service according to the network connection configuration type. The method of claim 4, wherein, In the step P3, the calling of the interface of the system service according to the network connection configuration type specifically comprises: the package management service acquires user permission information and network connection configuration information in the manifest file, organizes the network connection configuration information and the user permission information to obtain application configuration information, and calls the interface of the system service to pass the application configuration information as a parameter. The method of claim 4, wherein, The method further comprises generating the application to-be-installed APK file; The generation of the application to-be-installed APK file specifically comprises: Step D1, determining a network connection configuration type; Step D2, writing configuration startup item information, network connection configuration information and user permission information corresponding to the network connection configuration type into the manifest file according to a predetermined format to obtain the application to-be-installed APK file. The method of claim 1, wherein, In the step S3, before the network connection configuration information in the application configuration information is saved into the custom routing setting table, the step S3 further comprises: Step M21, the system service judges whether network connection configuration information exists in the custom routing setting table, and if yes, step M22 is performed, otherwise, the network connection configuration information in the application configuration information is saved into the custom routing setting table; Step M22, the system service acquires the network connection configuration information in the application configuration information, judges whether the network connection configuration information in the custom routing setting table is same as the network connection configuration information in the application configuration information, and if yes, the process is ended, otherwise, step M23 is performed; Step M23, the system service passes the network connection configuration information in the custom routing setting table into a network driver, and deletes the network connection configuration information in the custom routing setting table; Step M24, the network driver deletes the network connection configuration information in the custom routing setting table from the routing rule table through a deletion instruction. The method of claim 2, wherein, The intelligent terminal device comprises a POS management service; Before the step S1, the POS management service determines an interface type of a system service according to an interface type called by a third-party application, and calls an interface of the system service according to the determined interface type. The method of claim 8, wherein, The interface for calling the system service according to the determined interface type is specifically that the POS management service acquires network connection configuration information and an application package name, organizes the network connection configuration information and the application package name to obtain application configuration information, and calls the interface of the system service to pass the application configuration information as a parameter. The step of judging whether there is user permission information according to the application configuration information is specifically that the system service judges whether the third-party application corresponding to the application package name in the application configuration information has user permission information. The method of claim 9, wherein, When it is judged that there is user permission information according to the application configuration information, the step S3 is executed, and before the step S3, the system service further includes the following steps: The system service acquires signature data in the application configuration information to perform code signature, acquires network configuration permission if the signature passes, and executes the step S3, or ends if the signature does not pass. The method of claim 1, wherein, The method further includes that when the intelligent terminal device is powered off, the network driver deletes all the network connection configuration information in the routing rule table through a deletion instruction. The method further includes that when the intelligent terminal device is powered on and restarted, the system service acquires a saved custom routing setting table, traverses the custom routing setting table, sequentially acquires network connection configuration information in the custom routing setting table, and passes the network connection configuration information to the network driver to execute the step S4. The method of claim 1, wherein, In the step S2, when it is judged that there is user permission information according to the application configuration information, the system service further sets permission group information corresponding to the application according to the user permission information. The method of claim 1, wherein, Before the network driver acquires IP information in the network connection request, the network driver further includes the following steps: The method of claim 1, wherein, The processor executes the computer program to implement the following steps: Step S1, determine an application network connection mode setting type according to an interface type to be called, and execute step S2 if the application network connection mode setting type is a first type; An intelligent terminal device comprising a memory, a processor and a computer program stored on the memory, wherein, Step S2, acquire application configuration information passed through a called first preset interface, judge whether there is user permission information according to the application configuration information, and execute step S3 if yes, or end if no; Step S3, acquire a custom routing setting table, save network connection configuration information in the application configuration information into the custom routing setting table, and pass the network connection configuration information to a network driver, wherein the network connection configuration information includes IP information and a network connection mode corresponding to the IP information; Step S4, configure the network connection configuration information into a routing rule table through a configuration instruction, and end; The processor is further used to implement the following steps: Step F1, when a network connection request initiated by an application in the intelligent terminal device is received, send the network connection request to the network driver; Step F2, acquire IP information in the network connection request, judge whether there is network connection configuration information matching the IP information in a routing rule table, execute step F3 if yes, or execute step F4 if no; Step F3, determining the network connection mode corresponding to the IP information according to the routing rule table, sending the network request data packet to the server corresponding to the IP information according to the network connection mode, and executing step F5; Step F4, sending the network request data packet to the server corresponding to the IP information according to the default network connection mode, and executing step F5; Step F5, receiving the network response data packet returned by the server corresponding to the IP information, and returning the network response data packet to the system service; Step F6, returning the network response data packet to the application. A computer readable storage medium having stored thereon computer programs / instructions, wherein, The computer program / instruction is executed by the processor to realize the method in any one of claims 1-14. A computer program product comprising computer programs / instructions, wherein, The computer program / instruction is executed by the processor to realize the method in any one of claims 1-14.
Citation Information
Patent Citations
A method for a mobile terminal to switch a network in an automatically adaptive manner and a mobile terminal
CN104349412A
Intelligent terminal and system permission-free network configuration method thereof
CN105847321A
Method and device for network access of application in intelligent terminal equipment
CN118646604A
Method and device for network access of application in intelligent terminal equipment
CN118646605A
Implementation method and apparatus for installing application on smart POS device
WO2023124401A1