Cross-device service invocation method and electronic device

By using cross-device service call methods, leveraging the Binder mechanism and distributed application management services, direct transmission of shooting or scanning results between different electronic devices was achieved, solving the problem of cumbersome multi-device operation and improving user efficiency.

CN118945209BActive Publication Date: 2025-12-12HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310541270.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2025-12-12
Estimated Expiration
2043-05-12

AI Technical Summary

Technical Problem

The functional differences between different electronic devices make it cumbersome for users to switch between multiple devices, especially when shooting or scanning whiteboard content, which requires multiple data transfers and affects work efficiency.

Method used

By using cross-device service call methods, leveraging the Binder mechanism and distributed application management services, the first electronic device can send shooting or scanning commands to the second electronic device and directly return the results, simplifying the operation process.

Benefits of technology

It reduces the steps users need to switch between multiple devices and transfer data, improves work efficiency, simplifies the operation process, and meets users' shooting needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945209B_ABST
    Figure CN118945209B_ABST
Patent Text Reader

Abstract

The application provides a cross-device service calling method and an electronic device, relates to the field of electronic devices, and is applied to a first electronic device and includes the following steps: displaying a display interface of a first application, wherein the interface includes a plurality of device controls; receiving a first touch operation of a user on a target device control; obtaining a first Binder identifier ID corresponding to a distributed application management service from a second electronic device; and creating a second IBinder object based on the first Binder ID. In response to receiving a first request from the second electronic device, a corresponding second IBinder object is found according to a first Binder ID contained in the first request, and a first file providing object of the first application is indicated to the second electronic device based on the second IBinder object; in response to receiving a second request from the second electronic device, a first file handle object is indicated to the second electronic device based on the first file providing object; and a result of executing a service returned by the second electronic device based on the first file handle object is received. The scheme can improve work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic devices, and in particular to a cross-device service calling method and an electronic device. BACKGROUND

[0002] Currently, because different types of electronic devices have different functions, users will use more convenient electronic devices according to different scenes. For example, because the screen of a computer is relatively larger than that of a mobile phone, users usually use a computer to organize notes for learning, and in an offline classroom, the content of blackboard writing needs to be photographed and inserted into the notes of the computer.

[0003] Because there is no rear camera on the computer, the existing solution is to photograph the content of blackboard writing through a mobile phone, upload the photographed content to the computer, then download and save it to the computer, and finally upload it to the notes of the computer. However, in this method, multiple devices are switched and used for data transmission, 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, reduce the complexity of operations, and improve the work efficiency of users.

[0005] To achieve the above-mentioned purpose, embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a cross-device service calling method is provided, which can be applied to a first electronic device. The method includes: the first electronic device displays a display interface of a first application, the display interface of the first application including a plurality of device controls, each device control corresponding to a device that has established a preset wireless connection with the first electronic device, and each device control including one or more services provided by the corresponding device; the first electronic device receives a first touch operation of a user on a target device control in the plurality of device controls, the first touch operation corresponding to a distributed application management service of a second electronic device; the first electronic device obtains a first Binder identification (ID) corresponding to the distributed application management service from the second electronic device, and creates a second IBinder object based on the first Binder ID; wherein the first Binder ID is determined by the second electronic device when registering the distributed application management service according to a first IBinder object of the distributed application management service, and the first IBinder object and the second IBinder object are used to call the distributed application management service.

[0007] The first electronic device, in response to receiving the first request from the second electronic device, finds the corresponding second IBinder object according to the first Binder ID contained in the first request, and indicates the first file providing object of the first application to the second electronic device based on the second IBinder object; wherein the first request is used to request the first file providing object, the first request is sent by the second electronic device in response to a second touch operation of a user on the second application, the second touch operation is used to confirm the result of the second electronic device executing the distributed application management service on the second application, and the first file providing object is used to support the second electronic device returning the result of executing the distributed application management service to the first electronic device.

[0008] The first electronic device, in response to receiving the second request from the second electronic device, indicates the first file handle object to the second electronic device based on the first file providing object; wherein the second request is generated by the second electronic device based on the first file providing object, and is used to request the first file handle object for calling the preset cache file of the first application; and the first electronic device receives the result of executing the distributed application management service returned by the second electronic device based on the first file handle object.

[0009] By adopting the technical scheme, the user can send a shooting instruction to the second electronic device by using the first electronic device, the second electronic device calls up the camera to execute the shooting or scanning task after receiving the shooting instruction, and then returns the shooting result or the scanned text to the first electronic device. The step of uploading the shooting result or the scanned text to the first electronic device, then downloading and saving the shooting result or the scanned text to the first electronic device, and then uploading the shooting result or the scanned text to the corresponding position of the first electronic device can be saved, the operation is more convenient, and the work efficiency of the user is improved.

[0010] In a possible implementation manner, before the first electronic device responds to the first request from the second electronic device, the first electronic device further sends an opening instruction to the second electronic device, wherein the opening instruction is used to open the second application of the second electronic device.

[0011] In a possible implementation, the first electronic device, in response to receiving the first request from the second electronic device, finds the corresponding second IBinder object according to the first Binder ID contained in the first request, and indicates the first file providing object of the first application to the second electronic device based on the second IBinder object, including: the first electronic device, in response to receiving the first request from the second electronic device, finds the corresponding second IBinder object according to the first Binder ID contained in the first request; the first electronic device obtains the first file providing object of the first application based on the second IBinder object, and creates a corresponding second Binder ID based on the first file providing object; and the first electronic device sends the second Binder ID to the second electronic device. That is, the first electronic device actually sends the Binder ID corresponding to the first file providing object to the second electronic device.

[0012] In a possible implementation, the first electronic device, in response to receiving the second request from the second electronic device, indicates the first file handle object to the second electronic device based on the first file providing object, including: the first electronic device, in response to receiving the second request from the second electronic device, finds the corresponding first file providing object according to the second Binder ID contained in the second request; the first electronic device obtains the first file handle object based on the first file providing object, and creates a first distributed file based on the first file handle; and the first electronic device sends the name of the first distributed file to the second electronic device. That is, the first electronic device actually sends the name of the first distributed file corresponding to the first file handle object to the second electronic device.

[0013] In a possible implementation, the first electronic device obtains the first Binder ID corresponding to the distributed application management service from the second electronic device, and creates a second IBinder object based on the first Binder ID, including: the first application obtains the service name of the distributed application management service, and sends an obtaining instruction to the distributed service management module of the first electronic device; wherein the obtaining instruction includes the service name, and is used to obtain the first Binder ID corresponding to the distributed application management service; the distributed service management module, in response to the obtaining instruction, sends the obtaining instruction to the second electronic device through the preset wireless connection by using the communication module of the first electronic device; the communication module receives the first Binder ID from the second electronic device through the preset wireless connection, and sends the first Binder ID to the distributed service management module; the distributed service management module sends the first Binder ID to the distributed Binder management module of the first electronic device; and the distributed Binder management module creates the second IBinder object based on the first Binder ID.

[0014] In a possible implementation, after the first electronic device obtains the first Binder identification ID corresponding to the distributed application management service from the second electronic device, and creates the second IBinder object based on the first Binder ID, the method further includes: returning, by the distributed Binder management module, the second IBinder object to a system application framework of the first electronic device, and returning, by the system application framework, the second IBinder object to the first application.

[0015] In a possible implementation, in response to receiving the first request from the second electronic device, the first electronic device searches for the corresponding second IBinder object according to the first Binder ID contained in the first request, including: receiving, by the distributed Binder management module, the first request from the second electronic device by using the communication module, and searching for the corresponding second IBinder object according to the first Binder ID.

[0016] In a possible implementation, the first electronic device obtains the first file providing object of the first application based on the second IBinder object, and creates the second Binder ID corresponding to the first file providing object, including: sending, by the distributed Binder management module, a first execution request to the system application framework of the first electronic device based on the second IBinder object; sending, by the system application framework, the first file providing object of the first application to the distributed Binder management module based on the first execution request; and creating, by the distributed Binder management module, the second Binder ID based on the first file providing object.

[0017] In a possible implementation, the first electronic device sends the second Binder ID to the second electronic device, including: sending, by the distributed Binder management module, the second Binder ID to the second electronic device.

[0018] In a possible implementation, in response to receiving the second request from the second electronic device, the first electronic device searches for the corresponding first file providing object according to the second Binder ID contained in the second request, including: receiving, by the distributed Binder management module, the second request from the second electronic device by using the communication module, and searching for the corresponding first file providing object according to the second Binder ID contained in the second request.

[0019] In a possible implementation, the first electronic device obtains the first file handle object based on the first file providing object, and creates the first distributed file based on the first file handle, including: sending, by the distributed Binder management module, a second execution request to the system application framework based on the first file providing object.

[0020] The system application framework sends, based on the second execution request, a first file handle object of the first application to the distributed Binder management module; the distributed Binder management module sends, based on the first file handle object, a creation instruction for the first distributed file to the distributed file module of the first electronic device; and the distributed file module creates the first distributed file based on the creation instruction.

[0021] In a possible implementation, the first electronic device sends the name of the first distributed file to the second electronic device, including: the distributed file module sends the first distributed file to the distributed Binder management module; and the distributed Binder management module sends the name of the first distributed file to the second electronic device through the communication module.

[0022] In a second aspect, the present application provides a cross-device service calling method, applied to a second electronic device, including: the second electronic device sends, in response to a second touch operation of a second application of the second electronic device by a user, a first request to a first electronic device based on a first Binder ID of a distributed application management service; wherein the first request is used to request a first file providing object of a first application of the first electronic device, the first Binder ID is determined by the second electronic device according to a first IBinder object of the distributed application management service when the second electronic device registers the distributed application management service, the first IBinder object is used to call the distributed application management service, the second touch operation is used to confirm a result of the second electronic device executing the distributed application management service on the second application, and the first file providing object is used to support the second electronic device returning the result of executing the distributed application management service to the first electronic device.

[0023] The second electronic device receives the first file providing object indicated by the first electronic device, and sends a second request to the first electronic device based on the first file providing object; wherein the second request is used to request a first file handle object of a preset cache file of the first application; and the second electronic device receives the first file handle object indicated by the first electronic device, and returns the result of executing the distributed application management service to the first electronic device based on the first file handle object.

[0024] In a possible implementation, before the second electronic device responds to the second touch operation of the second application of the second electronic device by the user, the method further includes: the second electronic device receives an opening instruction sent by the first electronic device, and opens the second application of the second electronic device based on the opening instruction.

[0025] In a possible implementation, before the second electronic device receives the opening instruction sent by the first electronic device, the method further includes: receiving, by the second electronic device, an obtaining instruction from the first electronic device; finding, by the second electronic device, the first Binder ID of the distributed application management service based on the obtaining instruction; and sending, by the second electronic device, the first Binder ID to the first electronic device.

[0026] In a possible implementation, before the second electronic device receives the obtaining instruction from the first electronic device, the method further includes: obtaining, by the second electronic device, a service name of the distributed application management service and a first IBinder object of the distributed application management service, and determining the corresponding first Binder ID based on the first IBinder object; and wherein the first IBinder object is used to invoke the distributed application management service.

[0027] In a possible implementation, the second electronic device receives the first file providing object indicated by the first electronic device, and sends a second request to the first electronic device based on the first file providing object, including: receiving, by the second electronic device, a second Binder ID of the first file providing object, and creating a second file providing object based on the second Binder ID; sending, by the second electronic device, the second request to the first electronic device based on the second file providing object; and wherein the second Binder ID is included in the second request.

[0028] In a possible implementation, the second electronic device receives the first file handle object indicated by the first electronic device, and returns a result of executing the distributed application management service to the first electronic device based on the first file handle object, including: receiving, by the second electronic device, a name of a first distributed file sent by the first electronic device; wherein the first distributed file is created by the first electronic device based on the first file handle object; opening, by the second electronic device, a second distributed file corresponding to the first distributed file based on the name of the first distributed file; wherein the second distributed file is created by the second electronic device and corresponds to the first distributed file; obtaining, by the second electronic device, a second file handle object of the second distributed file, and returning, by the second electronic device, the result of executing the distributed application management service to the first electronic device based on the second file handle object.

[0029] In a possible implementation, the second electronic device receives the obtaining instruction from the first electronic device, and finds the first Binder ID of the distributed application management service based on the obtaining instruction, including:

[0030] The distributed Binder management module of the second electronic device receives the obtaining instruction from the first electronic device through the communication module of the second electronic device; wherein the obtaining instruction comprises the service name of the distributed application management service; the distributed Binder management module sends a searching instruction to the distributed service management module of the second electronic device in response to the obtaining instruction; wherein the searching instruction comprises the service name; the distributed service management module searches for the first Binder ID corresponding to the service name in response to the searching instruction;

[0031] In a possible implementation, the second electronic device sends the first Binder ID to the first electronic device, comprising: the distributed service management module sends the first Binder ID to the first electronic device through the communication module.

[0032] In a possible implementation, the first request is sent to the first electronic device based on the first Binder ID of the distributed application management service, comprising: the second application sends the first request to the system application framework of the second electronic device based on the first IBinder object; the system application framework sends the first request to the distributed Binder management module of the second electronic device;

[0033] The distributed Binder management module receives the first request and searches for the corresponding first Binder ID based on the first IBinder object; the distributed Binder management module sends the first request to the first electronic device through the preset wireless connection by using the communication module of the second electronic device; wherein the first request comprises the first Binder ID.

[0034] In a possible implementation, the second electronic device receives the second Binder ID of the first file providing object and creates a second file providing object based on the second Binder ID, comprising: the distributed Binder management module of the second electronic device receives the second Binder ID of the first file providing object sent by the first electronic device through the communication module, and creates a second file providing object based on the second Binder ID.

[0035] In a possible implementation, the second electronic device sends a second request to the first electronic device based on the second file providing object, wherein the second request contains the second Binder ID, including: the distributed Binder management module sends the second file providing object to the system application framework; the system application framework sends the second file providing object to the second application; the second application sends the second request to the distributed Binder management module based on the second file providing object; the distributed Binder management module receives the second request and finds the corresponding second Binder ID based on the second file providing object; and the distributed Binder management module sends the second request to the first electronic device through the communication module, wherein the second request contains the second Binder ID.

[0036] In a possible implementation, the second electronic device receives the name of the first distributed file sent by the first electronic device, including: the distributed Binder management module of the second electronic device receives the name of the first distributed file sent by the first electronic device through the communication module.

[0037] In a possible implementation, the second electronic device opens the corresponding second distributed file based on the name of the first distributed file, including: the distributed Binder management module opens the corresponding second distributed file in the distributed file module of the second electronic device based on the name of the first distributed file.

[0038] In a possible implementation, the second electronic device obtains a second file handle object of the second distributed file, and returns a result of executing the distributed application management service to the first electronic device based on the second file handle object, including:

[0039] The distributed file module sends the second file handle object of the second distributed file to the distributed Binder management module; the distributed Binder management module sends the second file handle object to the system application framework; the system application framework sends the second file handle object to the second application; and the second application returns the result of executing the distributed application management service to the first electronic device based on the second file handle object. In this way, each module in the electronic device interacts to implement the above-mentioned cross-device service call.

[0040] In a third aspect, the present application provides a cross-device service calling method, applied to a first electronic device, including: the first electronic device displays a display interface of a first application, and the display interface of the first application includes a plurality of device controls, each device control corresponding to a device that has established a preset wireless connection with the first electronic device, and each device control includes one or more services provided by the corresponding device; the first electronic device receives a first touch operation of a user on a target device control in the plurality of device controls, and the first touch operation corresponds to a target service of a second electronic device.

[0041] The first electronic device obtains a first Binder identifier ID corresponding to the target service from the second electronic device, and creates a second IBinder object based on the first Binder identifier ID; wherein the first Binder identifier ID is determined by the second electronic device when registering the target service according to a first IBinder object of the target service, and the first IBinder object and the second IBinder object are used to call the target service.

[0042] The first electronic device sends a calling request to the second electronic device based on the second IBinder object; wherein the calling request includes the first Binder identifier ID of the second IBinder object, and the calling request is used to request to call the target service of the second application in the second electronic device; the first electronic device receives a calling response from the second electronic device, and the calling response includes a result of calling the target service by the first electronic device.

[0043] By adopting the technical scheme, after the first electronic device receives the BinderId of the IBinder object corresponding to the service of the second electronic device, the IBinder object of the local end corresponding to the BinderId is created, and then the service of the second electronic device is called through the IBinder object of the local end, so that the cross-device service calling is realized.

[0044] In a fourth aspect, the present application provides a cross-device service calling method, applied to a second electronic device, and the method comprises the following steps: the second electronic device receives a calling request from a first electronic device; wherein the calling request includes a first Binder identifier ID of a second IBinder object, and the calling request is used to request to call a target service of a second application in the second electronic device; the second electronic device responds to the calling request, and finds a first IBinder object created for the target service when the second electronic device registers the target service according to the first Binder ID of the second IBinder object; the second electronic device calls the target service based on the first IBinder object, and feeds back a calling response to the first electronic device, and the calling response includes a result of calling the target service.

[0045] In a possible implementation, before the second electronic device receives the calling request from the first electronic device, the method further comprises the following steps: the second electronic device receives an acquisition instruction from the first electronic device, finds a first Binder ID of a distributed application management service based on the acquisition instruction; and the second electronic device sends the first Binder ID to the first electronic device.

[0046] In a possible implementation, before the second electronic device receives the obtaining instruction from the first electronic device, the method further includes: obtaining, by the second electronic device, a service name of the target service and a first IBinder object of the target service, and determining a corresponding first Binder ID based on the first IBinder object.

[0047] In the process of calling a certain service of the server (the second electronic device) by the client (the first electronic device), the application of the server may exit. For example, the application of the server exits due to some exception, or the application normally exits in response to a certain operation of the user. The above cases can be considered as that the application of the server has an exception, and at this time, the application of the client and the application of the server need to clean up the locally stored resources to avoid resource redundancy.

[0048] Optionally, a resource cleaning method can also be provided, which can be applied to the first electronic device. The method includes: registering, by the first electronic device, a cleaning service for a target service of the second electronic device; wherein the cleaning service is used to trigger the first electronic device to clean up calling resources of the target service and the cleaning service; the calling resources include resources used by the first electronic device when calling the corresponding service; sending, by the first electronic device, a registration indication of the cleaning service to the second electronic device based on a first IBinder object of the cleaning service; wherein the registration indication is used to instruct the second electronic device to register the cleaning service of the target service; and executing, by the first electronic device, the cleaning service based on the first IBinder object in response to receiving a first cleaning call request from the second electronic device; wherein the first cleaning request is sent by the second electronic device in response to the exit of the target service.

[0049] Through the scheme, the first electronic device can timely receive the message of the service exit of the second electronic device, and can timely clean up the stored resources to avoid resource redundancy in the first electronic device.

[0050] In a possible implementation, before the first electronic device registers the cleaning service for the target service of the second electronic device, the method further includes: displaying, by the first electronic device, a display interface of a first application, the display interface of the first application including a plurality of device controls, each device control corresponding to a device that has established a preset wireless connection with the first electronic device, and each device control including one or more services provided by the corresponding device; receiving, by the first electronic device, a first touch operation of a user on a target device control in the plurality of device controls, the first touch operation corresponding to the target service of the second electronic device.

[0051] The first electronic device obtains, in response to the first touch operation, a first Binder identification (ID) corresponding to the target service from the second electronic device, and creates a second IBinder object based on the first Binder ID; the first Binder ID is determined by the second electronic device when registering the target service according to a third IBinder object of the target service, and the second IBinder object and the third IBinder object are used to call the target service.

[0052] In a possible implementation, the first electronic device sends, to the second electronic device, a registration indication of the cleaning service based on the first IBinder object of the cleaning service, including: the first electronic device obtains the first IBinder object of the cleaning service based on the second IBinder object; the first electronic device creates a corresponding second Binder ID based on the first IBinder object, and sends the second Binder ID to the second electronic device; wherein the registration indication of the first cleaning service includes the second Binder ID.

[0053] In a possible implementation, the first electronic device executes the cleaning service based on the first IBinder object in response to receiving the first cleaning call request from the second electronic device, including: the first electronic device, in response to receiving the first cleaning call request, finds the corresponding first IBinder object according to the second Binder ID contained in the first cleaning call request; the first electronic device executes the cleaning service based on the first IBinder object.

[0054] In a possible implementation, before the first electronic device executes the cleaning service in response to receiving the first cleaning request from the second electronic device, the first electronic device further receives a registration message from the second electronic device; the registration message is used to indicate that the second electronic device has completed the registration of the cleaning service.

[0055] In a possible implementation, the calling resource includes a service name of the target service, the second IBinder object, the first Binder ID, and the first IBinder object of the cleaning service and the second Binder ID.

[0056] In a possible implementation, the first electronic device obtains the first IBinder object of the cleaning service based on the second IBinder object, including: the first application of the first electronic device obtains the first IBinder object of the cleaning service based on the second IBinder object.

[0057] In a possible implementation, the first electronic device creates a corresponding second Binder ID based on the first IBinder object, and sends the second Binder ID to the second electronic device, including: the first application sends the first IBinder object to the distributed Binder management module of the first electronic device; the distributed Binder management module creates a corresponding second Binder ID based on the first IBinder object, and sends the second Binder ID to the second electronic device through the communication module of the first electronic device.

[0058] In a possible implementation, the first electronic device, in response to receiving the first cleanup call request, finds the corresponding first IBinder object according to the second Binder ID contained in the first cleanup call request, including: the distributed Binder management module of the first electronic device receives the first cleanup call request through the communication module of the first electronic device, and finds the corresponding first IBinder object according to the second Binder ID contained in the first cleanup call request.

[0059] In a possible implementation, the first electronic device executes the cleanup service based on the first IBinder object, including: the distributed Binder management module invokes the cleanup service based on the first IBinder object, and cleans up the call resources of the target service stored in the distributed Binder management module; the distributed Binder management module sends a cleanup notification to the first application; and the first application, in response to the cleanup notification, cleans up the call resources of the target service and the cleanup service stored in the first application.

[0060] Optionally, another resource cleanup method can also be provided, which is applied to the second electronic device, and the method includes: the second electronic device receives a registration indication from the first electronic device; the registration indication is used to indicate that the second electronic device registers a cleanup service of a target service; the cleanup service is used to trigger the second electronic device to clean up call resources of the target service and the cleanup service; the call resources include resources used when the first electronic device calls the corresponding service; the second electronic device obtains a fourth IBinder object of the cleanup service; and the second electronic device, in response to the exit of the target service, executes the cleanup service based on the fourth IBinder object.

[0061] In a possible implementation, the method further includes: the second electronic device, in response to the exit of the target service, sends a first cleanup call request to the first electronic device based on the fourth IBinder object; and the first cleanup call request is used to instruct the first electronic device to clean up the call resources of the target service and the cleanup service.

[0062] It can be understood that the second electronic device can clean up the calling resources of the cleaning service after cleaning up the calling resources of the target service. The registration of the cleaning service here can represent the registration of the death notification.

[0063] In summary, the first electronic device and the second electronic device can clean up the locally stored calling resources to avoid resource redundancy.

[0064] In the above cross-device service calling method, cross-device data transmission is also involved.

[0065] Optionally, a cross-device data processing method can also be provided, which can be applied to the first electronic device. The method comprises: the first electronic device obtains a first IBinder object, and creates a corresponding Binder identifier ID based on the first IBinder object; wherein the first IBinder object is used to call a target service of the first electronic device; the first electronic device sends the Binder ID to the second electronic device, so that the second electronic device creates a corresponding second IBinder object based on the Binder ID, and the second IBinder object is used to call the target service by the second electronic device.

[0066] Through the present solution, when the parcel package contains complex objects such as Binder objects, the Binder objects in the parcel package can be replaced and then serialized, so that the two devices can access each other.

[0067] Optionally, another cross-device data processing method can also be provided, which is applied to the second electronic device, and the method comprises: the second electronic device receives the Binder identifier ID sent by the first electronic device; wherein the Binder ID is created by the first electronic device based on the first IBinder object, the first IBinder object is obtained by the first electronic device, and is used to call the target service of the first electronic device; the second electronic device creates a corresponding second IBinder object based on the Binder ID; wherein the second IBinder object is used to call the target service.

[0068] In summary, in the scenario of cross-device transmission of a Parcel package, if the Parcel package contains a Binder object, the Binder object can be replaced by a corresponding BinderId before serialization and transmission. That is, the local resource (Binder object) is replaced by a cross-device resource (BinderId) before serialization and transmission. After receiving the serialized parcel package at the other end, deserialization is performed to obtain the BinderId, and the BinderId is replaced by a locally created Binder object, thereby achieving cross-device transmission of a Parcel package containing a Binder object.

[0069] For example, in the process of the camera application of the second electronic device obtaining the FileProvider object of the note application of the first electronic device, the first electronic device assigns a corresponding BinderId to the FileProvider object (IFilePc object). Before serialization, the first electronic device can replace the IFilePc object in the data packet 1 (parcel package) with the corresponding BinderId to obtain a data packet 2. Then, the data packet 2 is serialized to obtain serialized data (parcel byte stream), which is then transmitted to the second electronic device through the network.

[0070] After receiving the serialized data (parcel byte stream), the second electronic device deserializes it to obtain the data packet 2. The second electronic device parses the data packet 2 to obtain the BinderId. Then, the second electronic device locally creates a reference object IFilePs object corresponding to the BinderId and writes the IFilePs object into the data packet 2 to obtain a data packet 3. In this way, cross-device transmission of a Parcel package containing a Binder object (FileProvider object) is achieved.

[0071] Optionally, another cross-device data processing method can also be provided, which can be applied to the first electronic device. The method includes: the first electronic device calling a target service of the second electronic device; the first electronic device obtaining a first file handle object of a preset file, and creating a first distributed file based on the first file handle object; wherein the preset file is used to save preset data, and the preset data is the result of the second electronic device executing the target service; the first distributed file and a second distributed file in the second electronic device are used to support data access between the first electronic device and the second electronic device, and the first file handle object is used for the first electronic device to return the preset data in the first distributed file to the preset file.

[0072] The first electronic device sends a file name of the first distributed file to the second electronic device, so that the second electronic device opens a corresponding second distributed file based on the file name, and the second distributed file is used to obtain preset data; the first distributed file of the first electronic device receives the preset data transmitted by the second distributed file of the second electronic device; and the first electronic device returns the preset data in the first distributed file to the preset file through the first file handle object.

[0073] By the scheme, when transmitting a complex object such as a file handle object, the file handle object is replaced and then transmitted, so that the devices at both ends can access each other.

[0074] Therefore, in the scenario of cross-device transmission of a Parcel package, if the Parcel package contains a file handle object, the file handle object is replaced by the name of a corresponding distributed file, and then serialized and transmitted. That is, the local resource (file handle object) is replaced by the cross-device resource (name of the distributed file) and then serialized and transmitted. After receiving the serialized Parcel package at the other end, deserialization is performed to obtain the name of the distributed file. Then, the corresponding distributed file is opened according to the name of the distributed file, and the file handle object of the locally created distributed file is obtained. Therefore, cross-device transmission of the Parcel package containing the file handle object can be implemented.

[0075] For example, in the process in which the camera application of the second electronic device obtains the file handle of the photo cache file of the note application of the first electronic device, the first electronic device creates a corresponding first distributed file for the file handle object. Before serialization, the first electronic device can replace the file handle object in the data packet 1 (Parcel package) with the name of the corresponding first distributed file to obtain a data packet 2. Then, the data packet 2 is serialized to obtain serialized data (Parcel byte stream), which is then transmitted to the second electronic device through the network.

[0076] After receiving the serialized data (Parcel byte stream), the second electronic device deserializes it to obtain the data packet 2. The second electronic device analyzes the data packet 2 to obtain the name of the distributed file. Then, the second electronic device opens a corresponding second distributed file according to the name of the distributed file, and obtains the file handle object of the second distributed file. The photo data obtained by the camera application is written into the second distributed file through the file handle object, and the second distributed file transmits the photo data to the first distributed file. The first distributed file returns the photo data to the photo cache file. Therefore, cross-device transmission of the Parcel package containing the file handle is implemented, and the result of the cross-device backhaul service is implemented.

[0077] In a fifth 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 processors are coupled; the memory is configured to store computer program codes, the computer program codes comprising computer instructions, when the computer instructions are executed by the electronic device, causing the electronic device to perform the method in the first aspect to the fourth aspect.

[0078] In a sixth aspect, the present application provides a computer readable storage medium, the computer readable storage medium stores instructions, when the instructions are executed on a computer, causing the computer to perform the method in any one of the first aspect to the fourth aspect.

[0079] In a seventh aspect, the present application provides a computer program product comprising instructions, when the instructions are executed on a computer, causing the computer to perform the method in any one of the first aspect to the fourth aspect.

[0080] In an eighth 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 in the first aspect or the second aspect or the third aspect or the fourth aspect.

[0081] It can be understood that the electronic device provided in the fifth aspect, the computer readable storage medium provided in the sixth aspect, the computer program product provided in the seventh aspect and the chip provided in the eighth aspect are all configured to perform the corresponding method provided above, and thus the beneficial effects achieved by the above-mentioned methods can be referred to the beneficial effects of the corresponding methods provided above, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS

[0082] Figure 1 A scene schematic diagram of inserting board content of offline classroom is provided for the embodiments of the present application;

[0083] Figure 2 A hardware structure schematic diagram of an electronic device is provided for the embodiments of the present application;

[0084] Figure 3 A software structure schematic diagram of an electronic device is provided for the embodiments of the present application;

[0085] Figure 4 A timing diagram of registering a service and obtaining the service is provided for the embodiments of the present application;

[0086] Figure 5 An interface display schematic diagram of a note application is provided for the embodiments of the present application;

[0087] Figure 6Another interface display schematic diagram of a note application provided by an embodiment of the present application is provided;

[0088] Figure 7 Another interface display schematic diagram of a note application provided by an embodiment of the present application is provided;

[0089] Figure 8 A timing diagram of calling a service interface provided by an embodiment of the present application is provided;

[0090] Figure 9 A schematic diagram of a cross-device service calling method provided by an embodiment of the present application is provided;

[0091] Figure 10 A timing diagram of registering a distributed application management service and obtaining a service provided by an embodiment of the present application is provided;

[0092] Figure 11 A schematic diagram of a first electronic device starting a camera of a second electronic device provided by an embodiment of the present application is provided;

[0093] Figure 12 A timing diagram of obtaining a File Provider object of a note provided by an embodiment of the present application is provided;

[0094] Figure 13 A timing diagram of obtaining a file handle of a note provided by an embodiment of the present application is provided;

[0095] Figure 14 A schematic diagram of a cross-device calling scenario provided by an embodiment of the present application is provided;

[0096] Figure 15 A data structure schematic diagram of a parcel provided by an embodiment of the present application is provided;

[0097] Figure 16 A schematic diagram of a cross-device data transmission method provided by an embodiment of the present application is provided;

[0098] Figure 17 A schematic diagram of another cross-device data transmission method provided by an embodiment of the present application is provided;

[0099] Figure 18 A schematic diagram of another cross-device data transmission method provided by an embodiment of the present application is provided;

[0100] Figure 19 A schematic diagram of another cross-device data transmission method provided by an embodiment of the present application is provided;

[0101] Figure 20 A flow schematic diagram of another cross-device data transmission method provided by an embodiment of the present application is provided;

[0102] Figure 21 A flowchart of a cross-device resource cleaning method provided by an embodiment of the present application is shown in FIG. 2;

[0103] Figure 22 A timing diagram of a cross-device service calling resource cleaning method provided by an embodiment of the present application is shown in FIG. 3;

[0104] Figure 23 A structural diagram of a chip system provided by an embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION

[0105] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0106] The terms "first", "second", etc. are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second", etc. can explicitly or implicitly include one or more of the features. In the description of the embodiments, unless otherwise specified, the meaning of "multiple" is two or more. In the present application, the character " / " generally indicates that the objects before and after are in an "or" relationship. For example, A / B can be understood as A or B.

[0107] In addition, the terms "include" and "have" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but can optionally include other steps or modules not listed, or can optionally include other steps or modules inherent to the process, method, product or device.

[0108] In addition, in the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design solution described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of "exemplary" or "for example" is intended to present concepts in a concrete manner.

[0109] For ease of understanding, the terms related to the embodiments of the present application are introduced here:

[0110] (1) Binder: from Android TMTo the application layer, Binder is a medium for the client and the server to communicate, wherein the server returns a Binder object containing the server business call, and through the Binder object, the client can obtain the services or data provided by the server.

[0111] The Binder mechanism supports intraprocess calls and interprocess calls. Remote calls (i.e., cross-process calls) of Android can be implemented through IBinder. IBinder is a basic interface used for remote calls. The main API of IBinder is transact(), and the corresponding method is Binder.onTransact(). The first method enables the local end to send a call to the remote IBinder object, and the second method enables the remote object of the local end to respond to the received call.

[0112] (2) Parcel: Parcel is a container for messages, and is used for data transmission through the Binder mechanism. It can carry serialized data for transmission through IPC and then deserialization at the destination. Parcel can also pass IBinder objects, and the destination will accept the proxy of the transmitted IBinder object.

[0113] Currently, for the sake of learning convenience, users usually use a tablet (Pad) or a personal computer (PC) to record and organize notes. Therefore, the user needs to obtain the content of the board writing in the offline classroom and insert it into the notes of the tablet or personal computer. Alternatively, when the user organizes the ideas of a thesis on a tablet or a personal computer, he or she often needs to obtain the content of the textbook and insert it into the tablet or personal computer.

[0114] However, since there is no rear camera on the personal computer, the user usually takes or scans the content of the board writing or the content of the textbook in the offline classroom through a mobile phone, uploads it to the personal computer, then downloads and saves it to the personal computer, and finally uploads it to the corresponding position of the notes. The user's operation is relatively complex, and the operation of switching between multiple devices and transferring data is relatively cumbersome.

[0115] Alternatively, the tablet is used to take pictures of the board writing, but the tablet is relatively bulky. At the same time, due to the limitation of device parameters, students in the back row (too far away) and students in the front row (too close to the blackboard, and need to use a wide-angle function to take pictures of the board writing) may not be able to take pictures of the board writing that meet the user's needs.

[0116] Thus, the application provides a cross-device service calling method, by which a user can use a first electronic device (such as a tablet or a personal computer) to send a shooting instruction to a second electronic device (such as a mobile phone). After receiving the shooting instruction, the mobile phone invokes a camera to perform a shooting or scanning task, and then returns the shooting result or the scanned text to the tablet or the personal computer.

[0117] As shown in Figure 1 , the main device can include a tablet and a personal computer, and the auxiliary device can include a mobile phone. The note application of the main device sends a shooting instruction or a scanning instruction to the auxiliary device in response to the operation of the user. After receiving the shooting instruction or the scanning instruction, the auxiliary device invokes a camera to perform a shooting or scanning task. After the shooting or scanning is completed, the auxiliary device returns the shooting result (a photo) or the scanning result (extracted text) to the note application of the main device.

[0118] Compared with the prior art, the above-mentioned remote calling between devices can realize different functions on the above-mentioned multiple devices, so as to reduce the switching between multiple devices when implementing the above-mentioned multiple functions. For example, the user can save the shooting result or the scanned text to the personal computer, and then download and save it to the corresponding position of the personal computer, and then upload it to the personal computer. The operation is more convenient, and the working efficiency of the user is improved. Moreover, the mobile phone can be used to shoot a photo of the board content that meets the user's demand.

[0119] Exemplarily, the electronic device in the embodiment of the 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, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, a vehicle-mounted device, and the like. The specific form of the electronic device is not specially limited in the embodiment of the application.

[0120] In the embodiment of the 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 the multiple different accounts are associated with each other. For example, the public device can be a television, a sound box, a tablet computer, and the like.

[0121] The execution subject of the cross-device service calling method provided in the application can be a device calling a service across devices, and the execution device can be Figure 2 The execution device can also be a central processing unit (CPU) of the electronic device or a control module for cross-device service calling in the electronic device. The cross-device service calling method is executed by the electronic device in the embodiments of the application, and the cross-device service calling method provided in the embodiments of the application is described.

[0122] The implementation of the embodiments of the application will be described in detail below with reference to the drawings. The hardware structure of the electronic device (such as the electronic device 300) is introduced by taking the electronic device as a mobile phone as an example. 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 2 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 2 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.

[0123] Please refer to Figure 2 , Figure 2 The structure of the electronic device is shown in the drawings, as shown in Figure 2 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 370C, a headset interface 370D, 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, and the like.

[0124] The sensor module 380 can include a pressure sensor, a gyroscope 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, and the like.

[0125] It can be understood that the structure illustrated 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 illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0126] 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. Among them, different processing units can be independent devices, or can be integrated in one or more processors.

[0127] 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.

[0128] The memory can also be provided in the processor 310, for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. The memory can save instructions or data that the processor 310 has just used or repeatedly uses. If the processor 310 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 310, thus improving the efficiency of the system.

[0129] 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.

[0130] It can be understood that the interface connection relationship between the modules shown in the embodiments is only illustrative and does not constitute a limitation on the structure of the electronic device 300. In other embodiments, the electronic device 300 can also use different interface connection manners or combinations of multiple interface connection manners.

[0131] 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.

[0132] The power management module 341 is configured to connect the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives the input of the battery 342 and / or the charging management module 340 to supply power to the processor 310, the internal memory 321, the external memory, the display screen 394, the camera 393, and the wireless communication module 360, etc. The power management module 341 can also be configured to monitor parameters such as the battery capacity, the battery cycle number, the battery health status (leakage, impedance), etc. In other embodiments, the power management module 341 can also be arranged in the processor 310. In other embodiments, the power management module 341 and the charging management module 340 can also be arranged in the same device.

[0133] The wireless communication function of the electronic device 300 can be implemented by the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor, the baseband processor, and the like.

[0134] The antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 300 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antennas can be used in combination with a tuning switch.

[0135] The mobile communication module 350 can provide a solution for wireless communication including 2G / 3G / 4G / 5G and the like applied to the electronic device 300. The mobile communication module 350 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communication module 350 can receive electromagnetic waves by the antenna 1, and perform filtering, amplification, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation.

[0136] The mobile communication module 350 can also amplify the signals modulated by the modem processor, and convert the signals into electromagnetic waves radiated by the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 350 can be arranged in the processor 310. In some embodiments, at least part of the functional modules of the mobile communication module 350 and at least part of the modules of the processor 310 can be arranged in the same device.

[0137] The wireless communication module 360 can provide a solution for wireless communication including wireless local area networks (WLAN) (such as a wireless fidelity (Wi-Fi) network), Bluetooth (BT), a global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, and the like, applied to the electronic device 300. 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.

[0138] 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, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to the processor 310. The wireless communication module 360 can also receive signals to be transmitted from the processor 310, frequency-modulate them, amplify them, and radiate them as electromagnetic waves via the antenna 2.

[0139] 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).

[0140] 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 that execute program instructions to generate or change display information.

[0141] 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 MicroLed, a Micro-oLed, a quantum dot light emitting diodes (QLED), or the like.

[0142] 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 digital signals, which can be digital image signals, 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 the 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.

[0143] The external memory interface 320 can be configured to connect an external memory card, such as a MicroSD 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.

[0144] 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.

[0145] 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.

[0146] 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.

[0147] 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.

[0148] 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.

[0149] The keys 390 include a power key, a volume key, and the like. The keys 390 can be mechanical keys. The keys 390 can also be touch keys. The motor 391 can generate a vibration prompt. The motor 391 can be used for incoming call vibration prompt, and can also be used for touch vibration feedback. The indicator 392 can be an indicator light, and can be used for indicating a charging state, a power change, and can also be used for indicating a message, a missed call, a notification, and the like. The SIM card interface 395 is used for connecting a SIM card. The SIM card can be inserted into or pulled out of the SIM card interface 395 to realize contact and separation with the electronic device 300. The electronic device 300 can support one or N SIM card interfaces, and N is a positive integer greater than 1. The SIM card interface 395 can support a Nano SIM card, a Micro SIM card, a SIM card, and the like.

[0150] Although Figure 2 Not shown, the electronic device 300 can also have a flash, a micro projection device, a near field communication (NFC) device, and the like, which will not be described here.

[0151] After introducing the hardware structure of the electronic device, the system architecture of the electronic device provided by the present application is introduced. The system architecture of the electronic device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes a layered architecture system as an example to exemplarily illustrate the software structure of the electronic device.

[0152] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the system is divided into five layers, and from top to bottom, the application layer, the system application framework layer, the collaborative service and scheduling layer, the communication module and device Profile layer, and the kernel layer.

[0153] Among them, the application program layer can include a series of application program packages. As Figure 3 shown, the application program package can include: notes, cameras, mail, schedules. The application program package can also include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, and the like.

[0154] As Figure 3As shown, the system application framework layer can include an Activity Manager Service (AMS), a Distributed Activity Manager Service (DAMS), a Package Manager Service (PMS), a Distributed Package Manager Service (DPMS), a Service Manager (SM), a Distributed Service Manager (DSM), and a system Binder framework. Among them, the AMS, the PMS, and the SM are system services in the Android system, and the related functions are not specifically introduced here. Among them, the DAMS, the DPMS, and the DSM are system functions newly added by the embodiments of the present application in the distributed system, and together they are a distributed application framework, used to process service calls between distributed applications.

[0155] Among them, the distributed application framework can provide a distributed application management service, used to register in the distributed service management module, to realize service calls and management between distributed applications.

[0156] As shown, Figure 3 The collaborative service and scheduling layer is used to provide management capabilities of remote services, including remote service registration and remote service acquisition. It is responsible for forwarding service calls between devices, and converting local resource references (anonymous Binder objects, file descriptors, etc.) into resource references between devices. Among them, the collaborative service and scheduling layer can include a distributed service management module, a distributed Binder management module, a distributed file management module, a transmission management module, and a device management module.

[0157] Among them, the distributed service management module includes a service registration module, a service management module, a service acquisition module, and a service lifecycle module. The service management module is used to manage multiple remote devices in the case where multiple remote devices exist.

[0158] The service registration module is used to register the target service by the service registration module of device 2 before device 1 calls the target service of device 2.

[0159] The service acquisition module is used to acquire the target service of device 2 by the service acquisition module of device 1 after the target service of device 2 is completely registered in the scenario where device 1 calls the target service of device 2.

[0160] The service life cycle module is configured to call services provided by the A device and the B device, wherein the A device can have two services and the B device can also have two services, and when a service on the A device or the B device is abnormal or dies, that is, the service exits, the service life cycle module of the device 1 needs to perform some processing on the exited service. The life cycle can be understood as a process of creation and closing.

[0161] The services listed in the distributed service management module are all named services, that is, all real-name services, and the corresponding Binder objects are all real-name Binders. When the service provider registers the service, the service is registered in the distributed service management module.

[0162] The distributed Binder management module includes a Binder management mapping module, a Binder access authentication module, and a Binder life cycle module.

[0163] The Binders in the distributed Binder management module are all anonymous Binders except the real-name Binders, so the scope is wider than that of the Binders in the distributed service management module. The anonymous Binder refers to a Binder that is not registered in the distributed service management module and is created by the application.

[0164] The Binder management mapping module is configured to manage Binder objects and involves mapping between local Binders and remote Binders.

[0165] The Binder access authentication module is configured to manage the Binder access authentication capability in the cross-device or distributed scenario.

[0166] The distributed file management module is responsible for cross-device file reading and writing. The distributed file management module is configured to manage distributed files, mainly to create files and open files, that is, involves message transmission between devices, and performs serialization and deserialization.

[0167] The distributed file management module mainly refers to the scenario of taking a photo, for example, the PC calls the photo taking capability of the mobile phone, and the actual photo cache file is created by the PC. Then, the mobile phone side acquires the file handle of the photo cache file of the PC side after taking a photo. After acquiring the file handle, the mobile phone side performs write operation on the photo cache file. That is, cross-device reading and writing are involved. The distributed file management module can provide cross-device file access.

[0168] Among them, the file handle is a relatively complex object, similar to the Binder object.

[0169] The transmission management module refers to a channel (session) created between devices, and messages are transmitted through the channel.

[0170] The device management module refers to the accessed device, and the device may have operations such as online or offline. Offline means that the device has been accessed and then offline, that is, no longer accessed, and all resources related to the device need to be cleaned up or other operations. Among them, one or more devices can be accessed.

[0171] As shown in Figure 3 The communication module and the device Profile (Device Profile) layer include a communication module, a device Profile module, and a distributed file module.

[0172] Among them, the communication module is responsible for transmission, including device discovery connection services and data transmission services, providing cross-device transmission interfaces, supporting automatic networking within the trust ring, one-to-many connection, and hibernating device wake-up. In the scene of cross-device calling, information transmission is performed between devices through the communication module.

[0173] The device Profile module is used to provide device information, provide service registration interfaces supported by the device, and other device query service interfaces.

[0174] The distributed file module, that is, the distributed file management mentioned above, is responsible for cross-device file reading and writing.

[0175] The kernel layer includes a Binder driver module, mainly used for cross-device communication.

[0176] The methods in the following embodiments can be implemented in an electronic device with the above hardware structure and the above system architecture.

[0177] In the embodiments of the present application, the first electronic device is taken as a client (main device), and the second electronic device is taken as a server (auxiliary device). The first electronic device can call the services of the second electronic device, wherein 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. Among them, the server (sever) refers to the side that provides services, and the client (client) refers to the side that wants to use the services provided by the server.

[0178] In a scenario where the first electronic device invokes the target service of the second electronic device, the second electronic device first registers the target service in the device itself, and then the first electronic device obtains the target service registered by the second electronic device. After the first electronic device successfully obtains the target service of the second electronic device, the first electronic device can invoke the service interface of the second electronic device.

[0179] Therefore, in the embodiments of the present application, the overall flow of the cross-device service invocation method mainly includes three parts: service registration of the second electronic device, service obtaining of the first electronic device, and service interface invocation of the first electronic device.

[0180] First, the service registration process of the second electronic device is introduced.

[0181] Taking a distributed application management service as an example, the target service registered by the second electronic device is a distributed application management service. The distributed application management service (target service) is in the system application framework, and the system application framework is started when the electronic device is powered on, that is, the distributed application management service is started. After the electronic device is powered on, the communication module is started. After the communication module is started, the service coordination module is started. Therefore, after the service coordination module is started, the second electronic device can register the distributed application management service in the service coordination module.

[0182] As shown in Figure 4 , the service registration process of the second electronic device includes that the target service of the second electronic device is registered in the distributed service management module (DistributedServiceManager) of the service coordination module of the second electronic device, the service name (ServiceName) and the IBinder object of the target service are stored in the distributed service management module, and the BinderId is allocated to the IBinder object.

[0183] Among them, the service name and IBinder are parameters, and one IBinder object can invoke one target service. After the first electronic device obtains the IBinder object of the target service of the second electronic device, the IBinder object can be used to invoke the interface of the corresponding target service, that is, the capability provided by the target service can be invoked.

[0184] Each service is provided with a corresponding service name (ServiceName), such as an AMS service, a camera service, an audio service, etc. The service name is registered in the service management module in the system. If in the distributed service scenario, the service name can be registered in the distributed service management module.

[0185] For example, the camera service is a system service, and the service name can be camera, or camera1, camera2. The camera service serves as a provider of a service, and has a corresponding IBinder object. The camera service can provide multiple interfaces, and different capabilities correspond to different interfaces. For example, the interfaces provided by the camera service can include opening the camera, taking a photo, and recording a video. Then, the above interfaces can be directly called through the corresponding IBinder object.

[0186] In the embodiments of the present application, a unique identifier (BinderId) can be allocated to the IBinder object, each Binder object has a BinderID, and the BinderId can establish a mapping relationship with the IBinder object. That is, the service of the server has a BinderId, and when the corresponding service is obtained at the client side, the BinderId can identify the relationship between the two. The mapping relationship can be understood as a key-value pair.

[0187] The BinderId can be allocated according to the device, for example, in the case of accessing multiple second electronic devices, the second electronic devices first set a device identifier (DeviceId), and then allocate BinderId to the services on each second electronic device. The device identifier can be pre-set.

[0188] Specifically, the BinderId can be allocated in a certain order. For example, the second electronic device A can provide services a (IBinder a), service b (IBinder b), the second electronic device B can provide service c (IBinder c), then the BinderId corresponding to IBinder a can be Binder1, the BinderId corresponding to IBinder b can be Binder2, and the BinderId corresponding to IBinder c can be Binder3. The form of BinderId is not limited to numbers, but can also be letters, characters, etc. When using numbers as BinderId, it is not necessarily from 1, but can also start from a specific number and increase sequentially.

[0189] In the embodiments of the present application, the second electronic device stores the service name and the IBinder object of the target service, and the second electronic device allocates BinderId to the IBinder object. Then, in the following steps, the target service can be obtained through the service name. The specific obtaining process is to determine the IBinder object through the service name, and after determining the IBinder object, the corresponding BinderId can be determined. The IBinder object and the BinderId are one-to-one correspondence.

[0190] It can be understood that the real-name service is to store the service name, IBinder object and BinderId in the service end. The above relationship is stored in the distributed service management module in the service end. The system service has a corresponding service name, and the service name is registered in the distributed service management module. Therefore, the system service is a real-name service.

[0191] The storage mode can be a list mode, as shown in Table 1.

[0192] Service Name IBinder Object BinderId Service S1 IBinder S1 BinderId S1 Service S2 IBinder S2 BinderId S2

[0193] Table 1

[0194] The storage mode can be a list mode, as shown in Table 1.

[0195] Service Name IBinder Object Service S1 IBinder S1 Service S2 IBinder S2

[0196] Table 2a

[0197] IBinder Object BinderId IBinder S1 BinderId S1 IBinder S2 BinderId S2

[0198] Table 2b

[0199] In the embodiment of the application, after the distributed Binder management module of the second electronic device allocates BinderId for the IBinder object and establishes the mapping relationship, it means that the target service of the second electronic device is registered successfully. The distributed Binder management module of the second electronic device can send the notification information of the registration success to the system application framework of the second electronic device. At this time, the first electronic device can obtain the target service registered by the second electronic device.

[0200] Secondly, the process that the first electronic device obtains the target service registered by the second electronic device is introduced. After the target service of the second electronic device is registered successfully, the first electronic device can obtain the target service registered by the second electronic device. It can be understood that before obtaining the target service, the first electronic device has opened the application, and the first electronic device responds to a certain operation of the user on the application interface to call out the device list and the capability list. That is to say, when the first electronic device receives the operation of the user, it can be considered that the user has the intention of cross-device calling, and therefore the target service needs to be obtained.

[0201] The application of the first electronic device can obtain a list of devices within a set range through interactions between devices. The distributed application framework of each device can determine whether a device has a collaborative service and scheduling module. If a device does not have a collaborative service and scheduling module, it does not have cross-device call capabilities and sends an empty message to the application of the first electronic device. In this case, the application interface of the first electronic device will not display the device name, or it will display the device name but distinguish it from other devices with cross-device call capabilities through a specific identifier.

[0202] In this embodiment, a call entry point is provided within the application of the first electronic device. For example, consider a note-taking application calling a camera application. Figure 5 As shown, the computer's note-taking application display interface 501 includes an insert button 502. After the user touches the insert button, the computer displays a list of server devices that can provide services and their corresponding capabilities on the display interface. The displayed devices can be a mobile phone 1 or a tablet 1. The capability list includes the services that the server device can provide, such as... Figure 5 Mobile phone 1 has functions for taking photos and scanning, while tablet 1 has functions for taking photos and scanning.

[0203] In some embodiments of this application, the display interface of the note-taking application can show all devices with cross-device calling capabilities within a set range. For example, if the set range of devices with cross-device calling capabilities includes mobile phone 1 and tablet 1. Figure 5 As shown, the devices displayed are mobile phone 1 and tablet 1, and the functions that mobile phone 1 and tablet 1 can provide, such as taking pictures and scanning.

[0204] In some embodiments of this application, the display interface of the note-taking application can also display all devices within a set range, and distinguish whether a device has cross-device calling capabilities through a set identifier. For example, devices without cross-device calling capabilities can be displayed in gray, while other devices with cross-device calling capabilities are displayed normally. Figure 6 As shown, if all devices within the set range are phone 1, phone 2, tablet 1, and tablet 2, they are represented by diagonal dashed lines and displayed in gray. Phone 1 and tablet 1 are displayed normally, indicating devices with cross-device calling capabilities, while phone 2 and tablet 2 are devices without cross-device calling capabilities.

[0205] In some embodiments of this application, the capability list corresponding to the device can also display all possible services, and distinguish whether a service is provided by the device by setting identification information, or only display the services that the device can provide.

[0206] In some embodiments of the present application, the display interface of the note application can first display a device list, and then in response to a touch operation on a device in the device list, display a capability list corresponding to the device. For example, as shown in Figure 7 The displayed device list includes mobile phone 1, mobile phone 2, tablet 1 and tablet 2. In response to a touch operation on mobile phone 1, a capability list corresponding to mobile phone 1 is displayed.

[0207] In embodiments of the present application, in response to an opening operation on an application of a first electronic device, an application interface is displayed, and then in response to a touch operation on a target button (such as the "insert" button in Figure 5 , the application interface of the first electronic device displays a device list and a corresponding capability list.

[0208] In some embodiments of the present application, in response to an opening operation on an application of a first electronic device, an application interface is displayed, and then in response to a touch operation on a target button (such as the "insert" button in

[0209] That is, the device list and the capability list are displayed before the service is obtained, and then in response to a touch operation of a user on a certain item in the list, such as a touch operation of the first electronic device on the camera service option of mobile phone 1 in the list of a certain application of the user, it can be determined that the corresponding second electronic device is mobile phone 1 and the target service is the distributed application management service. At this time, the first electronic device can start to obtain the distributed application management service of mobile phone 1.

[0210] As shown in Figure 4 , the process of the first electronic device obtaining the target service includes that the system application framework of the first electronic device initiates a request for obtaining the service to the distributed service management module of the first electronic device, and the request is initiated with a device identifier (DeviceId) and a service name (ServiceName).

[0211] In some embodiments of the present application, the first electronic device can establish a connection with the second electronic device according to the device identifier in the request. After the connection is established, the corresponding target service is searched from the second electronic device according to the service name in the request.

[0212] In some embodiments of the present application, the first electronic device can call the same service multiple times. Then, after the first electronic device acquires the service for the first time, the information of the acquired service can be cached locally. When the application of the first electronic device calls the service next time, the service name can be directly searched from the local cache. For example, the application 1 of the computer 1 calls the scanning service of the mobile phone 1 once. Then, when the application 1 of the computer 1 calls the scanning service next time, the name of the mobile phone 1 and the name of the distributed application management service can be directly searched from the local cache of the computer 1.

[0213] In some embodiments of the present application, if the target service is not found in the local cache, that is, the device name and the corresponding service name are not saved in the local cache. Then, the first electronic device can search for the corresponding target service in the second electronic device.

[0214] The specific steps of searching for the corresponding target service in the second electronic device include: creating a session between the first electronic device and the second electronic device. After the session is successfully created, the first electronic device searches for the corresponding target service from the second electronic device according to the service name.

[0215] The specific steps of creating the session include: after the session between the communication module of the first electronic device and the communication module of the second electronic device is successfully created, the communication module of the second electronic device sends a session creation success instruction to the distributed binder management module of the second electronic device, and the communication module of the first electronic device sends a session creation success instruction to the distributed binder management module of the first electronic device. The distributed binder management module is used to manage Binder objects.

[0216] The specific steps of searching for the corresponding service in the second electronic device according to the service name by the first electronic device include: the first electronic device sends the service name to be acquired to the target device through a message. After receiving the message, the second electronic device parses the service name according to the content of the message. Then, the second electronic device searches for the target service corresponding to the service name from the distributed service management module. The distributed service management module stores the correspondence between the service name and the IBinder object.

[0217] If the corresponding target service is found, the IBinder object corresponding to the target service is determined, and the IBinder object is returned to the first electronic device.

[0218] The communication module is a message receiving module and has a message receiving function. After the communication module of the second electronic device receives the message, the message can be parsed. If the message contains a service name, the message can be considered as a query type instruction message. Then, the service name in the message can be used to query the corresponding target service in the distributed service management module. If the distributed service management module stores a service name that is the same as the service name in the message, the corresponding target service is found. The second electronic device returns the IBinder object corresponding to the target service to the communication module of the second electronic device.

[0219] It can be understood that the distributed Binder management module of the second electronic device establishes a mapping relationship between the IBinder object and the BinderId. After the mapping relationship is successfully established, the distributed Binder management module of the second electronic device sends the mapping relationship to the distributed service management module, and the distributed service management module saves the mapping relationship. For details, refer to the arrow indication of Figure 4 The communication module of the second electronic device queries the distributed service management module according to the mapping relationship.

[0220] The second electronic device finds the corresponding IBinder object in the distributed service management module according to the service name, and then sends the IBinder object back to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device determines the BinderId corresponding to the IBinder object according to the established mapping relationship between the IBinder object and the BinderId. Then, the determined BinderId is sent to the communication module of the second electronic device.

[0221] That is, when the two devices really interact, the communication module of the second electronic device sends the BinderId to the communication module of the first electronic device.

[0222] It should be noted that the IBinder object of the target service generated by the second electronic device is actually not really sent to the client. Because the IBinder object has a system boundary, it only has a specific meaning on the second electronic device. The IBinder object can be understood as a pointer or address, and sending the IBinder object to the first electronic device has no actual meaning. Therefore, the second electronic device sends the BinderId to the first electronic device.

[0223] Specifically, the communication module of the second electronic device assembles a message after receiving the BinderID of the target service, and sends the message to the communication module of the first electronic device. That is, the message carries the BinderID of the target service.

[0224] The communication module of the first electronic device receives the message, that is, receives the BinderID of the target service carried in the message. The first electronic device creates a local IBinder object according to the BinderId. The distributed Binder management module of the first electronic device creates the local IBinder object according to the BinderId.

[0225] Then, the newly created IBinder object is returned to the application 1 of the first electronic device. Specifically, the newly created IBinder object is returned to the distributed service management module of the first electronic device, the system application framework, and finally returned to the application 1 of the first electronic device.

[0226] It can be understood that the newly created IBinder object of the first electronic device is created according to the BinderID carried in the received message, that is, the BinderId transmitted from the second electronic device to the first electronic device. The BinderId is constant. Then, the first electronic device newly creates a corresponding IBinder object according to the BinderId. That is, in the first electronic device, the BinderId and the new IBinder object also have a mapping relationship.

[0227] That is, in the embodiment of the present application, in order to enable the first electronic device to call the second electronic device, a virtual IBinder object is created for the first electronic device, and then corresponds to the received BinderId.

[0228] It should be noted that one service has a corresponding IBinder object, including several forms, one of which is the service itself, and the other is to provide a reference of a Binder object. Generally, the client obtains only the reference of the Binder object (i.e., Binder proxy). That is, the server sends to the system application framework of the client is an object of the Binder proxy type, that is, a proxy object is created in the client.

[0229] Finally, after the first electronic device obtains the target service, the first electronic device can call the service interface of the second electronic device. That is, after the first electronic device obtains the service provided by the application of the second electronic device, the interface of the service is called through the IBinder object.

[0230] Wherein, when the client calls the service interface of the server, a request of service call is sent to the server; after the server receives the request, the corresponding service interface is called, and a reply containing the call result is returned to the client.

[0231] Wherein, the request can contain an anonymous IBinder object or not contain an anonymous IBinder object. The anonymous IBinder object is an IBinder object that is not submitted to the distributed service management module for registration, and the anonymous IBinder object can call an anonymous service. When the client calls the service registered by the server, if a simple instruction is transmitted in the request, there is no further instruction (equivalent to that the request does not contain an anonymous IBinder object). If the returned result can be directly used, there is no further instruction (equivalent to that the reply does not contain an anonymous IBinder object), and if the returned result cannot be directly used, the returned result is further accessed or called (equivalent to that the reply contains an anonymous IBinder object).

[0232] For example, if the service provided by the second electronic device is a calculation service, taking a simple adder (a+b) as an example. For the application of the first electronic device, the input parameters are two numbers a and b, the interface of the service is called, and the result c can be directly obtained; wherein, the result c is a number and does not contain anything else. The above case is equivalent to that the request does not contain an IBinder object, and the reply (reply) does not contain an IBinder object.

[0233] For example, if the service provided by the second electronic device is a camera shooting service, after shooting, the application of the second electronic device (i.e., the camera) needs to return the shooting data to the application of the first electronic device (e.g., a note application), and needs to first obtain the file handle of the photo cache file of the note, and then write the shooting data into the photo cache file of the application of the first electronic device. Since the handle is a local resource of the first electronic device, it cannot be directly obtained. Therefore, the handle is managed in a certain service (e.g., a Provider service), and the second electronic device obtains the FileProvider object of the note, and then obtains the file handle through the object. The above case is equivalent to that the request does not contain an anonymous IBinder object, and the reply contains an anonymous IBinder object. It can be understood that in the process of the camera obtaining the FileProvider object of the note, the camera obtains the service of the note. Therefore, in the process of the camera obtaining the FileProvider object of the note, the camera is the client at this time, the note is the server at this time, the camera sends a request (i.e., obtaining the FileProvider object of the note) to the note, and the camera receives the reply (i.e., the FileProvider object of the note) returned by the client. The note obtains its own FileProvider object, which is not registered in the distributed application management service module, and is equivalent to an anonymous IBinder object.

[0234] For example, if the request sent by the client to the server contains an anonymous IBinder object, the server can call the interface provided by the IBinder object in the client after obtaining the IBinder object.

[0235] As shown in the steps of Figure 8 . It is assumed that the request does not contain an IBinder object, and the reply contains an IBinder object. It can be applied to the scenario that the first electronic device calls a certain service of the second electronic device, and the service returned by the second electronic device to the first electronic device can further call the first electronic device.

[0236] As shown in the steps of Figure 8 , when the application 1 of the first electronic device uses the Binder reference object to call the interface corresponding to the remote service, it enters the service cooperative distributed Binder management module, and the input parameters in the interface call can be encapsulated in a Parcel package (i.e., a Request Parcel).

[0237] The service coordination module parses the received Request Parcel package (set as Parcel 1) to determine whether it contains an IBinder object. If it does not contain an IBinder object, the Parcel package can be directly serialized. If it contains an IBinder object, the IBinder object is mapped and replaced, and then the Parcel package is serialized. Since it is assumed that the request does not contain an IBinder object, that is, after the Parcel 1 is parsed, it is determined that the Parcel 1 does not contain an IBinder object, the received Parcel 1 can be directly serialized.

[0238] After the Parcel 1 is serialized, the first electronic device can send the request (i.e., the Binder call request) to the second electronic device. It can be understood that the Parcel package is serialized, that is, the state of the object is serialized into a byte stream, and the byte stream can be transmitted across devices. Therefore, the Parcel 1 can be transmitted across devices, that is, from the first electronic device to the second electronic device.

[0239] Specifically, the communication module of the first electronic device can assemble a message (set as message 1), which carries the Binder call request (i.e., the Parcel 1 byte stream), and the communication module of the first electronic device sends the message 1 to the communication module of the second electronic device. The message 1 can include identification information, which is used to identify that the message 1 carries a Binder call of the first electronic device to the second electronic device. For example, some bytes in the byte stream can be used to represent the identification information. The second electronic device can determine the type of the request carried in the message 1 through the identification information, for example, determine that the request is a function call type through the identification information. The correspondence between the identification information and the request type can be preset.

[0240] The message 1 further includes the BinderId of the target service received by the first electronic device when obtaining the target service.

[0241] The communication module of the second electronic device receives and parses the message 1, and determines that the message 1 carries a Binder call request. That is, the second electronic device receives the request, deserializes the request, and calls the transact interface to execute the interface call of the service of the second electronic device. Specifically, the distributed Binder management module of the second electronic device processes the Parcel 1 byte stream. First, since the request previously assumed does not contain an IBinder object, the Parcel 1 byte stream can be directly deserialized. Then, it is detected again whether the IBinder object is contained. Since the anonymous IBinder object is not contained, the second electronic device can find the corresponding IBinder object according to the BinderId transmitted (according to the mapping relationship stored in the second electronic device), and then directly call the transact interface to perform the actual service call. That is, the second electronic device finds the target service according to the received BinderId, and calls the interface of the application where the target service is located.

[0242] After the interface call of the service of the second electronic device is completed, it is equivalent to that the actual method execution is completed, and a result is generated. The result is returned to the calling party (that is, the first electronic device) through a Parcel package (that is, a Reply Parcel). In the remote call scenario, the Reply Parcel (set as Parcel 2) needs to be returned to the first electronic device through the network.

[0243] When the second electronic device processes (parses) the Parcel 2, it can be determined that the Parcel 2 contains an IBinder object. The distributed Binder management module of the second electronic device allocates a BinderId for the IBinder object (that is, establishes a mapping relationship between the IBinder object and the BinderId), and caches it in the Binder list. Then, the distributed Binder management module of the second electronic device serializes the Parcel 2. Before serialization, the Binder object in the Parcel 2 is replaced with a BinderId, and other space padding placeholders belonging to the Binder object are filled.

[0244] Then, the serialized data (Parcel 2 byte stream) is sent to the first electronic device. Specifically, the distributed Binder management module of the second electronic device constructs a message (set as message 2), which carries a reply to the Binder call. The distributed Binder management module of the second electronic device sends the constructed message 2 to the communication module of the second electronic device, and the communication module of the second electronic device sends the message 2 to the communication module of the first electronic device.

[0245] The communication module of the first electronic device receives the message 2, parses the message 2, and obtains a message corresponding to the reply of the Binder call. Then, the communication module of the first electronic device sends the parsed message to the distributed Binder management module of the first electronic device for processing.

[0246] After the first electronic device receives the Parcel2 byte stream (i.e., the reply parcel byte stream of the Binder call), the first electronic device processes the Parcel2 byte stream. That is, the distributed Binder management module of the first electronic device processes the Parcel2 byte stream. Specifically, the first electronic device deserializes the Parcel2 byte stream to obtain a Parcel2 object. Then, the first electronic device can determine that the IBinder object is contained in the Parcel2, that is, the corresponding BinderId is written in the Parcel2 by parsing the Parcel2. Therefore, the first electronic device can obtain the BinderId of the second electronic device, create a local Binder reference object of the first electronic device, and establish a mapping relationship between the BinderId and the local Binder reference object. Then, the distributed Binder management module of the first electronic device writes the created Binder reference object into a new reply parcel and returns the new reply parcel to the application 1 of the first electronic device.

[0247] In summary, the embodiment of the present application provides a cross-device service calling method. After the first electronic device receives the BinderId of the IBinder object corresponding to the service of the second electronic device, the first electronic device creates a local IBinder object corresponding to the BinderId, and then calls the service of the second electronic device through the local IBinder object, thereby realizing cross-device service calling.

[0248] In the embodiment of the present application, the cross-device service calling method can be applied to the scenario that the first electronic device calls the photographing service of the second electronic device. 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.

[0249] If the first electronic device is a personal computer, taking the scenario that the application (e.g., a note) of the first electronic device calls the photographing service of the application (e.g., a camera) of the second electronic device as an example, the cross-device service calling method is introduced.

[0250] In a scenario where the note-taking application of the first electronic device invokes the camera application's photo-taking service of the second electronic device, the second electronic device first registers with the distributed application management service within its own device. Then, the first electronic device obtains the registered distributed application management service from the second electronic device. After the first electronic device successfully obtains the second electronic device's distributed application management service, its note-taking application launches the second electronic device's camera application. The camera application takes a picture of the specified content, and the second electronic device then transmits the captured data to the first electronic device's note-taking application.

[0251] Therefore, the overall process of the aforementioned cross-device service invocation method can include three parts: service registration by the second electronic device, service acquisition by the first electronic device, and service data (photograph data) being sent back from the second electronic device to the first electronic device. The service registered by the second electronic device at this point is a distributed application management service. For example... Figure 9 As shown, Figure 9 This is a flowchart illustrating a cross-device service invocation method provided in an embodiment of this application.

[0252] like Figure 9 In the illustrated process, the first electronic device displays the interface of the first application, receives first touch operations from the user on multiple target device controls, and sends an acquisition command to the second electronic device, which is to acquire the distributed application management service registered by the second electronic device. The second electronic device receives the acquisition command from the first electronic device, looks up the BinderID of the distributed application management service based on the command, and sends the BinderID to the first electronic device. The first electronic device acquires the BinderID of the distributed application management service and creates an IBinder object based on that BinderID (see reference). Figure 9 (Steps S101-S103). That is, the specific process of the second electronic device registering for service and the first electronic device obtaining service, which will be described in detail below.

[0253] Please see Figure 10 , Figure 10 This is a sequence diagram showing the service registration process for the second electronic device and the service acquisition process for the first electronic device. First, the service registration process for the second electronic device is introduced.

[0254] The distributed application management service is located within the system application framework. When the electronic device powers on, the system application framework, including the distributed application management service, is started. After the electronic device powers on, the communication module starts. Following the communication module, the service collaboration module starts. Therefore, after the service collaboration module starts, the second electronic device can register the distributed application management service with the service collaboration module.

[0255] The service registration procedure of the second electronic device, i.e., the registration procedure of the distributed application management service of the second electronic device, specifically includes: the distributed application management service of the second electronic device is registered in a distributed service manager (see step 1 in Figure 10 ). The distributed application management service is started in the system application framework after the second electronic device is powered on.

[0256] The service name (for example, “DisApp”) and the IBinder object (for example, “IBinder S1”) of the distributed application management service are stored in the distributed service manager. Then, the service name and the IBinder object are sent to a distributed Binder management module. The distributed Binder management module caches the IBinder object (IBinder S1) and allocates a BinderId (for example, “Binder S1”) for the IBinder object. That is, the IBinder S1 and the Binder S1 establish a mapping relationship (see step 1.1.1 in Figure 10 ). Then, the distributed Binder management module returns the registration result to the system application framework (see step 1.2 in Figure 10 ).

[0257] In the embodiment of the present application, after the distributed Binder management module of the second electronic device allocates the BinderId for the IBinder object and establishes the mapping relationship, it indicates that the registration of the distributed application management service of the second electronic device is successful. The distributed Binder management module of the second electronic device can send the notification information of the successful registration to the system application framework of the second electronic device. At this time, the first electronic device can obtain the distributed application management service registered by the second electronic device.

[0258] The application (for example, the camera application) is an interface provided by the distributed application framework in the system application framework. After the first electronic device obtains the distributed application management service registered by the second electronic device, the first electronic device can call the camera application of the second electronic device through the distributed application framework and can obtain the service provided by the camera application.

[0259] Secondly, the procedure of the first electronic device obtaining the service is introduced. After the registration of the distributed application management service of the second electronic device is successful, the first electronic device can obtain the distributed application management service registered by the second electronic device.

[0260] It can be understood that before the photographing service is acquired, the first electronic device has opened the note application, and the first electronic device invokes the device list and the capability list in response to the touch operation of the user on the invoking entry of the note application interface. That is, when the first electronic device receives the operation of the user, it can be considered that the user has the intention of cross-device invocation, and therefore the distributed application management service provided by the second electronic device needs to be acquired.

[0261] In the note application of the first electronic device, an invoking entry is provided. As shown in Figure 5 , an insert button is provided in the display interface of the note application of the computer, and the computer displays the second electronic device that can provide the service and the capability list corresponding to the device in the display interface in response to the touch operation of the user on the insert button. The displayed device can be the mobile phone 1 and the tablet 1. The capability list includes the services that can be provided by the second electronic device, such as Figure 5 corresponding to the mobile phone 1, and the photographing, scanning, etc. corresponding to the tablet 1.

[0262] In some embodiments of the present application, the first electronic device can be the first time to invoke the photographing service of the camera of the second electronic device, or there can be multiple invocations. Therefore, after the first electronic device acquires the photographing service of the camera for the first time, the invocation information of the acquired photographing service can be cached in the local. Therefore, the first electronic device can first search the second electronic device and the distributed application management service from the local cache, and if found, return directly to the note application, and if not found, search from the second electronic device.

[0263] The following describes in detail the process of acquiring the distributed application management service when the first electronic device invokes the photographing service of the camera of the second electronic device for the first time according to an embodiment of the present application.

[0264] In the present embodiment, after the distributed application management service of the second electronic device is successfully registered, and in response to the touch operation of the user on the invoking entry of the note application interface, the note application of the first electronic device can acquire the distributed context of the second electronic device, that is, acquire the “DisApp” service of the second electronic device (refer to step 2.1 of Figure 10 ). Figure 10 Specifically, the system application framework of the first electronic device sends a request for acquiring the “DisApp” service to the distributed service management module of the first electronic device, and then the distributed service management module of the first electronic device sends a request for acquiring the “DisApp” service to the message center (Message Center) - communication module of the first electronic device (refer to step 2.2 of Figure 10 ).

[0265] After receiving a request to obtain the "DisApp" service, the communication module of the first electronic device creates a session with the first electronic device (see [reference]). Figure 10 Step 2.2.1). After the channel is successfully created, the distributed service management module of the first electronic device sends an instruction to the communication module of the first electronic device to obtain the "DisApp" service (refer to...). Figure 10 Step 2.2.2). The communication module of the first electronic device receives the instruction to obtain the "DisApp" service, assembles a message, and sends the message to the communication module of the second electronic device.

[0266] After receiving the message, the communication module of the second electronic device parses the message and obtains the instruction to obtain the "DisApp" service (see reference). Figure 10 Step 2.2.3). The communication module of the second electronic device sends this instruction to the distributed Binder management module of the second electronic device (refer to...). Figure 10 Step 2.2.4).

[0267] After receiving the instruction, the distributed Binder management module of the second electronic device searches for the "DisApp" service in the distributed service management module. As mentioned in step 1.1, the distributed service management module stores service names and corresponding IBinder objects. Therefore, the distributed Binder management module can search its database to see if the service ("DisApp") is stored based on the service name in the instruction. If the service ("DisApp") is found, the corresponding IBinder object (IBinder S1) is determined.

[0268] Then, the distributed service management module of the second electronic device returns the IBinder object (IBinder S1) to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device determines the BinderId (BinderId S1) corresponding to the IBinder object (IBinder S1) based on the established mapping relationship between IBinder objects and BinderIds (see reference). Figure 10 Step 2.2.4). Then, the BinderId (BinderId S1) is sent to the communication module of the second electronic device (see step 2.2.4). Figure 10 Step 2.2.5).

[0269] The communication module of the second electronic device, after receiving the BinderId (BinderId S1) of the "DisApp" service, assembles a message (the message carries BinderId S1) and sends the message to the communication module of the first electronic device.

[0270] The communication module of the first electronic device receives the message and parses the information content to obtain the BinderId (BinderId S1) of the "DisApp" service (see step 2.2.6 of Figure 10 ). The communication module of the first electronic device sends the BinderId (BinderId S1) of the "DisApp" service to the distributed service management module of the first electronic device. The distributed service management module of the first electronic device sends the BinderId (BinderId S1) of the "DisApp" service to the distributed Binder management module of the first electronic device. Then, the distributed Binder management module newly creates a corresponding local IBinder object (IBinder C1) according to BinderId S1, that is, the distributed Binder management module creates a mapping relationship between BinderId S1 and IBinder C1 and stores the mapping relationship (see step 2.2.7 of Figure 10 ).

[0271] Then, the distributed Binder management module of the first electronic device returns the service name ("DisApp") and the corresponding IBinder object (IBinder C1) to the communication module of the first electronic device, the system application framework (see step 2.2.8 of Figure 10 ), and finally to the note application of the first electronic device (see step 2.3 of Figure 10 ).

[0272] In the embodiment of the present application, after the first electronic device obtains the "DisApp" service registered by the second electronic device, the first electronic device opens the camera application of the second electronic device.

[0273] The specific process in which the note application of the first electronic device opens the camera application of the second electronic device is as follows:

[0274] As shown in Figure 11As shown, the note application sends a start activity for result (intent) message to the system application framework of the first electronic device, and the Intent contains the uri and device information. The note application calls through the locally created IBinder C1, and the input parameters (uri and device information) in the message are encapsulated in parcel A, and the system application framework sends parcel A to the distributed Binder management module in the service collaboration module of the first electronic device. The distributed Binder management module parses parcel A, and it can be determined that there is no IBinder object in parcel A, and parcel A can be directly serialized to obtain a parcel A byte stream.

[0275] The service collaboration module of the first electronic device sends the parcel A byte stream (request) to the service collaboration module of the second electronic device. Specifically, the communication module of the first electronic device sends the parcel A byte stream to the communication module of the second electronic device. The communication module of the second electronic device forwards the parcel A byte stream to the distributed Binder management module in the service collaboration module of the second electronic device. The distributed Binder management module deserializes the parcel A byte stream to obtain parcel A.

[0276] The distributed Binder management module of the second electronic device sends parcel A (request) to the system application framework of the second electronic device. The system application framework of the second electronic device sends a start activity message to the camera application, and calls the start activity method through the locally created IBinder S1 to start the camera. Then, the system application framework encapsulates the result data (camera opening) returned by the camera application in parcel A' (reply), and sends it to the distributed Binder management module in the service collaboration module of the second electronic device. The distributed Binder management module parses parcel A', and it can be determined that there is no IBinder object in parcel A', and parcel A' can be directly serialized to obtain a parcel A' byte stream.

[0277] The service coordination module of the second electronic device sends the parcel A' byte stream to the service coordination module of the first electronic device. Specifically, the communication module of the second electronic device sends the parcel A' byte stream to the communication module of the first electronic device. The communication module of the first electronic device forwards the parcel A' byte stream to the distributed Binder management module in the service coordination module of the first electronic device. The distributed Binder management module deserializes the parcel A' byte stream to obtain the parcel A'.

[0278] The distributed Binder management module of the first electronic device sends the parcel A' to the system application framework of the first electronic device. At this time, the camera is successfully turned on.

[0279] After the first electronic device obtains the "DisApp" service registered by the second electronic device and the camera application of the second electronic device is opened, the user uses the camera application to take a picture of the information that needs to be returned to the note. The camera application returns the obtained picture data to the note in response to the user's operation. For example, the board content of the offline class is inserted in the note application. After the camera application is opened, the user uses the camera to take a picture of the board content. The camera obtains the board picture (picture data of the board content) in response to the user's click operation on the shooting button. Then, the camera returns the board picture to the note.

[0280] The camera obtains the picture in response to the user's click operation on the shooting button, and then can confirm whether the picture meets the user's demand. The camera obtains the confirmed picture in response to the user's click operation on the confirmation button, that is, after confirming that the picture meets the user's demand. The camera returns the confirmed picture to the note. That is, after the camera responds to the user's click operation on the confirmation button, the camera returns the picture data to the note of the first electronic device.

[0281] For the camera, when the picture data needs to be returned to the note application after shooting, the file handle of the picture cache file of the note needs to be obtained first, and then the picture data is written back to the picture cache file of the client application. Since the handle is a local resource of the first electronic device, it cannot be directly obtained. Therefore, the file handle can be hosted in a certain service (such as a Provider service), and the camera obtains the file handle through the File Provider object (file providing object) of the note. It can be understood that the camera application sends a simple request to the note application, and the result returned by the note application to the camera application is an object that needs to be further called. The above case is equivalent to that the request does not contain an anonymous IBinder object, and the reply contains an anonymous IBinder object.

[0282] Therefore, the specific steps for the second electronic device to send service data (photo data) back to the first electronic device include: the camera application obtaining the IContent Provider object (i.e., File Provider object) of the note-taking application; the camera application obtaining the file handle of the photo cache file of the note-taking application; and the camera application writing the photo data back to the first electronic device. Here, the photo data refers to the result of the second electronic device executing the distributed application management service.

[0283] The note-taking application of the first electronic device can create a photo cache file (File Provider) with a Uniform Resource Identifier (URI). Specifically, the photo cache file has a File Provider (equivalent to a binder object), which the note-taking application registers with the system application framework. The note-taking application can create the photo cache file in response to a user's touch operation on the camera options, or it can create the photo cache file at any time before obtaining its file handle.

[0284] Please see Figure 12 , Figure 12 A timing diagram of a File Provider object for obtaining notes, provided in an embodiment of this application. For example... Figure 12 As shown, when the camera application uses IBinder S1 to call the corresponding interface of the note application, it enters the distributed Binder management module of the service collaboration module. The input parameters in the interface call (by calling the transact method) can be encapsulated in the Parcel package (i.e., the request parcel).

[0285] The distributed Binder management module of the service collaboration module processes the request parcel (denoted as reqA) (see reference). Figure 12 Step 1.3). Specifically, first, it is determined whether reqA contains an anonymous IBinder object. By parsing reqA, it can be determined that reqA does not contain an anonymous IBinder object. This is understandable, since reqA is only used to retrieve the File Provider object for notes and does not require further calls, reqA does not contain an anonymous IBinder object. Then, the distributed Binder management module can directly serialize reqA.

[0286] The distributed Binder management module of the second electronic device receives the message and parses it, and determines that the message carries a Binder call request. Then the message is sent to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device parses the message and obtains the reqA byte stream (i.e. the serialized reqA). The distributed Binder management module of the second electronic device deserializes the reqA byte stream and obtains reqA. The distributed Binder management module of the second electronic device finds the corresponding local IBinder object (IBinder C2) according to the received BinderId S1. Then the transact is called to perform an actual service call (i.e. to obtain the File Provider object of the camera application).

[0287] The distributed Binder management module of the second electronic device receives the message and parses it, and determines that the message carries a Binder call request. Then the message is sent to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device parses the message and obtains the reqA byte stream (i.e. the serialized reqA). The distributed Binder management module of the second electronic device deserializes the reqA byte stream and obtains reqA. The distributed Binder management module of the second electronic device finds the corresponding local IBinder object (IBinder C2) according to the received BinderId S1. Then the transact is called to perform an actual service call (i.e. to obtain the File Provider object of the camera application).

[0288] The distributed Binder management module of the second electronic device receives the message and parses it, and determines that the message carries a Binder call request. Then the message is sent to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device parses the message and obtains the reqA byte stream (i.e. the serialized reqA). The distributed Binder management module of the second electronic device deserializes the reqA byte stream and obtains reqA. The distributed Binder management module of the second electronic device finds the corresponding local IBinder object (IBinder C2) according to the received BinderId S1. Then the transact is called to perform an actual service call (i.e. to obtain the File Provider object of the camera application). Figure 12 The distributed Binder management module of the second electronic device receives the message and parses it, and determines that the message carries a Binder call request. Then the message is sent to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device parses the message and obtains the reqA byte stream (i.e. the serialized reqA). The distributed Binder management module of the second electronic device deserializes the reqA byte stream and obtains reqA. The distributed Binder management module of the second electronic device finds the corresponding local IBinder object (IBinder C2) according to the received BinderId S1. Then the transact is called to perform an actual service call (i.e. to obtain the File Provider object of the camera application). Figure 12 The distributed Binder management module of the second electronic device receives the message and parses it, and determines that the message carries a Binder call request. Then the message is sent to the distributed Binder management module of the second electronic device. The distributed Binder management module of the second electronic device parses the message and obtains the reqA byte stream (i.e. the serialized reqA). The distributed Binder management module of the second electronic device deserializes the reqA byte stream and obtains reqA. The distributed Binder management module of the second electronic device finds the corresponding local IBinder object (IBinder C2) according to the received BinderId S1. Then the transact is called to perform an actual service call (i.e. to obtain the File Provider object of the camera application).

[0289] Then, the first electronic device sends the serialized repB1 (i.e., repB1 byte stream) to the second electronic device. Specifically, the distributed Binder management module of the first electronic device constructs a message carrying the repB1 byte stream. The distributed Binder management module of the first electronic device sends the constructed message to the communication module of the first electronic device, and then the communication module of the first electronic device sends the message to the communication module of the second electronic device.

[0290] After the communication module of the second electronic device receives the message, the communication module of the second electronic device parses the message to obtain a message corresponding to repB1. Then, the communication module of the second electronic device sends the parsed message to the distributed Binder management module of the second electronic device for processing.

[0291] That is, the distributed Binder management module of the second electronic device processes the repB1 byte stream. Specifically, the repB1 byte stream is first deserialized to obtain the repB1 object. Then, since the second electronic device can determine that the repB1 contains the IBinder object, i.e., the corresponding BinderId2 is written in the repB1 by parsing the repB1, the second electronic device can obtain the BinderId2 of the first electronic device, and then create an IFilePs object of the second electronic device (denoted as IFilePs), wherein the BinderId2 and the IFilePs object of the second electronic device establish a mapping relationship. Then, the distributed Binder management module of the second electronic device writes the created IFilePs object into a reply packet (denoted as repB2) and returns the camera application (see step 1.8 of Figure 12 .

[0292] At this time, the second electronic device obtains the File Provider object of the note application. Then, the second electronic device can obtain the file handle of the photo cache file of the note through the File Provider object.

[0293] Please refer to Figure 13 , Figure 13 the timing diagram provided by the embodiments of the present application for obtaining the file handle of the photo cache file of the note. As shown in Figure 13 , when the camera application uses the IFilePs object to call the interface corresponding to the note application, the distributed Binder management module of the service coordination module is entered, and the input parameters in the interface call (by calling the transact method) can be encapsulated in a Parcel packet (i.e., a request parcel).

[0294] The distributed Binder management module of the service collaboration module processes the request parcel (denoted as reqD) and reqD (see reference). Figure 13 Step 1.3). Specifically, first, it is determined whether reqD contains an anonymous IBinder object. By parsing reqD, it can be determined that reqD does not contain an anonymous IBinder object. It is understandable that since reqD is only used to obtain the file handle of the notes and does not require further calls, it can be determined that reqD does not contain an anonymous IBinder object. Then, the distributed Binder management module can directly perform serialization processing on reqD.

[0295] After the distributed Binder management module serializes reqD, it forwards the call request (reqD byte stream) to the communication module of the second electronic device. The communication module of the second electronic device then assembles a message and sends the reqD byte stream, which contains BinderId2, to the communication module of the first electronic device.

[0296] The communication module of the first electronic device receives and parses the message, determining that it carries a Binder call request. It then sends the message to the Binder management module of the first electronic device. The Binder management module parses the message, obtaining the serialized `reqD` (a byte stream), and deserializes the `reqD` byte stream to obtain `reqD` again. The distributed Binder management module of the first electronic device finds the corresponding local IBinder object (`I FilePc`) based on the received `BinderId2`. Then, it calls `transact` to perform the actual service call (i.e., obtain the file handle of the note).

[0297] The note-taking application on the first electronic device writes the file descriptor object Fdc into a Parcel package, i.e., Reply Parcel (denoted as repE), and then returns repE to the camera application on the second electronic device. Specifically, the note-taking application calls onTransact (see... Figure 13 Step 1.6). The distributed Binder management module of the first electronic device processes the repE. Specifically, it checks if the repE contains an Fdc (equivalent to a Binder object), and then sends an instruction to create a distributed file to the distributed file module of the first electronic device (see...). Figure 13Step 1.6.2 of the first embodiment. It is understood that the file can be accessed by a file handle, such as opening the file, closing the file, reading and writing the file, etc. Therefore, after the camera application obtains the file handle, the camera application can write the picture data into the actual file. Since the actual file is located at the device side of the note application, the camera application is a cross-device read and write, and therefore a distributed file (the distributed file module can provide cross-device file access) can be created to ensure that the data is written into the file at the device side of the note application from the camera side.

[0298] After the distributed file is successfully created, the distributed Binder management module of the first electronic device writes the name of the distributed file into the location of the original Fdc in repE and occupies the location, to generate repE1 (refer to Figure 13 Step 1.6.4 of the first embodiment). Then, the distributed Binder management module serializes repE1.

[0299] Then, the first electronic device sends the serialized repE1 (i.e., repE1 byte stream) to the second electronic device. Specifically, the distributed Binder management module of the first electronic device constructs a message carrying repE1. The distributed Binder management module of the first electronic device sends the constructed message to the communication module of the first electronic device, and then the communication module of the first electronic device sends the message to the communication module of the second electronic device.

[0300] After the communication module of the second electronic device receives the message, the communication module of the second electronic device parses the message to obtain the message corresponding to repE1. Then, the communication module of the second electronic device sends the parsed message to the distributed Binder management module of the second electronic device for processing.

[0301] That is, the distributed Binder management module of the second electronic device processes the repE1 byte stream. Specifically, the distributed Binder management module of the second electronic device deserializes the repE1 byte stream to obtain the repE1 object. Then, the distributed Binder management module can detect that the repE1 contains the name of the distributed file, that is, the repE1 contains the information corresponding to the file handle. The second electronic device can read the name of the distributed file (DisPicture) in repE1 and open the corresponding distributed file (refer to Figure 13 Step 1.7.2 of the first embodiment).

[0302] Then, the distributed file module of the second electronic device returns the file handle VFd of the distributed file to the distributed Binder management module of the second electronic device. The distributed Binder management module writes the file handle VFd into a reply packet (set as repE2) and returns to the camera application (refer to step 1.8 of Figure 13

[0303] At this time, the second electronic device has obtained the file handle VFd of the note application. Then, the camera application can write the photographing data back to the first electronic device, i.e., the camera application writes the photographing data into the distributed file of the second electronic device through the file handle, and then into the distributed file of the first electronic device, and finally returns to the note application of the first electronic device.

[0304] That is, a channel can be created between the distributed file modules of the first electronic device and the second electronic device. After the camera application calls the write data interface of the distributed file of the second electronic device through the file handle, the photographing data is written, transmitted to the distributed file of the first electronic device through the channel created above, and then returned to the note.

[0305] The above step of returning the photographing data to the first electronic device is also Figure 9 S104-S110 in FIG. 10. Specifically, the second electronic device sends a request to the first electronic device based on the first BinderID of the distributed application management service in response to the second touch operation of the user on the second application, the first electronic device finds the corresponding IBinder object according to the BinderID contained in the request in response to receiving the request from the second electronic device. The first electronic device indicates the first file providing object to the second electronic device according to the IBinder object, i.e., sends the BinderID corresponding to the first file providing object to the second electronic device. The second electronic device creates a local corresponding second file providing object according to the BinderID corresponding to the first file providing object received. The second electronic device initiates a request to the first electronic device according to the second file providing object, and obtains a file handle object. The first electronic device indicates the first file handle object to the second electronic device in response to receiving the request, i.e., sends the name of the distributed file corresponding to the first file handle object to the second electronic device. The second electronic device receives the indicated first file handle object, i.e., receives the name of the corresponding distributed file, opens the corresponding distributed file, returns the result of the execution service to the distributed file, and then returns the result to the first electronic device.

[0306] ​In summary, in the cross-device service calling method described above, through the interaction between various modules inside the device, the user can directly use the first electronic device to send a shooting instruction to the second electronic device. After receiving the shooting instruction, the second electronic device invokes the camera to perform a shooting or scanning task, and after the task is completed, the shooting result or the scanned text is directly returned to the first electronic device. The step of uploading the shooting result or the scanned text to the first electronic device, then downloading and saving it to the first electronic device, and then uploading it to the corresponding position of the first electronic device can be saved, the operation is more convenient, and the user's work efficiency is improved.

[0307] Please refer to Figure 14 , Figure 14 A cross-device calling scenario diagram is provided, as shown in Figure 14 , the display interface of the notebook application of the computer is provided with an insert button. After the computer responds to the touch operation of the user on the insert button, the display interface displays the server device that can provide services and the corresponding capability list of the device. Among them, the displayed devices can be mobile phone 1 and tablet 1. The capability list includes the services that the server device can provide, such as Figure 14 the corresponding photographing, scanning, etc. of mobile phone 1, and the corresponding photographing, scanning, etc. of tablet 1. After the computer responds to the click operation of the user on the photographing option in mobile phone 1, it sends an instruction to open the camera application to mobile phone 1. Mobile phone 1 opens the camera application and takes a photo of the specified content. In response to the click operation of the user on the photographing button, the photo of the specified content is obtained. Then, mobile phone 1 responds to the click operation of the user on the confirmation button, that is, confirms that the photo meets the user's demand, and obtains the confirmed photo. Mobile phone 1 returns the confirmed photo to the specified position in the notebook application of the computer.

[0308] Therefore, through the cross-device service calling method described above, the user can send a shooting instruction from the computer to the mobile phone. After receiving the shooting instruction, the mobile phone invokes the camera to perform a shooting or scanning task, and after the task is completed, the shooting result or the scanned text is directly returned to the computer. The step of uploading the shooting result or the scanned text to the computer, then downloading and saving it to the computer, and then uploading it to the corresponding position can be saved, the operation is more convenient, and the user's work efficiency is improved.

[0309] In the cross-device service calling method, serialization and deserialization of the parcel package are involved. For example, in the process of the camera application obtaining the File Provider object of the note application, serialization and deserialization of reqA (request parcel A) and serialization and deserialization of repB (reply parcel B) are required. In the process of the camera application obtaining the file handle of the photo cache file of the note application, serialization and deserialization of reqD (request parcel D) and serialization and deserialization of repE (reply parcel E) are required. The reqA and the reqD do not contain an anonymous binder object, the repB contains a File Pc object (that is, the repB contains an anonymous Binder object), and the repE contains an Fdc object (that is, the repE contains a file handle).

[0310] The existing serialization and deserialization method only supports serialization and deserialization of a parcel package that does not contain an anonymous Binder object or a file handle, that is, the existing method is applicable only when the parcel package contains only basic type objects (for example, int and string objects). The existing method does not support serialization and deserialization of a parcel package that contains a complex object such as an anonymous binder object or a file handle.

[0311] In the embodiment of the present application, a cross-device data processing method is provided, which can replace the Binder object or the file handle in the parcel package when the parcel package contains a complex object such as the Binder object or the file handle, and then perform serialization, so that the two devices can access each other.

[0312] As shown in FIG. 1, a data structure diagram of a parcel package is provided in the embodiment of the present application. Figure 15 In the embodiment, InterfaceToken is located at the beginning of the mData, and a package name is generally filled. An application has a package name. Figure 15 In the embodiment, an int type data and a string type data are further included. Here, writing of two common data types is taken as an example, and other types of data can also be used. Figure 15

[0313] ​In the parcel package, the start positions of binder1 and binder2 are also included, that is, the DataPos of binder1 and binder2, that is, the byte position from which the binder1 object starts and the byte position from which the binder2 object starts. That is, the data structure includes the bytes that can identify the positions of the binder object or the file handle object. The specific position of the binder object can be obtained through the above bytes in the parcel.

[0314] It should be noted that, Figure 15 The parcel data structure in the above is only an example. In actual scenarios, the parcel package generally only includes one Binder object, and does not include two Binder objects.

[0315] Referring to Figure 16 , Figure 16 A cross-device data processing method provided by an embodiment of the present application includes a Binder object in a parcel package. As shown in Figure 16 , the left side is an electronic device 1 and the right side is an electronic device 2. The local resource of the electronic device 1 is sent to the electronic device 2. S in Parcel A is a Binder object, and the corresponding BinderId is S1. Before serialization, the electronic device 1 can replace the Binder object S with the corresponding BinderId (S1) to obtain Parcel A'. Then, the electronic device 1 performs serialization processing on Parcel A' to obtain the byte stream of serialized Parcel A', and then transmits the byte stream to the client through the network. It can be understood that S in Parcel A is a Binder object, and the corresponding target service, for example, service 1, in the electronic device 1 can be called.

[0316] After the electronic device 2 receives the byte stream of Parcel A', the electronic device 2 performs deserialization on the byte stream to obtain Parcel A'. The electronic device 2 analyzes Parcel A' to obtain BinderId (S1), and then creates a Binder reference object Q corresponding to BinderId (S1) in the local electronic device 2, and writes Q into Parcel A' to obtain Parcel B. That is, the electronic device 2 can subsequently call the service 1 of the electronic device 1 through the Binder reference object Q.

[0317] The length of the bytes occupied by the Binder object in the Parcel package is fixed, such as 28 bytes. Before serialization, the Binder object is assigned a corresponding BinderId, where BinderId can be defined as an integer type, occupying 4 bytes. Then, in Parcel A', after replacing the Binder object with BinderId, the position of the bytes of the Binder object other than BinderId is filled with a placeholder. Thus, when replacing the Binder object in the Parcel package with BinderId, other data remains unchanged and does not affect the original structure of the Parcel package. In the above filling of the placeholder, as long as the preset placeholder can occupy the corresponding position, the form of the preset placeholder is not limited in the present application, which can be a blank or 0.

[0318] Figure 16 The Binder object can be S, and the assigned BinderId is S2. Before serialization, the electronic device 1 can replace the Binder object S with the corresponding BinderId (S2) to obtain Parcel A'. Then, the electronic device 1 serializes Parcel A' to obtain the serialized Parcel A', i.e., the byte stream of Parcel A', and then transmits it to the electronic device 2 through the network. After receiving the byte stream of Parcel A', the electronic device 2 deserializes it to obtain Parcel A'. The electronic device 2 analyzes Parcel A' to obtain BinderId (S2), and then creates a binder reference object Q1 corresponding to BinderId (S2) locally in the electronic device 2, and writes Q1 into Parcel A' to obtain Parcel B.

[0319] In the process of obtaining the File Provider object of the note application in the camera application in the embodiment of the present application, after the first electronic device receives the request reqA for obtaining the File Provider object, the first electronic device writes the File Provider object of the note application into the Parcel package (i.e., repB), Figure 17 A serialization method for the repB is provided.

[0320] Figure 17In the repB, the local Binder1 in the repB can represent the File Provider object (IFile Pc object) described above. The first electronic device assigns a corresponding BinderId (BinderId2) to the IFile Pc object. Before serialization, the first electronic device can replace the IFile Pc object with the corresponding BinderId (BinderId2) to obtain repB1. Then, the repB1 is subjected to serialization processing to obtain the serialized repB1, that is, the byte stream of repB1, and then transmitted to the second electronic device through the network.

[0321] After receiving the repB1 byte stream, the second electronic device deserializes it to obtain repB1. The second electronic device analyzes repB1 to obtain BinderId 2, and then creates a reference object IFile Ps object (that is, the remote Binder10 in the repB) corresponding to BinderId 2 locally in the second electronic device, and writes the IFile Ps object into repB1 to obtain repB2. Figure 17

[0322] In summary, the serialization method of the Parcel package provided in the embodiments of the present application can be used in the scenario of cross-device transmission of the Parcel package. If the Parcel package contains a Binder object, the Binder object is replaced with a corresponding BinderId before serialization processing and transmission. That is, the local resource (Binder object) is replaced with a cross-device resource (BinderId) before serialization processing and transmission. After receiving the serialized parcel package at the other end, the BinderId is obtained by deserialization processing, and then the BinderId is replaced with a locally created Binder object. Thus, the serialization method of the Parcel package can realize cross-device transmission of the Parcel package containing the Binder object.

[0323] In the service call scenario across devices in the embodiments of the present application, cross-device transmission of a Parcel package containing a file handle is also involved. The serialization method of the Parcel package is introduced as follows.

[0324] Please refer to Figure 18 , Figure 18 The cross-device data transmission method provided in the embodiments of the present application contains a file handle in the Parcel package. For example, Figure 18 ​As shown, we can assume the left side is electronic device 3 and the right side is electronic device 4. Local resources from electronic device 3 are sent to electronic device 4. In Parcel D, T is a file handle object with the name T1. Before serialization, electronic device 3 can replace the file handle object T with the corresponding name T1 to obtain Parcel D'. Then, Parcel D' is serialized to obtain the serialized Parcel D', which is the byte stream of Parcel D', and then transmitted to electronic device 4 over the network.

[0325] After receiving the byte stream of Parcel D', electronic device 4 deserializes it to obtain Parcel D'. Electronic device 4 parses Parcel D' to obtain the name T1 corresponding to the file handle object T. Then, electronic device 4 creates a file handle object K corresponding to the name T1 locally and writes K into Parcel D' to obtain Parcel E.

[0326] In this embodiment of the application, during the process of the camera application obtaining the file handle of the photo cache file of the note-taking application, after the first electronic device receives the request reqD to obtain the file handle object, the first electronic device writes the file descriptor Fdc of the note-taking application into the Parcel packet (i.e., repE). Figure 19 A method for serializing this repE is provided.

[0327] Figure 19 In this process, the first electronic device creates a distributed file for a file descriptor Fdc object, named "DisPicture" as described above. Before serialization, the first electronic device can replace the Fdc object with "DisPicture" to obtain repE1. Then, repE1 is serialized to obtain the serialized repE1, which is the byte stream of repE1, and then transmitted to the client over the network.

[0328] After receiving the `repE1` byte stream, the second electronic device deserializes it to obtain `repE1`. The second electronic device then parses `repE1` to obtain the name of the distributed file. Specifically, the second electronic device can read the name of the distributed file based on the type and offset position in the `repE1` message header. Then, the second electronic device opens the corresponding distributed file according to the name and returns the distributed file handle `VFd`. The second electronic device writes the distributed file handle `VFd` object into `repE1`, obtaining `repE2`.

[0329] In summary, the Parcel packet serialization method provided in this application embodiment can, in scenarios where Parcel packets are transmitted across devices, replace the file handle object with the name of the corresponding distributed file before serialization and transmission if the Parcel packet contains a file handle object. That is, the local resource (file handle object) is replaced with the cross-device resource (name of the distributed file) before serialization and transmission. Upon receiving the serialized Parcel packet at the other end, deserialization is performed to obtain the name of the distributed file. Then, the corresponding distributed file is opened based on the name, and the file handle object corresponding to the locally created distributed file is obtained. Therefore, the above Parcel packet serialization method can achieve cross-device transmission of Parcel packets containing file handle objects.

[0330] Please see Figure 20 ,like Figure 20 In the cross-device data transmission method flowchart shown (refer to steps S201-S209), after the first electronic device calls the target service of the second electronic device, namely the distributed application management service, the second electronic device, after obtaining the execution result, follows the specific steps of the camera application sending the captured data back to the note. Specifically, it first obtains the note's File Provider object, and then uses that object to obtain the file handle. The second electronic device sends a request to the first electronic device to obtain the first file handle object. After obtaining the first file handle object of the preset file, the first electronic device creates a corresponding first distributed file based on the first file handle object, and then sends the file name of the first distributed file to the second electronic device. The second electronic device opens the corresponding second distributed file using the received file name and obtains the corresponding second file handle object. Then, the second electronic device writes the acquired captured data into the first distributed file. The captured data in the second distributed file is then transmitted to the first distributed file of the first electronic device, and then further written into the preset file of the first electronic device.

[0331] Therefore, through the above-mentioned cross-device data transmission method, the cross-device transmission of Parcel packages containing file handle objects can be realized, enabling the return of photographed data to the calling application of the first electronic device, thus realizing the complete process of cross-device calling.

[0332] In this embodiment of the application, during the process of a client calling a service on the server, the server application may exit. For example, the server application may exit due to some kind of exception, or the application may exit normally in response to a user's operation. Both of these situations can be considered as an exception occurring in the server application. In this case, both the client application and the server application need to clean up the locally stored resources to avoid resource redundancy.

[0333] Therefore, this application provides a cross-device service call resource cleanup method, which can clean up the resources stored in the client application and the server application when the server application exits.

[0334] In this embodiment, the cross-device service call resource cleanup method described above can be applied to scenarios where a first electronic device (client) calls a service from a second electronic device (server). The first electronic device can be a personal computer, tablet, mobile phone, etc., and the second electronic device can be a tablet, mobile phone, etc.

[0335] If the first electronic device is a personal computer, the above-mentioned cross-device service call resource cleanup method is introduced by taking the application 1 of the first electronic device calling the service S1 of the application 2 of the second electronic device as an example.

[0336] Please see Figure 21 ,like Figure 21 In the resource cleanup method flowchart shown (refer to steps S301-S307), after the first electronic device calls the target service of the second electronic device, it registers a cleanup service for the acquired target service and sends a registration instruction for the cleanup service to the second electronic device based on the first IBinder object of the cleanup service. The second electronic device receives the registration instruction from the first electronic device and obtains the fourth IBinder object of the cleanup service. In response to the exit of the target service, the second electronic device executes the cleanup service based on the fourth IBinder object and sends a request to the first electronic device to invoke the service. In response to receiving the first cleanup invocation request from the second electronic device, the second electronic device executes the cleanup service based on the first IBinder object. Here, registering the cleanup service means registering a death notification. The cleanup resources mainly include the target service and the invocation resources of the cleanup service, and the invocation resources include the resources used by the electronic device when invoking the corresponding service. The above steps are described in detail below.

[0337] The overall process of the aforementioned cross-device service call resource cleanup method can be mainly divided into four parts: service registration of the first electronic device, service acquisition by the second electronic device, service registration death notification of the first electronic device, and service exit of the second electronic device. The services registered and acquired by the electronic device can be any service, such as distributed application management services or audio services. The registration death notification is used so that after Binder communication is established, the client can receive a notification when the server unexpectedly crashes due to internal errors or other reasons.

[0338] Please see Figure 22 , Figure 22 This is a timing diagram of a cross-device service call resource cleanup method provided in an embodiment of this application. Figure 22 As shown, let's assume the service name registered by application 2 is "ServiceS1". The process of application 2 registering the service is consistent with the service registration process in the cross-device service invocation method described above. Specifically, application 2's "ServiceS1" service is registered in the distributed service management module of the service collaboration module. The distributed service management module stores the service name ("ServiceS1") and IBinder object (IBinder S1) of "ServiceS1". The distributed Binder management module then assigns a corresponding BinderId (Binderld S1) to the "ServiceS1" service.

[0339] After the second electronic device stores the service name, iBinder object, and corresponding BinderId, the service registration of the first electronic device is successful. The first electronic device can then obtain the "ServiceS1" service registered in the second electronic device. Specifically, the first electronic device initiates a service request to the second electronic device, carrying the device identifier (DeviceId) and service name ("ServiceS1") in the request. The distributed Binder management module of the first electronic device can assemble a message (carrying the service name) and send it to the distributed Binder management module of the second electronic device through the channel established between the communication modules of the first and second electronic devices.

[0340] The first electronic device can establish a connection with the second electronic device based on the device identifier in the request.

[0341] The distributed Binder management module of the second electronic device looks up the corresponding service according to the service name carried in the message in the distributed service management module. The distributed service management module stores the correspondence between the service name and the IBinder object. After the corresponding service is found, the IBinder object corresponding to the service is determined, and the IBinder object is returned to the distributed Binder management module of the second electronic device, and the BinderId S1 corresponding to the IBinder object is determined.

[0342] Then, the distributed Binder management module of the second electronic device can assemble a message (carrying BinderId S1) and send the message to the distributed Binder management module of the first electronic device through the channel established between the communication module of the first electronic device and the communication module of the second electronic device.

[0343] After the distributed Binder management module of the first electronic device receives the message, BinderId S1 is obtained by parsing, and a local IBinder object (IBinder C1) is created according to BinderId S1. Wherein, IBinder C1 and BinderId S1 establish a mapping relationship.

[0344] Then, the newly created IBinder object is returned to the distributed service management module of the first electronic device and the application 1 of the first electronic device in turn.

[0345] After the first electronic device obtains the service S1, that is, the first electronic device obtains the IBinder reference object (IBinder C1) of the service S1, the first electronic device can register the death notification for IBinder C1.

[0346] Specifically, the application 1 of the first electronic device sends a request (that is, a request parcel, set as req1) to the distributed Binder management module of the first electronic device, wherein the req1 contains recipient C1. The distributed Binder management module of the first electronic device allocates a corresponding BinderId (BinderId C1) for recipient C1. Wherein, the mapping relationship between recipient C1 and BinderId C1 is established.

[0347] It can be understood that RecipientC1 is an anonymous binder object created by application 1 itself.

[0348] The distributed Binder management module of the first electronic device replaces recipient C1 in req1 with BinderId C1 and serializes the req1. Then, the distributed Binder management module of the first electronic device can assemble a message (carrying the serialized req1) and send the message to the distributed Binder management module of the second electronic device through the channel established between the communication module of the first electronic device and the communication module of the second electronic device.

[0349] The distributed Binder management module of the second electronic device parses the received message to obtain the serialized req1 (req1 byte stream). The distributed Binder management module of the second electronic device deserializes the req1 byte stream to obtain req1 and parses BinderId C1 in req1.

[0350] The distributed Binder management module of the second electronic device creates recipient S1 and associates it with BinderId C1. The distributed Binder management module of the second electronic device sends an instruction to register a death notification to application 2, that is, the distributed Binder management module of the second electronic device sends an instruction to register a death notification for IBinder S1 (Service S1) to application 2.

[0351] After the second electronic device successfully registers the death notification, a registration result is returned to the first electronic device.

[0352] At this time, the first electronic device and the second electronic device have both completed the registration of the death notification. When the service of the second electronic device exits, the first electronic device and the second electronic device can clean up service-related resources according to the death notification mechanism.

[0353] In the embodiment of the application, after application 2 of the second electronic device exits, the driver of the second electronic device triggers the recipient S1 death notification callback binderDied function, and the local Service S1 related resources are cleaned up in the binderDied function, including the mapping relationship of Service S1 and its ServiceName and BinderId.

[0354] After the second electronic device is cleaned up, a message is sent to the first electronic device to clean up the service associated with Service S1, triggering the resource cleaning and application notification of the first electronic device.

[0355] The first electronic device receives the message and finds the recipientC1 of the service ServiceC1 associated with ServiceS1, and calls the binderDied function of the death notification interface with recipientC1. After the application receives the callback, it cleans up the resources related to ServiceC1 by itself.

[0356] After the recipientC1 callback of the first electronic device is completed, first, the resources related to ServiceC1 in the local are cleaned up, such as the mapping relationship of ServiceC1 and its ServiceName, BinderId, etc.; second, the mapping relationship of recipientC1 and its BinderId, etc. are cleaned up.

[0357] In the embodiment of the application, the second electronic device can first clean up the local resources, and then send a message to the first electronic device to clean up the resources (such as Figure 22 the step). Or, it can also send a message to the first electronic device to clean up the resources first, and then clean up the local resources. Or, it can also be processed in parallel: while the second electronic device cleans up the local resources, it sends a message to the first electronic device to clean up the resources. After the second electronic device sends a message to the first electronic device to clean up the resources, and cleans up the local resources, the mapping relationship of recipientC1 and its BinderId, etc. can also be cleaned up.

[0358] It can be understood that when registering the death notification, the service call is normal. That is, after the first electronic device obtains the service registered by the second electronic device, it needs to register the death notification. If the death notification is registered when the service exits, it is meaningless, and the two ends cannot be notified in time to clean up the service call resources.

[0359] After the first electronic device and the second electronic device complete the resource cleaning, the first electronic device needs to reacquire the service of the second electronic device and re-register the death notification when making a call next time.

[0360] In summary, the application 1 of the first electronic device can receive the service exit message of the second electronic device in time, can clean up the stored resources in time, and avoid causing resource redundancy in the first electronic device. After the first electronic device cleans up the related resources of the service call in time, the first electronic device no longer has information related to the service (such as the calling interface of the application 1 no longer displays the corresponding second electronic device and service), and the problem of failed re-calling of the service (such as the user's click operation on the calling interface of the second electronic device and service is invalid) does not occur, which can improve the user's operation experience.

[0361] This application also provides a chip system, such as... Figure 23 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.

[0362] 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 causes the electronic device to perform various functions or steps performed by the mobile phone in the above method embodiment.

[0363] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps performed by the mobile phone in the above method embodiments.

[0364] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0365] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0366] The units described as separate components may or may not be physically separate, and the components displayed as units may be a physical unit or multiple physical units, that is, may be located in one place, or also can be 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.

[0367] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, 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.

[0368] 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 such understanding, the technical scheme of the embodiments of the present application essentially or the part that contributes to the prior art or the whole or part of the technical scheme 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 program code storage media.

[0369] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any change or replacement within the technical scope disclosed in 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 method of cross-device service invocation, applied to a first electronic device, the method comprising: receiving a service request from a second electronic device; determining a service provider of the service request; and invoking the service request on the service provider. The method comprises: The first electronic device displays a display interface of a first application, the display interface of the first application comprising a plurality of device controls, each device control corresponding to a device that has established a preset wireless connection with the first electronic device, and each device control comprising one or more services provided by the corresponding device; The first electronic device receives a first touch operation of a user on a target device control in the plurality of device controls, the first touch operation corresponding to a distributed application management service of a second electronic device; The first electronic device obtains a first Binder identification (ID) corresponding to the distributed application management service from the second electronic device, and creates a second IBinder object based on the first Binder ID; wherein the first Binder ID is determined by the second electronic device when registering the distributed application management service according to a first IBinder object of the distributed application management service, and the first IBinder object and the second IBinder object are used to call the distributed application management service; The first electronic device, in response to receiving a first request from the second electronic device, finds the corresponding second IBinder object according to the first Binder ID contained in the first request, and indicates a first file providing object of the first application to the second electronic device based on the second IBinder object; wherein the first request is used to request the first file providing object, the first request is sent by the second electronic device in response to a second touch operation of a user on a second application, the second touch operation is used to confirm a result of the second electronic device executing the distributed application management service on the second application, and the first file providing object is used to support the second electronic device returning the result of executing the distributed application management service to the first electronic device; The first electronic device, in response to receiving a second request from the second electronic device, indicates a first file handle object to the second electronic device based on the first file providing object; wherein the second request is generated by the second electronic device based on the first file providing object, and is used to request the first file handle object for calling a preset cache file of the first application; The first electronic device receives a result of executing the distributed application management service returned by the second electronic device based on the first file handle object.

2. The cross-device service invocation method of claim 1, wherein, Before the first electronic device responds to the first request from the second electronic device, the method further comprises: The first electronic device sends an opening instruction to the second electronic device, wherein the opening instruction is used to open a second application of the second electronic device.

3. The cross-device service invocation method according to claim 1 or 2, wherein, The first electronic device, in response to receiving a first request from the second electronic device, finds a corresponding second IBinder object according to the first Binder ID contained in the first request, and indicates a first file providing object of the first application to the second electronic device based on the second IBinder object, including: The first electronic device, in response to receiving a first request from the second electronic device, finds a corresponding second IBinder object according to the first Binder ID contained in the first request; The first electronic device acquires the first file providing object of the first application based on the second IBinder object, and creates a corresponding second Binder ID based on the first file providing object; The first electronic device sends the second Binder ID to the second electronic device.

4. The cross-device service invocation method of claim 3, wherein, The first electronic device, in response to receiving a second request from the second electronic device, indicates a first file handle object to the second electronic device based on the first file providing object, including: The first electronic device, in response to receiving a second request from the second electronic device, finds a corresponding first file providing object according to the second Binder ID contained in the second request; The first electronic device acquires the first file handle object based on the first file providing object, and creates a first distributed file based on the first file handle object; The first electronic device sends the name of the first distributed file to the second electronic device.

5. The cross-device service invocation method according to any one of claims 1, 2, 4, wherein, The first electronic device acquires the first Binder ID corresponding to the distributed application management service from the second electronic device, and creates a second IBinder object based on the first Binder ID, including: The first application acquires the service name of the distributed application management service, and sends an acquisition instruction to the distributed service management module of the first electronic device; wherein the acquisition instruction includes the service name, and is used to acquire the first Binder ID corresponding to the distributed application management service; The distributed service management module, in response to the acquisition instruction, sends the acquisition instruction to the second electronic device through the preset wireless connection by using the communication module of the first electronic device; The communication module receives the first Binder ID from the second electronic device through the preset wireless connection, and sends the first Binder ID to the distributed service management module; The distributed service management module sends the first Binder ID to the distributed Binder management module of the first electronic device; The distributed Binder management module creates the second IBinder object based on the first Binder ID; In the first electronic device from the second electronic device to obtain the distributed application management service corresponding to the first Binder ID, and based on the first Binder ID to create a second IBinder object, after still including: The distributed Binder management module returns the second IBinder object to the system application framework of the first electronic device, and the system application framework returns the second IBinder object to the first application.

6. The cross-device service invocation method of claim 3, wherein, The first electronic device responds to receiving a first request from the second electronic device, and finds a corresponding second IBinder object according to the first Binder ID contained in the first request, including: The distributed Binder management module receives a first request from the second electronic device through the communication module, and finds a corresponding second IBinder object according to the first Binder ID; Wherein, the first electronic device based on the second IBinder object obtains the first file providing object of the first application, and creates a corresponding second Binder ID based on the first file providing object, including: The distributed Binder management module sends a first execution request to the system application framework of the first electronic device based on the second IBinder object; The system application framework sends the first file providing object of the first application to the distributed Binder management module based on the first execution request; The distributed Binder management module creates a second Binder ID based on the first file providing object; Wherein, the first electronic device sends the second Binder ID to the second electronic device, including: The distributed Binder management module sends the second Binder ID to the second electronic device.

7. The cross-device service invocation method of claim 4, wherein, The first electronic device responds to receiving a second request from the second electronic device, and finds a corresponding first file providing object according to the second Binder ID contained in the second request, including: The distributed Binder management module receives a second request from the second electronic device through the communication module, and finds a corresponding first file providing object according to the second Binder ID contained in the second request; Wherein, the first electronic device based on the first file providing object obtains the first file handle object, and creates a first distributed file based on the first file handle object, including: The distributed Binder management module sends a second execution request to the system application framework based on the first file providing object; The system application framework sends the first file handle object of the first application to the distributed Binder management module based on the second execution request; The distributed Binder management module sends a creation instruction for the first distributed file to the distributed file module of the first electronic device based on the first file handle object; The distributed file module creates the first distributed file based on the creation instruction; The first electronic device sends the name of the first distributed file to the second electronic device, including: The distributed file module sends the first distributed file to the distributed Binder management module; The distributed Binder management module sends the name of the first distributed file to the second electronic device through the communication module.

8. A cross-device service calling method, applied to a second electronic device, the method comprising: The method comprises: The second electronic device sends a first request to the first electronic device based on a first Binder ID of a distributed application management service in response to a second touch operation of a user on a second application of the second electronic device; wherein the first request is used to request a first file providing object of a first application of the first electronic device, the first Binder ID is determined by the second electronic device according to a first IBinder object of the distributed application management service when the second electronic device registers the distributed application management service, the first IBinder object is used to call the distributed application management service, the second touch operation is used to confirm the result of the second electronic device executing the distributed application management service on the second application, and the first file providing object is used to support the second electronic device returning the result of executing the distributed application management service to the first electronic device; The second electronic device receives the first file providing object indicated by the first electronic device, and sends a second request to the first electronic device based on the first file providing object; wherein the second request is used to request a first file handle object for calling a preset cache file of the first application; The second electronic device receives the first file handle object indicated by the first electronic device, and returns the result of executing the distributed application management service to the first electronic device based on the first file handle object.

9. The cross-device service invocation method of claim 8, wherein, Before the second electronic device responds to the second touch operation of the user on the second application of the second electronic device, the method further comprises: The second electronic device receives the opening instruction sent by the first electronic device, and opens the second application of the second electronic device based on the opening instruction.

10. The cross-device service invocation method of claim 9, wherein, Before the second electronic device receives the opening instruction sent by the first electronic device, the method further comprises: The second electronic device receives the acquisition instruction from the first electronic device, and finds the first Binder ID of the distributed application management service based on the acquisition instruction; The second electronic device sends the first Binder ID to the first electronic device.

11. The cross-device service invocation method of claim 10, wherein, Before the second electronic device receives the acquisition instruction from the first electronic device, the method further comprises: The second electronic device acquires a service name of the distributed application management service and a first IBinder object of the distributed application management service, and determines a corresponding first Binder ID based on the first IBinder object; wherein the first IBinder object is used to call the distributed application management service.

12. The cross-device service invocation method according to any one of claims 8-11, wherein, The second electronic device receives the first file providing object indicated by the first electronic device, and sends a second request to the first electronic device based on the first file providing object, including: The second electronic device receives the second Binder ID of the first file providing object, and creates a second file providing object based on the second Binder ID; The second electronic device sends a second request to the first electronic device based on the second file providing object; wherein the second Binder ID is contained in the second request.

13. The cross-device service invocation method of any of claims 8-11, wherein, The second electronic device receives the first file handle object indicated by the first electronic device, and returns a result of executing the distributed application management service to the first electronic device based on the first file handle object, including: The second electronic device receives the name of the first distributed file sent by the first electronic device; wherein the first distributed file is created by the first electronic device based on the first file handle object; The second electronic device opens a corresponding second distributed file based on the name of the first distributed file; wherein the second distributed file is created by the second electronic device and corresponds to the first distributed file; The second electronic device acquires a second file handle object of the second distributed file, and returns a result of executing the distributed application management service to the first electronic device based on the second file handle object.

14. The cross-device service invocation method according to claim 10 or 11, wherein, The second electronic device receives an acquisition instruction from the first electronic device, and finds a first Binder ID of the distributed application management service based on the acquisition instruction, including: The distributed Binder management module of the second electronic device receives an acquisition instruction from the first electronic device through the communication module of the second electronic device; wherein the acquisition instruction includes a service name of the distributed application management service; The distributed Binder management module sends a finding instruction to the distributed service management module of the second electronic device in response to the acquisition instruction; wherein the finding instruction includes the service name; The distributed service management module finds a first Binder ID corresponding to the service name in response to the finding instruction; Wherein, the second electronic device sends the first Binder ID to the first electronic device, including: The distributed service management module sends the first Binder ID to the first electronic device through the communication module.

15. The cross-device service invocation method of any of claims 8-11, wherein, The first electronic device sends a first request to the first electronic device based on the first Binder ID of the distributed application management service, including: The second application sends a first request to a system application framework of the second electronic device based on the first IBinder object; The system application framework sends the first request to a distributed Binder management module of the second electronic device; The distributed Binder management module receives the first request and finds a corresponding first Binder ID based on the first IBinder object; The distributed Binder management module sends the first request to the first electronic device through a preset wireless connection by using a communication module of the second electronic device; wherein the first request includes the first Binder ID.

16. The cross-device service invocation method of claim 12, wherein, The second electronic device receives a second Binder ID of the first file providing object and creates a second file providing object based on the second Binder ID, including: The distributed Binder management module of the second electronic device receives the second Binder ID of the first file providing object sent by the first electronic device through a communication module and creates a second file providing object based on the second Binder ID; The second electronic device sends a second request to the first electronic device based on the second file providing object; wherein the second Binder ID is included in the second request, including: The distributed Binder management module sends the second file providing object to a system application framework; The system application framework sends the second file providing object to the second application; The second application sends a second request to the distributed Binder management module based on the second file providing object; The distributed Binder management module receives the second request and finds a corresponding second Binder ID based on the second file providing object; The distributed Binder management module sends the second request to the first electronic device through the communication module; wherein the second Binder ID is included in the second request.

17. The cross-device service invocation method of claim 13, wherein, The second electronic device receives a name of a first distributed file sent by the first electronic device, including: The distributed Binder management module of the second electronic device receives the name of the first distributed file sent by the first electronic device through a communication module; The second electronic device opens a corresponding second distributed file based on the name of the first distributed file, including: The distributed Binder management module opens a corresponding second distributed file in a distributed file module of the second electronic device based on the name of the first distributed file; The second electronic device obtains a second file handle object of the second distributed file and returns a result of executing the distributed application management service to the first electronic device based on the second file handle object, including: The distributed file module sends the second file handle object of the second distributed file to the distributed Binder management module; The distributed Binder management module sends the second file handle object to a system application framework; The system application framework sends the second file handle object to the second application; The second application returns a result of executing the distributed application management service to the first electronic device based on the second file handle object.

18. A cross-device service invocation method, applied to a first electronic device, the method comprising: The method comprises: The first electronic device displays a display interface of a first application, the display interface of the first application comprising a plurality of device controls, each device control corresponding to a device that has established a preset wireless connection with the first electronic device, and each device control comprising one or more services provided by the corresponding device; The first electronic device receives a first touch operation of a user on a target device control in the plurality of device controls, the first touch operation corresponding to a target service of a second electronic device; The first electronic device obtains a first Binder identification ID corresponding to the target service from the second electronic device, and creates a second IBinder object based on the first Binder ID; wherein the first Binder ID is determined by the second electronic device when registering the target service according to a first IBinder object of the target service, and the first IBinder object and the second IBinder object are used to call the target service; The first electronic device sends a call request to the second electronic device based on the second IBinder object; wherein the call request comprises a first Binder ID of the second IBinder object, and the call request is used to request calling the target service of a second application in the second electronic device; The first electronic device receives a call response from the second electronic device, the call response comprising a result of calling the target service by the first electronic device. 19.A method of cross-device service invocation, applied to a second electronic device, the method comprising: The method comprises: The second electronic device receives a call request from the first electronic device; wherein the call request comprises a first Binder identification ID of a second IBinder object, and the call request is used to request calling a target service of a second application in the second electronic device; The second electronic device, in response to the call request, finds a first IBinder object created for the target service when the second electronic device registers the target service according to a first Binder ID of the second IBinder object; The second electronic device calls the target service based on the first IBinder object, and feeds back a call response to the first electronic device, the call response comprising a result of calling the target service.

20. The cross-device service invocation method of claim 19, wherein, Before the second electronic device receives the call request from the first electronic device, the method further comprises: The second electronic device receives an acquisition instruction from the first electronic device, and finds a first Binder ID of a distributed application management service based on the acquisition instruction; The second electronic device sends the first Binder ID to the first electronic device.

21. The cross-device service invocation method of claim 20, wherein, Before the second electronic device receives the obtaining instruction from the first electronic device, further comprising: The second electronic device obtains the service name of the target service and the first IBinder object of the target service, and determines the corresponding first Binder ID based on the first IBinder object.

22. An electronic device, comprising: The electronic device comprises 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 used to store computer program code, the computer program code comprises computer instructions, when the computer instructions are executed by the electronic device, make the electronic device execute the method as claimed in any one of claims 1-21.

23. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, when the instructions run in the electronic device, make the electronic device execute the method as claimed in any one of claims 1 to 21.

Citation Information

Patent Citations

  • Inter-process communication synchronization callback method and system in application program and related equipment

    CN110275790A

  • Terminal equipment and cross-process communication method thereof

    CN111443961A