CN111026462A - Applet control method, apparatus, device and medium - Google Patents

Applet control method, apparatus, device and medium Download PDF

Info

Publication number
CN111026462A
CN111026462A CN201911258916.6A CN201911258916A CN111026462A CN 111026462 A CN111026462 A CN 111026462A CN 201911258916 A CN201911258916 A CN 201911258916A CN 111026462 A CN111026462 A CN 111026462A
Authority
CN
China
Prior art keywords
applet
target
small program
host application
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911258916.6A
Other languages
Chinese (zh)
Other versions
CN111026462B (en
Inventor
王晓红
任涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911258916.6A priority Critical patent/CN111026462B/en
Publication of CN111026462A publication Critical patent/CN111026462A/en
Application granted granted Critical
Publication of CN111026462B publication Critical patent/CN111026462B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a method, a device, equipment and a medium for controlling an applet, and relates to the communication technology in the technical field of computers. The method comprises the following steps: determining whether a target applet on a host application is to be restarted; controlling the target applet to clear data and target resource data in the target applet page stack; and controlling the target applet to bind the target applet page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target applet page stack and the re-downloaded target resource data. According to the method and the device, the applet is reloaded without leaving the applet when the abnormal condition occurs in the applet running process, so that the service time of the applet is prolonged, the user retention data is increased, the white screen rate of the applet is reduced, and the user experience is improved.

Description

Applet control method, apparatus, device and medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a communication technology, and particularly relates to a method, a device, equipment and a medium for controlling an applet.
Background
The Mini Program is an application which can be used without downloading and installing, realizes the dream of 'being reachable by hands' of the application, and also embodies the concept of 'being capable of being used up and running'.
In the actual use process, various abnormal conditions inevitably occur in the small program operation process. For example, JS error, a system memory recycle causing a white screen, or triggering the applet management module to destroy a single applet causing a white screen to be opened, etc. When the small program is abnormal, the small program is normally accessed by exiting the host application and closing the small program, and then reopening the host application; or, in the using process of the applet, adding an invalid mark for the applet, and when the applet is restarted subsequently, if the invalid mark of the applet is monitored, clearing the memory data of the applet and reopening the memory data. However, the above two solutions affect the use duration of the applet and the data retained by the user, increase the white screen rate of the applet, and seriously affect the user experience.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a medium for controlling an applet, so that the applet can be reloaded without leaving the applet when an abnormal condition occurs in the running process of the applet, the service life of the applet is prolonged, user retention data are increased, the white screen rate of the applet is reduced, and user experience is improved.
In a first aspect, an embodiment of the present application provides an applet control method, including:
determining whether a target applet on a host application is to be restarted;
controlling the target applet to clear data and target resource data in a target applet page stack;
and controlling the target applet to bind the target applet page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target applet page stack and the re-downloaded target resource data.
The method and the device for restarting the target applet have the advantages that whether the target applet needs to be restarted or not on the host application is determined, if the target applet needs to be restarted, the target applet is controlled to clear data and target resource data in a target applet page stack, the target applet page stack after the data are cleared is controlled to be bound by the target applet, the target resource data are downloaded again, and the target applet is restarted through the target applet page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
In addition, according to the applet control method of the above embodiment of the present application, the following additional technical features may also be provided:
optionally, determining whether the target applet on the host application is to be restarted includes:
detecting the screen state of an applet displayed on a host application;
and if the small program is in the abnormal state of the global screen, taking the small program as a target small program to be restarted.
One embodiment in the above application has the following advantages or benefits: the method and the device establish a foundation for determining the target small program to be restarted by determining the small program with the screen state as the abnormal state of the global screen as the target small program to be restarted.
Optionally, detecting the screen state of the applet displayed on the host application includes:
acquiring an applet display graph on a host application through screen capturing operation, and determining a middle area and other areas of the applet display graph;
determining whether other color pixel points except the background color of the small program exist in the middle area;
if so, determining that the small program is not in the abnormal state of the global screen;
if not, determining whether other color pixel points except the background color of the small program exist in other areas, and determining whether the small program is in a non-global screen abnormal state according to the result.
One embodiment in the above application has the following advantages or benefits: the screen state of the applet is detected whether to be in the global screen abnormal state or not by dividing the applet display image into a plurality of areas and determining whether other color pixel points exist in the middle area, so that the detection efficiency of the screen state of the applet is improved.
Optionally, acquiring an applet display image on the host application through a screen capture operation, including:
intercepting each window picture except for a screen window from a window container list of a host application;
and generating an applet display image on the host application according to the window pictures.
One embodiment in the above application has the following advantages or benefits: the method comprises the steps of intercepting all window pictures except a screen window through screen interception operation, generating a small program display image on a host application according to all the window pictures, intercepting information such as a prompt popup window and a keyboard popup window on a small program display screen besides the screen window of the small program, and accordingly improving the detection accuracy of the small program display image in an abnormal state.
Optionally, determining whether there are pixels with other colors except for the applet background color in the middle region or the other regions includes:
determining a difference value between a channel value of a pixel point in the middle area or the other area and a channel value of an applet background color;
if the difference is smaller than the threshold value, determining that the pixel point is a background color pixel point; otherwise, determining the pixel point as other color pixel points.
One embodiment in the above application has the following advantages or benefits: based on the relationship between the difference value between the channel value of the pixel point in the middle area or other areas and the channel value of the background color of the small program and the threshold, whether the small program display image is in the abnormal state of the global screen or the abnormal state of the non-global screen is determined, so that the condition that the screen where the small program is detected is inaccurate due to the color difference existing in the screen capturing of part of models is avoided, the introduction of the error threshold is realized, and the detection accuracy of the abnormal state of the small program display image is improved.
Optionally, detecting the screen state of the applet displayed on the host application includes:
acquiring an applet displayed on a host application, and determining whether the host application enters a secondary page of the applet;
and if so, determining that the small program is not in the global screen abnormal state.
One embodiment in the above application has the following advantages or benefits: when the host application enters a secondary page of the small program displayed by the host application, the small program is determined not to be in the global screen abnormal state, so that the detection flow of the screen state of the small program is optimized.
Optionally, determining whether the target applet on the host application is to be restarted includes:
if any applet on the host application monitors a restart event, taking the applet as a target applet to be restarted;
the restarting event is generated when a triggering operation acting on a restarting control in the small program is detected; or upon detecting a startup failure of any applet on the host application.
Optionally, determining whether the target applet on the host application is to be restarted includes:
if any small program on the host application detects a resource updating event, taking the small program as a target small program to be restarted;
and the resource updating event is generated according to the resource data issued through the small program resource updating interface.
Optionally, determining whether the target applet on the host application is to be restarted includes:
and if the host application is switched to any applet and the applet page stack exists, taking the applet as a target applet to be restarted.
One embodiment in the above application has the following advantages or benefits: the target small program to be restarted on the host application is determined in different modes, so that the diversity of the target small program to be restarted is improved.
Optionally, controlling the target applet to bind the target applet page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target applet page stack and the re-downloaded target resource data, including:
controlling the target applet to bind the target applet page stack after the data is cleared through an applet creating instruction;
and controlling the target applet to download the target resource data again through an applet restarting instruction, displaying the target resource data downloading progress through the bound target applet page stack, and restarting the target applet according to the downloaded target resource data.
One embodiment in the above application has the following advantages or benefits: the target applet page stack after the data are cleared is bound through controlling the target applet so as to obtain the starting data of the target applet, and the target applet is re-created and loaded based on the starting data, so that the target applet is restarted in the running process of the applet, and the user experience is improved.
Optionally, the method further includes:
and adding a probe for the target applet in the restarting process of the target applet, and acquiring the running data of the target applet after the target applet is restarted.
One embodiment in the above application has the following advantages or benefits: the probe is added to the target small program to collect the operation data of the target small program, so that the abnormal source of the target small program is positioned according to the operation data, and conditions are provided for repairing the abnormality.
Optionally, after detecting the screen state of the applet displayed on the host application, the method further includes:
and if the small program displayed on the host application is in a local screen abnormal state, controlling to clear the webpage view of the small program, reestablish the webpage view and bind the small program.
One embodiment in the above application has the following advantages or benefits: when the small program is determined to be in the abnormal state of the local screen, the small program is rebuilt and bound, so that the abnormal situation can be eliminated only by regenerating the webpage view without restarting the small program.
In a second aspect, an embodiment of the present application further discloses an applet control apparatus, including:
the determining module is used for determining whether the target applet needs to be restarted or not on the host application;
the first control module is used for controlling the target applet to clear data and target resource data in a target applet page stack;
and the second control module is used for controlling the target applet to bind the page stack of the removed data, re-download the target resource data and restart the target applet through the page stack of the target applet and the re-downloaded target resource data.
In a third aspect, an embodiment of the present application further discloses an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the applet control method according to any one of the embodiments.
In a fourth aspect, embodiments of the present application further disclose a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the applet control method according to any one of the embodiments of the present application.
Other effects of the above-described alternative will be described below with reference to specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
fig. 1 is a schematic flowchart of an applet control method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of another applet control method provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of an applet display sliced into multiple regions of the same scale provided by an embodiment of the application;
FIG. 4 is a schematic flow chart illustrating another applet control method provided in an embodiment of the present application;
FIG. 5 is a flow chart illustrating a further method for applet control provided in an embodiment of the present application;
FIG. 6 is a flow chart illustrating a further method for applet control provided in an embodiment of the present application;
FIG. 7 is a schematic structural diagram of an applet control device provided in an embodiment of the present application;
FIG. 8 is a schematic structural diagram of another small program control device provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The embodiment of the application aims at the problems that in the related technology, when the small program is abnormal in the running process, the small program is closed by exiting the host application, and then the host application is opened again to enter the small program; or, in the using process of the applet, adding an invalid mark to the applet, and when the applet is restarted subsequently, if the invalid mark of the applet is monitored, clearing the memory data of the applet and reopening the memory data, which affects the using time of the applet and the data retained by a user, increases the white screen rate of the applet and seriously affects the user experience.
The method and the device for restarting the target applet have the advantages that whether the target applet needs to be restarted or not is determined, if yes, the target applet is controlled to clear data and target resource data in a target applet page stack, then the target applet is controlled to bind the target applet page stack after the data are cleared, the target resource data are downloaded again, and the target applet is restarted through the target applet page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
Hereinafter, a method, an apparatus, a device, and a medium for controlling an applet according to embodiments of the present application will be described in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of an applet control method provided in an embodiment of the present application, where the applet control method is applicable to a restart situation during an applet running process, and the method may be executed by an applet control apparatus, where the apparatus is provided with an applet management system, the applet management system includes a host application, an applet management tool, an applet and a navigation stack including different applet page stacks, and the apparatus may be implemented by software and/or hardware, and may be integrated inside an electronic device. In the present embodiment, the electronic device may be any hardware device having a data processing function. The method comprises the following steps:
and S101, determining whether the target applet needs to be restarted or not on the host application.
In the embodiment of the application, the host application refers to an application providing a running environment for the applet, so that the applet runs on the electronic device depending on the host application. Wherein the host application is, for example, hundreds of mobile phones. Wherein the electronic device may be, but is not limited to: smart phones, tablet computers, personal digital assistants, smart home devices, wearable devices, and the like. Wherein, intelligent house includes: smart televisions, etc.; the wearable device includes: smart band, smart watch, etc.
Wherein, a host application can run a plurality of small programs. For example, applet Y1 and applet Y2 are run in host application XX 1.
Illustratively, whether a target applet is to be restarted on a host application may be determined as follows.
The first method is as follows: the method comprises the steps that the screen state of an applet displayed on a host application is detected, and when the screen state of the applet is a global screen abnormal state, a target applet to be restarted on the host application is determined;
in this embodiment, the screen state of the applet shown on the host application is detected by an applet management tool in the applet management system to determine whether the target applet on the host application is to be restarted.
The target small program to be restarted is the small program with the screen state in the global screen abnormal state.
For example, if the screen state of the applet a is the global screen abnormal state, the applet a is determined as the target applet to be restarted.
The second method comprises the following steps: when any applet on the host application detects a restart event, determining a target applet to be restarted on the host application;
the target applet to be restarted is the applet with the restart event detected.
For example, if the applet b detects a restart event, the applet b is determined as a target applet to be restarted.
It should be noted that, in this embodiment, when any applet on the host application detects a restart event, the applet sends the restart event to the applet management tool, so that the applet management tool determines a target applet to be restarted on the host application.
The third method comprises the following steps: when any small program on the host application detects a resource updating event, determining a target small program to be restarted on the host application;
the target applet to be restarted is the applet which detects the resource update event.
For example, if the applet c detects a resource update event, the applet c is determined as the target applet to be restarted.
The method is as follows: and when the host application is switched to any applet and the applet page stack exists, determining a target applet to be restarted on the host application.
In this embodiment, the applet management tool in the applet management system detects that the host application is switched to any applet, and determines a target applet to be restarted on the host application when the applet page stack exists.
The target applet to be restarted is the applet with the existing page stack.
For example, the host application switches from applet e to applet d, and the page stack of applet d is already in existence, at which time applet d is determined to be the target applet to be restarted.
It should be noted that, the above four implementation manners of determining whether the target applet on the host application is to be restarted are only used as exemplary illustrations of the embodiments of the present application, and are not used as specific limitations of the present application.
And S102, controlling the target small program to clear data and target resource data in the page stack of the target small program.
S103, controlling the target applet to bind the target applet page stack after the data are cleared, re-downloading the target resource data, and restarting the target applet through the target applet page stack and the re-downloaded target resource data.
In the embodiment of the application, the data in the page stack of the target applet refers to other data except the starting data of the target applet; the target resource data refers to a local resource file of the target applet. The starting data of the applet refers to data required when the applet is started, and may include an applet id, a source applet id for opening the applet, source applet page data, an applet initial page parameter, and the like.
In the embodiment of the application, the applet page stack and the applet run relatively independently, and the applet page stack is stored in the navigation stack, so that after the target applet is controlled to clear other data and local resource files, except the starting data of the target applet, in the target applet page stack, the starting data of the target applet also exists in the target applet page stack of the navigation stack, and therefore the target applet can also recreate a new target applet based on the starting data in the target applet page stack after the data is cleared.
Illustratively, after the control target applet clears the data and the target resource data in the target applet page stack, the control target applet binds the target applet page stack after clearing the data to obtain the startup data, and downloads the target resource data again. And then, restarting the target applet according to the starting data in the target applet page stack after the data are bound and the downloaded target resource data.
During specific implementation, an applet creating instruction can be used for controlling the target applet to bind the target applet page stack after data clearing;
and controlling the target applet to download the target resource data again through an applet restarting instruction, displaying the target resource data downloading progress through the bound target applet page stack, and restarting the target applet according to the downloaded target resource data.
The target resource data downloading progress is displayed through the target applet page stack, so that a user can visually see the target resource data downloading condition of the target applet, and the user experience is further improved.
It should be noted that, in the embodiment of the present application, the applet creating instruction and the applet restarting instruction are triggered and generated by an applet management tool in the applet management system.
According to the technical scheme provided by the embodiment of the application, whether the target applet needs to be restarted or not is determined on the host application, if the target applet needs to be restarted, the target applet is controlled to clear data and target resource data in a target applet page stack, the target applet page stack after the data are cleared is controlled to be bound by the target applet, the target resource data are downloaded again, and the target applet is restarted through the target applet page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
On the basis of the above embodiment, S103 is followed by:
and adding a probe for the target applet in the restarting process of the target applet, and acquiring the running data of the target applet after the target applet is restarted.
According to the method and the device, the probe is added to the target applet to acquire the running data of the target applet, so that the abnormal source of the target applet is positioned according to the running data, and conditions are provided for repairing the abnormality.
As can be seen from the above description, in the embodiment of the present application, when a target applet to be restarted on a host application is determined, the target applet is controlled to bind the target applet page stack after data is cleared, and target resource data is downloaded again, so that the target applet is restarted through the target applet page stack and the downloaded target resource data.
In one implementation scenario, determining whether a target applet on a host application is to be restarted includes: and detecting the screen state of the small program displayed on the host application, if the small program is in the abnormal state of the global screen, taking the small program as a target small program to be restarted, and restarting the target small program. The determination of the target applet to be restarted and restarting the target applet will now be described with reference to fig. 2.
As shown in fig. 2, the method may include:
s201, detecting the screen state of the applet displayed on the host application.
Optionally, the applet display image on the host application may be acquired through screen capture operation, and a middle area and other areas of the applet display image are determined; then determining whether other color pixel points except the background color of the small program exist in the middle area; if so, determining that the small program is not in the abnormal state of the global screen; otherwise, further determining whether other color pixel points except the background color of the small program exist in other areas of the small program display image, and determining whether the small program is in a non-global screen abnormal state according to the result.
The method for acquiring the applet display image on the host application through screen capture operation specifically comprises the following steps: intercepting each window picture except for a screen window from a window container list of a host application; and generating an applet display image on the host application according to the window pictures.
In the embodiment of the application, the screen capture operation specifically refers to a screen capture mode of windows, so as to capture other window pictures except the applet screen window, for example, a keyboard popup, a prompt popup, and the like. Therefore, the problem that when the small program display image is captured in the conventional webpage view screen capturing mode, other window images except the small program screen window cannot be captured, and the detection accuracy of the screen state where the small program display image is located is low is solved.
Illustratively, the acquisition of the applet display image on the host application by using windows screenshot is realized as follows:
// intercepting picture by intercepting windows
Figure BDA0002311066040000111
Figure BDA0002311066040000121
After acquiring the applet display image on the host application, existing solutions typically traverse the entire applet display image to determine whether the applet is in a global screen exception state. However, since the main content of a general applet is in the exact center of the screen, there is a high probability that the edge is a white screen (background color of the applet). Therefore, if the entire display screen is traversed from the (0,0) point, the pixel points at the start position are substantially white, which makes the detection inefficient.
Based on this, after the applet display image on the host application is acquired, the applet display image can be divided into a plurality of regions by using a preset rule, and then whether pixel points with other colors except the applet background color exist in the middle region is preferentially determined, so that the detection efficiency of the screen state of the applet is improved.
The preset rule can be set according to actual needs, and is not limited here. For example, if the applet display is divided into 3 parts in the horizontal direction (i.e., the lateral direction), the area corresponding to the second position (2/3) is used as the middle area, and the areas corresponding to the first position and the third position (1/3 and 3/3) are used as the other areas; for another example, if the applet display is divided into 5 pieces in the horizontal direction (i.e., the lateral direction), the area corresponding to the position 3/5 is used as the middle area, and the areas corresponding to the positions 1/5, 2/5, 4/5, and 5/5 are used as the other areas.
Assuming that the applet display is split into 5 parts, the implementation code may be as follows:
// detection zone is an image of 1/5 width in the middle of the screenshot (3 pixels are reserved to prevent black edges from affecting detection)
CGRect rect=CGRectMake(snapshot.size.width/5*2,3,
snapshot.size.width/5,
snapshot.size.height-6);
Further, after determining the middle area and other areas of the small program display image, it can be preferentially judged whether pixels in the middle area have pixels with other colors except the background color (white pixels) of the small program; if the small program exists, determining that the small program is not in the global screen abnormal state; if not, further determining whether other color pixel points except the background color of the applet exist in other areas; if other color pixel points except the background color of the small program exist in other areas, determining that the small program is in a non-global screen abnormal state; and if no pixel points with other colors except the background color of the small program exist in other regions, determining that the small program is in the abnormal state of the global screen.
In a specific implementation, whether the pixel values of other colors except the background color of the applet exist in the middle area or other areas can be determined in the following way;
and comparing the pixel values of the pixel points in the middle area or the pixel points in other areas with the pixel values of the pixel points in the background color of the small program to determine whether the pixel points in the middle area or other areas have other colors except the background color of the small program.
For example, if the pixel value of a pixel in the background color of the applet is 255, and the pixel value of any pixel in the middle area is not 255, it is determined that there are pixels in other colors except for the background color of the applet in the middle area.
In the actual use process, chromatic aberration exists during screenshot of part of models, so that errors exist when whether pixels with other colors except the background color of the applet exist in the middle area or other areas or not is determined. Therefore, in the embodiment of the application, in order to avoid chromatic aberration in partial machine type screenshot, an error threshold is introduced to determine a difference value between a channel pixel value of each pixel point in a middle area or other areas and a channel value of a background color of the applet. And then, comparing the difference value with an error threshold value, and determining whether each pixel point in the middle area or other areas is a background color pixel point or other color pixel points.
During specific implementation, determining whether there are pixels of other colors except the applet background color in the middle region or the other regions includes:
determining a difference value between a channel value of a pixel point in the middle area or the other area and a channel value of an applet background color;
if the difference is smaller than the threshold value, determining that the pixel point is a background color pixel point; otherwise, determining the pixel point as other color pixel points.
In the embodiment of the present application, the channel value of the pixel point is specifically RGBA. Where RGBA is a color space representing Red (Red) Green (Green) Blue (Blue) and Alpha (transparency).
Wherein the threshold is an error threshold. In the present embodiment, the threshold value may be set to a value smaller than 1.
That is, the difference between the four channel values of each pixel point in the middle area or other areas and the four channel values of the background color of the applet is made, and if the difference value of any one channel in each pixel point is greater than the threshold value, the pixel point in the middle area or other areas is determined to be a pixel point with other colors; and if the difference values of the four channels in each pixel point are smaller than the threshold value, determining the pixel point in the middle area or other areas as a background color pixel point.
In the embodiment, by introducing the error threshold, the accuracy of determining whether the pixel points of other colors except the background color of the applet exist in the middle area or other areas is higher.
For example, assuming that the threshold is 1, the channel value of any pixel point in the middle region is as shown in table 1, and the channel value of the applet background color is as shown in table 2, it is determined that the difference between the channel value of the pixel point in the middle region and the channel value of the applet background color is as shown in table 3 below; then, the difference value of each channel in table 3 is compared with the threshold value 1 to determine that the pixel point in the middle area is a pixel point of other colors.
TABLE 1
R 255
G 221
B 227
A 178
TABLE 2
R 255
G 255
B 255
A 255
TABLE 3
R |255-255|=0 0<1
G |221-255|=34 34>1
B |227-255|=28 28>1
A |178-255|=77 77>1
It should be noted that if the applet background color is non-white, e.g., blue, then it is not white or blue. That is, the pixel values of the channels of the pixel points in the screenshot are compared with the pixel values of the blue channels, and whether the scene is an abnormal screen scene is determined.
In another embodiment of the present application, detecting a screen state of an applet displayed in a host application further includes:
acquiring an applet displayed on a host application, and determining whether the host application enters a secondary page of the applet;
and if so, determining that the small program is not in the global screen abnormal state.
That is, when the applet page identifier displayed on the host application is changed into the second-level page identifier, it indicates that the user enters the second-level page of the applet in the applet opening process, and at this time, the applet is not a white screen, and the global screen abnormal state detection is ended. The applet page identifier and the second level page identifier may refer to information, such as an ID, capable of uniquely determining the page identity.
S202, if the small program is in the abnormal state of the global screen, the small program is taken as a target small program to be restarted.
For example, when it is determined that the screen state of the applet shown on the host application is the global screen abnormal state, it indicates that an abnormality occurs in the applet in the running process, and at this time, the applet may be used as a target applet to be restarted to restart the applet.
S203, controlling the target applet to clear the data in the target program page stack and the target resource data.
And S204, controlling the target applet to bind the target program page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target program page stack and the re-downloaded target resource data.
The implementation processes and principles of S203-S204 are similar to those of S102-S103 in the above embodiments, and refer to the implementation processes in the above embodiments specifically, which are not described herein in detail.
According to the technical scheme provided by the embodiment of the application, whether the small program is the target small program to be restarted is determined by detecting the screen state of the small program displayed on the host application, if yes, the target small program is controlled to clear data and target resource data in a target small program page stack, the target small program is controlled to bind the target small program page stack after the data are cleared, the target resource data are downloaded again, and the target small program is restarted through the target small program page stack and the downloaded target resource data. Therefore, an effective restarting mechanism is set for the small program, so that the small program can be automatically restarted when the small program is abnormal in the running process, and the running stability of the small program is improved.
On the basis of the above embodiment, S201 is followed by:
and if the small program displayed on the host application is in a local screen abnormal state, controlling to clear the webpage view of the small program, reestablish the webpage view and bind the small program.
For example, after acquiring an applet display diagram on a host application, in the embodiment of the present application, the applet display diagram may be further split into a plurality of regions with the same scale (specifically, as shown in fig. 3), and then whether each region is a pure color is detected, and whether a proportion of the pure color region to all the regions exceeds a proportion threshold is determined, so as to determine whether the applet is in a local screen abnormal state. When the pure color area proportion exceeds the proportion threshold, the small program is in a local screen abnormal state, otherwise, the small program is not in the local screen abnormal state. And determining whether each region is pure color or not, and judging whether the color of each region is the same as that of the next pixel point or not by scanning pixel points one by one.
The ratio threshold may be adaptively set according to actual needs, and is not specifically limited here, for example, 0.5.
In the embodiment of the application, when it is determined that the applet displayed on the host application is in the local screen abnormal state, it is indicated that the webpage view (applet page stack) of the applet is destroyed by the applet management system, but the applet is not destroyed, at this time, the control is performed to eliminate the abnormal webpage view of the applet, and to recreate the webpage view and bind the applet.
That is to say, when the webpage view of the applet is abnormal, the applet does not need to be restarted, and the normal state can be recovered only by regenerating the webpage view, so that the pertinence of abnormal processing of the applet in the running process is improved, and the user experience is further improved.
In another implementation scenario, determining whether a target applet on a host application is to be restarted further comprises: and if any applet on the host application monitors a restart event, taking the applet as a target applet to be restarted, and restarting the target applet. The determination of the target applet to be restarted and restarting the target applet will now be described with reference to fig. 4. As shown in fig. 4, the method may include:
s401, if any applet on the host application monitors a restarting event, the applet is used as a target applet to be restarted.
The restarting event is generated when a triggering operation acting on a restarting control in the small program is detected; or upon detecting a startup failure of any applet on the host application.
In the embodiment of the present application, the restart event is generated when the startup failure of any applet on the host application is detected, which may mean that a restart event is automatically generated when the exception of any applet is detected in the applet switching process on the host application; or, the host application generates a restart event when entering any applet in the netless state.
Any small program exception may be the small program exception caused by the exception of the host application; alternatively, it may be the memory management mechanism of the host application, such as when more than 5 applets are opened, the previous applet is cleared, and the exception occurs in the applet that has been unloaded by the level one return.
The triggering operation applied to the restart control in the applet may be a triggering operation in which the user manually triggers the restart control in the applet menu bar when an exception occurs in the applet running process.
S402, controlling the target applet to clear data and target resource data in the target program page stack.
And S403, controlling the target applet to bind the target program page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target program page stack and the re-downloaded target resource data.
The implementation process and principle of S402-S403 are similar to those of S102-S103 in the above embodiment, and refer to the implementation process of the above embodiment specifically, which is not described herein in detail.
According to the technical scheme provided by the embodiment of the application, the small program with the detected restart event is used as the target small program to be restarted, so that the target small program is controlled to clear data and target resource data in a target small program page stack, the target small program page stack after the data are cleared is controlled to be bound, the target resource data are downloaded again, and the target small program is restarted through the target small program page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
In yet another implementation scenario, determining whether an applet on a host application has a target applet to restart further comprises: and if any small program on the host application detects a resource updating event, taking the small program as a target small program to be restarted, and restarting the target small program. The determination of the target applet to be restarted and restarting the target applet will now be described with reference to fig. 5.
As shown in fig. 5, the method may include:
s501, if any small program on the host application detects a resource updating event, the small program is used as a target small program to be restarted.
Wherein the resource update event is generated based on resource data published through the applet resource update interface.
In the actual application process, an applet developer can perform emergency repair or version update on the applet, if the applet is opened by a user currently, the applet cannot be directly updated, so that the developer cannot directly perceive the problem in emergency repair or update the version, and the updated content can be seen only when the applet exits and then enters again, so that the applet update is not real-time.
Therefore, the method and the device have the advantages that the small program package is directly updated through the exposed resource updating interface of the small program, the small program is timely refreshed through restarting in the operation process of the small program, the small program resource data are pulled again, online problems can be timely and efficiently repaired, and therefore a user can intuitively perceive the updating of the small program when using the small program.
S502, controlling the target small program to clear data and target resource data in the target program page stack.
And S503, controlling the target applet to bind the target program page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target program page stack and the re-downloaded target resource data.
The implementation processes and principles of S502-S503 are similar to those of S102-S103 in the above embodiments, and refer to the implementation processes in the above embodiments specifically, which are not described herein in detail.
According to the technical scheme provided by the embodiment of the application, in the running process of the applet, the online forced refreshing of the applet by a developer is supported, the applet resource data is pulled again, the online problem can be repaired more timely and efficiently, and a user can intuitively perceive the update of the applet when using the applet.
In yet another implementation scenario, determining whether a target applet on a host application is to be restarted further comprises: and if the host application is switched to any applet and the applet page stack exists, taking the applet as a target applet to be restarted, and restarting the target applet. The determination of the target applet to be restarted and restarting the target applet will now be described with reference to fig. 6.
As shown in fig. 6, the method may include:
s601, if the host application is switched to any small program and the small program page stack exists, taking the small program as a target small program to be restarted.
S602, controlling the target applet to clear the data in the target program page stack and the target resource data.
S603, controlling the target applet to bind the target program page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target program page stack and the re-downloaded target resource data.
Because the applet on the host application supports the mutual switching of a plurality of applets, if the applet a is switched to the applet b and then switched from the applet b to the applet a, the page stack of the applet a already exists at the moment, and the page stacks of the two applets a exist at the moment, so that the page data have redundancy, and the data are easy to be disordered to cause the maintenance difficulty.
Therefore, in the embodiment of the application, in order to avoid redundancy of page data of the same applet, the page stack before the applet is unloaded, and the data in the page stack before the applet is cleared, so that caching of two applet data is avoided, data redundancy is reduced, memory occupation is reduced, and various problems caused by simultaneous reading and writing of data among the applets are also avoided.
The implementation processes and principles of S602-S603 are similar to those of S102-S103 in the above embodiments, and reference is specifically made to the implementation processes in the above embodiments, which are not described herein in detail.
According to the technical scheme provided by the embodiment of the application, when the host application is switched to any one applet and the applet page stack exists, the applet is used as the target applet to be restarted, so that the restart operation is performed on the applet. Therefore, the cache of two small program data is avoided, the data redundancy is reduced, the memory occupation amount is reduced, and various problems caused by simultaneous reading and writing of the data among the small program data are also avoided.
Fig. 7 is a schematic structural diagram of an applet control device according to an embodiment of the present application. The small program control device can be realized in a software and/or hardware mode and can be integrated on the electronic equipment.
As shown in fig. 7, an applet control apparatus 700 disclosed in an embodiment of the present application includes a determining module 710, a first control module 720, and a second control module 730, wherein:
a determining module 710, configured to determine whether a target applet on a host application is to be restarted;
a first control module 720, configured to control the target applet to clear data and target resource data in a target applet page stack;
the second control module 730 is configured to control the target applet to bind the page stack of the removed data, re-download the target resource data, and restart the target applet through the page stack of the target applet and the re-downloaded target resource data.
As an optional implementation form of the present application, the determining module 710 is specifically configured to:
if any applet on the host application monitors a restart event, taking the applet as a target applet to be restarted;
the restarting event is generated when a triggering operation acting on a restarting control in the small program is detected; or upon detecting a startup failure of any applet on the host application.
As an optional implementation form of the present application, the determining module 710 is specifically configured to:
if any small program on the host application detects a resource updating event, taking the small program as a target small program to be restarted;
and the resource updating event is generated according to the resource data issued through the small program resource updating interface.
As an optional implementation form of the present application, the determining module 710 is specifically configured to:
and if the host application is switched to any applet and the applet page stack exists, taking the applet as a target applet to be restarted.
As an optional implementation form of the present application, the second control module 730 is specifically configured to:
controlling the target applet to bind the target applet page stack after the data is cleared through an applet creating instruction;
and controlling the target applet to download the target resource data again through an applet restarting instruction, displaying the target resource data downloading progress through the bound target applet page stack, and restarting the target applet according to the downloaded target resource data.
As an optional implementation form of the present application, the apparatus 700 further includes: and adding a module.
The adding module is used for adding probes to the target applet in the restarting process of the target applet and is used for collecting the running data of the target applet after the target applet is restarted.
It should be noted that the foregoing explanation of the embodiment of the applet control method is also applicable to the applet control apparatus of the embodiment, and the implementation principle thereof is similar and will not be described herein again.
According to the technical scheme provided by the embodiment of the application, whether the target applet needs to be restarted or not is determined on the host application, if the target applet needs to be restarted, the target applet is controlled to clear data and target resource data in a target applet page stack, the target applet page stack after the data are cleared is controlled to be bound by the target applet, the target resource data are downloaded again, and the target applet is restarted through the target applet page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
Fig. 8 is a schematic structural diagram of an applet control device according to an embodiment of the present application. The small program control device can be realized in a software and/or hardware mode and can be integrated on the electronic equipment.
As shown in fig. 8, an applet control apparatus 700 disclosed in an embodiment of the present application includes a determining module 710, a first control module 720, and a second control module 730, wherein:
a determining module 710, configured to determine whether a target applet on a host application is to be restarted;
a first control module 720, configured to control the target applet to clear data and target resource data in a target applet page stack;
the second control module 730 is configured to control the target applet to bind the page stack of the removed data, re-download the target resource data, and restart the target applet through the page stack of the target applet and the re-downloaded target resource data.
As an optional implementation form of the present application, the determining module 710 further includes: a detection unit 7110 and a first control unit 7112.
The detecting unit 7110 is configured to detect a screen state of an applet displayed in the host application;
the first control unit 7112 is configured to, if the applet is in the global screen abnormal state, take the applet as a target applet to be restarted.
As an optional implementation form of the present application, the detecting unit 7110 is specifically configured to:
acquiring an applet display graph on a host application through screen capturing operation, and determining a middle area and other areas of the applet display graph;
determining whether other color pixel points except the background color of the small program exist in the middle area;
if so, determining that the small program is not in the abnormal state of the global screen;
if not, determining whether other color pixel points except the background color of the small program exist in other areas, and determining whether the small program is in a non-global screen abnormal state according to the result.
As an alternative implementation form of the present application, the detecting unit 7110 is further configured to:
intercepting each window picture except for a screen window from a window container list of a host application;
and generating an applet display image on the host application according to the window pictures.
As an alternative implementation form of the present application, the detecting unit 7110 is further configured to:
determining a difference value between a channel value of a pixel point in the middle area or the other area and a channel value of an applet background color;
if the difference is smaller than the threshold value, determining that the pixel point is a background color pixel point; otherwise, determining the pixel point as other color pixel points.
As an alternative implementation form of the present application, the detecting unit 7110 is further configured to:
acquiring an applet displayed on a host application, and determining whether the host application enters a secondary page of the applet;
and if so, determining that the small program is not in the global screen abnormal state.
As an optional implementation form of the present application, the determining module 710 further includes: a second control unit.
The second control unit is used for controlling to clear the webpage view of the small program, reestablish the webpage view and bind the small program if the small program displayed on the host application is in a local screen abnormal state.
It should be noted that the foregoing explanation of the embodiment of the applet control method is also applicable to the applet control apparatus of the embodiment, and the implementation principle thereof is similar and will not be described herein again.
According to the technical scheme provided by the embodiment of the application, whether the small program is the target small program to be restarted is determined by detecting the screen state of the small program displayed on the host application, if yes, the target small program is controlled to clear data and target resource data in a target small program page stack, the target small program is controlled to bind the target small program page stack after the data are cleared, the target resource data are downloaded again, and the target small program is restarted through the target small program page stack and the downloaded target resource data. Therefore, an effective restarting mechanism is set for the small program, so that the small program can be automatically restarted when the small program is abnormal in the running process, and the running stability of the small program is improved.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 9, it is a block diagram of an electronic device according to the applet control method in the embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus includes: one or more processors 901, memory 902, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 9 illustrates an example of a processor 901.
Memory 902 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the applet control method provided herein. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute the applet control method provided herein.
The memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the applet control method in the embodiments of the application (e.g., the determination module 710, the first control module 720, and the second control module 730 shown in fig. 7). The processor 901 executes various functional applications of the server and data processing, i.e., implementing the applet control method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 902.
The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device of the applet control method, and the like. Further, the memory 902 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 902 may optionally include a memory remotely located from the processor 901, and these remote memories may be connected to the electronic device of the applet control method via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the applet control method may further include: an input device 903 and an output device 904. The processor 901, the memory 902, the input device 903 and the output device 904 may be connected by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The input device 903 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device of the applet control method, such as a touch screen, keypad, mouse, track pad, touch pad, pointer stick, one or more mouse buttons, track ball, joystick, etc. input devices. The output devices 904 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme provided by the embodiment of the application, whether the target applet needs to be restarted or not is determined on the host application, if the target applet needs to be restarted, the target applet is controlled to clear data and target resource data in a target applet page stack, the target applet page stack after the data are cleared is controlled to be bound by the target applet, the target resource data are downloaded again, and the target applet is restarted through the target applet page stack and the downloaded target resource data. Therefore, when an abnormal condition occurs in the running process of the small program, the small program is reloaded without leaving the small program, so that the service time of the small program is prolonged, the user retention data is increased, the white screen rate of the small program is reduced, and the user experience is improved.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (15)

1. A method for applet control, comprising:
determining whether a target applet on a host application is to be restarted;
controlling the target applet to clear data and target resource data in a target applet page stack;
and controlling the target applet to bind the target applet page stack after the data is cleared, re-downloading the target resource data, and restarting the target applet through the target applet page stack and the re-downloaded target resource data.
2. The method of claim 1, wherein determining whether a target applet is pending for restart on a host application comprises:
detecting the screen state of an applet displayed on a host application;
and if the small program is in the abnormal state of the global screen, taking the small program as a target small program to be restarted.
3. The method of claim 2, wherein detecting a screen state of an applet exposed on the host application comprises:
acquiring an applet display graph on a host application through screen capturing operation, and determining a middle area and other areas of the applet display graph;
determining whether other color pixel points except the background color of the small program exist in the middle area;
if so, determining that the small program is not in the abnormal state of the global screen;
if not, determining whether other color pixel points except the background color of the small program exist in other areas, and determining whether the small program is in a non-global screen abnormal state according to the result.
4. The method of claim 3, wherein obtaining the applet display on the host application by a screen capture operation comprises:
intercepting each window picture except for a screen window from a window container list of a host application;
and generating an applet display image on the host application according to the window pictures.
5. The method of claim 3, wherein determining whether there are other color pixels in the middle region or the other region than the applet background color comprises:
determining a difference value between a channel value of a pixel point in the middle area or the other area and a channel value of an applet background color;
if the difference is smaller than the threshold value, determining that the pixel point is a background color pixel point; otherwise, determining the pixel point as other color pixel points.
6. The method of claim 2, wherein detecting a screen state of an applet exposed on the host application comprises:
acquiring an applet displayed on a host application, and determining whether the host application enters a secondary page of the applet;
and if so, determining that the small program is not in the global screen abnormal state.
7. The method of claim 1, wherein determining whether a target applet is pending for restart on a host application comprises:
if any applet on the host application monitors a restart event, taking the applet as a target applet to be restarted;
the restarting event is generated when a triggering operation acting on a restarting control in the small program is detected; or upon detecting a startup failure of any applet on the host application.
8. The method of claim 1, wherein determining whether a target applet is pending for restart on a host application comprises:
if any small program on the host application detects a resource updating event, taking the small program as a target small program to be restarted;
and the resource updating event is generated according to the resource data issued through the small program resource updating interface.
9. The method of claim 1, wherein determining whether a target applet is pending for restart on a host application comprises:
and if the host application is switched to any applet and the applet page stack exists, taking the applet as a target applet to be restarted.
10. The method of claim 1, wherein controlling the target applet to bind the target applet page stack after clearing the data, re-downloading the target resource data, and restarting the target applet via the target applet page stack and the re-downloaded target resource data comprises:
controlling the target applet to bind the target applet page stack after the data is cleared through an applet creating instruction;
and controlling the target applet to download the target resource data again through an applet restarting instruction, displaying the target resource data downloading progress through the bound target applet page stack, and restarting the target applet according to the downloaded target resource data.
11. The method of claim 1, further comprising:
and adding a probe for the target applet in the restarting process of the target applet, and acquiring the running data of the target applet after the target applet is restarted.
12. The method of claim 2, wherein after detecting the screen state of the applet exposed on the host application, further comprising:
and if the small program displayed on the host application is in a local screen abnormal state, controlling to clear the webpage view of the small program, reestablish the webpage view and bind the small program.
13. An applet control apparatus, comprising:
the determining module is used for determining whether the target applet needs to be restarted or not on the host application;
the first control module is used for controlling the target applet to clear data and target resource data in a target applet page stack;
and the second control module is used for controlling the target applet to bind the page stack of the removed data, re-download the target resource data and restart the target applet through the page stack of the target applet and the re-downloaded target resource data.
14. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the applet control method of any one of claims 1 to 12.
15. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the applet control method according to any one of claims 1-12.
CN201911258916.6A 2019-12-10 2019-12-10 Applet control method, device, apparatus and medium Active CN111026462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911258916.6A CN111026462B (en) 2019-12-10 2019-12-10 Applet control method, device, apparatus and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911258916.6A CN111026462B (en) 2019-12-10 2019-12-10 Applet control method, device, apparatus and medium

Publications (2)

Publication Number Publication Date
CN111026462A true CN111026462A (en) 2020-04-17
CN111026462B CN111026462B (en) 2023-08-29

Family

ID=70208504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911258916.6A Active CN111026462B (en) 2019-12-10 2019-12-10 Applet control method, device, apparatus and medium

Country Status (1)

Country Link
CN (1) CN111026462B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111654838A (en) * 2020-06-12 2020-09-11 北京百度网讯科技有限公司 Information processing method and device
CN111787088A (en) * 2020-06-28 2020-10-16 百度在线网络技术(北京)有限公司 Method and device for processing applet data
CN111782218A (en) * 2020-06-29 2020-10-16 百度在线网络技术(北京)有限公司 Applet processing method, device, equipment and storage medium
CN111858303A (en) * 2020-06-05 2020-10-30 百度在线网络技术(北京)有限公司 Method, device, equipment and medium for controlling page of applet
CN112698884A (en) * 2020-12-30 2021-04-23 北京达佳互联信息技术有限公司 Program starting method, device, system, equipment and storage medium
CN113687892A (en) * 2021-07-30 2021-11-23 阿里巴巴新加坡控股有限公司 Page processing method and device and computer program product
CN113849252A (en) * 2021-08-17 2021-12-28 支付宝(杭州)信息技术有限公司 Multi-screen display method for small program, host system supporting multi-screen display of small program and client device
CN113885967A (en) * 2021-10-22 2022-01-04 北京字跳网络技术有限公司 Method, device, equipment and medium for starting small program
CN113849252B (en) * 2021-08-17 2024-05-10 支付宝(杭州)信息技术有限公司 Small program multi-screen display method, host system supporting small program multi-screen display and client device

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1723448A (en) * 2002-11-18 2006-01-18 Arm有限公司 Secure memory for protecting against malicious programs
US20060095916A1 (en) * 2004-10-29 2006-05-04 Kyocera Corporation Mobile phone terminal, program management method, and computer program for the same
US20060195504A1 (en) * 2005-02-25 2006-08-31 Kyocera Corporation Portable terminal device, method for restoring program, method for terminating program, and computer program therefor
CN102985929A (en) * 2010-05-11 2013-03-20 杉中顺子 External boot device, external boot program, external boot method and network communication system
CN103038652A (en) * 2010-05-25 2013-04-10 海德沃特合作I有限公司 Device-assisted services for protecting network capacity
CN104135684A (en) * 2014-07-17 2014-11-05 Tcl集团股份有限公司 A method and a device for displaying an interface based on a Firefox OS
CN107943593A (en) * 2018-01-03 2018-04-20 上海传英信息技术有限公司 A kind of memory automatic cleaning method for intelligent terminal
CN108156265A (en) * 2010-11-22 2018-06-12 杭州硕文软件有限公司 A kind of application control method and mobile equipment
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium
CN108376207A (en) * 2018-03-22 2018-08-07 宝鸡中车时代工程机械有限公司 The emulation platform calculated for rail vehicle traction
CN108614722A (en) * 2018-05-10 2018-10-02 Oppo广东移动通信有限公司 Application program preloads method, apparatus, storage medium and terminal
CN109669764A (en) * 2017-10-13 2019-04-23 阿里巴巴集团控股有限公司 Processing method, device, equipment and machine readable media
CN109684123A (en) * 2018-12-25 2019-04-26 北京达佳互联信息技术有限公司 Problem resource localization method, device, terminal and storage medium
CN109726076A (en) * 2018-12-03 2019-05-07 百度在线网络技术(北京)有限公司 A kind of small routine life cycle management method and system
CN110069308A (en) * 2019-04-22 2019-07-30 北京字节跳动网络技术有限公司 The page starts method, apparatus, electronic equipment and storage medium
CN110083399A (en) * 2019-03-04 2019-08-02 上海连尚网络科技有限公司 Small routine operation method, computer equipment and storage medium
CN110196726A (en) * 2019-05-17 2019-09-03 江西山水光电科技股份有限公司 A method of the load of FPGA program remote upgrading is realized based on CPU+CPLD

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1723448A (en) * 2002-11-18 2006-01-18 Arm有限公司 Secure memory for protecting against malicious programs
US20060095916A1 (en) * 2004-10-29 2006-05-04 Kyocera Corporation Mobile phone terminal, program management method, and computer program for the same
US20060195504A1 (en) * 2005-02-25 2006-08-31 Kyocera Corporation Portable terminal device, method for restoring program, method for terminating program, and computer program therefor
CN102985929A (en) * 2010-05-11 2013-03-20 杉中顺子 External boot device, external boot program, external boot method and network communication system
CN103038652A (en) * 2010-05-25 2013-04-10 海德沃特合作I有限公司 Device-assisted services for protecting network capacity
CN108156265A (en) * 2010-11-22 2018-06-12 杭州硕文软件有限公司 A kind of application control method and mobile equipment
CN104135684A (en) * 2014-07-17 2014-11-05 Tcl集团股份有限公司 A method and a device for displaying an interface based on a Firefox OS
CN108334415A (en) * 2017-01-20 2018-07-27 百度在线网络技术(北京)有限公司 A kind of fault-tolerance processing method, device, terminal and storage medium
CN109669764A (en) * 2017-10-13 2019-04-23 阿里巴巴集团控股有限公司 Processing method, device, equipment and machine readable media
CN107943593A (en) * 2018-01-03 2018-04-20 上海传英信息技术有限公司 A kind of memory automatic cleaning method for intelligent terminal
CN108376207A (en) * 2018-03-22 2018-08-07 宝鸡中车时代工程机械有限公司 The emulation platform calculated for rail vehicle traction
CN108614722A (en) * 2018-05-10 2018-10-02 Oppo广东移动通信有限公司 Application program preloads method, apparatus, storage medium and terminal
CN109726076A (en) * 2018-12-03 2019-05-07 百度在线网络技术(北京)有限公司 A kind of small routine life cycle management method and system
CN109684123A (en) * 2018-12-25 2019-04-26 北京达佳互联信息技术有限公司 Problem resource localization method, device, terminal and storage medium
CN110083399A (en) * 2019-03-04 2019-08-02 上海连尚网络科技有限公司 Small routine operation method, computer equipment and storage medium
CN110069308A (en) * 2019-04-22 2019-07-30 北京字节跳动网络技术有限公司 The page starts method, apparatus, electronic equipment and storage medium
CN110196726A (en) * 2019-05-17 2019-09-03 江西山水光电科技股份有限公司 A method of the load of FPGA program remote upgrading is realized based on CPU+CPLD

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
欧燕JONATHAN: ""解决微信小程序部分ios机型在onLaunch中调用reLaunch,页面栈无法清空的坑"", pages 1 - 3 *

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858303B (en) * 2020-06-05 2023-12-01 百度在线网络技术(北京)有限公司 Page control method, device, equipment and medium for applet
CN111858303A (en) * 2020-06-05 2020-10-30 百度在线网络技术(北京)有限公司 Method, device, equipment and medium for controlling page of applet
CN111654838B (en) * 2020-06-12 2023-05-30 阿波罗智联(北京)科技有限公司 Information processing method and device
CN111654838A (en) * 2020-06-12 2020-09-11 北京百度网讯科技有限公司 Information processing method and device
US11831735B2 (en) 2020-06-28 2023-11-28 Baidu Online Network Technology (Beijing) Co., Ltd. Method and device for processing mini program data
CN111787088A (en) * 2020-06-28 2020-10-16 百度在线网络技术(北京)有限公司 Method and device for processing applet data
CN111782218A (en) * 2020-06-29 2020-10-16 百度在线网络技术(北京)有限公司 Applet processing method, device, equipment and storage medium
CN111782218B (en) * 2020-06-29 2024-03-01 百度在线网络技术(北京)有限公司 Applet processing method, device, equipment and storage medium
CN112698884A (en) * 2020-12-30 2021-04-23 北京达佳互联信息技术有限公司 Program starting method, device, system, equipment and storage medium
CN113687892A (en) * 2021-07-30 2021-11-23 阿里巴巴新加坡控股有限公司 Page processing method and device and computer program product
CN113687892B (en) * 2021-07-30 2024-05-03 阿里巴巴创新公司 Page processing method, device and computer program product
CN113849252A (en) * 2021-08-17 2021-12-28 支付宝(杭州)信息技术有限公司 Multi-screen display method for small program, host system supporting multi-screen display of small program and client device
CN113849252B (en) * 2021-08-17 2024-05-10 支付宝(杭州)信息技术有限公司 Small program multi-screen display method, host system supporting small program multi-screen display and client device
CN113885967A (en) * 2021-10-22 2022-01-04 北京字跳网络技术有限公司 Method, device, equipment and medium for starting small program
CN113885967B (en) * 2021-10-22 2024-02-13 北京字跳网络技术有限公司 Method, device, equipment and medium for starting applet

Also Published As

Publication number Publication date
CN111026462B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN111026462B (en) Applet control method, device, apparatus and medium
CN111432070B (en) Application screen projection control method, device, equipment and medium
CN111258609A (en) Upgrading method and device of Kubernetes cluster, electronic equipment and medium
CN112270399B (en) Operator registration processing method and device based on deep learning and electronic equipment
US20170199737A1 (en) Efficient detection of architecture related bugs during the porting process
US9563497B2 (en) Correcting a failure associated with a current firmware image
US20210149558A1 (en) Method and apparatus for controlling terminal device, and non-transitory computer-readle storage medium
US11556301B2 (en) Dynamic user interface and module facilitating content sharing in a distributed computing environment
US20140298245A1 (en) Display Instance Management
US20150039946A1 (en) Method and system for a high availability framework
US20140289719A1 (en) Automatic version management
CN111881387B (en) Data processing method, device, equipment and medium for small program
CN112148160B (en) Floating window display method and device, electronic equipment and computer readable storage medium
CN112817656B (en) Applet running method and device
US20230251920A1 (en) Detecting datacenter mass outage with near real-time/offline using ml models
CN112037332A (en) Display verification method and device of browser, computer equipment and storage medium
US20160112285A1 (en) Apparatus and method for detecting abnormal connection
CN111708653B (en) Memory fault processing method and device, electronic equipment and storage medium
CN111813623A (en) Page monitoring method and device, electronic equipment and storage medium
US9972280B2 (en) Display control device, input operation device, and air traffic control system
CN113051122B (en) Performance data acquisition method, device, electronic equipment and medium
CN111858303A (en) Method, device, equipment and medium for controlling page of applet
CN111338937A (en) Method, device, equipment and medium for off-line intervention of applet
CN111292223A (en) Graph calculation processing method and device, electronic equipment and storage medium
CN111597192A (en) Database switching control method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant