CN113032080A - Page implementation method, application program, electronic device and storage medium - Google Patents
Page implementation method, application program, electronic device and storage medium Download PDFInfo
- Publication number
- CN113032080A CN113032080A CN202110352177.8A CN202110352177A CN113032080A CN 113032080 A CN113032080 A CN 113032080A CN 202110352177 A CN202110352177 A CN 202110352177A CN 113032080 A CN113032080 A CN 113032080A
- Authority
- CN
- China
- Prior art keywords
- rendering
- main process
- component
- trigger signal
- independent
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/543—Local
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Telephone Function (AREA)
- Stored Programmes (AREA)
Abstract
The application provides a page implementation method, which comprises the following steps: creating a Surface for rendering by a main process, wherein the main process is a process operated when an application program is started; the main process creates an independent process as a rendering process and transmits the Surface to the rendering process so that the main process and the rendering process share the Surface; the rendering process creates a VirtualDisplay component and a Presentation component bound with the VirtualDisplay component; and the rendering process starts the Presentation component, a service View specified in the Presentation component is rendered to the VirtualDisplay component, and the VirtualDisplay component draws the rendering result on the Surface.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a page implementation method, an application program, an electronic device, and a computer-readable storage medium.
Background
Currently, the development of live Application programs (APPs) based on the Android platform is rapid. Because can not be restricted by the scene for the user can watch various abundant contents anytime and anywhere, live broadcast APP is deeply loved by the user.
However, the current live broadcast APP is limited by the structure of the existing Android platform and APP framework, page rendering is usually realized mainly based on a main process at present, however, the display of a page with rich content often needs to create multiple instances, and the simultaneous rendering of the multiple instances on the main process can cause a single process to occupy too much resources, which leads to higher memory pressure in the running process of the APP, so that memory recovery is triggered more frequently, the APP is prone to jamming or even collapse, and viewing experience of a user is seriously affected.
Disclosure of Invention
In order to overcome the problems in the related art, the present application provides a page implementation method, an application program, an electronic device, and a computer-readable storage medium.
According to a first aspect of an embodiment of the present application, a page implementation method is provided, where the method is executed by an application running on an Android platform, and includes: creating a Surface for rendering by a main process, wherein the main process is a process operated when the application program is started; the main process creates an independent process as a rendering process and transmits the Surface to the rendering process so that the main process and the rendering process share the Surface; the rendering process creates a VirtualDisplay component and a Presentation component bound with the VirtualDisplay component; and the rendering process starts the Presentation component, a service View specified in the Presentation component is rendered to the VirtualDisplay component, and the VirtualDisplay component draws the rendering result on the Surface.
According to a second aspect of embodiments of the present application, there is provided an application comprising computer programs/instructions which, when executed by a processor, implement the steps of the method of the first aspect of embodiments of the present application.
According to a third aspect of embodiments of the present application, there is provided an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of the method of the first aspect of embodiments of the present application are implemented.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing a computer program which, when executed by a processor, performs the steps of the method of the first aspect of embodiments of the present application.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
in the embodiment of the application, by using a Presentation technology of an Android platform, a main process of an application program creates an independent process as a rendering process, a service View specified in the application program is rendered to a virtual display component through a Presentation component, and rendering content is drawn on the Surface based on the virtual display component so that a user can View the rendering content. Compared with the technical scheme that the application program uses the main process to render in the related technology, the rendering can be realized by means of the independent process created by the main process, so that the main process and the independent process run simultaneously, more resources can be obtained, the probability of application program crash is reduced, in addition, even if the independent process crashes, the main process can run normally, and the defects that the whole application program crashes due to the crash of the rendering process and the user experience is seriously influenced can be overcome.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart illustrating a page display method according to an exemplary embodiment of the present application.
FIG. 2 is an application flowchart of a page implementation method shown in the present application according to an exemplary embodiment.
FIG. 3 is a diagram illustrating a host process and an independent process communicating with each other according to an example embodiment.
FIG. 4 is a diagram illustrating another host process and an independent process in communication with one another according to an illustrative embodiment of the present application.
Fig. 5 is a schematic diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
For an application program running on an Android platform, the application program is limited by the structure of the existing APP framework, and at present, almost all application programs and page rendering are realized in a main process, namely the process running when the application program is started. Pages of an application program usually have rich content to be rendered and displayed, and are often implemented by creating multiple instances by using a cross-platform technology (WebView, ReactNative, Flutter, and the like). However, this causes two significant problems: firstly, all pages realize whole realization based on the rendering of main process, and then the main process will occupy too much resource easily, leads to APP to gather in the operation process and faces higher memory pressure to trigger the memory recovery more frequently, and then APP appears blocking easily, influences user experience. Secondly, by adopting a cross-platform technology, under the condition of embedding the cross-platform component, because the internal code of the cross-platform component is huge, once an error occurs, the probability of the breakdown of the whole APP is also very high, and meanwhile, the problem can not be repaired under the general condition, so that the on-line breakdown quantity is increased, and partial user experience is influenced.
Therefore, it is necessary to implement a View implementation method capable of running in an independent process, that is, a rendering part implemented by a page is not completed in a main process, but implemented in an independent process other than the main process, so that even if the independent process where the rendering part is located crashes or is interrupted, normal running of the main process is not affected, and the crash of the whole application program is not caused.
On the Android platform, it is possible to create an independent process for an application program, but on the Android platform, creating an independent process for Activity is not detailed enough, that is, the independent process for Activity cannot be detailed to a View level process rendering, while an independent process for Service cannot operate a main thread UI, that is, the Service-based independent process is independent of UI rendering and does not support realization of View level process rendering. Due to the problems of the Activity and Service components of the Android system, no related technical scheme can be realized for multiple processes of the View level at present.
The inventor of the application discovers that a common service View (namely contents to be rendered and displayed) is rendered on a drawing interface through a Presentation technology of an Android platform by utilizing the Presentation technology of the Android platform in the process of researching a browser technology and a cross-platform technology (flute), and the realization of a View-level multi-process page can be realized. Through further research, the function can also establish a complete View independent integration technology by introducing Service independent processes and inter-process communication modes. The technical solutions provided in the embodiments of the present application are explained in detail below.
In an embodiment of the present application, a page implementation method as shown in fig. 1 is provided, where the method is executed by an application running on an Android platform, and the method includes:
101, a master process creates a Surface for rendering, wherein the master process is a process operated when the application program is started;
102, the main process creates an independent process as a rendering process and transmits the Surface to the rendering process so that the main process and the rendering process share the Surface;
and 104, starting the Presentation component by the rendering process, rendering the service View specified in the Presentation component to the VirtualDisplay component, and drawing the rendering result on the Surface by the VirtualDisplay component.
The Surface is a class (Dialog) of an Android system and is used for providing a drawing buffer area for rendering, each window corresponds to one Surface, and any service View is drawn on the Surface. When the APP needs to display the page content on the screen of the terminal device, a main process of the APP initiates a Surface creation request, after the Surface is created, the Surface can be drawn on a canvas and stored in the Surface, and finally the Surface is synthesized and displayed by a rendering process.
The virtual display component, which is also a class of the Android system, represents a virtual display, and content in the virtual display of the Android system can be rendered on a Surface by calling the created virtual display component, and the virtual display is automatically released when a process is terminated.
The Presentation component is a component for realizing multi-screen interaction provided by an Android system. The Presentation component, by its nature, is also a special class. In the related art, a Presentation component is used to perform multi-screen Presentation. One application scenario is: for the equipment of the cash register platform, a clerk can select and input commodities on a main screen, a secondary screen displays bill details for customers, and the display is realized through a Presentation component of an Android system. In the present application, the inventor of the present application uses the Presentation component of the Android system to implement the page rendering process of the application on the independent process created by the main process through the above steps 101 to 104.
Next, referring to fig. 2, fig. 2 is an application flowchart of a page implementation method provided in the foregoing embodiment. The Client side is the main process of the application program, and the Server side is the independent process created by the main process of the application program. Wherein, the container View is used for providing a Surface, and the creation of the Surface is realized by the main process of the application program through the above step 101.
In some embodiments, the Surface comprises: surface of a SurfaceView container or a TextureView container.
Wherein, the SurfaceView container and the TextureView container are both View containers. Both can be drawn and rendered in separate threads.
The SurfaceView container provides a drawing layer embedded in a view level, so that a developer can control the form of the interface such as the size and the like and ensure the correct position of the rendered interface on a screen. However, the surfaceView container is an independent layer of View, more like an independent window, and cannot be added with animation, translation, scaling and the like, and two different surfaceView containers cannot be mutually covered. However, the SurfaceView container occupies less resources and has a faster drawing speed. The method is suitable for application scenes with only one view of the whole page, such as a player and the like.
The TextureView container can be zoomed and translated, can be added with animation, can be transformed into a hierarchy at will, and has higher flexibility. However, TextureView consumes more memory than SurfaceView, and is accompanied by latency, and can only be used in windows where hardware acceleration is turned on.
The Surface view container and the TextureView container have respective advantages and disadvantages, so based on different application requirements, the Surface may be a Surface provided by the Surface view container or a Surface provided by the TextureView container, which is not limited in the embodiments of the present application.
For the main process of the application program as a Client (Client) side, after a Surface for rendering is created in step 101, an independent process is created as a rendering process, i.e. a service (Server) side shown in fig. 2, in step 102, and the Surface created in step 101 is transferred to the rendering process, where the Surface is a rendering area that can be shared between the main process and the independent process as the rendering process.
For the server shown in fig. 2, the independent process created by the host process is used as a rendering process, the independent process obtains the Surface transmitted by the host process, and through the step 103, a VirtualDisplay component is created as an abstract display component, and a Presentation component is created to be bound to the VirtualDisplay component; through step 104, the rendering process starts the created Presentation component, and the service View specified inside the Presentation component is rendered into the VirtualDisplay component, and the VirtualDisplay component draws the rendered content onto the shared Surface, so that the user can see the content drawn in the independent process.
The service View is created when the Presentation component is created, and the Presentation component is associated with the View, so that when the Presentation component is started, the service View specified in the Presentation component is automatically rendered into the virtual display component, and the rendered content is drawn onto the shared Surface by the virtual display component.
As can be seen from the foregoing embodiments, in the embodiments provided in the present application, by using the Presentation technology of the Android platform, an independent process is created as a rendering process by a main process of an application, a service View associated with the independent process is rendered to a VirtualDisplay component by a Presentation component, and a rendering content is rendered on the Surface based on the VirtualDisplay component so as to be viewed by a user. Compared with the technical scheme that the application program uses the main process to render in the related technology, the rendering can be realized by means of the independent process created by the main process, so that the main process and the independent process run simultaneously, more resources can be obtained, the probability of application program crash is reduced, in addition, even if the independent process crashes, the main process can run normally, and the defects that the whole application program crashes due to the crash of the rendering process and the user experience is seriously influenced can be overcome.
Through the embodiment, the page rendering can be completed in the independent process created by the main process of the application program, however, the inventor of the present application further finds that, after the page rendering of the application program is completed through the embodiment, the main process and the independent process cannot directly achieve mutual communication, and thus interaction between a user and the application program is caused, which can only be perceived by the main process and cannot be responded by the independent process. For example, an event triggered by a user clicking on the container View at the host process cannot be synchronized to the independent process. The inventor of the present application analyzes the reason and finds that the capture of the gesture event is implemented in the main process of the main process, and the Presentation created by the independent process does not support the mapping of the gesture event, so that the embodiment can only be used as rendering, and cannot affect the user operation. In addition, because the main process and the independent process cannot directly realize mutual communication, when the independent process needs to acquire some parameters from the main process, the independent process cannot acquire the parameters from the main process, and further the independent process cannot complete part of rendering work.
After intensive research, the inventor of the application finds that an event mechanism of an Android platform is triggered and transmitted by calling back several event methods of View through a View-based architecture. Therefore, in order to enable the page implementation method provided in the foregoing embodiment of the present application, not only the independent process created by the host process completes page rendering, but also the host process and the independent process can implement mutual communication, the page implementation method further includes: and the main process and the rendering process realize inter-process communication based on an AIDL mode of an Android platform.
The aid l, namely, an Android Interface Definition Language (Android Interface Definition Language), is one of Inter-Process Communication (IPC) modes in Android. In the Android system, each process runs in an independent memory, and each activity of the process is completed in the independent memory, and the process is separated from other processes. However, there are some requirements for interaction between processes, comparison of transmitted data, task delegation, and the like, and the aid id is created to meet such requirements. The AIDL is an interface definition language and is used for restricting communication rules between two processes, so that a compiler can generate codes to realize communication between the two processes on the Android device. The IPC mechanism of AIDL is that the communication information between the processes is converted into AIDL protocol information first and then sent to the other party, and the other party receives the AIDL protocol information and then converts the AIDL protocol information into corresponding objects. Because the communication information between the processes needs bidirectional conversion, the Android realizes the bidirectional conversion of the information behind the agents, and the agents are generated by an Android compiler and are transparent to developers. Through AIDL, data of another process can be acquired in one process and exposed methods can be called, so that the requirement of inter-process communication is met. Generally, an application which exposes methods to other applications for calling is called a server, an application which calls methods of other applications is called a client, and the client performs interaction by binding Service of the server.
As can be seen from the foregoing embodiments, since the independent process is created by the host process, the independent process is bound to the host process when the independent process is created. Therefore, the main process and the independent process can realize inter-process communication based on an AIDL mode of an Android platform. For the content of the aid id, reference may be made to related technologies, which are not described in detail in this embodiment.
As can be seen from the above embodiments, in the embodiments of the present application, in addition to the independent process created by the main process, page rendering can be completed for implementing a page of an application process, inter-process communication can also be implemented based on an aid id of an Android platform, so that the main process and the independent process can respond to call between themselves, and thus, the page implementation of the application program is completely the same as the page implementation of page rendering implemented in the main process, and can respond to an interaction action of a user; in addition, the probability of the crash of the application program can be reduced, even if the independent process crashes, the main process can run normally, and the defect that the whole application program is crashed and the user experience is seriously influenced due to the crash of the rendering process can be overcome.
In some embodiments, on the basis that the main process and the rendering process implement inter-process communication based on an aid dl of an Android platform, the page implementation method further includes:
one process of the main process and the independent process sends a calling request to the other process before responding to a specified trigger signal, and responds to the specified trigger signal after the other process returns relevant information responding to the specified trigger signal based on the calling request.
The above embodiments are described in detail below by taking a gesture event that the page of the application responds to the user input as an example. For convenience of explanation, a process that sends the call request will be referred to as a call side hereinafter, and another process that returns a response to the specified trigger signal based on the call request will be referred to as a call side hereinafter.
As described above, a user clicks a View gesture event in a main process, the gesture event is captured by the main thread of the main process, inter-process communication is achieved by using the main process and the rendering process based on an aid dl (aid storage layer) of an Android platform, the gesture event captured by the main thread of the main process can be notified to the independent process, so that the independent process returns relevant information responding to the gesture event to the main process, and the main process can respond to the gesture event. In this application scenario, the main process is a calling end, and the independent process is a called end.
This is explained with reference to fig. 3. As a main process of a calling end, as in step 301, after a Gesture event (Gesture event) such as zooming or moving a page input by a user is intercepted in a container View of the Surface, the related parameters of the Gesture event are used as data in step 302, and a calling request containing the related parameters of the Gesture event is sent to the independent process; after the independent process serves as a called end and receives the calling request, in step 303, based on the gesture event related parameters contained in the calling request, finding a Presentation component corresponding to the gesture event, executing a gesture callback method of rendering service View corresponding to the calling request, and returning the execution completion result to the main process; the host process responds to the gesture event based on the parameters in the results returned by the independent process, as shown in step 304.
As can be seen from the above examples, the page display method provided in the embodiment of the present application can capture a gesture for a container View in a main thread of a main process, transmit gesture event data to an independent process, find a corresponding service View in the independent process based on a Presentation component, and return relevant information of the gesture event data to the main process, thereby implementing gesture event synchronization from the main process to the independent process and a response of the main process to the gesture event, and thus can ensure completion of page rendering of an application program and also respond to the gesture event of a user.
In the above example, the main process is taken as a calling end, the independent process is taken as a called end, the specified trigger signal is a gesture event input by a user to the main process, and the returned related information is related information responding to the gesture event. Of course, those skilled in the art should understand that, depending on an application scenario and development requirements, the specified trigger signal may also be another trigger signal received by the host process or the independent process, the returned related information is related information corresponding to the other trigger signal, the host process serves as a called end, and the independent process serves as a calling end, which is not limited in this embodiment of the application.
As can be seen from the above embodiments, either of the main process and the independent process, by sending a call request to the other process before responding to a specified trigger, and responds to the specified trigger signal after another process returns relevant information responding to the specified trigger signal based on the call request, this way of sending call requests-returning call related information enables the application to render on a separate process, and when either process of the separate process and the host process, when another process is required to return the related information related to responding to the trigger signal, the other process can return the related information, and enabling any process to realize the response to the trigger signal, thereby realizing the page realization effect of the application program in the related technology. In addition, compared with the page implementation method of the application program in the related technology, the method also has the following advantages: the probability of application program crash can be reduced, even if the independent process crashes, the main process can run normally, and the defect that the whole application program crashes and user experience is seriously influenced due to the crash of the rendering process can be overcome.
As can be seen from the examples provided in the above embodiments, the specified trigger signal may include a gesture trigger event of the user intercepted by the host process. When the specified trigger signal is the gesture trigger event of the user intercepted by the main process, the application program which is rendered with the completion of the independent process can be enabled, the synchronization of the gesture event from the main process to the independent process and the response of the main process to the gesture event are realized, and therefore the completion of the page rendering of the application program can be ensured, and the gesture event of the user can also be responded.
In some embodiments, on the basis that the main process and the rendering process implement inter-process communication based on an aid dl of an Android platform, the page implementation method further includes:
when one process receives a specified trigger signal, the other process is informed to respond to the specified trigger signal, and a response result of the other process to the specified trigger signal is received.
Next, with reference to fig. 4, the above embodiment is described in detail by taking an example that the independent process needs to obtain the page display brightness information of the current application program from the host process under the trigger of a network request, and returns the page display brightness information of the application program to the network request.
In the example shown in fig. 4, the specified trigger signal is a network request for obtaining the brightness information of the page, and in the case that the independent process is triggered by the network request and the brightness information of the page of the current application needs to be obtained from the host process, the independent process is the aforementioned calling end, and the host process is the aforementioned called end. Step 401, that is, the independent process is triggered by the network request; step 402, that is, sending a call request to the host process for the independent process, and notifying the host process to obtain page brightness information, step 403, that is, after receiving the call request, the host process responds to the network request to obtain current page brightness information of the application program, and step 404, that is, the host process sends a response result, that is, the obtained page brightness information, to the independent process.
In the above example, the independent process is taken as a calling end, the main process is taken as a called end, the specified trigger signal is a network request for acquiring the brightness information of the application page, and the response result is the acquired brightness information of the application page. Of course, those skilled in the art should understand that, depending on an application scenario and development requirements, the specified trigger signal may also be another trigger signal received by the main process or the independent process, the response result may also be another related result corresponding to the trigger signal, the independent process serves as a called end, and the independent process serves as a calling end, which is not limited in this embodiment of the application.
It can be seen from the foregoing embodiment that, in a manner of notifying, by receiving a specified trigger signal, another process to respond to the specified trigger signal and receiving a response result of the other process to the specified trigger signal, and returning a response result, by any one of the host process and the independent process, the application program can implement rendering on the independent process, and when any one of the independent process and the host process needs the other process to respond to the trigger signal and return the response result, the foregoing embodiment can enable the other process to return the response result, thereby implementing a page implementation effect of the application program in the related art. In addition, compared with the page implementation method of the application program in the related technology, the method also has the following advantages: the probability of application program crash can be reduced, even if the independent process crashes, the main process can run normally, and the defect that the whole application program crashes and user experience is seriously influenced due to the crash of the rendering process can be overcome.
In some embodiments, the communication between the host process and the independent process is based on a preset protocol, the preset protocol comprising: the data packet sent by one process to the other process comprises a calling method name, an additional parameter and a calling identifier; the calling method name indicates a communication transaction, the additional parameter comprises a parameter related to the communication interaction, the additional parameter comprises an execution result of the calling method, and the calling identification uniquely indicates the current communication process.
In the foregoing embodiment, it has been introduced that, in the embodiment of the present application, inter-process communication between the master process and the independent process may be implemented based on an aid dl manner. The protocol adopted by the aid l may be the preset protocol described in the above embodiment. Still referring to fig. 3, taking the example that the communication between the main process and the independent process is a gesture event intercepted by the main process in the container View to which the Surface belongs, the preset protocol is introduced, and the data type at least included in the data packet interacted between the main process and the independent process is introduced.
The main process as a calling end encapsulates a calling request into a method data packet form based on a preset protocol, and the method data packet mainly records the following data:
a MethodName ("send gesture event data");
params ("data related to gesture events");
ID ("identity of this call").
A method name is used to indicate the event that the main process communicates with the independent process, i.e. sending gesture event data in the communication process shown in fig. 3; params (additional parameters) containing parameters related to the communication interaction, i.e. parameters related to the gesture event sent by the host process to the independent process in the communication process shown in fig. 3, for example, parameters indicating that the gesture event is zooming in, zooming out, panning, etc.; ID (identification) to uniquely indicate the current communication process, for example, the communication process of "data of gesture event" may be identified in a unique character.
As the independent process of the called end, after receiving a Method data packet sent by the main process, parsing out a Method name and an additional parameter to be called, executing a corresponding calling Method, that is, sending gesture event data to a target service View, and encapsulating the executed result data into a Callback (Callback) data packet, where the Callback data packet mainly records the following data:
a MethodName ("send gesture event data");
result ("executed Result data");
ID ("identity of this call").
A method name is used to indicate the communication between the main process and the independent process, and the calling end and the called field generally have the same content, i.e. sending gesture event data, in the communication process shown in fig. 3; a Result ("executed Result data") containing parameters related to the communication interaction, for the called end, that is, Result data returned in response to the calling method, that is, Result data of the gesture event generated by the target business view returned to the main process by the independent process in the communication process shown in fig. 3; the ID (identification) is used for uniquely indicating the current communication process, and the ID returned by the called end is usually the same as the ID sent by the calling end corresponding to the called end.
Of course, those skilled in the art should understand that the data packet included in the preset protocol based on which the main process communicates with the independent process may also include other fields in advance, which is not limited in this embodiment of the present application.
The embodiment can see that, the communication between the main process and the independent process is performed based on a preset protocol, and the content of the data packet sent by the process to another process is confirmed in a communication mode without using in each communication process, so that both parties of the processes performing the communication can quickly and effectively complete the communication process, and the method is simple, convenient and easy to implement.
In addition, corresponding to the page implementation method provided in the foregoing embodiment of the present application, an embodiment of the present application further provides a software product, that is, an application program, where the application program includes a computer/instruction, and when the computer program/instruction is executed by a processor, the software product implements the foregoing method embodiments provided in the foregoing embodiment of the present application. For the relevant content of the application program, reference may be made to the foregoing method embodiments, which are not described herein again.
Corresponding to the embodiment of the foregoing method, the present application further provides an electronic device, and fig. 5 is a schematic structural diagram of an exemplary electronic device provided in the present application.
As shown in fig. 5, the present embodiment provides an electronic device 500, including: a processor 501, a memory 502 and a computer program stored on the memory 502 and executable on the processor 501, which when executed implements the method hereinbefore described. The number of the processors 501 in the electronic device may be one or more, and in fig. 5, one processor 501 is taken as an example, and the processor may include a GPU and a CPU. The processor 501 and the memory 502 in the electronic device may be connected by a communication bus or other means, and in fig. 5, the connection by the communication bus 503 is taken as an example.
The processor 501 of the electronic device in this embodiment is integrated with the application program provided in the above embodiment. Further, the memory 502 in the electronic device, which is a computer-readable storage medium, may be used to store one or more programs, which may be software programs, computer-executable programs, and modules. The processor 501 executes various functional applications of the device and data processing by executing software programs, instructions and modules stored in the memory 502, namely, implements the above-described various method embodiments.
The memory 502 may include a storage program area and a storage data area, wherein the storage program 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 device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 502 may further include memory located remotely from processor 501, which may be connected to devices through 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 processor 501 executes programs stored in the memory 502 to execute various functional applications and data processing, thereby implementing the methods provided by the embodiments of the present application.
Furthermore, the present application also provides a computer-readable storage medium, which stores a computer program, which when executed by a processor implements any of the methods described above.
The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CDROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The signal medium of the computer readable storage medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing. Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.
Claims (10)
1. A page implementation method is executed by an application program running on an Android platform, and comprises the following steps:
creating a Surface for rendering by a main process, wherein the main process is a process operated when the application program is started;
the main process creates an independent process as a rendering process and transmits the Surface to the rendering process so that the main process and the rendering process share the Surface;
the rendering process creates a VirtualDisplay component and a Presentation component bound with the VirtualDisplay component;
and the rendering process starts the Presentation component, a service View specified in the Presentation component is rendered to the VirtualDisplay component, and the VirtualDisplay component draws the rendering result on the Surface.
2. The method of claim 1, wherein the Surface comprises: surface of a SurfaceView container or a TextureView container.
3. The method of claim 1, further comprising:
and the main process and the rendering process realize inter-process communication based on an AIDL mode of an Android platform.
4. The method of claim 3, wherein the method comprises:
one process sends a calling request to the other process before responding to a specified trigger signal, and responds to the specified trigger signal after the other process returns relevant information responding to the specified trigger signal based on the calling request.
5. The method of claim 3, wherein the method comprises:
when one process receives a specified trigger signal, the other process is informed to respond to the specified trigger signal, and a response result of the other process to the specified trigger signal is received.
6. The method of claim 4, wherein the specified trigger signal comprises: and triggering an event by the gesture of the user intercepted by the main process.
7. The method of claim 3, wherein the inter-process communication is based on a predetermined protocol, the predetermined protocol comprising: the data packet sent by one process to the other process comprises a calling method name, an additional parameter and a calling identifier; the calling method name indicates a communication transaction, the additional parameter comprises a parameter related to the communication interaction, the additional parameter comprises an execution result of the calling method, and the calling identification uniquely indicates the current communication process.
8. An application comprising a computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the method of any of claims 1-7.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110352177.8A CN113032080B (en) | 2021-03-31 | 2021-03-31 | Page implementation method, application program, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110352177.8A CN113032080B (en) | 2021-03-31 | 2021-03-31 | Page implementation method, application program, electronic device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113032080A true CN113032080A (en) | 2021-06-25 |
CN113032080B CN113032080B (en) | 2023-06-27 |
Family
ID=76453152
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110352177.8A Active CN113032080B (en) | 2021-03-31 | 2021-03-31 | Page implementation method, application program, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113032080B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113568748A (en) * | 2021-07-27 | 2021-10-29 | Oppo广东移动通信有限公司 | Application process processing method and device, storage medium and electronic equipment |
CN113703647A (en) * | 2021-07-29 | 2021-11-26 | 青岛海尔科技有限公司 | Method and device for realizing page gradual change effect |
CN113986447A (en) * | 2021-12-24 | 2022-01-28 | 畅捷通信息技术股份有限公司 | Interaction method and device of local application service and browser and storage medium |
CN114942809A (en) * | 2022-05-19 | 2022-08-26 | 麒麟合盛网络技术股份有限公司 | Animation display method and device |
CN117873740A (en) * | 2024-03-12 | 2024-04-12 | 麒麟软件有限公司 | Method, device and storage medium for constructing process deadlock relation graph based on gdb |
Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080222618A1 (en) * | 2005-08-25 | 2008-09-11 | Corizon Limited | Methods for User Interface Generation and Application Modification |
US20120260267A1 (en) * | 2011-04-07 | 2012-10-11 | Adobe Systems Incorporated | Methods and Systems for Supporting a Rendering API Using a Runtime Environment |
CN103019703A (en) * | 2012-11-28 | 2013-04-03 | 北京奇虎科技有限公司 | Method and device for loading browser tool window |
CN104268019A (en) * | 2014-09-23 | 2015-01-07 | 广州金山网络科技有限公司 | Software operating method and device and terminal |
CN105068866A (en) * | 2012-05-04 | 2015-11-18 | 北京奇虎科技有限公司 | Process control method and device for browser input control |
CN105893028A (en) * | 2016-03-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Method and device for drawing dynamic wallpaper of mobile terminal |
US20170060368A1 (en) * | 2015-09-02 | 2017-03-02 | International Business Machines Corporation | Computer-vision based execution of graphical user interface (gui) application actions |
CN106713937A (en) * | 2016-12-30 | 2017-05-24 | 广州虎牙信息科技有限公司 | Video playing control method and device as well as terminal equipment |
CN107463370A (en) * | 2017-06-30 | 2017-12-12 | 百度在线网络技术(北京)有限公司 | Striding course rendering intent and system |
US20180109625A1 (en) * | 2016-10-13 | 2018-04-19 | Sierraware, Llc | Method for cloud based mobile application virtualization |
US20180150308A1 (en) * | 2015-06-02 | 2018-05-31 | Phicomm (Shanghai) Co., Ltd. | Method for Communication between Views in Android System |
CN109388467A (en) * | 2018-09-30 | 2019-02-26 | 百度在线网络技术(北京)有限公司 | Map information display method, device, computer equipment and storage medium |
US20190205147A1 (en) * | 2016-10-25 | 2019-07-04 | Tencent Technology (Shenzhen) Company Limited | Application running method and device |
CN110618847A (en) * | 2018-06-20 | 2019-12-27 | 华为技术有限公司 | User interface display method and terminal equipment |
CN110704148A (en) * | 2019-09-20 | 2020-01-17 | 广州虎牙科技有限公司 | Method and device for acquiring device page elements, server and storage medium |
CN112486620A (en) * | 2020-12-03 | 2021-03-12 | 广州虎牙科技有限公司 | Cross-process off-screen rendering method and device, electronic equipment and storage medium |
-
2021
- 2021-03-31 CN CN202110352177.8A patent/CN113032080B/en active Active
Patent Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080222618A1 (en) * | 2005-08-25 | 2008-09-11 | Corizon Limited | Methods for User Interface Generation and Application Modification |
US20120260267A1 (en) * | 2011-04-07 | 2012-10-11 | Adobe Systems Incorporated | Methods and Systems for Supporting a Rendering API Using a Runtime Environment |
CN105068866A (en) * | 2012-05-04 | 2015-11-18 | 北京奇虎科技有限公司 | Process control method and device for browser input control |
CN103019703A (en) * | 2012-11-28 | 2013-04-03 | 北京奇虎科技有限公司 | Method and device for loading browser tool window |
CN104268019A (en) * | 2014-09-23 | 2015-01-07 | 广州金山网络科技有限公司 | Software operating method and device and terminal |
US20180150308A1 (en) * | 2015-06-02 | 2018-05-31 | Phicomm (Shanghai) Co., Ltd. | Method for Communication between Views in Android System |
US20170060368A1 (en) * | 2015-09-02 | 2017-03-02 | International Business Machines Corporation | Computer-vision based execution of graphical user interface (gui) application actions |
CN105893028A (en) * | 2016-03-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Method and device for drawing dynamic wallpaper of mobile terminal |
US20180109625A1 (en) * | 2016-10-13 | 2018-04-19 | Sierraware, Llc | Method for cloud based mobile application virtualization |
US20190205147A1 (en) * | 2016-10-25 | 2019-07-04 | Tencent Technology (Shenzhen) Company Limited | Application running method and device |
CN106713937A (en) * | 2016-12-30 | 2017-05-24 | 广州虎牙信息科技有限公司 | Video playing control method and device as well as terminal equipment |
CN107463370A (en) * | 2017-06-30 | 2017-12-12 | 百度在线网络技术(北京)有限公司 | Striding course rendering intent and system |
CN110618847A (en) * | 2018-06-20 | 2019-12-27 | 华为技术有限公司 | User interface display method and terminal equipment |
CN109388467A (en) * | 2018-09-30 | 2019-02-26 | 百度在线网络技术(北京)有限公司 | Map information display method, device, computer equipment and storage medium |
CN110704148A (en) * | 2019-09-20 | 2020-01-17 | 广州虎牙科技有限公司 | Method and device for acquiring device page elements, server and storage medium |
CN112486620A (en) * | 2020-12-03 | 2021-03-12 | 广州虎牙科技有限公司 | Cross-process off-screen rendering method and device, electronic equipment and storage medium |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113568748A (en) * | 2021-07-27 | 2021-10-29 | Oppo广东移动通信有限公司 | Application process processing method and device, storage medium and electronic equipment |
CN113703647A (en) * | 2021-07-29 | 2021-11-26 | 青岛海尔科技有限公司 | Method and device for realizing page gradual change effect |
CN113986447A (en) * | 2021-12-24 | 2022-01-28 | 畅捷通信息技术股份有限公司 | Interaction method and device of local application service and browser and storage medium |
CN113986447B (en) * | 2021-12-24 | 2022-03-29 | 畅捷通信息技术股份有限公司 | Interaction method and device of local application service and browser and storage medium |
CN114942809A (en) * | 2022-05-19 | 2022-08-26 | 麒麟合盛网络技术股份有限公司 | Animation display method and device |
CN117873740A (en) * | 2024-03-12 | 2024-04-12 | 麒麟软件有限公司 | Method, device and storage medium for constructing process deadlock relation graph based on gdb |
CN117873740B (en) * | 2024-03-12 | 2024-06-07 | 麒麟软件有限公司 | Method, device and storage medium for constructing process deadlock relation graph based on gdb |
Also Published As
Publication number | Publication date |
---|---|
CN113032080B (en) | 2023-06-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113032080A (en) | Page implementation method, application program, electronic device and storage medium | |
CN107992301B (en) | User interface implementation method, client and storage medium | |
CN109597677B (en) | Method and apparatus for processing information | |
EP3129871B1 (en) | Generating a screenshot | |
CN111433743B (en) | APP remote control method and related equipment | |
CN103197842B (en) | The control method of a kind of application window and device | |
US20220007083A1 (en) | Method and stream-pushing client for processing live stream in webrtc | |
CN111198739B (en) | Application view rendering method, device, equipment and storage medium | |
CN108762956B (en) | Method for acquiring Native local data, server, mobile terminal and storage medium | |
CN111026490B (en) | Page rendering method and device, electronic equipment and storage medium | |
WO2016197590A1 (en) | Method and apparatus for providing screenshot service on terminal device and storage medium and device | |
CN112925570A (en) | Application operation method and device based on dual systems, electronic equipment and storage medium | |
CN113784049B (en) | Camera calling method of android system virtual machine, electronic equipment and storage medium | |
CN104516885A (en) | Implementation method and device of browse program double-kernel assembly | |
JP7282133B2 (en) | Browser display verification method, device, computer equipment and storage medium | |
US20200258195A1 (en) | Image Processing Method and Device | |
CN109445760B (en) | Image rendering method and system | |
CN112486620A (en) | Cross-process off-screen rendering method and device, electronic equipment and storage medium | |
CN108335342B (en) | Method, apparatus and computer program product for multi-person drawing on a web browser | |
CN111176771A (en) | Data processing method, system and equipment | |
US11509707B1 (en) | Embedding remote applications into HTML pages | |
US9614900B1 (en) | Multi-process architecture for a split browser | |
CN113778593A (en) | Cloud desktop control method and device, electronic equipment, storage medium and program product | |
EP3835967A1 (en) | Card data display method and apparatus, and storage medium | |
CN111008050B (en) | Page task execution method, device, terminal and storage medium |
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 |