Binder management system, method, client, server
By setting up Binder management units on both the client and server sides to manage their respective Binder proxy objects and using a counting mechanism, the problem of Binder resources not being released in cross-platform interaction scenarios is solved, achieving effective release of Binder resources and normal execution of cross-platform interactions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2023-07-05
- Publication Date
- 2026-05-26
AI Technical Summary
The existing system cannot automatically clean up the Binder resources of the service collaboration module used in cross-platform interaction scenarios, resulting in the inability to release Binder resources.
By setting up Binder management units on both the client and server sides to manage their respective Binder proxy objects, and using a counting mechanism to ensure that Binder resources are released only after all related proxy objects have been released, the normal execution of cross-platform interaction is prevented from being affected.
It enables the effective release of Binder resources across platforms, avoids Binder resource leakage, and ensures the normal operation of cross-platform interaction.
Smart Images

Figure CN119271425B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of device management technology, and in particular to a Binder management system, method, client, and server. Background Technology
[0002] Binder is a tool used in electronic devices for inter-process communication. Applications in different processes use different Binders for inter-process communication. In some current application scenarios, cross-platform interaction between different electronic devices is required to complete business tasks. For example, electronic device 1 may cross-platform access the microphone of electronic device 2 to collect audio data, or electronic device 1 may cross-platform access a document stored on electronic device 2 to perform document modification operations.
[0003] See Figure 1 This diagram illustrates a cross-platform interaction scenario provided by an embodiment of this application. The diagram includes electronic devices 1 and 2 for cross-platform interaction. Each of the electronic devices, 1 and 2, is equipped with a service collaboration module 1 and a service collaboration module 2. During cross-platform interaction, application 1 in electronic device 1 and application 2 in electronic device 2 exchange information. Application 1 and service collaboration module 1 exchange information, application 2 and service collaboration module 2 exchange information, and service collaboration module 1 and service collaboration module 2 exchange messages, thereby enabling cross-platform collaborative work between application A and application B. In this process, application 1 and service collaboration module 1 run in different processes, and application 2 and service collaboration module 2 run in different processes. Application 1 uses Binder(proxy1) for inter-process communication, service collaboration module 1 uses Binder(proxy1') for inter-process communication, service collaboration module 2 uses Binder(proxy2) for inter-process communication, and application 2 uses Binder(proxy2') for inter-process communication.
[0004] Among them, proxy1, proxy1', proxy2, and proxy2' are all Binder proxy objects (BpBinder, BinderProxy Binder). proxy1 references binder_ref1, proxy1' references binder_ref1', proxy2 references binder_ref2, and proxy2' references binder_ref2'. binder_ref1, binder_ref1', binder_ref2, and binder_ref2' are all Binder reference objects (Binder_ref, Binder_Reference). binder_ref1 and binder_ref1' reference binder_node1, and binder_ref2 and binder_ref2' reference binder_node2. binder_node1 is the Binder entity object of the service corresponding to application 1, and binder_node2 is the Binder entity object (binder_node) of the service corresponding to service collaboration module 2.
[0005] binder_ref1, binder_ref1', and binder_node1 are located in the Binder driver within the client, while binder_ref2, binder_ref2', and binder_node2 are located in the Binder driver within the server.
[0006] However, in the above scenarios, if the application stops working, the system can release the application's corresponding Binder based on the lifecycle mechanism. But the current system cannot automatically clean up the Binder of the service collaboration module that is only used in cross-platform interaction scenarios, resulting in the inability to release Binder resources. Summary of the Invention
[0007] In view of this, this application provides a Binder management system, method, client, and server to manage Binder, clean up Binder, and release Binder resources.
[0008] In a first aspect, embodiments of this application provide a Binder management system, the system including a client and a server, the client running a first application and a first service collaboration module, the server running a second application and a second service collaboration module, the client and the server collaborating through the first service collaboration module and the second service collaboration module, the first service collaboration module including a first Binder management unit, and the second service collaboration module including a second Binder management unit;
[0009] The first application sends its first Binder proxy object to the first Binder management unit;
[0010] The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object, and assigns a Binder identifier to the second Binder proxy object;
[0011] The first Binder management unit sends the Binder identifier to the second Binder management unit;
[0012] After receiving the Binder identifier, the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier;
[0013] The second Binder management unit sends the third Binder proxy object to the second application;
[0014] The second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object;
[0015] After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, determines the Binder identifier corresponding to the third Binder proxy object according to the recorded association relationship, and sends a Binder release command carrying the Binder identifier to the first Binder management unit.
[0016] In response to the Binder release command, the first Binder management unit releases the Binder proxy object indicated by the Binder identifier.
[0017] As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0018] In one embodiment of this application, the second Binder management unit is further configured to:
[0019] After each third Binder proxy object is sent to a second application, the count value corresponding to the third Binder proxy object is incremented by 1;
[0020] After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, including:
[0021] After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1; after determining that the count value corresponding to the third Binder proxy object has dropped to 0, it releases the third Binder proxy object.
[0022] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. The third Binder proxy object is only released after the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released. This can prevent the third Binder proxy object from being released prematurely and affecting the normal execution of cross-end interaction.
[0023] Secondly, embodiments of this application provide a Binder management method applied to a client, wherein a first application and a first service collaboration module run in the client, the first service collaboration module including a first Binder management unit, and the method includes:
[0024] The first application sends its first Binder proxy object to the first Binder management unit;
[0025] The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object, and assigns a Binder identifier to the second Binder proxy object;
[0026] The first Binder management unit sends the Binder identifier to the second Binder management unit on the server side, so that the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier. The first Binder management unit also sends the third Binder proxy object to the second application, so that the second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object. The second application and the second service collaboration module run on the server side. The second Binder management unit is included in the second service collaboration module. The client and the server side work together through the first service collaboration module and the second service collaboration module.
[0027] The system receives a Binder release instruction sent by the second Binder management unit. The Binder release instruction is sent by the second Binder management unit after determining that the fourth Binder proxy object has been released and releasing the third Binder proxy object. The Binder release instruction carries the Binder identifier corresponding to the third Binder proxy object.
[0028] In response to the Binder release command, the first Binder management unit releases the Binder proxy object indicated by the Binder identifier.
[0029] As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0030] In one embodiment of this application, the Binder release instruction is sent by the second Binder management unit after releasing the third Binder proxy object when the count value corresponding to the third Binder proxy object drops to 0;
[0031] The count value corresponding to the third Binder proxy object is updated by the second Binder management unit in the following manner: after the second Binder management unit sends the third Binder proxy object to a second application, it increments the count value corresponding to the third Binder proxy object by 1; after the second Binder management unit determines that the fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1.
[0032] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. The third Binder proxy object is only released after the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released. This can prevent the third Binder proxy object from being released prematurely and affecting the normal execution of cross-end interaction.
[0033] Thirdly, embodiments of this application provide a Binder management method applied to a server, wherein a second application and a second service collaboration module run on the server, the second service collaboration module including a second Binder management unit, and the method includes:
[0034] The second Binder management unit receives a Binder identifier sent by the first Binder management unit in the client. The client runs a first application in the first service collaboration module. The first service collaboration module includes the first Binder management unit. The Binder identifier is allocated by the first Binder management unit for the second Binder proxy object. The second Binder proxy object is obtained by the first Binder management unit after receiving the first Binder proxy object sent by the first application, and it references the same Binder entity object as the first Binder proxy object.
[0035] After receiving the Binder identifier, the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier;
[0036] The second Binder management unit sends the third Binder proxy object to the second application;
[0037] The second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object;
[0038] After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object and determines the Binder identifier corresponding to the third Binder proxy object according to the recorded association relationship. It then sends a Binder release instruction carrying the Binder identifier to the first Binder management unit, so that the first Binder management unit responds to the Binder release instruction and releases the Binder proxy object indicated by the Binder identifier.
[0039] As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0040] In one embodiment of this application, the method further includes:
[0041] Each time the second Binder management unit sends the third Binder proxy object to a second application, it increments the counter value corresponding to the third Binder proxy object by 1.
[0042] After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, including:
[0043] After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1; after determining that the count value corresponding to the third Binder proxy object has dropped to 0, it releases the third Binder proxy object.
[0044] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. The third Binder proxy object is only released after the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released. This can prevent the third Binder proxy object from being released prematurely and affecting the normal execution of cross-end interaction.
[0045] Fourthly, embodiments of this application provide a client, including a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method described in the second aspect.
[0046] Fifthly, embodiments of this application provide a server, including a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method described in any one of the third aspects.
[0047] In a sixth aspect, embodiments of this application provide a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform the method described in the second or third aspect.
[0048] The beneficial effects of the embodiments of this application are as follows:
[0049] This application provides a Binder management system, which includes a client and a server. The client runs a first application and a first service collaboration module, while the server runs a second application and a second service collaboration module. The client and server can collaborate through the first and second service collaboration modules. During collaboration, the first application and the second service collaboration module on the client, and the second application and the second service collaboration module on the server, each have a corresponding Binder proxy object. These Binder proxy objects work together to complete the collaboration process. Therefore, after the fourth Binder proxy object corresponding to the second application is released, the collaboration stops, and the Binder proxy object corresponding to the aforementioned service collaboration module is no longer needed. Thus, the second Binder management unit can first release the third Binder proxy object, which is also on the server, and send a Binder release instruction to the first Binder management unit, instructing the first Binder management unit to release the second Binder proxy object whose Binder identifier is associated with the third Binder proxy object. As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module. Attached Figure Description
[0050] Figure 1 A schematic diagram illustrating a cross-platform interaction scenario provided in an embodiment of this application;
[0051] Figure 2 A schematic diagram of a client structure provided in an embodiment of this application;
[0052] Figure 3 This is a schematic diagram of the structure of a server provided in an embodiment of this application;
[0053] Figure 4 A schematic diagram of the software architecture of a Binder management system provided in this application embodiment;
[0054] Figure 5 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0055] Figure 6 This is a schematic diagram of a first type of Binder management process provided in an embodiment of this application;
[0056] Figure 7 This is a schematic diagram of a second Binder management process provided in an embodiment of this application;
[0057] Figure 8 This is a schematic diagram of an application scenario in related technologies;
[0058] Figure 9 A flowchart illustrating a Binder management method applied to a client, provided as an embodiment of this application;
[0059] Figure 10 This is a flowchart illustrating a Binder management method applied to a server, as provided in an embodiment of this application.
[0060] Specific implementation method
[0061] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0062] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, "first instruction" and "second instruction" are used to distinguish different user instructions and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0063] It should be noted that, in this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0064] In this application embodiment, both the client and the server can be electronic devices such as tablet computers (PCs), personal digital assistants (PDAs), smartwatches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, in-vehicle devices, smart cars, robots, smart glasses, and smart TVs.
[0065] like Figure 2 As shown, Figure 2 This is a schematic diagram of a client provided in an embodiment of this application. Figure 2 The client shown may include a processor 210, external memory interfaces 1-N220, internal memory 221, a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, antenna 1, antenna 2, a mobile communication module 250, a wireless communication module 260, buttons 290, a motor 291, an indicator 292, cameras 1-N293, displays 1-N294, and a Subscriber Identity Module (SIM) card interface 1-N295, etc. The sensor module 280 may include a pressure sensor 280A, a touch sensor 280B, etc.
[0066] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the client. In other embodiments of this application, the client may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0067] Processor 210 may include one or more processing units, such as an application processor (AP), a modem, 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). These different processing units may be independent devices or integrated into one or more processors.
[0068] The processor 210 can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.
[0069] The processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can store instructions or data that the processor 210 has just used or that are used repeatedly. If the processor 210 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0070] In some embodiments, the processor 210 may include one or more interfaces. These interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, a General-Purpose Input / Output (GPIO) interface, and a Subscriber Identity Module (SIM) interface.
[0071] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 210 may include multiple I2C buses. The processor 210 can couple to the touch sensor 280B, charger, flash, camera 293, etc., through different I2C bus interfaces. For example, the processor 210 can couple to the touch sensor 280B through the I2C interface, enabling the processor 210 and the touch sensor 280B to communicate through the I2C bus interface, thereby realizing the touch function of the client.
[0072] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 210 and the wireless communication module 260. For example, the processor 210 communicates with the Bluetooth module in the wireless communication module 260 via the UART interface to implement Bluetooth functionality.
[0073] The MIPI interface can be used to connect the processor 210 to peripheral devices such as the display screen 294 and the camera 293. The MIPI interface includes a Camera Serial Interface (CSI) and a Display Serial Interface (DSI). In some embodiments, the processor 210 and the camera 293 communicate via the CSI interface to enable the client's shooting function. The processor 210 and the display screen 294 communicate via the DSI interface to enable the client's display function.
[0074] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the client's structure. In other embodiments of this application, the client may also employ different interface connection methods or a combination of multiple interface connection methods as described above.
[0075] The client's wireless communication function can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor, and baseband processor.
[0076] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the client can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0077] The mobile communication module 250 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for client applications. In some embodiments, the mobile communication module 250 can be used to transmit call data between two electronic devices. For example, when acting as the called party, the device can receive downlink audio stream data from the calling party and transmit uplink audio stream data to the calling party.
[0078] The wireless communication module 260 can provide solutions for wireless communication applications on clients, including WLAN (Wireless Local Area Networks), BT (Bluetooth), GNSS (Global Navigation Satellite System), FM (Frequency Modulation), NFC (Near Field Communication), and IR (infrared).
[0079] In some embodiments, antenna 1 of the client is coupled to mobile communication module 250, and antenna 2 is coupled to wireless communication module 260, enabling the client to communicate with networks and other devices via wireless communication technology. In one embodiment of this application, the client can achieve local area network connection with another electronic device through wireless communication module 260. Wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division-Synchronous Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), Beidou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation System (SBAS), etc.
[0080] Display screen 294 is used to display images, videos, etc. Display screen 294 includes a display panel. The display panel can be a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), an Active-Matrix Organic Light-Emitting Diode (AMOLED), a Flexible Light-Emitting Diode (FLED), MiniLED, MicroLED, Micro-OLED, and a Quantum Dot Light-Emitting Diode (QLED), etc. In some embodiments, the client may include one or N displays 294, where N is a positive integer greater than 1.
[0081] The external storage interface 220 can be used to connect an external memory card, such as a Micro Secure Digital Memory (SD) card, to expand the client's storage capacity. The external memory card communicates with the processor 210 through the external storage interface 220 to perform data storage functions. For example, music, video, and audio files can be stored on the external memory card.
[0082] Internal memory 221 can be used to store computer executable program code, which includes instructions. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function (such as sound playback, image playback, and recording functions). The data storage area may store data created during client use (such as uplink audio data, downlink audio data, and phonebook data). Furthermore, internal memory 221 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, Universal Flash Storage (UFS), etc. Processor 210 executes various client applications and data processing by running instructions stored in internal memory 221 and / or instructions stored in memory located within processor 210.
[0083] Pressure sensor 280A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 280A may be disposed on display screen 294. In some embodiments, when a user presses the answer button on display screen 294, a call can be answered manually; when a user presses the hang-up button on display screen 294, a call can be hung up manually.
[0084] Touch sensor 280B, also known as a "touch device," can be located on display screen 294. The touch sensor 280B and display screen 294 together form a touchscreen, also known as a "touchscreen." Touch sensor 280B detects touch operations applied to or near it. Touch sensor 280B can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 294. In other embodiments, touch sensor 280B may also be located on the surface of the client, in a different position than display screen 294.
[0085] Buttons 290 include a power button, volume buttons, etc. Buttons 290 can be mechanical buttons or touch-sensitive buttons. The client can receive button inputs and generate key signal inputs related to user settings and function control.
[0086] Motor 291 can generate vibration alerts. Motor 291 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can be corresponding to touch operations applied to different applications (such as taking photos, playing audio, etc.). Motor 291 can also correspond to different vibration feedback effects for touch operations applied to different areas of the display screen 294. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0087] The SIM card interface 295 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 295 to establish contact with the client. The client can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, and other SIM cards. Multiple cards can be inserted into the same SIM card interface 295 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 295 is also compatible with different types of SIM cards. The SIM card interface 295 is also compatible with external storage cards. The client interacts with the network through the SIM card to achieve functions such as calls and data communication. In some embodiments, the client uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the client and cannot be separated from it.
[0088] like Figure 3 As shown, Figure 3 This is a schematic diagram of a server provided in an embodiment of this application. Figure 3 The server shown may include a processor 310, external memory interfaces 1' to N' 320, internal memory 321, a Universal Serial Bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, antenna 1', antenna 2', a mobile communication module 350, a wireless communication module 360, buttons 390, a motor 391, an indicator 392, cameras 1' to N' 393, a display screen 1' to N' 394, and a Subscriber Identity Module (SIM) card interface 1' to N' 395, etc. The sensor module 380 may include a pressure sensor 380A, a touch sensor 380B, etc.
[0089] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the server. In other embodiments of this application, the server may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0090] The processor 310 may include one or more processing units, such as an application processor (AP), a modem, 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). These different processing units may be independent devices or integrated into one or more processors.
[0091] The processor 310 can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.
[0092] The processor 310 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. This memory can store instructions or data that the processor 310 has just used or that are used repeatedly. If the processor 310 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 310, and thus improves the efficiency of the system.
[0093] In some embodiments, the processor 310 may include one or more interfaces. These interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, a General-Purpose Input / Output (GPIO) interface, and a Subscriber Identity Module (SIM) interface.
[0094] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 310 may include multiple I2C buses. The processor 310 can couple to the touch sensor 380B, charger, flash, camera 393, etc., through different I2C bus interfaces. For example, the processor 310 can couple to the touch sensor 380B through the I2C interface, enabling the processor 310 and the touch sensor 380B to communicate through the I2C bus interface, thereby realizing the touch function on the server side.
[0095] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 310 and the wireless communication module 360. For example, the processor 310 communicates with the Bluetooth module in the wireless communication module 360 via the UART interface to implement Bluetooth functionality.
[0096] The MIPI interface can be used to connect the processor 310 to peripheral devices such as the display screen 394 and the camera 393. The MIPI interface includes a Camera Serial Interface (CSI) and a Display Serial Interface (DSI). In some embodiments, the processor 310 and the camera 393 communicate via the CSI interface to implement the server's shooting function. The processor 310 and the display screen 394 communicate via the DSI interface to implement the server's display function.
[0097] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the server. In other embodiments of this application, the server may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.
[0098] The server's wireless communication function can be implemented through antenna 1', antenna 2', mobile communication module 350, wireless communication module 360, modem processor, and baseband processor.
[0099] Antennas 1' and 2' are used to transmit and receive electromagnetic wave signals. Each antenna in the server can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1' can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0100] The mobile communication module 350 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the server side. In some embodiments, the mobile communication module 350 can be used to transmit call data between two electronic devices. For example, when acting as the called party, the device can receive downlink audio stream data from the calling party and transmit uplink audio stream data to the calling party.
[0101] The 360 wireless communication module can provide solutions for server-side applications including WLAN (Wireless Local Area Networks), BT (Bluetooth), GNSS (Global Navigation Satellite System), FM (Frequency Modulation), NFC (Near Field Communication), and IR (infrared).
[0102] In some embodiments, antenna 1' of the server is coupled to mobile communication module 350, and antenna 2' is coupled to wireless communication module 360, enabling the server to communicate with the network and other devices via wireless communication technology. In one embodiment of this application, the server can connect to a local area network of another electronic device via wireless communication module 360. Wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division-Synchronous Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), Beidou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation System (SBAS), etc.
[0103] Display screen 394 is used to display images, videos, etc. Display screen 394 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, or a quantum dot light-emitting diode (QLED), etc. In some embodiments, the server may include one or N' displays 394, where N' is a positive integer greater than 1.
[0104] The external storage interface 320 can be used to connect external storage cards, such as Micro Secure Digital Memory (SD) cards, to expand the server's storage capacity. The external storage card communicates with the processor 310 through the external storage interface 320 to perform data storage functions. For example, music, video, and audio files can be stored on the external storage card.
[0105] Internal memory 321 can be used to store executable program code, including instructions. Internal memory 321 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function (such as sound playback, image playback, and recording functions). The data storage area may store data created during server use (such as upstream audio data, downstream audio data, and a phone book). Furthermore, internal memory 321 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or Universal Flash Storage (UFS). Processor 310 executes various server-side functional applications and data processing by running instructions stored in internal memory 321 and / or instructions stored in memory located within processor 310.
[0106] Pressure sensor 380A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 380A may be disposed on display screen 394. In some embodiments, when a user presses the answer button on display screen 394, a call can be answered manually; when a user presses the hang-up button on display screen 394, a call can be hung up manually.
[0107] Touch sensor 380B, also known as a "touch device," can be located on display screen 394. The touch sensor 380B and display screen 394 together form a touchscreen, also known as a "touchscreen." Touch sensor 380B is used to detect touch operations applied to or near it. Touch sensor 380B can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 394. In other embodiments, touch sensor 380B may also be located on the surface of the server, in a different position than display screen 394.
[0108] Buttons 390 include a power button, volume buttons, etc. Buttons 390 can be mechanical buttons or touch-sensitive buttons. The server can receive button input and generate key signal inputs related to user settings and function control on the server side.
[0109] Motor 391 can generate vibration alerts. Motor 391 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can be corresponding to touch operations applied to different applications (such as taking photos, playing audio, etc.). Motor 391 can also correspond to different vibration feedback effects for touch operations applied to different areas of the display screen 394. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0110] The SIM card interface 395 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 395 to achieve contact and separation with the server. The server can support one or N' SIM card interfaces, where N' is a positive integer greater than 1. The SIM card interface 395 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 395 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 395 is also compatible with different types of SIM cards. The SIM card interface 395 is also compatible with external memory cards. The server interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the server uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the server and cannot be separated from the server.
[0111] To address the problem of the inability to release Binder resources in related technologies, this application provides a Binder management system.
[0112] The aforementioned Binder management system includes a client and a server. The client runs a first application and a first service collaboration module, and the server runs a second application and a second service collaboration module. The client and the server collaborate through the first service collaboration module and the second service collaboration module. The first service collaboration module includes a first Binder management unit, and the second service collaboration module includes a second Binder management unit.
[0113] See Figure 4 This diagram illustrates the software architecture of a Binder management system provided in this application embodiment. The diagram includes software modules within the client and software modules within the server. As shown, the client includes a first application and a first service collaboration module, while the server includes a second application and a second service collaboration module. The first service collaboration module includes a first Binder management unit, and the second service collaboration module includes a second Binder management unit. The first application and the second application belong to the application layer, and the first service collaboration module and the second service collaboration module belong to the service collaboration layer. The diagram also includes a driver layer, which includes a Binder driver, comprising Binder reference objects and Binder entity objects.
[0114] Corresponding to Figure 1 In the application scenario shown, the client is electronic device 1, the first application is application 1, the first service collaboration module is service collaboration module 1, the server is electronic device 2, the second application is application 2, and the second service collaboration module is service collaboration module 2.
[0115] See Figure 5 This is a schematic diagram of an application scenario provided by an embodiment of this application. Figure 5 In the application scenario shown, the client is a PC or tablet, the first application is a note-taking application, the server is a mobile phone, and the second application is a camera application. The note-taking application sends a request to the second service collaboration module to take a picture of the whiteboard through the first service collaboration module. The second service collaboration module instructs the camera application to take a picture of the whiteboard and then write the whiteboard image into the corresponding note document of the note-taking application, thereby realizing cross-terminal image data acquisition and recording.
[0116] In addition, both the first and second Binder management units mentioned above consist of a BinderManager (Binder management) subunit and a Binder proxy subunit. The BinderManager subunit is used to implement data processing within the Binder management unit, and the Binder proxy subunit is used to interact with the application.
[0117] This application scenario is only one applicable scenario for the aforementioned Binder management system, and this application does not limit the specific application scenario.
[0118] See Figure 6 This is a schematic diagram of the first type of Binder management process provided in the embodiments of this application, which may include the following steps: S601-S612.
[0119] S601: The first application sends the first Binder proxy object of the first application to the first Binder management unit.
[0120] Corresponding to Figure 1 In the application scenario shown, the first Binder proxy object is proxy1.
[0121] The first Binder proxy object mentioned above is created by the Client process in the user space of the client.
[0122] S602: The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object.
[0123] Corresponding to Figure 1 In the application scenario shown, the second Binder proxy object mentioned above is proxy1'.
[0124] Once the second Binder proxy object is created by the Client process in the user space of the client, the first Binder management unit can obtain the second Binder proxy object.
[0125] Specifically, the method by which the Client process creates the Binder proxy object is based on relevant technologies, which will not be elaborated upon in this embodiment.
[0126] The second Binder proxy object mentioned above is derived from the first Binder proxy object, and the two reference different Binder reference objects, corresponding to... Figure 1 In the application scenario shown, proxy1 references binder_ref1, and proxy1' references binder_ref1'. Both of these binder references refer to the same binder entity object, corresponding to... Figure 1 In the application scenario shown, binder_ref1 and binder_ref1' reference binder_node1.
[0127] The Binder entity object corresponds to the service provided by the first application mentioned above. In addition, the Binder entity object references the Binder local object, which is created by the Server process in the client user space.
[0128] S603: The first Binder management unit assigns a Binder identifier to the second Binder proxy object.
[0129] The aforementioned Binder identifier can be represented in the form of numbers, characters, strings, etc. It should be noted that multiple applications may be running on the client, and each application may send a Binder proxy object to the first Binder management unit. The first Binder management unit responds to different Binder proxy objects by obtaining different second Binder proxy objects and assigning different Binder identifiers to these different second Binder proxy objects.
[0130] In one embodiment of this application, the first Binder management unit may pre-record multiple different Binder identifiers. Whenever a Binder proxy object is acquired, a Binder identifier that has not been assigned to other Binder proxy objects is selected from the pre-recorded Binder identifiers and assigned to the second Binder proxy object.
[0131] In another embodiment of this application, the first Binder management unit may also generate a new Binder identifier that is different from the Binder identifiers of other Binder proxy objects after obtaining the second Binder proxy object, and assign the generated Binder identifier to the second Binder proxy object.
[0132] S604: The first Binder management unit sends the Binder identifier to the second Binder management unit.
[0133] S605: The second Binder management unit creates a third Binder proxy object after receiving the Binder identifier.
[0134] Upon receiving the aforementioned Binder identifier, the second Binder management unit determines that the client requires cross-platform interaction. It then creates a third Binder proxy object to perform inter-process communication within the server and complete the cross-platform interaction.
[0135] The aforementioned third Binder proxy object is generated by the second Binder management unit after receiving the second Binder proxy object. Both of them are used to realize cross-platform interaction. It can be assumed that there is a relationship between the third Binder proxy object and the second Binder proxy object.
[0136] Specifically, the method for constructing the aforementioned third Binder proxy object is based on relevant technologies, which will not be elaborated upon in this application embodiment.
[0137] S606: The second Binder management unit records the association between the third Binder proxy object and the Binder identifier.
[0138] In one embodiment of this application, the association between the third Binder proxy object and the Binder identifier can be recorded in a table. The table contains two columns: one column records the identifier of the third Binder proxy object constructed by the second Binder management unit, and the other column records the Binder identifier received by the second Binder management unit. There is an association between the third Binder proxy object and the Binder identifier located in the same row.
[0139] In another embodiment of this application, the association between the third Binder proxy object and the Binder identifier can also be recorded in other ways. For example, the Binder identifier with an association relationship and the identifier of the third Binder proxy object can be stored in the same storage space to indicate that there is an association relationship between the two.
[0140] Additionally, corresponding to the above text Figure 1 In the application scenario, the third Binder proxy object is proxy2 in the diagram.
[0141] S607: The second Binder management unit sends the third Binder proxy object to the second application.
[0142] S608: The second application above obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object above.
[0143] Specifically, the aforementioned fourth Binder proxy object can be created by the Client process on the server side. The method by which the Client process creates the Binder proxy object is based on relevant technologies, which will not be elaborated further in this embodiment.
[0144] The aforementioned third and fourth Binder proxy objects are both Binder proxy objects used on the server side to achieve cross-platform collaborative work. The fourth Binder proxy object is generated in response to the third Binder proxy object, and it can be considered that there is a relationship between the two.
[0145] Corresponding to the above text Figure 1 In the application scenario, the fourth Binder proxy object is proxy2' in the diagram.
[0146] The fourth Binder proxy object mentioned above is derived from the third Binder proxy object. Both reference different Binder reference objects, corresponding to... Figure 1 In the application scenario shown, proxy2 references binder_ref2, and proxy2' references binder_ref2'. Both of these binder references refer to the same binder entity object, corresponding to... Figure 1 In the application scenario shown, binder_ref2 and binder_ref2' reference binder_node2.
[0147] The Binder entity object corresponds to the collaboration service provided by the first service collaboration module mentioned above. In addition, the Binder entity object references the Binder local object, which is created by the Server process in the server user space.
[0148] S609: After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object.
[0149] Specifically, the aforementioned fourth Binder proxy object may be released automatically by the server's operating system. The second application may send information about the release of the fourth Binder proxy object to the second Binder management unit to notify the second Binder management unit that the aforementioned fourth Binder proxy object has been released.
[0150] Alternatively, the second Binder management unit can monitor the status of the fourth Binder proxy object to determine whether the fourth Binder proxy object has been released.
[0151] As mentioned above, the third Binder proxy object and the fourth Binder proxy object are related. After the fourth Binder proxy object is released, the third Binder proxy object associated with it no longer needs to be used, so the third Binder proxy object can be released accordingly.
[0152] S610: The second Binder management unit determines the Binder identifier corresponding to the third Binder proxy object based on the recorded association relationship.
[0153] Specifically, the association relationship related to the aforementioned third Binder proxy object can be found from the various association relationships recorded in the second Binder management unit. The Binder identifier recorded in this association relationship is the Binder identifier corresponding to the third Binder proxy object.
[0154] S611: The second Binder management unit sends a Binder release command carrying the Binder identifier to the first Binder management unit.
[0155] The third Binder proxy object is created by the server in response to the second Binder proxy object sent by the client. The third Binder proxy object is associated with the second Binder proxy object. Both are used to realize cross-terminal collaborative work between the client and the server. The release of the third Binder proxy object means the end of cross-terminal collaborative work. Therefore, the second Binder management unit can send a Binder release instruction to the first Binder management unit to instruct the release of the second Binder proxy object corresponding to the Binder identifier it carries.
[0156] S612: The first Binder management unit responds to the Binder release instruction by releasing the Binder proxy object indicated by the Binder identifier.
[0157] This application provides a Binder management system, which includes a client and a server. The client runs a first application and a first service collaboration module, while the server runs a second application and a second service collaboration module. The client and server can collaborate through the first and second service collaboration modules. During collaboration, the first application and the second service collaboration module on the client, and the second application and the second service collaboration module on the server, each have a corresponding Binder proxy object. These Binder proxy objects work together to complete the collaboration process. Therefore, after the fourth Binder proxy object corresponding to the second application is released, the collaboration stops, and the Binder proxy object corresponding to the aforementioned service collaboration module is no longer needed. Thus, the second Binder management unit can first release the third Binder proxy object, which is also on the server, and send a Binder release instruction to the first Binder management unit, instructing the first Binder management unit to release the second Binder proxy object whose Binder identifier is associated with the third Binder proxy object. As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0158] It should be noted that the embodiments of this application do not limit the release method of the first Binder proxy object of the first application. The first Binder proxy object can be released by the Binder proxy object release method provided by the operating system configured in the client in the related technology, or the first Binder proxy object can be released after the second Binder proxy object is released.
[0159] Furthermore, in related technologies, the second and third Binder proxy objects cannot be released, which further leads to the inability to release the Binder reference objects, Binder entity objects, and Binder local objects referenced by the second and third Binder proxy objects. However, the solution provided in this application embodiment can release both the second and third Binder proxy objects, thus allowing the release of each Binder object referenced by them. Specifically, the methods for the client to release the Binder objects referenced by the second and third Binder proxy objects and the methods for the server to release the Binder objects referenced by the third Binder proxy object can be found in related technologies, and this embodiment does not limit these methods.
[0160] See Figure 7 This is a schematic diagram of the second Binder management process provided in the embodiments of this application, which is consistent with the aforementioned Figure 6 Compared to the illustrated embodiment, the step S613 is also included.
[0161] S613: After the second Binder management unit sends the third Binder proxy object to a second application, it increments the counter value corresponding to the third Binder proxy object by 1.
[0162] Specifically, the aforementioned server may include multiple second applications that participate in cross-platform interaction. In this case, the second Binder management unit needs to send a third Binder proxy object to each of the multiple second applications. After receiving the third Binder proxy object, each second application obtains its own corresponding fourth Binder proxy object.
[0163] Furthermore, the aforementioned second Binder management unit creates a counter for the third Binder proxy object to record the number of third Binder proxy objects sent by the second Binder management unit to the second application. Each time a third Binder proxy object is sent, a second application obtains a fourth Binder proxy object associated with the third Binder proxy object. In other words, the aforementioned counter value can identify the number of fourth Binder proxy objects currently associated with the third Binder proxy object.
[0164] In addition, the above step S609 can be achieved through the following steps S609A-S609B.
[0165] S609A: After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1.
[0166] As described above, the count value corresponding to the third Binder proxy object can identify the number of fourth Binder proxy objects associated with the third Binder proxy object. Therefore, after each fourth Binder proxy object of the second application is released, the count value currently corresponding to the third Binder proxy object needs to be changed accordingly, that is, reduced by 1 based on the current count value.
[0167] S609B: After determining that the count value corresponding to the third Binder proxy object has dropped to 0, the second Binder management unit releases the third Binder proxy object.
[0168] Specifically, a count value of 0 indicates that all fourth Binder proxy objects originally associated with the third Binder proxy object have been released, and the third Binder proxy object can be released in this case.
[0169] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. The third Binder proxy object is only released after the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released. This can prevent the third Binder proxy object from being released prematurely and affecting the normal execution of cross-end interaction.
[0170] To illustrate the differences between the solutions provided in this application and related technologies, please refer to... Figure 8 This is a schematic diagram of an application scenario in related technologies.
[0171] This application scenario does not involve cross-platform interaction. In the diagram, Application 1, Application 2, and the Binder driver reside on the same electronic device. Application 1 transmits proxy1 to Application 2, and Application 2 retrieves proxy1'. Proxy1 references binder_ref1, and proxy1' references binder_ref1'. Both binder_ref1 and binder_ref1' reference binder_node1. The operating system configured on the electronic device is capable of automatically releasing proxy1 from Application 1 and proxy2 from Application 2.
[0172] Since the relevant technology itself does not involve cross-platform interaction, there is no service collaboration module, and therefore no Binder proxy object for the service collaboration module. Consequently, the operating system configured in the electronic device cannot release the Binder proxy object for the service collaboration module. However, the embodiments of this application are adapted to cross-platform interaction application scenarios and can release the Binder proxy object for the service collaboration module.
[0173] Corresponding to the aforementioned Binder management system, this application also provides a Binder management method applied to a client.
[0174] See Figure 9 This is a flowchart illustrating a Binder management method applied to a client according to an embodiment of this application. The client runs a first application and a first service collaboration module, which includes a first Binder management unit. The method includes the following steps S901-S905.
[0175] S901: The first application sends the first Binder proxy object of the first application to the first Binder management unit.
[0176] S902: The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object, and assigns a Binder identifier to the second Binder proxy object.
[0177] S903: The first Binder management unit sends the Binder identifier to the second Binder management unit on the server, so that the second Binder management unit creates a third Binder proxy object, records the association between the third Binder proxy object and the Binder identifier, and sends the third Binder proxy object to the second application, so that the second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object.
[0178] The aforementioned server runs the aforementioned second application and second service collaboration module, the aforementioned second Binder management unit is included in the aforementioned second service collaboration module, and the aforementioned client and the aforementioned server work together through the aforementioned first service collaboration module and the aforementioned second service collaboration module.
[0179] S904: Receive the Binder release instruction sent by the second Binder management unit. The Binder release instruction is sent by the second Binder management unit after determining that the fourth Binder proxy object has been released and releasing the third Binder proxy object.
[0180] The aforementioned Binder release command carries the Binder identifier corresponding to the aforementioned third Binder proxy object.
[0181] S905: The first Binder management unit responds to the Binder release command by releasing the Binder proxy object indicated by the Binder identifier.
[0182] This application provides a Binder management system, which includes a client and a server. The client runs a first application and a first service collaboration module, while the server runs a second application and a second service collaboration module. The client and server can collaborate through the first and second service collaboration modules. During collaboration, the first application and the second service collaboration module on the client, and the second application and the second service collaboration module on the server, each have a corresponding Binder proxy object. These Binder proxy objects work together to complete the collaboration process. Therefore, after the fourth Binder proxy object corresponding to the second application is released, the collaboration stops, and the Binder proxy object corresponding to the aforementioned service collaboration module is no longer needed. Thus, the second Binder management unit can first release the third Binder proxy object, which is also on the server, and send a Binder release instruction to the first Binder management unit, instructing the first Binder management unit to release the second Binder proxy object whose Binder identifier is associated with the third Binder proxy object. As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0183] In one embodiment of this application, the Binder release instruction is sent by the second Binder management unit after releasing the third Binder proxy object when the count value corresponding to the third Binder proxy object drops to 0;
[0184] The count value corresponding to the third Binder proxy object is updated by the second Binder management unit in the following manner: after the second Binder management unit sends the third Binder proxy object to a second application, it increments the count value corresponding to the third Binder proxy object by 1; after the second Binder management unit determines that the fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1.
[0185] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. Only when the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released, will the third Binder proxy object be released and a Binder release instruction be sent to the first Binder management unit. This can prevent the second and third Binder proxy objects from being released prematurely and affecting the normal execution of cross-terminal interaction.
[0186] Corresponding to the aforementioned Binder management system, this application also provides a Binder management method applied to the server side.
[0187] See Figure 10 This is a flowchart illustrating a Binder management method applied to a server, provided in an embodiment of this application. A second application and a second service collaboration module run on the server. The second service collaboration module includes a second Binder management unit. The method includes the following steps S1001-S1005.
[0188] S1001: The second Binder management unit receives the Binder identifier sent by the first Binder management unit in the client.
[0189] The client runs a first application in the first service collaboration module, which includes the first Binder management unit. The Binder identifier is assigned by the first Binder management unit to the second Binder proxy object. The second Binder proxy object is obtained by the first Binder management unit after receiving the first Binder proxy object sent by the first application, and it references the same Binder entity object as the first Binder proxy object.
[0190] S1002: After receiving the Binder identifier, the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier.
[0191] S1003: The second Binder management unit sends the third Binder proxy object to the second application.
[0192] S1004: The second application above obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object above.
[0193] S1005: After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, determines the Binder identifier corresponding to the third Binder proxy object according to the recorded association relationship, and sends a Binder release instruction carrying the Binder identifier to the first Binder management unit, so that the first Binder management unit responds to the Binder release instruction and releases the Binder proxy object indicated by the Binder identifier.
[0194] This application provides a Binder management system, which includes a client and a server. The client runs a first application and a first service collaboration module, while the server runs a second application and a second service collaboration module. The client and server can collaborate through the first and second service collaboration modules. During collaboration, the first application and the second service collaboration module on the client, and the second application and the second service collaboration module on the server, each have a corresponding Binder proxy object. These Binder proxy objects work together to complete the collaboration process. Therefore, after the fourth Binder proxy object corresponding to the second application is released, the collaboration stops, and the Binder proxy object corresponding to the aforementioned service collaboration module is no longer needed. Thus, the second Binder management unit can first release the third Binder proxy object, which is also on the server, and send a Binder release instruction to the first Binder management unit, instructing the first Binder management unit to release the second Binder proxy object whose Binder identifier is associated with the third Binder proxy object. As can be seen from the above, after the fourth Binder proxy object of the second application in the server is released in the solution provided by the embodiments of this application, the second Binder management unit can not only release the third Binder proxy object in the server, but also release the second Binder proxy object in another electronic device, namely the client, thereby realizing the release of the Binder of the service collaboration module.
[0195] In one embodiment of this application, the method further includes:
[0196] Step A: After the second Binder management unit sends the third Binder proxy object to a second application, it increments the counter value corresponding to the third Binder proxy object by 1.
[0197] Furthermore, after the second Binder management unit determines that the fourth Binder proxy object has been released through steps B-C, it releases the third Binder proxy object.
[0198] Step B: After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1.
[0199] Step C: After determining that the count value corresponding to the third Binder proxy object has dropped to 0, the second Binder management unit releases the third Binder proxy object.
[0200] As can be seen from the above, the solution provided in this application uses a counter value to count the number of fourth Binder proxy objects associated with the third Binder proxy object. The third Binder proxy object is only released after the counter value corresponding to the third Binder proxy object drops to 0, that is, after all the fourth Binder proxy objects associated with the third Binder proxy object have been released. This can prevent the third Binder proxy object from being released prematurely and affecting the normal execution of cross-end interaction.
[0201] In a specific implementation, this application also provides a computer storage medium, wherein the computer storage medium may store a program, wherein when the program runs, it controls the device where the computer-readable storage medium is located to execute some or all of the steps in the above embodiments. The storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0202] In a specific implementation, this application also provides a computer program product, which includes executable instructions that, when executed on a computer, cause the computer to perform some or all of the steps in the above method embodiments.
[0203] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0204] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.
[0205] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0206] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or via other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact disc read-only memory (CD-ROMs), magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0207] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0208] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0209] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0210] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.
Claims
1. A Binder management system, characterized in that, The system includes a client and a server. The client runs a first application and a first service collaboration module, and the server runs a second application and a second service collaboration module. The client and the server work together through the first service collaboration module and the second service collaboration module. The first service collaboration module includes a first Binder management unit, and the second service collaboration module includes a second Binder management unit. The first application sends its first Binder proxy object to the first Binder management unit; The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object, and assigns a Binder identifier to the second Binder proxy object; The first Binder management unit sends the Binder identifier to the second Binder management unit; After receiving the Binder identifier, the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier; The second Binder management unit sends the third Binder proxy object to the second application; The second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object; After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, determines the Binder identifier corresponding to the third Binder proxy object according to the recorded association relationship, and sends a Binder release command carrying the Binder identifier to the first Binder management unit. In response to the Binder release command, the first Binder management unit releases the Binder proxy object indicated by the Binder identifier.
2. The system according to claim 1, characterized in that, The second Binder management unit is also used for: After each third Binder proxy object is sent to a second application, the count value corresponding to the third Binder proxy object is incremented by 1; After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, including: After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1; after determining that the count value corresponding to the third Binder proxy object has dropped to 0, it releases the third Binder proxy object.
3. A Binder management method, characterized in that, Applied to a client, wherein a first application and a first service collaboration module run in the client, the first service collaboration module includes a first Binder management unit, and the method includes: The first application sends its first Binder proxy object to the first Binder management unit; The first Binder management unit obtains a second Binder proxy object that references the same Binder entity object as the first Binder proxy object, and assigns a Binder identifier to the second Binder proxy object; The first Binder management unit sends the Binder identifier to the second Binder management unit on the server side, so that the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier. The first Binder management unit also sends the third Binder proxy object to the second application, so that the second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object. The second application and the second service collaboration module run on the server side. The second Binder management unit is included in the second service collaboration module. The client and the server side work together through the first service collaboration module and the second service collaboration module. The system receives a Binder release instruction sent by the second Binder management unit. The Binder release instruction is sent by the second Binder management unit after determining that the fourth Binder proxy object has been released and releasing the third Binder proxy object. The Binder release instruction carries the Binder identifier corresponding to the third Binder proxy object. In response to the Binder release command, the first Binder management unit releases the Binder proxy object indicated by the Binder identifier.
4. The method according to claim 3, characterized in that, The Binder release command is sent by the second Binder management unit after releasing the third Binder proxy object when the counter value corresponding to the third Binder proxy object drops to 0; The count value corresponding to the third Binder proxy object is updated by the second Binder management unit in the following manner: after the second Binder management unit sends the third Binder proxy object to a second application, it increments the count value corresponding to the third Binder proxy object by 1; after the second Binder management unit determines that the fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1.
5. A Binder management method, characterized in that, Applied to the server side, the server side runs a second application and a second service collaboration module, the second service collaboration module includes a second Binder management unit, and the method includes: The second Binder management unit receives a Binder identifier sent by the first Binder management unit in the client. The client runs a first application in a first service collaboration module. The first service collaboration module includes the first Binder management unit. The Binder identifier is assigned by the first Binder management unit to a second Binder proxy object. The second Binder proxy object is obtained by the first Binder management unit after receiving the first Binder proxy object sent by the first application, and it references the same Binder entity object as the first Binder proxy object. After receiving the Binder identifier, the second Binder management unit creates a third Binder proxy object and records the association between the third Binder proxy object and the Binder identifier; The second Binder management unit sends the third Binder proxy object to the second application; The second application obtains a fourth Binder proxy object that references the same Binder entity object as the third Binder proxy object; After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object and determines the Binder identifier corresponding to the third Binder proxy object according to the recorded association relationship. It then sends a Binder release instruction carrying the Binder identifier to the first Binder management unit, so that the first Binder management unit responds to the Binder release instruction and releases the Binder proxy object indicated by the Binder identifier.
6. The method according to claim 5, characterized in that, The method further includes: Each time the second Binder management unit sends the third Binder proxy object to a second application, it increments the counter value corresponding to the third Binder proxy object by 1. After the second Binder management unit determines that the fourth Binder proxy object has been released, it releases the third Binder proxy object, including: After the second Binder management unit determines that a fourth Binder proxy object of a second application has been released, it decrements the count value corresponding to the third Binder proxy object by 1; after determining that the count value corresponding to the third Binder proxy object has dropped to 0, it releases the third Binder proxy object.
7. A client application, characterized in that, It includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the processor is triggered to execute the method of any one of claims 3-4.
8. A server-side component, characterized in that, It includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the processor is triggered to execute the method of any one of claims 5-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 3-4.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 5-6.