System Function Invoking Method and Apparatus, and Terminal
A system function invoking method includes acquiring an installation package of a first application program, granting a first permission of a system to the first application program according to the installation package, where the first permission is used to, when the first application program is in a running state, forbid a second application program from invoking at least one system function. The method further includes running the first application program, and forbidding the second application program from invoking the at least one system function.
1 . A system function invoking method implemented by a terminal device, the method comprising:
acquiring configuration information of a first permission from an installation package of a first application program installed in the terminal device, wherein the first permission is less than a highest level permission and is configured to forbid a second application program from invoking a system function in response to running the first application program;
granting the first permission to the first application program according to the configuration information; and
forbidding, according to the configuration information, the second application program from invoking the system function in response to running the first application program.
2 . The system function invoking method of claim 1 , wherein acquiring the configuration information comprises:
installing the first application program in the terminal device according to the installation package; and
reading the configuration information from the installation package while installing the first application program in the terminal device.
3 . The system function invoking method of claim 1 , wherein the second application program is an application program of a plurality of application programs in the terminal device other than the first application.
4 . The system function invoking method of claim 1 , wherein forbidding the second application program from invoking the system function comprises:
ending an invocation of the system function by the second application program when the second application program has invoked the system function and the system function is currently in an invoked state of being invoked by the second application program; and
forbidding subsequent invocation of the system function by the second application program when the second application program has not invoked the system function or when the second application program has invoked the system function and the system function is currently not in the invoked state.
5 . The system function invoking method of claim 1 , wherein granting the first permission to the first application program comprises:
receiving a user grant; and
granting the first permission to the first application program according to the configuration information in response to receiving the user grant.
6 . The system function invoking method of claim 1 , wherein forbidding the second application program from invoking the system function comprises:
suspending an invocation of the system function by the second application program when the second application program has invoked the system function and the system function is currently in an invoked state of being invoked by the second application program; and
forbidding subsequent invocation of the system function by the second application program when the second application program has not invoked the system function or when the second application program has invoked the system function and the system function is currently not in the invoked state.
7 . The system function invoking method of claim 1 , wherein forbidding the second application program from invoking the system function comprises forbidding invoking an application programming interface (API) corresponding to the system function in response to running the first application program.
8 . A terminal device, comprising:
a storage device configured to store instructions; and
a processor coupled to the storage device, wherein the instructions cause the processor to be configured to:
acquire configuration information of a first permission from an installation package of a first application program installed in the terminal device, wherein the first permission is less than a highest level permission and is configured to forbid a second application program from invoking a system function in response to running the first application program;
grant the first permission to the first application program according to the configuration information; and
forbid, according to the configuration information, the second application program from invoking the system function in response to running the first application program.
9 . The terminal device of claim 8 , wherein the instructions further cause the processor to be configured to:
install the first application program in the terminal device according to the installation package; and
read the configuration information from the installation package while installing the first application program in the terminal device.
10 . The terminal device of claim 8 , wherein the second application program is an application program of all application programs in the terminal device other than the first application program.
11 . The terminal device of claim 8 , wherein the second application program is an application program of a plurality of application programs except the first application program.
12 . The terminal device of claim 8 , wherein the instructions further cause the processor to be configured to:
receive a user grant; and
grant the first permission to the first application program according to the configuration information in response to receiving the user grant.
13 . The terminal device of claim 8 , wherein the instructions further cause the processor to be configured to:
suspend or end an invocation of the system function by the second application program when the second application program has invoked the system function and the system function is currently in an invoked state of being invoked by the second application program; and
forbid subsequent invocation of the system function by the second application program when the second application program has not invoked the system function or when the second application program has invoked the system function and the system function is currently not in the invoked state.
14 . The terminal device of claim 8 , wherein the instructions further cause the processor to be configured to forbid invoking an application programming interface (API) corresponding to the system function in response to running the first application program.
15 . A system function invoking method implemented by a terminal device, the method comprising:
configuring a first mode in a system;
acquiring configuration information of a first permission from an installation package of a first application program, wherein the first permission is less than a highest level permission and is configured to forbid a second application program from invoking a system function in response to running the first application program;
granting the first permission to the first application program according to the configuration information;
running the first application program;
configuring the system such that the system is in the first mode in response to running the first application program; and
forbidding, according to the first permission, the second application program from invoking the system function in response to running the first application program.
16 . The system function invoking method of claim 15 , wherein acquiring the configuration information comprises:
installing the first application program in the terminal device according to the installation package; and
reading the configuration information from the installation package while installing the first application program in the terminal device.
17 . The system function invoking method of claim 15 , wherein the second application program is either:
an application program of all application programs in the terminal device other than the first application program; or
an application program of a plurality of application programs in the terminal device other than the first application program.
18 . The system function invoking method of claim 15 , wherein granting the first permission to the first application program comprises:
receiving a user grant; and
granting the first permission to the first application program according to the configuration information and in response to receiving the user grant.
19 . The system function invoking method of claim 15 , wherein forbidding the second application program from invoking the system function comprises:
suspending an invocation of the system function by the second application program when the second application program has invoked the system function and the system function is currently in an invoked state of being invoked by the second application program; and
forbidding subsequent invocation of the system function by the second application program when the second application program has not invoked the system function or when the second application program has invoked the system function and the system function is currently not in the invoked state.
20 . The system function invoking method of claim 15 , wherein forbidding the second application program from invoking the system function comprises forbidding invoking an application programming interface (API) corresponding to the system function in response to the first application program running.