Screen capture prevention method, device, computer equipment and storage medium

By monitoring and modifying the attribute data of the window, setting the target interface to prohibit screenshots, solving the problem of leaking user information through screenshots through screenshots, realizing the reinforcement of all window objects, comprehensively prevent screenshots, and avoid information leakage.

CN112417533BActive Publication Date: 2025-01-28JIANGSU PAYEGIS INFORMATION SECURITY TECH CO LTD +2

Patent Information

Application Number
CN202011348616.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-26
Publication Date
2025-01-28
Estimated Expiration
2040-11-26

AI Technical Summary

Technical Problem

The existing technology cannot completely prevent malicious programs from leaking user's privacy and security content through screenshots, especially malicious programs running in the background may record them on the user's privacy page, resulting in information leakage.

Method used

Whether the target method of the target interface is called, obtain the original window attribute data, and modify it according to the target data to obtain the target window attribute data, which is used to set the target interface to prohibit screenshots, and then display the target interface.

Benefits of technology

The screenshot of the screenshot of all window objects is reinforced, the reinforcement quality is improved, and the screenshot of the screen of the malicious program is comprehensively preventing the information leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112417533B_ABST
    Figure CN112417533B_ABST
Patent Text Reader

Abstract

The present application relates to an anti-screenshot method, device, computer equipment and storage medium. The method comprises: monitoring whether the target method of the target interface is called, and if the target method is monitored, obtaining the original window attribute data in the target method; modifying the original window attribute data according to the target data to obtain the target window attribute data. Since the target data is used to set the target interface as an interface that prohibits screenshots, the target interface is displayed according to the target window attribute data, and the anti-screenshot effect of all window objects is reinforced to improve the reinforcement quality, thereby preventing malicious programs from taking screenshots and completely preventing malicious programs from taking screenshots, thereby avoiding information leakage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and in particular to an anti-screenshot method, device, computer equipment and storage medium. Background Art

[0002] Mobile terminals have become one of the most commonly used consumer electronic products in people's daily lives. As people's demand for mobile terminals increases, mobile terminals have realized more and more functions. Among them, screenshot is a relatively important function of mobile terminals. Screenshot is to save screen elements such as desktop, window, dialog box, tab, etc. on the screen as a picture. However, when taking screenshots, especially when malicious programs running in the background take screenshots of some password input, personal privacy and other pages, the user's privacy content, security content, etc. may be recorded, causing the user's privacy content, security content, etc. to be leaked.

[0003] In traditional technologies, anti-screenshot operations are performed through monitoring programs, which monitor applications to capture, locate, and intercept screenshot actions. However, these monitoring programs rely on the malicious program using the screenshot method provided by the operating system, and some malicious programs may not use the screenshot method provided by the operating system. Therefore, preventing malicious programs from taking screenshots through these monitoring programs cannot completely prevent malicious programs from taking screenshots, thereby causing information leakage. Summary of the invention

[0004] Based on this, it is necessary to provide an anti-screenshot method, device, computer equipment and storage medium that can effectively prevent information leakage in response to the above technical problems.

[0005] A method for preventing screenshots, the method comprising:

[0006] Monitor whether a target method of a target interface is called, wherein the target method is a method for setting window properties to display the target interface;

[0007] If the target method is monitored, the original window attribute data in the target method is obtained;

[0008] Modify the original window attribute data according to the target data to obtain the target window attribute data, wherein the target data is used to set the target interface as an interface that prohibits screenshots;

[0009] The target interface is displayed according to the target window attribute data.

[0010] In one embodiment, the target data is security mark data; and the step of modifying the original window attribute data by using the target data to obtain the target window attribute data includes:

[0011] Adding a flag parameter to the parameter list of the original window attribute data;

[0012] The security mark data is set as the parameter value of the mark parameter to obtain the target window attribute data.

[0013] In one embodiment, displaying the target interface according to the target window attribute data includes:

[0014] Sending the target window attribute data to a window management service, the target window attribute data including at least one view;

[0015] The at least one view is displayed in the target interface according to the target window attribute data through the window management service.

[0016] In one embodiment, before monitoring whether the target method of the target interface is called, the method further includes:

[0017] The call to the window management object is intercepted based on the hook mechanism; the window management object is used to add each view required by the target interface to the window and generate the target interface.

[0018] In one embodiment, intercepting the call to the window management object based on the hook mechanism includes:

[0019] In the process of adding a view, a view adding method is called through the window management object, and a view property setting method is called;

[0020] Based on the hook mechanism, the view attribute setting method is intercepted from calling the window communication object to intercept the sending of the original window attribute data to the window management service.

[0021] In one embodiment, calling the view adding method and the view property setting method through the window management object includes:

[0022] The view adding method is called through the window management object, and the view property setting method is called through the window view connection link ViewRootImpl to draw the view in the window.

[0023] In one embodiment, intercepting the view attribute setting method calling the window communication object to intercept sending the original window attribute data to the window management service includes:

[0024] The view attribute setting method is intercepted to call the window communication object mWindowSession through the interface IWindowSession, so as to intercept the window display method addToDisplay to send the original window attribute data to the window management service.

[0025] A screen capture prevention device, comprising:

[0026] A method monitoring module, used to monitor whether a target method of a target interface is called, wherein the target method is a method for setting window properties to display the target interface;

[0027] A data acquisition module, if the target method is monitored, then acquires the original window attribute data in the target method;

[0028] A data modification module, used for modifying the original window attribute data according to target data to obtain target window attribute data, wherein the target data is used to set the target interface as an interface that prohibits screenshots;

[0029] An interface display module is used to display the target interface according to the target window attribute data.

[0030] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the method steps in the above embodiment when executing the computer program.

[0031] A computer-readable storage medium stores a computer program, which implements the method steps in the above embodiment when executed by a processor.

[0032] The above-mentioned anti-screenshot method, device, computer equipment and storage medium. The method includes: monitoring whether the target method of the target interface is called, if the target method is monitored, obtaining the original window attribute data in the target method; modifying the original window attribute data according to the target data to obtain the target window attribute data. Since the target data is used to set the target interface as an interface that prohibits screenshots, the target interface is displayed according to the target window attribute data, and the anti-screenshot effect of all window objects is reinforced to improve the reinforcement quality, thereby preventing malicious programs from taking screenshots and completely blocking malicious programs from taking screenshots, thereby avoiding information leakage. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a process of preventing screenshots in one embodiment;

[0034] Figure 2 is a flow chart of step S130 in one embodiment;

[0035] Figure 3a is a flow chart of step S140 in one embodiment;

[0036] Figure 3b A schematic diagram of a flow chart added to a view in an embodiment;

[0037] Figure 4 A schematic diagram of a process of preventing screenshots in one embodiment;

[0038] Figure 5 is a flow chart of step S410 in one embodiment;

[0039] Figure 6a A schematic diagram of a flowchart of an anti-screenshot method in another embodiment;

[0040] Figure 6b A schematic diagram of a flow chart of intercepting a communication object in another embodiment;

[0041] Figure 7 is a structural block diagram of an anti-screenshot device in an embodiment;

[0042] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0043] 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.

[0044] Screen capture is a relatively important function of mobile terminals. Screen capture is to save the screen elements such as desktop, window, dialog box, tab, etc. on the screen as a picture. However, when taking screenshots, especially when malicious programs running in the background take screenshots of some password input, personal privacy and other pages, the user's privacy content, security content, etc. may be recorded, causing the user's privacy content, security content, etc. to be leaked. The following examples illustrate two methods of preventing screenshots in related technologies:

[0045] On the one hand, the specific location is located to add the anti-screenshot code. The specific process includes: first, decompress the application installation package and then perform decompilation operations to obtain the source code, then locate the specific interface window and location to add the anti-screenshot code, and finally recompile, package, and publish. However, the positioning method has the problems of high difficulty and complexity in the coding process, poor performance in code complexity, code compatibility, and code running efficiency. For example, the file decompilation process is time-consuming, and the unpacking and packaging of the installation package will greatly limit the efficiency of anti-screenshot; the compatibility is relatively poor, and due to the limitations of different systems, different versions, and different page structures, the positioning methods may be different.

[0046] On the one hand, we can prevent screenshots by monitoring programs. Since the operating system does not have an interface for directly monitoring screenshot events and does not broadcast, we can only solve it through other monitoring methods. The more mainstream ideas are: refresh data; monitor changes in screenshot files in the screenshot directory; monitor changes in all resources to make judgments; monitor screenshot shortcut keys (due to the diversity of manufacturer-customized operating systems, different shortcut keys and third-party applications, monitoring screenshot shortcut keys is basically not feasible).

[0047] For example, in the Android system, by refreshing data in onPause(), when the device takes a screenshot, a screenshot animation effect is designed to remind the user that the screenshot has been taken successfully, so that the user can be aware of it. The Activity that is screenshotted here will run to the onPause() life cycle. Use FileObserver to monitor resource changes in a specific directory, and use this as a trigger condition to obtain the file path. Use ContentObserver to monitor changes in multimedia image library resources. When a new image file is generated on the terminal, a record is inserted into the image database through the MediaProvider class to facilitate image queries in the system's image library. ContentObserver can be used to receive image insertion events and obtain the URI of the inserted image.

[0048] However, the above methods still have the following problems: 1) Some applications do not set screenshot animations for screenshots, so they cannot be monitored and cause information leakage; 2) The default screenshot paths of different mobile phones may be different, which requires a lot of adaptation processing; 3) The event names triggered by screenshots on different mobile phones may be different, which requires a lot of testing and adaptation. 4) After monitoring the screenshot event, the image cannot be obtained immediately and needs to be delayed for a period of time.

[0049] Based on the above problems, this application proposes an anti-screenshot method, which monitors whether the target method of the target interface is called, and the target method is a method used to set window properties to display the target interface; if the target method is monitored, the original window property data in the target method is obtained; the original window property data is modified according to the target data to obtain the target window property data, and the target data is used to set the target interface to an interface that prohibits screenshots; the target interface is displayed according to the target window property data. The anti-screenshot effect of all window objects is reinforced to improve the reinforcement quality, thereby preventing malicious programs from taking screenshots and completely blocking malicious programs from taking screenshots, thereby avoiding information leakage.

[0050] In one embodiment, Figure 1 As shown, a method for preventing screenshots is provided, the method comprising the following steps:

[0051] S110, monitoring whether the target method of the target interface is called.

[0052] S120: If the target method is monitored, the original window attribute data in the target method is obtained.

[0053] Among them, the target method is a method for setting window properties to display the target interface. Window attribute data refers to the attribute data of the window set to display the target interface, such as the length, width, height, contrast, ratio and other attributes of each view to be displayed. Specifically, when the operating system opens an application, the operating system will open the corresponding activity component. Activity is a component that can contain a user interface, mainly used to interact with the user. An application can contain multiple activity components. In order to display the target interface, after the activity component is started, the operating system creates a window object, and the target method needs to be called during the window addition process. In order to prevent malicious programs from taking screenshots, this embodiment monitors the target method, so that all window objects can be protected, and the anti-screenshot of all window objects can be reinforced, thereby improving the reinforcement quality of anti-screenshot. The target method of the target interface is monitored, and the target method carries the original window attribute data, and the target interface displayed according to the original window attribute data may be screenshotted by malicious programs. Therefore, if the target method is monitored to be called, the target method is intercepted and the original window attribute data in the target method is obtained. It should be noted that the operating system can be Android system, IOS mobile operating system, MacOS operating system, Microsoft Windows operating system, etc.

[0054] S130. Modify the original window attribute data according to the target data to obtain target window attribute data.

[0055] S140, displaying a target interface according to the target window attribute data.

[0056] The target data is used to set the target interface as an interface that prohibits screenshots. Specifically, if the target interface is displayed using the original window attribute data, the target interface is vulnerable to attacks by malicious programs. Therefore, it is necessary to modify the original window attribute data using the target data with the attribute of prohibiting screenshots, obtain the target window attribute data, and use the target window attribute data to display the target interface, and the modified target window attribute data no longer allows the target interface to be screenshotted.

[0057] In the above-mentioned anti-screenshot method, by monitoring whether the target method of the target interface is called, if the target method is monitored, the original window attribute data in the target method is obtained; the original window attribute data is modified according to the target data to obtain the target window attribute data. Since the target data is used to set the target interface as an interface that prohibits screenshots, the target interface is displayed according to the target window attribute data, and the anti-screenshot effect of all window objects is reinforced to improve the reinforcement quality, thereby preventing malicious programs from taking screenshots and comprehensively preventing malicious programs from taking screenshots, thereby avoiding information leakage. Furthermore, the anti-screenshot method disclosed in this embodiment is relative to the reinforcement process of decompressing, decompiling, locating, recompiling, packaging, and republishing the installation package in the related art. The method disclosed in this application is based on the complete installation package of the application program. It realizes anti-screenshot reinforcement of the application installation package, which not only improves the efficiency of the anti-screenshot reinforcement work, but also further makes up for the compatibility of the related technology summary, and realizes compatibility between different terminal models and operating system versions.

[0058] In one embodiment, Figure 2 As shown, the target data is the security mark data. In step S130, the original window attribute data is modified by the target data to obtain the target window attribute data, including the following steps:

[0059] S210. Add a flag parameter to the parameter list of the original window attribute data.

[0060] S220: Set the security mark data as the parameter value of the mark parameter to obtain the target window attribute data.

[0061] Among them, the security mark data is used to mark that a certain window or a certain display interface is safe and screenshots are prohibited. Therefore, the security mark data is used as the target data to modify the original window attribute data. Specifically, the original window attribute data corresponds to a parameter list, and an additional parameter, namely the mark parameter, is added to the parameter list. The target data is used to assign a value to the mark parameter, and the security mark data is set to the parameter value of the mark parameter to obtain the target window attribute data. At this point, the modification of the original window attribute data is completed.

[0062] In this embodiment, by adding a flag parameter to the parameter list of the original window attribute data and setting the security flag data to the parameter value of the flag parameter, the target window attribute data is obtained, and the anti-screenshot reinforcement processing of the application installation package is realized, thereby improving the quality of the anti-screenshot reinforcement of the application in the operating system.

[0063] In one embodiment, Figure 3a As shown, in step S140, the target interface is displayed according to the target window attribute data, including:

[0064] S310: Send the target window attribute data to the window management service.

[0065] S320: Display at least one view in the target interface according to the target window attribute data through the window management service.

[0066] Among them, the target window attribute data includes at least one view. The window management service is mainly used to manage some states, attributes, view addition, view deletion, view update, window order, message collection and processing, etc. of the window. Specifically, since the transmission of the original window attribute data is intercepted, after the original window attribute data is modified to obtain the target window attribute data, in order to ensure the display of the target interface, the target window attribute data needs to be transmitted, and the target window attribute data is sent to the window management service. The target window attribute data includes at least one view, and the window management service can be used to add a view. Then, through the window management service, at least one view is displayed in the target interface according to the target window attribute data, for example, in layer order.

[0067] Exemplarily, the window management service calls the view (View) to add an implementation interface display. Figure 3b As shown, the view adding process needs to be implemented by the view adding addView() method of the window management object WindowManager. After the adding is completed, the interface is finally displayed on the terminal screen through a series of operations.

[0068] In this embodiment, the target window attribute data is sent to the window management service, and at least one view is displayed in the target interface according to the target window attribute data through the window management service, thereby ensuring that the terminal displays the target interface normally and the target interface is in an installation state that does not allow screenshots, thereby avoiding leakage of user information.

[0069] In one embodiment, Figure 4 As shown, before monitoring whether the target method of the target interface is called, the method further includes: S410, intercepting the call to the window management object based on the hook mechanism.

[0070] Among them, the window management object is used to add the views required by the target interface to the window and generate the target interface. The hook mechanism can be understood as intercepting and monitoring the transmission of events during the event transmission process, and integrating its own code with the system method. Specifically, in order to strengthen and upgrade the security of all windows based on the installation package, the window management object is intercepted based on the hook mechanism HOOK. Therefore, through global monitoring of the window management object WindowsManager, some target methods of the display interface are intercepted, and then the specific parameters carried by the target method are modified to achieve anti-screenshot.

[0071] In one embodiment, Figure 5 As shown, in step S410, the call to the window management object is intercepted based on the hook mechanism, including the following steps:

[0072] S510. In the process of adding a view, a view adding method is called through a window management object, and a view property setting method is called.

[0073] S520: Based on the hook mechanism, intercept the view attribute setting method calling the window communication object to intercept the original window attribute data sent to the window management service.

[0074] Among them, the window management service WindowManagerService communicates with the local service process. WindowManagerService is referred to as WMS, which is started by the system service SystemServer and is used to manage services related to windows. Specifically, in the process of adding a view (View), the main operation is completed by WindowManagerGlobal. WindowManagerGlobal is the specific implementation of the window management object WindowManager. It mainly completes the view addition work through its internal method view addition method addView, and addView continues to call the view attribute setting method setView. In order to intercept the use of original window attribute data to display the target interface, based on the hook mechanism HOOK, the view attribute setting method setView is intercepted to call the window communication object, thereby intercepting the original window attribute data sent to the window management service. For example, the communication object mWindowSession of IWindowSession (an instance of WindowManagerGlobal) is intercepted in the setView method, and then the original window attribute data is passed to the remote WindowManagerService by intercepting the window display method addToDisplay.

[0075] In one embodiment, the view adding method is called through the window management object, and the view property setting method is called, including: calling the view adding method through the window management object, calling the view property setting method through the window view connection link ViewRootImpl to draw the view in the window.

[0076] Among them, the window view connection link ViewRootImpl connects the window Window and the view View, and through the window view connection link ViewRootImpl, operations such as drawing the view can be completed. Specifically, the view adding method addView is called through the window management object WindowManager, and addView continues to call the view property setting method through the window view connection link ViewRootImpl, thereby connecting the window and the view, and then drawing the view in the window.

[0077] In one embodiment, the view property setting method is intercepted from calling the window communication object to intercept sending the original window property data to the window management service, including: intercepting the view property setting method from calling the window communication object mWindowSession through the interface IWindowSession to intercept the window display method addToDisplay from sending the original window property data to the window management service.

[0078] Among them, the type of the window communication object mWindowSession is the interface class IWindowSession, and mWindowSession is a Binder object. Specifically, the anti-screenshot solution in this embodiment mainly completes the interception of the interface IWindowSession, implements the HOOK of Binder communication, and intercepts several target methods including the view adding method addview, the window display method addToDisplay and other functions. Get the WindowManager.LayoutParams parameter in these methods. WindowManager.LayoutParams is a static inner class of the window management object WindowManager, which is used to manage the parameters of Window. There is a corresponding parameter list, so the parameter list is modified at the same time (add FLag parameter), and the security flag data (FLAG_SECURE value) is added. Finally, the global anti-screenshot function is realized.

[0079] In one embodiment, Figure 6a As shown, the present application discloses a method for preventing screenshots, which includes the following steps:

[0080] S602, in the process of adding a view, calling a view adding method through a window management object, and calling a view property setting method;

[0081] Specifically, the view adding method is called through the window management object, and the view property setting method is called through the window view connection link ViewRootImpl to draw the view in the window.

[0082] S604: Based on the hook mechanism, intercept the view attribute setting method calling the window communication object to intercept the original window attribute data sent to the window management service.

[0083] Among them, the type of mWindowSession is IWindowSession, which is an interface class, and mWindowSession is a binder object. Specifically, Figure 6b As shown, the intercepted view property setting method calls the window communication object mWindowSession through the interface IWindowSession to intercept the window display method addToDisplay and send the original window property data to the window management service.

[0084] S606, monitoring whether a target method of the target interface is called, where the target method is a method for setting window properties to display the target interface;

[0085] S608, if the target method is monitored, then the original window attribute data in the target method is obtained;

[0086] S610, adding a flag parameter to the parameter list of the original window attribute data;

[0087] S612: Set the security mark data as the parameter value of the mark parameter to obtain the target window attribute data.

[0088] S614, sending the target window attribute data to the window management service, where the target window attribute data includes at least one view;

[0089] S616: Display at least one view in the target interface according to the target window attribute data through the window management service.

[0090] It should be understood that, although the various steps in the above flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowchart may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0091] In one embodiment, Figure 7 As shown, a screen capture prevention device is provided, including: a method monitoring module 710, a data acquisition module 720, a data modification module 730 and an interface display module 740, wherein:

[0092] A method monitoring module 710 is used to monitor whether a target method of a target interface is called, where the target method is a method for setting window properties to display the target interface;

[0093] The data acquisition module 720 acquires the original window attribute data in the target method if the target method is monitored;

[0094] The data modification module 730 is used to modify the original window attribute data according to the target data to obtain the target window attribute data, wherein the target data is used to set the target interface as an interface that prohibits screenshots;

[0095] The interface display module 740 is used to display the target interface according to the target window attribute data.

[0096] In one embodiment, the target data is security mark data; the data modification module 730 is also used to add a mark parameter to the parameter list of the original window attribute data; the security mark data is set as the parameter value of the mark parameter to obtain the target window attribute data.

[0097] In one embodiment, the interface display module 740 is further used to send the target window attribute data to the window management service, and the target window attribute data includes at least one view; through the window management service, the at least one view is displayed in the target interface according to the target window attribute data.

[0098] In one embodiment, the device further comprises a window object calling module for intercepting calls to a window management object based on a hook mechanism; the window management object is used to add each view required by the target interface to the window and generate the target interface.

[0099] In one embodiment, the window object calling module is also used to call the view adding method and the view property setting method through the window management object during the process of adding a view; based on the hook mechanism, intercept the view property setting method from calling the window communication object to intercept the sending of the original window property data to the window management service.

[0100] In one embodiment, the window object calling module is further used to call the view adding method through the window management object, and call the view property setting method through the window view connection link ViewRootImpl to draw the view in the window.

[0101] In one embodiment, the window object calling module is further used to intercept the view attribute setting method from calling the window communication object mWindowSession through the interface IWindowSession, so as to intercept the window display method addToDisplay from sending the original window attribute data to the window management service.

[0102] For the specific definition of the anti-screenshot device, please refer to the definition of the anti-screenshot method above, which will not be repeated here. Each module in the above-mentioned anti-screenshot device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0103] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown. The computer device 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 computer device is used to provide computing and control capabilities. The memory of the computer device 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 computer device 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 preventing screenshots is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

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

[0105] In one embodiment, a computer device is 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 implemented:

[0106] Monitor whether a target method of a target interface is called, wherein the target method is a method for setting window properties to display the target interface; if the target method is monitored, obtain original window property data in the target method; modify the original window property data according to the target data to obtain target window property data, wherein the target data is used to set the target interface to an interface that prohibits screenshots; and display the target interface according to the target window property data.

[0107] In one embodiment, the target data is security mark data; when the processor executes the computer program, the following steps are also implemented: adding a mark parameter to the parameter list of the original window attribute data; setting the security mark data as the parameter value of the mark parameter to obtain the target window attribute data.

[0108] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0109] The target window attribute data is sent to a window management service, wherein the target window attribute data includes at least one view; and the at least one view is displayed in the target interface according to the target window attribute data through the window management service.

[0110] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0111] The call to the window management object is intercepted based on the hook mechanism; the window management object is used to add each view required by the target interface to the window and generate the target interface.

[0112] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0113] In the process of adding a view, the view adding method is called through the window management object, and the view attribute setting method is called; based on the hook mechanism, the view attribute setting method is intercepted from calling the window communication object to intercept the sending of the original window attribute data to the window management service.

[0114] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0115] The view adding method is called through the window management object, and the view property setting method is called through the window view connection link ViewRootImpl to draw the view in the window.

[0116] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0117] The view attribute setting method is intercepted to call the window communication object mWindowSession through the interface IWindowSession, so as to intercept the window display method addToDisplay to send the original window attribute data to the window management service.

[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are further implemented:

[0119] Monitor whether a target method of a target interface is called, wherein the target method is a method for setting window properties to display the target interface; if the target method is monitored, obtain original window property data in the target method; modify the original window property data according to the target data to obtain target window property data, wherein the target data is used to set the target interface to an interface that prohibits screenshots; and display the target interface according to the target window property data.

[0120] In one embodiment, the target data is security mark data; when the computer program is executed by the processor, the following steps are also implemented: adding a mark parameter to the parameter list of the original window attribute data; setting the security mark data as the parameter value of the mark parameter to obtain the target window attribute data.

[0121] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0122] The target window attribute data is sent to a window management service, wherein the target window attribute data includes at least one view; and the at least one view is displayed in the target interface according to the target window attribute data through the window management service.

[0123] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0124] The call to the window management object is intercepted based on the hook mechanism; the window management object is used to add each view required by the target interface to the window and generate the target interface.

[0125] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0126] In the process of adding a view, the view adding method is called through the window management object, and the view attribute setting method is called; based on the hook mechanism, the view attribute setting method is intercepted from calling the window communication object to intercept the sending of the original window attribute data to the window management service.

[0127] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0128] The view adding method is called through the window management object, and the view property setting method is called through the window view connection link ViewRootImpl to draw the view in the window.

[0129] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0130] The view attribute setting method is intercepted to call the window communication object mWindowSession through the interface IWindowSession, so as to intercept the window display method addToDisplay to send the original window attribute data to the window management service.

[0131] 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).

[0132] 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.

[0133] 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 preventing screenshots, characterized in that: The method comprises: Monitor whether a target method of a target interface is called; the target method is a method for setting window properties to display the target interface; wherein, when an operating system starts an application, the operating system opens a corresponding activity component, and after the activity component is started, the operating system creates a window object, and the target method is called during the process of adding the window; If the target method is monitored, intercept the target method and obtain the original window attribute data in the target method; Modify the original window attribute data according to the target data to obtain the target window attribute data, wherein the target data is used to set the target interface as an interface that prohibits screenshots; The target interface is displayed according to the target window attribute data.

2. The method according to claim 1, characterized in that The target data is safety mark data; The step of modifying the original window attribute data according to the target data to obtain the target window attribute data includes: Adding a flag parameter to the parameter list of the original window attribute data; The security mark data is set as the parameter value of the mark parameter to obtain the target window attribute data.

3. The method according to claim 1, characterized in that The displaying of the target interface according to the target window attribute data includes: Sending the target window attribute data to a window management service; the target window attribute data includes at least one view; The at least one view is displayed in the target interface according to the target window attribute data through the window management service.

4. The method according to any one of claims 1 to 3, characterized in that: Before monitoring whether the target method of the target interface is called, the method further includes: The call to the window management object is intercepted based on the hook mechanism; the window management object is used to add each view required by the target interface to the window and generate the target interface.

5. The method according to claim 4, characterized in that The method of intercepting the call to the window management object based on the hook mechanism includes: In the process of adding a view, a view adding method is called through the window management object, and a view property setting method is called; Based on the hook mechanism, the view attribute setting method is intercepted from calling the window communication object to intercept the sending of the original window attribute data to the window management service.

6. The method according to claim 5, characterized in that The calling of the view adding method through the window management object and the calling of the view property setting method include: The view adding method is called through the window management object, and the view property setting method is called through the window view connection link ViewRootImpl to draw the view in the window.

7. The method according to claim 5, characterized in that The method of intercepting the view attribute setting method and calling the window communication object to intercept the sending of the original window attribute data to the window management service includes: The view attribute setting method is intercepted to call the window communication object mWindowSession through the interface IWindowSession, so as to intercept the window display method addToDisplay to send the original window attribute data to the window management service.

8. A screen capture prevention device, characterized in that: The device comprises: A method monitoring module is used to monitor whether a target method of a target interface is called, wherein the target method is a method for setting window properties to display the target interface; wherein when an operating system starts an application, the operating system opens a corresponding activity component, and after the activity component is started, the operating system creates a window object, and the target method is called during the process of adding a window; A data acquisition module, if the target method is monitored, intercepts the target method and acquires the original window attribute data in the target method; A data modification module, used for modifying the original window attribute data according to target data to obtain target window attribute data, wherein the target data is used to set the target interface as an interface that prohibits screenshots; The interface display module is used to display the target interface according to the target window attribute data.

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

10. A computer-readable storage medium having a computer program stored thereon, 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 7 are implemented.

Citation Information

Patent Citations

  • Screen capture prevention method based on program windows

    CN104077539A

  • Screenshot processing method and device and electronic equipment

    CN106201468A

  • Method for preventing screen capture under Linux system and computer readable storage medium

    CN111796989A

Cited By

  • Anti-screenshot extension protocol implementation system based on X framework

    CN115373878A

  • Safe anti-screenshot system in Wayland environment

    CN115544497A