CN115202902A - Method for controlling process interaction and related device - Google Patents

Method for controlling process interaction and related device Download PDF

Info

Publication number
CN115202902A
CN115202902A CN202210764724.8A CN202210764724A CN115202902A CN 115202902 A CN115202902 A CN 115202902A CN 202210764724 A CN202210764724 A CN 202210764724A CN 115202902 A CN115202902 A CN 115202902A
Authority
CN
China
Prior art keywords
data
target information
information
application
binder
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210764724.8A
Other languages
Chinese (zh)
Other versions
CN115202902B (en
Inventor
肖名鹏
李鹏
沈海翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210764724.8A priority Critical patent/CN115202902B/en
Publication of CN115202902A publication Critical patent/CN115202902A/en
Application granted granted Critical
Publication of CN115202902B publication Critical patent/CN115202902B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application provides a method and a related device for controlling process interaction, and relates to the technical field of terminals. The method comprises the following steps: the terminal equipment determines that the first process calls the target information to the second process; transmitting first data in the target information to a first process; the first data comprise first part information in the target information, the size of the first data does not exceed a preset value, and the first process and the second process communicate based on a binder mechanism. Therefore, batch data transmission can be supported in the binder mechanism, so that data in binder interaction is not overlarge, and the abnormal exit phenomenon of an application program caused by depletion of a binder memory due to overlarge data in the binder is improved.

Description

Method for controlling process interaction and related device
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a method for controlling process interaction and a related device.
Background
With the development of terminal technology, more and more Applications (APPs) can be supported in a terminal device. Communication between system services and applications, between different applications, etc. in the terminal device may be based on processes. For example, IPC (inter-process communication) is a communication method for propagating or exchanging information between different processes.
In some implementations, binder is an important link of IPC, for example, when process a calls information of process B, process a may implement the call to process B based on binder communication and binder driving in the binder mechanism.
However, in the above implementation, there is a phenomenon that an application program of the terminal device is abnormally exited.
Disclosure of Invention
The embodiment of the application provides a method and a related device for controlling process interaction, which can support batch data transmission according to component information in a binder mechanism, so that data in binder interaction cannot be overlarge, and the phenomenon of abnormal exit of an application program caused by depletion of a binder memory due to overlarge data in the binder is improved.
In a first aspect, an embodiment of the present application provides a method for controlling process interaction, where the method is applied to a terminal device running a first process and a second process, and the first process and the second process communicate based on a binder mechanism, and the method includes:
determining that a first process calls target information to a second process; transmitting first data in the target information to a first process; the first data comprise first part information in the target information, and the size of the first data does not exceed a preset value. Therefore, batch data transmission can be supported in the binder mechanism, so that data in binder interaction is not overlarge, and the abnormal exit phenomenon of an application program caused by depletion of a binder memory due to overlarge data in the binder is improved.
In one possible implementation, the first part of information includes at least activity. This may allow important activity to be transmitted.
In a possible implementation manner, the first part of information is: and selecting the obtained parts smaller than or equal to the preset value according to the sequence of activity, service, broadcast and providers in the target information from front to back. In this way, the size of the first data can be made not to exceed the preset value, and the important data can be transmitted.
In a possible implementation manner, before determining that the first process invokes the target information to the second process, the method further includes: acquiring the number of application components corresponding to the target information; determining the times of sending the instruction for calling the target information to the second process by the first process according to the number of the application components; and when the first process sends an instruction for calling the target information to the second process once, the second process returns data to the first process once, and the size of the data returned at any time does not exceed a preset value. Therefore, the number of the application components can be used for determining how many batches of data transmission can be completed by the second process, so that the second process can completely transmit the target information to the first process.
In a possible implementation manner, after transmitting the first data in the target information to the first process, the method further includes: a first process sends an instruction for calling target information to a second process; and the second process transmits second data in the target information to the first process, wherein the second data comprises a second part of information in the target information, and the size of the second data does not exceed a preset value. This enables the second process to completely transfer the target information to the first process.
In a possible implementation manner, the determining, by the first process, the number of times of sending the instruction for calling the target information to the second process according to the number of the application components includes: and when the number of the application components is larger than the number threshold, the first process determines the number of times of sending the instruction for calling the target information to the second process according to the number of the application components. The method for acquiring the number of the application components corresponding to the target information in the second process by the first process comprises the following steps: and the first process acquires the number of the application components corresponding to the target information in the second process based on the getPackageInfoComponentCount. Therefore, when the number of the application components is larger than the number threshold, the first process determines the frequency of sending the instruction for calling the target information to the second process according to the number of the application components, and executes subsequent batch transmission, so that data in the binder interaction is not overlarge, and the abnormal exit phenomenon of the application program caused by the depletion of the memory of the binder due to the overlarge data in the binder is improved.
In a possible implementation manner, the first data carries a first value, and the first value is a total batch of data to be transmitted to the first process by the second process. In this way, the first process can know how many batches of data the second process will transmit to the first process, and the subsequent first process can check whether the missed transmission occurs, and the first process can also know whether the second process completes the data transmission.
In a possible implementation manner, after transmitting the first data in the target information to the first process, the method further includes: transmitting the Nth data in the target information to the first process until the second process completes the batch transmission of the component information in the target information; the Nth data comprises partial information in the target information, and the size of the Nth data does not exceed a preset value. Therefore, after the second process transmits the first data to the first process, the second process can automatically continue to transmit other data in the target information to the first process, and the size of the data transmitted each time does not exceed the preset value, so that signaling resources can be saved.
In a possible implementation manner, the first data and/or the nth data further carry a second value, where the second value is a specific batch value of the first data or the nth data in the total batch. Therefore, after the first process obtains the data transmitted by the second process, the data can be sorted based on the specific batch values of the data, or whether the data are missed or not and the specific missed batch of data are checked, so that subsequent retransmission and the like are facilitated.
In a second aspect, an embodiment of the present application provides a device for controlling process interaction, where the device for controlling process interaction may be a terminal device, and may also be a chip or a chip system in the terminal device. The means for controlling process interaction may comprise a processing unit and an integrated circuit IC. The processing unit is configured to implement the first aspect or any of the methods related to processing in any of the possible implementations of the first aspect. When the means for controlling the process interaction is a terminal device, the processing unit may be a processor. The means for controlling process interaction may further comprise a storage unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored by the storage unit to enable the terminal device to implement the method described in the first aspect or any one of the possible implementation manners of the first aspect. When the means for controlling the process interaction is a chip or a system of chips within the terminal device, the processing unit may be a processor. The processing unit executes the instructions stored by the storage unit to cause the terminal device to implement the first aspect or one of the possible implementations of the first aspect. The storage unit may be a storage unit (e.g., a register, a cache, etc.) within the chip, or a storage unit (e.g., a read-only memory, a random access memory, etc.) external to the chip within the terminal device.
Illustratively, the processing unit is configured to determine that a first process invokes target information to a second process; transmitting first data in the target information to a first process; the first data comprises first part information in the target information, and the size of the first data does not exceed a preset value.
In one possible implementation, the first part of information includes at least activity.
In one possible implementation manner, the first part of information is: and selecting the obtained parts smaller than or equal to the preset value according to the sequence of activity, service, broadcast and providers in the target information from front to back.
In a possible implementation manner, the processing unit is further configured to obtain the number of application components corresponding to the target information; determining the times of sending the instruction for calling the target information to the second process by the first process according to the number of the application components; and when the first process sends an instruction for calling the target information to the second process once, the second process returns data to the first process once, and the size of the data returned at any time does not exceed a preset value.
In a possible implementation manner, the processing unit is further configured to send, by the first process, an instruction for calling the target information to the second process; and the second process transmits second data in the target information to the first process, wherein the second data comprises a second part of information in the target information, and the size of the second data does not exceed a preset value.
In a possible implementation manner, the processing unit is specifically configured to, when the number of the application components is greater than the number threshold, determine, by the first process, a number of times of sending an instruction for invoking the target information to the second process according to the number of the application components. The processing unit is specifically configured to acquire, by the first process, the number of application components corresponding to the target information in the second process based on the getPackageInfoComponentCount.
In a possible implementation manner, the first data carries a first value, and the first value is a total batch of data to be transmitted to the first process by the second process.
In a possible implementation manner, the processing unit is further configured to transmit nth data in the target information to the first process until the second process completes batch transmission of component information in the target information; the Nth data comprises partial information in the target information, and the size of the Nth data does not exceed a preset value.
In a possible implementation manner, the first data and/or the nth data further carry a second value, and the second value is a specific batch value of the first data or the nth data in the total batch.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, where the memory is configured to store code instructions, and the processor is configured to execute the code instructions to perform the method described in the first aspect or any one of the possible implementation manners of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program or an instruction is stored, and when the computer program or the instruction is executed on a computer, the computer is caused to execute the method for controlling process interaction described in the first aspect or any one of the possible implementation manners of the first aspect.
In a fifth aspect, an embodiment of the present application provides a computer program product including a computer program, which, when the computer program runs on a computer, causes the computer to execute the method for controlling process interaction described in the first aspect or any one of the possible implementation manners of the first aspect.
In a sixth aspect, the present application provides a chip or a chip system, where the chip or the chip system includes at least one processor and a communication interface, where the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to execute a computer program or instructions to perform the method for controlling process interaction described in the first aspect or any one of the possible implementations of the first aspect. The communication interface in the chip may be an input/output interface, a pin, a circuit, or the like.
In one possible implementation, the chip or chip system described above in this application further comprises at least one memory having instructions stored therein. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or may be a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
It should be understood that the second aspect to the sixth aspect of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by the aspects and the corresponding possible implementations are similar and will not be described again.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a software framework of an electronic device according to an embodiment of the present application
Fig. 3 is a schematic flowchart of a control process interaction according to an embodiment of the present disclosure;
fig. 4 is a schematic instruction diagram for controlling process interaction according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
In order to facilitate clear description of the technical solutions of the embodiments of the present application, some terms and techniques referred to in the embodiments of the present application are briefly described below:
1. a Binder: the method is a mode of inter-process communication (IPC) in an Android system and is also one of important characteristics in the Android system. Different apps and the like in the Android system can run in different processes, and the Binder is a bridge for communication among the processes. Specifically, the Android system comprises four components: interface (Activity), service (Service), broadcast (Broadcast) and Content (Content), the Binder can stick all the components in the system together, and the communication between the processes is realized based on all the components.
2. Asynchronous calling: after the application sends data to the binder driver, the suspension thread does not need to wait for the reply of the binder driver, but the application is directly ended. For example, the Client (Client) calls ip layer.start (), and the start (start) of the Server (Server) needs to be executed for 2 seconds, because the defined interface is asynchronous, the Client can quickly execute ip layer.start (), and cannot be delayed for 2 seconds by the Server.
3. Synchronous calling: after the application sends data to the binder driver, the suspended thread needs to wait for the reply of the binder driver. For example, the Client terminal calls the ip layer.getvolume (), and the getVolume of the Server terminal needs to be executed for 1 second, and since the defined interfaces are synchronous, the Client terminal is held for 1 second by the Server terminal when executing the ip layer.getvolume ().
4. Other terms
In the embodiments of the present application, the words "first", "second", and the like are used to distinguish the same items or similar items having substantially the same functions and actions. For example, the first chip and the second chip are only used for distinguishing different chips, and the sequence order thereof is not limited. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present relevant concepts in a concrete fashion.
In the embodiments of the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a alone, A and B together, and B alone, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c can be single or multiple.
5. Terminal device
The terminal device of the embodiment of the present application may also be any form of electronic device, for example, the electronic device may include a handheld device having an image processing function, an in-vehicle device, and the like. For example, some electronic devices are: a mobile phone (mobile phone), a tablet computer, a palm computer, a notebook computer, a Mobile Internet Device (MID), a wearable device, a Virtual Reality (VR) device, an Augmented Reality (AR) device, a wireless terminal in industrial control (industrial control), a wireless terminal in unmanned driving (self driving), a wireless terminal in remote surgery (remote medical supply), a wireless terminal in smart grid (smart grid), a wireless terminal in transportation security (smart), a wireless terminal in city (smart city), a wireless terminal in smart home (smart home), a cellular phone, a cordless phone, a session initiation protocol (session initiation protocol), SIP) phone, wireless Local Loop (WLL) station, personal Digital Assistant (PDA), handheld device with wireless communication function, computing device or other processing device connected to wireless modem, vehicle-mounted device, wearable device, terminal device in 5G network or terminal device in Public Land Mobile Network (PLMN) for future evolution, etc., which are not limited by the embodiments of the present application.
By way of example and not limitation, in embodiments of the present application, the electronic device may also be a wearable device. Wearable equipment can also be called wearable intelligent equipment, is the general term of applying wearable technique to carry out intelligent design, develop the equipment that can dress to daily wearing, like glasses, gloves, wrist-watch, dress and shoes etc.. A wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction and cloud interaction. The generalized wearable smart device includes full functionality, large size, and can implement full or partial functionality without relying on a smart phone, such as: smart watches or smart glasses and the like, and only focus on a certain type of application functions, and need to be used in cooperation with other devices such as smart phones, such as various smart bracelets for physical sign monitoring, smart jewelry and the like.
In addition, in the embodiment of the present application, the electronic device may also be a terminal device in an internet of things (IoT) system, where IoT is an important component of future information technology development, and a main technical feature of the electronic device is to connect an article with a network through a communication technology, so as to implement an intelligent network with interconnected human-computer and interconnected objects.
The electronic device in the embodiment of the present application may also be referred to as: a terminal device, a User Equipment (UE), a Mobile Station (MS), a Mobile Terminal (MT), an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a user terminal, a wireless communication device, a user agent, or a user equipment, etc.
In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a Central Processing Unit (CPU), a Memory Management Unit (MMU), and a memory (also referred to as a main memory). The operating system may be any one or more computer operating systems that implement business processing through processes (processes), such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. The application layer comprises applications such as a browser, an address list, word processing software, instant messaging software and the like.
For example, fig. 1 shows a schematic structural diagram of an electronic device.
The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identification Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not limit the electronic device. In other embodiments of the present application, an electronic device may include more or fewer components than illustrated, or some components may be combined, or some components may be split, or a different arrangement of components may be used. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose-input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
It should be understood that the interface connection relationship between the modules according to the embodiment of the present invention is only an exemplary illustration, and does not limit the structure of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The electronic device implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The electronic device may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in the external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The data storage area can store data (such as audio data, phone book and the like) created in the using process of the electronic device. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 110 executes various functional applications of the electronic device and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor. For example, the method of controlling process interaction of the embodiments of the present application may be performed.
When the terminal device is running, in addition to some or all of the hardware support shown in fig. 1, software support loaded in the terminal device is also required. The software loaded in the terminal device may include system software, and may also include APPs depending on the system software implementation, and some APPs may call information of other APPs when running.
When calling between applications, a binder mechanism may be employed. Illustratively, as shown in fig. 2, taking application a corresponding to process a and application B corresponding to process B as an example, a schematic process of inter-process bin-based communication is described. It is to be understood that a process may correspond to one or more applications, and the number of the applications and the like specifically corresponding to the process is not specifically limited in the embodiment of the present application.
As shown in fig. 2, in the application layer, each of the process a and the process B may have a respective agent, for example, the agent includes an IPC Thread State tranascot binder communication instance. The kernel layer and the binder driver can be used as a bridge for communication of all processes, and the binder driver can prepare respective kernel buffers for all processes and map the kernel buffers to virtual address spaces and kernel address spaces of the processes. When process a communicates with process B in binder, process a may communicate with a binder driver based on the IPC Thread State transcapt binder communication instance of process a, and the binder driver transfers the data of process a to process B based on the IPC Thread State transcapt binder communication instance of process B. It is understood that, if the binder communication is performed between the process a and the process C, or between the process B and the process C, a similar manner may be adopted, and details are not described again.
In some implementations, when an APP is installed in a terminal device, a system application may need to obtain component information of the APP. For example, the system APP application process may call a Packet Manager Service (PMS) interface, bin communication is performed between get application info and a system service process (system server process) to obtain application component information of the installed APP, and the system server process may further obtain the application info of the installed application from PMS application management based on the PMS get application info, and return the application info of the installed application to the system APP application process.
However, it can be understood that the update speed of APP is fast, new APPs are always emerging, the number of application components of some system APPs or three-party APPs is large, for example, may reach more than four thousand activities, and thus, in the binder communication between APP application processes of these applications and systemsever processes, component information needing to be transmitted may occur to reach 1.3MB size.
In the binder communication mechanism, the binder driver prepares a kernel buffer for each process, which is usually small, for example, 4M, and the kernel buffer of 4M, which may be used by the application layer, is only 8k-1M, and others are used by the kernel layer.
Thus, the calling failure in the binder communication is caused to return to the "Dead System Exception" because the transmitted component information is too large, thereby causing the application to flash back. The crash can be understood as that the client program encounters an error or an exception which cannot be handled when running, and the application program is exited.
In other implementations, the application processes may transmit the large data at one time when they are mutually called, so that the single large data may also cause the binder space to be full, and the system is jammed or the application program is abnormally exited.
In view of this, in the embodiment of the present application, batch transmission of data may be supported in the binder mechanism, so that data in binder interaction is not too large, and an abnormal exit phenomenon of an application program caused by depletion of a binder memory due to the too large data in the binder is improved.
The method for controlling process interaction according to the embodiment of the present application is described in detail through a specific embodiment. The following embodiments may be implemented in combination with each other or independently, and details of the same or similar concepts or processes may not be repeated in some embodiments.
For example, fig. 3 illustrates a method for controlling process interaction according to an embodiment of the present application. The method comprises the following steps:
s301: determining that the first process calls the target information to the second process.
In this embodiment of the application, both the first process and the second process may be any processes running in the terminal device, the first process may be understood as a caller process, and the second process may be understood as a called process. The target information may be any information related to the second process, for example, the target information may include application component information of an application corresponding to the second process, and the like. The first process may invoke the target information to the second process based on the first binder communication instance corresponding to the first process.
The embodiment of the present application does not limit the timing and the function of the first process to invoke the second process. For example, when an application is newly installed in a terminal device, a system process in the terminal device may call component information of the newly installed application, so as to implement setting or management of the newly installed application, and the like. Or, for example, when application a is running, information in application B is needed, and the first process of application a may invoke the second process of application B.
It should be noted that, the determining that the first process calls the target information to the second process in S301 may be understood as the first process initiating to call the target information of the second process.
S302: transmitting first data in the target information to a first process; the first data comprise first part information in the target information, and the size of the first data does not exceed a preset value.
In this embodiment, the first data may refer to data in which a size of a part of data in the target information does not exceed a preset value. Or it can be understood that when the second process returns the target information to the first process, the target information may be split, and the size of the data transmitted each time is not more than the preset value by a batch transmission mode. The preset value may be set based on experience, and the preset value may be positively correlated to the size of the binder space, for example, the preset value may be set to any value from 200KB to 800KB, such as 300 KB.
It should be noted that, the embodiment of the present application does not limit the specific splitting manner of the target information, and all data of the target information may be split in any manner, such as according to the timestamp sequence, the importance degree sequence, and the data type distinction, so that the size of the data does not exceed a preset value in a single transmission.
In a possible implementation, the splitting may also be performed according to the number of application components corresponding to the target information, for example, the size of each application component is about 0.3KB, if the preset value is 300KB, the maximum number of application components in a single transmission may be set to 300KB/0.3KB =1000, and the number of application components included in the first data does not exceed 1000.
In this embodiment of the application, the second process may transmit, in response to the call of the first process, the first data corresponding to the target information to the first process based on the second binder communication instance corresponding to the second process.
In summary, in the embodiment of the present application, batch transmission of data may be supported in the binder mechanism, so that data in binder interaction is not too large, and an abnormal exit phenomenon of an application program caused by depletion of a binder memory due to the too large data in the binder is improved.
In a first possible implementation, on the basis of the embodiment in fig. 3, the first data may be more important data in the target information, and after the first process obtains the first data, a similar function after obtaining the whole target information can be approximately achieved, and after the second process transmits the first data to the first process, the transmission of the data to the first process may be ended. Or it can be understood that after the first process calls the target information to the second process, in order to avoid abnormal exit of the application due to too large single data transmission, the second process may return part of the important data to the first process.
Taking the target information as the component information of the application corresponding to the second process as an example, the component information may include one or more application component types of activity, service, broadcast, or providers, the number of any type of application component may be multiple, and the activity application component is a relatively critical application component in the application, so that the activity application component may be transmitted first, and the first part of information at least includes the activity. This may allow important activity to be transmitted.
It can be understood that, in different applications, the corresponding importance degrees of the activity, service, broadcast, and providers may be different, and therefore, the first data may include partial data sorted according to the importance degrees in the activity, service, broadcast, and providers, so that the size of the first data does not exceed a preset value, and the important data is transmitted.
For example, the first part of information may be: and selecting the obtained parts smaller than or equal to the preset value according to the sequence of activity, service, broadcast and providers in the target information from front to back.
In a second possible implementation, after the second process transmits the first data to the first process, the second process may wait for the call instruction of the first process, and after receiving the call instruction of the first process, continue to transmit other data in the target information to the first process, where the size of the data transmitted each time does not exceed a preset value. This enables the second process to completely transfer the target information to the first process.
Exemplarily, before the second process transmits the first data to the first process, the number of application components corresponding to the target information is acquired; determining the times of sending the instruction for calling the target information to the second process by the first process according to the number of the application components; and when the first process sends an instruction for calling the target information to the second process once, the second process returns data to the first process once, and the size of the data returned at any time does not exceed a preset value.
For example, a first interface for supporting obtaining of the number of the application components may be designed, and the terminal device may obtain the number of the application components corresponding to the target information in the second process based on the first interface and the getPackageInfoComponentCount. The getPackageInfoComponentCount may include, for example, getPackageInfoComponentCount (String packageName, int flags).
After the number of application components corresponding to the target information is obtained, the number of times that the first process sends an instruction for calling the target information to the second process can be further determined according to the number of the application components.
Illustratively, the number of application components corresponding to the obtained target information is M, and when the sum of the component information transmitted at a single time does not exceed a preset value, the maximum number of application components that can be transmitted is L, the number of times that the first process sends the instruction for calling the target information to the second process may be M/L, and it can be understood that, if M/L is not an integer, the integer value obtained by carry may be used as the number of times that the first process sends the instruction for calling the target information to the second process regardless of any value after the decimal point.
Thus, after the first data in the target information is transmitted to the first process, the method further includes: a first process sends an instruction for calling target information to a second process; and the second process transmits second data in the target information to the first process, wherein the second data comprises a second part of information in the target information, and the size of the second data does not exceed a preset value. It can be understood that, if it is determined that the number of times that the first process sends the instruction for calling the target information to the second process is greater than 2, the subsequent first process may further continue to send the instruction for calling the target information to the second process, and the second process continues to transmit the data in the target information to the first process, and the data is transmitted once per instruction until the number of times that the first process sends the instruction for calling the target information to the second process is reached.
Optionally, the determining, by the first process, the number of times of sending the instruction for invoking the target information to the second process according to the number of the application components includes: and when the number of the application components is larger than the number threshold, the first process determines the number of times of sending the instruction for calling the target information to the second process according to the number of the application components.
In this embodiment of the application, the number threshold may be the maximum number of application components that can be transmitted when the sum of the component information transmitted in a single time does not exceed a preset value, for example, the number threshold may be 1000.
The number of the application components in the target information may be less than or equal to the number threshold, so that data transmission in batches is not needed, and the second process can return all the application components of the target information to the first process, thereby saving computing resources. When the number of the application components is larger than the number threshold, the first process determines the frequency of sending the instruction for calling the target information to the second process according to the number of the application components, and executes subsequent batch transmission, so that data in binder interaction is not overlarge, and the abnormal exit phenomenon of an application program caused by depletion of a binder memory due to overlarge data in the binder is improved.
In a third possible implementation, after the second process transmits the first data to the first process, the second process may further automatically continue to transmit other data in the target information to the first process, and the size of the data transmitted each time does not exceed the preset value. Or it can be understood that after the first process sends the instruction for calling the target information to the second process once, the second process can transmit the data in the target information to the first process in batches without the need for the first process to send the instruction additionally.
Optionally, the first data carries a first value, where the first value is a total batch of data to be transmitted to the first process by the second process. In this way, the first process can know how many batches of data the second process will transmit to the first process, and the subsequent first process can check whether the missed transmission occurs, and the first process can also know whether the second process completes the data transmission.
For example, taking the total lot as Q as an example, if the first process receives data of the Q lot from the second process, it may be considered that the target information acquisition is completed, and the subsequent steps may be performed. Or, when the preset time of the first process is reached, the batch of data received by the first process from the second process does not reach Q, and it can be considered that the missed transmission occurs.
Thus, after transmitting the first data in the target information to the first process, the method further includes: transmitting the Nth data in the target information to the first process until the second process completes the batch transmission of the component information in the target information; the Nth data comprises partial information in the target information, and the size of the Nth data does not exceed a preset value. In the embodiment of the application, the second process can automatically transmit data to the first process in batches, so that instruction interaction between the first process and the second process can be saved.
Optionally, the first data and/or the nth data further carry a second value, where the second value is a specific batch value of the first data or the nth data in the total batch. Therefore, after the first process obtains the data transmitted by the second process, the first process can sort the data based on the specific batch values of the data, or check whether the data is missing or not, and the specific missing data, so as to facilitate subsequent retransmission and the like.
It should be noted that, when the second process transmits data to the first process in batches, a second interface for acquiring component information in batches according to the index may be designed, and the terminal device may acquire the application component corresponding to the target information in the second process based on the second interface and the getPackageInfoComponents. The getParackageInfoComponents may include, for example, getParackageInfoComponents (String packagName, int flags, int start, int end), end < Count & (end-start) <1000.
By way of example, fig. 4 illustrates one possible interface implementation of the embodiments of the present application.
As shown in fig. 4, a first application may call a PMS interface through a first process, perform binder communication with a second process through a get package info, take the second process as a system service process (system server process) as an example, the system server process may further obtain the package info of the first application from PMS application management based on the PMS get package info internal, the PMS may generate component information (generate package info) of the first application, the PMS may further process the component information of the first application into effective content (package info utilities), the effective content includes, for example, component information classified according to application component types, for example, component information includes activity, service, broadcast and providers, when the second process returns component information to the first process, the total number of components returned in a single time may be less than 1000 according to the manner of the embodiment of the present application. The data in the binder interaction cannot be overlarge, and the abnormal exit phenomenon of the application program caused by the memory exhaustion of the binder due to the overlarge data in the binder is improved.
The scheme provided by the embodiment of the application is mainly introduced from the perspective of a method. To implement the above functions, it includes hardware structures and/or software modules for performing the respective functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the exemplary method steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, a device for implementing a method for controlling process interaction may be divided into function modules according to the above method example, for example, each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
Fig. 5 is a schematic structural diagram of a chip according to an embodiment of the present disclosure. Chip 500 includes one or more (including two) processors 501, communication lines 502, a communication interface 503, and memory 504.
In some embodiments, the memory 504 stores the following elements: an executable module or a data structure, or a subset thereof, or an expanded set thereof.
The method described in the embodiments of the present application may be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 501. The processor 501 may be a general-purpose processor (e.g., a microprocessor or a conventional processor), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an FPGA (field-programmable gate array) or other programmable logic device, discrete gate, transistor logic device or discrete hardware component, and the processor 501 may implement or execute the methods, steps and logic blocks disclosed in the embodiments of the present application.
The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium mature in the field, such as a random access memory, a read only memory, a programmable read only memory, or a charged erasable programmable memory (EEPROM). The storage medium is located in the memory 504, and the processor 501 reads the information in the memory 504 and completes the steps of the method in combination with the hardware.
The processor 501, the memory 504, and the communication interface 503 may communicate with each other via a communication line 502.
In the above embodiments, the instructions stored by the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be written in the memory in advance, or may be downloaded in the form of software and installed in the memory.
Embodiments of the present application also provide a computer program product comprising one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in, or transmitted from, one computer-readable storage medium to another, e.g., from one website, computer, server, or datacenter, through a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.) manner to another website, computer, server, or datacenter.
The embodiment of the application also provides a computer readable storage medium. The methods described in the above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may include any medium that can communicate a computer program from one place to another. A storage medium may be any target medium that can be accessed by a computer.
As one possible design, the computer-readable medium may include a compact disk read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disk storage; the computer readable medium may include a disk memory or other disk storage device. Also, any connecting line may also be properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

Claims (12)

1. A method for controlling process interaction is applied to a terminal device running a first process and a second process, wherein the first process and the second process communicate based on a binder mechanism, and the method comprises the following steps:
determining that the first process calls target information to the second process;
transmitting first data in the target information to the first process; the first data comprises a first part of information in the target information, and the size of the first data does not exceed a preset value.
2. The method of claim 1, wherein the first portion of information comprises at least activity.
3. The method of claim 2, wherein the first part of information is: and selecting the obtained parts smaller than or equal to the preset value according to the sequence of activity, service, broadcast and providers in the target information from front to back.
4. The method of any of claims 1-3, wherein prior to determining that the first process invokes target information to the second process, further comprising:
acquiring the number of application components corresponding to the target information;
determining the number of times that the first process sends an instruction for calling the target information to the second process according to the number of the application components;
and when the first process sends an instruction for calling the target information to the second process once, the second process returns data to the first process once, and the size of the data returned at any time does not exceed the preset value.
5. The method of claim 4, wherein after transmitting the first data in the target information to the first process, further comprising:
the first process sends an instruction for calling the target information to the second process;
and the second process transmits second data in the target information to the first process, wherein the second data comprises a second part of information in the target information, and the size of the second data does not exceed the preset value.
6. The method according to claim 4 or 5, wherein the first process determines the number of times of sending the instruction for calling the target information to the second process according to the number of the application components, and comprises:
when the number of the application components is larger than a number threshold value, the first process determines the number of times of sending an instruction for calling the target information to the second process according to the number of the application components;
the acquiring, by the first process, the number of application components corresponding to the target information in the second process includes:
and the first process acquires the number of the application components corresponding to the target information in the second process based on the getPackageInComponentCount.
7. A method according to any one of claims 1 to 3, wherein the first data carries a first value, the first value being a total batch of data to be transmitted by the second process to the first process.
8. The method of claim 7, wherein after the transmitting the first data in the target information to the first process, further comprising:
transmitting the Nth data in the target information to the first process until the second process completes batch transmission of the component information in the target information; the Nth data comprises partial information in the target information, and the size of the Nth data does not exceed the preset value.
9. The method according to claim 8, wherein the first data and/or the nth data further carry a second value, and the second value is a specific batch value of the first data or the nth data in the total batch.
10. A terminal device, comprising: a memory for storing a computer program and a processor for executing the computer program to perform the method of controlling process interaction according to any of claims 1-9.
11. A computer-readable storage medium storing instructions that, when executed, cause a computer to perform a method of controlling process interaction according to any one of claims 1-9.
12. A computer program product, comprising a computer program which, when executed, causes an electronic device to perform the method of any of claims 1-9.
CN202210764724.8A 2022-07-01 2022-07-01 Method for controlling process interaction and related device Active CN115202902B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210764724.8A CN115202902B (en) 2022-07-01 2022-07-01 Method for controlling process interaction and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210764724.8A CN115202902B (en) 2022-07-01 2022-07-01 Method for controlling process interaction and related device

Publications (2)

Publication Number Publication Date
CN115202902A true CN115202902A (en) 2022-10-18
CN115202902B CN115202902B (en) 2023-08-22

Family

ID=83578984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210764724.8A Active CN115202902B (en) 2022-07-01 2022-07-01 Method for controlling process interaction and related device

Country Status (1)

Country Link
CN (1) CN115202902B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105335238A (en) * 2014-08-12 2016-02-17 腾讯科技(深圳)有限公司 Inter-process communication method and apparatus
CN108984321A (en) * 2018-06-29 2018-12-11 Oppo(重庆)智能科技有限公司 A kind of mobile terminal and its method for limiting, the storage medium of interprocess communication
CN109032812A (en) * 2018-06-29 2018-12-18 Oppo(重庆)智能科技有限公司 A kind of mobile terminal and its method for limiting, the storage medium of interprocess communication
CN109669784A (en) * 2017-10-13 2019-04-23 华为技术有限公司 A kind of method and system of interprocess communication
CN109684069A (en) * 2017-10-13 2019-04-26 华为技术有限公司 The method and terminal device of resource management
CN109891392A (en) * 2017-09-30 2019-06-14 华为技术有限公司 A kind of processing method and processing device of system service time-out
WO2021083378A1 (en) * 2019-11-01 2021-05-06 华为技术有限公司 Method for accelerating starting of application, and electronic device
WO2021208627A1 (en) * 2020-04-13 2021-10-21 荣耀终端有限公司 Task scheduling method and apparatus, and electronic device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105335238A (en) * 2014-08-12 2016-02-17 腾讯科技(深圳)有限公司 Inter-process communication method and apparatus
CN109891392A (en) * 2017-09-30 2019-06-14 华为技术有限公司 A kind of processing method and processing device of system service time-out
CN109669784A (en) * 2017-10-13 2019-04-23 华为技术有限公司 A kind of method and system of interprocess communication
CN109684069A (en) * 2017-10-13 2019-04-26 华为技术有限公司 The method and terminal device of resource management
CN108984321A (en) * 2018-06-29 2018-12-11 Oppo(重庆)智能科技有限公司 A kind of mobile terminal and its method for limiting, the storage medium of interprocess communication
CN109032812A (en) * 2018-06-29 2018-12-18 Oppo(重庆)智能科技有限公司 A kind of mobile terminal and its method for limiting, the storage medium of interprocess communication
WO2021083378A1 (en) * 2019-11-01 2021-05-06 华为技术有限公司 Method for accelerating starting of application, and electronic device
WO2021208627A1 (en) * 2020-04-13 2021-10-21 荣耀终端有限公司 Task scheduling method and apparatus, and electronic device

Also Published As

Publication number Publication date
CN115202902B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
US20230016915A1 (en) Method and apparatus for low energy discovery
CN107241689B (en) Earphone voice interaction method and device and terminal equipment
EP3018919B1 (en) Method of transmitting and receiving data of electronic device and electronic device using the method
US11016769B1 (en) Method and apparatus for processing information
CN115499897B (en) WiFi network access method and related device
CN109656844A (en) A kind of AT24xx EEPROM driving method and device
CN116860391A (en) GPU computing power resource scheduling method, device, equipment and medium
CN111445331A (en) Transaction matching method and device
CN117724852A (en) Cloud computer computing resource allocation method and device
CN112506676A (en) Inter-process data transmission method, computer device and storage medium
CN117707439A (en) Log printing method and related device
CN115202902B (en) Method for controlling process interaction and related device
CN112799858A (en) Heterogeneous simulation model data processing method and system under heterogeneous joint simulation environment
CN116089110B (en) Method for controlling process interaction and related device
CN113591006A (en) Web extension method and device based on WebSocket
CN116737258B (en) Method and related device for unloading application
CN117858279A (en) SIM card service processing method and related device
CN115397033B (en) Wireless communication method, wireless communication device, wireless communication module, medium, and program product
CN116700660B (en) Audio playing method and electronic equipment
CN116196621B (en) Application processing method and related device
CN116088888B (en) Application program updating method and related device
CN117834649B (en) Data transmission method and related device
CN116049096B (en) Data migration method, electronic equipment and storage medium
CN116707048B (en) OTG-based charging control method and related device
CN116089563B (en) Log processing method and related 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
GR01 Patent grant
GR01 Patent grant