CN115373869A - Process processing method and device based on AAR and electronic equipment - Google Patents

Process processing method and device based on AAR and electronic equipment Download PDF

Info

Publication number
CN115373869A
CN115373869A CN202111162782.5A CN202111162782A CN115373869A CN 115373869 A CN115373869 A CN 115373869A CN 202111162782 A CN202111162782 A CN 202111162782A CN 115373869 A CN115373869 A CN 115373869A
Authority
CN
China
Prior art keywords
aar
sub
independent
subprocess
interface
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
CN202111162782.5A
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.)
Cloudminds Beijing Technologies Co Ltd
Original Assignee
Cloudminds Beijing Technologies 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 Cloudminds Beijing Technologies Co Ltd filed Critical Cloudminds Beijing Technologies Co Ltd
Priority to CN202111162782.5A priority Critical patent/CN115373869A/en
Publication of CN115373869A publication Critical patent/CN115373869A/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure provides a process processing method, apparatus, electronic device and computer-readable storage medium based on an AAR, the method comprising: splitting a target application program into a main process and at least one sub-process; generating a first sub-process number and a second sub-process number according to the at least one sub-process; creating at least one AAR, each AAR corresponding to one second sub-process number; setting an independent process carrier in each AAR, wherein the independent process carrier comprises a subprocess attribute for representing an independent process; setting an Android interface definition language file in each AAR; and configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface. According to the process processing method disclosed by the invention, one application is divided into the main process and at least one subprocess, so that on one hand, more memory allocation is enjoyed, the load balance is realized, and on the other hand, the process keep-alive is better carried out.

Description

Process processing method and device based on AAR and electronic equipment
Technical Field
The present disclosure relates to the field of process processing, and in particular, to a method and an apparatus for processing a process based on an AAR (Android) and an electronic device.
Background
With the development of mobile phone technology, more and more applications are installed on a mobile phone, more and more plug-ins are installed for each application, and the occupied memory is larger and larger, so that in an Android operating system, when more applications run simultaneously, the applications often run to cause the mobile phone to be stuck and even halted, and much inconvenience is brought to a user.
At present, in order to ensure the stability of a system, a fixed memory size is allocated to each process in the existing Android system, and when a memory used by the process exceeds a memory threshold value allocated by the system, an exception of memory overflow occurs, which causes application crash. Therefore, how to solve the problem of memory occupation in the process becomes a big problem in the industry.
Disclosure of Invention
In order to solve the above technical problem, for a large application, it is necessary to split an application into more processes, so that on one hand, more memory allocations are enjoyed to realize load balancing, and on the other hand, process keep-alive is better performed. The embodiment of the disclosure aims to provide a visual inertial odometer method, a device, an electronic device and a storage medium.
According to a first aspect of the present disclosure, an embodiment of the present disclosure provides an AAR-based process processing method, where an AAR (Android Archive) package is a binary Archive file of an Android library item, and a file extension is AAR, the method including:
splitting a target application program into a main process and at least one sub-process;
generating a first sub-process number and a second sub-process number according to the at least one sub-process;
creating at least one AAR, each AAR corresponding to one second sub-process number;
setting an independent process carrier in each AAR, wherein the independent process carrier comprises a subprocess attribute for representing an independent process;
setting an Android interface definition language file in each AAR;
and configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface.
Further, the dependent environments of the main process and the at least one sub-process are independent of each other.
Further, the generating a first sub-process number and a second sub-process number according to the at least one sub-process includes:
acquiring a process sequence number of the at least one sub-process, and generating a first sub-process number according to the process sequence number;
generating a second subprocess number according to the association attribute of the subprocess and the target application;
further, the association attribute includes the number of sub-processes split by the target application, a sub-process architecture, a sub-process order, and a communication link between a sub-process and a main process.
Further, the creating at least one AAR, each AAR corresponding to one of the second child process numbers, includes:
extracting attribute features of the second subprocess;
encapsulating attribute features of the second sub-process into at least one AAR based on independent plug-in attributes of the AAR;
the AAR is designed as an independent process and communicates with the host process.
Further, the setting of an independent process carrier in each AAR, where the independent process carrier includes sub-process attributes characterizing independent processes, includes:
setting at least one independent process carrier in each AAR;
configuring a program list file in the independent process carrier, wherein a process attribute is added in the program list file;
and recording the attribute of the sub-process which characterizes the independent process in the process attribute.
Further, the setting of the Android interface definition language file in each AAR includes:
setting an Android interface definition language file based on a cross-process communication mechanism in each AAR;
and encapsulating the communication information in the Android interface definition language file in the AAR.
Further, configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface includes:
configuring a bridge type interface for providing all external access in the Android interface definition language file;
the host process communicates with the AAR through the bridge class interface;
and encapsulating the bridge type interface in the AAR to hide communication information between processes.
In a second aspect, another embodiment of the present disclosure provides an AAR-based process processing apparatus, including:
the splitting module is used for splitting the target application program into a main process and at least one subprocess;
the generating module is used for generating a first subprocess number and a second subprocess number according to the at least one subprocess;
a creating module, configured to create at least one AAR, where each AAR corresponds to one of the second subprocess numbers;
a first setting module, configured to set an independent process bearer in each AAR, where the independent process bearer includes a sub-process attribute that characterizes an independent process;
the second setting module is used for creating an Android interface definition language file in each AAR;
and the configuration module is used for configuring a bridge type interface in the Android interface definition language file and communicating with the main process through the bridge type interface.
In a third aspect, another embodiment of the present disclosure provides an electronic device, including:
a memory for storing computer readable instructions; and
a processor configured to execute the computer readable instructions to enable the electronic device to implement the method of any of the first aspect.
In a fourth aspect, another embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer-readable instructions that, when executed by a computer, cause the computer to implement the method of any one of the first aspects above.
The embodiment of the disclosure discloses a process processing method, a device, an electronic device and a computer readable storage medium based on AAR, wherein the method comprises the following steps: splitting a target application program into a main process and at least one sub-process; generating a first sub-process number and a second sub-process number according to the at least one sub-process; creating at least one AAR, each AAR corresponding to one second sub-process number; setting an independent process carrier in each AAR, wherein the independent process carrier comprises a subprocess attribute for representing an independent process; setting an Android interface definition language file in each AAR; and configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface. According to the process processing method disclosed by the invention, one application is divided into the main process and at least one subprocess, so that on one hand, more memory allocation is enjoyed, the load balance is realized, and on the other hand, the process keep-alive is better carried out. The AAR sub-process can share the pressure of the main process, so that an Application program is more stable and robust, the memory problem is Not easily killed by the system or ANR (Application Not Responding, which means on Android, when the response of the Application program is Not sensitive enough, a dialog box displayed by the system to a user) is Not generated, meanwhile, the AAR sub-process does Not depend on the life cycle of the main process, and after the main process is unexpectedly crashed, the AAR sub-process can also independently run to continue the service or collect logs, and can also implement mutual keep-alive with the main process, so that the survival rate of the Application is improved.
The foregoing description is only an overview of the technical solutions of the present disclosure, and in order to make the technical means of the present disclosure more clearly understood, the present disclosure may be implemented in accordance with the content of the description, and in order to make the above and other objects, features, and advantages of the present disclosure more clearly understood, the following preferred embodiments are specifically illustrated below, and the detailed description is given in conjunction with the accompanying drawings.
Drawings
Fig. 1 is a schematic flow chart of a process processing method based on AAR according to an embodiment of the present disclosure;
FIG. 2 is a diagram illustrating an application process processing architecture according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a Binder cross-process communication mechanism model according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of an AAR-based process handling apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to another embodiment of the disclosure.
Detailed Description
In order to more clearly describe the technical content of the present disclosure, the following further description is given in conjunction with specific embodiments.
The implementations described in the following exemplary examples do not represent all implementations 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.
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more complete and thorough understanding of the present disclosure. It should be understood that the drawings and the embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a" or "an" in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will appreciate that references to "one or more" are intended to be exemplary and not limiting unless the context clearly indicates otherwise.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this disclosure 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. The disclosed embodiments are described in detail below with reference to the accompanying drawings.
In order to ensure the stability of the system, the Android system allocates a fixed memory size to each application process, and when a memory used by a process exceeds a memory threshold allocated by the system, an exception of memory overflow occurs, so that the application is crashed. Based on the problem, for a large-scale application, it is necessary to split an application into more processes, so that on one hand, more memory allocation is enjoyed, load balancing is realized, and on the other hand, process keep-alive is better performed.
The technical problem is solved by adopting a process processing mode based on an AAR (Android Archive), wherein an AAR package is a binary filing file of an Android library project, and the file extension is AAR, and the AAR is used as a library of an Android system and can comprise a project library of codes, audio, picture files, resources and the like. Meanwhile, the AAR exists as a single plug-in unit which can be plugged in and out by a main process, and the AAR is more necessary to be designed into an independent process and is an independent process which is not sensible to a user. By the design, when the user uses the AAR, the user can enjoy the plug-in function brought by the AAR without causing more load to the main process of the user.
Fig. 1 is a flowchart illustrating an AAR-based process processing method according to an embodiment of the present disclosure, where the AAR-based process processing method according to this embodiment may be executed by an AAR-based process processing apparatus, which may be implemented as software or implemented as a combination of software and hardware, and the apparatus may be integrally disposed in an electronic device and implemented by a processor of the electronic device. As shown in fig. 1, the method comprises the steps of:
step S101: the target application program is split into a main process and at least one sub-process.
In step S101, one application generally corresponds to one process in the Android system, and at this time, a process of a larger application occupies a larger content. In this disclosure, when a larger application runs, in order to avoid that a process occupies a larger memory, in this embodiment, a target application is split into a main process and at least one sub-process, where dependency environments of the main process and the at least one sub-process are independent of each other. The number of the sub-processes may be determined according to the number of SDKs (software development kit) included in the target application program, or may be determined according to the number of function packages of the target application program, or a combination thereof. According to the embodiment of the disclosure, the sub-process corresponds to the AAR independent process, and based on the feasibility of Android AAR packaging, the AAR is designed to be the independent process and inter-process communication is realized. Therefore, the AAR independent process corresponding to the sub-process shares the pressure of the main process, load balance is achieved, the target Application program is enabled to be more stable and robust, and the target Application program is Not easy to be killed or ANR (Application Not Responding, which means a dialog box displayed to a user by the system on Android when the response of the Application program is Not sensitive enough) caused by memory problems.
With reference to fig. 2, a schematic diagram of an application process processing architecture provided by an embodiment of the present disclosure is shown, where a target application splits a process into a main process and a sub-process 1, a sub-process 2, \8230;, a sub-process N, where N is a natural number. The main process and the dependent environments of the sub-processes are independent from each other, and the communication between the processes can be realized through a bridging interface.
Step S102: and generating a first sub-process number and a second sub-process number according to the at least one sub-process.
In step S102, in the present disclosure, the target application is split into a main process and at least one sub-process, where the sub-process is different from a general process, and the general process only includes one process number, i.e., a process ID (process ID) of the process in the system, which is a numerical value used by most operating system kernels to uniquely identify the process, in short, a nickname of the process. This value can be used as a parameter for many function calls to make it possible to adjust process control behavior such as process priority, kill (command) process, etc. The sub-process in the embodiment of the present disclosure has an AAR independent process attribute, and the generated process number not only includes a first sub-process number representing a process ID, but also includes a second sub-process number based on the AAR, that is, the sub-process is represented as:
and (4) a sub-process N: [ first subprocess number, second subprocess number ], where N is a natural number.
Specifically, the generating a first subprocess number and a second subprocess number according to the at least one subprocess includes: acquiring a process sequence number of the at least one sub-process, and generating a first sub-process number according to the process sequence number; and generating a second subprocess number according to the correlation attributes of the subprocess and the target application. The association attribute comprises the number of the sub processes split by the target application, a sub process architecture, a sub process sequence and a communication link between the sub process and a main process.
Referring to fig. 2, each of the sub-processes 1 to N generates a first sub-process number and a second sub-process number, where the second sub-process number corresponds to an AAR independent process of each sub-process, and communicates with the main process through a Bridge interface in the AAR.
Step S103: creating at least one AAR, each AAR corresponding to one of the second child process numbers.
In step S103, in the present disclosure, based on the feasibility of packaging the AAR of the Android itself, the AAR is designed to be an independent process and inter-process communication is implemented. Meanwhile, the AAR exists as a single plug-in unit which can be plugged in and out by a main process, and the AAR is more necessary to be designed into an independent process and is an independent process which is not sensible to a user. The method realizes the process design of the AAR through the android studio development tool, creates a Module carrier in the android studio, and designs the applyplogic into com.
Specifically, the creating at least one AAR, where each AAR corresponds to one of the second subprocess numbers, includes: extracting attribute features of the second sub-process; encapsulating attribute features of the second child process into at least one AAR based on independent plug-in attributes of the AAR; the AAR is designed as an independent process and communicates with the main process. The attribute characteristics of the second sub-process include a second sub-process ID, an identifier representing an independent process, a Bridge (Bridge) Interface, an independent process bearer Service (independent process bearer Service), an aid ID (Android Interface Definition Language), and the like. Wherein the identity of the individual process and the plug-in attributes of the AAR itself indicate the individual plug-in attributes of the AAR. And packaging the attribute features of the second sub-process into an independent AAR based on the feasibility of Android self AAR packaging, and communicating with the main process through a Bridge interface in the attribute features.
With reference to fig. 2, each of the sub-processes 1 to N generates a first sub-process number and a second sub-process number, where the second sub-process number corresponds to an AAR independent process of each sub-process, and the AAR is configured with attribute features of the second sub-process, including a second sub-process ID, an identifier for characterizing the independent process, a Bridge (Bridge) class interface, an independent process bearer Service (independent process bearer Service), and an aid ID (interface definition language). Communicating with the host process over a Bridge-like interface in the AAR.
Step S104: an independent process carrier is provided in each AAR, the independent process carrier including sub-process attributes characterizing the independent process.
In step S104, in the present disclosure, at least one Service is designed in the AAR to serve as a bearer or an entry of an independent process, and an attribute of process, namely android, is added to the android manifest to make the AAR an independent process. If other services exist, the android process is added with the attribute of the same android, namely the process. For all places in the AAR where a Context (Context) needs to be used, it is provisioned from the Service so that the environment on which the AAR depends exists independent of the host process.
Specifically, the setting of an independent process bearer Service (independent process bearer Service) in each AAR includes a sub-process attribute characterizing an independent process, and includes: setting at least one independent process carrier in each AAR; configuring a program list file in the independent process carrier, wherein a process attribute is added in the program list file; and recording the attribute of the sub-process which characterizes the independent process in the process attribute. The attribute characteristics of the second sub-process include a second sub-process ID, an identifier representing an independent process, a Bridge (Bridge) Interface, an independent process bearer Service (independent process bearer Service), an aid ID (Android Interface Definition Language), and the like. Wherein the identity of the individual process and the plug-in attributes of the AAR itself indicate the individual plug-in attributes of the AAR.
With reference to fig. 2, a second sub-process number in the sub-process 1 to the sub-process N corresponds to an AAR independent process of each sub-process, where the AAR is configured with attribute features of the second sub-process, including a second sub-process ID, an identifier characterizing the independent process, a Bridge (Bridge) class interface, an independent process bearer Service (independent process bearer Service), an aid ID (interface definition language), and the like.
Step S105: and setting an Android interface definition language file in each AAR.
In step S105, for inter-process communication, a communication architecture based on the aid of Binder needs to be created, and since two identical aid file files cannot exist in one project, in the embodiment of the present disclosure, the communication of the aid l is encapsulated in the AAR, and such a design can implement an independent process of the AAR invisibly for a caller.
Specifically, the setting of the Android interface definition language file in each AAR includes: an AIDL (i.e. Android interface definition language) file based on a Binder (i.e. cross-process communication) mechanism is arranged in each AAR; and encapsulating the communication information in the AIDL file in the AAR.
Referring to fig. 2, the second sub-process number in the sub-process 1 to the sub-process N corresponds to an AAR independent process of each sub-process, where all AARs are configured with AIDL (interface definition language), and AIDL files in the AARs corresponding to the sub-process 1 to the sub-process N cannot be completely the same or two AARs cannot share one AIDL file.
The establishment of AIDL service is more complicated than the establishment of ordinary service, and the specific steps are as follows:
(1) A file with an extension name of AIDL is established in a Java package catalog of Eclipse Android project. The syntax of this file is similar to Java code but will be slightly different.
(2) If the contents of the AIDL file are correct, the ADT automatically generates a Java interface file (.java).
(3) A Service class (Service subclass) is established.
(4) And realizing the Java interface generated by the AIDL file.
(5) Xml file, and especially, the attribute value of the android name in the < action > tag is the ID that the client wants to refer to the service, namely the parameter value of the Intent class.
Description of implementation of AIDL interface:
(1) The AIDL interface only supports the method and cannot declare static members;
(2) There is no exception returned to the caller.
In this embodiment, the schematic diagram of the Binder cross-process communication mechanism model may refer to fig. 3, and as shown in fig. 3, the interactions between the Client process and the Server process & Service Manager process must be driven by the Binder (using open and ioctl file operation functions), rather than direct interactions.
The reason is as follows: the Client process and the Server process and the Service Manager process belong to a user space of a process space, and inter-process interaction cannot be carried out; the Binder drives a kernel space belonging to a process space, and can perform inter-process and intra-process interaction.
Thread management of Binder request:
the Server process can create a plurality of threads to process the Binder request;
the thread for managing the Binder model adopts a Binder-driven thread pool, and is managed by the Binder driver, rather than being managed by a Server process;
the default maximum number of Binder threads for a process is 16, and excess requests will be blocked waiting for a Binder thread to be idle.
Therefore, when dealing with concurrency issues during interprocess communication, such as when using ContentProvider, its CRUD (create, retrieve, update, and delete) method can only work simultaneously with 16 threads.
The realization of a Binder mechanism in Android mainly depends on Binder class, which realizes IBinder interface. The Server process registers Service to the Service Manager process through the Binder driver, and then the Server process creates a Binder object, wherein the Binder entity is the existing form of the Server process in the Binder driver, and the object stores the information of the Server and the ServiceManager (in the kernel space); the Binder driver finds the Server object of the user space through the Binder entity of the kernel space; at this point, the Client process has established a connection with the Server process. And the Client process establishes a link communicated with the Server process where the Service is located through the Binder drive according to the obtained Service information (Binder proxy object) and starts to use the Service.
Step S106: and configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface.
In step S106, in the AAR corresponding to the child process, a Bridge class interface (Bridge class interface) is created, and all interfaces for external access are provided. The environment in which the Bridge-like interface operates may be the host process, the purpose of which is to communicate with a separate process in the AAR, and finally the Bridge-like interface is encapsulated in the AAR together with the process in order to hide details of the inter-process communication from the user. It is only necessary for the user (master process) to communicate with the Bridge-like interface to stand alone the AAR as a process and use the functions in the AAR.
Specifically, configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface includes: configuring a bridging interface for providing all external access in the Android interface definition language file; the host process communicates with the AAR through the bridge class interface; and encapsulating the bridge type interface in the AAR to hide communication information between processes.
Referring to fig. 2, sub-process 1 to sub-process N generate respective AARs corresponding to the first sub-process number and the second sub-process number, and each configure a Bridge (Bridge) class interface. The main process of the target application communicates with the sub-process via a Bridge-like interface in the AAR. And establishing the relation between the processes, so that the subprocess 3 and the main process can implement mutual keep-alive, and the survival rate of the target application program is ensured.
Fig. 4 shows a schematic diagram of an AAR-based process processing apparatus according to another embodiment of the present disclosure. The device includes: a splitting module 401, a generating module 402, a creating module 403, a first setting module 404, a second setting module 405, and a configuring module 406. Wherein:
the splitting module 401 is configured to split the target application program into a main process and at least one sub-process.
In this disclosure, when a larger application runs, in order to avoid a process occupying a larger memory, in this embodiment, a target application is split, and the target application is split into a main process and at least one sub-process, where dependency environments of the main process and the at least one sub-process are independent of each other. The number of the sub-processes may be determined according to the number of SDKs (software development kit) included in the target application program, or may be determined according to the number of function packages of the target application program, or a combination thereof. The sub-process corresponds to the AAR independent process, and based on the feasibility of Android AAR packaging, the AAR is designed into the independent process and inter-process communication is achieved. Therefore, the AAR independent process corresponding to the sub-process shares the pressure of the main process, load balance is achieved, the target application program is more stable and robust, and the target application program is not easy to be killed by a system or generate ANR due to memory problems. The dependency environments of the main process and the sub-processes are independent, and the communication between the processes can be realized through the bridging type interface.
The generating module 402 is configured to generate a first sub-process number and a second sub-process number according to the at least one sub-process.
The target application program is divided into a main process and at least one sub-process, wherein the sub-process is different from a general process, and the general process only comprises a process number, namely, the process ID (process ID) of the process in the system is a numerical value which is used by the kernel of most operating systems for uniquely identifying the process, namely, a nickname of the process. This value can be used as a parameter for many function calls to make it possible to adjust process control behavior such as process priority, kill (command) process, etc. The sub-process in the embodiment of the present disclosure has an AAR independent process attribute, and the generated process number includes not only the first sub-process number representing the process ID, but also the second sub-process number based on the AAR, that is, the sub-process is represented as:
and a sub-process N: [ first subprocess number, second subprocess number ], where N is a natural number.
The module is specifically configured to: acquiring a process sequence number of the at least one sub-process, and generating a first sub-process number according to the process sequence number; and generating a second subprocess number according to the correlation attributes of the subprocess and the target application. The association attribute comprises the number of the sub processes split by the target application, a sub process architecture, a sub process sequence and a communication link between the sub process and a main process.
The creating module 403 is configured to create at least one AAR, where each AAR corresponds to one second child process number.
The module is specifically configured to: extracting attribute features of the second subprocess; encapsulating attribute features of the second sub-process into at least one AAR based on independent plug-in attributes of the AAR; the AAR is designed as an independent process and communicates with the main process. The attribute characteristics of the second sub-process include a second sub-process ID, an identifier representing an independent process, a Bridge (Bridge) Interface, an independent process carrier Service (independent process carrier Service), an aid l (Android Interface Definition Language), and the like. The identity of the individual process and the plug-in attributes of the AAR itself therein indicate the individual plug-in attributes of the AAR. And packaging the attribute features of the second sub-process into an independent AAR based on the feasibility of Android self AAR packaging, and communicating with the main process through a Bridge interface in the attribute features.
The first setting module 404 is configured to set an independent process bearer in each AAR, where the independent process bearer includes a sub-process attribute characterizing an independent process.
The module is specifically configured to: setting at least one independent process carrier in each AAR; configuring a program list file in the independent process carrier, wherein a process attribute is added in the program list file; and recording the attribute of the sub-process which characterizes the independent process in the process attribute. The attribute characteristics of the second sub-process include a second sub-process ID, an identifier representing an independent process, a Bridge (Bridge) Interface, an independent process bearer Service (independent process bearer Service), an aid ID (Android Interface Definition Language), and the like. Wherein the identity of the individual process and the plug-in attributes of the AAR itself indicate the individual plug-in attributes of the AAR. The second sub-process number in the sub-process 1 to the sub-process N corresponds to the AAR independent process of each sub-process, wherein the AAR is configured with the attribute characteristics of the second sub-process, including a second sub-process ID, an identifier for characterizing the independent process, a Bridge (Bridge) type interface, an independent process bearer Service (independent process bearer Service), an aid ID (interface definition language), and the like.
The second setting module 405 is configured to create an Android interface definition language file in each AAR.
In the present disclosure, for inter-process communication, a communication architecture based on the aid of Binder needs to be created, and since two identical aid l files cannot exist in one project, in the embodiment of the present disclosure, communication of the aid l is encapsulated in the AAR, and such a design can realize an independent process of the AAR without feeling for a caller.
The module is specifically configured to: an AIDL (i.e. Android interface definition language) file based on a Binder (i.e. cross-process communication) mechanism is arranged in each AAR; and encapsulating the communication information in the AIDL file in the AAR. And the second sub-process number in the sub-process 1 to the sub-process N corresponds to the AAR independent process of each sub-process, wherein AIDL (interface definition language) is configured in the AAR, and AIDL files in the AARs corresponding to the sub-process 1 to the sub-process N cannot be completely the same or two AARs cannot share one AIDL file.
The configuration module 406 is configured to configure a bridge type interface in the Android interface definition language file, and communicate with the host process through the bridge type interface. Here, a communication module is implicitly provided for communicating with the host process via the bridge-like interface.
In the AAR corresponding to the sub-process, a Bridge class interface (Bridge class interface) is created, and all interfaces for external access are provided. The environment in which the Bridge-like interface operates may be the host process, the purpose of which is to communicate with a separate process in the AAR, and finally the Bridge-like interface is encapsulated in the AAR together with the process in order to hide details of the inter-process communication from the user. For the user (master process), it is only necessary to communicate with the Bridge-like interface to stand the AAR as a process and use the functions in the AAR.
The module is specifically configured to: configuring a bridge type interface for providing all external access in the Android interface definition language file; the main process communicates with the AAR through the bridge class interface; and encapsulating the bridge type interface in the AAR to hide communication information between processes.
The apparatus shown in fig. 4 can perform the method of the embodiment shown in fig. 1, and reference may be made to the related description of the embodiment shown in fig. 1 for a part of this embodiment that is not described in detail. The implementation process and technical effect of the technical solution refer to the description in the embodiment shown in fig. 1, and are not described herein again.
Referring now to FIG. 5, shown is a schematic diagram of an electronic device 500 suitable for use in implementing another embodiment of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a communication line 504. An input/output (I/O) interface 505 is also connected to communication line 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be alternatively implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: 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 (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, 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. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. 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 thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may be separate and not incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: the interaction method in the above embodiment is performed.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on 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 compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the preceding first aspects.
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium characterized by storing computer instructions for causing a computer to perform the method of any of the preceding first aspects.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (10)

1. A process processing method based on AAR is characterized by comprising the following steps:
splitting a target application program into a main process and at least one sub-process;
generating a first sub-process number and a second sub-process number according to the at least one sub-process;
creating at least one AAR, each AAR corresponding to one second sub-process number;
setting an independent process carrier in each AAR, wherein the independent process carrier comprises a subprocess attribute for representing an independent process;
setting an Android interface definition language file in each AAR;
and configuring a bridge type interface in the Android interface definition language file, and communicating with the host process through the bridge type interface.
2. The method of claim 1, wherein the dependency contexts of the host process and the at least one sub-process are independent of each other.
3. The method as claimed in claim 1, wherein the generating a first sub-process number and a second sub-process number according to the at least one sub-process comprises:
acquiring a process sequence number of the at least one sub-process, and generating a first sub-process number according to the process sequence number;
and generating a second subprocess number according to the correlation attributes of the subprocess and the target application.
4. The method according to claim 3, wherein the association attributes comprise the number of sub-processes split by the target application, a sub-process architecture, a sub-process order, and a communication link of a sub-process with a host process.
5. The method of claim 1, wherein creating at least one AAR, each AAR corresponding to one of the second sub-process numbers comprises:
extracting attribute features of the second subprocess;
encapsulating attribute features of the second sub-process into at least one AAR based on independent plug-in attributes of the AAR;
the AAR is designed as an independent process and communicates with the main process.
6. The method according to claim 1, wherein an independent process carrier is provided in each AAR, and the independent process carrier includes sub-process attributes characterizing independent processes, including:
setting at least one independent process carrier in each AAR;
configuring a program list file in the independent process carrier, wherein a process attribute is added in the program list file;
and recording the attribute of the sub-process which characterizes the independent process in the process attribute.
7. The method according to claim 1, wherein the setting of the Android interface definition language file in each AAR includes:
setting an Android interface definition language file based on a cross-process communication mechanism in each AAR;
and encapsulating the communication information in the Android interface definition language file in the AAR.
8. The method according to claim 1, wherein configuring a bridge class interface in the Android interface definition language file, and communicating with the host process through the bridge class interface comprises:
configuring a bridge type interface for providing all external access in the Android interface definition language file;
the main process communicates with the AAR through the bridge class interface;
and encapsulating the bridge type interface in the AAR to hide communication information between processes.
9. An AAR-based process processing apparatus, comprising:
the splitting module is used for splitting the target application program into a main process and at least one subprocess;
the generating module is used for generating a first subprocess number and a second subprocess number according to the at least one subprocess;
a creating module, configured to create at least one AAR, where each AAR corresponds to one of the second subprocess numbers;
the first setting module is used for setting an independent process carrier in each AAR, and the independent process carrier comprises a subprocess attribute for representing an independent process;
the second setting module is used for creating an Android interface definition language file in each AAR;
and the configuration module is used for configuring a bridge type interface in the Android interface definition language file and communicating with the host process through the bridge type interface.
10. An electronic device, comprising:
a memory for storing computer readable instructions; and
a processor configured to execute the computer-readable instructions to cause the electronic device to implement the method according to any one of claims 1-8.
CN202111162782.5A 2021-09-30 2021-09-30 Process processing method and device based on AAR and electronic equipment Pending CN115373869A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111162782.5A CN115373869A (en) 2021-09-30 2021-09-30 Process processing method and device based on AAR and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111162782.5A CN115373869A (en) 2021-09-30 2021-09-30 Process processing method and device based on AAR and electronic equipment

Publications (1)

Publication Number Publication Date
CN115373869A true CN115373869A (en) 2022-11-22

Family

ID=84060337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111162782.5A Pending CN115373869A (en) 2021-09-30 2021-09-30 Process processing method and device based on AAR and electronic equipment

Country Status (1)

Country Link
CN (1) CN115373869A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453513A (en) * 2023-12-21 2024-01-26 荣耀终端有限公司 Log acquisition method and related equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453513A (en) * 2023-12-21 2024-01-26 荣耀终端有限公司 Log acquisition method and related equipment

Similar Documents

Publication Publication Date Title
US10521242B2 (en) Application containers with updatable application programming interface layers
CN110489101B (en) Interface simulation method, system, medium and electronic equipment
CN109643252B (en) Middleware interface and middleware interface generator
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
US20170083387A1 (en) High-performance computing framework for cloud computing environments
CN114077367A (en) Method and device for realizing shortcut of android application in Linux system
US8938522B2 (en) Tiered XML services in a content management system
CN115373869A (en) Process processing method and device based on AAR and electronic equipment
CN113835790B (en) Paging page display method and device based on Android
CN110086880B (en) Method and apparatus for creating instances of network requests
CN114510334A (en) Class instance calling method and device, electronic equipment and automatic driving vehicle
CN111381898B (en) Interface calling method and device, mobile terminal and storage medium
CN114327404A (en) File processing method and device, electronic equipment and computer readable medium
CN113849449A (en) Communication system and information interaction method, device and medium
CN114116263A (en) System, method, apparatus, and medium for multi-page tag communication in a browser
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN114731343A (en) Cloud service method and device
CN112612460A (en) Interface packaging and calling method, electronic device and storage medium
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN112099841A (en) Method and system for generating configuration file
CN109766246B (en) Method and apparatus for monitoring applications
CN110099122B (en) Method and apparatus for sending network request
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN113971060B (en) Interface display method, device, electronic equipment and medium
CN112041817A (en) Method and node for managing requests for hardware acceleration by means of an accelerator device

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