Application program control method and device

By matching the data type when the application calls the hardware interface and interrupting the mismatch, the problem of user data being obtained by unnecessary authorization is solved, and the security of user data is improved.

CN120145375APending Publication Date: 2025-06-13VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510348078.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In the prior art, when a user authorizes an application to call a hardware interface, he often does not read the permission prompts carefully, causing the application to obtain unnecessary user data and reduce the security of user data.

Method used

By obtaining the data type when the application calls the hardware interface and the data type declared by the application, if it does not match, the application's call will be interrupted to prevent data theft.

Benefits of technology

It effectively prevents applications from obtaining user data that should not be obtained and improves the security of user data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120145375A_ABST
    Figure CN120145375A_ABST
Patent Text Reader

Abstract

The invention discloses an application program control method and device, and belongs to the technical field of electronic equipment. The application program control method comprises the steps of obtaining data returned by a hardware interface when an application program calls the hardware interface; obtaining a first data type of data required to be returned by the hardware interface when the hardware interface is called and declarated by the application program; and when the data type of the data returned by the hardware interface is not matched with the first data type, interrupting the application program to call the hardware interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of electronic devices, and particularly relates to a method and device for controlling application programs. Background Art

[0002] The system permissions of an electronic device are a key security function of the operating system. It controls the application program to call the corresponding hardware interface by granting different permissions to the application program.

[0003] In the related art, some application programs request more permissions than those actually required for their functions. Although the operating system provides permission prompts, users usually authorize the hardware interface without carefully reading the permission prompts or understanding the permission request instructions for calling a certain hardware interface. When the user authorizes the application program to call a certain hardware interface unnecessarily, the application program may obtain user data through this hardware interface, reducing the security of user data. Summary of the Invention

[0004] The purpose of the embodiments of this application is to provide a method and device for controlling application programs, which can improve the security of user data.

[0005] In a first aspect, the embodiments of this application provide a method for controlling an application program, including:

[0006] Obtaining the data returned by the hardware interface when the application program calls the hardware interface;

[0007] Obtaining a first data type of the data that the application program declares is required to be returned by the hardware interface when calling the hardware interface;

[0008] Interrupting the application program from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type.

[0009] In a second aspect, the embodiments of this application provide a device for controlling an application program, including:

[0010] A first obtaining module, configured to obtain the data returned by the hardware interface when the application program calls the hardware interface;

[0011] A second obtaining module, configured to obtain a first data type of the data that the application program declares is required to be returned by the hardware interface when calling the hardware interface;

[0012] An interrupt module, configured to interrupt the application program from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instructions that can run on the processor. When the program or instructions are executed by the processor, the steps of the control method of the application program provided by the embodiment of the present application are implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instructions are stored. When the program or instructions are executed by a processor, the steps of the control method of the application program provided by the embodiment of the present application are implemented.

[0015] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is used to run a program or instructions to implement the steps of the control method of the application program provided by the embodiment of the present application.

[0016] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the steps of the control method of the application program provided by the embodiment of the present application.

[0017] In the embodiment of the present application, by obtaining the data returned by the hardware interface when the application program calls the hardware interface; obtaining the first data type of the data that the application program declares to be required to be returned by the hardware interface when calling the hardware interface; and interrupting the application program from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type. In this way, it is possible to prevent the application program from obtaining data that is not the data that it declares to be required to be returned by the hardware interface when calling the hardware interface, prevent the application program from stealing user data, and improve the security of user data. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a flowchart of the control method of the application program provided by the embodiment of the present application;

[0019] Figure 2 is a schematic diagram of the data interaction architecture provided by the embodiment of the present application;

[0020] Figure 3 is a schematic diagram of the structure of the control device of the application program provided by the embodiment of the present application;

[0021] Figure 4 is a schematic diagram of the structure of the electronic device provided by the embodiment of the present application;

[0022] Figure 5 is a schematic diagram of the hardware structure of the electronic device implementing the embodiment of the present application. DETAILED DESCRIPTION

[0023] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0024] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means an "or" relationship between the associated objects before and after.

[0025] Next, in conjunction with the accompanying drawings, the control method and device of the application program provided by the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.

[0026] Figure 1 It is a schematic flowchart of the control method of the application program provided by the embodiments of the present application. The control method of the application program may include:

[0027] Step 101: Obtain the data returned by the hardware interface when the application program calls the hardware interface;

[0028] In some possible implementations of the embodiments of the present application, the hardware interface in the embodiments of the present application may be any one of multiple hardware interfaces of the electronic device, for example, a microphone interface, a camera interface, and the like.

[0029] Step 102: Obtain the first data type of the data that the application program declares to be required to be returned by the hardware interface when calling the hardware interface;

[0030] In some possible implementations of the embodiments of the present application, when the hardware interface is a camera interface, the first data type in the embodiments of the present application may include at least one of: QR code, video call type, portrait type, and landscape type; when the hardware interface is a microphone interface, the first data type in the embodiments of the present application may include at least one of: recording, voice, and phone call.

[0031] In some possible implementations of the embodiments of the present application, for an electronic device with the Android operating system, the data type of the data that the hardware interface needs to return when the application calls the hardware interface can be obtained from the core configuration file "AndroidMainfest.xml" of the application.

[0032] Step 103: Interrupt the application from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type.

[0033] When it is obtained that when the application calls the hardware interface, the data type of the data returned by the hardware interface does not match the data type of the data that the application declares the hardware interface needs to return when calling the hardware interface, it indicates that the application may be stealing the data returned by the hardware interface when calling the hardware interface. Therefore, interrupt the application from calling the hardware interface, that is, control the application not to be able to call the hardware interface.

[0034] Exemplarily, assume that the data type of the data that a certain application declares the microphone interface needs to return when calling the microphone interface is recording, and when the user actually uses the application and the application calls the microphone interface, the data returned by the microphone interface is a phone call, then interrupt the application from calling the microphone interface.

[0035] In the embodiments of the present application, by obtaining the data returned by the hardware interface when the application calls the hardware interface; obtaining the first data type of the data that the application declares the hardware interface needs to return when calling the hardware interface; and interrupting the application from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type. In this way, it is possible to prevent the application from obtaining data that is not the data that the application declares the hardware interface needs to return when calling the hardware interface, prevent the application from stealing user data, and improve the security of user data.

[0036] In some possible implementations of the embodiments of the present application, the control method for the application provided in the embodiments of the present application may further include: when the data type of the data returned by the hardware interface matches the first data type, feedback the data returned by the hardware interface to the application.

[0037] Exemplarily, assume that the data type of the data that a certain application declares the microphone interface needs to return when calling the microphone interface is recording; when the user actually uses the application and the application calls the microphone interface, the data returned by the microphone interface is also recording, then feedback the recording data returned by the microphone interface to the application.

[0038] In an embodiment of the present application, when the data type of the data returned by the hardware interface when the application calls the hardware interface matches the data type of the data that the application declares to be required to be returned by the hardware interface when calling the hardware interface, by returning the data returned by the hardware interface when the application calls the hardware interface to the application, the normal operation of the application can be ensured.

[0039] In some possible implementations of the embodiment of the present application, before step 101, the application control method provided by the embodiment of the present application may further include: determining whether it is reasonable for the application to call the hardware interface according to the type of the application and the first data type; when it is unreasonable for the application to call the hardware interface, prohibiting the application from calling the hardware interface. Correspondingly, step 101 may include: when it is reasonable for the application to call the hardware interface, obtaining the data returned by the hardware interface when the application calls the hardware interface.

[0040] In some possible implementations of the embodiment of the present application, the types of the applications in the embodiment of the present application include but are not limited to: games, news, chat, payment, shopping, and the like.

[0041] Exemplarily, assume that the type of a certain application is a game, and the data type of the data returned by the declared call to the microphone interface of the application is a phone. Since game applications do not use phones, it can be considered that it is unreasonable for the application to call the microphone interface. At this time, the application's call to the microphone interface can be directly disabled.

[0042] Exemplarily, assume that the type of a certain application is shopping, and the data type of the data returned by the declared call to the camera interface of the application is an image. Since shopping applications can search for products by taking pictures with the camera, it can be considered that it is reasonable for the application to call the camera interface. The application can call the camera interface, and then obtain the data returned by the camera interface when the application calls the camera interface.

[0043] In an embodiment of the present application, when it is unreasonable for an application to call a hardware interface, by prohibiting the application from calling the hardware interface, it is possible to prevent the application from obtaining user data through the hardware interface, and improve the security of user data.

[0044] In some possible implementations of the embodiment of the present application, the application control method provided by the embodiment of the present application may further include: when it is unreasonable for the application to call the hardware interface, displaying a prompt message, where the prompt message is used to prompt that there is a risk of data theft in the application.

[0045] Exemplarily, assume that the type of a certain application is a game, and the data type of the data returned by the declared call to the microphone interface of this application is "phone". Since game applications do not use the phone, it can be considered that the application's call to the microphone interface is unreasonable. At this time, a prompt message for prompting the risk of data theft in this application can be displayed. Through this prompt message, the user can decide whether to continue using this application and whether to grant the application the permission to call the microphone interface.

[0046] In the embodiment of the present application, when an application calls a hardware interface unreasonably, the user can obtain the risk of data theft in this application by displaying a prompt message.

[0047] In some possible implementations of the embodiment of the present application, the control method of the application provided by the embodiment of the present application may further include: when an application calls a hardware interface unreasonably, sending a first message to the application platform that provides the application, where the first message is used for the application platform to notify the developer of the application to modify the application's call to the hardware interface.

[0048] Exemplarily, assume that the type of a certain application is a game, and the data type of the data returned by the declared call to the microphone interface of this application is "phone". Since game applications do not use the phone, it can be considered that the application's call to the microphone interface is unreasonable. At this time, a message for the application platform to notify the developer of the application to modify the application's call to the hardware interface can be sent to the application platform that provides this game. After receiving this message, the application platform notifies the developer of this application to modify the application's call interface.

[0049] In the embodiment of the present application, when an application calls a hardware interface unreasonably, by sending a message for the application platform to notify the developer of the application to modify the application's call to the hardware interface to the application platform that provides this game, the application platform can notify the developer of this application to modify the application's call interface to ensure the reasonableness of the application's call to the hardware interface.

[0050] In some possible implementations of the embodiment of the present application, when a certain application applies to be listed on the application platform, the application platform can first perform a reasonableness detection on the application's call to the hardware interface. When it is detected that the application's call to the hardware interface is unreasonable, the application can be returned to the developer of this application and the developer of this application can be notified to modify the application's call interface; when it is detected that the application's call to the hardware interface is reasonable, the application is listed for the user to download and install.

[0051] In the embodiments of the present application, by performing rationality detection on application programs on the application platform side, it can be ensured that the application programs provided by the application platform are all application programs that reasonably call hardware interfaces, and the resources occupied by the electronic device for performing rationality detection on application programs can be reduced.

[0052] In some possible implementations of the embodiments of the present application, the electronic device may record the situation information of each call of the hardware interface by the application program and send it to the application platform that provides the application program. Among them, the situation information may include: the hardware interface declared by the application program to be called, the data type of the data that the application program declares to be required to be returned by the hardware interface when calling the hardware interface, the data type of the data actually returned by the hardware interface when the application program calls the hardware interface, the timestamp when the application program calls the hardware interface, etc. When the application platform determines, based on the received situation information, that the data type of the data returned by the hardware interface when the application program calls the hardware interface multiple times does not match the data type of the data that the application program declares to be required to be returned by the hardware interface when calling the hardware interface, the application program may be taken off the shelves and the developer of the application program may be notified to modify the interface called by the application program.

[0053] In some possible implementations of the embodiments of the present application, during the life cycle of the application program, the application program may request the hardware identifier of the electronic device. Based on this, the control method for the application program provided by the embodiments of the present application may further include: when the application program requests the hardware identifier of the electronic device and the application program is not an application program in the application program whitelist, obtaining the key for encrypting the hardware identifier, the package name corresponding to the application program, and the first identifier allocated to the process of the application program currently; generating a second identifier by using the trusted execution environment (TEE) according to the key, the package name, and the first identifier; and feeding back the second identifier to the application program.

[0054] Among them, the trusted execution environment TEE is an independent and secure area in the computer processor, which is specifically used to execute sensitive code and store sensitive data, and is isolated from the operating system to prevent being invaded by malware or other attacks. The main purpose of the TEE is to improve the security of the system and provide a trusted operating environment for critical data and operations.

[0055] In some possible implementations of the embodiments of the present application, an application can call a framework layer interface to request the hardware identifier of an electronic device. The framework layer obtains the package name of the application and the first identifier currently assigned to the process of the application, and passes the package name and the first identifier to a trusted application (TA) in a trusted execution environment. When the application is not an application in the application whitelist, the trusted application TA obtains a dedicated key for encrypting the hardware identifier from a keymaster. The trusted application TA generates a second identifier by using the dedicated key, the package name of the application, and the first identifier currently assigned to the process of the application, and the trusted application TA feeds back the second identifier to the framework layer, and the framework layer feeds back the second identifier to the application.

[0056] Since the first identifier currently assigned to the process of the application changes over time, and thus the second identifier also changes, the second identifier can be referred to as a temporary identifier.

[0057] In some possible implementations of the embodiments of the present application, when generating a second identifier by using a trusted execution environment according to a key, a package name, and a first identifier, the package name of the application and the first identifier currently assigned to the process of the application can be logically operated first to obtain a logical operation result, and the trusted application uses a hash-based message authentication code (HMAC) algorithm and the dedicated key to perform a hash operation on the logical operation result to obtain the second identifier. Among them, the logical operations in the embodiments of the present application include, but are not limited to, logical AND operation, logical OR operation, and logical XOR operation, etc.

[0058] In some possible implementations of the embodiments of the present application, the second identifier can be generated by the following formula (1):

[0059] tmpId = HMAC_SHA256(key_ta, package_name || process_id) (1)

[0060] Wherein, in formula (1), tmpId is the second identifier, HMAC_SHA256 is the HMAC algorithm, key_ta is the key, package_name is the package name of the application, process_id is the first identifier currently assigned to the application, and || is a logical OR operation.

[0061] When the life cycle of the application ends and the application is restarted, when the application requests the hardware identifier of the electronic device again, the second identifier is regenerated and fed back to the application in the above manner.

[0062] In an embodiment of the present application, when the application is not an application in the application whitelist, by feeding back a temporary identifier to the application during the life cycle of the application and using a trusted execution environment to generate the temporary identifier, it is possible to prevent the application from obtaining the hardware identifier of the electronic device, and improve the security of the hardware identifier of the electronic device.

[0063] In some possible implementations of the embodiment of the present application, the control method for the application provided by the embodiment of the present application may further include: when the application requests the hardware identifier of the electronic device and the application is an application in the application whitelist, obtaining the key for encrypting the hardware identifier, the hardware identifier, the package name corresponding to the application, and the signature information of the application; generating a third identifier by using the trusted execution environment according to the key, the hardware identifier, the package name, and the signature information; and feeding back the third identifier to the application.

[0064] In some possible implementations of the embodiment of the present application, the application may call a framework layer interface to request the hardware identifier of the electronic device. The framework layer obtains the package name of the application and the signature information of the application, and passes the package name and the signature information to a trusted application in the trusted execution environment. When the application is an application in the application whitelist, the trusted application TA obtains the dedicated key for encrypting the hardware identifier and the hardware identifier from the key manager. The trusted application TA generates a third identifier by using the dedicated key, the package name of the application, the hardware identifier, and the signature information, and the trusted application TA feeds back the third identifier to the framework layer, and the framework layer feeds back the third identifier to the application.

[0065] Since the dedicated key, the package name of the application, the hardware identifier, and the signature information are all fixed and unchanged, when the application requests the hardware identifier of the electronic device each time, the third identifier generated by the trusted application TA is the same, and the third identifier can be called a permanent identifier.

[0066] In some possible implementations of the embodiment of the present application, when generating the third identifier by using the trusted execution environment according to the key, the hardware identifier, the package name, and the signature information, the package name of the application and the signature information of the application may be logically operated first to obtain a logical operation result, and the trusted application encrypts the logical operation result and the hardware identifier by using a symmetric encryption algorithm (Advanced Encryption Standard, AES) and the dedicated key to obtain the third identifier.

[0067] In some possible implementations of the embodiment of the present application, the third identifier may be generated by the following formula (2):

[0068] tmpDeviceId = AES128_GCM(key_ta, deviceId, package_name || app_sign) (2)

[0069] Among them, in formula (2), tmpDeviceId is the third identifier, AES128_GCM is the AES algorithm, key_ta is the key, deviceId is the hardware representation, package_name is the package name of the application, app_sign is the signature information of the application, and || is the logical OR operation.

[0070] In the embodiments of the present application, when the application is an application in the application whitelist, by feeding back the permanent identifier to the application during the life cycle of the application and generating the permanent identifier using the hardware identifier of the electronic device in the trusted execution environment, it is possible to prevent the application from obtaining the hardware identifier of the electronic device and improve the security of the hardware identifier of the electronic device.

[0071] In some possible implementations of the embodiments of the present application, when the application whitelist is maintained by the server, when an application calls a framework layer interface to request the hardware identifier of the electronic device, the framework layer may first obtain the package name of the application and the signature information of the application, and pass the package name and the signature information to the trusted application in the trusted execution environment. The trusted application TA obtains the dedicated key and the hardware identifier used to encrypt the hardware identifier from the key manager. The trusted application TA generates a third identifier through the above formula (2), and the trusted application TA feeds back the third identifier to the framework layer; the framework layer reports the information of the application to the server, where the information reported by the application includes, but is not limited to: the package name of the application, the signature information of the application, the public key of the application, and so on. The server determines whether the application is an application in the application whitelist based on the information reported by the application. When the application is an application in the application whitelist, the server sends a first indication message to the framework layer, where the first indication message is used to indicate that the framework layer can feed back the third identifier to the application; after receiving the first indication message, the framework layer feeds back the third identifier to the application. When the application is not an application in the application whitelist, the server sends a second indication message to the framework layer, where the second indication message is used to indicate that the framework layer cannot feed back the third identifier to the application; after receiving the second indication message, the framework layer obtains the package name of the application and the first identifier currently allocated to the process of the application, and passes the package name and the first identifier currently allocated to the process of the application to the trusted application in the trusted execution environment. The trusted application TA obtains the dedicated key and the used to encrypt the hardware identifier from the key manager. The trusted application TA generates a second identifier through the above formula (1), and the trusted application TA feeds back the second identifier to the framework layer; the framework layer feeds back the second identifier to the application.

[0072] The data interaction architecture corresponding to the application's request for the hardware identifier of the electronic device is as Figure 2 shown, Figure 2 which is a schematic diagram of the data interaction architecture provided by the embodiments of the present application. In Figure 2In this case, the application 201 calls the framework layer 202 to request the hardware identifier of the electronic device. The framework layer 202 feeds back the second identifier or the third identifier to the application 201. The framework layer 202 passes the package name of the application and the signature information of the application to the trusted application 2031 included in the trusted execution environment 203, or passes the package name of the application and the first identifier currently allocated to the process of the application to the trusted application 2031. The trusted application 2031 obtains the dedicated key for encrypting the hardware identifier and the hardware identifier from the key manager 2032 included in the trusted execution environment 203. The trusted application 2031 feeds back the second identifier or the third identifier to the framework layer 202. The framework layer 202 reports the information of the application to the server 204. The server 204 feeds back the first indication information or the second indication information to the framework layer.

[0073] In some possible implementations of the embodiments of the present application, the framework layer may report the operation logs related to the application's request for the hardware identifier to the server at regular intervals. The server determines whether there are the following situations based on the operation logs reported by the framework layer:

[0074] Situation 1: Application A applies for and uses a temporary identifier once, but the identifier of the process allocated to the application is not updated during subsequent use.

[0075] Situation 2: Application A applies for and uses a temporary identifier, but the same temporary identifier is found in the operation log of Application B.

[0076] Situation 3: Application A applies for and uses a permanent identifier, but the same permanent identifier is found in the operation log of Application B.

[0077] When any of the above three situations exists, the server may notify the application platform providing Application A to take Application A off the shelves. The application platform takes Application A off the shelves and notifies the developer of Application A to modify Application A. A prompt message is sent to the electronic device installed with Application A, and the prompt message is used to prompt the user that Application A has a risk of data theft.

[0078] For the application control method provided by the embodiments of the present application, the execution subject may be the control device of the application. In the embodiments of the present application, taking the control device of the application executing the application control method as an example, the control device of the application provided by the embodiments of the present application is described.

[0079] Figure 3 It is a schematic structural diagram of the control device of the application provided by the embodiments of the present application. The control device 300 of the application may include:

[0080] The first acquisition module 301 is configured to acquire the data returned by the hardware interface when the application calls the hardware interface.

[0081] A second acquisition module 302, configured to acquire a first data type of data that needs to be returned by a hardware interface when an application calls the hardware interface as declared by the application.

[0082] An interruption module 303, configured to interrupt the application from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type.

[0083] In an embodiment of the present application, by acquiring the data returned by the hardware interface when the application calls the hardware interface; acquiring the first data type of data that needs to be returned by the hardware interface when the application calls the hardware interface as declared by the application; and interrupting the application from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type. In this way, it is possible to prevent the application from acquiring data that is not the data that needs to be returned by the hardware interface as declared by it, prevent the application from stealing user data, and improve the security of user data.

[0084] In some possible implementations of the embodiment of the present application, the control device 300 of the application provided in the embodiment of the present application may further include:

[0085] A first feedback module, configured to return the data returned by the hardware interface to the application when the data type of the data returned by the hardware interface matches the first data type.

[0086] In the embodiment of the present application, when the data type of the data returned by the hardware interface when the application calls the hardware interface matches the data type of the data that needs to be returned by the hardware interface as declared by the application, by returning the data returned by the hardware interface when the application calls the hardware interface to the application, it is possible to ensure the normal operation of the application.

[0087] In some possible implementations of the embodiment of the present application, the control device 300 of the application provided in the embodiment of the present application may further include:

[0088] A first determination module, configured to determine whether it is reasonable for the application to call the hardware interface according to the type of the application and the first data type; and prohibit the application from calling the hardware interface when it is not reasonable for the application to call the hardware interface.

[0089] Correspondingly, the first acquisition module 301 is specifically configured to:

[0090] When it is reasonable for the application to call the hardware interface, acquire the data returned by the hardware interface when the application calls the hardware interface.

[0091] In the embodiments of the present application, when an application calls a hardware interface unreasonably, by prohibiting the application from calling the hardware interface, it is possible to prevent the application from obtaining user data through the hardware interface, thereby improving the security of user data.

[0092] In some possible implementations of the embodiments of the present application, the control device 300 for an application provided by the embodiments of the present application may further include:

[0093] A display module, configured to display a prompt message when the application calls the hardware interface unreasonably, where the prompt message is used to prompt that there is a risk of data theft in the application.

[0094] In the embodiments of the present application, when an application calls a hardware interface unreasonably, by displaying a prompt message, the user can be made aware that there is a risk of data theft in the application.

[0095] In some possible implementations of the embodiments of the present application, the control device 300 for an application provided by the embodiments of the present application may further include:

[0096] A sending module, configured to send a first piece of information to the application platform that provides the application, where the first piece of information is used for the application platform to notify the developer of the application to modify the application's call to the hardware interface.

[0097] In the embodiments of the present application, when an application calls a hardware interface unreasonably, by sending a message to the application platform that provides the game, which is used for the application platform to notify the developer of the application to modify the application's call to the hardware interface, the application platform can notify the developer of the application to modify the application's call interface to ensure the reasonableness of the application's call to the hardware interface.

[0098] In some possible implementations of the embodiments of the present application, the control device 300 for an application provided by the embodiments of the present application may further include:

[0099] A third acquisition module, configured to acquire a key for encrypting the hardware identifier, the package name corresponding to the application, and a first identifier currently allocated to the process of the application when the application requests the hardware identifier of the electronic device and the application is not an application in the application whitelist;

[0100] A first generation module, configured to generate a second identifier using a trusted execution environment based on the key, the package name, and the first identifier;

[0101] A second feedback module, configured to feedback the second identifier to the application.

[0102] In an embodiment of the present application, when an application is not an application in the application whitelist, by feeding back a temporary identifier to the application during the life cycle of the application and generating the temporary identifier using a trusted execution environment, it is possible to prevent the application from obtaining the hardware identifier of the electronic device and improve the security of the hardware identifier of the electronic device.

[0103] In some possible implementations of the embodiment of the present application, the application control device 300 provided in the embodiment of the present application may further include:

[0104] A fourth acquisition module, configured to acquire a key for encrypting the hardware identifier, the hardware identifier, the package name corresponding to the application, and the signature information of the application when the application requests the hardware identifier of the electronic device and the application is an application in the application whitelist;

[0105] A second generation module, configured to generate a third identifier using the trusted execution environment according to the key, the hardware identifier, the package name, and the signature information;

[0106] A third feedback module, configured to feed back the third identifier to the application.

[0107] In an embodiment of the present application, when an application is an application in the application whitelist, by feeding back a permanent identifier to the application during the life cycle of the application and generating the permanent identifier using the hardware identifier of the electronic device in the trusted execution environment, it is possible to prevent the application from obtaining the hardware identifier of the electronic device and improve the security of the hardware identifier of the electronic device.

[0108] The control device of the application in the embodiment of the present application may be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other device other than the terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., or may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiment of the present application does not make a specific limitation.

[0109] The control device of the application program in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.

[0110] The control device of the application program provided in the embodiments of the present application can implement Figures 1 to 2 each process implemented by the control method embodiment of the application program. To avoid repetition, it will not be elaborated here.

[0111] Optionally, as Figure 4 shown, the embodiments of the present application further provide an electronic device 400, including a processor 401 and a memory 402. A program or instruction that can run on the processor 401 is stored on the memory 402. When the program or instruction is executed by the processor 401, each step of the control method embodiment of the application program provided in the embodiments of the present application is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.

[0112] Figure 5 is a schematic diagram of the hardware structure of the electronic device implementing the embodiments of the present application.

[0113] The electronic device 500 includes, but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510 and other components.

[0114] Those skilled in the art can understand that the electronic device 500 may further include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 510 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in

[0115] does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0116] In an embodiment of the present application, when an application calls a hardware interface, the data returned by the hardware interface is obtained; the first data type of the data that the hardware interface needs to return when the application declares to call the hardware interface is obtained; when the data type of the data returned by the hardware interface does not match the first data type, the application's call to the hardware interface is interrupted. In this way, it is possible to prevent the application from obtaining data that is not the data that the hardware interface needs to return when it declares to call the hardware interface, prevent the application from stealing user data, and improve the security of user data.

[0117] In some possible implementations of the embodiment of the present application, the processor 510 is further configured to:

[0118] When the data type of the data returned by the hardware interface matches the first data type, the data returned by the hardware interface is fed back to the application.

[0119] In an embodiment of the present application, when the data type of the data returned by the hardware interface when the application calls the hardware interface matches the data type of the data that the hardware interface needs to return when the application declares to call the hardware interface, by returning the data returned by the hardware interface when the application calls the hardware interface to the application, the normal operation of the application can be ensured.

[0120] In some possible implementations of the embodiment of the present application, the processor 510 is further configured to: determine whether the application's call to the hardware interface is reasonable according to the type of the application and the first data type; prohibit the application from calling the hardware interface when the application's call to the hardware interface is unreasonable; when the application's call to the hardware interface is reasonable, obtain the data returned by the hardware interface when the application calls the hardware interface.

[0121] In an embodiment of the present application, when the application's call to the hardware interface is unreasonable, by prohibiting the application from calling the hardware interface, it is possible to prevent the application from obtaining user data through the hardware interface and improve the security of user data.

[0122] In some possible implementations of the embodiment of the present application, the display unit 506 may be configured to:

[0123] When the application's call to the hardware interface is unreasonable, display a prompt message, where the prompt message is used to prompt that there is a risk of data theft in the application.

[0124] In an embodiment of the present application, when the application's call to the hardware interface is unreasonable, by displaying a prompt message, the user can obtain that there is a risk of data theft in the application.

[0125] In some possible implementations of the embodiment of the present application, the network module 502 may be configured to:

[0126] Send a first message to an application platform that provides an application, where the first message is used for the application platform to notify the developer of the application to modify the call of the hardware interface by the application.

[0127] In the embodiments of the present application, when an application calls a hardware interface unreasonably, by sending a message to the application platform that provides the game, which is used for the application platform to notify the developer of the application to modify the call of the hardware interface by the application, the application platform can notify the developer of the application to modify the call interface of the application to ensure the reasonableness of the application calling the hardware interface.

[0128] In some possible implementations of the embodiments of the present application, the processor 510 is further configured to:

[0129] In the case where an application requests the hardware identifier of the electronic device and the application is not an application in the application whitelist, obtain the key for encrypting the hardware identifier, the package name corresponding to the application, and the first identifier currently assigned to the process of the application; generate a second identifier using the trusted execution environment according to the key, the package name, and the first identifier; and feedback the second identifier to the application.

[0130] In the embodiments of the present application, when an application is not an application in the application whitelist, by feeding back a temporary identifier to the application during the life cycle of the application and generating the temporary identifier using the trusted execution environment, it is possible to prevent the application from obtaining the hardware identifier of the electronic device and improve the security of the hardware identifier of the electronic device.

[0131] In some possible implementations of the embodiments of the present application, the processor 510 is further configured to:

[0132] In the case where an application requests the hardware identifier of the electronic device and the application is an application in the application whitelist, obtain the key for encrypting the hardware identifier, the hardware identifier, the package name corresponding to the application, and the signature information of the application; generate a third identifier using the trusted execution environment according to the key, the hardware identifier, the package name, and the signature information; and feedback the third identifier to the application.

[0133] In the embodiments of the present application, when an application is an application in the application whitelist, by feeding back a permanent identifier to the application during the life cycle of the application and generating the permanent identifier using the hardware identifier of the electronic device in the trusted execution environment, it is possible to prevent the application from obtaining the hardware identifier of the electronic device and improve the security of the hardware identifier of the electronic device.

[0134] It should be understood that in the embodiments of the present application, the input unit 504 may include a Graphics Processing Unit (GPU) 5041 and a microphone 5042. The graphics processor 5041 processes the image data of static pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also referred to as a touch screen. The touch panel 5071 may include two parts, a touch detection device and a touch controller. The other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.

[0135] The memory 509 can be used to store software programs and various data. The memory 509 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory 509 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 509 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.

[0136] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor may not be integrated into the processor 510 either.

[0137] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the control method embodiment of the application program provided by the embodiment of the present application, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0138] Among them, the processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium. Examples of the computer-readable storage medium include non-transitory computer-readable media, such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.

[0139] The embodiment of the present application also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run a program or instruction to implement each process of the control method embodiment of the application program provided by the embodiment of the present application, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0140] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.

[0141] The embodiment of the present application also provides a computer program product. The program product is stored in a storage medium. The program product is executed by at least one processor to implement each process of the control method embodiment of the application program provided by the embodiment of the present application, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0142] It should be noted that in this text, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0143] From the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present application.

[0144] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Those of ordinary skill in the art, under the inspiration of the present application and without departing from the purpose of the present application and the scope protected by the claims, can also make many forms, all of which fall within the protection scope of the present application.

Claims

1. A method for controlling an application, characterized in that: The method comprises: Acquire the data returned by the hardware interface when the application calls the hardware interface; Acquire a first data type of data required to be returned by the hardware interface when calling the hardware interface as declared by the application program; In a case where the data type of the data returned by the hardware interface does not match the first data type, the application program is interrupted from calling the hardware interface.

2. The method according to claim 1, characterized in that The method further comprises: In a case where the data type of the data returned by the hardware interface matches the first data type, the data returned by the hardware interface is fed back to the application.

3. The method according to claim 1, characterized in that Before obtaining the data returned by the hardware interface when the application calls the hardware interface, the method further includes: Determining whether it is reasonable for the application to call the hardware interface according to the type of the application and the first data type; If it is unreasonable for the application to call the hardware interface, prohibiting the application from calling the hardware interface; The data returned by the hardware interface when the application program calls the hardware interface includes: When it is reasonable for the application to call the hardware interface, data returned by the hardware interface when the application calls the hardware interface is obtained.

4. The method according to claim 1, characterized in that The method further comprises: When the application requests the hardware identification of the electronic device and the application is not an application in the application whitelist, obtaining a key for encrypting the hardware identification, a package name corresponding to the application, and a first identification currently allocated to the process of the application; Generate a second identifier using a trusted execution environment according to the key, the package name, and the first identifier; Feedback the second identifier to the application.

5. The method according to claim 1, characterized in that The method further comprises: When the application requests the hardware identification of the electronic device and the application is an application in the application whitelist, obtaining a key for encrypting the hardware identification, the hardware identification, a package name corresponding to the application, and signature information of the application; Generate a third identifier using a trusted execution environment according to the key, the hardware identifier, the package name, and the signature information; The third identifier is fed back to the application.

6. A control device for an application, characterized in that: The device comprises: A first acquisition module, used for acquiring data returned by the hardware interface when the application program calls the hardware interface; A second acquisition module, used for acquiring a first data type of data required to be returned by the hardware interface when calling the hardware interface as declared by the application program; An interrupt module is used to interrupt the application program from calling the hardware interface when the data type of the data returned by the hardware interface does not match the first data type.

7. The device according to claim 6, characterized in that The device also includes: The first feedback module is configured to feed back the data returned by the hardware interface to the application program if the data type of the data returned by the hardware interface matches the first data type.

8. The device according to claim 6, characterized in that The device also includes: A first determination module is used to determine whether it is reasonable for the application to call the hardware interface according to the type of the application and the first data type; if it is unreasonable for the application to call the hardware interface, prohibit the application from calling the hardware interface; The first acquisition module is specifically used for: When it is reasonable for the application to call the hardware interface, data returned by the hardware interface when the application calls the hardware interface is obtained.

9. The device according to claim 6, characterized in that The device also includes: A third acquisition module is used to acquire a key used to encrypt the hardware identification, a package name corresponding to the application, and a first identification currently allocated to the process of the application when the application requests the hardware identification of the electronic device and the application is not an application in the application whitelist; A first generating module, configured to generate a second identifier by using a trusted execution environment according to the key, the package name and the first identifier; The second feedback module is used to feed back the second identifier to the application.

10. The device according to claim 6, characterized in that The device also includes: a fourth acquisition module, configured to acquire, when the application requests the hardware identification of the electronic device and the application is an application in the application whitelist, a key for encrypting the hardware identification, the hardware identification, a package name corresponding to the application, and signature information of the application; A second generating module, configured to generate a third identifier using a trusted execution environment according to the key, the hardware identifier, the package name and the signature information; The third feedback module is used to feed back the third identifier to the application.