CN113032080B - Page implementation method, application program, electronic device and storage medium - Google Patents

Page implementation method, application program, electronic device and storage medium Download PDF

Info

Publication number
CN113032080B
CN113032080B CN202110352177.8A CN202110352177A CN113032080B CN 113032080 B CN113032080 B CN 113032080B CN 202110352177 A CN202110352177 A CN 202110352177A CN 113032080 B CN113032080 B CN 113032080B
Authority
CN
China
Prior art keywords
rendering
main process
independent
application program
communication
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.)
Active
Application number
CN202110352177.8A
Other languages
Chinese (zh)
Other versions
CN113032080A (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.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya 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 Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202110352177.8A priority Critical patent/CN113032080B/en
Publication of CN113032080A publication Critical patent/CN113032080A/en
Application granted granted Critical
Publication of CN113032080B publication Critical patent/CN113032080B/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/451Execution arrangements for user interfaces
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/543Local

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 realization method, which comprises the following steps: creating a Surface for rendering by a main process, wherein the main process is a process running 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 virtual display component and a Presentation component bound with the virtual display component; the rendering process starts the Presentation component, the service View appointed in the Presentation component is rendered to the virtual display component, and the virtual display component draws the rendering result on the Surface.

Description

Page implementation method, application program, electronic device and storage medium
Technical Field
The present disclosure 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, live Application (APP) programs based on Android platform are rapidly developed. The live APP is not limited by scenes, so that a user can watch various rich contents anytime and anywhere, and the live APP is deeply favored by the user.
However, limited by the existing Android platform and the structure of the APP framework, currently, the live APP generally realizes page rendering mainly based on a main process, however, multiple instances often need to be created for displaying pages with rich contents, and simultaneous rendering of multiple instances on the main process can cause that a single process occupies too much resources, so that higher memory pressure can be faced in the APP operation process, and accordingly memory recovery is triggered more frequently, the APP is easy to get stuck or even crashed, 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 embodiments of the present application, there is provided a page implementation method, which is executed by an application running on an Android platform, including: creating a Surface for rendering by a main process, wherein the main process is a process running 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 virtual display component and a Presentation component bound with the virtual display component; the rendering process starts the Presentation component, the service View appointed in the Presentation component is rendered to the virtual display component, and the virtual display 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 comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to the first aspect of embodiments of the present application when the program is executed.
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, implements 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 comprise the following beneficial effects:
in the embodiment of the application, by using the Presentation technology of the Android platform, the main process of the application program creates an independent process as a rendering process, and the internally specified service View is rendered to the virtual display component through the Presentation component, and rendering content is drawn on the Surface based on the virtual display component to enable a user to watch. Compared with the technical scheme that an application program uses a main process to render in the related art, the embodiment of the application can realize rendering 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 breakdown is reduced, in addition, even if the independent process breaks down, the main process can run normally, and the defect that the whole application program breaks down due to the fact that the user experience is seriously affected 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 specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a flowchart of a page display method according to an exemplary embodiment of the present application.
Fig. 2 is an application flow diagram of a page implementation method according to an exemplary embodiment of the present application.
Fig. 3 is a schematic diagram illustrating a main process and an independent process in communication with each other according to an exemplary embodiment of the present application.
Fig. 4 is a schematic diagram illustrating another master-process in communication with independent processes according to an exemplary embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present 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 or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
Aiming at the application program running on the Android platform, the method is limited by the structure of the existing APP framework, and almost all the application programs at present are realized in a main process, namely the running process when the application program is started. Pages of applications often have rich content that needs to be rendered for display, often using cross-platform technology (WebView, reactNative, flutter, etc. technology), creating multiple instances to implement. However, this causes two relatively significant problems: firstly, all page implementations are all based on rendering implementations of a main process, and then the main process can easily occupy excessive resources, so that APP is caused to summarize and face higher memory pressure in the running process, memory recovery is triggered more frequently, and further APP is easy to get stuck, and user experience is affected. Secondly, a cross-platform technology is adopted, under the condition of embedding a cross-platform component, the probability of the whole APP crashing is also high once errors occur due to huge code in the cross-platform component, and meanwhile, the problem cannot be repaired under the general condition, so that the number of online crashes is increased, and part of user experience is affected.
Therefore, it is necessary to implement a View implementation method capable of running in an independent process, that is, the rendering part of the page implementation is not completed in the main process, but is 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, the normal running of the main process is not affected, and the crash of the whole application program is not caused.
On the Android platform, creating an independent process for an application program can be achieved, but on the Android platform, creating an independent process for Activity is not fine enough, namely, the independent process for Activity cannot be fine to process rendering of a View level, while the independent process for Service cannot operate a main thread UI, namely, the independent process based on Service is independent of UI rendering and does not support process rendering of the View level. Because of the problems of the two components of the Activity and Service of the Android system, no related technical scheme can be realized at present for the View level multiprocess.
The inventor of the application finds that in the process of researching a browser technology and a cross-platform technology (router), a common service View (namely content to be rendered and displayed) is rendered on a drawing interface by using the Presentation technology of an Android platform, so that the realization of a View-level multi-process page can be realized. Through further research, the function can also build a complete View independent integration technology by introducing a Service independent process and an inter-process communication mode. The following describes in detail the technical solutions provided in the embodiments of the present application.
In an embodiment of the present application, a method for implementing a page as shown in fig. 1 is provided, where the method is executed by an application running on an Android platform, and the method includes:
step 101, a main process creates a Surface for rendering, wherein the main process is a process running 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;
step 103, the rendering process creates a virtual display component and a Presentation component bound with the virtual display component;
step 104, the rendering process starts the Presentation component, the service View specified in the Presentation component is rendered to the virtual display component, and the virtual display component draws the rendering result on the Surface.
The Surface is a class (Dialog) of the 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 page content on a screen of the terminal equipment, a Surface creation request is initiated by a main process of the APP, after the Surface is created, drawing can be performed on a canvas, the Surface is saved, and finally, the Surface is synthesized and displayed by a rendering process.
The virtual display component is also a class of the Android system and represents a virtual display, and by calling the created virtual display component, the content in the virtual display of the Android system can be rendered on a Surface, and when the process is terminated, the virtual display can be automatically released.
The Presentation component is a component for realizing multi-screen interaction provided by the Android system. In essence, the Presentation component is also a special class. In the related art, a Presentation component is used to perform multi-screen highlighting. One application scenario is: for the equipment of the cashing platform, a clerk can select and input commodities on a main screen, a subsidiary screen displays bill details of customers, and the display is realized through a Presentation component of an Android system. In this application, the inventor of the present application uses the Presentation component of the Android system to implement the page rendering process of the application program on the independent process created by the main process through 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 end is the main process of the application program, and the Server end is an independent process created by the main process of the application program. Wherein, the container View is used for providing Surface, and the creation of Surface is realized by the main process of the application program through the step 101.
In some embodiments, the Surface comprises: surface View containers or Surface of textureView containers.
Wherein, the SurfaceView container and the textureView container are both View containers. Both of which can be drawn and rendered in separate threads.
The surfmeview container provides a drawing level of the embedded view level specifically, and a developer can control the form of the interface such as the size and the like to ensure the correct position of the rendered interface on the screen. However, the surfacview container is a separate layer of View, more like a separate window, and cannot be animated, panned, zoomed, etc., and two different surfacview containers cannot overlap each other. However, the surfmeview container occupies less resources and drawing speed is faster. The method is suitable for application scenes, such as players, with only one view of the whole page.
The TextureView container can be scaled and translated, can be added with animation, can be transformed at any level, and has higher flexibility. However, textureView consumes more memory than surfeneview and with delay 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 that the Surface may be a Surface provided by the Surface view container or a Surface provided by the TextureView container based on different application requirements, which is not limited in the embodiment of the present application.
After creating a Surface for rendering by the above step 101, the main process of the application program as the Client creates an independent process as a rendering process, i.e. a service (Server) end shown in fig. 2, and transfers the Surface created in step 101 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, an independent process created by the main process is used as a rendering process, the independent process obtains a Surface transmitted by the main process, creates a virtual display component as an abstract display component through the step 103, and creates a Presentation component to bind with the virtual display component; through step 104, the rendering process starts the created Presentation component, and then the service View specified in the Presentation is rendered into the virtual display component, which renders the rendered content onto the shared Surface, so that the user can see the content rendered in the independent process.
The service View is created when the Presentation component is created, and the Presentation is associated with the View, so when the Presentation component is started, the service View specified in the Presentation is automatically rendered into the virtual display component, and the virtual display component draws the rendered content onto the shared Surface.
In the embodiment provided by the application, the Presentation technology of the Android platform is utilized to enable the main process of the application program to create an independent process as a rendering process, and the service View associated with the independent process is rendered to the virtual display component through the Presentation component, so that the rendering content is drawn on the Surface based on the virtual display component to be viewed by a user. Compared with the technical scheme that an application program uses a main process to render in the related art, the embodiment of the application can realize rendering 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 breakdown is reduced, in addition, even if the independent process breaks down, the main process can run normally, and the defect that the whole application program breaks down due to the fact that the user experience is seriously affected can be overcome.
Through the above embodiment, the page rendering can be completed in an independent process created by the main process of the application program, however, the inventor of the application further finds that after the page rendering of the application program is completed through the above embodiment, the main process and the independent process cannot directly realize mutual communication, so that interaction between a user and the application program is caused, and the interaction 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 application analyzes reasons and discovers that the capturing of the gesture event is realized in the main process of the main process, but the Presentation created by the independent process does not support the mapping of the gesture event, so that the embodiment can only be used for rendering, and cannot influence the operation of a user. In addition, because the host process and the independent process cannot directly realize mutual communication, when the independent process needs to acquire certain parameters from the host process, the independent process cannot acquire the parameters from the host process, and therefore the independent process cannot complete partial rendering work.
The inventor of the application finds out through intensive research that the event mechanism of the Android platform is triggered and transmitted through a View-based architecture and a plurality of event methods for calling back the View. Therefore, in order to enable the page implementation method provided in the foregoing embodiments of the present application to implement not only that an independent process created by the host process completes page rendering, but also that the host process and the independent process can implement intercommunication, the page implementation method further includes: and the main process and the rendering process realize inter-process communication based on an AIDL mode of the Android platform.
The AIDL, android Interface Definition Language, android interface definition language is one of Inter-process communication (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 is separated from other processes. However, there are sometimes demands for interaction between processes, comparison and transfer of data, task delegation, etc., and AIDL is being created to meet such demands. AIDL is an interface definition language used for restricting the communication rules between two processes, so that a compiler can generate codes to realize the communication between two processes on the Android device. The IPC mechanism of the AIDL is that communication information between processes is firstly converted into an AIDL protocol message and then sent to the counterpart, and the counterpart receives the AIDL protocol message and then converts the message into a corresponding object. Because the communication information between the processes needs to be converted in two directions, the Android realizes the two-way conversion of the information behind the agent class, and the agent class is generated by an Android compiler and is transparent to the developer. Through AIDL, data of one process can be acquired from the other process and the exposed method can be called, so that the requirement of inter-process communication is met. In general, an application that exposes methods to call other applications is called a server, an application that calls methods of other applications is called a client, and the client interacts by binding services 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 created, i.e., binding with the host process is achieved. Therefore, the main process and the independent process can realize inter-process communication based on an AIDL mode of the Android platform. For the content of AIDL, reference may be made to the related art, and this will not be described in detail in the embodiments of the present application.
According to the embodiment, in addition to the independent process created by the main process, the page rendering can be completed for the page realization of the application process, and communication between processes can be realized based on the AIDL mode of the Android platform, so that the main process and the independent process can respond to the call between each other, and the page realization of the application program is completely the same as the page realization of the page rendering in the main process, and can respond to the interaction action of the user; in addition, the probability of application program crash can be reduced, even if an independent process crashes, the main process can also run normally, and the defect that the whole application program crashes and seriously influences user experience due to the fact that the rendering process crashes can be overcome.
In some embodiments, on the basis that the main process and the rendering process realize inter-process communication based on an AIDL mode of an Android platform, the page realizing method further includes:
and one process of the main process and the independent process sends a calling request to the other process before responding to the appointed trigger signal, and responds to the appointed trigger signal after the other process returns relevant information responding to the appointed trigger signal based on the calling request.
The above embodiments are described in detail below by taking a gesture event of a page of the application program in response to a user input as an example. For convenience of explanation, a process of transmitting the call request will be hereinafter also referred to as a calling end, and another process of returning a response to the specified trigger signal based on the call request will be hereinafter also referred to as a called end.
As described above, when a user clicks such gesture event of View in a main process, capturing of the gesture event is implemented in the main process of the main process, and using the main process and the rendering process to implement inter-process communication based on the AIDL manner of the 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, thereby enabling the main process to respond to the gesture event. In this application scenario, the main process is called, and the independent process is called.
This is explained in connection with fig. 3. As a main process of a calling end, in step 301, after intercepting a Gesture event (Gestme event) such as zooming or moving a page input by a user in a container View of the Surface, in step 302, sending a calling request including the Gesture event related parameter to the independent process by using the Gesture event related parameter as data; after receiving the call request, the independent process finds a Presentation component corresponding to the gesture event based on the related parameters of the gesture event included in the call request, executes a gesture callback method of the rendering service View corresponding to the call request, and returns the execution completion result to the main process, as in step 303; the host process responds to the gesture event based on parameters in the results returned by the independent process, as shown in step 304.
As can be seen from the above examples, according to the page display method provided by the embodiment of the present application, by means of the gesture of the main line Cheng Buhuo of the main process for the container View, gesture event data is transferred to the independent process, the corresponding service View is found in the independent process based on the Presentation component, and relevant information of the gesture event data is returned to the main process, so that gesture event synchronization from the main process to the independent process and response of the main process to the gesture event are realized, and therefore, completion of page rendering of the application program can be ensured, and gesture events of a user can be responded.
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 taken as input gesture event to the main process by a user, and the returned related information is taken as related information responding to the gesture event as an example. Of course, it should be understood by those skilled in the art that, depending on the application scenario and development requirements, the specified trigger signal may also be other trigger signals received by the main process or an independent process, the returned related information is related information corresponding to the other trigger signals, the main process is used as a called end, and the independent process is used as a calling end, which is not limited in the embodiments of the present application.
According to the embodiment, one of the main process and the independent process sends a call request to the other process before responding to the specified trigger signal, and after the other process returns the related information responding to the specified trigger signal based on the call request, the other process responds to the specified trigger signal, and the mode of sending the call request-returning the call related information can enable the application program to render on the independent process, and when the independent process and the main process are required to return the related information related to responding to the trigger signal, the other process can return the related information, so that the one process can respond to the trigger signal, and the page realization effect of the application program in the related technology is realized. In addition, compared with the page implementation method of the application program in the related art, the method has the following advantages: the method can reduce the probability of application program crash, even if an independent process crashes, the main process can normally run, and the defect that the whole application program crashes and seriously influences user experience due to the fact that the rendering process crashes can be overcome.
As can be seen by the examples provided by the above embodiments, the specified trigger signal may include a gesture trigger event of the user intercepted by the host process. When the appointed trigger signal is a gesture trigger event of a user intercepted by the main process, the application program which is rendered with the independent process can be synchronized, and the gesture event from the main process to the independent process and the response of the main process to the gesture event are realized, so that the completion of page rendering of the application program can be ensured, and the gesture event of the user can be responded.
In some embodiments, on the basis that the main process and the rendering process realize inter-process communication based on an AIDL mode of an Android platform, the page realizing method further includes:
and when one process receives the appointed trigger signal, informing the other process to respond to the appointed trigger signal, and receiving a response result of the other process to the appointed trigger signal.
Next, with reference to fig. 4, the above embodiment will be 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 triggering of a network request, and taking the page display brightness information of the application program returned to the network request as an example.
In the example shown in fig. 4, the specified trigger signal is a network request for acquiring page brightness information, and in the case that the independent process is triggered by the network request and needs to acquire brightness information of a page of a current application program from the main process, the independent process is the calling end, and the main process is the called end. Step 401, namely, triggering the independent process by the network request; step 402, namely, sending a call request to the main process for the independent process, notifying the main process to acquire page brightness information, step 403, namely, after the main process receives the call request, responding to the network request to acquire current page brightness information of the application program, and step 404, namely, sending a response result, namely, acquired page brightness information, to the independent process by the main 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 taken as a network request for acquiring the brightness information of the application program page, and the response result is taken as the acquired brightness information of the application program page as an example. Of course, it should be understood by those skilled in the art that, depending on the application scenario and development requirements, the specified trigger signal may also be other trigger signals received by the main process or an independent process, the response result may also be other relevant results corresponding to the trigger signal, the independent process is used as a called end, and the independent process is used as a calling end, which is not limited in the embodiments of the present application.
By the above embodiment, it can be seen that, by adopting a manner that, when a specified trigger signal is received, one of the main process and the independent process notifies the other process to respond to the specified trigger signal and receives a response result of the other process to the specified trigger signal, the application program can implement rendering on the independent process by notifying the response-returning response result, and when any one of the independent process and the main process needs the other process to respond to the trigger signal and return the response result, the above embodiment can enable the other process to return the response result, thereby implementing the 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 art, the method has the following advantages: the method can reduce the probability of application program crash, even if an independent process crashes, the main process can normally run, and the defect that the whole application program crashes and seriously influences user experience due to the fact that the rendering process crashes can be overcome.
In some embodiments, the communication between the master process and the independent process is performed based on a preset protocol, the preset protocol comprising: the data packet sent by one process to another process comprises a calling method name, an additional parameter and a calling identifier; the calling method name indicates a communication item, 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 identifier uniquely indicates a current communication process.
In the foregoing embodiments, it has been described that the inter-process communication between the main process and the independent process in the embodiments of the present application may be implemented based on the AIDL manner. The protocol used by the AIDL may be a preset protocol as described in the above embodiments. Still referring to fig. 3, taking the communication between the host process and the independent process as an example of intercepting a gesture event in a container View to which the host process belongs in a Surface, a description is given of at least a data type included in a data packet interacted by the host process and the independent process based on the preset protocol.
The main process as a calling end encapsulates a calling request into a method data packet based on a preset protocol, and the method data packet mainly records the following data:
MethodName ("send gesture event data");
params ("related data to gesture event");
ID ("identification of this call").
The method name is used for indicating the communication event between the main process and the independent process, and in the communication process shown in fig. 3, the communication event data is "send gesture event data"; params (additional parameters), including parameters related to the communication interaction, in the communication process shown in fig. 3, that is, parameters related to gesture events, for example, parameters indicating that the gesture events are zoom-in, zoom-out, panning, etc., sent by the host process to the independent process; an ID (identification) to uniquely indicate the current communication process, for example, the communication process "data of send gesture event" may be identified in a unique character.
After receiving a Method data packet sent by the main process and analyzing a Method name and additional parameters to be called, the independent process as a called end executes a corresponding calling Method, namely sends gesture event data to a target service View, and encapsulates the result data of the completion of execution into a Callback (Callback) data packet, wherein the Callback data packet mainly records the following data:
MethodName ("send gesture event data");
result ("Result data of execution");
ID ("identification of this call").
The method name is used for indicating the communication item between the main process and the independent process, the content contained in the calling end and the called field is generally the same, and in the communication process shown in fig. 3, the calling end is "sending gesture event data"; result ("Result data of execution"), including parameters related to the communication interaction, for the called end, namely, the Result data returned in response to the calling method, in the communication process shown in fig. 3, namely, the Result data of the gesture event generated by the target service view and returned by the independent process to the main process; the ID (identification) is used to uniquely indicate the current communication process, and the ID returned by the called end is generally the same as the ID sent by the calling end corresponding to the called end.
Of course, it should be understood by those skilled in the art that the preset protocol on which the above main process communicates with the independent process may include other fields in advance, which is not limited in this embodiment of the present application.
According to the embodiment, the communication between the main process and the independent process is performed based on the preset protocol, the content of the data packet sent by the process to the other process is not confirmed in the communication process, and both the processes for communication can rapidly and effectively complete the communication process, so that the method is simple, convenient and easy to implement.
In addition, corresponding to a page implementation method provided in the foregoing embodiments of the present application, the embodiments of the present application further provide a software product, that is, an application program, where the application program includes a computer/instruction, and the computer program/instruction implements the foregoing method embodiments provided in the foregoing embodiments of the present application when executed by a processor. For the relevant content of the application program, reference may be made to the foregoing method embodiments, and details are not repeated herein.
Corresponding to the foregoing method embodiment, 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, an electronic device 500 provided in this embodiment includes: a processor 501, a memory 502 and a computer program stored on the memory 502 and executable on the processor 501, which processor implements the methods of the present application. The processor 501 in the electronic device may be one or more, and one processor 501 is illustrated in fig. 5, 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 otherwise, in fig. 5 by way of example by means of a communication bus 503.
The processor 501 of the electronic device in this embodiment integrates the application program provided in the above embodiment. Furthermore, the memory 502 in the electronic device serves as a computer-readable storage medium, and 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, i.e., implements the various method embodiments described above, by running software programs, instructions, and modules stored in the memory 502.
Memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the device, etc. In addition, 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 the device 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 processor 501 implements the method provided in the embodiment of the present application by executing a program stored in the memory 502, thereby executing various functional applications and data processing.
Furthermore, the present application provides a computer readable storage medium storing 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. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 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 include a data signal propagated in baseband or as part of a carrier wave, with computer readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 of the present application may be written in 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Other embodiments of the present application will be 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 application 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 application 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 is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (4)

1. The page implementation method is characterized by being executed by an application program running on an Android platform and comprising the following steps of:
creating a Surface for rendering by a main process, wherein the main process is a process running when the application program is started, the Surface comprises a Surface view container or a Surface of a TextureView container, and the Surface view container and the TextureView container can be drawn and rendered in independent threads;
the method comprises the steps that an independent process is established as a rendering process by the main process, and the Surface is transmitted to the rendering process, so that the Surface is shared by the main process and the rendering process, and the main process and the rendering process realize inter-process communication based on an AIDL mode of an Android platform;
the rendering process creates a visual display component and a Presentation component bound with the visual display component, wherein a service View is created when the Presentation component is created, and the Presentation component is associated with the service View;
the rendering process starts the Presentation component, the service View appointed in the Presentation component is rendered to the virtual display component, and the virtual display component draws a rendering result on the Surface;
after intercepting a gesture trigger event of a user, a main process sends a calling request containing relevant parameters of the gesture event to the rendering process;
the rendering process searches a Presentation component corresponding to the gesture event based on the gesture event related parameters, finds a rendering service View corresponding to the call request based on the Presentation component in the rendering process, executes a gesture callback method of the rendering service View, and returns an execution result to the main process;
and the main process responds to the gesture event based on parameters in an execution result returned by the rendering process.
2. The method of claim 1, wherein the inter-process communication is based on a pre-set protocol comprising: the data packet sent by one process to another process comprises a calling method name, an additional parameter and a calling identifier; the calling method name indicates a communication item, 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 identifier uniquely indicates a current communication process.
3. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 2 when the program is executed.
4. 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 2.
CN202110352177.8A 2021-03-31 2021-03-31 Page implementation method, application program, electronic device and storage medium Active CN113032080B (en)

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 CN113032080A (en) 2021-06-25
CN113032080B true 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)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113568748B (en) * 2021-07-27 2024-06-18 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
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
CN115734023A (en) * 2022-11-28 2023-03-03 福建新大陆支付技术有限公司 Method, device and medium for transmitting video frame based on android cross-process
CN117873740B (en) * 2024-03-12 2024-06-07 麒麟软件有限公司 Method, device and storage medium for constructing process deadlock relation graph based on gdb

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893028A (en) * 2016-03-28 2016-08-24 乐视控股(北京)有限公司 Method and device for drawing dynamic wallpaper of mobile terminal
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

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0517357D0 (en) * 2005-08-25 2005-10-05 Corizon Ltd User interface generation
US9286142B2 (en) * 2011-04-07 2016-03-15 Adobe Systems Incorporated Methods and systems for supporting a rendering API using a runtime environment
CN105068866B (en) * 2012-05-04 2019-06-04 北京奇虎科技有限公司 A kind of course control method and device of browser input control
CN103019703B (en) * 2012-11-28 2016-06-22 北京奇虎科技有限公司 Tool window loading method and device for browser
CN104268019B (en) * 2014-09-23 2018-04-27 广州猎豹网络科技有限公司 A kind of software running method, device and terminal
CN105022627B (en) * 2015-06-02 2018-04-06 上海斐讯数据通信技术有限公司 A kind of communication means in android system between View
US10169006B2 (en) * 2015-09-02 2019-01-01 International Business Machines Corporation Computer-vision based execution of graphical user interface (GUI) application actions
US10764375B2 (en) * 2016-10-13 2020-09-01 Sierraware, Llc Method for cloud based mobile application virtualization
CN107977272A (en) * 2016-10-25 2018-05-01 腾讯科技(深圳)有限公司 The method and device of application operation
CN109388467B (en) * 2018-09-30 2022-12-02 阿波罗智联(北京)科技有限公司 Map information display method, map information display device, computer equipment and storage medium
CN110704148B (en) * 2019-09-20 2023-09-05 广州虎牙科技有限公司 Acquisition method and device of equipment page element, 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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893028A (en) * 2016-03-28 2016-08-24 乐视控股(北京)有限公司 Method and device for drawing dynamic wallpaper of mobile terminal
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

Also Published As

Publication number Publication date
CN113032080A (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN113032080B (en) Page implementation method, application program, electronic device and storage medium
CN111433743B (en) APP remote control method and related equipment
CN111414225B (en) Three-dimensional model remote display method, first terminal, electronic device and storage medium
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
US9070211B1 (en) Webview tag for a sandboxed multiprocess browser
CN111240626A (en) Method and system for double-screen interaction of intelligent cabin operating system based on Hypervisor
US9477575B2 (en) Method and system for implementing a multi-threaded API stream replay
US11314391B2 (en) Navigation bar controlling method and terminal
CN111176771A (en) Data processing method, system and equipment
CN108335342B (en) Method, apparatus and computer program product for multi-person drawing on a web browser
CN113784049A (en) Camera calling method of android system virtual machine, electronic device and storage medium
CN112486620A (en) Cross-process off-screen rendering method and device, electronic equipment and storage medium
CN111669447A (en) Page display method, device, equipment and medium
CN113655975A (en) Image display method, image display device, electronic apparatus, and medium
CN111918102A (en) Bullet screen management method, bullet screen management device, bullet screen management equipment and storage medium
CN117609646A (en) Scene rendering method and device, electronic equipment and storage medium
CN110543384B (en) Memory write-back method, device, terminal and storage medium
CN110737385A (en) video mouse interaction method, intelligent terminal and storage medium
CN113645484B (en) Data visualization accelerated rendering method based on graphic processor
CN109960562B (en) Information display method and device and computer readable storage medium
CN114356475A (en) Display processing method, device, equipment and storage medium
CN114547523A (en) Method, device, equipment and storage medium for performing activity navigation in live broadcast room
CN111913711A (en) Video rendering method and device
CN109857568B (en) Data encapsulation and processing 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