System interface calling method, device, terminal and storage medium

By building a proxy application in the mobile operating system, using the definition language interface and configuration manager instance to obtain the system interface, the application operation exceptions and permission abuse caused by the traditional system-level permission acquisition scheme are solved, and safe and efficient system-level permission calls are achieved.

CN114371891BActive Publication Date: 2025-05-09IFREECOMM TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111540400.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2025-05-09
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

Traditional system-level permission acquisition schemes may cause other applications to run abnormally and easily cause system-level permissions to be abused.

Method used

By incorporating a proxy application in a mobile operating system, providing cross-process services with a definition language interface, generating configuration manager instances, registering callback interfaces, and obtaining system interfaces through cross-process services or JAVA reflection to perform system-level permission operations.

Benefits of technology

It effectively avoids common applications sharing system-level permissions by being labeled as system tags, thereby preventing other applications from running abnormally and preventing system-level permissions from being abused.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114371891B_ABST
    Figure CN114371891B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, terminal and storage medium for calling a system interface. The method comprises: running a definition language interface of the mobile operating system through the proxy application, the definition language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, generating a configuration manager instance; registering a callback interface to the configuration manager instance; running an instance method in the configuration manager instance to obtain a first system interface using the cross-process service, or obtaining a second system interface through JAVA reflection; executing the first system interface or the second system interface to obtain an execution result; when the execution result satisfies the callback condition, returning the execution result to the callback interface. The use of this method can prevent the application system from causing abnormal operation of other applications during operation, and avoid abuse of system permissions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, terminal and storage medium for calling a system interface. Background Art

[0002] With the popularity of mobile terminals, a large number of applications (Application, APP) are developed based on mobile operating systems (such as Android and Hongmeng), but some functions require the application to have system-level permissions to be implemented. The traditional system-level permission acquisition solution usually signs the application with a system signature and shares system-level permissions, which may cause other applications to run abnormally, such as startup crashes, and it is also easy to cause system-level permissions to be abused. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, terminal and storage medium for calling a system interface that can prevent the application system from causing abnormal operation of other applications during operation and avoid the abuse of system permissions in response to the above technical problems.

[0004] A method for calling a system interface is applied to a mobile operating system with a built-in proxy application; the method comprises:

[0005] Running a definition language interface of the mobile operating system through the proxy application, wherein the definition language interface is used to provide a cross-process service in the mobile operating system;

[0006] When a third-party application requests to call an interface with system-level permissions, a configuration manager instance is generated;

[0007] Registering a callback interface to the configuration manager instance;

[0008] Running an instance method in the configuration manager instance to obtain a first system interface using the cross-process service, or to obtain a second system interface through JAVA reflection;

[0009] Executing the first system interface or the second system interface to obtain an execution result;

[0010] When the execution result meets the callback condition, the execution result is returned to the callback interface.

[0011] In one embodiment, the method further comprises:

[0012] A service interface is constructed in the mobile operating system through the definition language interface to provide cross-process services in the mobile operating system.

[0013] In one embodiment, when a third-party application requests to call an interface of system-level permissions, generating a configuration manager instance includes:

[0014] When a third-party application requests to call an interface with system-level permissions, the interface definition language file is executed;

[0015] Generate a configuration manager class based on the interface definition language file;

[0016] The third-party application is bound to the proxy application to obtain a configuration manager instance through the proxy application.

[0017] In one embodiment, the second system interface includes a shutdown interface; and obtaining the second system interface through JAVA reflection includes:

[0018] Obtaining the service manager of the mobile operating system through JAVA reflection;

[0019] Obtaining remote management services using the service manager;

[0020] Obtain the stub class of the power service through the JAVA reflection;

[0021] Passing the remote management service to the method of the stub class to obtain a power service class for controlling shutdown;

[0022] The shutdown interface is called from the power service class.

[0023] In one embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

[0024] A system interface calling device is applied to a mobile operating system with a built-in proxy application; the device comprises:

[0025] A first running module, used for running a definition language interface of the mobile operating system through the proxy application, wherein the definition language interface is used for providing a cross-process service in the mobile operating system;

[0026] A generation module is used to generate a configuration manager instance when a third-party application requests to call an interface of system-level permissions;

[0027] A registration module, used to register the callback interface to the configuration manager instance;

[0028] A second running module, used for running the instance method in the configuration manager instance, so as to obtain the first system interface by using the cross-process service, or to obtain the second system interface by using JAVA reflection;

[0029] An execution module, used for executing the first system interface or the second system interface to obtain an execution result;

[0030] The return module is used to return the execution result to the callback interface when the execution result meets the callback condition.

[0031] In one embodiment, the device further comprises:

[0032] A construction module is used to construct a service interface in the mobile operating system through the definition language interface to provide cross-process services in the mobile operating system.

[0033] In one embodiment, the generation module is also used to execute an interface definition language file when a third-party application requests to call an interface of system-level permissions; generate a configuration manager class based on the interface definition language file; and bind the third-party application to the proxy application to obtain a configuration manager instance through the proxy application.

[0034] In one embodiment, the second system interface includes a shutdown interface; the second running module is also used to obtain the service manager of the mobile operating system through JAVA reflection; use the service manager to obtain the remote management service; obtain the stub class of the power service through the JAVA reflection; pass the remote management service to the method of the stub class to obtain the power service class that controls shutdown; call the shutdown interface from the power service class.

[0035] In one embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

[0036] A terminal includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0037] Running a definition language interface of the mobile operating system through the proxy application, wherein the definition language interface is used to provide a cross-process service in the mobile operating system;

[0038] When a third-party application requests to call an interface with system-level permissions, a configuration manager instance is generated;

[0039] Registering a callback interface to the configuration manager instance;

[0040] Running an instance method in the configuration manager instance to obtain a first system interface using the cross-process service, or to obtain a second system interface through JAVA reflection;

[0041] Executing the first system interface or the second system interface to obtain an execution result;

[0042] When the execution result meets the callback condition, the execution result is returned to the callback interface.

[0043] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0044] Running a definition language interface of the mobile operating system through the proxy application, wherein the definition language interface is used to provide a cross-process service in the mobile operating system;

[0045] When a third-party application requests to call an interface with system-level permissions, a configuration manager instance is generated;

[0046] Registering a callback interface to the configuration manager instance;

[0047] Running an instance method in the configuration manager instance to obtain a first system interface using the cross-process service, or to obtain a second system interface through JAVA reflection;

[0048] Executing the first system interface or the second system interface to obtain an execution result;

[0049] When the execution result meets the callback condition, the execution result is returned to the callback interface.

[0050] The calling method, device, terminal and storage medium of the above-mentioned system interface run the defined language interface of the mobile operating system through a proxy application, and the defined language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated; the callback interface is registered to the configuration manager instance; the instance method in the configuration manager instance is run to obtain the first system interface by using the cross-process service, or to obtain the second system interface through JAVA reflection; the first system interface or the second system interface is executed to obtain the execution result; when the execution result meets the callback condition, the execution result is returned to the callback interface, thereby realizing the ordinary application to call the system interface of system-level permissions, effectively avoiding sharing the system-level permissions by labeling the ordinary application as a system, so as not to affect the normal operation of other applications, and will not cause the system-level permissions to be abused. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A schematic diagram of a flow chart of a method for calling a system interface in one embodiment;

[0052] Figure 2A schematic diagram of a flow chart of a method for calling a system interface in another embodiment;

[0053] Figure 3 is a structural block diagram of a calling device of a system interface in one embodiment;

[0054] Figure 4 is a structural block diagram of a calling device of a system interface in another embodiment;

[0055] Figure 5 FIG. 4 is a diagram showing the internal structure of a terminal in an embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] In one embodiment, Figure 1 As shown, a method for calling a system interface is provided, which is applied to a mobile operating system with a built-in proxy application, and the mobile operating system is installed in a terminal. The method specifically includes the following steps:

[0058] S102, running a defined language interface of a mobile operating system through a proxy application, where the defined language interface is used to provide a cross-process service in the mobile operating system.

[0059] Among them, a proxy application (ProxyAPP) refers to an application built into a mobile operating system that can interact with third-party applications to obtain an interface for system-level permissions.

[0060] The definition language interface may be an Android Interface Definition Language (AIDL) interface, or a definition language interface of other mobile operating systems.

[0061] In one embodiment, the terminal constructs a service interface in the mobile operating system by defining a language interface to provide cross-process services in the mobile operating system. For example, in the process of implementing the AIDL interface, the terminal constructs a service (Service) of the mobile operating system and implements mBinder, wherein mBinder is used to allow cross-process access.

[0062] S104, when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated.

[0063] Among them, third-party applications may refer to non-operating system-level applications, which require system-level permissions to call system interfaces.

[0064] The configuration manager instance may refer to a system configuration manager (ISysSettingManager) instance, which includes a variety of methods, such as instance methods.

[0065] In one embodiment, S104 may specifically include: when a third-party application requests to call an interface of system-level permissions, the terminal executes an interface definition language file; generates a configuration manager class based on the interface definition language file; and binds the third-party application to the proxy application to complete service binding, so as to obtain a configuration manager instance through the proxy application.

[0066] In one embodiment, the terminal binds a service, such as calling a shutdown interface. The terminal can bind a data packet and an action of the service, where the package name of the data packet is such as "com.ifreecomm.oneproxy" and the action is "sys.setting". Then, the configuration manager instance is obtained by binding the service, such as obtaining an ISysSettingManager instance by binding the service.

[0067] S106: Register the callback interface to the configuration manager instance.

[0068] For example, the terminal registers the callback interface (IGetResultListener) to the ISysSettingManager instance.

[0069] S108, running the instance method in the configuration manager instance to obtain the first system interface by using the cross-process service, or to obtain the second system interface by using JAVA reflection.

[0070] The configuration manager instance includes a plurality of instance methods, and by calling these instance methods, the proxy application built into the mobile operating system can obtain the corresponding system interface, so as to execute the system interface and obtain the corresponding execution result.

[0071] The first system interface may be a system interface disclosed by the mobile operating system. The second system interface may be a system interface hidden by the mobile operating system, such as a shutdown interface (sysShutDown).

[0072] In one embodiment, the terminal runs an instance method in the configuration manager instance, thereby requesting the built-in proxy application of the mobile operating system to obtain the corresponding system interface, that is, requesting the built-in proxy application of the mobile operating system to directly use the cross-process service to obtain the first system interface, or to use the cross-process service combined with JAVA reflection technology to obtain the second system interface.

[0073] In one embodiment, the second system interface includes a shutdown interface; obtaining the second system interface through JAVA reflection in S108 may specifically include: the terminal obtains the service manager of the mobile operating system through JAVA reflection; using the service manager to obtain the remote management service; obtaining the stub class of the power service through JAVA reflection; passing the remote management service to the method of the stub class to obtain the power service class that controls shutdown; and calling the shutdown interface from the power service class.

[0074] For example, the terminal obtains the ServiceManager of the mobile operating system through JAVA reflection technology, then obtains the RemoteService, and then obtains the Stub class of IPowerManager through JAVA reflection technology, and passes the obtained remoteService to the method of the Stub class to obtain the oIpowerManager class that controls shutdown, and finally directly calls the shutdown method of the oIpowerManager class to achieve shutdown.

[0075] S110, executing the first system interface or the second system interface to obtain an execution result.

[0076] Different types of system interfaces may result in different execution results. For example, when the second system interface is a shutdown interface of a mobile operating system, the execution result is that the shutdown is completed.

[0077] S112, when the execution result meets the callback condition, the execution result is returned to the callback interface.

[0078] In one embodiment, if the execution result is not the completion of shutdown, the execution result satisfies the callback condition, and the terminal execution result is returned to the callback interface registered with the configuration manager instance.

[0079] In another embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, the callback condition is not met, and the execution result is not returned to the callback interface. Since the system has been shut down at this time, the execution result is not returned to the callback interface.

[0080] In order to more intuitively understand the calling method of the above system interface, combined with Figure 2 Further explanation is as follows:

[0081] (1)Built-in Proxy APP.

[0082] (2) Implement the provided AIDL file in the user JAVA layer.

[0083] (3) Bind the service and generate an ISysSettingManager instance.

[0084] (4)ProxyAPP implements the AIDL interface.

[0085] (5) Based on the request of the third-party application, ProxyAPP builds Service and implements mBinder.

[0086] (6) Register the callback interface to the ISysSettingManager instance.

[0087] (7) Call methods in ISysSettingManager.

[0088] (8) Based on the request of the third-party application, ProxyAPP implements the call of system-level API.

[0089] (9) Alternatively, obtain the system class through JAVA reflection to obtain the system-level API.

[0090] (10) Execute the system-level API to obtain the execution result.

[0091] (11) Return the result to the registered callback interface.

[0092] (12) Implement the return of execution results.

[0093] In the above embodiment, a defined language interface of the mobile operating system is run through a proxy application, and the defined language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated; the callback interface is registered to the configuration manager instance; the instance method in the configuration manager instance is run to obtain the first system interface by utilizing the cross-process service, or to obtain the second system interface through JAVA reflection; the first system interface or the second system interface is executed to obtain an execution result; when the execution result meets the callback condition, the execution result is returned to the callback interface, thereby enabling ordinary applications to call the system interface of system-level permissions, effectively avoiding sharing system-level permissions by labeling ordinary applications as system applications, thereby not affecting the normal operation of other applications, and not causing abuse of system-level permissions.

[0094] The present application also provides a shutdown application scenario, which applies the above-mentioned method for calling the system interface. Taking a smartphone with a certain processor model and an Android system as an example, the application of the method for calling the system interface in this application scenario is as follows:

[0095] 1) Android system built-in Proxy APP

[0096] 2) ProxyAPP implements a method called sysShutDown, in which the system ServiceManager is obtained through JAVA reflection technology, and then the RemoteService is obtained. The Stub class of IPowerManager is obtained through reflection, and the obtained remoteService is passed to the method of the Stub class to obtain the oIpowerManager class that controls the shutdown. Finally, the shutdown method of this class is directly called to achieve shutdown.

[0097] 3) The developer's project generates the ISysSettingManager class by implementing the provided AIDL file, and obtains the ISysSettingManager instance by binding the service. Then, the callback interface IGetResultListener is registered to the instance generated by ISysSettingManager. The bound package name is "com.ifreecomm.oneproxy" and the bound action is "sys.setting".

[0098] 4) Developers implement the shutdown method and directly call the sysShutDown method of ISysSettingManager in their own implementation method. No other operations are required. In this example, the call is shutdown and no data is returned.

[0099] The above-mentioned embodiments can achieve the following technical effects:

[0100] 1. Solved the problem that third-party applications cannot call system-level APIs;

[0101] 2. The CS architecture model is adopted to support multiple applications to interact with ProxyAPP, greatly reducing code redundancy;

[0102] 3. Developers and Android manufacturers do not need to communicate one-on-one, which improves development efficiency and reduces communication costs;

[0103] 4. The black box mode is adopted, so developers do not need to know the execution details behind it, which reduces the development difficulty for developers.

[0104] It should be understood that although Figure 1The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0105] In one embodiment, Figure 3 As shown, a system interface calling device is provided, which is applied to a mobile operating system with a built-in proxy application; the device can adopt a software module or a hardware module, or a combination of the two to become a part of the terminal, and the device specifically includes: a first running module 302, a generating module 304, a registering module 306, a second running module 308, an executing module 310 and a returning module 312, wherein:

[0106] A first running module 302, used to run a defined language interface of a mobile operating system through a proxy application, where the defined language interface is used to provide a cross-process service in the mobile operating system;

[0107] A generating module 304, used to generate a configuration manager instance when a third-party application requests to call an interface of system-level permissions;

[0108] A registration module 306, used to register the callback interface to the configuration manager instance;

[0109] A second running module 308 is used to run an instance method in the configuration manager instance to obtain the first system interface by using the cross-process service, or to obtain the second system interface by using JAVA reflection;

[0110] An execution module 310 is used to execute the first system interface or the second system interface to obtain an execution result;

[0111] The return module 312 is used to return the execution result to the callback interface when the execution result meets the callback condition.

[0112] In one embodiment, Figure 4 As shown, the device also includes:

[0113] The construction module 314 is used to construct a service interface in the mobile operating system by defining a language interface, so as to provide cross-process services in the mobile operating system.

[0114] In one embodiment, the generation module 304 is also used to execute the interface definition language file when a third-party application requests to call an interface of system-level permissions; generate a configuration manager class based on the interface definition language file; and bind the third-party application to the proxy application to obtain a configuration manager instance through the proxy application.

[0115] In one embodiment, the second system interface includes a shutdown interface; the second running module 308 is also used to obtain the service manager of the mobile operating system through JAVA reflection; use the service manager to obtain the remote management service; obtain the stub class of the power service through JAVA reflection; pass the remote management service to the method of the stub class to obtain the power service class that controls shutdown; call the shutdown interface from the power service class.

[0116] In one embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

[0117] In the above embodiment, a defined language interface of the mobile operating system is run through a proxy application, and the defined language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated; the callback interface is registered to the configuration manager instance; the instance method in the configuration manager instance is run to obtain the first system interface by utilizing the cross-process service, or to obtain the second system interface through JAVA reflection; the first system interface or the second system interface is executed to obtain an execution result; when the execution result meets the callback condition, the execution result is returned to the callback interface, thereby enabling ordinary applications to call the system interface of system-level permissions, effectively avoiding sharing system-level permissions by labeling ordinary applications as system applications, thereby not affecting the normal operation of other applications, and not causing abuse of system-level permissions.

[0118] For the specific definition of the calling device of the system interface, please refer to the definition of the calling method of the system interface in the above text, which will not be repeated here. Each module in the calling device of the above system interface can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the terminal in the form of hardware, or can be stored in the memory in the terminal in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0119] In one embodiment, a terminal is provided, whose internal structure diagram can be as follows: Figure 5As shown. The terminal includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the terminal is used to provide computing and control capabilities. The memory of the terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the terminal is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for calling a system interface is implemented. The display screen of the terminal can be a liquid crystal display screen or an electronic ink display screen, and the input device of the terminal can be a touch layer covering the display screen, or a button, trackball or touchpad set on the terminal shell, or an external keyboard, touchpad or mouse, etc.

[0120] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the terminal to which the scheme of the present application is applied. The specific terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0121] In one embodiment, a terminal is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are performed:

[0122] A defined language interface of a mobile operating system is run through a proxy application, and the defined language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated; a callback interface is registered to the configuration manager instance; an instance method in the configuration manager instance is run to obtain a first system interface using cross-process services, or to obtain a second system interface through JAVA reflection; the first system interface or the second system interface is executed to obtain an execution result; when the execution result meets the callback condition, the execution result is returned to the callback interface.

[0123] In one embodiment, the processor further performs the following steps when executing the computer program:

[0124] By defining a language interface, a service interface is built in the mobile operating system to provide cross-process services in the mobile operating system.

[0125] In one embodiment, when the processor executes the step of generating a configuration manager instance when a third-party application requests to call an interface of system-level permissions, the processor specifically executes the following steps:

[0126] When a third-party application requests to call an interface with system-level permissions, the interface definition language file is executed;

[0127] Generates a configuration manager class based on the interface definition language file;

[0128] Bind the third-party application with the proxy application to obtain the Configuration Manager instance through the proxy application.

[0129] In one embodiment, the second system interface includes a shutdown interface; when the processor executes the step of obtaining the second system interface through JAVA reflection, the following steps are specifically performed:

[0130] Obtain the service manager of the mobile operating system through JAVA reflection; use the service manager to obtain the remote management service; obtain the stub class of the power service through JAVA reflection; pass the remote management service to the method of the stub class to obtain the power service class that controls shutdown; call the shutdown interface from the power service class.

[0131] In one embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

[0132] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which, when executed by a processor, implements the following steps:

[0133] A defined language interface of a mobile operating system is run through a proxy application, and the defined language interface is used to provide cross-process services in the mobile operating system; when a third-party application requests to call an interface of system-level permissions, a configuration manager instance is generated; a callback interface is registered to the configuration manager instance; an instance method in the configuration manager instance is run to obtain a first system interface using cross-process services, or to obtain a second system interface through JAVA reflection; the first system interface or the second system interface is executed to obtain an execution result; when the execution result meets the callback condition, the execution result is returned to the callback interface.

[0134] In one embodiment, the processor further performs the following steps when executing the computer program:

[0135] By defining a language interface, a service interface is built in the mobile operating system to provide cross-process services in the mobile operating system.

[0136] In one embodiment, when the processor executes the step of generating a configuration manager instance when a third-party application requests to call an interface of system-level permissions, the processor specifically executes the following steps:

[0137] When a third-party application requests to call an interface with system-level permissions, the interface definition language file is executed;

[0138] Generates a configuration manager class based on the interface definition language file;

[0139] Bind the third-party application with the proxy application to obtain the Configuration Manager instance through the proxy application.

[0140] In one embodiment, the second system interface includes a shutdown interface; when the processor executes the step of obtaining the second system interface through JAVA reflection, the following steps are specifically performed:

[0141] Obtain the service manager of the mobile operating system through JAVA reflection; use the service manager to obtain the remote management service; obtain the stub class of the power service through JAVA reflection; pass the remote management service to the method of the stub class to obtain the power service class that controls shutdown; call the shutdown interface from the power service class.

[0142] In one embodiment, when the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

[0143] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a terminal reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the terminal performs the steps in the above-mentioned method embodiments.

[0144] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0145] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0146] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for calling a system interface, characterized in that: The method is applied to a mobile operating system with a built-in proxy application, and supports multiple third-party applications to interact with the proxy application; the method comprises: The proxy application implements a definition language interface of the mobile operating system, and constructs a service interface in the mobile operating system through the definition language interface to provide a cross-process service in the mobile operating system; When a third-party application requests to call an interface of system-level permissions, the third-party application generates a configuration manager instance; The third-party application registers a callback interface to the configuration manager instance; The third-party application runs the instance method in the configuration manager instance to interact with the proxy application using the cross-process service, and the proxy application obtains the first system interface or obtains the second system interface through JAVA reflection; The proxy application executes the first system interface or the second system interface to obtain an execution result; When the execution result meets the callback condition, the proxy application returns the execution result to the callback interface.

2. The method according to claim 1, characterized in that The second system interface is a system interface hidden by the mobile operating system.

3. The method according to claim 1, characterized in that When the third-party application requests to call the interface of the system-level permission, the third-party application generates a configuration manager instance including: When a third-party application requests to call an interface of system-level permission, the third-party application executes the interface definition language file; The third-party application generates a configuration manager class based on the interface definition language file; The third-party application binds the third-party application to the proxy application to obtain a configuration manager instance through the proxy application.

4. The method according to any one of claims 1 to 3, characterized in that: The second system interface includes a shutdown interface; and obtaining the second system interface through JAVA reflection includes: Obtaining the service manager of the mobile operating system through JAVA reflection; Obtaining remote management services using the service manager; Obtain the stub class of the power service through the JAVA reflection; Passing the remote management service to the method of the stub class to obtain a power service class for controlling shutdown; The shutdown interface is called from the power service class.

5. The method according to claim 4, characterized in that When the second system interface is a shutdown interface, the execution result indicates that the shutdown is completed, and the execution result is not returned to the callback interface.

6. A system interface calling device, characterized in that: The device is applied to a mobile operating system with a built-in proxy application, and supports multiple third-party applications to interact with the proxy application; the device includes: A first running module is used for the proxy application to implement a definition language interface of the mobile operating system, and to construct a service interface in the mobile operating system through the definition language interface to provide a cross-process service in the mobile operating system; A generation module, configured to generate a configuration manager instance when a third-party application requests to call an interface of system-level permissions; A registration module, used for the third-party application to register a callback interface to the configuration manager instance; A second running module is used for the third-party application to run the instance method in the configuration manager instance to interact with the proxy application using the cross-process service, and the proxy application obtains the first system interface or obtains the second system interface through JAVA reflection; An execution module, used for the proxy application to execute the first system interface or the second system interface to obtain an execution result; The return module is used for the proxy application to return the execution result to the callback interface when the execution result meets the callback condition.

7. The device according to claim 6, characterized in that The second system interface is a system interface hidden by the mobile operating system.

8. The device according to claim 6, characterized in that The generation module is also used for, when a third-party application requests to call an interface of system-level permissions, the third-party application executes an interface definition language file; the third-party application generates a configuration manager class based on the interface definition language file; the third-party application binds the third-party application to the proxy application to obtain a configuration manager instance through the proxy application.

9. A terminal comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Cross-process communication method, device and equipment

    CN110569130A