A webpage access interception method and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2026-08-11
AI Technical Summary
当电子设备处于青少年模式,会限制用户的使用时段、时长、功能以及浏览内容等
[0010] In the first mode, the path for one application to access another application via WebView is cut off. Users can access the application by directly launching it. In this way, access to the application can be constrained by the healthy use of mobile phone policy, avoiding the failure of the healthy use of mobile phone control measures and effectively blocking access to the controlled application.
Smart Images

Figure CN122554849A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a method and electronic device for intercepting web page access. Background Technology
[0002] Many electronic devices have a "teenager mode," also known as a minor mode, child mode, or mode for children. When an electronic device is in teenager mode, it restricts the user's usage time, duration, functions, and browsing content.
[0003] Currently, some electronic devices have issues with the failure of youth mode control measures, and in some cases, users are able to successfully access web pages that are set to be inaccessible. Summary of the Invention
[0004] This application provides a method and electronic device for blocking web page access. When the electronic device is in youth mode, it can successfully block access to the controlled application.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0006] Firstly, a method for intercepting webpage access is provided, which includes:
[0007] When the electronic device is in a first mode (e.g., minor mode, youth mode), it displays a first interface of a first application. This first interface includes a first control, such as a WebView, which links to a first webpage of a second application, where the second application is set as a controlled application. After receiving a user's first action on the first control (e.g., a click), the electronic device issues a first prompt, such as displaying a first prompt message or playing a first prompt voice, to remind the user to prohibit access to the second application.
[0008] When the electronic device is in a second mode (e.g., normal mode), it displays a second interface of the first application. This second interface includes a second control, such as a WebView, which links to a first webpage of the second application. Optionally, the second interface and the first interface are the same user interface, and the second control and the first control are the same control. After receiving a second user action (e.g., a click) on the second control, the electronic device displays the first webpage.
[0009] In this method, when the electronic device is in the first mode, the access of the first application to the webpage of the second application through WebView is intercepted according to the preset strategy. When the electronic device exits the first mode (and enters the second mode), the access of the first application to the webpage of the second application through WebView can be successfully executed.
[0010] In the first mode, the path for one application to access another application via WebView is cut off. Users can access the application by directly launching it. In this way, access to the application can be constrained by the healthy use of mobile phone policy, avoiding the failure of the healthy use of mobile phone control measures and effectively blocking access to the controlled application.
[0011] In conjunction with the first aspect, in one possible implementation, after the electronic device receives the user's first operation on the first control, it determines that the first webpage does not belong to the preset whitelist; or, it determines that the second application is a controlled application; then it blocks access to the first webpage.
[0012] Specifically, if the first webpage is not on the preset whitelist, access to that webpage is blocked, meaning access to the first webpage is not executed. In this way, access to other webpages besides those on the whitelist is blocked, cutting off the path from one application to another's webpages. Users can access the second application directly by launching it, and access to the second application is constrained by the healthy mobile phone usage policy, thus more thoroughly solving the problem of ineffective healthy mobile phone usage control measures.
[0013] If the application on the first webpage is a controlled application, access to that webpage is blocked, meaning access to the first webpage is not executed. This cuts off the path to accessing controlled applications through WebView in other applications, effectively preventing the control measures for healthy mobile phone use from failing; while uncontrolled applications can still be accessed through WebView, making it more convenient for users.
[0014] In conjunction with the first aspect, in one possible implementation, in a first mode, the electronic device displays a desktop interface, which includes icons for a first application and a second application; if a third operation (e.g., a click operation) is received from the user on the icon of the first application, the electronic device displays a third interface for the first application; if a fourth operation (e.g., a click operation) is received from the user on the icon of the second application, a second prompt is issued to inform the user that the second application has been set to be disabled.
[0015] In this method, when the electronic device is in the first mode and the second application is disabled, the user cannot launch the second application via its icon; that is, the user cannot access the second application through the application icon on the desktop interface. In the first mode, the second application is disabled.
[0016] In conjunction with the first aspect, in one possible implementation, after receiving the user's first operation on the first control, the first application calls the WebView SDK component to access the URL of the first webpage; the WebView SDK component is loaded in the first application, that is, the first application calls the WebView SDK component within the application's process.
[0017] The WebView SDK components include a first cache and a first module. The first cache includes a first mode flag, which is used to mark whether the first mode is on or off. When the first mode flag indicates that the first mode is on, it means that the electronic device is in the first mode.
[0018] When the first mode flag is valid and the first mode flag indicates that the first mode is enabled, i.e. the electronic device is in the first mode, the first module blocks access to the first webpage.
[0019] In this method, a first mode flag is stored within the WebView SDK component. This allows the application that calls the WebView SDK component (the first application) to query whether the electronic device is in the first mode within the application process, avoiding the large system overhead caused by frequent cross-process queries from various applications, including WebView.
[0020] In conjunction with the first aspect, in one possible implementation, the electronic device includes a third application and a system service module. After the electronic device receives an operation from the user to set the electronic device to enter or exit the first mode, the third application updates the first mode configuration information according to the user's operation. The first mode configuration information is used to mark whether the first mode is enabled or disabled. When the first mode configuration information changes, the system service module marks the first mode flag as invalid.
[0021] When the first mode flag is valid, the first application can directly read the first mode flag to determine whether the electronic device is in the first mode, thus reducing cross-process interaction.
[0022] When the first mode flag becomes invalid, after the first application calls the webpage control SDK component to access the URL of the first webpage, the first module retrieves the first mode configuration information from the third application across processes. The first module also sets the first mode flag to be valid and updates the first mode flag according to the first mode configuration information.
[0023] During this process, whenever the configuration information for the first mode changes, the WebView SDK component reads the operating system database across processes and updates the first mode flag in the first cache based on the latest configuration information in the operating system database. When the configuration information for the first mode does not change, the WebView SDK component does not read the operating system database, meaning it does not need to read data across processes. When the first application accesses a webpage through WebView, the first mode flag is read within the first application's process, and the first mode flag is used to determine whether the electronic device is in the first mode.
[0024] Typically, users don't frequently operate electronic devices to enter or exit first mode, and the configuration information for first mode changes infrequently. However, when an electronic device is in first mode, third-party applications or system applications (such as the first application, which includes WebView) call WebView to access web pages more frequently. Each time a third-party application or system application calls WebView to access a web page, it reads the first mode flag within its own application process. It only reads the first mode configuration information and updates the first mode flag across processes when the first mode configuration information changes. This effectively reduces the number of cross-process communications, achieving low-cost web page access interception and reducing the performance overhead of application identification when interception is needed.
[0025] In conjunction with the first aspect, in one possible implementation, the application set to be controlled includes: an application set to be prohibited from use, or an application set to be used for a limited time and whose running time is greater than or equal to the limited time.
[0026] Secondly, an electronic device is provided, which has the function of implementing the method described in the first aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned function.
[0027] Thirdly, an electronic device is provided, comprising: a processor, a memory, and a display screen; the display screen is used to display a user interface, the memory is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory to cause the electronic device to perform the method as described in any of the possible embodiments of the first aspect above.
[0028] Fourthly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, enable the computer to perform the method described in any of the possible embodiments of the first aspect.
[0029] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, enables the computer to perform the method described in any of the possible embodiments of the first aspect above.
[0030] The technical effects of any of the possible implementations in the second to fifth aspects can be found in the technical effects of different implementations in the first aspect, and will not be repeated here. Attached Figure Description
[0031] Figure 1 A scenario illustrating the application of the webpage access interception method provided in this application embodiment. Figure 1 ;
[0032] Figure 2 A scenario illustrating the application of the webpage access interception method provided in this application embodiment. Figure 2 ;
[0033] Figure 3 A scenario illustrating the application of the webpage access interception method provided in this application embodiment. Figure 3 ;
[0034] Figure 4 A scenario illustrating the application of the webpage access interception method provided in this application embodiment. Figure 4 ;
[0035] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;
[0036] Figure 6 A schematic diagram of module interaction for a webpage access interception method provided in an embodiment of this application;
[0037] Figure 7 This is a schematic diagram of the structural composition of an electronic device provided in an embodiment of this application;
[0038] Figure 8 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0039] In the description of the embodiments of this application, the terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, "at least one" and "one or more" refer to one or more (including two). The term "and / or" is used to describe the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can indicate: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0040] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes direct connections and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0041] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0042] Users can configure their electronic devices to enter a minor mode, referred to as "first mode" in this application. When an electronic device enters first mode, the user can restrict the usage time of the electronic device, the runtime of applications, the functions allowed, and the content that can be viewed.
[0043] Taking a mobile phone as an example, for instance, such as Figure 1As shown, the phone displays a "Healthy Phone Use" interface 101, which includes a "Select Mode" option 102. Users can use the "Select Mode" option 102 to set whether the phone enters or exits underage mode. For example, if the "Select Mode" option 102 is set to "Underage Mode," the phone enters underage mode; if the "Select Mode" option 102 is set to "Normal Mode," the phone exits underage mode.
[0044] For example, when the "Select Mode" option 102 is set to "Minor Mode", the "Healthy Use of Mobile Phone" interface 101 also includes an "Available Duration" option 103, a "Rest Reminder" option 104, an "Application Limit" option 105, and a "Disuse Time" option 106. Users can set the allowed usage time of the mobile phone through the "Available Duration" option 103, and users can set the single continuous usage time of the mobile phone and the interval rest time through the "Rest Reminder" option 104.
[0045] In one example, in response to a user's action on the "App Limits" option 105 (e.g., a click), the phone displays the "App Limits" interface 107. Exemplarily, the "App Limits" interface 107 includes options for "App 1," "App 2," "App 3," "App 4," "App 5," "App 6," and "App 7," etc.; wherein, the "App 1" option includes the prompt "1 minute," indicating that App 1 is set to run for a maximum of 1 minute per day, meaning App 1 is set for time-limited use and its daily runtime is less than the limit (which can be set by the user); the "App 2" option includes the prompt "15 minutes," indicating that App 2 is set to run for a maximum of 15 minutes per day; and the "App 3" option includes the prompt "Always Allow," indicating that App 3 is set to have no runtime limit.
[0046] For example, in response to a user's action on option 108 of "App 5" (e.g., a click), the phone displays the "App 5" interface 109. The "App 5" interface 109 includes a "Limited Time Use" switch 1091, a "Always Allow" switch 1092, and a "Disable" switch 1093. The user can set the "Limited Time Use" switch 1091 to be on, setting the limited duration (maximum daily running time) for App 5; the user can set the "Always Allow" switch 1092 to be on, setting the running time of App 5 to be unlimited; the user can set the "Disable" switch 1093 to be on, setting App 5 to be disabled. Optionally, the "App 5" interface 109 also includes a "Cancel" control 1094 and an "OK" control 1095. The user can click the "Cancel" control 1094 to cancel the settings of each switch in the "App 5" interface 109, and the user can click the "OK" control 1095 to confirm the settings of each switch in the "App 5" interface 109. For example, as... Figure 1 As shown, the "Disable" switch 1093 is set to be on, and after receiving a user's click operation on the "OK" control 1095, application 5 is set to be disabled.
[0047] Once application 5 is set to be disabled, users are not allowed to access application 5. For example, such as... Figure 2 As shown, the mobile phone displays a desktop interface 201, which includes application icons for "Application 1", "Application 2", "Application 3", "Application 4", "Application 5", "Application 6", "Application 7", and "Application 8". Upon receiving a user action on the application icon 203 of "Application 5" (e.g., a click), the phone displays a prompt interface 204, which includes the message: "Application 5 has been disabled," indicating to the user that application 5 has been set to be disabled.
[0048] It should be noted that, Figure 1 and Figure 2 Taking the example of application 5 being set to be disabled (prohibited from running), in other examples, application 5 may be set to have limited usage time, for example, allowing 5 minutes of use per day. Application 5 will be disabled after its runtime exceeds or equals the limited time. For instance, when the runtime of application 5 is less than the limited time, the phone launches application 5 after receiving a user's click on the application icon 203; when the runtime of application 5 is greater than or equal to the limited time, the phone displays a prompt interface 204 after receiving a user's click on the application icon 203.
[0049] In this application embodiment, applications that are set to be prohibited from use, or applications that are set to be used for a limited time and whose running time is greater than or equal to the limited time, are collectively referred to as controlled applications.
[0050] In some scenarios, even after an electronic device enters first mode, the user can still access controlled applications through certain means. In one example, refer to... Figure 1 Application 5 is set to be disabled, while application 3 is set to always be allowed, meaning application 3 is set to run without time limit. For example, as shown... Figure 3 As shown, the mobile phone displays a desktop interface 201, which includes an application icon 202 for "Application 3". After receiving a user's operation on the application icon 202 for "Application 3" (such as a click operation), the mobile phone displays the "Application 3" interface 205, which is the user interface of Application 3.
[0051] In one example, the "Application 3" interface 205 includes an "Application 5" icon 206, which is a WebView (web page control) linked to Application 5. The WebView is used to embed web page displays within the application, show web pages within the application, and allow users to interact with the web page. For example, the "Application 5" icon 206 is used to embed the web page of Application 5 within Application 3. Exemplary examples include... Figure 3 As shown, after receiving a user's action on the "App 5" icon 206 (such as a click), the phone displays the "App 5" interface 207, which is the user interface for App 5. In this way, the user can access App 5 through App 3, rendering the control over App 5 in the underage mode ineffective.
[0052] This application provides a method for intercepting webpage access, such as... Figure 4 As shown, when the electronic device is in the first mode, application one is launched. This application one is not a controlled application. For example, application one is an application that is set to "always allowed", or application one is an application that is set to "limited use" and the application has been running for less than the limit time.
[0053] The first interface of Application 1 includes a WebView that links to Application 2. Application 2 is a controlled application; for example, Application 2 is an application set to "prohibited," or an application set to "limited use" with a runtime greater than or equal to the limited duration.
[0054] Upon receiving a user's action on the WebView (e.g., a click), application two is not launched. Optionally, upon receiving a user's action on the WebView (e.g., a click), the electronic device displays a first prompt message to instruct the user not to navigate to application two. For example, such as... Figure 4 As shown, the phone displays the "Application 3" interface 205, which includes the "Application 5" icon 206. In response to the user's click on the "Application 5" icon 206, the phone displays a prompt message interface 208, which includes the message: "Inter-application switching is disabled."
[0055] In one implementation, after the electronic device receives the user's operation on the WebView, if it determines that the electronic device is in the first mode, it will intercept the webpage access according to a preset strategy.
[0056] In one example, blocking webpage access according to a preset policy includes: if the webpage associated with the WebView is on a preset whitelist, access to the webpage is not blocked, and access is allowed. If the webpage associated with the WebView is not on the preset whitelist, access to the webpage is blocked, and access is not allowed. Optionally, if webpage access is blocked, the electronic device prompts the user to prohibit access to the webpage; for example, displaying a prompt message or playing a prompt voice. The whitelist includes at least one webpage identifier (e.g., a webpage address), such as system-associated webpages or carrier-related webpages. In this way, access to other webpages besides those on the whitelist is blocked, cutting off the path from one application to another. Users in underage mode can access applications by directly launching them, and their application access is constrained by the healthy use of mobile phones policy, effectively solving the problem of ineffective control measures for healthy mobile phone use.
[0057] In another example, blocking webpage access according to a preset strategy includes: if the webpage associated with the WebView is on a preset whitelist, access to the webpage is not blocked, i.e., access to the webpage is allowed. If the application associated with the WebView is a controlled application, access to the webpage is blocked, i.e., access to the webpage is not allowed. Optionally, the electronic device may issue a prompt to the user, such as displaying a prompt message or playing a prompt voice. The webpage and application do not necessarily have a one-to-one correspondence. This cuts off the path to accessing controlled applications through the WebView in other applications, effectively avoiding the failure of healthy mobile phone use control measures; while uncontrolled applications can still be accessed through the WebView, making it more convenient for users.
[0058] In some embodiments, after the electronic device exits the first mode, when the electronic device displays the first interface of application one, if it receives a user operation (e.g., a click operation) on the WebView in the first interface, it displays the user interface (web page) of application two, and application two is successfully launched. For example, refer to... Figure 3 The phone displays the "Application 3" interface 205, which includes the "Application 5" icon 206. In response to the user's click on the "Application 5" icon 206, the phone displays the "Application 5" interface 207.
[0059] The aforementioned electronic devices may include mobile phones, tablets, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), handheld computers, netbooks, smart home devices (such as smart TVs, smart screens, large screens, smart speakers, smart air conditioners, etc.), personal digital assistants (PDAs), wearable devices (such as smartwatches, smart bracelets, etc.), in-vehicle devices, virtual reality devices, etc., and this application embodiment does not impose any limitations on them.
[0060] Figure 5 This is a hardware structure diagram of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 130, a display screen 140, a communication module 150, a power supply module 160, a sensor module 170, etc. The sensor module 170 may include a pressure sensor, a touch sensor, etc.
[0061] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0062] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural network processing unit (NPU). Different processing units may be independent components or integrated into one or more processors. In some embodiments, electronic device 100 may also include one or more processors 110.
[0063] The controller is the nerve center and command center of the electronic device 100. It can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.
[0064] An operating system for the electronic device 100 can run on the application processor to manage the hardware and software resources of the electronic device 100. This includes managing and configuring memory, determining the priority of system resource allocation, controlling input and output devices, operating the network, managing the file system, and managing drivers. The operating system can also provide a user interface for interacting with the system. Various types of software can be installed within the operating system, such as drivers and applications (Apps).
[0065] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0066] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc.
[0067] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0068] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0069] Internal memory 130 can be used to store one or more computer programs, which include instructions. Processor 110 can execute the instructions stored in internal memory 130, thereby causing electronic device 100 to perform the methods provided in some embodiments of this application, as well as various applications and data management. Internal memory 130 may include a code storage area and a data storage area. The data storage area may store data created during the use of electronic device 100. In addition, internal memory 130 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc. In some embodiments, processor 110 can execute instructions stored in internal memory 130 and / or instructions stored in memory disposed in processor 110 to cause electronic device 100 to perform the methods provided in embodiments of this application, as well as other applications and data management.
[0070] Electronic device 100 implements display functions through a GPU, display screen 140, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 140 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0071] Display screen 140 is used to display images, videos, etc. Display screen 140 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 140, where N is a positive integer greater than 1.
[0072] In some embodiments, the display screen 140 is provided with a pressure sensor, a touch sensor, etc. The pressure sensor senses pressure signals and converts them into electrical signals. When a touch operation is applied to the display screen 140, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor. The electronic device 100 can also calculate the touch location based on the detection signal from the pressure sensor. The touch sensor, also called a "touch panel," can form a touchscreen with the display screen 140, also called a "touch screen." The touch sensor detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can also be provided through the display screen 140.
[0073] The communication module 150 can provide solutions for wireless communication applications on the electronic device 100, including cellular, Wi-Fi, Bluetooth, and wireless data transmission modules (e.g., 433MHz, 868MHz, 915MHz). The communication module 150 can be one or more devices integrating at least one communication processing module.
[0074] The power module 160 can be used to supply power to the various components included in the electronic device 100. In some embodiments, the power module 160 can be a battery, such as a rechargeable battery.
[0075] In this embodiment, the electronic device described above is an electronic device capable of running an operating system and installing applications. Optionally, the operating system running on the electronic device can be... system, system, Systems, etc.
[0076] For example, Figure 6 This illustration shows a module interaction diagram of the webpage access interception method provided in an embodiment of this application.
[0077] refer to Figure 6 The operating system of electronic device 100 has a settings application and a mobile phone health usage application package installed. Application packages (APKs), third-party applications, and system applications are all included. The operating system includes system service modules, which optimize system performance, provide core functions, and support stable system operation. Each application and system service module runs in an independent process. The operating system can also provide applications with a WebView (web page control) software development kit (SDK) component. Applications can load and call the WebView SDK component to access web pages. In one implementation, the WebView SDK component runs within the process of the third-party application or system application that calls the WebView SDK component.
[0078] In some embodiments, a user can configure the electronic device 100 to enter or exit a first mode. (See reference...) Figure 1 When the "Select Mode" option 102 is set to "Minor Mode", it means that the first mode is enabled and the electronic device 100 is in the first mode; when the "Select Mode" option 102 is set to a mode other than "Minor Mode", such as "Normal Mode" or "Adult Mode", it means that the first mode is disabled and the electronic device 100 is in the second mode, that is, it has exited the first mode.
[0079] The electronic device 100 can save the configuration information of the first mode, which includes whether the first mode is enabled or disabled; when the first mode is enabled, the electronic device enters the first mode; when the first mode is disabled, the electronic device exits the first mode.
[0080] In one implementation, when a user enters or exits the first mode through the user interface settings of the health usage mobile APK, the settings application updates the configuration information of the first mode stored in the operating system database according to the user's operation. For example, when the "Select Mode" option 102 is set to "Minor Mode", the configuration information of the first mode is recorded as the first mode is enabled; when the "Select Mode" option 102 is set to "Normal Mode", the configuration information of the first mode is recorded as the first mode is disabled.
[0081] In this way, when a third-party application or system application calls WebView to access a webpage, it can determine whether the electronic device is in the first mode based on the configuration information of the first mode. If it is determined that the electronic device is in the first mode, the webpage access behavior can be blocked according to the preset policy.
[0082] In one embodiment, the WebView SDK components include a ChildModeManager module and a Cache unit; the system service module includes a ChildModeManagerService and a Cache utility (HnPropertyInvalidateCacheUtils).
[0083] The cache unit stores the first mode flag. For example, a first mode flag of the first mode value indicates that the first mode is enabled, and a first mode flag of the second value indicates that the first mode is disabled. The minor mode management module can retrieve the configuration information of the first mode from the operating system database and update the first mode flag accordingly. In one example, if the configuration information of the first mode indicates that the first mode is enabled, the first mode flag is updated to the first value; if the configuration information of the first mode indicates that the first mode is disabled, the first mode flag is updated to the second value.
[0084] The WebView SDK components run within the process of third-party applications or system applications. These applications can read the first-mode flag, i.e., obtain the first-mode configuration information, within their own process. Third-party applications or system applications do not need to read the first-mode configuration information across processes.
[0085] In some embodiments, the first mode flag stored in the cache unit is updated according to the configuration information of the first mode. When the configuration information of the first mode changes, for example, from the first mode enabled to the first mode disabled or from the first mode disabled to the first mode enabled, the first mode flag in the cache unit is updated accordingly.
[0086] In one implementation, such as Figure 6 As shown, the minor mode management service monitors the operating system database. If it determines that the configuration information for the first mode in the operating system database has changed, the minor mode management service marks the first mode flag in the cache unit as invalid through the caching tool's mechanism. An invalid first mode flag indicates that the first mode flag is untrusted.
[0087] After the first mode flag expires, the minor mode management module of the WebView SDK component can read the latest configuration information of the first mode from the operating system database and update the first mode flag accordingly based on the configuration information of the first mode; after the first mode flag is updated, the first mode flag becomes valid.
[0088] In some embodiments, after the electronic device 100 receives a user's operation (e.g., a click) on the WebView in a third-party application or system application, the third-party application or system application invokes the WebView to access a webpage. The WebView accesses the URL of the webpage through the WebViewSDK component. In one example, the WebView invokes the URL of the webpage through the shouldOverrideUrlLoading interface provided by the WebView SDK component; in another example, the WebView invokes the URL of the webpage through the loadurl interface provided by the WebView SDK component.
[0089] In one implementation, the WebView SDK component's minor mode management module determines whether the first mode flag in the cache unit is valid.
[0090] When the first mode flag is valid, the minor mode management module retrieves the first mode flag from the cache. If the first mode is determined to be enabled based on the first mode flag (e.g., the first mode flag is a first value), the minor mode management service interface is invoked to intercept the webpage access according to a preset policy. In one example, if the preset policy determines to intercept the webpage access, the minor mode management service invokes the Healthy Use of the Mobile APK interface to intercept the webpage access. If the first mode is determined to be disabled based on the first mode flag (e.g., the first mode flag is a second value), the webpage access is allowed.
[0091] When the first mode flag becomes invalid, the WebView SDK component's minor mode management module reads the latest first mode configuration information from the operating system database. The minor mode management module then sets the first mode flag to be valid and updates it accordingly based on the configuration information. If the first mode is determined to be enabled based on the first mode flag (e.g., the first mode flag is set to the first value), the minor mode management module calls the minor mode management service's interface to intercept the webpage access according to a preset strategy. Understandably, the minor mode management module can also determine whether the first mode is enabled or disabled based on the configuration information. In one example, if the preset strategy determines to intercept the webpage access, the minor mode management service calls the Healthy Use of Mobile APK's interface to intercept the webpage access. If the first mode is determined to be disabled based on the first mode flag (e.g., the first mode flag is set to the second value), then the webpage access is allowed.
[0092] During this process, whenever the configuration information for the first mode changes, the WebView SDK component reads the operating system database across processes and updates the first mode flag in the cache unit based on the latest configuration information in the operating system database. When the configuration information for the first mode does not change, the WebView SDK component does not read the operating system database, meaning it does not need to read data across processes. When third-party applications or system applications access a webpage through WebView, they read the first mode flag in the cache unit within the application's process and determine whether it is in the first mode based on the first mode flag.
[0093] Typically, users do not frequently operate electronic devices to enter or exit the first mode, and the configuration information of the first mode changes infrequently. However, when the electronic device is in the first mode, third-party applications or system applications call WebView to access web pages more frequently. Compared to third-party applications or system applications reading the configuration information of the first mode from the operating system database every time they call WebView to access a web page, this embodiment stores the first mode flag in a cache unit. Each time a third-party application or system application calls WebView to access a web page, it reads the first mode flag within its application process. The first mode configuration information is read and the first mode flag is updated only when the configuration information of the first mode changes. This effectively reduces the frequency of cross-process communication, achieves web page access interception at low cost, and reduces the performance consumption of applications identifying whether to intercept.
[0094] It is understood that the electronic device provided in this application embodiment includes hardware structures and / or software modules corresponding to perform each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0095] This application embodiment can divide the above-described electronic device into functional modules based on the method example described above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0096] In one example, please refer to Figure 7 The diagram illustrates a possible structural schematic of the electronic device involved in the above embodiments. The electronic device 700 includes a processing unit 710, a storage unit 720, and a display unit 730.
[0097] The processing unit 710 is used to control and manage the operation of the electronic device 700. The storage unit 720 is used to store the program code and data of the electronic device 700. The processing unit 710 calls the program code stored in the storage unit 720 to execute the various steps in the above method embodiments. The display unit 730 is used to display the user interface of the electronic device 700.
[0098] Of course, the unit modules in the aforementioned electronic device 700 include, but are not limited to, the processing unit 710, the storage unit 720, and the display unit 730. For example, the electronic device 700 may also include a communication unit, a power supply unit, etc. The communication unit is used for communication between the electronic device 700 and other electronic devices. The power supply unit is used to supply power to the electronic device 700.
[0099] The processing unit 710 can be a processor or controller, such as a central processing unit (CPU), graphics processing unit (GPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The storage unit 720 can be a memory. The display unit 730 can be a display screen, etc.
[0100] For example, processing unit 710 is a processor (such as...) Figure 5 The processor 110 shown can be a memory (such as a storage unit 720). Figure 5 The internal memory 130 shown, and the display unit 730 can be a display screen (such as...). Figure 5 The display screen 140 shown is an example of an electronic device 700 provided in this application embodiment. Figure 5 The electronic device 100 shown above. The processor, memory, display screen, etc., can be connected together, for example, via a bus. The processor calls program code stored in the memory to execute the various steps in the above method embodiments.
[0101] This application also provides a chip system (e.g., a system-on-a-chip (SoC)). Figure 8 As shown, the chip system includes at least one processor 801 and at least one interface circuit 802. The processor 801 and the interface circuit 802 are interconnected via lines. For example, the interface circuit 802 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 802 can be used to send signals to other devices (e.g., the processor 801 or the touchscreen of an electronic device). Exemplarily, the interface circuit 802 can read instructions stored in the memory and send those instructions to the processor 801. When the instructions are executed by the processor 801, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete components, which are not specifically limited in this application embodiment.
[0102] This application also provides a computer-readable storage medium including computer instructions that, when executed on the electronic device, cause the electronic device to perform the various functions or steps described in the method embodiments.
[0103] This application also provides a computer program product that, when run on a computer, causes the computer to perform the functions or steps described in the above method embodiments.
[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0106] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for intercepting webpage access, characterized in that, Applied to an electronic device, the electronic device including a first mode and a second mode, the method includes: In the first mode, a first interface of a first application is displayed; the first interface includes a first control, which links to a first webpage of a second application, and the second application is set as the controlled application. After receiving the user's first operation on the first control, a first prompt is issued; the first prompt is used to remind the user to prohibit access to the second application; In the second mode, a second interface of the first application is displayed; the second interface includes a second control, which links to a first webpage of the second application. After receiving the user's second operation on the second control, the first webpage is displayed.
2. The method according to claim 1, characterized in that, After receiving the user's first operation on the first control, the method further includes: Determine that the first webpage does not belong to the preset whitelist; or, The second application was identified as a controlled application.
3. The method according to claim 1 or 2, characterized in that, The method further includes: In the first mode, a desktop interface is displayed; the desktop interface includes the icon of the first application and the icon of the second application. If a third operation is received from the user on the icon of the first application, the third interface of the first application is displayed; If a fourth action is received from the user on the icon of the second application, a second prompt is issued; the second prompt is used to inform the user that the second application has been set to be disabled.
4. The method according to any one of claims 1-3, characterized in that, After receiving the user's first operation on the first control, the method further includes: The first application calls the web page control software development kit (SDK) component to access the URL of the first web page; the web page control SDK component is loaded into the first application, and the web page control SDK component includes a first cache and a first module. The first cache includes a first mode flag, which is used to mark whether the first mode is enabled or disabled. When the first mode flag is valid and the first mode flag indicates that the first mode is enabled, the first module blocks access to the first webpage.
5. The method according to claim 4, characterized in that, The electronic device includes a third application and system service module, and the method further includes: The third application receives an operation from the user to set the electronic device to enter or exit the first mode, and updates the first mode configuration information, which is used to mark whether the first mode is turned on or off. When the configuration information of the first mode changes, the system service module marks the first mode flag as invalid.
6. The method according to claim 5, characterized in that, After the first application calls a webpage control software development kit (SDK) component to access the URL of the first webpage, the method further includes: When the first mode flag becomes invalid, the first module obtains the first mode configuration information from the third application.
7. The method according to claim 6, characterized in that, After the first module obtains the first mode configuration information from the third application, the method further includes: The first module sets the first mode flag to be valid and updates the first mode flag according to the first mode configuration information.
8. The method according to any one of claims 1-7, characterized in that, The applications set to be controlled include: applications set to be prohibited from use, or applications set to be used for a limited time and whose running time is greater than or equal to the limited time.
9. An electronic device, characterized in that, The device includes a memory, a processor, and a display screen; the display screen is used to display a user interface; the memory is coupled to the processor and is used to store computer program code, the computer program code including computer instructions; the processor invokes the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the method described in any one of claims 1-8.
11. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the method described in any one of claims 1-8.