Mode switching method and related device
By implementing pattern switching methods and pattern tag recognition technology in the application, the problem of complex and costly design of teenagers in the existing technology is solved, and automatically recognize and block content that is not suitable for teenagers to watch is realized, reducing the development workload and cost.
Patent Information
- Application Number
- CN202310973316.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-02-14
AI Technical Summary
When setting up adolescent mode for applications, the prior art requires individual design of content sources and interface layouts, resulting in large development workloads and high costs.
By implementing the mode switching method in the application, using the mode tag to identify and block interface elements that need to be hidden, avoiding setting different content sources and interface layouts in different usage modes.
After switching to the teenager mode, it realizes that content that is not suitable for teenagers to watch automatically, without setting different content sources and interface layouts for different modes, reducing development workload and cost.
Smart Images

Figure CN119440354A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a mode switching method and related devices. Background Art
[0002] With the continuous development of electronic technology, electronic devices are becoming increasingly closely connected with daily life, and children and teenagers are coming into contact with electronic devices more and more frequently.
[0003] In order to protect the physical and mental health of children and teenagers, application software (also called applications) can be set with a youth mode to provide different content for users in youth mode to prevent users in youth mode from being exposed to content that is not suitable for teenagers to watch in the application.
[0004] However, the above method requires the application to set up a separate content source and interface layout for the youth mode, which requires a large amount of development work and high cost. Summary of the invention
[0005] The present application provides a mode switching method and related devices, which realize identifying and shielding the elements that need to be shielded in the mode after the mode is switched.
[0006] In a first aspect, the present application provides a mode switching method, which is applied to an electronic device, and the mode switching method includes: when the first application is in a first mode, receiving a first operation for the first application; in response to the first operation, displaying a first interface of the first application based on a first file, the first interface including a first element; the first file includes a first code segment corresponding to the first element, and the first code segment is used to indicate a content source of the first element; after the first application switches from the first mode to the second mode, when it is determined according to a second file of the first interface that the first element includes shielded content, shielding the display of the first element in the first interface; the second file includes a second code segment corresponding to the first element, the second code segment includes the first code segment and a first tag, and the first tag is used to indicate that the electronic device recognizes whether the first element includes shielded content.
[0007] In this way, after switching to the second mode, the electronic device can shield and display the first element that needs to be shielded in the second mode.
[0008] In one possible implementation, determining that the first element includes shielded content based on the second file of the first interface specifically includes: when the electronic device executes the first tag in the second code segment, obtaining the content source of the first element from the first code segment in the second code segment; obtaining the content of the first element based on the content source of the first element; and calling the first recognition algorithm to determine that the content of the first element includes shielded content.
[0009] In this way, whether to identify the content of the first element can be determined by judging whether the second code segment includes the first tag.
[0010] In one possible implementation, before determining that the first element includes shielded content based on the second file of the first interface, the method also includes: obtaining a class corresponding to the first element based on the first code segment; determining that the class corresponding to the first element belongs to a first predetermined class; and performing instrumentation on the first code segment to insert the first tag into the first code segment to obtain a second code segment.
[0011] In this way, the second code segment can be obtained by means of instrumentation.
[0012] In one possible implementation, before determining that the first element includes shielded content based on the second file of the first interface, the method also includes: obtaining a class corresponding to the first element based on the first code segment; determining that the class corresponding to the first element belongs to a first predetermined class; and encapsulating the first code segment from the first format into a second code segment in a second format.
[0013] In this way, the second code segment can be obtained by encapsulation.
[0014] In one possible implementation, the first interface also includes a second element, and the first file also includes a third code segment corresponding to the second element; the second file also includes a fourth code segment corresponding to the second element, and the fourth code segment includes the third code segment and the first label; after the first application switches from the first mode to the second mode, when it is determined according to the second file of the first interface that the second element does not include blocked content, the second element is displayed in the first interface.
[0015] In this way, when it is determined that the second element does not include shielded content, the second element may be displayed after switching to the second mode.
[0016] In one possible implementation, the first interface also includes a third element, and the first file also includes a fifth code segment corresponding to the third element; the second file also includes a sixth code segment corresponding to the third element, and the sixth code segment does not include the first tag; after the first application switches from the first mode to the second mode, the first element is displayed in the first interface according to the second file.
[0017] In this way, since the sixth code segment corresponding to the third element in the second file does not include the first tag, there is no need to perform content identification on the third element.
[0018] In a possible implementation manner, shielding the display of the first element in the first interface specifically includes: displaying an overlay layer on the first element of the first interface.
[0019] In this way, the first element can be shielded by displaying an overlay layer on the first element.
[0020] In a possible implementation manner, shielding the first element from being displayed in the first interface specifically includes: not displaying the first element in the first interface.
[0021] In this way, the first element can be shielded by not displaying the first element.
[0022] In a possible implementation, the first application switches from the first mode to the second mode, specifically including: detecting a second operation of the user switching the first application from the first mode to the second mode; and switching the first application from the first mode to the second mode in response to the second operation.
[0023] In this way, the usage mode of the application can be switched in response to a manual operation by the user.
[0024] In a possible implementation, the first application switches from the first mode to the second mode, specifically including: detecting that the current moment belongs to a time period of the preset second mode, and switching the first application from the first mode to the second mode.
[0025] In this way, the usage mode of the application can also be switched based on the preset mode switching time.
[0026] In one possible implementation, the first interface also includes a fourth element; the first file includes a seventh code segment corresponding to the fourth element, the second file includes an eighth code segment corresponding to the fourth element, and the eighth code segment does not include the first tag; the method also includes: before the first application switches from the first mode to the second mode, displaying a first configuration interface of the first application, the first configuration interface including all elements in the first interface; receiving an operation by the user to block the fourth element; after the first application switches from the first mode to the second mode, blocking the display of the fourth element in the first interface.
[0027] In this way, in response to the user's operation of shielding the fourth element, after switching to the second mode, the fourth element can be shielded from display.
[0028] In a possible implementation, the first configuration interface also includes a first level identifier of the first element and a second level identifier of the fourth element; the first level identifier is used to indicate a security level of the first element, and the second level identifier is used to indicate a security level of the third element.
[0029] In this way, the security levels of different elements in the user interface can be indicated by level labels, making it easier for users to select elements to be blocked.
[0030] In a possible implementation, before displaying the first configuration interface, the method further includes: determining that the first level identification is safe according to the first tag in the second code segment; and calling a second recognition algorithm to determine the second level identification when the eighth code segment does not include the first tag.
[0031] In this way, the elements corresponding to the code segment that does not include the first tag can be identified and the security levels of these elements can be determined.
[0032] In one possible implementation, the second mode is a youth mode or a child mode.
[0033] In a second aspect, the present application provides an electronic device, comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the mode switching method in any possible implementation of any of the above aspects.
[0034] In a third aspect, an embodiment of the present application provides a computer storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a mode switching method in any possible implementation of any of the above aspects.
[0035] In a fourth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the mode switching method in any possible implementation of any of the above aspects.
[0036] The beneficial effects of the second to fourth aspects may refer to the beneficial effects of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application;
[0038] FIG. 2A to FIG. 2D A schematic diagram of changes in an application interface before and after enabling the youth mode provided in an embodiment of the present application;
[0039] FIG. 3A to FIG. 3H A schematic diagram of changes in an application interface before and after switching a usage mode provided in an embodiment of the present application;
[0040] FIG. 4A to FIG. 4G A schematic diagram of an interface for setting an interception element mode based on user operation provided in an embodiment of the present application;
[0041] FIG. 4H to FIG. 4L A schematic diagram of changes in an application interface before and after switching a usage mode provided in an embodiment of the present application;
[0042] FIG. 5A to FIG. 5HA schematic diagram of the arrangement change of interface elements before and after switching the usage mode when the interface elements provided in the embodiment of the present application are set to different layouts;
[0043] Fig. 6A A schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;
[0044] Figure 6B A schematic diagram for comparing different files corresponding to application 1 in different usage modes provided in an embodiment of the present application;
[0045] Figure 6C A schematic diagram of packaging different types of interface elements provided in an embodiment of the present application;
[0046] Figure 7 A schematic flow chart of a method for obtaining a code segment B1 of an interface element 1 in a file 2 based on a code segment A1 of an interface element 1 in a file 1 provided in an embodiment of the present application;
[0047] Figure 8 A flowchart of a method provided in an embodiment of the present application for determining whether to shield the interface element 1 after the application 1 switches from mode 1 to mode 2 when the interface element 1 is a picture control;
[0048] Fig. 9 A flowchart of a method provided in an embodiment of the present application for determining whether to shield the interface element 1 after the application 1 switches from mode 1 to mode 2 when the interface element 1 is a web page view control;
[0049] Fig. 10A A flowchart of a method for setting an interception element provided in an embodiment of the present application;
[0050] Fig. 10B A flowchart of a method for switching modes performed by an electronic device 100 after a user sets an interception element for an application 1 in mode 2 is provided in an embodiment of the present application;
[0051] Fig.11 A schematic flow chart of a method for determining the security level of an interface element provided in an embodiment of the present application;
[0052] Fig. 12A A flowchart of a method for setting an interception element provided in an embodiment of the present application;
[0053] Fig. 12B A flowchart of a method for switching modes performed by the electronic device 100 after the user sets an interception element for the application 1 in mode 2 provided in an embodiment of the present application;
[0054] Fig.13A schematic diagram of functional modules of an electronic device 100 provided in an embodiment of the present application;
[0055] Fig.14 A flowchart of a mode switching method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0057] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0058] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0059] The terms involved in the embodiments of the present application are introduced below.
[0060] The user interface is composed of views. Views can include base views and view groups. The base view is a control that can be displayed independently, such as an image control (imageview), a text control (TextView), a video control (videoview), a button (Button), etc. The above-mentioned imageview, textview, etc. can all be called subclasses of view. In the embodiments of the present application, the above-mentioned subclasses of view can also be called classes corresponding to interface elements.
[0061] Interface elements: Elements displayed on the interface are collectively referred to as interface elements, including but not limited to controls (such as image controls, text controls, web view controls, video controls, etc.), search bars, menu bars, etc.
[0062] Interface layout: The layout of an interface includes the arrangement of all interface elements in the interface and the display position of each interface element. The layout of an interface can be achieved by setting the layout of each interface element in the interface.
[0063] Layout of interface elements: In the interface, the layout of interface elements can be set by the developer. The layout of interface elements can include the following three types: linear layout, relative layout and frame layout. Among them:
[0064] Linear layout is to arrange multiple interface elements in the interface horizontally or vertically. When two or more interface elements in the interface are set to linear layout, the two or more interface elements are arranged horizontally or vertically in the interface. The schematic diagram of multiple interface elements arranged in linear layout can be referred to as follows Figure 5A The embodiment shown.
[0065] Relative layout is a layout method that uses another interface element as a reference to determine the position of an interface element in the interface. The schematic diagram of multiple interface elements arranged in relative layout can be referred to as follows Figure 5C The embodiment shown.
[0066] The frame layout can divide an area in the display screen or interface by setting coordinates, and display the interface elements to be added in the area, and the subsequently added controls will cover the previous ones. The schematic diagram of multiple interface elements arranged in a frame layout can be referred to as follows Figure 5E The embodiment shown.
[0067] Figure 1 A schematic diagram of the hardware structure of the electronic device 100 is shown.
[0068] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.
[0069] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, and a display screen 194. The sensor module 180 may include a touch sensor 180K. Optionally, the sensor module 180 may also include one or more sensors, such as a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0070] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0071] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0072] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0073] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. In some embodiments, the processor 110 may also include one or more interfaces.
[0074] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0075] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display screen 194, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0076] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0077] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0078] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0079] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0080] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0081] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0082] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0083] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), and the display panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0084] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0085] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0086] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data, etc.
[0087] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0088] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0089] The electronic device 100 can implement audio functions through the audio module 170 and the application processor, such as music playing, recording, etc. The audio module 170 may include any one or more of the following: a speaker 170A, a receiver 170B, a microphone 170C, and an earphone interface 170D.
[0090] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0091] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0092] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0093] FIG. 2A to FIG. 2D A schematic diagram showing the changes in the application interface before and after the youth mode is enabled.
[0094] like Figure 2AAs shown, the electronic device 100 may display a video application interface 200, which may include a search bar 201, a menu control 202, an option bar 203, and one or more video controls, such as a video control 204, a video control 205, a video control 206, a video control 207, and a video control 208. Each video control may display a cover image and a video title, and the video control may be used to trigger the electronic device 100 to play a corresponding video file. Moreover, the video files corresponding to the one or more video controls include entertainment videos.
[0095] The electronic device 100 can receive and respond to a user's click operation on the menu control 202, such as Figure 2B As shown, a menu bar 210 is displayed on the video application interface 200 .
[0096] like Figure 2B As shown, the menu bar 210 may include one or more items, such as a setting item, a night mode item, and a child / teen mode item 211. The child / teen mode item 211 may also display the text "Not Enabled" to prompt the user that the child / teen mode is not currently enabled.
[0097] The electronic device 100 can receive and respond to the user's click operation for the child / teen mode by displaying Figure 2C Mode selection interface 220 is shown.
[0098] like Figure 2C As shown, the mode selection interface 220 may include one or more mode controls, such as a child mode control 221 and a youth mode control 222. The mode control may be used to trigger the electronic device 100 to enable a corresponding mode.
[0099] The electronic device 100 can receive and respond to a user's click operation on the youth mode control 222, such as Figure 2D As shown, a teen mode interface 230 of a video application is displayed.
[0100] like Figure 2D As shown, the youth mode interface 230 of the video application may include a menu control 231 and one or more video controls. The video files corresponding to the one or more video controls are all learning videos. Figure 2A and Figure 2DIt can be seen that the interface elements in the teen mode interface 230 are different from the interface elements in the video application interface 200. For example, the teen mode interface 230 does not include a search bar and an option bar, etc. Moreover, the layout of the teen mode interface 230 is also different from the layout of the video application interface 200. In addition, the video files corresponding to one or more video controls in the teen mode interface 230 are also different from the video files corresponding to one or more video controls in the video application interface 200.
[0101] In this way, by enabling the youth mode, young users can be prevented from being exposed to bad information or excessive entertainment information, which is conducive to the healthy growth of young people.
[0102] However, using the above method, the application developer needs to design the interface layout and content source of the youth mode for the application separately, which is labor-intensive and costly.
[0103] The present application provides a mode switching method, in which the electronic device 100 can display the interface (including the first interface element) of the first application based on the first file of the first application when the usage mode of the first application is the first mode. The first file includes the first code segment of the first interface element. When the electronic device 100 detects the operation of switching the usage mode of the first application from the first mode to the second mode, the second file of the first application in the second mode can be obtained, and the second file includes the second code segment of the first interface element. The second code segment includes a mode tag. When the electronic device 100 displays the interface of the first application based on the second file, it can determine to identify the content of the first interface element based on the mode tag in the second code segment, and determine whether the first interface element needs to be shielded in the second mode. If it is determined that the first interface element needs to be shielded, the interface of the first application displayed by the electronic device 100 based on the second file does not include the first interface element; if it is determined that the first interface element does not need to be shielded, the interface of the first application displayed by the electronic device 100 based on the second file includes the first interface element.
[0104] By adopting the mode switching method provided in the embodiment of the present application, when the use mode of the application is switched to the second mode, the electronic device 100 can perform content recognition on the interface element corresponding to the code segment including the mode tag to determine whether to display the interface element in the second mode. In this way, interface elements that are not suitable for display in the current use mode can also be identified and shielded, without the need to set different content sources for different use modes of the application, nor the need to set different interface layouts for different use modes of the application, etc., with small development workload, low cost, and applicable to all applications.
[0105] In some application scenarios, when the usage mode of application 1 is mode 1 (for example, the youth mode is not enabled), the electronic device 100 may display interface 1 of application 1, and interface 1 includes interface element 1 and interface element 2. After the electronic device 100 switches the usage mode of application 1 from mode 1 to mode 2 (for example, the youth mode), the electronic device 100 may display interface 2 of application 1, and interface 2 may include interface element 2, but does not include interface element 1 (or interface element 1 is coded). Among them, interface 2 is interface 1 in mode 2, and interface element 1 is a shielded element (i.e., a disabled element) in mode 2.
[0106] In this way, after switching the usage mode of application 1, the electronic device 100 can display the definitely shielded elements in the current usage mode with coding, or not display them, to prevent the user from using the shielded elements in the current usage mode.
[0107] For example, after the electronic device 100 enables the youth mode in the video application, the video application interface can be changed from the above Figure 2A The video application interface 200 shown switches to Figure 3A The youth video interface 240 shown includes one or more layers for coding the shielded elements in the youth mode.
[0108] like Figure 3A As shown, the youth video interface 240 may include a search bar 201, a menu control 202, an option bar 203, and one or more video controls, such as video control 204, video control 205, video control 206, video control 207, and video control 208. Moreover, the interface elements in the youth video interface 240 may be kept consistent with the Figure 2A The youth video interface 240 is different from the video application interface 200 in that one or more video controls in the youth video interface 240 are covered with a layer (such as a mosaic layer, etc.), and these coded video controls are disabled in the youth mode. Figure 2A It can be seen that the video file corresponding to the video control 205 is an entertainment video, and the video files corresponding to the video controls 207 and 208 are both game videos. The above three video controls are all determined to be disabled in the youth mode. Figure 3A In the youth video interface 240 shown, a layer 241 may be overlaid and displayed on the video control 205 , a layer 242 may be overlaid and displayed on the video control 207 , and a layer 243 may be overlaid and displayed on the video control 208 .
[0109] In some other embodiments, after the electronic device 100 enables the youth mode for the video application, the video application interface can be changed from the above Figure 2A The video application interface 200 shown switches to Figure 3B Teen video interface 250 is shown, which does not include masking elements in teen mode.
[0110] like Figure 3B As shown, the teen video interface 250 may include a search bar 201, a menu control 202, an options bar 203, and one or more video controls, such as video control 204, video control 206, video control 251, video control 252, and video control 253. Furthermore, the interface elements in the teen video interface 240 may be kept consistent with the Figure 2A The same layout of interface elements in the video application interface 200 shown in FIG. Figure 2A One or more of the video controls in the illustrated embodiment are not identical, i.e., the youth video interface 250 includes non-disabled video controls (e.g., video control 204 and video control 206) but does not include disabled video controls (e.g., Figure 2A 205, video control 207, and video control 208, etc.). Optionally, Figure 3A The display position of the video control 206 can be Figure 2A The display position of the video control 205 in the video application interface 200 shown, that is, after the youth mode is enabled, when the video control 205 is not displayed, the video controls located to the right or below the video control 205 can be filled in turn.
[0111] As another example, before the youth mode is enabled, the electronic device 100 may receive and respond to the user's operation of opening a social application, displaying a Figure 3C The social application interface 300 shown. The social application interface 300 may include an option bar 301, a bottom control bar 306, and one or more picture controls, such as picture control 302, picture control 303, picture control 304, and picture control 305. Each picture control may display a picture and may be used to trigger the electronic device 100 to display a graphic interface corresponding to the picture control.
[0112] The electronic device 100 can receive and respond to the user's click operation on the picture control 304, displaying the following Figure 3D The graphic interface 310 is shown.
[0113] like Figure 3DAs shown, the graphic interface 310 may include graphic content 311 and one or more comments, such as comment A posted by user 1, comment B posted by user 2, and comment C posted by user 3, etc. Among them, comment C includes content that is not suitable for teenagers to read (such as dirty words, web page hyperlinks, advertisements that induce consumption, etc.).
[0114] After the electronic device 100 enables the youth mode of the social application, the electronic device 100 may receive and respond to the user's operation of opening the social application, and display the following information: Figure 3E Teen social interface 320 is shown.
[0115] like Figure 3E As shown, the youth social interface 320 may include an option bar 301, a bottom control bar 306, and one or more picture controls, such as picture control 302, picture control 303, picture control 304, and picture control 304. Moreover, the interface elements in the youth social interface 320 may be kept consistent with the Figure 3C The youth social interface 320 is different from the social application interface 300 in that one or more of the image controls in the youth social interface 320 are covered with layers (such as mosaic layers, etc.), and these coded image controls are disabled in the youth mode. Figure 3C It can be seen that the graphic content corresponding to the picture control 302 is entertainment, and the graphic content corresponding to the picture control 303 is advertising. The above picture controls are all determined to be disabled in the youth mode. Figure 3A In the illustrated youth social interface 320 , a layer 321 may be overlaid and displayed on the picture control 302 , and a layer 322 may be overlaid and displayed on the picture control 303 .
[0116] The electronic device 100 can receive and respond to the user's click operation on the picture control 304, displaying the following Figure 3F The youth graphic interface 330 is shown.
[0117] like Figure 3F As shown, the youth graphic interface 330 may include graphic content 311 and one or more comments, for example, comment A posted by user 1 and comment B posted by user 2. Figure 3D As can be seen from the illustrated embodiment, comment C posted by user 3 includes content that is not suitable for teenagers to read. In the teenager mode, comment C is a blocked element. Figure 3F In the illustrated youth graphic interface, a layer (such as a mosaic layer, etc.) 331 may be overlaid on the comment C to indicate that the comment contains content that is not suitable for teenagers to read.
[0118] In some embodiments, after the electronic device 100 enables the youth mode of the social application, the electronic device 100 may also receive and respond to the user's operation of opening the social application, displaying a Figure 3G The teen social interface 340 shown does not include shielded elements in the teen mode.
[0119] like Figure 3G As shown, the youth social interface 340 may include an option bar 301, a bottom control bar 306, and one or more picture controls. Figure 3C The layout of the social application interface 300 shown is the same. The difference between the youth social interface 320 and the social application interface 300 is that one or more picture controls in the youth social interface 320 include one or more non-disabled picture controls (such as picture control 304 and picture control 305), and do not include disabled picture controls (such as picture control 304 and picture control 305). Figure 3C In addition, the youth social interface 340 also includes one or more picture controls (such as picture control 341 and picture control 342) that are not displayed in the social application interface 300. Optionally, in the youth social interface 340, the picture control 304 can be displayed in Figure 3C At the display position of the picture control 302 shown, the picture control 305 can be displayed Figure 3C At the display position of the picture control 304 shown, the picture control 341 can be displayed Figure 3C The picture control 303 is shown in the display position, and the picture control 342 can be displayed on Figure 3C The display position of the picture control 305 is shown.
[0120] The electronic device 100 can receive and respond to the user's click operation on the picture control 304, displaying the following Figure 3H Teen graphic interface 350 is shown.
[0121] like Figure 3H As shown, the youth graphic interface 350 may include graphic content 311 and one or more comments. Since comment C posted by user 3 is a blocked element in the youth mode, in the youth graphic interface 350, the one or more comments may include comment A posted by user 1, comment B posted by user 2, and comment D posted by user 4, etc., but comment C is not displayed. The display position of comment D may be Figure 3D The display position of comment C is shown.
[0122] It is understandable that the above FIG. 3A to FIG. 3HIt is just an exemplary explanation that after application 1 switches from mode 1 to mode 2, electronic device 100 can display the shielded elements in application 1 with codes (or not display the shielded elements). Interface elements can include video controls, picture controls, text controls, etc. in the above embodiments, and can also include more types of interface elements such as audio controls and web view (webview) controls. In addition, mode 2 can also be other modes besides youth mode, which is not limited in this application.
[0123] It should be noted that, in the embodiment of the present application, when the shielding element is not displayed, the change of the display position (or arrangement) of the interface elements before and after the mode switching can refer to the above Figure 3B , Figure 3G or Figure 3H The display position change of the control in the embodiment shown can also refer to the following FIG. 5A to FIG. 5F The relevant contents in the illustrated embodiments will not be described in detail in this application.
[0124] In some application scenarios, the electronic device 100 may display the configuration interface of application 1, and the configuration interface of application 1 may include all interface elements (such as interface element 3) in interface 1 of application 1, and a security level identifier may be displayed on the one or more interface elements to indicate the security level of each interface element in user interface 1. The electronic device 100 may receive and respond to the user's selection operation on interface element 3, and display a check mark on interface element 3 of the configuration interface (such as overlaying a layer, etc.). After enabling mode 2 of application 1, the electronic device 100 may receive and respond to the user's operation of opening interface 1 of application 1, and display interface 2 of application 1, which does not include interface element 3, or a layer is overlaid on interface element 3 in interface 2. Among them, the security level may include dangerous and safe, and optionally, may also include general.
[0125] In this way, the security level of the interface elements can be provided to the user in the configuration interface, so that the user can configure the interface elements displayed by the application 1 in the mode 2 by himself.
[0126] For example, Figure 4AAs shown, the electronic device 100 can display a desktop 400. A page with application icons is displayed in the desktop 400, and the page includes multiple application icons (for example, a weather application icon, a setting application icon 404, a study guidance application icon 405, a browser application icon, etc.). A page indicator 402 is also displayed below the page with application icons to indicate the total number of pages on the desktop and the positional relationship between the currently displayed page and other pages. For example, the desktop 400 may include three pages, and the white dot in the page indicator is located at the third position from the left, which can indicate that the currently displayed page is the third page from the left of the three pages. Optionally, a status bar 401 is also displayed above the page with application icons, and the status bar 401 may include information such as a signal strength indicator, a battery value, and time. Further optionally, there may be a tray (dock) area 403 below the page indicator, and the dock area 403 may include one or more tray icons (for example, a dial application icon, a message application icon, a contact application icon, a camera application icon, etc.), and one or more tray icons in the dock area may remain displayed when the page is switched.
[0127] The electronic device 100 may receive and respond to a user's click operation on the settings application icon 404, displaying a Figure 4B A settings application interface 410 is shown.
[0128] like Figure 4B As shown, the setting application interface 410 may include one or more setting items, such as a Bluetooth item, a mobile network item, an application and service item 411, etc. Each setting item may be used to trigger the electronic device 100 to display the setting interface corresponding to the setting item.
[0129] The electronic device 100 may receive and respond to a user's click operation on the application and service entry 411, and display the following information: Figure 4C An application and services settings interface 420 is shown.
[0130] like Figure 4C As shown, the application and service setting interface 420 may include one or more setting items for setting applications or services, such as application management items, service management items, permission management items, and application and service quota items 421.
[0131] The electronic device 100 may receive and respond to a user's click operation on the application and service limit entry 421, and display the following information: Figure 4D An application selection interface 430 is shown.
[0132] like Figure 4DAs shown, the application selection interface 430 may include one or more application entries, such as a chat application entry, a study tutoring application entry 431, a reading application entry, and a browser application entry, etc. Each application entry may be displayed with an application name and an application icon, and the application entry may be used to trigger the electronic device 100 to display the configuration interface of the application corresponding to the application entry.
[0133] The electronic device 100 may receive and respond to a user's click operation on the learning tutoring application item 431 by displaying the following information: Figure 4E A configuration interface 440 of a learning tutoring application is shown.
[0134] like Figure 4E As shown, the configuration interface 440 of the learning tutoring application may include a user bar 441, a bottom auxiliary control bar 446, and one or more functional controls, such as an invite friend control 442, a course learning control, a course discussion control, a member center control 443, a mall control 444, a customer service control 447, an evaluation control, and a setting control. Among them, a security level logo may be displayed on the one or more functional controls to indicate the security level of the functional control. In some embodiments, the security level may include dangerous, general, and safe, etc. The security level logo may include a dangerous logo, a general logo, and a safe logo. For example, a dangerous logo 448a may be displayed on the member center control 443 and the mall control 444, a general logo 448b may be displayed on the invite friend control 442, and a safe logo 448c may be displayed on other functional controls such as the customer service control 447. It can be understood that the security level logo can be Figure 4E In the illustrated embodiment, a rectangular box is displayed outside the function control, and different forms and / or lines of different thicknesses are used to represent different security levels. In other embodiments, the security level identification can use other methods such as rectangular boxes of different colors, graphics of different shapes, or function controls displayed in different colors to represent different security levels, which is not limited in this application. Optionally, the configuration interface 440 may also include a one-key selection control 445, which can be used to trigger the electronic device 100 to overlay and display a layer (e.g., a mosaic layer) on all interface elements in the configuration interface 440 that display danger identification.
[0135] The electronic device 100 may receive and respond to a user's click operation on the one-key selection control 445, or the electronic device 100 may receive and respond to a user's click operation on the member center control 443 and the mall control 444 in sequence, such as Figure 4FAs shown, a mosaic layer 448d is respectively covered and displayed on the member center control 443 and the mall control 444. The mosaic layer 448d can be used to prompt the user that the member center control 443 and the mall control 444 have been selected as shielded elements, and the shielded elements are interface elements that are prohibited from use or display in the youth mode. Figure 4F A completion control 449 may also be displayed in the configuration interface 440 shown.
[0136] The electronic device 100 can receive and respond to the user's click operation on the completion control 449, or the electronic device 100 can also receive and respond to the user's operation of returning to the application selection interface 430 (such as a right swipe operation, etc.), set the interface element currently covered with the mosaic layer as a shielding element, and display the following Figure 4G An application selection interface 430 is shown.
[0137] like Figure 4G As shown, the learning tutoring application entry 431 in the application selection interface 430 may display a configured mark 432, such as the text "page configured", etc. For other specific contents of the application selection interface 430, please refer to the above Figure 4D Related descriptions in the illustrated embodiment. The configured mark 432 can be used to prompt the user that the interface in the application has been configured.
[0138] The electronic device 100 may receive and respond to a user's upward sliding operation on the application selection interface 430, and display the following Figure 4H The desktop 400 is shown. The desktop 400 displays a study guidance application icon 405 .
[0139] The electronic device 100 may receive and respond to a user's click operation on the learning tutoring application icon 405. After detecting that the learning tutoring application has enabled the youth mode, the electronic device 100 may display the following information: Fig. 4I Youth learning interface 450 is shown.
[0140] like Fig. 4I As shown, the youth learning interface 450 may include a user bar, a bottom auxiliary control bar, and one or more functional controls. The one or more functional controls are not included in the above FIG. 4E to FIG. 4F In the embodiment shown, the member center control 443 and the mall control 444 are set as shielded elements. Other contents of the youth learning interface 450 can refer to the above Figure 4E The configuration interface 440 is shown with reference to the related description, and the youth learning interface 450 does not include the security level identification and the one-key selection control 445 .
[0141] In some embodiments, the electronic device 100 may receive and respond to a user's click operation on the learning tutoring application icon 405. After detecting that the learning tutoring application has enabled the youth mode, the electronic device 100 may display the following information: Figure 4J Youth learning interface 460 is shown.
[0142] like Fig. 4I As shown, the youth learning interface 450 may include a user bar, a bottom auxiliary control bar, and one or more functional controls. Figure 4E The same as the embodiment shown, in addition, the member center control 443 is covered with a mosaic layer 461, and the mall control 444 is covered with a mosaic layer 462. The mosaic layer 461 and the mosaic layer 462 can be used to prompt the user that the two function controls are disabled in the youth mode.
[0143] In some embodiments, the electronic device 100 may receive and respond to a user's click operation on the learning tutoring application icon 405. After detecting that the learning tutoring application has enabled the youth mode, the electronic device 100 may display the following information: Figure 4K The youth learning interface 470 shown. The interface elements and the layout of the interface elements included in the youth learning interface 470 are similar to Figure 4E The configuration interface 440 is the same as shown, and the youth learning interface 470 does not include the security level logo and the one-key selection control 445.
[0144] In this case, the electronic device 100 may receive and respond to a user's click operation on the member center control 443 or the mall control 444, and display the following information: Figure 4L Disable interface 480 is shown.
[0145] like Figure 4L As shown, the disabling interface 480 may include a disabling prompt, such as the text "this control is currently in a disabled state", etc. The disabling interface 480 may be used to prompt the user that the interface element currently clicked is a shielded element in the youth mode.
[0146] It is understandable that FIG. 4A to FIG. 4L This is just an example. Mode 2 can also be other modes besides the youth mode, and the mosaic layer displayed on the configuration interface can also be other layers, which is not limited in this application. In addition, in some embodiments, all interface elements in application 1 in the configuration interface can be displayed with a security level identification. In other embodiments, some of the interface elements in application 1 in the configuration interface may not display the security level identification, and these interface elements may be controls that carry the necessary functions of application 1, etc., which is not limited in this application.
[0147] It should be noted that when configuring the interface of application 1 in mode 2, the current mode of application 1 can be other modes other than mode 2, or mode 2. Moreover, when configuring the interface of application 1 in mode 2, only one interface of application 1 in mode 2 can be configured, or multiple interfaces of application 1 in mode 2 can be configured (for example, triggering the electronic device 100 to display another interface of application 1 and configure it through the control in interface 1, etc.), and this application does not limit this.
[0148] In some embodiments, if after application 1 switches from mode 1 to mode 2, the electronic device 100 does not display the shielding elements of application 1 in mode 2 when displaying the interface of application 1, then the display position (or arrangement) of the same interface elements in the interface of application 1 may change accordingly before and after the mode switching. The change in the display position of the interface element before and after the mode switching is related to the layout type of the interface element.
[0149] The following introduces several layout changes of interface elements in interface 1 in application 1 before and after the usage mode of application 1 is switched.
[0150] In some application scenarios, the electronic device 100 may display multiple interface elements in area 1 of the display screen, and the layout of the interface elements is set to a linear layout. After the use mode is switched, if the multiple interface elements include shielded elements in the current use mode, the electronic device 100 may display one or more interface elements of the multiple interface elements that are not disabled in area 1 in the original linear layout.
[0151] For example, Figure 5A It shows a schematic diagram of arrangement of multiple interface elements in a linear layout in the interface when the usage mode of application 1 is mode 1.
[0152] like Figure 5A As shown, in area A of the display screen, the layout of interface element 501, interface element 502 and interface element 503 is a horizontal linear layout, that is, interface element 501, interface element 502 and interface element 503 are arranged in sequence from left to right, and the three interface elements are on the same horizontal line. Among them, interface element 501 is a shielding element in mode 2.
[0153] After application 1 switches from mode 1 to mode 2, as shown in Figure 5B As shown, electronic device 100 does not display interface element 501, and interface element 502 and interface element 503 are displayed in a horizontal linear layout in area A, that is, interface element 502 and interface element 503 are arranged in sequence from left to right, and the two interface elements are on the same horizontal line.
[0154] In some application scenarios, the electronic device 100 can display multiple interface elements in area 1 of the display screen, and the layout of the interface elements is set to a relative layout. After the use mode is switched, if the multiple interface elements include shielded elements in the current mode, the electronic device 100 can display one or more interface elements that are not disabled among the multiple interface elements in area 1 in the original relative layout. Moreover, after the use mode is switched, the non-shielded elements (i.e., the interface elements that are not disabled) can be filled to the left and upward while maintaining the original relative layout, that is, the interface elements are preferentially displayed in the upper and left parts of area 1.
[0155] For example, Figure 5C As shown, in area B of the display screen, interface element 511, interface element 512, interface element 513 and interface element 514 are displayed, and the layout of the above interface elements is a relative layout, specifically including: interface element 512 is below interface element 511, interface element 513 and interface element 514 are below interface element 512, and interface element 514 is on the right side of interface element 513. Among them, interface element 511 and interface element 513 are shielding elements in mode 2.
[0156] After application 1 switches from mode 1 to mode 2, as shown in Figure 5D As shown, electronic device 100 does not display interface element 511 and interface element 513. Interface element 512 and interface element 514 maintain their original relative layout display in area B, that is, interface element 512 moves upward and is displayed at the original display position of interface element 511, and interface element 514 moves leftward and upward and is displayed at the lower left of interface element 512.
[0157] In some application scenarios, the electronic device 100 can display multiple interface elements in area 1 of the display screen, and the layout of the interface elements is set to a frame layout. After the use mode is switched, if the multiple interface elements include shielded elements in the current use mode, the electronic device 100 can display one or more interface elements that are not disabled in the multiple interface elements in area 1 at their original display positions.
[0158] For example, Figure 5E As shown, the electronic device 100 can display interface element 521, interface element 522 and interface element 523 in area C of the display screen. Moreover, the layout of the above three interface elements is set to a frame layout, that is, the display positions of the three interface elements in area C are determined. Among them, interface element 523 is a shielding element in mode 2.
[0159] After application 1 switches from mode 1 to mode 2, as shown in Fig. 5F As shown, in area C of the display screen, Figure 5E All interface elements except interface element 523 shown, and each of the above interface elements is Fig. 5F The display position in the area C shown is consistent with the interface element in Figure 5E The display positions in the illustrated area C are the same.
[0160] Understandably, FIG. 5A to FIG. 5F These are just three examples. In the embodiments of the present application, the multiple interface elements may include more or fewer interface elements than those in the above embodiments, and may also be arranged in different ways, which are not limited in the present application.
[0161] In other application scenarios, the electronic device 100 can display multiple interface elements of application 1 in area 1 of the display screen, and the layout of the multiple interface elements can be set to layout 1. There is interface element a among the multiple interface elements, and the interface element a includes multiple sub-elements. The layout of the multiple sub-elements in interface element a is set to layout 2, and layout 2 is different from layout 1. Among them, interface element a is not a shielded element in mode 2, and there are sub-elements in the multiple sub-elements that are disabled in mode 2. After the use mode of application 1 is switched, the multiple interface elements (including interface element a) can determine the display positions of the remaining interface elements in area 1 based on layout 1 and the shielded elements. The display positions of the multiple sub-elements in interface element a can be adjusted based on layout 2 and the disabled sub-elements among the multiple sub-elements.
[0162] For example, Figure 5G As shown, the electronic device 100 can display interface element 530, interface element 540 and interface element 550 in area D of the display screen, and interface element 530 includes multiple sub-elements, such as sub-element 531, sub-element 532 and sub-element 533. The layout of interface element 530, interface element 540 and interface element 550 is set to a relative layout, specifically including: in area D, interface element 540 and interface element 550 are below interface element 530, and interface element 550 is located on the right side of interface element 540. In interface element 530, the layout of the above three sub-elements is set to a frame layout, that is, the display positions of the three interface elements in the display area where interface element 530 is located are determined. Among them, interface element 540 and sub-element 533 are shielding elements under mode 2.
[0163] After application 1 switches from mode 1 to mode 2, as shown in Figure 5H As shown, in area D of the display screen, Figure 5G All interface elements except interface element 540 and sub-element 533 are shown. Figure 5GIn the shown area D, the display position of interface element 530 remains unchanged, the display positions of sub-elements 531 and 532 in interface element 530 remain unchanged, and the display position of interface element 550 moves to the left and is located at the lower left of interface element 530 .
[0164] Understandably, Figure 5G to Figure 5H This is just an example. In an embodiment of the present application, the multiple interface elements may also include more or fewer interface elements, or there may be more interface elements including sub-elements, and the layout of the interface elements and sub-elements may also be set to different layouts, which is not limited in the present application.
[0165] The following describes a process of a mode switching method provided in an embodiment of the present application.
[0166] like Fig. 6A As shown, the specific process of a mode switching method provided in an embodiment of the present application may include the following steps:
[0167] S601, the electronic device 100 detects that the usage mode of the application 1 is mode 1, and displays the interface 1 based on the file 1 of the application 1, the interface 1 includes the interface element 1, and the file 1 includes the code segment A1 corresponding to the interface element 1.
[0168] In some embodiments, the usage mode may include a normal mode and a youth mode, and the normal mode is when the youth mode is not enabled. In the case where the usage mode includes the normal mode and the youth mode, mode 1 may be the normal mode and mode 2 may be the youth mode. In other embodiments, the usage mode may also include more modes, such as a child mode, an elderly mode, a learning mode, a healthy usage mode, etc. In this case, mode 2 may also be any of the above usage modes, and this application does not limit this.
[0169] After detecting that the current usage mode of application 1 is mode 1, electronic device 100 may determine to display interface 1 based on file 1 corresponding to mode 1. Interface 1 includes interface element 1. The relationship between file 1 and code segment A1 corresponding to interface element 1 can be referred to Figure 6B Relevant statements in the illustrated embodiments.
[0170] S602, the electronic device 100 detects that the usage mode of the application 1 switches from mode 1 to mode 2, and obtains the file 2 of the application 1 in mode 2, wherein the file 2 includes the code segment B1 corresponding to the interface element 1, and the code segment B1 includes a mode tag.
[0171] In some embodiments, the use mode of application 1 is switched from mode 1 to mode 2, which may be implemented within application 1. For example, FIG. 2A to FIG. 2D The embodiment shown.
[0172] In other embodiments, the electronic device 100 may also include multiple usage modes, which may include mode 1 and mode 2, and the specific content of the usage mode may refer to the relevant description of the usage mode of application 1 in the above step S601. In this case, the usage mode of application 1 may also be determined based on the usage mode of the electronic device 100, that is, when the usage mode of the electronic device 100 switches from mode 1 to mode 2, the usage mode of application 1 may follow the usage mode of the electronic device 100 and switch from mode 1 to mode 2.
[0173] After detecting that the current usage mode of application 1 is mode 2, the electronic device 100 can obtain file 2 of application 1 in mode 2. In some embodiments, the installation package of application 1 includes file 1 and file 2 (or includes files used to generate file 1 and file 2). In this case, the electronic device 100 can obtain file 2 from the installation package of application 1. In other embodiments, the electronic device 100 can generate file 2 based on file 1. Specifically, the electronic device 100 can sequentially encapsulate or insert the code corresponding to the interface element in file 1 to obtain the code segment corresponding to the interface element in file 2, and then obtain file 2. Among them, the specific process of the electronic device 100 obtaining the code segment B1 of the interface element 1 in file 2 based on the code segment A1 corresponding to the interface element 1 in file 1 can be referred to. Figure 7 The relevant contents in the illustrated embodiment will not be described in detail here.
[0174] File 2 of application 1 in mode 2 includes code segment B1 corresponding to interface element 1, and code segment B1 includes a mode tag. Code segment B1 can be a code segment obtained by encapsulating or plugging code segment A1, and a mode tag is added during the encapsulation or plugging process. The mode tag is used to indicate whether the interface element corresponding to the code segment needs to be content identified. The process of encapsulating or plugging the code segment in file 1 can also refer to the following Figures 7 to 9 The relevant descriptions in the illustrated embodiments are not described in detail here.
[0175] In some embodiments, the mode tag may be a Boolean value, such as a code “ischild='True'”, etc. In other embodiments, the mode tag may also be other application programming interfaces (APIs) or other parameters.
[0176] For example, Figure 6BAs shown, the file 1 corresponding to the application 1 in mode 1 may include code segments corresponding to multiple interface elements, such as code segment A1 corresponding to interface element 1, code segment A2 corresponding to interface element 2, and code segment A3 corresponding to interface element 3. The file 2 corresponding to the application 1 in mode 2 may include code segments corresponding to multiple interface elements, such as code segment B1 corresponding to interface element 1, code segment B2 corresponding to interface element 2, and code segment B3 corresponding to interface element 3. Among them, code segment B1 and code segment B2 may include a mode tag for indicating that in mode 2, when the electronic device 100 displays the interface of application 1, it is necessary to perform content recognition on interface element 1 and interface element 2.
[0177] Understandably, Figure 6B The illustrated embodiments are merely exemplary of the differences in code segments corresponding to interface elements 1 in different modes. In some embodiments, file 2 may include more or fewer interface elements, and may include more or fewer mode tags, which is not limited in this application.
[0178] In other embodiments, if code segment B1 is obtained by encapsulating code segment A1, the mode label may also be the corresponding class of the encapsulated interface element, which is also referred to as the encapsulation class in this application. The encapsulation class can be defined by the application developer or the default class can be used. Taking mode 2 as the youth mode as an example, the encapsulation class in the youth mode may include any one or more of the following: youth picture control (childimageview), youth text control (childTextview, childEditText, etc.), youth video control (childvideoview, childsurfaceview, etc.), youth audio control (childaudioTrack) and youth web view control (childwebview), etc. When the electronic device 100 detects that the code segment B1 includes any of the above encapsulation classes, the electronic device 100 determines to perform content recognition on the interface element 1 corresponding to the code segment B1.
[0179] For example, Figure 6CAs shown, interface element 1 can be an image control, and the code segment A1 corresponding to interface element 1 can include the class corresponding to interface element 1, namely "imageview". After encapsulating code segment A1, the code segment B1 corresponding to interface element 1 can include the encapsulation class of interface element 1, namely "childimageview". Interface element 2 can be a text control, and the code segment A2 corresponding to interface element 2 can include the class corresponding to interface element 2, namely "Textview". After encapsulating code segment A2, the code segment B2 corresponding to interface element 2 can include the encapsulation class of interface element 2, namely "childTextview". Interface element 3 can be a grid control, and the code segment A3 corresponding to interface element 3 does not need to be encapsulated, so code segment B3 can be the same as code segment A3.
[0180] When the electronic device 100 displays the interface of application 1 in mode 2 based on file 2, it can determine to perform content recognition on interface element 1 when it detects that code segment B1 includes "childimageview"; and determine to perform content recognition on interface element 2 when it detects that code segment B2 includes "childTextview".
[0181] Optionally, the encapsulated code segment B1 or code segment B2 may also include the above-mentioned Boolean value, API or parameter, etc.
[0182] Understandably, Figure 6C The shown embodiment is only an example. In the embodiment of the present application, the class corresponding to the interface element 1 may also be other classes. In this case, the encapsulation class corresponding to the interface element 1 may also be other encapsulation classes. The present application does not limit this.
[0183] In other embodiments, the code segment B1 may also include a function for calling the recognition algorithm, or a code segment including the recognition algorithm. In this case, optionally, the function for calling the recognition algorithm, or the code segment of the recognition algorithm may also be used as a mode tag.
[0184] It should be noted that the above-mentioned mode label refers to the mode label of mode 2. In some embodiments, if there are one or more shielding elements in other usage modes (such as mode 3) besides mode 2 among the multiple usage modes of application 1, then application 1 may also correspond to file 3 under mode 3, and the shielding elements under mode 3 may also include the mode label of mode 3 in the code segment in file 3. The mode label of mode 3 may be the same as or different from the mode label of mode 2, and the type of the mode label of mode 3 may be the same as the type of the mode label of mode 2.
[0185] S603 , the electronic device 100 determines to perform content recognition on the interface element 1 based on the mode tag in the code segment B1 .
[0186] When it is detected that the code segment B1 includes a mode tag, the electronic device 100 may determine to perform content recognition on the interface element 1, that is, determine to perform the following step S604 and subsequent steps.
[0187] It should be noted that if the code segment of another interface element (such as interface element 3) in file 2 does not include a mode tag, when the electronic device 100 executes the code segment, it can directly display interface element 3 based on the code segment without the need to perform content recognition on interface element 3.
[0188] S604, the electronic device 100 obtains the content of the interface element 1 based on the code segment B1, and the content of the interface element 1 includes any one or more items such as pictures, texts, web page hyperlinks, and audio.
[0189] The specific process of the electronic device 100 acquiring the content of the interface element 1 based on the code segment B1 may include the following steps:
[0190] 1. The electronic device 100 obtains the class corresponding to the interface element 1 based on the code segment B1.
[0191] The corresponding classes of interface elements may include: image controls (imageview), text controls (Textview, EditText, etc.), video controls (videoview, surfaceview, etc.), audio controls (audioTrack), web view (webview) controls, and so on.
[0192] Code segment B1 includes a class corresponding to interface element 1. Electronic device 100 can determine the class corresponding to interface element 1 based on code segment B1.
[0193] 2. The electronic device 100 obtains the content of the interface element 1 based on the class corresponding to the interface element 1.
[0194] When the classes corresponding to interface elements are different, the contents of the interface elements are also different.
[0195] For example, when the interface element 1 is a picture control, the content of the interface element 1 may include a picture. The electronic device 100 may obtain the picture source of the interface element 1 from the code segment B1 based on the class corresponding to the interface element 1, and obtain the content of the interface element 1 based on the picture source of the interface element 1.
[0196] For another example, when the interface element 1 is a webview control, the content of the interface element 1 may include the uniform resource locator (URL) of the webpage corresponding to the interface element 1. The electronic device 100 may obtain the webview source of the interface element 1 from the code segment B1 based on the class corresponding to the interface element 1, and obtain the URL of the interface element 1 based on the webview source.
[0197] For another example, when the interface element 1 is a video control, the content of the interface element 1 may include a video file corresponding to the video control. The electronic device 100 may obtain the video source of the interface element 1 from the code segment B1 based on the class corresponding to the interface element 1, and obtain the video file corresponding to the interface element 1 based on the video source.
[0198] It is understandable that the method for obtaining the content of three types of interface elements is only exemplified here. In the embodiments of the present application, the interface element 1 can also be other types that are different from the above embodiments. In this case, the method for obtaining the content of the interface element 1 can also refer to the method described in the above embodiments, and the present application does not limit it here.
[0199] S605, the electronic device 100 determines whether the content of the interface element 1 includes the shielded content corresponding to mode 2.
[0200] The electronic device 100 can determine whether the content of the interface element 1 includes the blocked content corresponding to mode 2. For example, when mode 2 is the youth mode, the blocked content corresponding to mode 2 may include any one or more of the following: elements that are not suitable for teenagers to watch, such as advertisements, inducements to consumption, uncivilized language, and games.
[0201] The electronic device 100 can determine whether the content of the interface element 1 contains the shielded content corresponding to the mode 2 through the built-in recognition algorithm. The recognition algorithm may include an image recognition algorithm, an audio recognition algorithm, a video recognition algorithm, a text recognition algorithm, a web page view recognition algorithm, a URL recognition algorithm, etc. The recognition algorithm built into the electronic device 100 can be an algorithm model trained based on a machine learning algorithm such as deep learning and a large amount of data (such as pictures, text, video, audio, etc.).
[0202] The electronic device 100 may determine the recognition algorithm to be used based on the content of the interface element 1. For example, when the content of the interface element 1 includes a picture, the electronic device 100 may use a picture recognition algorithm to determine whether the picture includes the shielded content corresponding to mode 2; when the content of the interface element 1 includes a URL, the electronic device 100 may use a URL recognition algorithm to determine whether the URL is an illegal URL, or determine whether the webpage corresponding to the URL includes the shielded content corresponding to mode 2; when the content of the interface element 1 includes a video file or an audio file, the electronic device 100 may use a video recognition algorithm or an audio recognition algorithm to determine whether the content of the interface element 1 includes the shielded content corresponding to mode 2.
[0203] In some embodiments, when the content of interface element 1 includes a video file, the electronic device 100 can sample the video file, obtain images of multiple sampling frames (such as key frames) of the video file, and determine whether the multiple sampling frames contain shielded content corresponding to mode 2 based on the image recognition algorithm, and then determine whether the video file includes shielded content corresponding to mode 2.
[0204] The specific process of the electronic device 100 determining whether the interface element 1 needs to be shielded in mode 2 based on the built-in recognition algorithm can be referred to as follows: Figure 8 or Fig. 9 The relevant steps in the illustrated embodiment will not be described in detail here.
[0205] If the content of the interface element 1 does not include the shielded content corresponding to the mode 2, the electronic device 100 may execute the following step S606.
[0206] If the content of the interface element 1 includes the shielded content corresponding to the mode 2, the electronic device 100 may execute the following step S607.
[0207] S606 , the electronic device 100 displays interface 2 based on file 2 , where interface 2 includes interface element 1 .
[0208] When it is determined that interface element 1 does not need to be shielded in mode 2 , when electronic device 100 displays interface 2 based on file 2 , interface 2 may include interface element 1 .
[0209] S607 , the electronic device 100 displays interface 2 based on file 2 , and interface 2 does not include interface element 1 .
[0210] When it is determined that interface element 1 needs to be shielded in mode 2 , in some embodiments, when electronic device 100 displays interface 2 based on file 2 , interface 2 does not include interface element 1 .
[0211] In other embodiments, the interface 2 displayed by the electronic device 100 based on the file 2 may also include an interface element 1, and in this case, a layer (such as a mosaic layer) is displayed over the interface element 1 to prompt the user that the interface element 1 is disabled in the current mode.
[0212] In this way, after the usage mode of application 1 is switched, the electronic device 100 can also identify and shield interface elements that are not suitable for display in the current usage mode based on the mode label, without the need to set different content sources for different usage modes of the application, nor to set different interface layouts for different usage modes of the application, etc. The development workload is small, the cost is low, and it is applicable to all applications.
[0213] The following describes a method flow for obtaining code segment B1 of interface element 1 in file 2 based on code segment A1 of interface element 1 in file 1, provided in an embodiment of the present application.
[0214] like Figure 7 As shown, a specific process of obtaining code segment B1 based on code segment A1 provided in an embodiment of the present application may include the following steps:
[0215] S701, the electronic device 100 obtains the class corresponding to the interface element 1 based on the code segment A1.
[0216] Code segment A1 is a code segment of interface element 1 in file 1. Code segment A1 includes a class corresponding to interface element 1, such as "imageview", "surfaceview", etc. Electronic device 100 can obtain the class corresponding to interface element 1 based on code segment A1.
[0217] S702, the electronic device 100 determines whether the class corresponding to the interface element 1 belongs to a predetermined class.
[0218] After determining the class corresponding to the interface element 1 , the electronic device 100 may determine whether the class corresponding to the interface element 1 belongs to a predetermined class.
[0219] Class I can be a class preset by the user or a class set by default. In some embodiments, the predetermined class may include the following classes: image control (imgeview), text control (Textview, Editview, etc.), video control (surfaceview, videoview, etc.), audio control (audioTrack), and web view control (webview), etc. It is understandable that the predetermined class may also include more, fewer, or different classes from the above embodiments, and this application does not limit this.
[0220] If the electronic device 100 determines that the class corresponding to the interface element 1 belongs to the predetermined class, the following step S704 is executed.
[0221] If the electronic device 100 determines that the class corresponding to the interface element 1 does not belong to the predetermined class, the following step S703 is executed.
[0222] S703, the electronic device 100 obtains a code segment B1, and the code segment B1 is the same as the code segment A1.
[0223] S704, the electronic device 100 adds a mode tag to the code segment A1 by encapsulation or plugging to obtain the code segment B1.
[0224] In some embodiments, the electronic device 100 can add a mode tag to the code segment A1 by inserting a stub. In this case, the mode tag can be the above Fig. 6A The Boolean value, API or other parameter described in the illustrated embodiment. The electronic device 100 can insert the mode tag into the code segment A1 to obtain the code segment B1. Optionally, the electronic device 100 can also insert a function for calling the recognition algorithm or a code segment of the recognition algorithm into the code segment A1 to determine the code segment B1.
[0225] In some other embodiments, the electronic device 100 may also add a mode tag to the code segment A1 by encapsulation to obtain the code segment B1. In this case, the mode tag may be the above Fig. 6A The Boolean value, API or other parameter in the embodiment shown may also be the above Fig. 6A The encapsulation class in the illustrated embodiment may be a function for calling a recognition algorithm or a code segment for a recognition algorithm. The electronic device may encapsulate the code segment A1 into a new code segment B1, and the code segment B1 has an encapsulation class. In some embodiments, the code segment B1 may also include a function for calling a recognition algorithm or a code segment for a recognition algorithm, and optionally, may also include the above-mentioned Boolean value, API or other parameters.
[0226] When the electronic device 100 needs to obtain the file 2 based on the file 1, the electronic device 100 can use Figure 7 The method in the illustrated embodiment traverses the code segments corresponding to each interface element in file 1, determines the code segments of each interface element in file 2, and thereby determines file 2.
[0227] In this way, the electronic device 100 can obtain the file 2 based on the file 1, and the application developer does not need to write code files for the application in different usage modes separately, which reduces the development workload and cost and can also be applicable to all applications.
[0228] It should be noted that, when the installation package of application 1 includes file 2 (or a file used to generate file 2), the developer of application 1 can also use Figure 7The method in the illustrated embodiment obtains file 2 based on file 1. At this time, the execution subject is the electronic device used by the developer.
[0229] In this way, application developers only need to add mode tags to obtain code files of applications in different usage modes, reducing development workload and costs.
[0230] The following takes the interface elements of the imageview and webview classes as examples to introduce the specific process of the electronic device 100 determining whether to shield the interface element after the application 1 switches from mode 1 to mode 2.
[0231] For example, Figure 8 As shown, when the interface element 1 is of the imageview class, the specific process of the electronic device 100 determining whether to shield the interface element 1 after the application 1 switches from mode 1 to mode 2 may include the following steps:
[0232] S801, the electronic device 100 determines that the class corresponding to the interface element 1 is an image control (imageview) based on the code segment B1.
[0233] When the electronic device 100 displays the interface 2 based on the file 2 , when the electronic device 100 detects that the code segment B1 in the file 2 includes a mode tag, the electronic device 100 can determine the class corresponding to the interface element 1 based on the code segment B1 .
[0234] exist Figure 8 In the illustrated embodiment, the class corresponding to the interface element 1 is imageview. At this time, the electronic device 100 can determine that the class corresponding to the interface element 1 is imageview based on "imageview" or "childimageview" in the code segment B1.
[0235] S802, the electronic device 100 determines the image source of the interface element 1 based on the class corresponding to the interface element 1 and the code segment B1.
[0236] The interface element 1 is of the imageview class. At this time, the content of the interface element 1 includes a picture. The code segment B1 includes the picture source of the interface element 1. The electronic device 100 can obtain the picture source of the interface element based on the code segment B1.
[0237] S803, the electronic device 100 obtains a picture of the interface element 1 based on the picture source of the interface element 1.
[0238] S804, the electronic device 100 determines whether to shield the interface element 1 based on the image of the interface element 1.
[0239] The electronic device 100 can determine whether the image of the interface element 1 includes the shielding content corresponding to mode 2 based on the built-in image recognition algorithm, and then determine whether to shield the interface element 1 in mode 2.
[0240] In some embodiments, when the electronic device 100 determines whether the interface element 1 includes the shielded content corresponding to mode 2 based on the built-in image recognition algorithm, the image of the interface element 1 can be scored in multiple aspects. If the score of the image in a certain aspect exceeds the score threshold set for the aspect, it is determined that the image includes the element in the aspect. Taking the shielded content including the advertising element as an example, if the electronic device 100 determines that the score of the image in the advertising aspect reaches the preset score threshold, it is determined that the image of the interface element 1 includes the advertising element. At this time, the electronic device 100 can determine to shield the interface element 1 in mode 2. It should be noted that if the shielded content corresponding to mode 2 includes multiple contents, as long as it is determined that the image of the interface element 1 includes any one of them, it can be determined that the interface element 1 is shielded. When the electronic device 100 determines that the image of the interface element 1 does not include each of the shielded content, the electronic device 100 can determine not to shield the interface element 1. It can be understood that the embodiment here is only an example. In the embodiment of the present application, when the electronic device 100 identifies the content of the interface element 1, it can also judge for more, less or different elements from the above embodiment, or adopt a different image recognition algorithm from the above embodiment, which is not limited in the present application.
[0241] In addition, in other embodiments, the electronic device 100 may also obtain a weighted sum score of the content of interface element 1 after obtaining the scores for different aspects of the content of interface element 1, and determine whether the content of interface element 1 includes shielded content corresponding to mode 2 based on the score and the score threshold.
[0242] After determining whether the image of interface element 1 includes shielding content corresponding to mode 2, electronic device 100 may determine whether interface element 1 is to be shielded in mode 2.
[0243] If the image of the interface element 1 does not include the shielding content corresponding to mode 2, the electronic device 100 determines that the interface element 1 does not need to be shielded in mode 2. At this time, the following step S805 can be executed.
[0244] If the image of the interface element 1 includes shielding content corresponding to mode 2, the electronic device 100 determines that the interface element 1 needs to be shielded in mode 2. At this time, the following step S806 can be executed.
[0245] S805, the electronic device 100 determines to display interface element 1 in interface 2.
[0246] When it is determined that the interface element 1 does not need to be shielded, the electronic device 100 determines to display the interface element 1 normally in the interface 2. The interface 2 is the above Fig. 6A In the illustrated embodiment, the electronic device 100 displays an interface based on file 2 .
[0247] S806, the electronic device 100 determines to shield the interface element 1 in the interface 2.
[0248] When it is determined that interface element 1 needs to be shielded, electronic device 100 determines to shield interface element 1 in interface 2. When displaying interface 2, electronic device 100 may not display interface element 1, or may display interface element 1 and overlay a layer on interface element 1 to prompt the user that interface element 1 is disabled in mode 2.
[0249] When the class corresponding to interface element 1 is imageview, the above Fig. 6A Steps S603 to S607 shown can be replaced by Figure 8 Steps in the illustrated embodiment.
[0250] Another example is Fig. 9 As shown, when the interface element 1 is of the webview class, the specific process of the electronic device 100 determining whether to shield the interface element 1 after the application 1 switches from mode 1 to mode 2 may include the following steps:
[0251] S901, the electronic device 100 determines, based on the code segment B1, that the class corresponding to the interface element 1 is a web view control (webview).
[0252] When the electronic device 100 displays the interface 2 based on the file 2 of the application 1 in the mode 2, when the electronic device 100 detects that the code segment B1 in the file 2 includes a mode tag, it can determine the class corresponding to the interface element 1 based on the code segment B1.
[0253] exist Fig. 9 In the illustrated embodiment, the class corresponding to the interface element 1 is webview. At this time, the electronic device 100 can determine that the class corresponding to the interface element 1 is webview based on the "webview" or "childwebview" in the code segment B1.
[0254] S902, the electronic device 100 determines the webview source of the interface element 1 based on the class corresponding to the interface element 1 and the code segment B1.
[0255] The interface element 1 is of the webview class. At this time, the content of the interface element 1 includes the webview source. The code segment B1 includes the webview source of the interface element 1. The electronic device 100 can obtain the webview source of the interface element based on the code segment B1.
[0256] S903, the electronic device 100 obtains the website address (URL) of the interface element 1 based on the webview source of the interface element 1.
[0257] S904, the electronic device 100 determines whether the URL of the interface element 1 is an illegal URL.
[0258] In some embodiments, the electronic device 100 can obtain an incompatible URL and determine whether the URL is an incompatible URL based on the URL of the interface element 1. It should be noted that the electronic device 100 can store some incompatible URLs and can also obtain incompatible URLs from the cloud or other servers.
[0259] In other embodiments, the electronic device 100 may also send the URL of the interface element 1 to the server, and the server determines whether the URL is an unqualified URL and returns the determination result to the electronic device 100. The electronic device 100 may determine whether the URL of the interface element 1 is an unqualified URL based on the determination result returned by the server.
[0260] It is understandable that the embodiments herein are merely illustrative of several methods for determining whether the URL of the interface element 1 is an incompatible URL. In the embodiments of the present application, the electronic device 100 may also combine a plurality of methods, or use a method different from the above-mentioned embodiments to determine whether the URL of the interface element 1 is an incompatible URL. The present application does not make any limitation thereto.
[0261] If the electronic device 100 determines that the URL of the interface element 1 is not an illegal URL, the electronic device 100 determines that the interface element 1 does not need to be blocked in mode 2. At this time, the following step S905 can be executed.
[0262] If the electronic device 100 determines that the URL of the interface element 1 is an illegal URL, the electronic device 100 determines that the interface element 1 needs to be blocked in mode 2. At this time, the following step S906 can be executed.
[0263] S905, the electronic device 100 determines to display interface element 1 in interface 2.
[0264] S906, the electronic device 100 determines to shield the interface element 1 in the interface 2.
[0265] Step S905 and step S906 can refer to the above Figure 8The related descriptions in step S805 and step S806 are not repeated here.
[0266] When the class corresponding to interface element 1 is webview, the above Fig. 6A Steps S603 to S607 shown can be replaced by Fig. 9 Steps in the illustrated embodiment.
[0267] It should be noted that when the interface element 1 is a video control, a text control, an audio control or other types of interface elements, the electronic device 100 can also obtain the content of the interface element 1 based on the code segment B1 corresponding to the interface element 1, and determine whether the interface element 1 is to be shielded in mode 2 based on the video recognition algorithm, text recognition algorithm or audio recognition algorithm built into the electronic device 100. The specific judgment method can also refer to the above Figure 8 The method of judging the picture shown is not limited in this application.
[0268] In some embodiments, after application 1 switches from mode 1 to mode 2, application 1 may display the interface of application 1 based on an interception element preset by the user. The interception element is an interface element that needs to be disabled in mode 2 set by the user.
[0269] Fig. 10A A flow chart of a method for setting an interception element provided in an embodiment of the present application is shown.
[0270] like Fig. 10A As shown, the electronic device 100 may include a setting application 11, an accessibility framework 12, an identification module 13 and a view module 14. A specific process of setting an interface element that needs to be shielded in mode 2 of the setting application 1 provided in an embodiment of the present application may include the following steps:
[0271] S1001, setting application 11 to display one or more application icons, including the icon of application 1.
[0272] For example, the setting application 11 may display one or more application icons in the application selection interface, and the application selection interface may be the above-mentioned Figure 4D In the application selection interface 430 shown, the icon of application 1 may be a study tutoring application icon 431 .
[0273] S1002 , setting application 11 to detect a user operation on the icon of application 1 , and obtain interface code 1 of interface 1 in application 1 , where interface code 1 includes code segments corresponding to all interface elements in interface 1 .
[0274] The user's operation on the icon of application 1 refers to the user's operation on the icon of application 1 displayed in step S1001 .
[0275] Interface 1 of application 1 may be the main interface of application 1, that is, the first interface displayed after the user opens application 1. In this case, setting application 11 may obtain interface code 1 of interface 1 in response to the user's operation on the icon of application 1.
[0276] In other embodiments, interface 1 may also be other interfaces in application 1. In this case, setting application 11 may also obtain interface code 1 of interface 1 when detecting that the user triggers the operation of displaying the configuration interface of interface 1.
[0277] In other embodiments, the setting application 11 may also obtain the interface codes of multiple interfaces (including interface 1) in application 1 in response to the user's operation on the icon of application 1, and in subsequent steps S1003 and S1004, send the interface codes of the multiple interfaces to the identification module 13, which is not limited in this application.
[0278] S1003 , the configuration application 11 sends the interface code 1 to the accessibility framework 12 .
[0279] S1004 , the accessibility framework 12 sends the interface code 1 to the recognition module 13 .
[0280] It should be noted that, in some other embodiments, the setting application 11 may also directly send the interface code 1 to the recognition module 13 without being transferred through the barrier-free framework 12 .
[0281] S1005 , the identification module 13 traverses the interface code 1 to determine the security levels of multiple interface elements in the interface 1 .
[0282] The identification module 13 may determine the security level of the interface element corresponding to each code segment in sequence according to a certain order (eg, the order from front to back in the interface code 1).
[0283] In some embodiments, the security level of the interface element may include safe and dangerous. Optionally, it may also include general. In other embodiments, the dangerous in the security level may also include multiple different degrees of danger, such as high risk, medium risk and low risk, etc. This application does not limit the division method of the security level and the number of security levels.
[0284] The specific process of the identification module 13 determining the security level of the interface element can be referred to as follows Fig.11 The illustrated embodiment will not be described in detail here.
[0285] It should be noted that, in some embodiments, the identification module 13 can determine the security level of all interface elements in the interface 1 based on the interface code 1. In other embodiments, the identification module 13 can also determine the security level of some interface elements in the interface 1. In this case, the identification module 13 can determine whether it is necessary to determine the security level of the interface element based on the class or other attribute information corresponding to the interface element. In this way, if the interface 1 includes interface elements with irreplaceable functions such as return controls and home page controls, these interface elements will affect the normal use of the application 1 after being blocked. In this case, the identification module 13 does not need to determine the security level of these interface elements. The interface elements that need to determine the security level can be reduced, thereby improving the efficiency of determining the security level of all interface elements in the interface 1.
[0286] S1006 , the identification module 13 sends the security levels of the multiple interface elements in the interface 1 to the setting application 11 .
[0287] S1007, setting the configuration interface of the display interface 1 of the application 11, wherein the security level identifiers of the multiple interface elements are displayed in the configuration interface.
[0288] Exemplarily, the configuration interface may be as described above. Figure 4E Configuration interface 440 is shown.
[0289] For a detailed description of the security level identification, please refer to the above Figure 4E In the embodiment shown, for example, the security level identifier may include the above Figure 4E The illustrated embodiment includes a danger sign 448a, a general sign 448b, and a safety sign 448c, etc.
[0290] S1008, the setting application 11 detects a user's selection operation on one or more interface elements in the configuration interface, and determines that the one or more interface elements are interception elements.
[0291] The user's selection operation on one or more interface elements in the configuration interface may be a click operation on the one or more interface elements. FIG. 4E to FIG. 4F In the illustrated embodiment, the user's selection operation on one or more interface elements in the configuration interface may be a click operation on the member center control 443 and the mall control 444 in sequence, or a click operation on the one-key selection control 445 in the configuration interface 440, etc.
[0292] After determining the one or more interface elements selected by the user in the configuration interface, the setting application 11 can determine that the one or more interface elements are interception elements and obtain the identifier of the interception element. The identifier of the interception element can be used to identify the interception element, and the identifier of the interception element includes any one or more items such as the id, name, and class of each interception element.
[0293] S1009 , the setting application 11 sends the identifier of the intercepted element to the view module 14 .
[0294] S1010 , the view module 14 registers and stores the interception information of the application 1 , including the identifier of the interception element and the identifier of the application 1 .
[0295] In some embodiments, the interception information may include the identifier of the interception element and the identifier of application 1, which is used to indicate the interface elements of application 1 that need to be blocked in mode 2 (e.g., youth mode). Optionally, the interception information may also include the identifier of interface 1, which is used to indicate the interface elements in interface 1 of application 1 that need to be blocked in mode 2.
[0296] The application identifier can be used to identify the application, and the application identifier can be any one or more of the application name, icon, number, etc. The interface identifier can be used to identify the interface, and the interface identifier can be the level of the interface in the application, or the identifier of an interface element in the interface, or the identifier of an interface element in the application used to trigger the display of the interface, etc., which is not limited in this application.
[0297] Exemplarily, Table 1 shows interception information of interface 1 in application 1 stored in a view module 14 .
[0298] Table 1
[0299] Application Identification Interface Logo Identification of the intercepting element Application 1 Interface 1 logo id=a Application 1 Interface 1 logo id=b Application 1 Interface 1 logo id=c
[0300] As shown in Table 1, the interception information of interface 1 in application 1 registered by view module 14 may include an application identifier, an interface identifier, and an identifier of an interception element. Among them, the application identifier is application 1, and the interface identifier is interface 1. The identifier of the interception element may include id=a, id=b, and id=c, which indicates that the interception elements of interface 1 of application 1 in mode 2 include three interface elements with ids a, b, and c, respectively.
[0301] It will be understood that the embodiment shown in Table 1 is only an example. In the embodiments of the present application, the interception information of interface 1 in application 1 registered and stored by view module 14 may also include more, less or different content from the above embodiments. In other embodiments, if the user also sets interception elements of other interfaces in application 1 in setting application 11, the interception information of application 1 may also include interception information of other interfaces in application 1. The present application does not make any limitation on this.
[0302] In other embodiments, the interception information may also include a usage mode (eg, mode 2).
[0303] As another example, Table 2 shows another interception information of interface 1 in application 1 stored by view module 14 .
[0304] Table 2
[0305] Application Identification Interface Logo Usage Mode Identification of the intercepting element Application 1 Interface 1 logo Mode 2 id=a Application 1 Interface 1 logo Mode 2 id=b Application 1 Interface 1 logo Mode 2 id=c
[0306] As shown in Table 1, the interception information of interface 1 in application 1 registered by view module 14 may include application identification, interface identification, usage mode, and identification of interception elements. Among them, the application identification is application 1, the interface identification is interface 1, and the usage mode is mode 2. The identification of the interception element may include id=a, id=b, and id=c, which indicates that the interception elements of interface 1 of application 1 in mode 2 include three interface elements with ids a, b, and c, respectively.
[0307] It will be understood that the embodiment shown in Table 1 is only an example. In the embodiments of the present application, the interception information of interface 1 in application 1 registered and stored by view module 14 may also include more, less or different content from the above embodiments. In other embodiments, if the user also sets interception elements of other interfaces in application 1 in setting application 11, the interception information of application 1 may also include interception information of other interfaces in application 1. The present application does not make any limitation on this.
[0308] Fig. 10B The specific process of the mode switching method executed by the electronic device 100 is shown after the user sets the interception element of the application 1 in the mode 2:
[0309] like Fig. 10B As shown, after registering the interception information, the specific process of the electronic device 100 executing the mode switching method may include the following steps:
[0310] S1011 , application 1 detects that the usage mode switches from mode 1 to mode 2 .
[0311] The specific content of step S1011 can refer to the above Fig. 6A The relevant description in step S602 is shown.
[0312] S1012, application 1 receives an operation from a user to open interface 1 in application 1.
[0313] In some embodiments, the user opens the interface 1 in the application 1, which can be a click operation of the user on the icon of the application 1, for example, Figure 4H In the illustrated embodiment, the user clicks on the learning tutoring application diagram, etc.
[0314] In other embodiments, interface 1 may also be another interface in application 1 other than the main interface. For example, interface 1 may be triggered for display by a control in application 1. At this time, the user's operation of opening interface 1 may also be the user's operation on the control, and so on.
[0315] S1013, application 1 sends a request to view module 14 to obtain interception information of application 1 in mode 2.
[0316] In response to the user opening the interface 1 in the application 1 , after determining that the usage mode of the application 1 is mode 2 , the application 1 may send a obtaining request to the view module 14 .
[0317] The acquisition request may include the identifier of application 1, and optionally, may also include the usage mode of application 1. The acquisition request may be used to request to obtain the interception information of application 1 in mode 2.
[0318] In some other embodiments, the acquisition request may further include an identifier of interface 1 , for requesting to obtain interception information of interface 1 of application 1 in mode 2 .
[0319] S1014, view module 14 sends interception information of application 1 in mode 2 to application 1.
[0320] In some embodiments, if the acquisition request includes the identifier of interface 1, view module 14 can send interception information of interface 1 in mode 2 to application 1.
[0321] In some other embodiments, the view module 14 may also send the interception information of the application 1 in mode 2 to the application 1, including the identifiers of all interception elements in the application 1 in mode 2.
[0322] S1015, application 1 displays interface 2 based on the interception information, and interface 2 does not include the interception element indicated by the interception information.
[0323] Interface 2 is the interface corresponding to interface 1 in mode 2.
[0324] For example, the interface 2 may be the above Fig. 4I The learning guidance interface 450 shown can also be Figure 4JThe learning guidance interface 460 shown can also be Figure 4K to Figure 4L The learning guidance interface 470 in the illustrated embodiment, etc.
[0325] By adopting the method for setting the interception element provided in the embodiment of the present application, based on the interception element set by the user, when the usage mode of application 1 is mode 2, it is determined to block the interception element. In this way, the interception element can be set in combination with the security level of the interface element and the actual needs of the user, thereby increasing the flexibility of the method.
[0326] The following describes a method for determining the security level of an interface element provided by an embodiment of the present application.
[0327] like Fig.11 As shown, a specific process for determining the security level of an interface element in interface 1 provided in an embodiment of the present application may include the following steps:
[0328] S1101 , the identification module 13 determines the code segment X1 of the target element from the interface code 1 .
[0329] The target element may be any interface element in interface 1. The target element corresponds to code segment X1 in interface code 1.
[0330] S1102, the identification module 13 determines the class corresponding to the target element based on the code segment X1.
[0331] The code segment X1 includes the class corresponding to the target element, and the identification module 13 can obtain the class corresponding to the target element from the code segment X1.
[0332] For more information about the class corresponding to the target element, please refer to the above Fig. 6A The relevant description in step S604 is shown.
[0333] S1103, the identification module 13 determines whether the class corresponding to the target element belongs to the specified class.
[0334] In some embodiments, the specified class may include any one or more of the following: surfaceview, videoview, webview, audioTrack, etc. The classes included in the specified class may be the same as those described above. Fig. 6A The predetermined classes in the illustrated embodiment overlap partially (or completely).
[0335] In other embodiments, the specified class may also include more, fewer or different classes from the above embodiments, and this application does not limit this.
[0336] If the recognition module 13 determines that the class corresponding to the target element belongs to the specified class, the following step S1107 may be executed to determine that the security level of the target element is dangerous.
[0337] If the recognition module 13 determines that the class corresponding to the target element does not belong to the specified class, the following step S1104 or step S1105 may be executed.
[0338] S1104, the recognition module 13 determines whether the target element includes a blocked word based on the text content in the code segment X1.
[0339] Step S1104 is an optional step.
[0340] In some embodiments, text may be displayed in the target element, and in this case, the code segment X1 may include text content. The recognition module 13 may obtain the text content of the target element from the code segment X1 and determine whether the target element includes a blocked word.
[0341] The recognition module 13 can determine whether the target element includes a blocked word based on a built-in text recognition algorithm. The specific determination method can refer to the above Figure 8 Related description in the illustrated embodiment.
[0342] If the recognition module 13 determines that the target element includes a blocked word, the following step S1107 may be executed to determine that the security level of the target element is dangerous.
[0343] If the recognition module 13 determines that the target element does not include a blocked word, the following step S1105 may be executed.
[0344] S1105, the identification module 13 obtains the content of the target element based on the code segment X1 and the class corresponding to the target element.
[0345] The specific content of step S1105 can refer to the above Fig. 6A The relevant description in step S604 in the illustrated embodiment.
[0346] S1106 , the identification module 13 determines whether the target element includes shielded content corresponding to mode 2 based on the content of the target element.
[0347] The specific content of step S1106 can refer to the above Fig. 6A The relevant description in step S605 in the illustrated embodiment.
[0348] If the recognition module 13 determines that the target element includes the shielded content corresponding to mode 2, the following step S1107 may be executed to determine that the security level of the target element is dangerous.
[0349] If the recognition module 13 determines that the target element does not include the shielded content corresponding to mode 2, the following step S1108 may be executed.
[0350] S1107, the identification module 13 determines that the safety level of the interface element is dangerous.
[0351] S1108, the identification module 13 determines whether the security level of the interface element is safe or general.
[0352] In some embodiments, the identification module 13 may also score the content of the target element during the execution of step S1106, and determine the security level of the interface element (e.g., safe, general, dangerous, etc.) based on the score and the thresholds corresponding to different security levels. This application does not limit this.
[0353] use Fig.11 In the method of determining the security level of the target element shown, the identification module 13 can sequentially take multiple interface elements (or each interface element) in the interface code 1 as the target element to determine the security level of the multiple interface elements.
[0354] In some embodiments, after application 1 switches from mode 1 to mode 2, application 1 may display interface 2 of application 1 based on file 2 corresponding to mode 2 and interception information registered by view module 14 .
[0355] Fig. 12A A flow chart of a method for setting an interception element provided in an embodiment of the present application is shown.
[0356] like Fig. 12A As shown, the electronic device 100 may include a setting application 11, an accessibility framework 12, an identification module 13 and a view module 14. A specific process of setting an interface element that needs to be shielded in mode 2 of the setting application 1 provided in an embodiment of the present application may include the following steps:
[0357] S1201, setting application 11 to display one or more application icons, including the icon of application 1.
[0358] S1202, setting application 11 detects the user's operation on the icon of application 1, and obtains interface code 1 of interface 1 in application 1 in file 2, where interface code 1 includes code segments corresponding to all interface elements in interface 1.
[0359] S1203 , the configuration application 11 sends the interface code 1 to the accessibility framework 12 .
[0360] The specific contents of steps S1201 to S1203 can refer to the above Fig. 10A The relevant description of step S1001 to step S1003 is shown. Among them, the relevant description of file 2 can refer to the above FIG. 6A to FIG. 6C Related description in the illustrated embodiment.
[0361] S1204 , the barrier-free framework 12 determines that the security level of the marked element is safe based on the interface code 1 , and the marked element is the interface element containing the mode tag in the code segment.
[0362] The relevant content of the mode tag can refer to the above Fig. 6A The relevant description in step S602 is shown.
[0363] The barrier-free framework 12 can determine, based on the interface code 1 , that the interface elements in the code segment that contain a mode tag are marked elements, and determine that the interface elements in the code segment that do not contain a mode tag are unmarked elements.
[0364] S1205 , the accessibility framework 12 sends the security level of the marked element to the setting application 11 .
[0365] The accessibility framework 12 may send the identity and safety level of the marked element to the settings application 11 .
[0366] S1206 , the barrier-free framework 12 sends the code segment of the unmarked element to the identification module 13 , where the unmarked element is an interface element that does not contain a mode tag in the code segment.
[0367] S1207, the identification module 13 determines the security level of the unmarked element.
[0368] The specific process of step S1207 can refer to the above Fig. 10A The relevant description of step S1005 shown in FIG. Fig.11 Relevant content of the illustrated embodiment.
[0369] S1208 , the identification module 13 sends the security level of the unmarked element to the setting application 11 .
[0370] After determining the security level of the unmarked interface element, the identification module 13 may send the identification and security level of the unmarked interface element to the setting application 11 .
[0371] S1209, setting the configuration interface of the display interface 1 of the application 11, wherein the configuration interface displays security level identifiers of multiple interface elements.
[0372] The multiple interface elements may include marked elements with security levels received by the setting application 11 in step S1205, and unmarked interface elements with security levels received by the setting application 11 in step S1208.
[0373] For more information on security level identification, please refer to the above Fig. 10A The relevant description of step S1007 is shown.
[0374] S1210, the setting application 11 detects a user selection operation on one or more interface elements in the configuration interface, determines that the one or more interface elements are interception elements, and displays a selection mark on the interception elements.
[0375] S1211 , the setting application 11 sends the identifier of the interception element to the view module 14 .
[0376] S1212, the view module 14 registers and stores the interception information of the application 1, including the identifier of the interception element and the identifier of the application 1.
[0377] For the relevant contents of step S1210 to step S1212, please refer to the above Fig. 10A The relevant contents of step S1008 to step S1010 are shown.
[0378] Fig. 12B The specific process of the mode switching method executed by the electronic device 100 is shown after the user sets the interception element of the application 1 in the mode 2:
[0379] like Fig. 12B As shown, after registering the interception information, the specific process of the electronic device 100 executing the mode switching method may include the following steps:
[0380] S1213 , application 1 detects that the usage mode is switched from mode 1 to mode 2 .
[0381] S1214, application 1 receives the user's operation of opening interface 1 in application 1.
[0382] S1215, application 1 sends a request to view module 14 to obtain interception information of application 1 in mode 2.
[0383] S1216, view module 14 sends interception information of application 1 in mode 2 to application 1.
[0384] The specific contents of steps S1213 to S1216 can refer to the above Fig. 10B The relevant descriptions of steps S1011 to S1014 are shown.
[0385] S1217, application 1 obtains the content of the marked element based on file 2.
[0386] The method for applying 1 to obtain the content of the marked element can refer to the above Fig. 6A The relevant description in step 604 is shown.
[0387] S1218 , application 1 sends the content of the marked element to recognition module 13 .
[0388] S1219, the identification module 13 determines the shielding element based on the content of the marked element, where the shielding element is one or more interface elements that need to be shielded in the marked element in mode 2.
[0389] The specific method for the identification module 13 to determine whether the marked element is a shielding element can refer to the above Fig. 6A The relevant description in step S605 is shown.
[0390] S1220 , the identification module 13 sends the identifier of the shielding element to the application 1 .
[0391] S1221, application 1 displays interface 2 corresponding to interface 1 in mode 2, and interface 2 does not include intercepting elements and shielding elements.
[0392] By adopting the method for setting the interception element provided in the embodiment of the present application, not only the interception elements set by the user can be shielded, but also the shielding elements recognized by the electronic device 100 can be shielded.
[0393] In some other embodiments, in addition to Mode 1 and Mode 2, Application 1 may also include one or more other usage modes (e.g., Mode 3), and users may also use the same usage modes as above. Fig. 10A or Fig. 12A The setting application 1 intercepts the element in mode 3 in the manner shown. It should be noted that in this case, the setting application 11 can determine the usage mode corresponding to the interception element set by the user based on the operation of the user selecting the usage mode, and register and store the usage mode together with the identifier of the interception element in the view module 14. Accordingly, in this case, Fig. 10B or Fig. 12B In the illustrated embodiment, the acquisition request sent by application 1 to view module 14 may include the current usage mode of application 1 .
[0394] The following introduces the functional modules of an electronic device 100 provided in an embodiment of the present application.
[0395] like Fig.13 As shown, the electronic device 100 may include an application 1, a setting application 11, an accessibility framework 12, an identification module 13, and a view module 14. Optionally, the electronic device 100 may also include one or more other applications.
[0396] Among them, application 1 can be application 1 in the above embodiment, and application 1 can be a self-developed application or a third-party application.
[0397] The setting application 11 may be the above FIG. 10A to FIG. 12BThe setting application 11 in the illustrated embodiment can be used to receive and, in response to a user's operation of configuring the application 1 (or other applications), configure the interception elements of the application 1 in mode 2 (or other modes).
[0398] The accessibility framework 12 may be used to identify interface elements that include mode tags and determine the safety level of these interface elements.
[0399] The recognition module 13 may have one or more recognition algorithms built in, which are used to recognize the content of the interface element and determine whether the interface element is a shielding element or an intercepting element.
[0400] The view module 14 may be used to register and store the interception information of the application 1 in mode 2. In some embodiments, the view module 14 may also be used to register and store the interception information of different applications in different modes.
[0401] The specific functions of the above modules can also refer to the above FIG. 10A to FIG. 12B The relevant description in the illustrated embodiment will not be repeated here.
[0402] Understandably, Fig.13 The illustrated embodiment is merely an example. In the embodiments of the present application, the electronic device 100 may further include more, fewer, or different functional modules from those in the above embodiments, or split the above one functional module into multiple functional modules, or merge the above multiple functional modules into one functional module. The present application does not make any limitation on this.
[0403] The following describes a process of a mode switching method provided in an embodiment of the present application.
[0404] like Fig.14 As shown, the specific process of the mode switching method may include the following steps:
[0405] S1401: When the first application is in a first mode, the electronic device 100 receives a first operation for the first application.
[0406] The first application may be application 1 in the above embodiment, the first mode may be mode 1 in the above embodiment (for example, when the youth mode is not enabled, the child mode is not enabled, etc.), and the second mode may be mode 2 in the above embodiment (for example, the youth mode or the child mode, etc.). The first operation on the first application may be used to trigger the electronic device 100 to display the first interface of the first application. The first operation may be an operation of the user opening the first application (for example, a click operation on the application icon of the first application, etc.), or an operation of the user on any control in the first application.
[0407] S1402, the electronic device 100 displays a first interface of a first application based on a first file in response to a first operation, where the first interface includes a first element; the first file includes a first code segment corresponding to the first element, where the first code segment is used to indicate a content source of the first element.
[0408] The first file can be Fig. 6A In the illustrated embodiment, the first interface of the file 1 may be interface 1, the first element may be interface element 1, and the first code segment may be code segment A1. The first code segment may be used to indicate the content source of the first element, and the electronic device 100 may obtain the content source of the first element according to the first code segment, and further obtain the content of the first element.
[0409] S1403, after the first application switches from the first mode to the second mode, when the electronic device 100 determines that the first element includes blocked content based on the second file of the first interface, the first element is blocked from display in the first interface; the second file includes a second code segment corresponding to the first element, the second code segment includes the first code segment and a first tag, and the first tag is used to indicate that the electronic device recognizes whether the first element includes blocked content.
[0410] The second file can be the above Fig. 6A In the file 2 of the illustrated embodiment, the second code segment may be code segment B1, the first label may refer to a mode label, and the shielded content may be shielded content corresponding to mode 2.
[0411] In this way, after switching to the second mode, the electronic device can shield and display the first element that needs to be shielded in the second mode.
[0412] In one possible implementation, determining that the first element includes shielded content based on the second file of the first interface specifically includes: when the electronic device executes the first tag in the second code segment, obtaining the content source of the first element from the first code segment in the second code segment; obtaining the content of the first element based on the content source of the first element; and calling the first recognition algorithm to determine that the content of the first element includes shielded content.
[0413] In this way, whether to identify the content of the first element can be determined by judging whether the second code segment includes the first tag.
[0414] In a possible implementation, before determining that the first element includes blocked content according to the second file of the first interface, the method further includes: obtaining a class corresponding to the first element based on the first code segment; determining that the class corresponding to the first element belongs to a first predetermined class; and performing instrumentation on the first code segment to insert the first tag into the first code segment to obtain a second code segment. The specific method of instrumentation can refer to the above Figure 6A-Figure 7 The relevant description of the plugging in the illustrated embodiment. In this way, the second code segment can be obtained by plugging.
[0415] In a possible implementation, before determining that the first element includes blocked content according to the second file of the first interface, the method further includes: obtaining a class corresponding to the first element based on the first code segment; determining that the class corresponding to the first element belongs to a first predetermined class; and packaging the first code segment from the first format to a second code segment in a second format. The specific packaging method can refer to the above Figure 6A-Figure 7 The relevant description of encapsulation in the illustrated embodiment. In this way, the second code segment can be obtained by encapsulation.
[0416] In a possible implementation, the first interface also includes a second element, the first file also includes a third code segment corresponding to the second element; the second file also includes a fourth code segment corresponding to the second element, and the fourth code segment includes the third code segment and the first tag; after the first application switches from the first mode to the second mode, when it is determined according to the second file of the first interface that the second element does not include blocked content, the second element is displayed in the first interface. In this way, when it is determined that the second element does not include blocked content, the second element can be displayed after switching to the second mode.
[0417] In a possible implementation, the first interface further includes a third element, the first file further includes a fifth code segment corresponding to the third element; the second file further includes a sixth code segment corresponding to the third element, and the sixth code segment does not include the first tag; after the first application switches from the first mode to the second mode, the first element is displayed in the first interface according to the second file. In this way, since the sixth code segment corresponding to the third element in the second file does not include the first tag, it is not necessary to perform content recognition on the third element.
[0418] In a possible implementation, shielding the first element from being displayed in the first interface specifically includes: displaying an overlay layer on the first element of the first interface. In this way, the first element can be shielded by displaying an overlay layer on the first element.
[0419] In a possible implementation, shielding the first element from being displayed in the first interface specifically includes: not displaying the first element in the first interface. In this way, the first element can be shielded by not displaying the first element.
[0420] In a possible implementation, the first application is switched from the first mode to the second mode, specifically including: detecting a second operation of the user switching the first application from the first mode to the second mode; and switching the first application from the first mode to the second mode in response to the second operation. In this way, the use mode of the application can be switched in response to the manual operation of the user.
[0421] In a possible implementation, the first application switches from the first mode to the second mode, specifically including: detecting that the current moment belongs to a preset time period of the second mode, and switching the first application from the first mode to the second mode. In this way, the use mode of the application can also be switched based on the preset mode switching time.
[0422] In one possible implementation, the first interface also includes a fourth element; the first file includes a seventh code segment corresponding to the fourth element, the second file includes an eighth code segment corresponding to the fourth element, and the eighth code segment does not include the first tag; the method also includes: before the first application switches from the first mode to the second mode, displaying a first configuration interface of the first application, the first configuration interface including all elements in the first interface; receiving an operation by the user to block the fourth element; after the first application switches from the first mode to the second mode, blocking the display of the fourth element in the first interface.
[0423] Among them, the first configuration interface can be the above Figures 10A-12B In the configuration interface of interface 1 in the illustrated embodiment, the fourth element may be the interception element in the above-mentioned embodiment.
[0424] In this way, in response to the user's operation of shielding the fourth element, after switching to the second mode, the fourth element can be shielded from display.
[0425] In a possible implementation, the first configuration interface also includes a first level identifier of the first element and a second level identifier of the fourth element; the first level identifier is used to indicate a security level of the first element, and the second level identifier is used to indicate a security level of the third element.
[0426] The first level mark and the second level mark can be the above Figures 10A-12B Security level identification in the illustrated embodiment.
[0427] In this way, the security levels of different elements in the user interface can be indicated by level labels, making it easier for users to select elements to be blocked.
[0428] In a possible implementation, before displaying the first configuration interface, the method further includes: determining that the first level identification is safe according to the first tag in the second code segment; and calling a second recognition algorithm to determine the second level identification when the eighth code segment does not include the first tag.
[0429] In this way, the elements corresponding to the code segment that does not include the first tag can be identified and the security levels of these elements can be determined.
[0430] In one possible implementation, the second mode is a teenager mode or a child mode. In other possible implementations, the second mode may also be an elderly mode, a health management mode, or other usage modes, etc.
[0431] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0432] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0433] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0434] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A mode switching method, characterized in that: Applied to electronic equipment; the method comprises: When the first application is in the first mode, receiving a first operation for the first application; In response to the first operation, a first interface of a first application is displayed based on a first file, where the first interface includes a first element; the first file includes a first code segment corresponding to the first element, where the first code segment is used to indicate a content source of the first element; After the first application switches from the first mode to the second mode, when it is determined according to the second file of the first interface that the first element includes blocked content, blocking display of the first element in the first interface; The second file includes a second code segment corresponding to the first element, the second code segment includes the first code segment and a first tag, and the first tag is used to instruct the electronic device to identify whether the first element includes blocked content.
2. The method according to claim 1, characterized in that: The determining, according to the second file of the first interface, that the first element includes shielded content specifically includes: When the electronic device executes the first tag in the second code segment, acquiring the content source of the first element from the first code segment in the second code segment; Acquire the content of the first element according to the content source of the first element; A first recognition algorithm is called to determine that the content of the first element includes the shielded content.
3. The method according to claim 1 or 2, characterized in that: Before determining, according to the second file of the first interface, that the first element includes shielded content, the method further includes: Obtaining a class corresponding to the first element based on the first code segment; Determining that the class corresponding to the first element belongs to a first predetermined class; Perform instrumentation on the first code segment, insert the first label into the first code segment, and obtain the second code segment.
4. The method according to claim 1 or 2, characterized in that: Before determining, according to the second file of the first interface, that the first element includes shielded content, the method further includes: Obtaining a class corresponding to the first element based on the first code segment; Determining that the class corresponding to the first element belongs to a first predetermined class; The first code segment is packaged from a first format into a second code segment in a second format.
5. The method according to any one of claims 1 to 4, characterized in that The first interface further includes a second element, and the first file further includes a third code segment corresponding to the second element; the second file further includes a fourth code segment corresponding to the second element, and the fourth code segment includes the third code segment and the first label; After the first application switches from the first mode to the second mode, when it is determined according to the second file of the first interface that the second element does not include blocked content, the second element is displayed in the first interface.
6. The method according to any one of claims 1 to 5, characterized in that The first interface further includes a third element, and the first file further includes a fifth code segment corresponding to the third element; the second file further includes a sixth code segment corresponding to the third element, and the sixth code segment does not include the first tag; After the first application switches from the first mode to the second mode, the first element is displayed in the first interface according to the second file.
7. The method according to any one of claims 1 to 6, characterized in that The shielding and displaying of the first element in the first interface specifically includes: An overlay layer is displayed on the first element of the first interface.
8. The method according to any one of claims 1 to 6, characterized in that The shielding and displaying of the first element in the first interface specifically includes: The first element is not displayed on the first interface.
9. The method according to any one of claims 1 to 8, characterized in that The first application switches from the first mode to the second mode, specifically including: detecting a second operation of a user switching the first application from the first mode to a second mode; In response to the second operation, the first application is switched from the first mode to a second mode.
10. The method according to any one of claims 1 to 8, characterized in that The first application switches from the first mode to the second mode, specifically including: It is detected that the current moment belongs to a preset time period of the second mode, and the first application is switched from the first mode to the second mode.
11. The method according to any one of claims 1 to 10, characterized in that The first interface further includes a fourth element; the first file includes a seventh code segment corresponding to the fourth element, the second file includes an eighth code segment corresponding to the fourth element, and the eighth code segment does not include the first tag; the method further includes: Before the first application switches from the first mode to the second mode, displaying a first configuration interface of the first application, where the first configuration interface includes all elements of the first interface; receiving an operation of shielding the fourth element from a user; After the first application is switched from the first mode to the second mode, the fourth element is shielded from display in the first interface.
12. The method according to claim 11, characterized in that The first configuration interface also includes a first level identifier of the first element and a second level identifier of the fourth element; the first level identifier is used to indicate the security level of the first element, and the second level identifier is used to indicate the security level of the third element.
13. The method according to claim 12, characterized in that Before displaying the first configuration interface, the method further includes: determining, according to the first tag in the second code segment, that the first level is identified as safe; When the eighth code segment does not include the first tag, a second recognition algorithm is called to determine the second level identifier.
14. The method according to any one of claims 1 to 13, characterized in that The second mode is the youth mode or the child mode.
15. An electronic device, characterized in that: include: One or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in any one of claims 1 to 14.
16. A computer-readable storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 14.