Cross-device service invocation method and electronic device
By obtaining the distributed context and bound services of the device in the distributed application framework, and using the IBinder object to implement cross-device service calls, the problem of cumbersome cross-device operations is solved, and the calling efficiency and convenience are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2026-03-20
AI Technical Summary
In existing technologies, cross-device operations are cumbersome, requiring switching back and forth between different electronic devices to make service calls. For example, selecting a photo from a mobile phone and uploading it to a tablet for processing is a complex and redundant operation.
By obtaining the distributed context of the device and binding the target service in the distributed application framework, cross-device service calls can be implemented using the IBinder object. This simplifies the communication and binding process to be completed within the distributed application framework, avoiding the design of redundant communication modules.
It simplifies and improves the efficiency of cross-device service calls, reduces operational steps, enhances call efficiency and convenience, and avoids redundant communication module design.
Smart Images

Figure CN119232765B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of electronic devices, and in particular to a cross-device service calling method and an electronic device. BACKGROUND
[0002] Currently, different types of electronic devices have different functions, and a user can hold different types of electronic devices and use more convenient electronic devices according to different scenarios. For example, a mobile phone is convenient to carry and has high pixels, and the mobile phone is usually used to take photos. A tablet has a larger screen than a mobile phone, and it is more convenient to process photos on the tablet. Therefore, the tablet needs to first obtain the taken photos from the mobile phone.
[0003] In the prior art, the user needs to select the required photos from the mobile phone for uploading, and then receives the photos in the tablet and processes them. However, in this method, the user needs to switch between the two devices, which is relatively cumbersome. SUMMARY
[0004] Embodiments of the present application provide a cross-device service calling method and an electronic device, which can realize cross-device calling of services.
[0005] To achieve the above object, embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a cross-device service calling method is provided, applied to a first electronic device, and the method includes: the first electronic device displays a display interface of a first application, and the display interface of the first application includes a calling control; the calling control corresponds to a plurality of devices that have established a wireless connection with the first electronic device; the first electronic device acquires a distributed context of a second electronic device in response to receiving a calling operation of the calling control by a user; the calling operation corresponds to a target service of the second electronic device in the plurality of devices, and the distributed context is used to indicate information required for the device to implement communication; the first electronic device sends a binding request for the target service to the second electronic device based on the distributed context; the first electronic device receives an IBinder object from the second electronic device and sends a calling request to the second electronic device based on the IBinder object; the IBinder object is created by the second electronic device in response to the binding request based on the target service, the IBinder object is used to call the target service, and the calling request is used to request the second electronic device to call the target service; and the first electronic device receives a calling result of the target service returned by the second electronic device. The distributed context of the device can include a device identifier, a device name, a communication connection to be used for communication with the device, and a logical set of software processing such as a connection response.
[0007] In the solution, the first electronic device can unbind the target service of the second electronic device through the acquired distributed context of the second electronic device, and then can directly request to call the target service of the second electronic device. For the first electronic device, since the acquisition of the distributed context and the binding of the service are both completed in the distributed application framework, the first electronic device only needs to call the interface of the distributed application framework to realize the cross-device call.
[0008] The calling control corresponds to a plurality of devices that have established a wireless connection with the first electronic device, that is, the first electronic device can determine a device list that has established a connection with the first electronic device in response to the operation of the calling control. The calling operation corresponds to the target service of the second electronic device in the plurality of devices, that is, the first electronic device can select the second electronic device and the target service from the device list in response to different calling operations of the calling control by the user.
[0009] In a possible implementation manner of the first aspect, the first electronic device sends a binding request for the target service to the second electronic device based on the distributed context, including that the first electronic device calls the interface of the distributed context to send the binding request for the target service to the second electronic device; and the binding request includes the identification information of the target service. The first electronic device only needs to call the interface of the distributed application framework to acquire the distributed context and call the interface of the distributed context to bind the service, so as to realize the cross-device call. For the calling application of the electronic device, a simple interface can be called to realize the cross-device call.
[0010] In another possible implementation manner of the first aspect, the calling operation can be used to search data on the second electronic device; the target service is a search service; and the calling result of the target service includes a search result of the data. Specifically, the first electronic device acquires the distributed context of the second electronic device in response to receiving the calling operation of the calling control by the user; the calling operation corresponds to the search service of the second electronic device. The first electronic device sends a binding request for the search service to the second electronic device based on the distributed context, and the second electronic device returns an IBinder object corresponding to the search service to the first electronic device based on the IBinder object created by the search service after receiving the binding request. The first electronic device sends a calling request to the second electronic device based on the IBinder object, and requests the second electronic device to call the search service. The first electronic device receives the search result of the search service returned by the second electronic device.
[0011] In another possible implementation manner of the first aspect, the data can include at least one of the following data: a picture, a file, a video, and an audio.
[0012] In a possible implementation form of the first aspect, the first electronic device obtains the distributed context of the second electronic device in response to receiving the user's invocation operation on the invocation control, including: the first electronic device sends an obtaining request for the distributed context of the second electronic device to the second electronic device in response to receiving the user's invocation operation on the invocation control; and the first electronic device receives the distributed context from the second electronic device.
[0013] In a possible implementation form of the first aspect, before the first electronic device obtains the distributed context of the second electronic device in response to receiving the user's invocation operation on the invocation control, the method further includes: when the first electronic device establishes a wireless connection with the second electronic device, the first electronic device obtains the distributed context of the second electronic device and stores the distributed context into cache information of the first electronic device.
[0014] In a possible implementation form of the first aspect, the first electronic device obtains the distributed context of the second electronic device in response to receiving the user's invocation operation on the invocation control, including: the first electronic device obtains the distributed context of the second electronic device from the cache information in response to receiving the user's invocation operation on the invocation control. By obtaining the distributed context of the second electronic device in advance and storing the distributed context into the cache before invocation, the distributed context can be obtained directly from the cache during invocation, without the need to obtain the distributed context across devices, thereby improving invocation efficiency.
[0015] In a possible implementation form of the first aspect, the first electronic device receives the IBinder object from the second electronic device and sends an invocation request to the second electronic device based on the IBinder object, including: the first electronic device obtains invocation indication information of the invocation operation, wherein the invocation indication information is determined according to the user's input operation on the display interface of the first application; and the first electronic device receives the IBinder object from the second electronic device and sends an invocation request to the second electronic device based on the IBinder object, the invocation request including the invocation indication information. The invocation indication information can be included in the invocation request, so that the remote invocation can be performed according to the user's demand. Here, the invocation indication information can be, for example, a search keyword in a cross-device search request, so that the second electronic device searches for the corresponding picture according to the search keyword in the search request during the search operation, that is, the picture corresponding to the search keyword is displayed in the first electronic device.
[0016] In a possible implementation manner of the first aspect, the first electronic device obtains the distributed context of the second electronic device from the cache information in response to receiving the invocation operation of the user on the invocation control, and the obtaining the distributed context of the second electronic device from the cache information comprises: the first application sends a first request to the distributed application framework layer of the first electronic device in response to receiving the invocation operation of the user on the invocation control; the first request comprises the identification information of the second electronic device, and the first request is used to request to obtain the distributed context of the second electronic device; the distributed application framework layer invokes the distributed application service layer to obtain the distributed context from the cache information in response to the first request; and the distributed application framework layer returns the distributed context to the first application.
[0017] In a possible implementation manner of the first aspect, the first electronic device invokes the interface of the distributed context, and sends a binding request for the target service to the second electronic device, and the sending the binding request for the target service to the second electronic device comprises: the first application creates a service connection module, the service connection module is used to receive the service binding result from the second electronic device and return the service binding result to the first application; the first application invokes the interface of the distributed context, creates a distributed service connection module, and sends the binding request to the second electronic device; and the distributed service connection module is used to receive the service binding result from the second electronic device and return the service binding result to the service connection module.
[0018] In a possible implementation manner of the first aspect, the first electronic device receives the IBinder object from the second electronic device, and sends an invocation request to the second electronic device based on the IBinder object, and the sending the invocation request to the second electronic device based on the IBinder object comprises: the distributed service connection module receives the IBinder object from the second electronic device, and returns the IBinder object to the service connection module; the service connection module receives the IBinder object, and returns the IBinder object to the first application; and the first application receives the IBinder object, and sends the invocation request to the second electronic device based on the IBinder object.
[0019] In a possible implementation manner of the first aspect, the first electronic device receives the IBinder object from the second electronic device, and sends an invocation request to the second electronic device based on the IBinder object, and the sending the invocation request to the second electronic device based on the IBinder object comprises: the distributed service connection module receives the IBinder object from the second electronic device, and returns the IBinder object to the service connection module; the service connection module receives the IBinder object, and returns the IBinder object to the first application; and the first application receives the IBinder object, and sends the invocation request to the second electronic device based on the IBinder object.
[0020] In the solution, after the second electronic device creates the IBinder object of the target service according to the received binding request and returns to the first electronic device, the first electronic device successfully binds the target service of the second electronic device. Thus, the second electronic device can directly respond to the calling request of the first electronic device to call the target service. Since the acquisition of the distributed context and the binding of the service are both completed in the distributed application framework, the first electronic device only needs to call the interface of the distributed application framework to complete the acquisition of the distributed context and the binding, and can realize the cross-device calling.
[0021] In a possible implementation of the second aspect, before the second electronic device receives the binding request from the first electronic device, the method further includes: in response to receiving the acquisition request of the distributed context from the first electronic device, the second electronic device acquires the distributed context of the second electronic device; wherein the distributed context is used to indicate the information required by the device to implement communication; and the second electronic device returns the distributed context to the first electronic device.
[0022] In another possible implementation of the second aspect, the second electronic device creates the IBinder object of the target service in response to the binding request and returns the IBinder object to the first electronic device, including: in response to the binding request, the second electronic device starts the process of the target application corresponding to the target service, and starts the target service component corresponding to the target application; the second electronic device creates the IBinder object of the target service based on the target service component, and returns the IBinder object to the first electronic device.
[0023] In another possible implementation of the second aspect, the calling request includes calling indication information, the second electronic device calls the target service based on the calling request and returns the calling result of calling the target service to the first electronic device, including: the second electronic device calls the target service based on the calling indication information, and obtains the calling result corresponding to the calling indication information; and the second electronic device returns the calling result corresponding to the calling indication information to the first electronic device. The second electronic device performs remote calling according to the calling indication information included in the calling request, that is, can perform remote calling according to user demand. Here, the calling indication information can be, for example, the search keyword in the cross-device search request, so that the second electronic device searches for the corresponding picture according to the search keyword in the search request when performing the search operation, and returns the picture corresponding to the search keyword to the first electronic device.
[0024] In a possible implementation form of the second aspect, the second electronic device receiving the binding request from the first electronic device comprises: the distributed application framework layer of the second electronic device receiving the binding request from the first electronic device, and creating a service connection module, the service connection module being configured to receive a service binding result and return the service binding result to the first electronic device.
[0025] In a possible implementation form of the second aspect, the second electronic device creating the IBinder object of the target service in response to the binding request and returning the IBinder object to the first electronic device comprises: the distributed application framework layer sending the binding request to an activity management module of the second electronic device; the activity management module sending a start request to a target application in response to receiving the binding request, the start request being configured to start a process of the target application; the target application starting the process of the target application and starting a target service component corresponding to the target application; the target application creating the IBinder object of the target service based on the target service component and returning the IBinder object to the service connection module; and the service connection module receiving the IBinder object returned by the target application and returning the IBinder object to the first electronic device.
[0026] In a third aspect, the present application provides an electronic device, comprising: a communication module, a display screen, a memory and one or more processors; the communication module, the display screen, the memory and the processor are coupled; the memory is configured to store computer program code, the computer program code comprising computer instructions, when the computer instructions are executed by the electronic device, causing the electronic device to perform the method of the first aspect to the second aspect.
[0027] In a fourth aspect, the present application provides a computer readable storage medium, the computer readable storage medium storing instructions, when the instructions are run on a computer, causing the computer to perform the method of any one of the first aspect to the second aspect.
[0028] In a fifth aspect, the present application provides a computer program product comprising instructions, when the instructions are run on a computer, causing the computer to perform the method of any one of the first aspect to the second aspect.
[0029] In a sixth aspect, the present application provides a chip, the chip comprising a processor, the processor being configured to invoke a computer program in a memory to perform the method of the first aspect or the second aspect.
[0030] It can be understood that the electronic device provided in the third aspect, the computer readable storage medium provided in the fourth aspect, the computer program product provided in the fifth aspect, and the chip provided in the sixth aspect are all used to execute the corresponding method provided above, and thus the beneficial effects achieved thereby can refer to the beneficial effects of the corresponding method provided above, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 A scenario diagram of a cross-device service call provided by an embodiment of the present application;
[0032] Figure 2 A framework diagram of an existing cross-device search method provided by an embodiment of the present application;
[0033] Figure 3 A hardware structure diagram of an electronic device provided by an embodiment of the present application;
[0034] Figure 4 A software structure diagram of an electronic device provided by an embodiment of the present application;
[0035] Figure 5 A whole architecture diagram of a cross-device service call provided by an embodiment of the present application;
[0036] Figure 6 An interface diagram of a cross-device search method provided by an embodiment of the present application;
[0037] Figure 7 Another interface diagram of a cross-device search method provided by an embodiment of the present application;
[0038] Figure 8 A structure diagram of a system framework of a cross-device service call provided by an embodiment of the present application;
[0039] Figure 9 A flow timing diagram of a cross-device service call provided by an embodiment of the present application;
[0040] Figure 10 A whole flow diagram of a cross-device search method provided by an embodiment of the present application;
[0041] Figure 11 A chip structure diagram provided by an embodiment of the present application. DETAILED DESCRIPTION
[0042] In the description of the application, the term "a plurality" means two or more unless otherwise specified. The character " / " in the application generally indicates that the antecedent and the following object are in a "or" relationship. For example, A / B can be understood as A or B.
[0043] In this specification, the reference to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, although it can. Furthermore, the terms "comprises", "comprising", "includes", "including", and the like in the description and in claims are open-ended transition terms that are intended to mean including, but not limited to. One skilled in the art will recognize that processes, methods, systems, products, or apparatuses that include, but are not limited to, certain steps or units are thereby
[0044] In addition, in the embodiments of the application, the words "exemplary" and "for example" are used on the basis and in the sense of assistance in understanding the application. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the application should not be interpreted as being more preferred or having more advantages than other embodiments or design schemes. Rather, the use of the words "exemplary" and "for example" is intended to present relevant concepts in a specific manner.
[0045] For ease of understanding, the terms related to the embodiments of the application are introduced here:
[0046] (1) Binder: From the application layer of the system, Binder is the medium for the client and the server to communicate, in which the server returns a Binder object for the server business call, through which the client can obtain the services or data provided by the server. Among them, the Binder mechanism supports intra-process call and inter-process call. The remote call (i.e. cross-process call) of the system can be implemented through IBinder.
[0047] Among them, Binder stub: passively receives binder data (similar to the server obtaining data). Binder proxy: actively accesses binder and writes data into binder driver (similar to the client requesting data).
[0048] (2) bindService (bind service): bindService is used to bind a service, which can communicate with other components.
[0049] (3) Service Connection (service connection): application components (clients) can bind to a service by calling bindService(). Then, the system can call the onBind() method of the service, which returns IBinder used to interact with the service.
[0050] Among them, the binding is asynchronous, and bindService() can return immediately without returning IBinder to the client. If you want to receive IBinder, the client must create a Service Connection instance and pass it to bindService(). Service Connection contains a callback method, which is called by the system to pass the IBinder to be returned.
[0051] Receive information when the service starts and stops, which must be a valid Service Connection and cannot be empty. The connection between the client and the server is established through the Service Connection instance object.
[0052] Currently, with users owning various electronic devices, they choose the most convenient one depending on the scenario. For example, mobile phones are portable and have high resolution, typically used for taking photos. Tablets, with their larger screens, offer more convenient photo editing capabilities. Therefore, the tablet first needs to retrieve the photos from the phone. Existing methods require selecting and uploading the desired photos from the phone, then receiving and processing them on the tablet. However, this method involves switching back and forth between the two devices, making the process cumbersome.
[0053] Therefore, there may be scenarios where cross-device capabilities are needed to manage photos, files, etc., across different devices. For example, searching directly from a tablet for a specific image linked to a phone. Or, a phone can search for photos stored on a tablet. Figure 1 As shown, the mobile device searches for photos in the tablet's album within the phone's photo album. The phone's photo album display interface has a search entry point. By entering search keywords in the search entry point, the corresponding photos in the tablet's album are found.
[0054] In traditional solutions, implementing the aforementioned cross-device search service requires custom development for the applications on both devices, essentially combining multiple functional modules. For example, custom development is needed for both the phone and tablet applications. Taking searching photos from a tablet application using a phone application as an example... Figure 2 As shown, the mobile phone side includes a remote search request module, a session management module, and a data transmission module, while the tablet side includes a remote search response module, a session management module, and a data transmission module. The mobile phone side's session management module includes submodules for connection establishment, reconnection mechanism, disconnection management, timeout management, and multi-device session management. The mobile phone side's data transmission module includes submodules for data serialization, data deserialization, data fragmentation, and concurrent transmission management. The tablet side's session management module includes submodules for connection establishment, reconnection mechanism, disconnection management, timeout management, multi-device session management, and callback listening. The tablet side's data transmission module includes submodules for data serialization, data deserialization, fragmented reception / transmission, concurrent reception management, and data-search call conversion. To implement the session management and data transmission modules, supporting modules are also needed on the tablet side, such as security control modules, including an access security management submodule. The tablet side also includes a response registration module, comprising a process response launch submodule and a search module launch submodule. The core cross-platform search function refers to the remote search request module on the mobile phone side and the remote search response module on the tablet side. The communication functions for many non-core search services refer to the data transmission modules on both the mobile phone and tablet sides.
[0055] The bottom layer of the phone side and the tablet side is a communication module, and the session management module is based on the communication module to perform the service function. After the session is established, the phone can search for photos, files, etc. on the tablet side. Specifically, the service data of the phone side, such as a search request, is transmitted to the tablet side after being processed by the data transmission module, such as data serialization. The tablet side obtains the search request by performing reverse operations, such as data deserialization by the data transmission module. Then, the tablet side sends the received search request to the module that actually performs the search, that is, the remote search response module. After obtaining the search results, such as photos, from the remote search response module, the tablet side returns the search results to the phone side. Similarly, the tablet side needs to perform data serialization on the search results and send them to the phone side. The phone side obtains the search results by performing deserialization.
[0056] In the above scheme, each application needs to access the communication capability, causing repeated access. Each application needs to complete repeated design of session establishment, data transmission, device listening, serialization, etc. for cross-end communication, causing functional redundancy. The transmission between applications is in the form of data files, and can only interact based on messages, and cannot be controlled in real time. Any application access needs to be customized, that is, the source application and the sink application need to communicate and negotiate the private protocol of the data to be transmitted, and cannot be quickly replicated and incubated. In addition, the sink application needs to be kept running to respond, otherwise the application cannot be awakened and pulled, causing application pull constraints.
[0057] Therefore, the embodiment of the present application provides a cross-device service calling method, which can bind services by calling a distributed application framework interface to realize cross-device calling. Compared with the related scheme, the search service only needs to call the distributed application framework to realize cross-device calling, and does not need to design a communication module, that is, a large number of non-search related functions in the related scheme are completed in the distributed application framework. In addition, the interface of the distributed application framework can enable the application to interact in the remote procedure call (RPC) mode. In addition, there is no need to customize and develop each application of the remote search service on the calling side and each application accessed by the called side, and each corresponding application can be directly searched and called through the distributed application framework.
[0058] Exemplarily, the electronic device in the embodiments of the present application can be a tablet computer, a mobile phone, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, a vehicle-mounted device, and the like. The embodiments of the present application do not specially limit the specific form of the electronic device.
[0059] In the embodiments of the present application, the electronic device can be divided into a private device and a public device. It can be understood that the private device is used to indicate a device that can be used only by the owner (i.e., the owner of the device). For example, the private device can be a mobile phone, a smart watch, smart glasses, a headset, and the like. The public device is used to indicate a device that can be used by any user. That is, there can be multiple accounts logged in the public device, and there is an association between the multiple different accounts. For example, the public device can be a television, a sound box, a tablet computer, and the like.
[0060] The execution subject of the cross-device service calling method provided in the embodiments of the present application can be a device for calling a service across devices. For example, the execution device can be the electronic device shown in Figure 3 . Alternatively, the execution device can also be a central processing unit (CPU) of the electronic device, or a control module for calling a service across devices in the electronic device. In the embodiments of the present application, the electronic device executes the cross-device service calling method as an example to illustrate the cross-device service calling method provided in the embodiments of the present application.
[0061] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings. The above electronic device is taken as a mobile phone as an example to introduce the hardware structure of the electronic device (such as the electronic device 300). Among them, Figure 3 The electronic device 300 shown in the drawings is only an example of the electronic device, and the electronic device 300 can have more or fewer components than those shown in the drawings, can combine two or more components, or can have a different component configuration. Figure 3 The various components shown in the drawings can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0062] Please refer to Figure 3 , Figure 3 The structure of the electronic device is shown in the schematic diagram, such as Figure 3As shown, the electronic device 300 can include a processor 310, an external memory interface 320, an internal memory 321, a USB interface 330, a charge management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone, a headset jack, a sensor module 380, a key 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a subscriber identification module (SIM) card interface 395, etc.
[0063] The sensor module 380 can include a pressure sensor, a gyro sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, and a bone conduction sensor, etc.
[0064] It can be understood that the structure shown in the embodiment does not constitute a specific limitation on the electronic device 300. In other embodiments, the electronic device 300 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0065] The processor 310 can include one or more processing units, for example: the processor 310 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.
[0066] The controller can be the nerve center and command center of the electronic device 300. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0067] The processor 310 can also have internal memory that is used to store instructions and data. In some embodiments, the internal memory of the processor 310 is a cache memory. Such a memory can hold instructions or data that the processor 310 has recently accessed, or is likely to access again. If the processor 310 needs to re-use the instructions or data, it can call upon them directly from the memory, avoiding repeated access. This reduces the latency of the processor 310 and improves the efficiency of the system.
[0068] In some embodiments, the processor 310 can include one or more interfaces. The interfaces can 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), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0069] It can be understood that the interface connection relationship between the modules shown in the embodiments is only illustrative and does not limit the structure of the electronic device 300. In other embodiments, the electronic device 300 can also use different interface connection modes or a combination of multiple interface connection modes.
[0070] The charging management module 340 is configured to receive a charging input from a charger. In the embodiments of the present application, the charger is a wired charger, and the charging management module 340 can receive the charging input of the wired charger through the USB interface 330 (i.e., the charging interface described above). The charging management module 340 can charge the battery 342 and also supply power to the electronic device through the power management module 341.
[0071] The power management module 341 connects the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340, providing power to the processor 310, internal memory 321, external memory, display screen 394, camera 393, and wireless communication module 360. The power management module 341 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 341 may also be located within the processor 310. In other embodiments, the power management module 341 and the charging management module 340 may be housed in the same device.
[0072] The wireless communication function of electronic device 300 can be realized through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor and baseband processor, etc.
[0073] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 300 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed 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.
[0074] The mobile communication module 350 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 300. The mobile communication module 350 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation.
[0075] The mobile communication module 350 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 350 can be housed in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 and at least some modules of the processor 310 can be housed in the same device.
[0076] The wireless communication module 360 can provide a solution for wireless communication, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. For example, in the embodiments of the present application, the electronic device 300 can access a Wi-Fi network through the wireless communication module 360.
[0077] The wireless communication module 360 can be one or more devices that integrate at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 310. The wireless communication module 360 can also receive signals to be sent from the processor 310, perform frequency modulation, amplify, and convert them into electromagnetic wave radiation via the antenna 2.
[0078] In some embodiments, the antenna 1 and the mobile communication module 350 of the electronic device 300 are coupled, and the antenna 2 and the wireless communication module 360 are coupled, so that the electronic device 300 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can 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 code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidu navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite based augmentation systems (SBAS).
[0079] The electronic device 300 implements a display function through a GPU, a display screen 394, and an application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 can include one or more GPUs, which execute program instructions to generate or change display information.
[0080] The display screen 394 is configured to display images, videos, and the like. The 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 flex light-emitting diode (FLED), a Miniled, a Micro Led, a Micro-oLed, a quantum dot light emitting diodes (QLED), or the like.
[0081] The electronic device 300 can implement a photographing function through an ISP, the camera 393, a video codec, a GPU, the display screen 394, and an application processor, and the like. The ISP is configured to process data fed back by the camera 393. The camera 393 is configured to capture a still image or a video. In some embodiments, the electronic device 300 can include one or N cameras 393, where N is a positive integer greater than 1. The digital signal processor is configured to process a digital signal, which can be a digital image signal, and can also be other digital signals. For example, when the electronic device 300 selects a frequency point, the digital signal processor is configured to perform Fourier transform on the frequency point energy, and the like. The video codec is configured to compress or decompress a digital video. The NPU is a neural-network (NN) calculation processor, which is configured to process input information quickly by referring to a biological neural network structure, for example, by referring to a transmission mode between human brain neurons, and can also be self-learned constantly. Through the NPU, the electronic device 100 can implement intelligent cognition applications, such as image recognition, face recognition, voice recognition, text understanding, and the like.
[0082] The external memory interface 320 can be configured to connect an external memory card, such as a Micro SD card, to implement an extension of the storage capability of the electronic device 300. The external memory card communicates with the processor 310 through the external memory interface 320 to implement a data storage function. For example, music, video, and the like are saved in the external memory card.
[0083] The internal memory 321 can be used to store computer executable program codes, which include instructions. The processor 310 performs various functional applications and data processing of the electronic device 300 by running the instructions stored in the internal memory 321. For example, in the embodiments of the present application, the processor 310 can perform the instructions stored in the internal memory 321, and the internal memory 321 can include a storage program area and a storage data area.
[0084] The storage program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like. The storage data area can store data (such as audio data, a phone book, etc.) created during the use of the electronic device 300, and the like. In addition, the internal memory 321 can include a high-speed random access memory, and can further include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
[0085] The electronic device 300 can realize an audio function through an audio module 370, a speaker 370A, a receiver 370B, a microphone, a headset interface, and an application processor, and the like. For example, music playing, recording, and the like.
[0086] The audio module 370 is used to convert digital audio information into an analog audio signal output, and is also used to convert an analog audio input into a digital audio signal. The audio module 370 can also be used to encode and decode an audio signal. In some embodiments, the audio module 370 can be disposed in the processor 310, or part of the functions of the audio module 370 can be disposed in the processor 310. The speaker 370A, also known as a “loudspeaker”, is used to convert an audio electrical signal into a sound signal. The receiver 370B, also known as a “earpiece”, is used to convert an audio electrical signal into a sound signal. The microphone, also known as a “microphone”, “sound receiver”, is used to convert a sound signal into an electrical signal.
[0087] The headset interface is used to connect a wired headset. The headset interface can be a USB interface 330, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0088] Buttons 390 include a power button, volume buttons, etc. Buttons 390 can be mechanical buttons or touch-sensitive buttons. Motor 391 can generate vibration alerts. Motor 391 can be used for incoming call vibration alerts or for touch vibration feedback. Indicator 392 can be an indicator light, used to indicate charging status, battery level changes, messages, missed calls, notifications, etc. 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 electronic device 300. The electronic device 300 can support one or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 395 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0089] although Figure 3 As not shown, electronic device 300 may also include a flash, a miniature projection device, a near field communication (NFC) device, etc., which will not be described in detail here.
[0090] After introducing the hardware structure of the electronic device, the software architecture of the electronic device provided in this application will be described. The software system of the electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses a layered architecture system as an example to illustrate the software structure of the electronic device.
[0091] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into five layers, from top to bottom: the application layer, the system application framework layer, the coordination service and scheduling layer, the communication module layer, and the kernel layer.
[0092] The application layer can include a series of application packages. For example... Figure 4 As shown, the application package can include: notes, photo album, and gallery. The application package can also include applications such as camera, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0093] like Figure 4 As shown, the system application framework layer may include ActivityManagerService (AMS), DistributedActivityManagerService (DAMS), and Package Management Service.
[0094] (PackageManagerService, PMS), Distributed Package Manager Service (DPMS), Service Manager (SM), Distributed Service Manager (DSM). Among them, AMS, PMS and SM are system services already in the system, and the related functions are not specifically introduced here. Among them, DAMS, DPMS and DSM are system functions newly added in the distributed system by the embodiments of the present application, which are collectively referred to as a distributed application framework, used to process service calls between distributed applications in the embodiments of the present application. Among them, distributed applications refer to application programs distributed on different electronic devices, which work together to complete a task through a network.
[0095] The distributed application framework is divided into two layers at the implementation level: the distributed application framework-framework layer and the distributed application framework-service layer. The distributed application framework refers to a framework system that schedules application execution across devices in a distributed system composed of multiple devices connected by a network. It can send call requests to remote devices, respond to scheduling requests from remote devices and pull up the application of the device to respond to the execution of the distributed application framework layer. It includes application programming interfaces (APIs) provided for applications and management services in the system. The distributed application framework-framework layer refers to a module that provides interfaces and common distributed running logic for applications. Applications can initiate call requests or respond to distributed calls based on the framework layer. The distributed application framework-service layer refers to a module responsible for managing the component information and application information of all connected devices in the distributed environment; executing requests issued by the framework layer and scheduling application execution across devices; responding to scheduling requests from remote devices and pulling up the application of the device to respond to execution.
[0096] As shown in Figure 4 , the collaboration service and scheduling layer are used to provide management capabilities for remote services. Among them, the collaboration service and scheduling layer can include a distributed application service layer, a transmission management module and a device management module.
[0097] Among them, the transmission management module refers to a session created between devices, through which messages are transmitted. The device management module refers to managing connected devices, such as device online and offline.
[0098] As shown in Figure 4As shown, the communication module and the device Profile layer include a communication module and a device Profile module. The communication module is a module responsible for transmission, including device discovery connection services and data transmission services, etc., providing a cross-device transmission interface, supporting automatic networking within a trust ring, one-to-many connection, and hibernating device wake-up. In the cross-device calling scenario, information is transmitted between devices through the communication module.
[0099] The device Profile module is used to provide information of the device, provide a service registration interface supported by the device, and an interface for other devices to query services.
[0100] The kernel layer includes a Binder driving module, mainly used for cross-device communication.
[0101] The methods in the following embodiments can be implemented in an electronic device with the hardware structure and the software architecture described above.
[0102] In the embodiments of the present application, taking the service of the second electronic device (called end) called by the first electronic device (calling end) as an example, the first electronic device can be a personal computer, a tablet, a mobile phone, etc., and the second electronic device can be a tablet, a mobile phone, etc.
[0103] In the scenario where the first electronic device calls the target service of the second electronic device, the first electronic device needs to bind the target service of the second electronic device first, and after successfully binding the service, the first electronic device can remotely call the service.
[0104] As shown, Figure 5 As shown, Figure 5 A cross-device service calling overall architecture diagram is provided in the embodiments of the present application, in which the mobile phone is the calling end and the tablet is the called end. Taking the search service as an example, Figure 5It can be seen that the search architecture of the mobile phone side includes a remote search request module, a service binding module, a search interface calling module and a distributed application framework. The search architecture of the tablet side includes a remote search response module, a search interface implementation module and a distributed application framework. The remote search request module and the remote search response module are function modules developed by calling the search business logic of the application core of the calling device and the called device. A large number of non-search related functions are integrated in the distributed application framework of the calling device and the called device, including triggering of remote procedure call (RPC), data transmission, session management, etc. The interface provided to the application is provided through the design of the distributed application framework. After the application of the mobile phone calls the interface of the distributed application framework for service binding, the application of the mobile phone can send a search request to the tablet side to realize the function of cross-device remote search access by calling the search interface. The application can perform RPC remote calling as if it is performing cross-process communication (IPC) of the local application. The search service can also be named as Figure 5 Smart Search Service in the above.
[0105] Therefore, in the embodiments of the present application, the overall flow of the cross-device service calling method mainly includes two parts: service binding of the first electronic device and remote calling of the first electronic device.
[0106] First, the flow of service binding of the first electronic device is introduced. Before binding the service, the first electronic device (calling device) obtains the distributed context of the second electronic device (called device) to be called, and binds the service by calling the interface of the distributed context. The distributed context of the device is used to indicate the information required for communication of the second electronic device, including but not limited to at least one of the following information: device identifier, communication connection required for communication with the second electronic device, connection response and other software processing logic set. Optionally, the device identifier includes but is not limited to the device name.
[0107] In the embodiments of the present application, the first application needs to determine the second electronic device to be called, and the application and service to be called in the second electronic device.
[0108] First, the first electronic device opens the first application in response to the user operation, and the display interface of the first application includes a calling control. When the first electronic device receives the user operation on the calling control, it can be considered that the user has the intention of cross-device calling, and therefore the target service needs to be bound. Different calling controls can correspond to different cross-device calling capabilities, for example, a search control corresponds to cross-device search, a photographing control corresponds to cross-device photographing, etc. There can also be only one calling control, and the first electronic device can determine the cross-device capability to be called in response to different calling operations of the user on the calling control.
[0109] Specifically, after the first electronic device responds to a user's operation to open the first application, the application's display interface may include multiple call controls. Upon the user's touch operation on a target call control, the first application can display a device list. If the target call control is a search control, the devices in the device list are those with remote search capabilities within a certain range. These devices within the certain range have established a wireless connection with the first electronic device. Upon the user's selection of a target device from the device list, the first application obtains the target device's distributed context. After obtaining the target device's distributed context and binding it to the service corresponding to the target device's search capability, the first application can remotely search for images on the target device.
[0110] In some embodiments, after responding to a user's touch operation on the target invocation control, the first electronic device may not need to display a device list, but can directly obtain the distributed context of the target device. Here, the target device is a device that has established a wireless connection with the first electronic device and possesses target remote invocation capabilities. For example, if the target invocation control is a search control, the aforementioned target device is a device that has established a wireless connection with the first electronic device and possesses remote search capabilities. After the first application obtains the distributed context of the target device and binds it to the service corresponding to the target device's search capabilities, the first application can remotely search for images on the target device.
[0111] If the first electronic device opens the first application in response to a user's action, the application's display will only show a single call control. In this case, the first application, responding to the user's touch on the call control, can display a device list and a corresponding capability list. The device list shows the names of devices that have established a wireless connection with the first electronic device, and the capability list lists the services that each device can provide. For example, ... Figure 6 As shown in Figure 6A, after the user touches the control 601, the photo album application displays the following device and capability lists: Tablet 1, with the corresponding capabilities of search and scan; and Laptop 1, with the corresponding capability of search. The first application responds to the user's selection of a target device from the device list, which is the second electronic device to be invoked, and obtains the distributed context of the target device. For example, if the phone's photo album 1 responds to the user's selection of Tablet 1 from the device list, then photo album 1 obtains the distributed context of Tablet 1. Specifically, photo album 1 responds to the user's selection of a target capability from the capability list of Tablet 1, such as search, meaning photo album 1 determines that it wants to bind the search service. After photo album 1 obtains the distributed context of Tablet 1 and binds the search service of Tablet 1, photo album 1 can remotely search for images on Tablet 1.
[0112] In some embodiments, where the target call control is a search control, for example, such as Figure 6 As shown in Figure 6B, the search control may include a search bar 602 and a search confirmation control 603. The first application can display a device list in response to the user's input in the search bar and the user's touch operation on the search confirmation control. That is, the first application can determine the user's invocation instruction information in response to the user's input, which is the search instruction information, i.e., the search keywords. After the first application obtains the distributed context of the target device and binds the service corresponding to the search capability of the target device, the first application can remotely search for images corresponding to the search keywords on the target device. This solution, through the aforementioned invocation instruction information, can perform remote invocation according to user needs.
[0113] In some embodiments, when the target invocation control is a search control (designated as the first search control), the first application displays a device list in response to the user's touch operation on the first search control. The first application then displays a second search control in response to the user's selection of a target device from the device list. The second search control may include a search bar and a search confirmation control. The first application obtains the distributed context of the target device in response to the user's input in the search bar and the user's touch operation on the search confirmation control. That is, the first application determines the user's search indication information, i.e., the search keywords, in response to the user's input. After obtaining the distributed context of the target device and binding the service corresponding to the search capability of the target device, the first application can remotely search for images on the target device that correspond to the search keywords.
[0114] In some embodiments, if only one call control is displayed on the interface of the first application, the first application displays a device list and a corresponding capability list in response to the user's touch operation on the call control. The first application may also display a search control in response to the user's selection of a search capability for a target device in the device list, wherein the search control includes a search bar and a search confirmation control. The first application obtains the distributed context of the target device in response to the user's input in the search bar and the user's touch operation on the search confirmation control. That is, the first application determines the user's search indication information, i.e., the search keywords, in response to the user's input. After the first application obtains the distributed context of the target device and binds the service corresponding to the search capability of the target device, the first application can remotely search for images on the target device that correspond to the search keywords.
[0115] In this embodiment of the application, the first application can perform a local search simultaneously while performing a remote search. For example, as... Figure 7As shown, the first application determines the search indication information of the user, i.e., the search keyword, in response to the input operation of the user in the search control. It is assumed that the search keyword is "flower". After the first application acquires the distributed context of the target device and binds the service corresponding to the search capability of the target device, the first application can remotely search the picture corresponding to "flower" in the target device. Meanwhile, the first application searches the picture corresponding to "flower" in the local gallery and displays the picture in the interface of the first application.
[0116] As shown, the first application can display the option of the first electronic device while displaying the list of devices, such as Figure 7 As shown, if the first application selects the target device and the first electronic device in response to the operation of the user, it means that after the first application acquires the distributed context of the target device and binds the service corresponding to the search capability of the target device, the first application performs local search while performing remote search on the target device.
[0117] As shown, if the first application selects the target device and the first electronic device in response to the operation of the user, it means that after the first application acquires the distributed context of the target device and binds the service corresponding to the search capability of the target device, the first application performs local search while performing remote search on the target device.
[0118] As can be seen from the above, the embodiment of the present application can determine the target device to be acquired with the distributed context, i.e., the second electronic device.
[0119] In the embodiment of the present application, the first electronic device acquires the distributed context of the second electronic device, which can be acquired in the cache according to the device identifier of the second electronic device or acquired in the second electronic device according to the device identifier of the second electronic device.
[0120] Specifically, after the first electronic device is powered on, the first electronic device can establish wireless connection with one or more electronic devices, for example, with the electronic devices in the same trust circle. The electronic devices that have established wireless connection can synchronize information, for example, the first electronic device can acquire the distributed context of the second electronic device through the wireless connection between the first electronic device and the second electronic device and cache the distributed context in the cache of the first electronic device.
[0121] As shown, each device has a device identifier, for example, the device identifier of the electronic device A is device 1. The first electronic device can store the device identifier of the second electronic device and the corresponding distributed context in association.
[0122] The first electronic device can be connected with multiple electronic devices, that is, multiple distributed contexts can be stored in the first electronic device. After receiving the calling operation of the user on the calling control, the first electronic device can directly find the distributed context of the corresponding second electronic device from the cached information according to the determined device identifier of the second electronic device. In this implementation manner, the distributed context of the second electronic device is pre-cached before calling, and the distributed context can be directly obtained from the local cache when calling, without cross-device operation, thereby improving the calling efficiency.
[0123] If the distributed context corresponding to the device identifier is not found in the cached information of the first electronic device, that is, the distributed context of the second electronic device is not cached by the first electronic device when starting. Then, the first electronic device needs to obtain the distributed context of the second electronic device across devices. Specifically, the first electronic device sends a request for obtaining the distributed context to the second electronic device, and the second electronic device returns the distributed context to the first electronic device after receiving the request.
[0124] In the embodiment of the application, after obtaining the distributed context of the second electronic device, the first electronic device sends a binding request for the target service to the second electronic device based on the distributed context, that is, sends a request for binding the service to the second electronic device by calling the interface of the distributed context. Since the first electronic device can determine the second electronic device to be called and the application and the service to be called when receiving the calling operation of the user, the first electronic device carries the information of the application to be called and the information of the service in the binding request when sending the binding request, so that the second electronic device can perform corresponding operations according to the information of the application to be called and the information of the service when receiving the binding request.
[0125] Specifically, the first electronic device calls the API interface of the bindService of the distributed context. The interface provides intent information, and the intent information includes target application information and service component information corresponding to the target service, that is, the binding request includes the above-mentioned intent information. At the same time, a ServiceConnection object is needed when binding the service, which is used to receive the binding result.
[0126] After the second electronic device receives the binding request, the intent information in the request is parsed to confirm the target application on the second electronic device. Then, the process of the local device is scheduled to start the target application, and the corresponding target service to be started is scheduled to be executed, that is, the binding of the target service is started. For example, the intent information in the binding request contains the target application information, which is the album application, and the target service is the search service. Therefore, the second electronic device starts the album application process and starts the service component corresponding to the search service.
[0127] Then, the second electronic device triggers the onBind callback of the corresponding target service, creates the IBinder corresponding to the target service, and returns the IBinder object of the target service to the first electronic device across devices by calling the onBind method. One IBinder object can call one service. After the first electronic device obtains the IBinder object of the target service of the second electronic device, the IBinder object of the target service can be used to call the interface of the corresponding target service, that is, the capability that the target service can provide. At this time, the first electronic device completes the binding process of the target service.
[0128] In the embodiment of the present application, the first electronic device can remotely call the target service after completing the binding of the target service. Specifically, the first electronic device sends a call request to the second electronic device based on the IBinder object of the target service, and requests to call the target service corresponding to the IBinder object. After receiving the call request, the second electronic device calls the corresponding target service according to the IBinder object carried in the call request. For example, after the album application (set as album 1) of the first electronic device completes the binding of the search service of the album application (set as album 2) of the second electronic device, the IBinder object corresponding to the search service is set as IBinderS1, that is, the first electronic device obtains IBinderS1. The first electronic device sends a call request to the second electronic device, and if the second electronic device receives the call request containing the indication information corresponding to IBinderS1, the second electronic device calls the search service of album 2.
[0129] In the embodiment of the present application, the second electronic device can determine the search indication information of the user, such as the search keyword, when calling the search service of the photo album 2 to perform the search operation. That is, the second electronic device can search in the local data according to the search keyword to obtain the pictures related to the search keyword. The first electronic device determines the search keyword in response to the input operation of the user on the interface of the photo album 1, and then includes the search keyword in the calling request when the first electronic device sends the calling request to the second electronic device. Thus, the second electronic device can obtain the search keyword when receiving the calling request, and search locally according to the search keyword.
[0130] The second electronic device can obtain the calling result after calling the target service, and return the calling result to the first electronic device. For example, the photo album 2 of the second electronic device returns the pictures searched in the photo album 2 to the photo album 1 of the first electronic device after calling the search service. That is, the photo album 1 of the first electronic device can display the pictures searched in the photo album 2 of the second electronic device.
[0131] Thus, the cross-device service calling method provided in the embodiment of the present application can directly call the target service of the second electronic device after the first electronic device completes the binding of the target service to be called in the second electronic device by calling the interface of the distributed context of the second electronic device obtained.
[0132] Please refer to Figure 8 , Figure 8 The figure is a structural schematic diagram of a cross-device service calling system framework provided in the embodiment of the present application. As shown in Figure 8 , the distributed application 1 of the device A calls the target service of the distributed application 2 of the device B. The device identifier of the device A is deviceId1, and the device identifier of the device B is deviceId2. First, the distributed application 1 obtains the distributed context of the device B through the device identifier. For example, the distributed application framework of the device A calls the distributed application framework service to obtain the distributed context of the device B.
[0133] After obtaining the distributed context of the device B, the distributed application 1 calls the API interface of the binding service of the distributed context (please refer to step 1 of Figure 8 ). The interface needs to provide the intent information, and the intent information specifies the information (package name, service component information, etc.) of the target service. At the same time, the service connection (ServiceConnection) object needs to be provided in the distributed application 1, which is used to receive the binding result.
[0134] Within the distributed application framework of distributed application 1, the API interface of the binding service forwards the binding request to the DAMS in the distributed application framework service of device B through the DAM (see step 2 of Figure 8 . The DAMS described herein refers to the AMS and DAMS service on device B (the running entity is DistributedContextImpl).
[0135] The DPMS service on device B parses the intent information of the binding request, performs target service component retrieval (see step 3 of Figure 8 , and confirms the application on the local device. The DPMS described herein refers to the PMS and DPMS service on device B. Device B schedules a process to locally start the target application according to the target application information parsed from the intent information (see step 4 of Figure 8 . Then, the ActivityTaskManagerService (ATMS) on device B starts the corresponding target service component, schedules the corresponding target service to be started to execute, and triggers the onBind callback of the corresponding target service (see step 5 of Figure 8 .
[0136] The target service component of distributed application 2 creates a Bind service object of the corresponding business logic in the onBind callback (see step 6 of Figure 8 . The object is a BinderStub object. Then, distributed application 2 returns the BinderStub object to distributed application 1 of device A across devices by calling the onBind method. The service connection object in distributed application 1 receives the BinderStub object (see step 7 of Figure 8 . Finally, distributed application 1 of device A can perform interface conversion on the obtained BinderStub object, that is, convert it into a BinderProxy object, and trigger a remote RPC call (see step 8 of Figure 8 . After receiving the call request, the distributed application 2 of device B calls the service corresponding to the BinderStub object.
[0137] In the embodiments of the present application, each application can be called through the distributed application framework, without the need for each application to access the communication capability, which will not cause repeated access. In addition, each application does not need to customize a large number of modules required for cross-terminal communication, but can directly call the interface of the distributed application framework to complete the cross-terminal communication.
[0138] See Figure 9 , Figure 9A flow timing diagram of a cross-device service invocation is provided in the embodiments of the present application. As shown in Figure 7 , an application 1 of a first electronic device sends a request for obtaining a distributed context to a framework layer of a distributed application framework (see step 1 in Figure 9 ). The request contains a device identifier of a second electronic device. After receiving the request, the framework layer of the distributed application framework sends the request to a service layer of the distributed application framework, i.e., invokes a service of the service layer of the distributed application framework to obtain the distributed context of the second electronic device corresponding to the device identifier (see steps 2 and 3 in Figure 9 ). Then, the framework layer of the distributed application framework returns the distributed context to the application 1 (see step 4 in Figure 9 ). The service layer of the distributed application framework can obtain the distributed context of the second electronic device corresponding to the device identifier from cache information of the first electronic device.
[0139] After obtaining the distributed context, the application 1 creates a service connection module (see step 5 in Figure 9 ) and initiates a request for binding a service to the distributed context (see step 6 in Figure 9 ), i.e., invokes an API interface of the binding service of the distributed context. The request for binding the service contains target application information, which includes an identifier of a target application and an identifier of a target service corresponding to the target application, and the service connection module is used to receive a binding result. When invoking the interface of the binding service of the distributed context, a distributed service connection module (IDistributedServiceConnection) can be created (see step 7 in Figure 9 ) and the request for binding the service is sent to the second electronic device (see step 8 in Figure 9 ).
[0140] After receiving the request for binding the service, the distributed application framework of the second electronic device creates a service connection module (see step 9 in Figure 9 ) and sends the request for binding the service to an AMS (see step 10 in Figure 9 ). The second electronic device determines the target application and the target service according to the target application information (such as the identifier of the target application and the identifier of the target service corresponding to the target application) contained in the request for binding the service. Then, the AMS starts a process of the target application according to the target application information (see step 11 in Figure 9 ), the target application schedules the target service to be started to execute, and triggers an onBind callback of the target service (see step 12 in Figure 9Step 12) of FIG. 1. Specifically, the service component of the target service creates an IBinder object of the corresponding business logic, i.e., a Binder Stub object, in the onBind callback. The created IBinder object is returned to the application 1 of the first electronic device in the onBind callback method. The service connection module contains a callback method, which is called by the system to pass the IBinder to be returned. Specifically, the application 2 of the second electronic device sends the IBinder object to the service connection module of the second electronic device by calling the onServiceConnected method (see Figure 9 Step 13) of FIG. 1. The service connection module of the second electronic device sends the IBinder object to the distributed service connection module of the first electronic device by calling the onServiceConnected method (see Figure 9 Step 14) of FIG. 1. The distributed service connection module of the first electronic device sends the IBinder object to the service connection module of the first electronic device by calling the onServiceConnected method (see Figure 9 Step 15) of FIG. 1. The service connection module of the first electronic device returns the acquired IBinder object to the application 1 (see Figure 9 Step 16) of FIG. 1.
[0141] After the application 1 of the first electronic device acquires the IBinder object, the IBinder object can be interface-converted, and then an RPC call can be triggered, i.e., an RPC call request is sent to the application 2 of the second electronic device based on the interface-converted IBinder object (see Figure 9 Step 17) of FIG. 1. After receiving the call request, the application 2 calls the target service corresponding to the IBinder object, and returns the call result to the application 1 (see Figure 10 Step 18) of FIG. 1.
[0142] Therefore, in the cross-device service calling method provided in the above embodiments of the present application, the first electronic device only needs to acquire the distributed context of the second electronic device by calling the interface of the distributed application framework, and bind the target service of the second electronic device by calling the interface of the distributed context, so as to realize remote calling of the target service of the second electronic device, and real-time control of data transmission can be realized through remote calling.
[0143] In the embodiments of the present application, the target service to be called is taken as a search service as an example, and the overall function design schematic diagram of cross-device search is introduced. As shown in Figure 11As shown, the gallery application of the first electronic device (the calling end) searches for photos in the second electronic device (the called end). Before the first electronic device binds the service, the first electronic device needs to obtain the distributed context of the second electronic device. The first electronic device searches for the corresponding distributed context according to the device identifier of the second electronic device. Specifically, after the first electronic device determines the second electronic device that performs the remote search operation in response to the operation of the user, the first electronic device can find the corresponding distributed context in the cache information of the first electronic device according to the device identifier of the second electronic device.
[0144] After the first electronic device obtains the distributed context, the first electronic device can bind the service, that is, trigger the distributed context to initiate a request for binding the service. Specifically, the first electronic device calls the API interface of the bindService of the distributed context to bind the service, that is, bind the search service (SearchService).
[0145] After the first electronic device successfully binds the service, the first electronic device generates a search request according to the search keyword input by the user in the search bar interface to call the search service. The search service includes local search and remote search, and the search service can perform local search and remote search according to the search request. In the remote search, the first electronic device sends the search request to the second electronic device through the remote search module to pull up the search service of the second electronic device to perform local search. Then, the second electronic device returns the remote search result to the result recycling module in the remote search module of the first electronic device. The second electronic device returns the received remote search result to the gallery of the first electronic device. It should be noted that the first electronic device does not receive the search keyword generated by the input operation of the user in the search bar interface after the service binding is successful, but can initiate the binding process of the search service in response to the input operation of the user in the search bar and the operation of the search confirmation control, that is, the operation of the search control. Alternatively, in another embodiment of the present application, after the first electronic device completes the remote call to the second electronic device, the first electronic device displays all the remote search results. Then, the first electronic device generates a search keyword in response to the input operation of the user in the search bar to further search for the pictures corresponding to the search keyword.
[0146] In the local search, the first electronic device directly calls the search service to start the local search, and the search can be performed in the local data index. The gallery can obtain updated pictures from the media data center, and update the local data index after obtaining the updated pictures. The media data center includes local and remote data, which can be obtained from the distributed database. The local data refers to the data on the local end, for example, the pictures taken by the camera on the local end. The remote data refers to the data obtained by calling the remote service, for example, the pictures taken by the remote camera.
[0147] Similarly, the second electronic device performs local searches in the same way as the first electronic device, so we will not go into details here.
[0148] After receiving local and remote search results, the first electronic device can display the search results through the gallery application interface, that is, display the images corresponding to the search keywords found in the local and second electronic devices.
[0149] Understandably, when data occupies a large amount of memory, the search results can be data indexes. For example, for a large video file, the search results could be links to the video file. Then, the first electronic device can respond to the user's action on the link and open the corresponding video file.
[0150] Therefore, after the first electronic device is bound to the search service of the second electronic device, it can remotely call the search service of the second electronic device, and the first electronic device can search for photos on the second electronic device.
[0151] This application also provides a chip system, such as... As shown, the chip system 90 includes at least one processor 901 and at least one interface circuit 902. The processor 901 and the interface circuit 902 are interconnected via lines. For example, the interface circuit 902 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 902 can be used to send signals to other devices (e.g., the processor 901). Exemplarily, the interface circuit 902 can read instructions stored in the memory and send those instructions to the processor 901. When the instructions are executed by the processor 901, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete devices, and this application embodiment does not specifically limit this.
[0152] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the electronic device, the electronic device performs various functions or steps performed by the electronic device in the above method embodiments.
[0153] This application also provides a computer program product that, when run on a computer, causes the computer to perform various functions or steps performed by the electronic device in the above method embodiments.
[0154] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is exemplified, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0155] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0156] The units described as separate components can or can not be physically separated, and the components shown as units can be one physical unit or multiple physical units, that is, they can be located in one place or distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0157] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0158] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application essentially or the parts that make contributions to the prior art or all or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing an apparatus (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium that can store program codes.
[0159] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any change or replacement within the technical scope disclosed by the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A cross-device service invocation method, applied to a first electronic device, characterized in that, The method includes: The first electronic device displays the display interface of a first application, and the display interface of the first application includes a call control; wherein the call control corresponds to multiple devices that have established a wireless connection with the first electronic device; The first electronic device, in response to receiving a user's call operation on the call control, obtains the distributed context of the second electronic device; wherein, the call operation corresponds to the target service of the second electronic device among the plurality of devices, and the distributed context is used to indicate the information required for the device to achieve communication; the distributed context of the second electronic device is obtained by the first application calling the first distributed application framework, and the first distributed application framework has the ability to be called by multiple applications; the first application is any one of the plurality of applications; The first electronic device sends a binding request for the target service to the second electronic device based on the distributed context; The first electronic device receives an IBinder object from the second electronic device and sends a call request to the second electronic device based on the IBinder object; wherein, the IBinder object is created by the second electronic device in response to the binding request based on the target service, the IBinder object is used to call the target service, and the call request is used to request the second electronic device to call the target service; The first electronic device receives the call result of the second electronic device, which indicates that the target service has been invoked.
2. The cross-device service invocation method according to claim 1, characterized in that, The first electronic device sends a binding request for the target service to the second electronic device based on the distributed context, including: The first electronic device invokes the interface of the distributed context to send a binding request for the target service to the second electronic device; wherein, the binding request includes the identification information of the target service.
3. The cross-device service invocation method according to claim 1, characterized in that, The invocation operation is used to search for data on the second electronic device; the target service is a search service; the invocation result of the target service includes the search results for the data.
4. The cross-device service invocation method according to claim 3, characterized in that, The data includes at least one of the following: images, files, videos, and audio.
5. The cross-device service invocation method according to any one of claims 1-4, characterized in that, In response to receiving a user's call operation on the control, the first electronic device obtains the distributed context of the second electronic device, including: In response to receiving a user's call operation on the control, the first electronic device sends a request to the second electronic device to obtain the distributed context of the second electronic device; The first electronic device receives a distributed context from the second electronic device.
6. The cross-device service invocation method according to any one of claims 1-4, characterized in that, Before the first electronic device obtains the distributed context of the second electronic device in response to receiving a user's call operation on the call control, the method further includes: When the first electronic device establishes the wireless connection with the second electronic device, the first electronic device obtains the distributed context of the second electronic device and stores it in the cache information of the first electronic device; Wherein, the first electronic device, in response to receiving a user's call operation on the call control, obtains the distributed context of the second electronic device, including: In response to receiving a user's call operation on the control, the first electronic device obtains the distributed context of the second electronic device from the cache information.
7. The cross-device service invocation method according to any one of claims 1-4, characterized in that, The first electronic device receives an IBinder object from the second electronic device and sends a call request to the second electronic device based on the IBinder object, including: The first electronic device acquires the invocation indication information of the invocation operation, wherein the invocation indication information is determined based on the user's input operation on the display interface of the first application; The first electronic device receives the IBinder object from the second electronic device and sends the call request to the second electronic device based on the IBinder object, the call request including the call indication information.
8. The cross-device service invocation method according to claim 6, characterized in that, In response to receiving a user's call operation on the control, the first electronic device retrieves the distributed context of the second electronic device from the cached information, including: In response to receiving the user's call operation on the call control, the first application sends a first request to the distributed application framework layer of the first electronic device; wherein, the first request includes the identification information of the second electronic device, and the first request is used to request to obtain the distributed context of the second electronic device; In response to the first request, the distributed application framework layer calls the distributed application service layer to obtain the distributed context from the cached information; The distributed application framework layer returns the distributed context to the first application.
9. The cross-device service invocation method according to claim 2, characterized in that, The first electronic device invokes the interface of the distributed context to send a binding request for the target service to the second electronic device, including: The first application creates a service connection module, which is used to receive the service binding result from the second electronic device and return the service binding result to the first application. The first application calls the interface of the distributed context to create a distributed service connection module and sends the binding request to the second electronic device; wherein, the distributed service connection module is used to receive the service binding result from the second electronic device and return the service binding result to the service connection module.
10. The cross-device service invocation method according to claim 9, characterized in that, The first electronic device receives an IBinder object from the second electronic device and sends the invocation request to the second electronic device based on the IBinder object, including: The distributed service connection module receives the IBinder object from the second electronic device and returns the IBinder object to the service connection module; The service connection module receives the IBinder object and returns the IBinder object to the first application. The first application receives the IBinder object and sends the call request to the second electronic device based on the IBinder object.
11. A cross-device service invocation method, applied to a second electronic device, characterized in that, The method includes: The second electronic device receives a binding request from the first electronic device; wherein the binding request is used by the first electronic device to request binding to a target service of the second electronic device; The second electronic device responds to the binding request by creating an IBinder object for the target service and returns the IBinder object to the first electronic device; wherein, the IBinder object is used to invoke the target service; the IBinder object is obtained by the second electronic device by invoking a second distributed application framework, the second distributed application framework having the ability to invoke multiple applications within the second electronic device, and the target service is a service of any one of the multiple applications within the electronic device; The second electronic device receives a call request from the first electronic device; wherein the call request is generated by the first electronic device based on the IBinder object, and is used by the first electronic device to request the second electronic device to call the target service; The second electronic device invokes the target service based on the invocation request and returns the invocation result of the target service to the first electronic device.
12. The cross-device service invocation method according to claim 11, characterized in that, Before the second electronic device receives the binding request from the first electronic device, the method further includes: In response to receiving a request from the first electronic device for a distributed context, the second electronic device obtains the distributed context of the second electronic device; wherein the distributed context is used to indicate information required for the device to perform communication; The second electronic device returns the distributed context to the first electronic device.
13. The cross-device service invocation method according to claim 11 or 12, characterized in that, The second electronic device, in response to the binding request, creates an IBinder object for the target service and returns the IBinder object to the first electronic device, including: In response to the binding request, the second electronic device starts the process of the target application corresponding to the target service and starts the target service component corresponding to the target application; The second electronic device creates an IBinder object for the target service based on the target service component and returns the IBinder object to the first electronic device.
14. The cross-device service invocation method according to claim 11 or 12, characterized in that, The call request includes call indication information. The second electronic device calls the target service based on the call request and returns the call result of the target service to the first electronic device, including: The second electronic device invokes the target service based on the invocation instruction information and obtains the invocation result corresponding to the invocation instruction information; The second electronic device returns the call result corresponding to the call instruction information to the first electronic device.
15. An electronic device, characterized in that, The electronic device includes: a communication module, a display screen, a memory, and one or more processors; the communication module, the display screen, the memory, and the processors are coupled; the memory is used to store computer program code, the computer program code including computer instructions, which, when executed by the electronic device, cause the electronic device to perform the method as described in any one of claims 1-14.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed in an electronic device, cause the electronic device to perform the method as described in any one of claims 1-14.
Citation Information
Patent Citations
Cross-device service calling method and electronic device
CN118945209A
Remote procedure calling method between different devices
KR1020160080487A