CN115543480A - Activity component call processing method, system, computer equipment and storage medium - Google Patents

Activity component call processing method, system, computer equipment and storage medium Download PDF

Info

Publication number
CN115543480A
CN115543480A CN202211239018.8A CN202211239018A CN115543480A CN 115543480 A CN115543480 A CN 115543480A CN 202211239018 A CN202211239018 A CN 202211239018A CN 115543480 A CN115543480 A CN 115543480A
Authority
CN
China
Prior art keywords
activity component
component
caller
return result
intention information
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.)
Pending
Application number
CN202211239018.8A
Other languages
Chinese (zh)
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.)
Zhongyuan Bank Co ltd
Original Assignee
Zhongyuan Bank 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 Zhongyuan Bank Co ltd filed Critical Zhongyuan Bank Co ltd
Priority to CN202211239018.8A priority Critical patent/CN115543480A/en
Publication of CN115543480A publication Critical patent/CN115543480A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to the technical field of communication, and provides an Activity component call processing method, a system, a computer device and a storage medium, which comprise the following steps: establishing communication connection with a calling party, and establishing cross-process connection with a preset agent Activity component; receiving intention information input by a caller, sending the intention information to the agent Activity component through cross-process connection, and enabling the agent Activity component to call a target Activity component corresponding to the intention information to process the intention information and obtain a return result; and receiving a return result sent by the agent Activity component, and returning the return result to the caller. According to the method and the device, cross-process calling of the Activity component is realized, the range of the target Activity component which can be called by a calling party is expanded, the complexity of a calling party code is reduced, the logicality of the calling party is improved, the calling party can be ensured to efficiently obtain data from the target component, and operation, maintenance and functional test on the calling party are facilitated.

Description

Activity component call processing method, system, computer equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to an Activity component call processing method, system, computer device, and storage medium.
Background
In an Android app, a scenario of starting an Activity and obtaining a result returned by the Activity is common, for example: to select a photo from the system album, the system album Activity needs to be started first, and after the user selects the photo, the album Activity returns to the selected photo. In Android, a target Activity is started through an Activity. The inventors have realized, however, that,
the operation of starting the Activity and obtaining the return of the Activity currently needs to be realized based on a calling party with an interface Activity component, and the calling party without the interface Activity component cannot call the starting target Activity, so that the condition that the calling range of the target Activity component is narrow is caused.
Disclosure of Invention
The application provides an Activity component call processing method, system, computer equipment and storage medium, which are used for solving the problems.
In a first aspect, the present application provides an Activity component call processing method, which is executed in a process management component of a terminal, and includes:
establishing communication connection with a caller, and establishing cross-process connection with a preset agent Activity component, wherein the caller is a component displayed on the current page of the terminal, and the cross-process connection is used for enabling the caller to access the agent Activity components in different processes with the caller; wherein the caller is a brick with or without an interface Activity component;
receiving intention information input by a caller, sending the intention information to the agent Activity component through the cross-process connection, and enabling the agent Activity component to call a target Activity component corresponding to the intention information to process the intention information and obtain a return result;
and receiving a return result sent by the agent Activity component, and returning the return result to the caller.
In the above solution, the establishing a cross-process connection with a preset agent Activity component includes:
creating a service process and generating connection mechanism information corresponding to the service process, and creating a connection driver corresponding to the service process;
sending the connection mechanism information to the agent Activity component, and creating a client process corresponding to the service process in the agent Activity component according to the connection mechanism information;
creating a service management process in the agent Activity component, so that the client process can refer to the service process according to the service management process;
and calling the connection driver to form communication connection between the service process and the client process, and constructing cross-process connection between the communication connection serving as the intention information and the agent Activity component.
In the foregoing solution, the returning the return result to the caller includes:
extracting a return result in a service process in the cross-process connection;
and sending the return result to a calling party.
In a second aspect, the present application provides an Activity component invocation processing method, which runs in a proxy Activity component of a terminal, and includes:
constructing cross-process connection with a process management component, and receiving intention information sent by the process management component; wherein the intention information is request information sent to the process management component by a caller, the caller being a chunk with or without an interface Activity component;
identifying a target Activity component corresponding to the intention information, and instantiating the target Activity component;
calling the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component;
and sending the return result to the process management component through the cross-process connection, so that the process management component sends the return result to a caller.
In the above scheme, the identifying a target Activity component corresponding to the intention information and instantiating the target Activity component includes:
acquiring component information from intention information, wherein the component information refers to the number of a target Activity component which needs to be called by the intention information;
and loading the target Activity component corresponding to the component information into a preset idle process, and starting the target Activity component corresponding to the component information, wherein the instantiation of the target Activity component is realized by loading the target Activity component into the process.
In the above scheme, the invoking the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component includes:
calling the target Activity component to process the intention information through interaction logic in the target Activity component to obtain a return result;
and receiving the returned result returned by the target Activity component according to the result setting method in the target Activity component.
In the foregoing solution, the sending the return result to the process management component through the cross-process connection includes:
obtaining a return result sent by the target Activity component from a preset component result method;
and sending the return result to the process management component according to a result setting method in the client process connected in the cross-process mode.
In a third aspect, the present application provides an Activity component call processing system, running in a terminal, including: the system comprises a calling party, a process management component, an agent Activity component and at least one target Activity component;
the caller is connected with an input module of the terminal and used for receiving intention information sent by the input module; the calling party is a component displayed on the current page of the terminal;
the process management component is connected with the caller, and cross-process connection is formed between the process management component and the agent Activity component; the cross-process connection is used for realizing information interaction between process management components and agent Activity components in different processes;
the process management component is used for receiving intention information sent by the caller and sending the intention information to the agent Activity component;
the agent Activity component is connected with the at least one target Activity component, and is used for receiving intention information sent by the process management component, identifying the target Activity component corresponding to the intention information and instantiating the target Activity component;
the agent Activity component is also used for calling the target Activity component to process the intention information to obtain a return result, receiving the return result sent by the target Activity component corresponding to the intention information, sending the return result to the process management component through the cross-process connection, and enabling the process management component to send the return result to a calling party;
and the process management component is also used for returning a return result sent by the agent Activity component to the caller.
In a fourth aspect, the present application provides a computer device comprising: a processor and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement an Activity component Call processing method according to the above claims.
In a fifth aspect, the present application provides a computer-readable storage medium, where a computer executable instruction is stored, and when the computer executable instruction is executed by a processor, the computer executable instruction is used to implement the above-mentioned Activity component call processing method.
In a sixth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the Activity component call processing method described above is implemented.
According to the Activity component call processing method, the system, the computer equipment and the storage medium, the cross-process connection is established between the process management component and the agent Activity component, so that the caller can call the target Activity component which is not in the same process as the caller through the agent Activity component and the cross-process connection, and obtain the return result generated by the target Activity component, the cross-process call of the Activity component is realized, the target Activity component can be called by the Activity component with the interface or the Activity component without the interface through the agent Activity component, the call range of the target Activity component can be enlarged, and the application range of the target Activity component is enlarged.
Meanwhile, the target Activity component corresponding to the intention information is identified through the proxy Activity component, the return result is obtained by receiving the target Activity component and processing the intention information, the intention information and the return result are fed back to the process management component one by one through the proxy Activity component, the complexity of the code of the calling party is reduced, the logic of the calling party is improved, the calling party is ensured to be capable of efficiently acquiring data from the target component, and the maintenance and function test of the calling party are facilitated.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
fig. 2 is a flowchart of an Activity component call processing method according to embodiment 1 of the present application;
fig. 3 is a flowchart of embodiment 2 of an Activity component invocation processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of program modules of embodiment 3 of an Activity component Call processing system according to the present invention;
FIG. 5 is a program module communication interaction diagram of an embodiment 3 of an Activity component invocation processing system provided by the invention;
FIG. 6 is a flowchart of an Activity component call processing apparatus according to an embodiment 4 of the present invention;
FIG. 7 is a flowchart of an Activity component call processing apparatus according to an embodiment 5 of the present invention;
fig. 8 is a schematic diagram of a hardware structure of a computer device in the computer device according to the present invention.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
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.
Referring to fig. 1, the application scenario is as follows: the caller 11, the process management component 12, the agent Activity component 13 and at least one target Activity component 14 are installed in the terminal 4, assuming that the caller 11 is the caller of a first application (e.g. an edit page or a background cache of a friend circle of a WeChat) and the target Activity component 14 is a cache library of a second application (e.g. a picture or a video of an album page), since it is easy to call a photo in the cache library of the second application if the caller is an edit page with a corresponding interface Activity component, but if the caller is a background cache without a corresponding interface Activity component, that is: under the condition that the photo is extracted from the cache library of the second application as return data only through the background and is not displayed on the interface Activity component, the current android system cannot meet the requirement due to the defect that the target Activity component cannot be called through the no interface Activity component.
In contrast, according to the application, the process management component 12 is in communication connection with a caller, the intention information (including photo codes in an album) sent by the caller is received, the intention information is sent to the proxy Activity component 13 by the process management component 12, the proxy Activity component 13 calls a cache library of a second application, the cache library is loaded into the stack 5 to instantiate the cache library, the photo (namely, return data) is extracted from the instantiated cache library according to the intention information, the commodity page is sent to the caller through cross-process connection, and then the target Activity component is called through the proxy Activity component 13 and the technical effect of the photo is obtained, so that the caller can obtain the photo in an edited page, and the photo can be cached in a preset background cache process without depending on the interface Activity component, and the defect that the current android system cannot call the target Activity component through the interface-free Activity component is overcome.
The data transmission method provided by the application aims to solve the technical problems in the prior art.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Example 1:
referring to fig. 2, the present application provides an Activity component call processing method, which runs in a process management component of a terminal, and includes:
s101: establishing communication connection with a caller, and establishing cross-process connection with a preset agent Activity component, wherein the caller is a component displayed on the current page of the terminal, and the cross-process connection is used for enabling the caller to access the agent Activity components in different processes with the caller; wherein the caller is a brick with or without an interface Activity component;
s102: receiving intention information input by a caller, sending the intention information to the agent Activity component through the cross-process connection, and enabling the agent Activity component to call a target Activity component corresponding to the intention information to process the intention information and obtain a return result;
s103: and receiving a return result sent by the agent Activity component, and returning the return result to the caller.
In the embodiment, cross-process connection is established between the agent Activity component and the agent Activity component, and the intention information is sent to the agent Activity component, so that the agent Activity component calls a target Activity component corresponding to the intention information to process the intention information and obtain a return result; the method and the system enable the caller to call the target Activity component which is not in the same process with the caller through the proxy Activity component and the cross-process connection, obtain a return result generated by the target Activity component, realize the cross-process call of the Activity component, enable the target Activity component to be called by the Activities component with the interface and the Activities component without the interface through the proxy Activity component, expand the scope of the target Activity component which can be called, and further expand the application scope of the target Activity component.
In a preferred embodiment, said building a cross-process connection with a preset agent Activity component comprises:
s11: creating a service process and generating connection mechanism information corresponding to the service process, and creating a connection driver corresponding to the service process;
s12: sending the connection mechanism information to the agent Activity component, and creating a client process corresponding to the service process in the agent Activity component according to the connection mechanism information;
s13: creating a service management process in the agent Activity component, so that the client process can refer to the service process according to the service management process;
s14: and calling the connection driver to form communication connection between the service process and the client process, and constructing cross-process connection between the communication connection serving as the intention information and the agent Activity component.
In this embodiment, an aid is used to create a service process in the process management component and generate connection mechanism information, and an aid is used to create a client process in the proxy Activity component according to the connection mechanism information;
because the processes in the Android system cannot share the memory, the embodiment realizes that the Activity components in different processes in the Android system can communicate data through the Binder mechanism.
The AIDL refers to an Android Interface Definition Language, namely an Android Interface Definition Language, and is used for defining a programming Interface approved by both a client process and a service process so as to realize communication between a process where an agent Activity component corresponding to the client process is located and a process where a process management component corresponding to the service process is located.
Specifically, the cross-process connection is Binder communication, which includes:
client process (Client process) a process that uses a service.
Service process (Server process): a process of providing a service.
Service management process (ServiceManager process): the function of the ServiceManager is to convert the name of a Binder in character form into a reference to the Binder in the Client, so that the Client can obtain a reference to the Binder entity in the Server by the name of the Binder.
Connected drive (Binder drive): the system is responsible for establishing the Binder communication among the processes, transmitting the Binder among the processes, managing the Binder reference count, transmitting and interacting the data packet among the processes and the like.
The process management component is used for receiving intention information sent by the caller and sending the intention information to the agent Activity component;
in this embodiment, the process management component starts the proxy Activity component by calling a startActivity () method in Context, and sends the intention information to the proxy Activity component.
Because the proxy Activity component and the process management component are in different processes, the cross-process operation of the startActivity () method in Context realizes the technical effect that the process management component in one process can send a message for starting the proxy Activity component to the proxy Activity component in the other process. Context is a predefined class in the android system that contains the method for launching the component. The agent Activity component is connected with the at least one target Activity component, and is used for receiving intention information sent by the process management component, identifying the target Activity component corresponding to the intention information and instantiating the target Activity component; the target Activity component and the proxy Activity component are in communication connection through a Binder mechanism preset in the android system, and the Binder mechanism can realize the same-process communication and cross-process communication between the target Activity component and the proxy Activity component.
The agent Activity component is also used for calling the target Activity component to process the intention information to obtain a return result, receiving the return result sent by the target Activity component corresponding to the intention information, sending the return result to the process management component through the cross-process connection, and enabling the process management component to send the return result to a calling party.
When a caller with an interface Activity component calls a target Activity component directly, intention information sent by the caller and a return result fed back by the target Activity component are not in the same program block due to the program setting of the android system, so that the contents of the intention information and the return result in an internal program of the caller are very disordered, and the maintenance and the functional test of the caller are not facilitated by the operation and the test;
according to the method and the device, the target Activity component corresponding to the intention information is identified through the proxy Activity component, the target Activity component is received through the proxy Activity component, the intention information is processed through the proxy Activity component, and the returned result is obtained, so that the intention information and the returned result are fed back to the process management component through the proxy Activity component one by one and correspond to each other in the process management component one by one, the complexity of a calling party code is reduced, the logic of relevance between the intention information and the returned result is improved, the calling party can be ensured to obtain data from the target component efficiently, and the maintenance and the functional test of the calling party are facilitated through operation and testing. In a preferred embodiment, the returning the return result to the caller includes:
s21: and extracting a return result in the service process in the cross-process connection.
S22: and sending the return result to a calling party.
In this embodiment, the process management component obtains a return result of the target activity in an onResult method of a binder server (service process), where the onResult method is a method for storing a return result sent by a client process to the service process.
And the process management component sends the return result to the caller through the callback of the received result, wherein the callback of the received result represents an interface of the caller called when the return result is sent to the caller, so that the process management component can send the return result to the caller.
Example 2:
referring to fig. 3, the present application provides an Activity component call processing method, which runs in a proxy Activity component of a terminal, and includes:
s201: constructing cross-process connection with a process management component, and receiving intention information sent by the process management component; wherein the intention information is request information sent to the process management component by a caller, the caller being a chunk with or without an interface Activity component;
s202: identifying a target Activity component corresponding to the intention information, and instantiating the target Activity component;
s203: calling the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component;
s204: and sending the return result to the process management component through the cross-process connection, so that the process management component sends the return result to a caller.
In the embodiment, a cross-process connection is established between the agent Activity component and the process management component, and the intention information is sent to the agent Activity component, so that the agent Activity component calls a target Activity component corresponding to the intention information to process the intention information and obtain a return result;
the method and the system enable the caller to call the target Activity component which is not in the same process as the caller through the proxy Activity component and the cross-process connection, and obtain a return result generated by the target Activity component, thereby realizing the cross-process call of the Activity component and expanding the range of the target Activity component which can be called by the caller.
Meanwhile, the target Activity component corresponding to the intention information is identified through the proxy Activity component, the intention information is received and processed by the target Activity component to obtain a return result, so that the intention information and the return result are fed back to the process management component one by one through the proxy Activity component, the complexity of a caller code is reduced, the logic associated with the intention information and the return result is improved, the caller can be ensured to efficiently obtain data from the target component, and the maintenance and function test of the caller are facilitated through operation, maintenance and test.
In a preferred embodiment, identifying a target Activity component corresponding to the intent information, instantiating the target Activity component, includes:
and S31, acquiring component information from the intention information, wherein the component information refers to the number of a target Activity component which needs to be called by the intention information.
S32: and loading the target Activity component corresponding to the component information into a preset idle process, and starting the target Activity component corresponding to the component information, wherein the instantiation of the target Activity component is realized by loading the target Activity component into the process.
In this embodiment, the event information in the proxy Activity component intention information is obtained, a startActivity () method in the proxy Activity component is called to start a target, and a target Activity component corresponding to the component information is started, where the startActivity (event) of the Activity is used to start the target Activity component, and the target Activity component is pushed to the stack top. The parameter Intent is used for describing the target Activity component, wherein the technical effect of instantiating the target Activity component is realized by loading the target Activity component into the process.
In this embodiment, the target Activity component corresponding to the component information may be loaded into an idle process in the process in which the proxy Activity component is located, where the idle process is an idle resource in the process in which the proxy Activity component is located, so that the target Activity component and the proxy Activity component are in the same process;
target Activity components corresponding to the component information can also be loaded into idle processes different from the process in which the proxy Activity component is located, so that the target Activity components and the proxy Activity components are located in different processes;
the target Activity component and the agent Activity component are in communication connection through a Binder mechanism preset in the android system, and the Binder mechanism can realize the same-process communication and cross-process communication between the target Activity component and the agent Activity component. In a preferred embodiment, the invoking the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component includes:
s41: calling the target Activity component to process the intention information through interaction logic in the target Activity component to obtain a return result;
s42: and receiving the returned result returned by the target Activity component according to the result setting method in the target Activity component.
In this step, the interaction logic includes two words, one is interaction and the other is logic, where interaction is information and operation, how information flows and how operation is performed; logic, which is an interactive connection, combining the involved interactions in a certain way; therefore, the interactive logic is a computer rule that defines in advance what kind of operation processing is performed in the target Activity component according to what kind of intention information, and what kind of return result is generated.
Activity used to pass data back to its launch page via setResult method (set result method) in the target Activity component, namely: returning the return result to the broker Activity component.
In a preferred embodiment, the sending the return result to the process management component through the cross-process connection includes:
s51: and obtaining a return result sent by the target Activity component from a preset component result method.
S52: and sending the return result to the process management component according to a result setting method in the client process of the cross-process connection.
In this embodiment, the component result method is a callback function onactityresult, and the principle of the callback function onactityresult is as follows: activityA calls startActivityForResult (intent, requestCode) to start ActivityB; when activityB replies to activityA, invoking setResult to set a returned result, and then invoking finish; finally, obtaining a return result of activityB at the onaactivityResult of activityA;
and calling a setResult method (result setting method) of a binder client to set a return result of the target Activity, and therefore, sending the return result to a binder server (service process) of the process management component through the result setting method of the client.
Example 3:
referring to fig. 4 and 5, the application provides an Activity component call processing system 1, running in a terminal, including: a caller 11, a process management component 12, a proxy Activity component 13, and at least one target Activity component 14;
the caller 11 is connected with an input module of the terminal, and the caller 11 receives intention information sent by the input module; the caller 11 is a component displayed on the current page of the terminal;
in this example, the intention information sent by the caller 11 includes Intent information and a callback of a received result, and the Intent information mainly solves communication among various components of the Android application. The Android is responsible for describing actions, action related data and additional data of one operation in the application, and the Android is responsible for finding a corresponding component according to the description of the Intent, transmitting the Intent to the called component and completing calling of the component. The input module is an input device of the terminal, for example: keys, touch screens, keyboards, etc.; the input module sends the key or position triggered by the user to the caller 11 to realize event triggering of the corresponding key or position.
The callback of the received result represents an interface of the caller 11 that is called when the returned result is sent to the caller 11, so that the process management component 12 can send the returned result to the caller 11, wherein the caller 11 and the process management component 12 are in the same process.
The process management component 12 is connected with the caller 11, and a cross-process connection is formed between the process management component 12 and the agent Activity component 13; the cross-process connection is used for realizing information interaction between the process management component 12 and the agent Activity component 13 in different processes.
In this embodiment, the cross-process connection between the process management component 12 and the agent Activity component 13 is a communication connection based on a Binder mechanism, where a Binder is an inter-process communication mechanism and is used to implement cross-process communication in an android. The connection mechanism information refers to attribute information describing a service process.
Preferably, the cross-process connection between the process management component 12 and the agent Activity component 13 includes:
t11: a service process provided in the process management component 12 and connection mechanism information corresponding to the service process;
t12: the agent Activity component 13 is provided with a client process corresponding to the service process and established according to the connection mechanism information;
t13: the agent Activity component 13 is provided with a service management process, and the service management process is used for forming process connection between the service process and the client process; the process management component 12 has a connection driver, and the connection driver is configured to implement data transmission between the service process and the client process, so that the process connection is converted into the cross-process connection.
In this embodiment, a service process is created in the process management component 12 by aid l and connection mechanism information is generated, and a client process is created in the proxy Activity component 13 by aid l according to the connection mechanism information;
because the processes in the Android system cannot share the memory, the embodiment can implement data communication between Activity components in different processes in the Android system through a Binder mechanism.
The aid l is an Android Interface Definition Language, which is an Android Interface Definition Language, and is used for defining a programming Interface approved by both a client process and a service process, so as to implement communication between a process in which the proxy Activity component 13 corresponding to the client process is located and a process in which the process management component 12 corresponding to the service process is located.
Specifically, the cross-process connection is Binder communication, which includes:
client process (Client process): a process of using a service.
Service process (Server process): a process of providing a service.
Service management process (ServiceManager process): the function of the ServiceManager is to convert the name of a Binder in character form into a reference to the Binder in the Client, so that the Client can obtain a reference to the Binder entity in the Server by the name of the Binder.
Connected drive (Binder drive): the system is responsible for establishing the Binder communication among the processes, transmitting the Binder among the processes, managing the Binder reference count, transmitting and interacting the data packet among the processes and the like.
The process management component 12 is configured to receive intention information sent by the caller 11, and send the intention information to the agent Activity component 13;
in this embodiment, the process management component 12 starts the proxy Activity component 13 by calling a startActivity () method in Context, and sends the intention information to the proxy Activity component 13.
Since the proxy Activity component 13 and the process management component 12 are in different processes, the cross-process operation of the startActivity () method in Context achieves the technical effect that the process management component 12 in one process can send a message for starting the proxy Activity component 13 to the proxy Activity component 13 in another process. Context is a predefined class in the android system that contains the method for launching the component. The proxy Activity component 13 is connected to the at least one target Activity component 14, and the proxy Activity component 13 is configured to receive intention information sent by the process management component 12, identify a target Activity component 14 corresponding to the intention information, instantiate the proxy Activity component 13 to the target Activity component 14, invoke the target Activity component 14 to process the intention information to obtain a return result, receive the return result sent by the target Activity component 14 corresponding to the intention information, send the return result to the process management component through the cross-process connection, and send the return result to the caller 12 by the process management component.
Specifically, proxy Activity component 13 includes:
t21: the agent Activity component 13 is configured to obtain component information from Intent information in the Intent information, where the component information refers to a number of a target Activity component 14 that needs to be called by the Intent information.
T22: and the proxy Activity component 13 is used for loading the target Activity component 14 corresponding to the component information into the process of the proxy Activity component 13 and starting the target Activity component 14 corresponding to the component information.
In this embodiment, the agent Activity component 13 obtains component information from Intent information in the Intent information, invokes a startActivity () method in the agent Activity component 13 to start a target, and starts a target Activity component 14 corresponding to the component information, where the startActivity (Intent) of Activity is used to start the target Activity component 14, and the target Activity component 14 is pushed onto the stack top. The parameter Intent is used to describe the target Activity component 14, wherein the technical effect of instantiating the target Activity component 14 is achieved by loading the target Activity component 14 into the process.
T23: the target Activity component 14 is configured to process the intention information through an interaction logic in the target Activity component 14 to obtain a return result, and send the return result to the agent Activity component 13 according to a result setting method in the target Activity component 14.
In this step, the interaction logic includes two words, one is interaction and the other is logic, where interaction is information and operation, how information flows and how operation is performed; logic, which is an interactive connection, combining the involved interactions in a certain way; therefore, the interactive logic is a computer rule that defines in advance what operation process is performed in the target Activity component 14 according to what intention information, and what return result is generated.
Activity used to pass data back to its launch page via the setResult method (set result method) in the target Activity component 14, namely: the return results are returned to broker Activity component 13.
T24: the agent Activity component 13 is configured to obtain a return result sent by the target Activity component 14 from a component result method in the agent Activity component 13, and send the return result to the process management component 12 according to a set result method in the client process connected across processes.
In this embodiment, the component result method is a callback function onactive result, and the principle of the callback function onactive result is as follows: activityA calls startActivityForResult (intent, requestCode) to start ActivityB; when activityB replies to activityA, invoking setResult to set a returned result, and then invoking finish; finally, obtaining a return result of activityB at the onaactivityResult of activityA;
the setResult method (set result method) of the binder client is called to set the return result of the target Activity, and therefore, the return result is sent to the binder server (service process) of the process management component 12 by the set result method of the client process.
The process management component 12 is further configured to return a return result sent by the agent Activity component 13 to the caller 11.
In this embodiment, the process management component 12 further includes:
t31: the process management component 12 is used to extract the returned results in the service processes in the cross-process connection.
In this step, the process management component 12 obtains the return result of the target activity in the onResult method of the binder server (service process), where the onResult method is a method for storing the return result sent by the client process to the service process.
T32: the process management component 12 is configured to send the return result to the caller 11.
In this step, the process management component 12 sends the return result to the caller 11 through the callback of the received result, where the callback of the received result represents an interface of the caller 11 that is called when the return result is sent to the caller 11, so that the process management component 12 can send the return result to the caller 11.
Example 4:
referring to fig. 6, the present application provides an Activity component call processing apparatus 2 installed in a process management component of a terminal, including:
the process communication module 21 is configured to establish a communication connection with a caller, and establish a cross-process connection with a preset agent Activity component, where the caller is a component displayed on a current page of the terminal, and the cross-process connection is used to enable the caller to access the agent Activity component in a different process from the caller;
the cross-process calling module 22 is configured to receive intention information input by a caller, send the intention information to the agent Activity component through the cross-process connection, and enable the agent Activity component to call a target Activity component corresponding to the intention information to process the intention information and obtain a return result;
and the result feedback module 23 is configured to receive a return result sent by the agent Activity component, and return the return result to the caller.
Example 5:
referring to fig. 7, the present application provides an Activity component call processing apparatus 3, installed in an agent Activity component of a terminal, including:
the agent communication module 31 is used for establishing cross-process connection with the process management component and receiving intention information sent by the process management component;
a target instantiation module 32, configured to identify a target Activity component corresponding to the intention information, and instantiate the target Activity component;
the target calling module 33 is configured to call the target Activity component to process the intention information to obtain a return result, and receive the return result sent by the target Activity component;
a result returning module 34, configured to send the return result to the process management component through the cross-process connection, so that the process management component sends the return result to the caller.
Example 6:
to achieve the above object, the present application also provides a computer device 6, comprising: a processor and a memory communicatively coupled to the processor; the memory stores computer-executable instructions;
the processor executes the computer execution instruction stored in the memory to implement the above-mentioned Activity component call processing method, where components of the Activity component call processing apparatus may be distributed in different computer devices, and the computer device 6 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster formed by multiple application servers) that executes a program, and the like. The computer device of the embodiment at least includes but is not limited to: a memory 61, a processor 62, which may be communicatively coupled to each other via a system bus, as shown in FIG. 8. It should be noted that fig. 8 only shows a computer device with components, but it should be understood that not all of the shown components are required to be implemented, and more or fewer components may be implemented instead. In the present embodiment, the memory 61 (i.e., the readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 61 may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory 61 may be an external storage device of a computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the memory 61 may also include both internal and external storage units of the computer device. In this embodiment, the memory 61 is generally used for storing an operating system and various application software installed in the computer device, for example, program codes of the Activity component call processing device in the third embodiment. Further, the memory 61 may also be used to temporarily store various types of data that have been output or are to be output. Processor 62 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 62 is typically used to control the overall operation of the computer device. In this embodiment, the processor 62 is configured to execute program codes or process data stored in the memory 61, for example, execute an Activity component call processing device, so as to implement the Activity component call processing method according to the foregoing embodiment.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute some steps of the methods described in the embodiments of the present application. It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in the incorporated application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor. The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.
To achieve the above objects, the present application also provides a computer readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App, etc., on which computer executable instructions are stored, and the program implements corresponding functions when executed by the processor 62. The computer-readable storage medium of this embodiment is used for storing computer-executable instructions for implementing the Activity component call processing method, and when being executed by the processor 62, the computer-readable storage medium implements the Activity component call processing method of the above-mentioned embodiment.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
The application provides a computer program product, which comprises a computer program, and the computer program realizes the above-mentioned Activity component calling processing method when being executed by a processor.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
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 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.

Claims (10)

1. An Activity component call processing method, which runs in a process management component of a terminal, is characterized by comprising the following steps:
establishing communication connection with a caller, and establishing cross-process connection with a preset agent Activity component, wherein the caller is a component displayed on the current page of the terminal, and the cross-process connection is used for enabling the caller to access the agent Activity components in different processes with the caller; wherein the caller is a brick with or without an interface Activity component;
receiving intention information input by a caller, sending the intention information to the agent Activity component through the cross-process connection, and enabling the agent Activity component to call a target Activity component corresponding to the intention information to process the intention information and obtain a return result;
and receiving a return result sent by the agent Activity component, and returning the return result to the caller.
2. The Activity component call processing method according to claim 1, wherein said building a cross-process connection with a preset agent Activity component comprises:
creating a service process and generating connection mechanism information corresponding to the service process, and creating a connection driver corresponding to the service process;
sending the connection mechanism information to the agent Activity component, and creating a client process corresponding to the service process in the agent Activity component according to the connection mechanism information;
creating a service management process in the agent Activity component, so that the client process can refer to the service process according to the service management process;
and calling the connection driver to form communication connection between the service process and the client process, and constructing cross-process connection between the communication connection serving as the intention information and the agent Activity component.
3. The Activity component call processing method of claim 1, wherein said returning the return result to the caller comprises:
extracting a return result in a service process in cross-process connection;
and sending the return result to a calling party.
4. An Activity component call processing method, which runs in an agent Activity component of a terminal, is characterized by comprising the following steps:
constructing cross-process connection with a process management component, and receiving intention information sent by the process management component; the intention information is request information sent to the process management component by a caller, and the caller is a program block with or without an interface Activity component;
identifying a target Activity component corresponding to the intention information, and instantiating the target Activity component;
calling the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component;
and sending the return result to the process management component through the cross-process connection, so that the process management component sends the return result to a caller.
5. The Activity component call processing method of claim 4, wherein the identifying a target Activity component corresponding to the intent information, instantiating the target Activity component, comprises:
acquiring component information from intention information, wherein the component information refers to the number of a target Activity component which needs to be called by the intention information;
and loading the target Activity component corresponding to the component information into a preset idle process, and starting the target Activity component corresponding to the component information, wherein the instantiation of the target Activity component is realized by loading the target Activity component into the process.
6. The Activity component call processing method according to claim 4, wherein said invoking the target Activity component to process the intention information to obtain a return result, and receiving the return result sent by the target Activity component comprises:
calling the target Activity component to process the intention information through interaction logic in the target Activity component to obtain a return result;
and receiving the returned result returned by the target Activity component according to the result setting method in the target Activity component.
7. The Activity component call processing method of claim 4, wherein sending the return result to the process management component over the cross-process connection comprises:
obtaining a return result sent by the target Activity component from a preset component result method;
and sending the return result to the process management component according to a result setting method in the client process connected in the cross-process mode.
8. An Activity component call processing system, operating in a terminal, comprising: the system comprises a calling party, a process management component, an agent Activity component and at least one target Activity component;
the caller is connected with an input module of the terminal and used for receiving intention information sent by the input module; the calling party is a component displayed on the current page of the terminal;
the process management component is connected with the caller, and cross-process connection is formed between the process management component and the agent Activity component; the cross-process connection is used for realizing information interaction between the process management components and the agent Activity components in different processes;
the process management component is used for receiving the intention information sent by the caller and sending the intention information to the agent Activity component;
the agent Activity component is connected with the at least one target Activity component, and the agent Activity component is used for receiving intention information sent by the process management component, identifying a target Activity component corresponding to the intention information, and instantiating the target Activity component;
the agent Activity component is also used for calling the target Activity component to process the intention information to obtain a return result, receiving the return result sent by the target Activity component corresponding to the intention information, sending the return result to the process management component through the cross-process connection, and enabling the process management component to send the return result to a calling party;
and the process management component is also used for returning a return result sent by the agent Activity component to the caller.
9. A computer device, comprising: a processor and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executing the memory-stored computer-executable instructions to implement the Activity component Call processing method of any of claims 1 to 7.
10. A computer-readable storage medium having stored thereon computer-executable instructions for implementing the Activity component call processing method of any of claims 1-7 when executed by a processor.
CN202211239018.8A 2022-10-11 2022-10-11 Activity component call processing method, system, computer equipment and storage medium Pending CN115543480A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211239018.8A CN115543480A (en) 2022-10-11 2022-10-11 Activity component call processing method, system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211239018.8A CN115543480A (en) 2022-10-11 2022-10-11 Activity component call processing method, system, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115543480A true CN115543480A (en) 2022-12-30

Family

ID=84734328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211239018.8A Pending CN115543480A (en) 2022-10-11 2022-10-11 Activity component call processing method, system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115543480A (en)

Similar Documents

Publication Publication Date Title
US9798555B2 (en) Application implementation method and apparatus
US10554604B1 (en) Low-load message queue scaling using ephemeral logical message topics
CN111858727B (en) Multi-data source data export system and method based on template configuration
WO2020199594A1 (en) Service component loading method and apparatus, and computer device and storage medium
EP3428796A1 (en) Resource loading method, and service function implementing method and device for application (app)
CN111338829B (en) Calling method and device for remote procedure call service
WO2021179156A1 (en) Message processing method, device and system, and server
CN108920211A (en) The starting method and device of Launcher application program, electronic equipment, storage medium
CN111294377B (en) Dependency network request sending method, terminal device and storage medium
CN109032693B (en) Method and device for loading display information, electronic equipment and readable storage medium
CN111078437B (en) Remote calling method and device for verification codes, electronic equipment and readable storage medium
CN115543480A (en) Activity component call processing method, system, computer equipment and storage medium
CN112287265B (en) Asynchronous event driven based file conversion method and system
US20230251835A1 (en) Building base applications with user interface micro frontends
CN113271364B (en) Sharing system, method, computer device and storage medium of service arrangement data
CN108874557B (en) Front-end interface processing method and system
CN110249305A (en) Shell operation browser extension when browser crash or hang-up
CN111177624B (en) Website front-end and back-end communication method, device, computer equipment and storage medium
CN112714148A (en) Interface configuration method, device, equipment and medium
CN112130850A (en) Method and device for realizing functions in application program
CN106850756B (en) Method and system for realizing communication between web page and local application
CN111399928A (en) Application program starting method and device, electronic equipment and readable storage medium
CN114553806B (en) Optimization method, device and equipment for instant messaging and storage medium
CN114817166B (en) Method, device and medium for canceling file operation
CN111372134B (en) Player calling method and terminal

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