A method and electronic device for managing virtualization services
By registering a global callback function in the multi-screen collaboration service to manage multiple virtualization services, the problem of low operating efficiency of virtualization services under the Android architecture is solved, and efficient scheduling of multiple virtualization services and improvement of business access efficiency are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2026-03-20
AI Technical Summary
In multi-screen collaboration services, virtualization services based on the Android architecture suffer from low operating efficiency, especially when multiple virtualization services are running simultaneously, as excessive system-level binding relationships lead to decreased efficiency.
By registering a global callback function to manage multiple virtualization services when the first electronic device establishes a collaborative connection with the second electronic device, the number of callbacks is reduced, the binding relationship at the system layer is improved, and efficient scheduling of multiple virtualization services is achieved.
It effectively reduced the number of callbacks, improved system efficiency when multiple virtualization services run simultaneously, reduced the occurrence of concurrency conflicts, and improved business access efficiency.
Smart Images

Figure CN120255983B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal, and in particular, to a method for managing virtualization services and an electronic device. BACKGROUND
[0002] With the development of intelligent terminal technology, some services of the intelligent terminal can be implemented by calling virtualization services. Taking a multi-screen collaboration service as an example, when a user uses a mobile phone supporting a virtual camera function to make a video call, the user also needs to use a computer for work, at which time the mobile phone and the computer can be multi-screened to use the computer to control the mobile phone to make a video call. However, in the case where multiple virtualization services are running simultaneously, based on an open basic program framework of an Android architecture, there is a problem of low running efficiency. SUMMARY
[0003] Therefore, the present application provides a method for managing virtualization services, an electronic device, a computer readable storage medium and a computer program product, which can improve the running efficiency in the case where multiple virtualization services are running simultaneously.
[0004] In a first aspect, a method for managing virtualization services is provided, applied to a first electronic device, and the method comprises:
[0005] When a collaborative connection with a second electronic device is established by any of the following ways: receiving a collaborative connection request from the second electronic device, scanning a two-dimensional code for establishing a collaborative connection, connecting the second electronic device through a wired interface, and displaying a first interface including a first window including a first control in the first interface;
[0006] In response to the operation of the user clicking the first control, enabling a first virtualization service and a second virtualization service; wherein the first virtualization service and the second virtualization service are both used to call a first process service in a system layer;
[0007] Based on a first global callback function, a registration callback is executed, and first registration information and second registration information are saved, the first global callback function corresponds to one or more virtualization services calling the first process service, the first registration information includes device information and service information corresponding to the first virtualization service, and the second registration information includes device information and service information corresponding to the second virtualization service; wherein the first global callback function is used to call the first process service.
[0008] The method can be performed by the first electronic device or a chip in the first electronic device. Based on the above scheme, the first electronic device enables the first virtualization service and the second virtualization service in response to an operation of confirming, by a user, to establish a collaborative connection with the second electronic device. The two virtualization services call the same virtualization service capability in the system layer. Compared with registering a corresponding callback for each virtualization service when enabling multiple virtualization services, the embodiments of the present application only register a global callback for multiple virtualization services that call the same virtualization service capability, which can greatly reduce the number of callbacks; in the case of running multiple virtualization services at the same time, fewer binding relationships are established with the system layer, greatly improving the running efficiency.
[0009] After the first electronic device and the second electronic device establish a collaborative connection, a media audio virtualization service is enabled by default. The first virtualization service and the second virtualization service can be a media audio speaker service and a media audio microphone service, respectively.
[0010] It should be noted that, since the embodiments of the present application register the same global callback (such as the first global callback function) for multiple virtualization services that call the same service capability, the number of callbacks corresponding to the virtualization services in the first global callback function can be counted and counted, and the device information and service information corresponding to each callback number can be saved. The form of saving is not limited, which can be a mapping table or a mapping relationship. For example, the first virtualization service corresponds to device1, service1, cb1; the second virtualization service corresponds to device1, service2, cb2, and so on.
[0011] In some possible implementation manners, the method further includes:
[0012] When enabling multiple virtualization services for calling the first process service, the number of callbacks corresponding to the virtualization services in the first global callback function is counted by one for each added virtualization service. Here, the registration callback of each added virtualization service can be incremented, and the number of virtualization services calling the first process service can be obtained by counting the number of callbacks.
[0013] In some possible implementation manners, the method further includes:
[0014] When the first virtualization service is disabled, the callback count included in the first global callback function is reduced by one, and the first registration information saved in the system relay layer is deleted. Here, the callback number in the first global callback function can be sequentially decremented when each virtualization service is disabled, so that the number of virtualization services currently enabled can be obtained.
[0015] In some possible implementation manners, the method further includes: deleting the first global callback function and registration information corresponding to the plurality of virtualization services saved in the system layer when a callback count in the first global callback function is zero. In order to ensure that all virtualization services that call the same process service module can normally operate, the global callback is deleted only when all virtualization services are disabled or all virtualization services initiate a callback for canceling registration, for example, the callback counter is 0.
[0016] In some possible implementation manners, the method further includes:
[0017] enabling a third virtualization service and a fourth virtualization service in response to receiving the incoming call, the third virtualization service and the fourth virtualization service both being used to call the first process service;
[0018] performing a registration callback based on the first global callback function, and saving third registration information and fourth registration information, the third registration information including device information and service information corresponding to the third virtualization service, and the fourth registration information including device information and service information corresponding to the fourth virtualization service.
[0019] In some possible implementation manners, the first process service is an AIDL process audio service, the first virtualization service is a media audio speaker service, the second virtualization service is a media audio microphone service, the third virtualization service is a modem speaker service, and the fourth virtualization service is a modem mic service.
[0020] In some embodiments, the camera registration service and the camera cut stream service both belong to virtual camera virtualization services, and the two services are the same but the specific mode types are different, and a mode field can be introduced to distinguish them. For example, mode1 corresponds to the camera registration service, and mode2 corresponds to the camera cut stream service.
[0021] In some possible implementation manners, the method further includes: enabling a camera virtualization service in response to receiving a service related to a camera, the camera virtualization service including a camera registration service or a camera cut stream service;
[0022] registering a callback function corresponding to the camera virtualization service, the registration callback function corresponding to the camera virtualization service including device information, service information, callback function information, and a mode type; and
[0023] calling a second process service based on the callback function corresponding to the camera virtualization service, the second process being a camera process service.
[0024] In some possible implementations, the mode type is the first mode; the registration of the callback function corresponding to the camera virtualization service includes:
[0025] The status of the usage table and the service table are read respectively. The usage table is used to record the usage of inter-process channels, and the service table is used to record the usage of the corresponding camera virtualization service.
[0026] Determine whether the first mode has already been registered in the service table;
[0027] If the first mode is not registered in the service table, determine whether the first mode has already been registered in the usage table;
[0028] If the first mode is not registered in the usage table, then create a camera AIDL service corresponding to the first mode;
[0029] If the first mode has already been registered in the usage table, then delete the information corresponding to the first mode in the usage table and create a camera AIDL service corresponding to the first mode.
[0030] Therefore, by looking up the status of the aforementioned service table and usage table, corresponding registration callbacks can be created based on the first mode under different circumstances.
[0031] Optionally, creating a camera AIDL service corresponding to the first mode includes: saving the created camera AIDL service to the service table using the first mode as the key, and saving the device information and service information corresponding to the first mode to the usage table using the first mode as the key.
[0032] In some possible implementations, the method further includes:
[0033] If the first mode has already been registered in the service table, determine whether the first mode has already been registered in the usage table;
[0034] When the first mode has been registered in the usage table, the usage table is traversed to determine whether the device information and service information corresponding to the first mode have been registered in the usage table.
[0035] If the first mode is not registered in the usage table, or if the device information and service information corresponding to the first mode are not registered in the usage table, the device information and service information corresponding to the first mode are saved to the usage table using the first mode as the key.
[0036] When the device information corresponding to the first mode and the service information corresponding to the first mode have been registered in the usage table, the process ends.
[0037] Based on the above specific process, by reading the states of the usage table and the service table respectively, and combining multiple judgment logics, the process of enabling the camera virtualization service registration callback can be realized.
[0038] In some possible implementation manners, the method further includes: when the camera virtualization service is disabled, deleting the callback function corresponding to the camera virtualization service.
[0039] In some possible implementation manners, deleting the callback function corresponding to the camera virtualization service includes:
[0040] Respectively reading states of a usage table and a service table, the usage table being used for recording usage of an inter-process channel, and the service table being used for recording usage of a corresponding camera virtualization service;
[0041] Iterating the usage table, and judging whether the first mode has been registered in the service table;
[0042] When the first mode has been registered in the service table, judging whether device information and service information corresponding to the first mode have been registered in the usage table;
[0043] Judging whether there is still device information and service information using the first mode in the first mode after the first mode is deleted in the usage table;
[0044] If there is still device information and service information using the first mode in the first mode, deleting the device information and the first service information of the first mode from the usage table;
[0045] If there is no device information and service information using the first mode in the first mode, deleting the first mode from the usage table.
[0046] Similarly, for the camera class virtualization service, the embodiments of the application also provide an implementation manner of deleting a registered callback.
[0047] Based on the above specific process, by reading the states of the usage table and the service table respectively, and combining multiple judgment logics, the process of deleting the callback of the camera virtualization service can be realized.
[0048] In some possible implementation manners, the method further includes:
[0049] In response to receiving the notification exit event of the camera virtualization service, the first mode is deleted from the use table, and the first mode is deleted from the service table. That is, upon receiving the notification exit event, the relevant information of the first mode in the use table and the service table can be directly deleted, including but not limited to: all device information and service information stored with the first mode as a key.
[0050] In a second aspect, an electronic device is provided, including units for performing any of the methods in the first aspect. The electronic device can be a terminal or a chip in the terminal. The electronic device includes a communication unit, a display unit, and a processing unit.
[0051] When the electronic device is a terminal, the processing unit can be a processor, the communication unit can be a communication interface, and the display unit can be a graphic processing module and a screen. The terminal can further include a memory for storing computer program code, which, when executed by the processor, causes the terminal to perform any of the methods in the first aspect.
[0052] When the electronic device is a chip in the terminal, the processing unit can be a logic processing unit inside the chip, the communication unit can be a communication interface, a pin, or a circuit, and the display unit can be a graphic processing unit inside the chip. The chip can further include a memory, which can be a memory inside the chip (e.g., a register, a cache, etc.) or a memory outside the chip (e.g., a read-only memory, a random access memory, etc.). The memory is used to store computer program code, which, when executed by the processor, causes the chip to perform any of the methods in the first aspect.
[0053] In a third aspect, a computer-readable storage medium is provided, which stores computer program code. When the computer program code is run by an electronic device, the electronic device performs any of the methods in the first aspect.
[0054] In a fourth aspect, a computer program product is provided, which includes computer program code. When the computer program code is run by an electronic device, the electronic device performs any of the methods in the first aspect.
[0055] In a fifth aspect, an embodiment of the present application provides a chip system applied to an electronic device. The chip system includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the method described in the first aspect and any possible implementation manner of the first aspect.
[0056] It can be understood that the electronic device provided in the second aspect, the computer readable storage medium provided in the third aspect, the computer program product provided in the fourth aspect, and the chip system provided in the fifth aspect are all used to execute the method provided in the present application. Therefore, the beneficial effects achieved thereby can refer to the beneficial effects in the corresponding method, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS
[0057] Figure 1 is an example diagram of an application scenario of an embodiment of the present application;
[0058] Figure 2 is a software architecture diagram provided by an embodiment of the present application;
[0059] Figure 3 is a comparison diagram of a historical scheduling scheme of a virtualization service and a scheduling scheme provided by an embodiment of the present application;
[0060] Figure 4 is an example diagram of an access relationship of a virtualized audio / video multi-service provided by an embodiment of the present application;
[0061] Figure 5A is a timing example diagram for enabling a virtualization service provided by an embodiment of the present application;
[0062] Figure 5B is an example diagram of a user confirmation collaborative connection interface of an embodiment of the present application;
[0063] Figure 5C is another example diagram of a user confirmation collaborative connection interface of an embodiment of the present application;
[0064] Figure 6 is a timing example diagram for disabling a virtualization service provided by an embodiment of the present application;
[0065] Figure 7A is a timing example diagram for enabling a camera registration service provided by an embodiment of the present application;
[0066] Figure 7B is an example diagram of a method logic of a registration callback provided by an embodiment of the present application;
[0067] Figure 8A is a timing example diagram for disabling a camera registration service provided by an embodiment of the present application;
[0068] Figure 8B is an example diagram of a method logic of a deletion callback provided by an embodiment of the present application;
[0069] Figure 9A is a timing example diagram for notifying exit from a virtualization service provided by an embodiment of the present application;
[0070] Figure 9B is an example diagram of a method for notifying exit provided by an embodiment of the present application;
[0071] Figure 10 is an example diagram of a timing sequence for enabling camera cut stream service provided by an embodiment of the present application;
[0072] Figure 11 is an example diagram of a timing sequence for other instructions provided by an embodiment of the present application;
[0073] Figure 12 is an example diagram of a method flow for managing virtualization service provided by an embodiment of the present application;
[0074] Figure 13 is a structural schematic diagram of an electronic device suitable for the present application. DETAILED DESCRIPTION
[0075] The technical solutions in the embodiments of the present application will be described below with reference to the drawings.
[0076] In the embodiments of the present application, the meaning of "multiple" can be two or more, unless otherwise specified.
[0077] The embodiments of the present application are suitable for electronic devices, which can be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, a vehicle-mounted electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, and / or a smart city device, etc. The embodiments of the present application do not specially limit the specific type of the electronic device.
[0078] The embodiments of the present application are suitable for electronic devices supporting virtualization functions or calling virtualization capabilities. The virtualization functions complete the scheduling of upper and lower layers in the dimension of virtualization services. In some embodiments, the electronic device supports multiple virtualization services. Optionally, the virtualization services include audio virtualization services (or virtual audio services), video virtualization services (or virtual video services), etc. For example, the audio virtualization services include virtual microphone services, virtual speaker services, etc. For another example, the video virtualization services include virtual camera services, etc.
[0079] The embodiments of the present application do not make specific limitations on the service of scheduling or triggering the virtualization service. For example, when the user uses the multi-screen collaboration service, the super notification service, the super incoming call service or the office service, the electronic device triggers the virtualization service.
[0080] In some application scenarios, taking the multi-screen collaboration service as an example, the first electronic device as the master device can establish a communication connection with one or more second electronic devices as the slave device.
[0081] The embodiments of the present application do not make specific limitations on the communication connection mode between the first electronic device and the second electronic device. The communication connection between the first electronic device and the second electronic device can be wired connection (such as connection through USB connection line) or wireless connection. The wired connection refers to the connection mode established through the wired interface. The wired interface includes but is not limited to universal serial bus (USB) interface, Ethernet interface, high definition multimedia interface (HDMI) interface, video graphics array (VGA) interface, digital visual interface (DVI), serial interface, etc. The wireless connection refers to the connection mode established through the wireless communication interface. The wireless connection includes but is not limited to wireless fidelity (Wi-Fi) connection, Bluetooth connection, infrared (IR) connection, NFC connection, ZigBee connection, etc. near distance connection, or long distance connection (long distance connection includes but is not limited to mobile network supporting 2G, 3G, 4G, 5G, 6G and subsequent standard protocols). For example, the master device and the slave device can log in to the same user account (for example, the user's honor account), and then perform long distance connection through the server (for example, the multi-device collaboration server provided by honor).
[0082] The following will be described in combination with the application scenarios in Figure 1 As shown in Figure 1 , when the user A uses the mobile phone 102 to make a video call with the user B (using the mobile phone 103), the notebook computer 101 also needs to be used to process some work at the same time. In order to facilitate operation, the user A can perform multi-screen collaboration between the mobile phone 102 (corresponding to the first electronic device) and the notebook computer 101 (corresponding to the second electronic device). After the mobile phone 102 and the notebook computer 101 establish a collaborative connection, the audio and video of the mobile phone 102 can be switched to the notebook computer 101. At this time, the user A can control the mobile phone 102 to make a video call through the notebook computer 101.
[0083] After the mobile phone 102 and the notebook computer 101 establish the collaborative connection, the audio and video of the mobile phone 102 are switched to the notebook computer 101. Alternatively, an option can be popped up in the mobile phone 102, for the user to decide whether to switch the audio and video to the notebook computer 101. If the user confirms to switch the audio and video to the notebook computer 101, the sound collection about the microphone is collected from the notebook computer 101. If the user B (who is in a video call with the user A) makes a sound, the sound of the user B is also played from the speaker of the notebook computer 101. Meanwhile, the camera collection of the mobile phone 102 is switched to the camera collection of the notebook computer 101.
[0084] As shown in Figure 1 , the interface 11 displayed in the mobile phone 102 is the interface after the mobile phone 102 and the mobile phone 103 establish the video call connection. After the mobile phone 102 collaborates with the notebook computer 101, the interface displayed in the notebook computer 101 includes the interface 10. The interface 10 is the same as, or synchronized with, the interface 11 displayed in the mobile phone 102.
[0085] In the scenario of multi-screen collaboration shown in Figure 1 , the mobile phone 102 realizes the collaboration with the notebook computer 101 by invoking the virtualized audio and video service (including the virtualized audio service and the virtualized video service).
[0086] It should be noted that Figure 1 , only the multi-screen collaboration service is taken as an example for description, and the embodiments of the present application are not limited thereto.
[0087] It should be further noted that, for different types of services, the virtualized services invoked by the mobile phone can be the same or different, and the embodiments of the present application are not limited thereto.
[0088] It should be understood that Figure 1 , only the mobile phone and the notebook computer are taken as an example for description, and the embodiments of the present application are not limited thereto. For example, the mobile phone and the tablet, the mobile phone and the smart screen, and the mobile phone and the mobile phone are also applicable to the embodiments of the present application.
[0089] The embodiments of the present application provide a method for managing virtualized services. By adding part of modules (at least including a system relay layer) in the application framework layer in the software architecture, and modifying the scheduling flow of the virtualized services, the efficiency of multiple services when running at the same time is improved. The related modules involved in the embodiments of the present application will be described below in combination with the software architecture shown in Figure 2 .
[0090] Figure 2is an architecture diagram of a software system provided by an embodiment of the present application. The software system can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. Embodiments of the present application take the layered architecture as an example to describe the software system of the electronic device.
[0091] As shown in Figure 2 , the software system adopting the layered architecture is divided into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into five layers, from top to bottom, the application program layer, the application program framework layer, the system layer, the extension layer, and the kernel layer (linux kernel).
[0092] The application program layer can include multiple application programs, or in other words, a series of application program packages (android application package, APK). In an embodiment of the present application, as shown in Figure 2 , the application program layer includes instant messaging software and multi-screen collaboration application. The instant messaging software can be a system application or a third-party application, such as a social application such as WeChat, QQ, etc. In some embodiments, the multi-screen collaboration application is a system application.
[0093] It can be understood that the application programs included in the application program layer can be third-party application programs or system application programs.
[0094] It can be understood that the application program layer can also include other application programs. For example, as shown in Figure 2 , the application program layer can also include a gallery, a map, WIFI, Bluetooth, a short message, music, a call, navigation, a video, and a camera.
[0095] The application program framework layer provides the application program layer with application program programming interfaces (application programming interface, API) and programming frameworks. The application program framework layer can include some predefined functions.
[0096] In an embodiment of the present application, the application program framework layer provides a function module for managing virtualization services. As shown in Figure 2 , the application program framework layer includes an interconnection service module. The interconnection service module includes an interface layer module, a connection layer module, and a system relay layer. Optionally, the application program framework layer includes a distributed mobile sensing development platform (DMSDP) framework layer; the DMSDP framework layer includes the interconnection service module.
[0097] The interface layer module in the interconnection service is used to provide an interface to realize the communication between the interconnection service module and the upper layer (application layer). For example, the interface layer module obtains a request from the application layer. For another example, the interface layer module sends signaling or data to the application layer. Illustratively, the interface layer module is a DMSDP software development kit (SDK) interface layer module.
[0098] The connection layer module is an intermediate conversion layer used to connect the interface layer module and the system relay layer. The connection layer module can also be called a wrapper DMSDP (Wrapper) connection layer, which obtains the service version supported by the system layer when the system relay layer is first loaded, and converts the corresponding service version, such as converting an Android interface definition language (AIDL) service into V2 and a hardware abstraction layer interface definition language (HIDL) service into V1.
[0099] The AIDL is a description language of an Android internal process communication interface, which defines the communication interface between processes through the AIDL to realize the inter-process communication. The AIDL is a solution for realizing remote procedure call (RPC) in the Android architecture.
[0100] The system relay layer is used to perform corresponding processing when the application layer service callback virtualization service. Illustratively, the system relay layer is a DMSDP system relay layer. The specific functions or roles of the system relay module will be described in detail in the timing interaction flow shown later.
[0101] Optionally, the interconnection service module further includes a data processing module, a transmission channel, and a capability collection. The data processing module is used to perform processing on the service data related to the interconnection service, including but not limited to data collection, data analysis, data packaging, data conversion, data query, data storage, and the like. The transmission channel is used to transmit data related to the interconnection service (or virtualization service). The capability collection module is used to collect the related virtualization capabilities supported by the local device and the opposite device (such as the device that performs multi-screen collaboration with the local device). Illustratively, the capability collection module is used to collect camera resolution information, the number of cameras, and the use state of audio or video.
[0102] It can be understood that the application framework layer further includes other virtualization service related modules. For example, optionally, Figure 2The device discovery service is configured to provide a framework interface of virtual services related to device discovery. The device transmission service is configured to provide a framework interface of virtual services related to device transmission function. The device connection service is configured to provide a framework interface of virtual services related to device connection function. The collaborative assistant service is configured to provide a framework interface of virtual services related to device collaboration function.
[0103] The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application layer and the application framework layer into binary files. The virtual machine is configured to perform functions such as management of object life cycle, stack management, thread management, security and exception management, and garbage collection.
[0104] The system layer can include a plurality of functional modules. In the embodiment of the present application, the system layer provides an adaptation functional module related to virtualization services. As shown in Figure 2 The system layer includes a camera virtualization adaptation layer and an audio virtualization adaptation layer.
[0105] The audio virtualization adaptation layer is configured to provide virtualization services related to audio. Optionally, the audio virtualization adaptation layer includes an audio AIDL service and an audio HIDL service.
[0106] In some embodiments, the audio virtualization adaptation layer includes virtualization services of different audio types, which can be integrated in the same service module. For example, the audio AIDL service includes a media audio speaker service, a modem speaker service, a media audio mic service, and a modem mic service.
[0107] The media audio includes, but is not limited to, ring tones, message alert tones, or notification tones, etc. The modem audio can be understood as a sound related to a person, including but not limited to, telephone call sound, call recording, etc.
[0108] The camera virtualization adaptation layer is configured to provide virtualization services related to cameras. Optionally, the camera virtualization adaptation layer includes a camera AIDL service and a camera HIDL service.
[0109] In some embodiments, the camera virtualization adaptation layer includes virtualization services of different modes of cameras, which can be integrated in the same service module. For example, the camera AIDL service includes a camera registration service and a camera cut stream service.
[0110] It can be understood that the system layer can also include other modules. Optionally, as shown in Figure 2As shown, the system layer also includes a multimedia platform, an audio framework, a codec module, and the like. The functions of the other modules can refer to the explanations in the related art.
[0111] It can also be understood that the virtualization adaptation layer in the system layer can be distinguished according to the system layer configuration, Figure 2 The above is only an exemplary description. For example, access and communication to the camera HIDL service and the audio HIDL service can be maintained. Alternatively, as the technology evolves or the Android version develops, Figure 2 The AIDL service (such as the camera AIDL service and the audio AIDL service) can also be included in the system layer, but the HIDL service (such as the camera HIDL service and the audio HIDL service) is not included; or, part of the AIDL service and part of the HIDL service can be included, such as the camera AIDL service and the audio HIDL service, and the like.
[0112] The extension layer refers to the extension layer of the hardware abstraction layer (HAL). As shown in Figure 2 As shown, the extension layer includes a media audio module, a modem module, a sensor module, a camera module, and a virtual camera module. The extension layer can be understood as a layer that is re-encapsulated according to the usage of the system layer, and is used to solve the adaptation problem of different drivers.
[0113] It can be understood that Figure 2 The extension layer shown can also include other modules, and the embodiments of the present application are not limited thereto.
[0114] The kernel layer is used to drive hardware resources. The kernel layer can include a plurality of driver modules. As shown in Figure 2 As shown, the kernel layer includes a display driver, a camera driver, a USB driver, a CPU driver, an audio driver, a network driver, a storage driver, and a print driver, and the like.
[0115] Figure 2 In the software architecture shown in
[0116] It should be understood that Figure 3 The layered structure shown does not constitute a specific limitation on the software system of the electronic device. In other embodiments of the present application, the software system of the electronic device can include more or less architecture than Figure 3 The layered architecture shown, or each layer of the software system of the electronic device can include more or less structure than Figure 3 The embodiments of the present application are not limited thereto.
[0117] In the multi-screen cooperation application, the mobile phone triggers a request for enabling the audio virtualization service in response to the user confirming the multi-screen cooperation with the peer device. It should be understood that the audio virtualization service is taken as an example for description, and the embodiments of the present application are not limited thereto. After the first electronic device and the second electronic device establish the multi-screen cooperation, the audio virtualization service is usually started by default. The request for enabling the audio virtualization service is transmitted to the application framework layer through the application program layer. The system relay layer in the interconnection service in the application framework layer performs cross-process access to check the service version type supported by the lower layer (system layer). Specifically, the system relay layer checks the audio virtualization adaptation layer in the system layer to determine whether the audio virtualization service supports the audio AIDL service or the HIDL service. The system layer returns the result to the system relay layer in the interconnection service. The system relay layer continues to return the result to the connection layer module in the interconnection service. The connection layer module in the interconnection service converts the result into a corresponding version number (V2 or V1) for recording and returns the version number to the interface layer in the interconnection service. The interface layer in the interconnection service returns the result of successful enabling to the application program layer.
[0118] In the current scheduling scheme of multiple virtualization services, one virtualization service corresponds to one registered callback (callback, which can be referred to as cb), or in the case of multiple virtualization services running simultaneously, multiple virtualization services establish multiple binder binding relationships with the system layer, thereby resulting in low running efficiency.
[0119] The callback function refers to a function that is called when certain conditions are met or events occur, and its execution is determined by the calling manner. The callback function can be passed as a parameter to other functions and called for execution when needed.
[0120] In addition, the management of multiple callbacks in the chip adaptation module (such as the aforementioned audio virtualization adaptation layer or camera virtualization adaptation layer) in the system layer is prone to cause concurrent conflict problems, such as frequent receipt of QQ notification messages, resulting in that the registered callback corresponding to the corresponding virtualization service is not cleaned up, thereby causing other messages to be unable to be transmitted to the upper layer. Under these problems, a new solution is urgently needed to manage multiple virtualization services. The historical scheduling scheme and the newly proposed scheduling scheme of the present application are introduced below. Figure 3 The historical scheduling scheme and the newly proposed scheduling scheme of the present application are introduced below.
[0121] Reference Figure 3 , Figure 3 is a schematic diagram of the historical scheme of the virtualization service and the decoupling scheme proposed by the present application. Figure 3The upper part of the figure in FIG. 1 shows a historical scheduling scheme. In the historical scheduling scheme, a plurality of virtualization services (such as service 1, service 2, …, service n, n is an integer greater than or equal to 2, as shown in the figure) are in a one-to-one correspondence with callbacks (or callback functions). In other words, the virtualization services are independent of each other. The term "callback" is a programming term understood by those skilled in the art, and its explanation can be referred to the description in the related art.
[0122] Taking virtualization service 1 (for ease of description, the virtualization service can be referred to as a service) as an example, service 1 corresponds to callback 1; callback 1 calls HIDL service 1 after being processed by the system dependency library, and HIDL service 1 runs virtualization service 1 by calling HIDL callback 1 in the HIDL chip service. Similarly, the callback process of other virtualization services can refer to the callback process of virtualization service 1, that is, each virtualization service corresponds to a corresponding callback.
[0123] In the above historical scheme, a plurality of virtualization services establish a plurality of binding relationships with the system dependency library, which causes the problem of low running efficiency when a plurality of virtualization services run at the same time. Figure 3 The lower part of the figure in FIG. 1 shows a decoupling scheme proposed by the embodiments of the present application. The decoupling scheme is a callback scheme added on the basis of the historical scheme. The decoupling scheme proposed by the embodiments of the present application can be compatible with the historical version at the same time, that is, the problem of version compatibility is considered.
[0124] The above decoupling scheme includes a callback scheme of a new version (V2) and a callback scheme of an old version (V1). After a service is triggered at the application layer, version judgment is performed first, that is, the version type of the virtualization service calling is detected. In other words, it is judged whether the corresponding version type is V1 or V2, and the detection result is returned to the system dependency library. After intermediate processing, the system dependency library can return the version information to the application layer. The version information can be the new version (V2) or the old version (V1). When the virtualization service triggered at the application layer is the old version (V1), the scheduling can be performed through the callback scheme of the old version (V1) shown in FIG. 2. When the virtualization service triggered at the application layer is the new version (V2), the scheduling can be performed through the callback scheme of the new version (V2) shown in FIG. 3. Figure 3 Figure 4 The above decoupling scheme includes a callback scheme of a new version (V2) and a callback scheme of an old version (V1). After a service is triggered at the application layer, version judgment is performed first, that is, the version type of the virtualization service calling is detected. In other words, it is judged whether the corresponding version type is V1 or V2, and the detection result is returned to the system dependency library. After intermediate processing, the system dependency library can return the version information to the application layer. The version information can be the new version (V2) or the old version (V1). When the virtualization service triggered at the application layer is the old version (V1), the scheduling can be performed through the callback scheme of the old version (V1) shown in FIG. 2. When the virtualization service triggered at the application layer is the new version (V2), the scheduling can be performed through the callback scheme of the new version (V2) shown in FIG. 3.
[0125] The execution process of the callback scheme of the old version (V1) can be the same as the callback scheme of the old version (V1) shown in FIG. 2. Figure 4 The upper part of the diagram shows a consistent historical approach, where each virtualization service has a one-to-one relationship with a callback. For example, service n+1 corresponds to callback V11, which, after intermediate processing, corresponds to HIDL service 1, and HIDL service 1 corresponds to HIDL callback 1; service n+2 corresponds to callback V12, which, after intermediate processing, corresponds to HIDL service 2, and HIDL service 2 corresponds to HIDL callback 2, and so on.
[0126] Regarding the callback scheme for the new version (V2), there is a many-to-one relationship between multiple virtualization services and callbacks; that is, multiple virtualization services correspond to one callback. Figure 4 Taking the callback scheme of the new version (V2) shown in the lower part of the diagram as an example, multiple virtualization services correspond to one callback (V2). For example, service 1, service 2, ..., service n all correspond to callback V2, and callback V2 can directly connect to the AIDL service, which corresponds to the AIDL callback. As you can see, compared with the old version's callback scheme, the new version supports multiple virtualization services corresponding to the same callback. This can effectively reduce the number of bindings between the relay layer and the system-level AIDL process services, significantly improving access efficiency.
[0127] It should be noted that, Figure 4 The multiple virtualization services involved have a many-to-one relationship with the callbacks. Specifically, it can be understood as multiple virtualization services accessing the same service module in the system layer corresponding to the same registration callback.
[0128] For example, the virtualization services of multiple audio classes include: audio speaker service, audio mic service, modem speaker service, and modem mic service, and these multiple virtualization services correspond to the same global callback.
[0129] For example, in a scenario where the device is connected to multiple USB cameras, the virtualization services for multiple camera registration classes include: camera_1_register service; camera_2_register service, ..., camera_n_register service, etc.; the virtualization services for these multiple camera registration classes can correspond to the same registration callback.
[0130] For example, when the device includes multiple cameras locally (e.g., telephoto camera, wide-angle camera, front-facing camera, etc.), the virtualization services for multiple camera classes include: camera_1_translator service; camera_2_translator service, ..., camera_n_translator service, etc.; the virtualization services for these multiple camera classes can correspond to the same registration callback.
[0131] It can be understood that the above description of the plurality of virtualization services is only an example description, and the embodiments of the present application are not limited thereto.
[0132] In some embodiments, in the case where a plurality of virtualization services run simultaneously, the plurality of virtualization services need to call back the system layer AIDL process service through the system relay layer at the same time. Compared with the scheme that each virtualization service corresponds to one callback, the way that the plurality of virtualization services correspond to one callback provided by the embodiments of the present application can greatly reduce the number of binder bindings and improve business access efficiency.
[0133] In addition, the management of the system layer AIDL process service for multiple callbacks (such as the scenarios of super incoming calls, super notifications, and multi-screen collaboration) can effectively reduce the occurrence of conflicts.
[0134] In order to more intuitively understand the scheduling scheme of the plurality of virtualization services, the following describes an example in conjunction with Figure 4
[0135] Figure 4 is an example diagram of an access relationship of a virtualized audio / video multi-service provided by the embodiments of the present application. As shown in Figure 4 , the audio service connection layer includes a plurality of virtualization services; the audio service client includes an audio service mapping table and a call audio service mapping table. The system layer includes an audio system and a call audio system. The HAL layer includes an audio service and a call audio service.
[0136] For the audio virtualization service, the plurality of virtualization services related to the audio virtualization service (such as the device 1 media audio microphone service, the device 2 media audio microphone service, the device 1 media audio speaker service, and the device 2 media audio speaker service shown in Figure 5A ) correspond to the same audio service mapping table. The plurality of virtualization services related to the audio virtualization service correspond to the same callback, which can be understood as a many-to-one relationship between the plurality of virtualization services and the callback. Among them, the device 1 and the device 2 can be understood as devices that establish a communication connection with the first electronic device. Or, the device 1 and the device 2 are examples of the second electronic device.
[0137] Similarly, for the call audio virtualization service, the plurality of virtualization services related to the call audio service (such as the device 1 call audio microphone service, the device 2 call audio microphone service, the device 1 call audio speaker service, and the device 2 call audio speaker service shown in Figure 5A ) correspond to the same call audio service mapping table. The plurality of virtualization services related to the call audio service correspond to the same callback, which can be understood as a many-to-one relationship between the plurality of virtualization services and the callback.
[0138] It should be understood that,Figure 5A The access relationship of the plurality of virtualization services shown in FIG. 8 is only an exemplary description, and embodiments of the present application are not limited thereto.
[0139] It should be noted that Figure 2 In FIG. 8, the case that a plurality of media audio services correspond to the same registration callback and the case that a plurality of call audios correspond to the same registration callback are shown, and embodiments of the present application are not limited thereto. In other words, embodiments of the present application do not make specific limitations on the dimensions or categories of the same category of virtualization services. For example, for a plurality of virtualization services belonging to the same audio category service, the same registration callback can be corresponded. For example, for a plurality of virtualization services belonging to the same media audio category service in the audio category service, the same registration callback can be corresponded. For example, for a plurality of virtualization services belonging to the same call audio category service in the audio category service, the same registration callback can be corresponded.
[0140] Optionally, the different examples of the plurality of virtualization services and the registration callback listed above can depend on the setting of the service module in the system layer. If the audio category service of different audio types in the system layer is one module, then the plurality of virtualization services belonging to the same audio category service can correspond to the same registration callback. In some embodiments, with the evolution of technology, if the service of the same large category (such as the audio category service) in the system layer is divided into more refined modules, for example, the system layer includes the media audio category AIDL service and the call audio category AIDL service, then the plurality of media audio category services correspond to the same registration callback, and the plurality of call audio category services correspond to the same registration callback, and embodiments of the present application do not make specific limitations thereon.
[0141] Reference is made to Figure 5A , Figure 2 is a timing example diagram of the first electronic device enabling a virtualization service according to an embodiment of the present application.
[0142] In some embodiments, Figure 5A The timing flow shown in FIG. 8 can be applied to Figure 2 The software architecture shown in FIG. 8. Optionally, Figure 5A The first service shown in FIG. 8 is triggered by an application in the application layer in Figure 2 For example, a multi-screen collaboration application or an instant messaging software application. Figure 5A The interface layer module (such as the DMSDP SDK interface layer) shown in FIG. 8 is Figure 2 The interface layer module shown in FIG. 8; Figure 5A The connection layer module (such as the DMSDP Wrapper connection layer) shown in FIG. 8 is Figure 5B The connection layer module shown in FIG. 8; Figure 5B The relay layer module shown in FIG. 8 can be Figure 5C The system relay layer shown in the application framework layer in FIG. 8; Figure 4The AIDL process audio service (including a media audio service or a call audio service) shown in the middle can be Figure 3 The audio AIDL service in the audio virtualization service shown in the system layer.
[0143] As shown in Figure 5A Taking the first service as an example, the process of enabling the virtualization service includes the following steps:
[0144] Step 1: The first service in the application layer enables the virtualization service.
[0145] The embodiments of the present application do not make specific limitations on the service and / or application that triggers the virtualization service. The first service is used to generally refer to a service that needs to trigger the virtualization service. For example, the first service can be a multi-screen collaboration service, a super incoming call service, a super notification service, a call sharing service, a notification sharing service, an office service, and the like.
[0146] The embodiments of the present application do not make specific limitations on the application program initiated by the first service. For example, the application program can be a multi-screen collaboration application program, a video call application program, and the like.
[0147] The embodiments of the present application do not make specific limitations on the number and / or type of virtualization services enabled. The specific number and / or type can depend on the triggering of the service and / or the implementation of the application.
[0148] Generally speaking, for the multi-screen collaboration service, the first enabled service is an audio type service. Taking the multi-screen collaboration service as an example, the multi-screen collaboration service enables the virtualization service, which includes enabling a media audio speaker service and / or a media audio microphone service.
[0149] The timing of enabling the virtualization service is described below from the perspective of UX interaction.
[0150] In some scenarios, for the multi-screen collaboration service, the virtualization service is enabled when the multi-screen collaboration service is enabled, or in other words, when the device is confirmed to be in collaboration. The embodiments of the present application do not make specific limitations on the operation of confirming the execution of the multi-screen collaboration.
[0151] In some embodiments, the first electronic device implements a collaborative connection with the second electronic device through a "Bluetooth" function. For example, the user opens the "multi-screen collaboration" switch option on the PC side, and turns on the Bluetooth function of the mobile phone. The mobile phone displays a connection interface, which includes a "connect" control; the mobile phone initiates a collaborative connection in response to the user's operation of clicking the "connect" control. After the connection is successful, the interface of the mobile phone is displayed on the PC side. When the mobile phone detects the user's operation of clicking the "connect" control, the virtualization service, such as the audio virtualization service, can be enabled.
[0152] Figure 5AAn example of a co-connection interface is shown. As shown in Figure 5A If the notebook computer 101 is enabled for multi-screen co-operation and the mobile phone 102 is enabled for Bluetooth, a connection window 210 can be popped up in the interface of the mobile phone 102. The window 210 includes a connection control and a cancel control. The window 210 is used to prompt the user to establish a connection to enable data sharing between devices. The mobile phone 102 starts to establish a connection with the notebook computer 101 in response to the user clicking the connection control. After the notebook computer 101 and the mobile phone 102 successfully establish a connection, the interface of the mobile phone 102 is displayed in the notebook computer 101.
[0153] It should be understood that the above is only an example in which the first electronic device is discovered by the second electronic device by enabling Bluetooth. The embodiments of the present application are not limited thereto. The first electronic device can also enable other forms of sharing functions to be in a discoverable state by other devices. For example, access to the same local area network, discoverable by devices in the local area network; access to a near field network, discoverable by other devices in the near field network; log in to an account, discoverable by other devices under the account, and the like.
[0154] In some embodiments, the first electronic device establishes a co-connection with the second electronic device through a "tap-to-connect" function or a "one-touch connection" function. For example, the mobile phone can be connected to the notebook computer by tapping the NFC area on the back of the mobile phone against the magic-link tag of the notebook computer. It should be understood that this connection method requires both the mobile phone and the notebook computer to support NFC functions.
[0155] In some embodiments, the first electronic device establishes a co-connection with the second electronic device through a scanning code function. For example, as shown in Figure 5A The mobile phone 102 establishes a connection with the notebook computer 101 by scanning the two-dimensional code displayed in the notebook computer 101. After scanning the two-dimensional code displayed in the notebook computer 101, the mobile phone 102 displays a connection interface, which includes a window 210 including a "connect" control. The mobile phone 102 initiates a co-connection in response to the user clicking the "connect" control. After the notebook computer 101 and the mobile phone 102 successfully establish a connection, the interface of the mobile phone 102 is displayed in the notebook computer 101.
[0156] In some embodiments, the first electronic device determines to establish a co-connection with the second electronic device in response to the user's operation on the mobile phone. The user's operation on the mobile phone includes, but is not limited to, clicking the confirmation connection in the window popped up on the screen, or clicking a shortcut key to implement co-connection.
[0157] In some embodiments, the first electronic device establishes the collaborative connection after being connected to the second electronic device (e.g., a PC) through a data line (e.g., a USB interface). For example, after a mobile phone is connected to a PC through a data line, a connection interface pops up in the mobile phone, and the interface includes a "connect" control. The mobile phone initiates the collaborative connection in response to a user's operation of clicking the "connect" control.
[0158] In some other scenarios, there are other services (e.g., super incoming call, shared call) that enable virtualization services.
[0159] In some embodiments, the first electronic device (e.g., a mobile phone) does not establish a collaborative connection with the second electronic device (e.g., a PC), but the two devices belong to the same trust circle. In the scenario of a shared call, if the first electronic device receives an incoming call, the virtualization service is enabled.
[0160] For example, the mobile phone enters a "super terminal" interface, and the "super terminal" interface includes multiple smart devices. The mobile phone establishes a collaborative connection with the PC in response to a user's operation of clicking the PC in the interface.
[0161] It should be understood that the above-described various implementations of triggering the multi-screen collaborative connection are only exemplary descriptions, and the embodiments of the present application are not limited thereto.
[0162] For example, taking the multi-screen collaborative service as an example, the multi-screen collaborative service enables virtualization services including the following steps:
[0163] Step 1-1, enabling a media audio speaker (audio speaker) service.
[0164] Step 1-2, enabling a media audio microphone (audio mic) service.
[0165] In some embodiments, the audio virtualization service is usually started by default. This is because the audio virtualization service has the highest priority among the multiple virtualization services. Therefore, when the user confirms to start the multi-screen collaborative service, the media audio virtualization service is triggered first.
[0166] Optionally, for the multi-screen collaborative service, the call audio (modem) service is also triggered in the scenario of the electronic device receiving an incoming call.
[0167] For example, taking the multi-screen collaborative service as an example, the multi-screen collaborative service enables virtualization services including the following steps in addition to the above steps 1-1 and 1-2:
[0168] Step 1-3, enabling a call audio microphone (modem mic) service.
[0169] Step 1-4, enabling modem speaker service.
[0170] Of course, the above is only described by taking the multi-screen cooperation service as an example, and the embodiments of the present application are not limited thereto. In fact, which virtualization services are enabled depends on the triggering of the service and / or the application implementation.
[0171] It should be noted that the above is only an example of the multi-screen cooperation service enabling multiple virtualization services, and the embodiments of the present application are not limited thereto. For example, during the process in which the user uses the electronic device for multi-screen cooperation, if the electronic device receives a video call service, the camera registration service also needs to be enabled. The process of enabling the photo album registration service will be described later.
[0172] It should be understood that the virtualization services enabled in step 1 can include more quantities and / or categories, and the embodiments of the present application are not limited thereto. Figure 5A Steps 1-1 to 1-4 shown in the above are only example descriptions.
[0173] It should also be understood that the embodiments of the present application do not make specific limitations on the order of the enabled virtualization services. For example, steps 1-1 to 1-4 can be executed simultaneously, or can be executed in sequence. For another example, steps 1-1 and 1-2 can be earlier than steps 1-3 and 1-4. For another example, step 1-1 can be before step 1-2, or step 1-1 can be after step 1-2.
[0174] Step 2, the interface layer module registers the virtualization services to the connection layer.
[0175] After receiving the virtualization services enabled by the first service, the interface layer module registers each virtualization service to be enabled in step 1 through a registration function.
[0176] In some embodiments, registering the virtualization services to be enabled includes: registering and renaming the device information corresponding to the virtualization services; and registering and renaming the service information corresponding to the virtualization services.
[0177] Optionally, in the case where step 1 includes the foregoing steps 1-1 to 1-4, then correspondingly, step 2 includes the following steps:
[0178] Step 2-1, the interface layer module registers the media audio speaker service.
[0179] Exemplarily, for the media audio speaker service in step 1-1, registration is performed through reg(device1, service1). Wherein, device1 is used to represent the name of the device (for example, the device can be the second electronic device) corresponding to the media audio speaker service; service1 is used to represent the name of the media audio speaker service. Step 2-1 occurs after step 1-1.
[0180] Here, it is uniformly stated that device1 is used to represent the device information (for example, the second electronic device) corresponding to the invocation of a certain virtualization service, and the embodiment of the present application does not limit the specific form of the device information. The present application only takes device1 as an example for description. For example, in specific implementation, device1 can be a number or a letter, which can be obtained by hashing the MAC address or IP address corresponding to the device.
[0181] Here, it is also uniformly stated that the timing diagram of the embodiment of the present application takes the connection of the first electronic device and one device (for example, the second electronic device) as an example, and enables multiple virtualization services of the same device as an example for description, which is not limited to this. The embodiment of the present application is also applicable to the scenario of enabling multiple different virtualization services when the first electronic device and multiple devices are cooperatively connected. Or, the embodiment of the present application is also applicable to the scenario of enabling different virtualization services of different devices by the first electronic device.
[0182] Exemplarily, for the first electronic device, the audio virtualization service is enabled when the second electronic device is connected for multi-screen cooperation; the call audio virtualization service is enabled when the third electronic device is shared for call; the camera registration service is enabled when the fourth electronic device is shared for camera, and so on.
[0183] Step 2-2, the interface layer module registers the audio microphone service.
[0184] Exemplarily, for the media audio microphone service in step 1-2, registration is performed through reg(device1, service2). Wherein, device1 is used to represent the name of the device corresponding to the media audio microphone service; service2 is used to represent the name of the media audio microphone service. Step 2-2 occurs after step 1-2.
[0185] Step 2-3, the interface layer module registers the call audio (modem) microphone service.
[0186] Exemplarily, for the call audio microphone service in step 1-3, registration is performed through reg(device1, service3). Here, device1 is used to represent the name of the device corresponding to the call audio microphone service; and service3 is used to represent the name of the call audio microphone service. Step 2-3 occurs after step 1-3.
[0187] In step 2-4, the interface layer module registers the call audio speaker service.
[0188] Exemplarily, for the call audio speaker service in step 1-4, registration is performed through reg(device1, service4). Here, device1 is used to represent the name of the device corresponding to the call audio speaker service; and service4 is used to represent the name of the call audio speaker service. Step 2-4 occurs after step 1-4.
[0189] It can be seen that, for the virtualization services to be enabled in steps 1-1 to 1-4, the interface layer module performs corresponding registration.
[0190] It should be noted that the specific form of the registration function described above is only exemplary, and the embodiments of the present application are not limited thereto. Alternatively, in specific implementation, other prefixes can be added before the service field in the registration function to distinguish different types of calls. For example, for the case of enabling media audio virtualization services, a prefix audio can be added before the service field, such as reg(device1, audio_service1); for the case of enabling call audio virtualization services, a prefix modem can be added before the service field, such as reg(device1, modem_service3), and so on.
[0191] It should be understood that the above enabled multiple virtualization services are described by taking the same device (such as device1) as an example, and the embodiments of the present application are not limited thereto. For example, the multiple virtualization services can be services triggered by different devices.
[0192] Alternatively, the connection layer module is configured to obtain the service version supported by the system layer when the system layer module is loaded for the first time, and convert the corresponding service AIDL into V2 and the corresponding service HIDL into V1. After obtaining the version information, the subsequent call solution can be selected based on the version information. If it is a V2 version, the V2 version corresponding call solution is executed; if it is a V1 version, the V1 version corresponding call solution is executed. For details, refer to the decoupling solution shown in Figure 5A It can be understood that, Figure 6The modules of the system layer shown in the figure are described by taking an AIDL process as an example. Embodiments of the present application are also compatible with the callback scheme of an HIDL process.
[0193] Embodiments of the present application do not make specific limitations on the time node at which the connection layer module acquires the version information. For example, the connection layer module can perform the judgment when it first receives a message for calling a service module of a process. For example, taking the case that step 1-1 is the first time to load the audio service in the system layer, after receiving step 1-1, the connection layer can first acquire the version information supported by the audio service in the system layer.
[0194] Step 3, the connection layer module registers the callback to the system relay layer.
[0195] In the process of enabling the audio virtualization service, the connection layer module is used to register the callback to the system relay layer.
[0196] Optionally, in the case that step 1 includes the foregoing steps 1-1 to 1-4, and step 2 includes the foregoing steps 2-1 to 2-4, then correspondingly, step 3 includes the following steps:
[0197] Step 3-1, the connection layer module registers the callback of the audio speaker service.
[0198] For example, for the registration function of the media audio speaker service in step 2-1, the callback is registered by regcb(d1, s1, cb1). Wherein, d1 can refer to the explanation of device1 in step 2; s1 refers to the explanation of service1 in step 2; cb1 is used to represent the callback corresponding to the media audio speaker service. Step 3-1 occurs after step 2-1.
[0199] Step 3-2, the connection layer module registers the callback of the media audio microphone service.
[0200] For example, for the media audio microphone service in step 2-2, the registration is performed by regcb(d1, s2, cb2). Wherein, d1 can refer to the explanation of device1 in step 2; s2 refers to the explanation of service2 in step 2; cb2 is used to represent the callback corresponding to the media audio microphone service. Step 3-2 occurs after step 2-2.
[0201] Step 3-3, the connection layer module registers the callback of the modem microphone service.
[0202] Exemplarily, for the call audio microphone service in step 1-3, registration is performed through regcb(d1, s3, cb3). Wherein, d1 can refer to the explanation of device1 in step 2; s3 refers to the explanation of service3 in step 2; and cb3 is used to represent the callback corresponding to the call audio microphone service. Step 3-3 occurs after step 2-3.
[0203] In step 3-4, the connection layer module registers the callback of the call audio speaker service.
[0204] Exemplarily, for the call audio speaker service in step 1-4, registration is performed through regcb(d1, s4, cb4). Wherein, d1 can refer to the explanation of device1 in step 2; s4 refers to the explanation of service4 in step 2; and cb4 is used to represent the callback corresponding to the call audio speaker service. Step 3-4 occurs after step 2-4.
[0205] In step 4, the system relay layer registers the global callback, increases the count, and saves the information.
[0206] In some embodiments, when the system relay layer receives the registration callback process initiated by the connection layer, it first judges whether there is a global callback. If there is no global callback, the system relay layer creates a global callback (such as the first global callback function); if there is a global callback, it is not necessary to create, and the counter is incremented by one, and the corresponding information is saved, including but not limited to: the device information and service information corresponding to the virtualization service.
[0207] Taking the registration of the callback of the audio speaker service by the connection layer module in step 3-1 as an example, the system relay layer judges that this is the first time to initiate the registration callback, and there is no global callback function, so it creates a global callback function, such as regcb(d0, s0, cb0). The system relay layer receives one registration callback from the connection layer, and increments the count of cb by one, and at the same time saves the corresponding relationship of the corresponding device information and service information, such as (d, s).
[0208] For the case of the first registration of the global callback of the audio virtualization service, the system relay layer can also save the global callback in the AIDL process (that is, the AIDL process audio service or modem service) through the registration function.
[0209] Optionally, in step 5-1, the system relay layer sends the first registration callback to the AIDL process audio service; and in step 5-2, the AIDL process audio service returns the result.
[0210] Exemplarily, the system relay layer saves the global callback in the AIDL process audio service through regcb(d0, s0, cb0). After receiving the global callback sent by the system relay layer, the AIDL process audio service returns a result to the system relay layer after saving is completed, so as to tell the system relay layer that saving is successful.
[0211] Step 6, the system relay layer performs registration information notification.
[0212] That is, the system relay layer can notify the AIDL process of the registration information (which can specifically include device information and service information, or the correspondence of the two).
[0213] Optionally, in the case that step 1 includes the foregoing steps 1-1 to 1-4, step 2 includes the foregoing steps 2-1 to 2-4, and step 3 includes the foregoing steps 3-1 to 3-4, then correspondingly, step 6 includes the following steps:
[0214] Step 6-1, the system relay layer performs registration information notification of the call audio speaker service.
[0215] For example, the registration information of the call audio speaker service is (d1, s1).
[0216] Step 6-2, the system relay layer performs registration information notification of the call audio microphone service.
[0217] For example, the registration information of the call audio microphone service is (d2, s2).
[0218] Step 6-3, the system relay layer performs registration information notification of the call audio microphone service.
[0219] For example, the registration information of the demodulator microphone service is (d3, s3).
[0220] Step 6-4, the system relay layer performs registration information notification of the call audio speaker service.
[0221] For example, the registration information of the call audio speaker service is (d4, s4).
[0222] Step 7, the AIDL process audio service of the system layer saves the global callback.
[0223] Step 8, the AIDL process audio service of the system layer saves the registration information.
[0224] It should be noted that services of the same type in the AIDL process of the system layer can be integrated in the same process service module. For example, Figure 6The AIDL process audio service of the AIDL process is shown in FIG. 6, which specifically includes an AIDL process media audio service or an AIDL process call audio service. The embodiments of the present application are not limited thereto. Of course, the registration information notification initiated by the system relay layer can be saved to the corresponding AIDL process service.
[0225] In some embodiments, the AIDL process audio service of the system layer can save the registration information of the foregoing steps 6-1 to 6-4. This is because steps 6-1 to 6-4 correspond to the respective virtualization services of steps 1-1 to 1-4, and the virtualization services involved in steps 1-1 to 1-4 are all audio service related virtualization services.
[0226] The foregoing steps describe the relevant processes in combination with the first service enabled multiple virtualization services of the application layer. In actual applications, some services can be triggered by the underlying layer. For the events triggered by the underlying layer, Figure 6 The processes in FIG. 6 can also be processed.
[0227] Optionally, Figure 5A The processes shown in FIG. 6 also include:
[0228] Step 9-1: The AIDL process service module of the system layer reads the information.
[0229] In some embodiments, after receiving the event triggered by the underlying layer, the AIDL process audio service of the system layer reads the event and determines the device information and service information corresponding to the event, i.e., <d, s>. For example, the device information and service information corresponding to the event are <d1, s2>.
[0230] Step 9-2: The AIDL process audio service of the system layer notifies the system relay layer of the process event.
[0231] Taking the device information and service information corresponding to the event as <d1, s2> for example, the AIDL process audio service of the system layer notifies the system relay layer of <d1, s2>.
[0232] Step 9-3: The system relay layer performs global callback.
[0233] For example, the system relay layer can perform global callback upon receiving <d1, s2> and pass <d1, s2> to the connection layer.
[0234] Step 9-4: The connection layer module performs corresponding logical processing based on the information (such as <d1, s2>) returned by the system relay layer.
[0235] It can be understood that the logical processing performed by the connection layer based on the information returned by the system relay layer can be combined with the specific type of the event and described in the related art, which will not be described here.
[0236] It should be understood that Figure 6 The multiple virtualization services enabled shown are only described as examples of calling audio service capabilities, and the embodiments of this application are not limited to this. The embodiments of this application are also applicable to calling other types of services or enabling other types of virtualization services.
[0237] Combined with the preceding text Figure 6 This illustrates the specific process for enabling one or more virtualization services. Of course, when a business requires shutting down or stopping a virtualization service, a process for de-enabling the virtualization service can be initiated. The following will combine... Figure 5A The examples in the text are described below.
[0238] Figure 5A This is a timing example diagram of disabling virtualization services according to an embodiment of this application. Figure 6 The modules shown can be referenced. Figure 6 The description in [the original text] will not be repeated here. For example... Figure 5A As shown, it includes:
[0239] Step 1: Enable virtualization services in the first business.
[0240] For example, taking multi-screen collaboration as an example, enabling virtualization services in multi-screen collaboration includes the following steps:
[0241] Step 1-1: Enable the Media Audio Speaker service.
[0242] Steps 1-2: Enable the Media Audio Microphone service.
[0243] Steps 1-3: Disable the call audio microphone service.
[0244] Steps 1-4: Disable the call audio microphone service.
[0245] Understandable. Figure 6 The disabled virtualization service shown in the image can be used with Figure 7A The corresponding virtualization service enabled is shown in the diagram. For example, in... Figure 7B Multiple virtualization services enabled by the middle can be accessed through Figure 7A The enable process is executed in a manner that allows it to be de-enabled.
[0246] Step 2: Unregister the virtualization service at the interface layer.
[0247] After receiving the first business request to disable the virtualization service, the interface layer module unregisters each virtualization service to be disabled in step 1 using the unregistration function.
[0248] Optionally, step 2 includes the following steps:
[0249] Step 2-1, the interface layer module unregisters the media audio speaker service.
[0250] By way of example, the media audio speaker service is unregistered by unreg(device1, service1).
[0251] Step 2-2, the interface layer module unregisters the media audio microphone service.
[0252] By way of example, the media audio microphone service is unregistered by unreg(device1, service2).
[0253] Step 2-3, the interface layer module unregisters the call audio microphone service.
[0254] By way of example, the call audio microphone service is unregistered by unreg(device1, service3).
[0255] Step 2-4, the interface layer module unregisters the call audio speaker service.
[0256] By way of example, the call audio speaker service is unregistered by unreg(device1, service4).
[0257] Step 3, the connection layer module unregisters the callbacks for the virtualization service.
[0258] In the process of de- enabling the virtualization service, the connection layer module is configured to unregister the callbacks.
[0259] Optionally, in the case that step 1 includes the aforementioned steps 1-1 through 1-4, and step 2 includes the aforementioned steps 2-1 through 2-4, then correspondingly, step 3 includes the following steps:
[0260] Step 3-1, the connection layer module unregisters the callbacks for the audio speaker service.
[0261] By way of example, the callbacks for the media audio speaker service are unregistered by unregcb(device1, service1).
[0262] Step 3-2, the connection layer module unregisters the callbacks for the audio microphone service.
[0263] By way of example, the callbacks for the media audio microphone service are unregistered by unregcb(device1, service2).
[0264] Step 3-3, the connection layer module unregisters the callbacks for the call audio microphone service.
[0265] For example, the unregcb(device1, service3) is used to unregister the callback of the call audio microphone service.
[0266] Step 3-4, the connection layer module unregisters the callback of the call audio speaker service.
[0267] For example, the unregcb(device1, service3) is used to unregister the callback of the call audio speaker service.
[0268] It should be noted that when the connection layer module initiates the unregistration of the callback to the system relay layer, only the device information and the service information corresponding to the virtualization service to be disabled need to be sent, and the corresponding callback does not need to be carried. This is because the system relay layer not only saves the device information and the service information corresponding to the virtualization service, but also saves the callback information, such as the callback count, the number of callbacks or the callback number. For example, when the system relay layer receives the unregcb(device1, service1) from the connection layer module, it can delete (device1, service1) and reduce the cb count by 1.
[0269] Step 4, the system relay layer unregisters the callback, reduces the count, and deletes the information.
[0270] In some embodiments, when the system relay layer receives the unregistration callback initiated by the connection layer, it performs a minus one operation on the counter for each unregistration callback of a virtualization service, and deletes the device information and the service information corresponding to the virtualization service, or deletes the mapping table between the service information and the device information.
[0271] For example, assuming that the original count of the counter is 4, when the unregcb(device1, service1) is received, the counter is reduced by 1, and the (d1, s1) information is deleted.
[0272] It should be noted that for the received unregistration callback, the unregistration callback is not a real deletion of the callback, and the unregistration callback can be understood as a corresponding decrease of the counter, and the device information and the service information corresponding to the corresponding virtualization service are deleted. If the counter is decremented to a preset value (such as zero), the callback is actually deleted at this time. And the system relay layer will correspondingly notify the AIDL process (corresponding service) in the system layer to perform deletion.
[0273] Optionally, step 5, if the counter is 0, the system relay layer deletes the global callback.
[0274] Exemplarily, assuming that the counter is originally 4, after receiving unregcb(d1, s1, cb1), unregcb(d1, s2, cb2), unregcb(d1, s3, cb3) and unregcb(d1, s4, cb4) in sequence, the counter is decremented to 0, at which time the global callback created previously can be deleted, and the AIDL process is notified to delete the global callback.
[0275] In step 6, the system relay layer cancels the registered callback in the AIDL process audio service.
[0276] Exemplarily, the system relay layer notifies the AIDL process audio service to delete the callback through unregcb(d0, s0, cb0).
[0277] It should be noted that the global callback is deleted and the system layer is notified to delete the global callback only when the counter is 0. This is because there can be multiple virtualization services calling the same process service module. If the global callback is deleted after a certain virtualization service is disabled, or the channel calling the process service module is closed, other virtualization services cannot be normally used or called. In order to ensure that all virtualization services calling the same process service module can be normally run, the global callback needs to be deleted only when all virtualization services are disabled, or all virtualization services initiate the cancellation of the registered callback, for example, the callback counter is 0.
[0278] In step 7, the AIDL process audio service deletes the global callback.
[0279] In step 8, the AIDL process audio service deletes the registration information.
[0280] In some embodiments, the AIDL process audio service deleting the registration information can be understood as deleting the mapping table between the device information and the service information. For example, if unregcb(d0, s0, cb0) is received, the mapping table between the saved device information and the service information, (d1, s1), (d1, s2), (d1, s3) and (d1, s4) is deleted.
[0281] Based on the process of disabling the virtualization service shown in Figure 7A The callback deletion can be implemented when the virtualization service is triggered to be disabled based on the process of disabling the virtualization service shown in
[0282] The implementation process of enabling the audio virtualization service and disabling the audio virtualization service is respectively shown in the foregoing Figure 7A and Figure 5A The implementation process of enabling the audio virtualization service and disabling the audio virtualization service is respectively shown in the foregoing
[0283] Before introducing the specific process, it needs to be explained that there are some differences between the operations related to the camera virtualization service and the audio virtualization service. For the same camera virtualization service but for different mode types of services, a field needs to be added to distinguish different scenarios.
[0284] In some embodiments, the camera registration service and the camera cut stream service both belong to the camera virtualization service, and the two services are the same, but the specific mode types are not the same, and the mode field can be introduced to distinguish them. Exemplarily, mode1 corresponds to the camera registration service; mode2 corresponds to the camera cut stream service.
[0285] The following describes the process of enabling the camera registration service (such as the service that is usually triggered by a video call) in combination with Figure 7A and Figure 7A .
[0286] Referring to Figure 5A , Figure 5A , a timing example diagram of enabling the camera registration service is shown. As Figure 10 indicated, it includes:
[0287] Step 701, the second service enables the camera registration service.
[0288] It should be understood that Figure 7B the flow shown in Figure 7B may be implemented in combination with the flow shown in , and each can be implemented independently. The embodiments of the present application do not make specific limitations on this.
[0289] Figure 7B Optionally, Figure 7B the second service shown in may be the same service as the first service shown in
[0290] , or it can be a different service.
[0291] It can be understood that the above is only described by taking the video call service as an example, and the embodiments of the present application are not limited thereto. In fact, the second service can be other services that need to enable the camera registration service, such as a photographing service, and the like.
[0292] Step 702, the interface layer module registers the camera registration service to the connection layer.
[0293] Exemplarily, for the camera registration service in step 701, registration is performed through reg(device1, r_camera1_service1).
[0294] It should be understood that this description uses a single camera registration service as an example, and the embodiments of this application are not limited to this. In fact, a greater number of camera registration services can be triggered.
[0295] For example, step 701 may also include: enabling the camera registration service via reg(device1, r_camera2_service1); enabling the camera registration service via reg(device1, r_camera3_service1); enabling the camera registration service via reg(device1, r_camera4_service1), etc.
[0296] Step 703-1: The connection layer saves the registration information initiated by the interface layer module.
[0297] Step 703-2: The connection layer registers a callback with the relay layer in the system.
[0298] During the process of enabling the camera virtualization service, the connection layer module is used to register callbacks with the system relay layer. This callback registration is related to the previous section. Figure 7A The difference in step 3 is that the callback for registering the camera service also needs to include a mode type, or service type. This is because there are different mode types for camera virtualization services. This description refers to the camera registration service within the camera virtualization service; other mode types exist, such as camera streaming services, which will be discussed later. Figure 7A A timing diagram for the camera cut-through service is shown.
[0299] For example, if the camera registration service corresponds to mode1, then step 703-2 includes: executing the registration callback via regcb(d1, s1, cb1, mode1). Here, d1 is short for device1, and s1 is short for service1.
[0300] Step 704: The relay layer in the system executes the processing logic for the camera AIDL service registration callback.
[0301] The detailed process of step 704 will be discussed later. Figure 7B The logical flow shown in the figure is described in detail.
[0302] Similarly, during the initial registration callback of the camera service, the system's relay layer can also save it in the AIDL process through the registration function (e.g., Camera registration service).
[0303] Optionally, in step 705-1, the relay layer in the system sends an initial registration callback to the camera registration service in the AIDL process; in step 705-2, the camera registration service in the AIDL process returns the result.
[0304] For example, the system relay layer saves the callback in the camera registration service of the AIDL process via regcb(d1, s1, cb1, mode1). After receiving the registration callback sent by the system relay layer, the camera registration service in the AIDL process returns the result to the system relay layer after saving to inform the system relay layer that the saving was successful.
[0305] refer to Figure 7B , Figure 7A The diagram shows the processing logic of the camera registration service in the relay layer of the system. Mode type The process shown can be applied to Device information and service information corresponding to the mode In the middle. For example, mode1 Step 704 in the text can be replaced with mode2 The method logic is shown in the diagram. For example... Figure 7A As shown, the processing logic of the camera registration service in the relay layer of the system includes at least the following steps:
[0306] Step 801: Read the status of the usage table and the service table respectively.
[0307] In some embodiments, tables are used to record channel usage. A channel can be understood as a way to establish a connection between two modules. A channel can also be understood as a logical channel between two processes.
[0308] Optionally, the table may specifically record one or more patterns (or different pattern types, such as those mentioned above). Mode type The information includes service and device information corresponding to the mode mentioned in the text. By reading or looking up the usage table, the usage or registration status of the virtualization service corresponding to a certain mode can be obtained.
[0309] This application does not limit the specific form of the table used in its embodiments. For example, the table can be represented as mChannelUseMap(mode,<device,service> ).
[0310] It is understood that the above-mentioned usage table added in the embodiments of this application may also have other forms, and the embodiments of this application are not limited thereto.
[0311] For example, the table can also be in the form of a table, as shown in Table 1:
[0312] Service information corresponding to the mode mode1 AidlService1 <device1, service1> mode2 <device1, service1> … …
[0313] In Table 1, the device information and service information corresponding to mode1 is represented as <device1, service1>; the device information and service information corresponding to mode2 is represented as <device1, service2>. It can be understood that the mode types, the device information and the service information corresponding to the modes shown in Table 1 are only exemplary descriptions, and the embodiments of the present application are not limited thereto. For example, mode1 and mode2 can be different services corresponding to the same device, or different services corresponding to different devices, and the embodiments of the present application are not limited thereto.
[0314] In some embodiments, the service table is used to record the usage record or usage of the virtualized service. Optionally, the service table specifically records the AIDL service information corresponding to one or more modes (or different mode types, for example, mode mentioned in the foregoing AidlService1 By reading or searching the usage table, the registration of a certain mode in the AIDL service can be known.
[0315] The embodiments of the present application are not limited to the specific form of the service table. For example, the service table can be represented as mServiceMap(mode, AidlService); wherein the mode and AidlService in mServiceMap have a mapping relationship or a corresponding relationship.
[0316] It can be understood that the above-mentioned usage table and service table newly added in the embodiments of the present application can also have other forms, and the embodiments of the present application are not limited thereto.
[0317] Exemplarily, the service table can also be in the form of the following table, as shown in Table 2:
[0318] Figure 7A Figure 7A Figure 7B Figure 7A Figure 7B Figure 8A … …
[0319] In Table 2, the service information corresponding to mode1 is represented as AidlService1; the service information corresponding to mode2 is represented as AidlService1. It can be understood that the mode types and the service information corresponding to the modes shown in Table 2 are only exemplary descriptions, and the embodiments of the present application are not limited thereto. For example, mode1 and mode2 can correspond to other different services, and the embodiments of the present application are not limited thereto.
[0320] Step 802, it is judged whether the first mode has been registered in the service table (mServiceMap).
[0321] If the first mode has not been registered in the service table, step 803-1 is executed; if the first mode has been registered in the service table, step 803-2 is executed.
[0322] In some embodiments, when the step 802 is performed for the first time, usually the first mode corresponding virtualization service (such as the camera registration service) is triggered for the first time, and the first mode is not registered in the service table, the flow corresponding to the "No" branch is performed. For the case that the step 802 is not performed for the first time, the first mode has been registered in the service table, and the flow corresponding to the "Yes" branch is performed.
[0323] Exemplarily, the first mode is mode1 in Figure 8B It can be determined whether the mode1 has been registered in the mServiceMap. If the service information corresponding to the mode1 is recorded in the mServiceMap, or the (mode1, AidlService1) is included in the mServiceMap, it is considered that the mode1 has been registered in the service table. If the service information corresponding to the mode1 is not found by searching or traversing the state of each table item in the mServiceMap (mode, AidlService), it is considered that the mode1 has not been registered in the service table.
[0324] The step 803-1 is to determine whether the first mode has been registered in the use table (mChannelUseMap).
[0325] If the first mode has not been registered in the service table, it is necessary to further determine the use by the step 803-1, so as to decide whether to create a new service for the first mode or delete the service in the abnormal state.
[0326] For the step 803-1, if the first mode has not been registered in the use table, the step 804-2 is performed; if the first mode has been registered in the use table, the step 804-1 is performed.
[0327] Exemplarily, the first mode is mode1 in Figure 8A If the mode1 has been registered in the mServiceMap, it can be further determined whether the mode1 has been registered in the mChannelUseMap. If the device information and the service information corresponding to the mode1 are recorded in the mChannelUseMap, or the (mode1, <device1, service1>) is included in the mChannelUseMap, it is considered that the mode1 has been registered in the use table. If the device information and the service information corresponding to the mode1 are not found by searching or traversing the state of each table item in the mChannelUseMap (mode, <device, service)), it is considered that the mode1 has not been registered in the use table.
[0328] Step 803-2, determine whether the first mode has been registered in the use table (mChannelUseMap).
[0329] If the first mode has been registered in the service table, it is also necessary to further determine whether the service is used through step 803-2 to know the use of the first mode in the use table.
[0330] For step 803-2, if the first mode is not registered in the use table, step 809 is executed, that is, the device information and service information corresponding to the first mode are saved in the use table for subsequent use.
[0331] For step 803-2, if the first mode has been registered in the use table, steps 807 and 808 are executed, that is, it is indicated that the first mode has used the service before, and it is further determined whether the first mode has been registered in the use table (that is, step 808) by further traversing or checking the use table; if it has been registered, the process can be ended, and if it has not been registered, step 809 can also be executed, that is, the device information and service information corresponding to the first mode are saved in the use table.
[0332] The related explanation of determining whether the first mode has been registered in the use table can refer to the description of step 803-1, and will not be repeated here for brevity.
[0333] In some embodiments, it is determined through step 802 that the first mode is not registered in the service table (mServiceMap), and it is also determined through step 803-1 that the first mode is not registered in the use table (mChannelUseMap), then step 804-2 is executed.
[0334] Step 804-1, delete from the use table (mChannelUseMap).
[0335] In some embodiments, it is determined through step 802 that the first mode is not registered in the service table (mServiceMap), but it is determined through step 803-1 that the first mode is registered in the use table (mChannelUseMap), at this time, the registration information corresponding to the first mode needs to be deleted from the use table and re-created, that is, step 804-2 is executed.
[0336] Step 804-2, create an AIDL service corresponding to the first mode.
[0337] In some embodiments, for the case that the first mode is not registered in the service table and is not registered in the use table, a new AIDL service can be created for the first mode.
[0338] Or, in some embodiments, for the case that the first mode is not registered in the service table but has been registered in the use table, the registration information of the first mode in the use table is deleted first, and then a new AIDL service is created for the first mode.
[0339] Step 805, register a callback to the AIDL service using the AIDL service.
[0340] Exemplarily, register a callback to the AIDL service using the AidlService, bind a registration callback of the new AIDL service with the service (camera registration service) corresponding to the underlying AIDL process, and ensure the communication between the two ends.
[0341] Step 806, save the created AIDL service to the service table with the first mode as the key, and save the device information and service information corresponding to the first mode to the use table with the first mode as the key.
[0342] Exemplarily, save AidlService to mServiceMap with mode1 as the key, and save <device1, service1> to mChannelUseMap with mode1 as the key.
[0343] Step 807, iterate from the use table (mChannelUseMap).
[0344] For the branch where the judgment step 803-2 is "yes", step 807 is executed. By checking in the use table, or reading the state of the table entry in the use table, it is determined whether the first mode has been registered in the use table.
[0345] Step 808, determine whether the device information and service information corresponding to the first mode have been registered in the use table.
[0346] For step 808, if the device information and service information corresponding to the first mode have been registered in the use table, the process ends; if the device information and service information corresponding to the first mode have not been registered in the use table, step 809 is executed.
[0347] Step 809, save the device information and service information corresponding to the first mode to the use table with the first mode as the key.
[0348] For the branch where the judgment step 803-2 is "no", or the branch where the judgment step 808 is "no", step 809 is executed.
[0349] Exemplarily, save <device1, service1> to mChannelUseMap with mode1 as the key.
[0350] In summary, in the flow of Figure 8A , it is determined first whether the service corresponding to the target mode (e.g., the first mode) exists in the service table. If the service corresponding to the target mode does not exist in the service table, the service can be created. If an abnormal state exists (i.e., there is no corresponding service but there is a use record in the use table), the service in the abnormal state is cleared. If the service corresponding to the target mode has been created, it is determined whether the use record corresponding to the target mode has been added. If the use record has been added, no further operation is needed. If the use record corresponding to the target mode has not been added, the corresponding information can be added in the use table. Based on these flows, the process of camera registration callback can be implemented in different situations.
[0351] The foregoing describes in detail the callback management process of the camera registration service. The following describes the deletion callback process of the camera registration service in combination with Figure 8A and Figure 8B . Figure 8B and Figure 6 .
[0352] Referring to Figure 8B , Figure 8B , timing diagram examples of disabling the camera registration service are shown. As shown in Figure 8B , the timing diagram includes:
[0353] Step 901, the second service disables the camera registration service.
[0354] Step 902, the interface layer cancels the registration of the camera registration service.
[0355] Exemplarily, the camera registration service is canceled by unreg(device1, service1).
[0356] Step 903, the connection layer deletes the callback of the registered virtualization service.
[0357] Exemplarily, the camera registration service is canceled by unregcb(d1, s1, cb1, mode1). That is, the mode field needs to be considered when deleting the callback of the camera registration service.
[0358] Step 904-1, the system relay layer executes the processing logic of the deletion callback of the camera AIDL service.
[0359] The detailed process of step 904-1 will be described in detail later in combination with the logic flow shown in Figure 8A .
[0360] Step 904-2, the system relay layer cancels the registration callback of the camera registration service in the AIDL process.
[0361] Step 905, the camera registration service in the AIDL process deletes the callback and deletes the registration information.
[0362] For step 905, the camera registration service in the AIDL process can determine whether to delete all device information and service information under mode1 or delete (device1, service1) corresponding to mode1 based on the processing logic of the camera AIDL service deletion callback performed by the system relay layer in step 904-1. The relevant description can also be referred to the description in the following Figure 8A .
[0363] Regarding the timing process of disabling the camera registration service, it is essentially similar to the timing process of disabling the audio service shown in Figure 8B , the difference is that disabling the camera registration service needs to consider the impact of mode.
[0364] The processing logic of the system relay layer for deleting the callback of the camera registration service is shown in Figure 8B . Figure 7B The process shown in Figure 9A can be applied to Figure 9B . For example, step 904-1 in Figure 9A can be replaced by the method logic shown in Figure 9B . As shown in Figure 9A , the callback processing logic of the system relay layer for deleting the camera registration service at least includes the following steps:
[0365] Step 1001, read the status of the usage table and the service table respectively.
[0366] The status of the usage table and the service table can be referred to the description in the foregoing Figure 9A , and will not be described here for brevity.
[0367] Step 1002, traverse from the usage table.
[0368] Exemplarily, the status of each table entry in the usage table is read to know the usage of the first mode.
[0369] Step 1003, determine whether the first mode has been registered in the service table.
[0370] For step 1003, if the first mode has been registered in the service table, step 1004 is executed; if the first mode is not registered in the service table, the process ends.
[0371] Exemplarily, the first mode has been registered in the service table, including that the service table includes service information saved with the first mode as a keyword.
[0372] Step 1004, it is judged whether the device information and service information corresponding to the first mode have been registered in the use table.
[0373] For step 1004, if the device information and service information corresponding to the first mode have been registered in the use table, step 1005 is executed; if the device information and service information corresponding to the first mode have not been registered in the use table, the flow ends.
[0374] Step 1005, it is judged whether there is no other device information and service information corresponding to the first mode after deletion.
[0375] Exemplarily, if there is other <device, service> corresponding to mode1 in the use table except <device1, service1> corresponding to mode1, for example, <device3, service1>, and the other <device, service> corresponding to mode1 is still in use, only <device1, service1> corresponding to mode1 is deleted in the use table, and mode1 is not deleted. If there is no other <device, service> corresponding to mode1 in the use table except <device1, service1> corresponding to mode1, mode1 is deleted in the use table, that is, the device information and service information under mode1, for example, <device1, service1>, are deleted.
[0376] For step 1005, if there is no other device information and service information in use under the first mode, step 1006 is executed; if there is other device information and service information in use under the first mode, step 1007 is executed.
[0377] Step 1006, the first mode is deleted from the use table.
[0378] For example, mode1 is deleted in mChannelUseMap.
[0379] Step 1007, the device information and service information are deleted from the use table.
[0380] For example, <device1, service1> corresponding to mode1 is deleted in mChannelUseMap.
[0381] It should be noted that, in some embodiments, enabling or disabling a virtualization service is essentially triggered by a service, which can be considered as a user's active behavior. Disabling a certain virtualization service does not affect the running of other virtualization services.
[0382] In some embodiments, the notification of exit is caused by some exception of the system layer or automatically triggered based on some mechanism, and the process exits. The notification of exit is essentially related to the service process module in the system layer. If a service process module is notified to exit, all services related to the process module will exit. For example, if the AIDL process audio service is notified to exit, the enabled media audio virtualization service or the call audio speaker service will be exited.
[0383] For example, when it is found in the background that some services consume too much power when running, the process is ended.
[0384] In some application scenarios, there are cases where the underlying event triggers the closing of the virtualization service or notifies the exit of the currently running virtualization service. For example, when the camera is actively closed by the user, or the electronic device responds to the user's operation of opening another application, causing the currently running camera virtualization service to be preempted by the other application, the underlying will deliver a closing notification to the system layer (such as delivering a closing event to the upper layer from the hardware layer or the kernel layer). The system layer delivers the closing notification to the system relay layer, so that the system relay layer decides whether to delete the callback of the currently running virtualization service based on the processing logic. Of course, after the underlying module triggers the closing notification, the closing notification is delivered to the corresponding service module in the system layer, and which service module is delivered to depends on the type of the event corresponding to the service.
[0385] For example, when the event triggered by the underlying is the event that the smart table lamp first connects the camera, the closing notification is delivered to the system relay layer through the camera registration service.
[0386] For example, when the event triggered by the underlying is the event of switching the front or rear camera, the closing notification is delivered to the system relay layer through the camera stream switching service.
[0387] The application embodiments do not make specific limitations on the triggering conditions of the notification of exit of the virtualization service. The foregoing examples are only exemplary descriptions of some scenarios, and the application embodiments are not limited thereto. For example, in the case of underlying failure, there can also be a situation of notifying the exit of the virtualization service.
[0388] The implementation process of the notification of exit of the virtualization service will be described below in combination with Figure 9A and Figure 9B . Figure 9B and Figure 9B The camera registration service is described as an example, and the application embodiments are not limited thereto.
[0389] Reference is made to Figure 9B , Figure 7B which shows a timing example of the notification of exit. As Figure 9B indicated, it includes:
[0390] Step 1101, the camera registration service of the AIDL process receives a notification exit event from the underlying layer.
[0391] Step 1102, the camera registration service of the AIDL process delivers the notification exit event to the system relay layer.
[0392] Step 1103, the system relay layer executes the processing logic of the exit callback.
[0393] The specific execution logic of step 1103 can refer to the process shown in Figures 7A to 9B .
[0394] Step 1104, the system relay layer notifies the connection layer of the exit success.
[0395] Step 1105, the connection layer notifies the interface layer of the exit success.
[0396] That is, after the system relay layer deletes the callback successfully, the successful deletion message can be delivered to the upper layer through the connection layer and the interface layer in turn.
[0397] Reference is made to Figures 7A to 9B , Figure 10 which shows the processing logic of the exit callback. As shown in Figure 10 , it includes:
[0398] Step 1201, the status of the use table and the service table is read respectively.
[0399] For the related description of the use table and the service table, reference can be made to the description of step 801 in Figure 10 . For brevity, no further description is given here.
[0400] Step 1202, the first mode is deleted from the use table. In some embodiments, all device information and service information corresponding to the first mode are deleted from the use table.
[0401] Exemplarily, all classes under mode1 in mChannelUseMap are deleted with mode1 as the keyword, that is, all <device, service> corresponding to mode1 are deleted, including but not limited to <device1, service1>.
[0402] Step 1203, the first mode is deleted from the service table. In some embodiments, all device information and service information corresponding to the first mode are deleted from the service table. Exemplarily, all classes under mode1 in mServiceMap are deleted with mode1 as the keyword, that is, the AIDL service corresponding to mode1 is deleted.
[0403] Through Figure 7AThe process shown allows for the deletion of the first pattern in both the usage table and the service table.
[0404] This application does not specify the order of execution of steps 1202 and 1203 in the embodiments. For example, steps 1202 and 1203 can be executed simultaneously. Or, steps 1202 can be executed first, followed by steps 1203. Or, steps 1203 can be executed first, followed by steps 1202.
[0405] Combined with the preceding text Figure 5A The management process for the camera registration service is described. It should be noted that other types of camera services (such as camera streaming services) can also refer to the above. Figure 7B The process described. Figure 7B The timing diagram for enabling the camera cutover service is shown in the figure.
[0406] For example, such as Figure 8B As shown, the process of enabling camera streaming service includes the following steps:
[0407] Step 1301: Enable the camera translator service for the third service.
[0408] Optionally, Figure 9B The third business shown in the text is related to Figure 11 The second business shown in the document (or Figure 11 The first business shown in the text can be the same business or a different business.
[0409] For example, the third service is the camera switching service.
[0410] Step 1302: The interface layer module registers the camera stream switching service with the connection layer.
[0411] For example, the camera streaming service in step 1301 is registered using reg(device1, T_camera1_service1).
[0412] It should be understood that this description uses a single camera switching service as an example, and the embodiments of this application are not limited to this. In fact, a greater number of camera switching services can be triggered.
[0413] For example, step 1301 may also include: enabling the camera registration service via reg(device1, T_camera2_service1); enabling the camera registration service via reg(device1, T_camera3_service1); enabling the camera streaming service via reg(device1, T_camera4_service1), etc.
[0414] Step 1303-1, the connection layer saves the registration information initiated by the interface layer module.
[0415] Step 1303-2, the connection layer registers the callback to the system relay layer.
[0416] Since the camera registration service and the camera cut stream service are services of different mode types, the registration callback in step 1303-2 is different from the previous step 703-2 at least in that the mode field in the registration callback corresponds to different values in order to distinguish the camera registration service and the camera cut stream service.
[0417] For example, the camera cut stream service corresponds to mode 2; then step 1303-2 includes: performing the registration callback by regcb(d1, s1, cb2, mode 2).
[0418] Step 1304, the system relay layer executes the processing logic of the camera AIDL service registration callback.
[0419] For the detailed process of step 1304, please refer to the logic flow shown in the previous Figure 11 For the sake of brevity, it will not be repeated here.
[0420] Optionally, step 1305-1, the system relay layer sends the first registration callback to the camera cut stream service in the AIDL process; step 1305-2, the camera cut stream service in the AIDL process returns the result.
[0421] Exemplarily, the system relay layer saves the callback in the camera cut stream service in the AIDL process by regcb(d1, s1, cb2, mode 2). After receiving the registration callback sent by the system relay layer, the camera cut stream service in the AIDL process will return the result to the system relay layer after saving is completed, so as to tell the system relay layer that the saving is successful.
[0422] For the processing logic of the system relay layer executing the registration callback of the camera cut stream service, please refer to the description in Figure 5A , which will not be repeated here. Similarly, for the processing logic of the system relay layer executing the deletion callback of the camera cut stream service, please refer to the description in Figure 10 , which will not be repeated here. For the processing logic of the system relay layer executing the notification exit of the camera cut stream service, please refer to the description in Figure 11 , which will not be repeated here.
[0423] The foregoing describes in detail the registration of virtualization services and the de-registration of virtualization services in combination with the audio virtualization service and the camera virtualization service. In some scenarios, there can be other instructions triggering the process of running virtualization services. The other instructions can be control commands or instructions for data transmission. The following describes in combination with Figures 5A to 11 Figure 1 shows a schematic diagram of a system for running virtualization services. As shown in Figure 1, the system comprises an interface layer, a connection layer, a system relay layer, and an AIDL process. The interface layer is configured to receive a first instruction. The connection layer is configured to transmit the first instruction to the system relay layer. The system relay layer is configured to find a corresponding virtualization service according to the first instruction. The AIDL process is configured to run the corresponding virtualization service. Figure 12 The system further comprises a camera virtualization service and an audio virtualization service. The camera virtualization service is configured to run a camera registration service. The audio virtualization service is configured to run an audio registration service.
[0424] Step 1401, the interface layer transmits the received first instruction to the connection layer.
[0425] The embodiments of the present application do not limit the form of the first instruction received by the interface layer. The first instruction can be a control instruction or a data transmission instruction.
[0426] Optionally, the first instruction comprises device information and service information of the virtualization service that needs to be triggered. For example, the first instruction comprises <device3, service3>.
[0427] Step 1402, the connection layer performs protocol conversion on the content of the first instruction.
[0428] Exemplarily, the connection layer converts the content of the first instruction into a JS object notation (JSON) format through protocol conversion and sends it through a public interface. The JSON format is a data exchange format.
[0429] In some embodiments, the protocol conversion can be understood as packaging all parameters (including but not limited to: device, service, etc.) in the first instruction into a json file.
[0430] Step 1403, the connection layer sends a first request command to the system relay layer.
[0431] Exemplarily, the first request command is SendRequest (id, json). Wherein, id can be understood as a command word. Different id values can correspond to different parsing methods.
[0432] Step 1404-1, the system relay layer finds the service.
[0433] The system relay layer will perform a table lookup, or in other words, find the service, after receiving the first request command. The purpose of the table lookup is to determine the sending object, or in other words, to determine the corresponding virtualization service. If it is learned through the table lookup that the corresponding virtualization service is the camera registration service, the system relay layer sends a second request command to the camera registration service in the AIDL process.
[0434] Step 1404-2, the system relay layer sends a second request command to the AIDL process (such as the camera registration service).
[0435] Exemplarily, the second request command is doCmd Request(id, json).
[0436] Step 1405, the AIDL process camera registration service performs parsing processing.
[0437] After the AIDL process receives the second request instruction, the content of the registration is obtained by performing json parsing on the second request instruction.
[0438] In other words, in the process of steps 1401 to 1405, the protocol conversion process of the connection layer can be understood as packing the structure A into json; the system relay layer does not need to perform structure conversion after receiving the first request command, but directly performs service lookup; and after determining the corresponding service, the second request command is transparently transmitted to the corresponding service module in the AIDL process; the service module can obtain the structure B by parsing the json, so as to execute the corresponding processing logic based on the structure.
[0439] Further, the process of the service module in the AIDL process returning data to the upper layer is also similar.
[0440] Step 1411, the AIDL process performs json parsing processing.
[0441] Step 1412, the AIDL process sends a first process request instruction to the system relay layer.
[0442] Step 1413, the system relay layer sends a second process request instruction to the connection layer.
[0443] Step 1414, the connection layer performs protocol conversion.
[0444] In other words, in the process of steps 1411 to 1414, the corresponding service module in the AIDL process can pack the returned data into json in the form of structure B; and send a first process request instruction to the system relay layer. After the system relay layer receives the first process request instruction, a second process request instruction is transparently transmitted to the connection layer. After the connection layer receives the second process request instruction, the structure A can be obtained by parsing the json, so as to execute the corresponding processing logic based on the structure A.
[0445] It should be noted that, Figure 12 The process in the foregoing is only described by taking the camera registration service in the AIDL process as an example. The embodiments of the present application are not limited thereto. For example, the audio virtualization service mentioned in the foregoing Figure 12 can also be taken as an example.Figure 5A The camera streaming service shown in the image, etc., are also applicable. Figure 5A The process in.
[0446] The above text combined Figure 6 The examples described herein illustrate timing diagrams or implementation logic for managing virtualization services according to embodiments of this application. The following, in conjunction with... Figure 5A This application describes a method flow for managing virtualization services as illustrated in an embodiment. Figure 7A The method shown can be applied to a first electronic device. For example... Figure 7B As shown, it includes:
[0447] Step 1501: When establishing a collaborative connection with the second electronic device in any of the following ways: receiving a collaborative connection request from the second electronic device, scanning a QR code for establishing a collaborative connection, connecting to the second electronic device via a wired interface, and displaying a first interface, the first interface including a first window, the first window including a first control.
[0448] Step 1502: In response to the user's click on the first control, enable the first virtualization service and the second virtualization service; wherein, both the first virtualization service and the second virtualization service are used to call the first process service in the system layer.
[0449] Step 1503: Execute the registration callback based on the first global callback function, and save the first registration information and the second registration information. The first global callback function corresponds to one or more virtualization services that call the first process service. The first registration information includes device information and service information corresponding to the first virtualization service, and the second registration information includes device information and service information corresponding to the second virtualization service. The first global callback function is used to call the first process service.
[0450] In this embodiment, when the first electronic device and the second electronic device confirm the establishment of a collaborative connection, the first virtualization service and the second virtualization service are enabled. These two virtualization services invoke the same virtualization service capability in the system layer. Compared to registering a corresponding callback for each virtualization service when enabling multiple virtualization services, this embodiment registers only one global callback for multiple virtualization services invoking the same virtualization service capability, which greatly reduces the number of callbacks. Furthermore, when multiple virtualization services are running simultaneously, fewer binding relationships are established with the system layer, significantly improving operational efficiency.
[0451] It should be understood that the above only takes two virtualization services (the first virtualization service and the second virtualization service) as an example to invoke the same virtualization service capability, and the embodiments of the present application are not limited thereto. In fact, the services invoking the same virtualization service capability can include a larger number, which can depend on the business trigger or application implementation. For example, the above-mentioned Figure 8A invokes multiple virtualization services.
[0452] In some embodiments, the method further comprises:
[0453] When enabling multiple virtualization services for invoking the first process service, the number of callbacks corresponding to the virtualization services in the first global callback function is counted by one for each added virtualization service.
[0454] Exemplarily, Figure 8B Step 4 performed by the system relay layer in the system in the above-mentioned
[0455] It can be understood that the embodiments of the present application are also applicable to the scenario of disabling. In some embodiments, the method further comprises: when disabling the first virtualization service, the callback count included in the first global callback function is reduced by one, and the first registration information saved in the system relay layer is deleted. For example, Figure 9A the specific process of canceling the registration callback when disabling the virtualization service is shown.
[0456] In some embodiments, the method further comprises: when the callback count in the first global callback function is zero, the first global callback function and the registration information corresponding to the multiple virtualization services saved in the system layer are deleted. Therefore, in order to avoid affecting the normal use of the services corresponding to the business that are invoking the same process service, the callback in the system layer and the registration information can be deleted when the callback count is reduced to 0.
[0457] In some embodiments, the method further comprises: in response to receiving an incoming call, enabling a third virtualization service and a fourth virtualization service, the third virtualization service and the fourth virtualization service are both used to invoke the first process service; performing a registration callback based on the first global callback function, saving third registration information and fourth registration information, the third registration information including device information and service information corresponding to the third virtualization service, and the fourth registration information including device information and service information corresponding to the fourth virtualization service.
[0458] Optionally, the first process service is an AIDL process audio service, the first virtualization service is a media audio speaker service, the second virtualization service is a media audio microphone service, the third virtualization service is a call audio speaker service, and the fourth virtualization service is a call audio microphone service.
[0459] Exemplarily, Figure 9B A timing diagram for enabling multiple audio class virtualization services is shown in FIG.
[0460] In some embodiments, the method further comprises: in response to receiving a camera-related service, enabling a camera virtualization service, the camera virtualization service including a camera registration service or a camera stream splitting service; registering a callback function corresponding to the camera virtualization service, the registration callback function corresponding to the camera virtualization service including device information, service information, callback function information, and a mode type; wherein the camera registration service and the camera stream splitting service correspond to different mode types; and invoking a second process service based on the callback function corresponding to the camera virtualization service, the second process being a camera process service.
[0461] In some embodiments, the mode type is a first mode; and the registering the callback function corresponding to the camera virtualization service comprises:
[0462] Respectively reading a usage table and a service table, the usage table being used to record usage of inter-process channels, and the service table being used to record usage of corresponding camera virtualization services;
[0463] Determining whether the first mode has been registered in the service table;
[0464] When the first mode has not been registered in the service table, determining whether the first mode has been registered in a usage table;
[0465] If the first mode has not been registered in the usage table, creating a camera AIDL service corresponding to the first mode;
[0466] If the first mode has been registered in the usage table, deleting information corresponding to the first mode in the usage table, and creating a camera AIDL service corresponding to the first mode.
[0467] Optionally, the creating the camera AIDL service corresponding to the first mode comprises: saving the created camera AIDL service to the service table with the first mode as a key, and saving device information and service information corresponding to the first mode to the usage table with the first mode as a key.
[0468] In some embodiments, the method further comprises:
[0469] when the first mode has been registered in the service table, judging whether the first mode has been registered in a usage table;
[0470] when the first mode has been registered in the usage table, traversing the usage table, and determining whether the device information corresponding to the first mode and the service information corresponding to the first mode have been registered in the usage table;
[0471] when the first mode has not been registered in the usage table, or when the device information corresponding to the first mode and the service information corresponding to the first mode have not been registered in the usage table, saving the device information and the service information corresponding to the first mode into the usage table with the first mode as a key;
[0472] when the device information corresponding to the first mode and the service information corresponding to the first mode have been registered in the usage table, ending the flow.
[0473] Exemplarily, the timing diagram and the specific implementation logic of the registration callback with respect to enabling the camera class service can refer to the processes of the foregoing Figures 1 to 12 and Figure 13 respectively.
[0474] In some embodiments, the method further comprises: when the camera virtualization service is disabled, deleting the callback function corresponding to the camera virtualization service.
[0475] Optionally, deleting the callback function corresponding to the camera virtualization service comprises:
[0476] reading the states of a usage table and a service table respectively, the usage table being used for recording the usage of inter-process channels, and the service table being used for recording the usage of corresponding camera virtualization services;
[0477] traversing the usage table, and judging whether the first mode has been registered in the service table;
[0478] when the first mode has been registered in the service table, judging whether the device information and the service information corresponding to the first mode have been registered in the usage table;
[0479] judging whether there still exist the device information and the service information using the first mode in the first mode after the first mode is deleted from the usage table;
[0480] if there still exist the device information and the service information using the first mode, deleting the device information and the service information of the first mode from the usage table;
[0481] If there is no device information and service information using the first mode in the first mode, delete the first mode from the using table.
[0482] For example, the timing diagram for disabling the camera class service and the specific implementation logic of the deletion callback can refer to the processes of the foregoing Figure 13 and Figure 13 respectively.
[0483] In some embodiments, the method further includes: in response to receiving the notification exit event of the camera virtualization service, deleting the first mode from the using table, and deleting the first mode from the service table.
[0484] For example, the timing diagram for disabling the camera class service and the specific implementation logic of the deletion callback can refer to the processes of the foregoing Figure 13 and Figure 13 respectively.
[0485] It can be understood that the specific description about various implementation manners can refer to the foregoing description, which will not be repeated here. The foregoing Figure 13 detailed the method for managing virtualization services provided by the embodiments of the present application. The apparatus embodiments of the present application will be described below in combination with Figure 13 It should be understood that the apparatus for managing virtualization services of the embodiments of the present application can perform the method for managing virtualization services of the foregoing embodiments of the present application, that is, the specific working processes of the various products below can refer to the corresponding processes in the foregoing method embodiments.
[0486] Figure 13 A structural schematic diagram of an electronic device 1000 suitable for the present application is shown.
[0487] The electronic device 1000 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0488] Among them, the sensor module 180 can include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0489] It should be noted that Figure 13 The structure shown does not constitute a specific limitation on the electronic device 1000. In some embodiments of the present application, the electronic device 1000 can include more or fewer components than those shown, or the electronic device 1000 can include a combination of some of the components shown, or the electronic device 1000 can include sub-components of some of the components shown. The structure shown does not constitute a specific limitation on the electronic device 1000. In some embodiments of the present application, the electronic device 1000 can include more or fewer components than those shown, or the electronic device 1000 can include a combination of some of the components shown, or the electronic device 1000 can include sub-components of some of the components shown. The structure shown does not constitute a specific limitation on the electronic device 1000. In some embodiments of the present application, the electronic device 1000 can include more or fewer components than those shown, or the electronic device 1000 can include a combination of some of the components shown, or the electronic device 1000 can include sub-components of some of the components shown. The structure shown does not constitute a specific limitation on the electronic device 1000. In some embodiments of the present application, the electronic device 1000 can include more or fewer components than those shown, or the electronic device 1000 can include a combination of some of the components shown, or the electronic device 1000 can include sub-components of some of the components shown. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0490] The processor 110 can include one or more processing units. For example, the processor 110 can include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, a neural-network processing unit (NPU). Among them, different processing units can be independent devices, or can be integrated devices.
[0491] The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0492] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. Avoiding repeated access reduces the waiting time of the processor 110, thereby improving the efficiency of the system.
[0493] In some embodiments, the processor 110 can include one or more interfaces. For example, the processor 110 can include at least one of the following interfaces: 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 SIM interface, a USB interface.
[0494] The connection relationship between the modules shown is only illustrative and does not constitute a limitation on the connection relationship between the modules of the electronic device 1000. Alternatively, the modules of the electronic device 1000 can also adopt a combination of various connection manners in the above embodiments.
[0495] The charging management module 140 is configured to receive power from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive the current of the wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive electromagnetic waves through the wireless charging coil of the electronic device 1000 (the current path is shown as a dashed line). The charging management module 140 charges the battery 142, and at the same time, can also supply power to the electronic device 1000 through the power management module 141.
[0496] The power management module 141 is configured to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives the input of the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160, etc. The power management module 141 can also be configured to monitor parameters such as battery capacity, battery cycle number, and battery health status (for example, leakage, impedance), etc. Alternatively, the power management module 141 can be arranged in the processor 110, or the power management module 141 and the charging management module 140 can be arranged in the same device.
[0497] The wireless communication function of the electronic device 1000 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.
[0498] The electronic device 1000 can implement the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0499] The display screen 194 can be used to display images or videos. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a micro OLED, or a quantum dot light emitting diode (QLED). In some embodiments, the electronic device 1000 can include 1 or N display screens 194, and N is a positive integer greater than 1.
[0500] The electronic device 1000 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0501] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. The ISP can optimize the noise, brightness, and color of the image through algorithm, and the ISP can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be arranged in the camera 193.
[0502] The camera 193 is used for capturing still images or videos. An object projects an optical image through a lens onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard red green blue (RGB), YUV, or the like format image signal. In some embodiments, the electronic device 1000 can include one or N cameras 193, where N is a positive integer greater than one.
[0503] The digital signal processor is used for processing digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 1000 is in frequency selection, the digital signal processor is used for Fourier transform of frequency energy, etc.
[0504] The video codec is used for compressing or decompressing digital video. The electronic device 1000 can support one or more video codecs. In this way, the electronic device 1000 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.
[0505] The electronic device 1000 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the microphone 170B, the microphone 170C, the earphone interface 170D, and the application processor, etc.
[0506] The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 1000 can adaptively adjust the brightness of the display screen 194 according to the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when shooting.
[0507] In some embodiments, the ambient light sensor 180L can obtain the ambient illuminance of the current shooting environment. When the ambient illuminance is greater than or equal to a first illuminance threshold, it can be considered that the current shooting environment is relatively bright, and it can be considered that the current is a high-brightness shooting environment.
[0508] The touch sensor 180K is also referred to as a touch device. The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also referred to as a touch panel. The touch sensor 180K is configured to detect a touch operation acting on or near the touch sensor 180K. The touch sensor 180K can transmit the detected touch operation to the application processor to determine a touch event type. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 1000 and be disposed at a position different from the display screen 194.
[0509] The keys 190 include a power key and a volume key. The keys 190 can be mechanical keys or touch keys. The electronic device 1000 can receive a key input signal and implement a function related to the key input signal.
[0510] The motor 191 can generate vibration. The motor 191 can be used for incoming call prompt or touch feedback. The motor 191 can generate different vibration feedback effects for touch operations acting on different application programs. The motor 191 can also generate different vibration feedback effects for touch operations acting on different regions of the display screen 194. Different application scenarios (for example, time reminder, received information, alarm clock, and game) can correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0511] In some embodiments, the processor 110 is configured to, when a collaborative connection is established with a second electronic device by any of the following: receiving a collaborative connection request from the second electronic device, scanning a two-dimensional code for establishing a collaborative connection, connecting the second electronic device through a wired interface, displaying a first interface on the display screen 194, the first interface including a first window, and the first window including a first control; in response to a user operation of clicking the first control, enabling a first virtualization service and a second virtualization service; wherein the first virtualization service and the second virtualization service are configured to invoke a first process service in a system layer; registering a callback based on a first global callback function, and saving first registration information and second registration information, the first global callback function corresponding to one or more virtualization services that invoke the first process service, the first registration information including device information and service information corresponding to the first virtualization service, and the second registration information including device information and service information corresponding to the second virtualization service; and wherein the first global callback function is configured to invoke the first process service.
[0512] It can be understood that the method for managing virtualization services in the embodiments of the present application can be applied to In the electronic device shown in the middle, the specific implementation steps can refer to the description of the foregoing method embodiments, and details are not described herein.
[0513] In a possible example, the processor 110 can be implemented by a processor or a processing unit. It should be understood that the functional units can be implemented in the form of software and / or hardware, and the embodiments of the present application do not make a specific limitation.
[0514] For example, the "unit" can be a software program, a hardware circuit, or a combination of both, which implements the above functions. The hardware circuit can include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group processor) and a memory that execute one or more software or firmware programs, an integrated logic circuit, and / or other suitable devices that can provide the above functions.
[0515] Those of ordinary skill in the art can be aware that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0516] The present application also provides a computer program product, which, when executed by a processor, implements the method described in any of the method embodiments of the present application.
[0517] The computer program product can be stored in a memory and finally converted into an executable object file capable of being executed by the processor through preprocessing, compiling, assembling, and linking, etc.
[0518] The present application also provides a computer readable storage medium, which stores a computer program, and the computer program, when executed by a computer, implements the method described in any of the method embodiments of the present application. The computer program can be a high-level language program or an executable object program.
[0519] The computer-readable storage medium can be a volatile memory or a nonvolatile memory, or can include both volatile memory and nonvolatile memory. The nonvolatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DR RAM). The computer-readable storage medium can also be other media capable of storing data, such as a hard disk, a floppy disk, or a tape.
[0520] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and apparatuses and the generated technical effects can refer to the corresponding processes and technical effects in the foregoing method embodiments, and will not be described here.
[0521] Those skilled in the art can understand that all or part of the foregoing method embodiments can be implemented by a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, the program can include the processes of the foregoing method embodiments.
[0522] In several embodiments provided in the present application, the disclosed system, device and method can be implemented in other ways. For example, some features of the foregoing method embodiments can be omitted or not executed. The foregoing device embodiments are merely illustrative, and the division of units is merely a logical function division. In actual implementation, another division manner can be used, and multiple units or components can be combined or integrated into another system. In addition, the coupling between units or the coupling between components can be direct coupling or indirect coupling, and the foregoing coupling includes electrical, mechanical or other forms of connection.
[0523] It should be understood that the size of the sequence number of each process in various embodiments of the present application does not mean the order of execution, the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0524] The term "user interface (UI)" in the specification and claims of the present application and the drawings can be simply referred to as interface, which is a medium interface for interaction and information exchange between an application program or an operating system and a user, and it realizes the conversion between the internal form of information and the form that the user can accept. The user interface of the application program is the source code written by a specific computer language such as java, extensible markup language (XML), etc. The interface source code is parsed, rendered on the terminal device, and finally presented as content that the user can recognize, such as pictures, texts, buttons, etc. Control (widget) is the basic element of the user interface, and typical controls include toolbar, menu bar, text box, button, scrollbar, picture and text. The properties and content of the controls in the interface are defined by tags or nodes, such as XML <textview> 、
[0525] <imgview> 、 <videoview>The interface is defined by nodes that specify the controls contained in the interface. One node corresponds to one control or property in the interface, and the nodes are parsed and rendered to present the content visible to the user. In addition, many applications, such as hybrid applications, also contain web pages in the interface. A web page, also referred to as a page, can be understood as a special control embedded in the interface of an application. The web page is a source code written in a specific computer language, such as hyper text markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed by a browser or a web page display component similar to the function of a browser to present content recognizable to the user. The specific content contained in the web page is also defined by tags or nodes in the web page source code, such as HTML defines the content of the web page by tags such as 、 、 <video> 、 <canvas>To define the elements and attributes of a web page.
[0526] A common form of user interface is a graphic user interface (GUI), which refers to a user interface that displays in a graphical manner. It can be an icon, window, control, etc. interface element displayed in the display screen of an electronic device, wherein the control can include an icon, button, menu, tab, text box, dialog box, status bar, navigation bar, Widget, and other visible interface elements.
[0527] In addition, the terms "system" and "network" are often used interchangeably herein. The term "and / or" herein is merely an association relationship between associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.
[0528] The terms (or numbers) "first", "second", and the like appearing in the embodiments of the present application are only for descriptive purposes, i.e., only to distinguish different objects, such as different "virtualization services", and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features limited by "first", "second", and the like can explicitly or implicitly include one or more features. In the description of the embodiments of the present application, "at least one" means one or more. The meaning of "multiple" is two or more. "At least one of the following" or the like means any combination of these items, including any combination of single (item) or multiple (item).
[0529] For example, the meaning of the expression similar to "the item includes at least one of the following: A, B, and C" appearing in the embodiments of the present application, if not otherwise specified, generally means that the item can be any one of the following: A; B; C; A and B; A and C; B and C; A, B and C; A and A; A, A and A; A, A and B; A, A and C, A, B and B; A, C and C; B and B, B, B and B, B, B and C, C and C; C, C and C, and other combinations of A, B and C. The above is an example of 3 elements A, B and C to illustrate the optional entries of the item. When expressed as "the item includes at least one of the following: A, B, …, and X", i.e., when there are more elements in the expression, the entries applicable to the item can also be obtained according to the foregoing rules.
[0530] As used in the above embodiments, the term "when" can be interpreted to mean "if" or "after" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "on determining" or "if detecting (a stated condition or event)" can be interpreted to mean "if determined" or "in response to determining" or "on detecting (a stated condition or event)" or "in response to detecting (a stated condition or event)" depending on the context.
[0531] In conclusion, the above description is only the preferred embodiment of the technical scheme of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.< / canvas> < / video> < / videoview> < / imgview> < / textview>
Claims
1. A method for managing virtualization services, characterized in that, Applied to a first electronic device, the method includes: When establishing a collaborative connection with a second electronic device in any of the following ways: receiving a collaborative connection request from the second electronic device, scanning a QR code for establishing a collaborative connection, connecting to the second electronic device via a wired interface, and displaying a first interface, the first interface including a first window, the first window including a first control; In response to the user's click on the first control, the first virtualization service and the second virtualization service are enabled; wherein, both the first virtualization service and the second virtualization service are used to call the first process service in the system layer; The registration callback is executed based on the first global callback function, and the first registration information and the second registration information are saved. The first global callback function corresponds to one or more virtualization services that call the first process service. The first registration information includes device information and service information corresponding to the first virtualization service, and the second registration information includes device information and service information corresponding to the second virtualization service. The first global callback function is used to call the first process service, which is an AIDL process audio service. The first global callback function is the same global callback function created for multiple virtualization services that call the same service capability. The multiple virtualization services that call the same service capability include at least the first virtualization service and the second virtualization service. The first virtualization service is a media audio speaker service, and the second virtualization service is a media audio microphone service.
2. The method according to claim 1, characterized in that, The method further includes: When multiple virtualization services used to call the first process service are enabled, for each additional virtualization service, the callback number corresponding to the virtualization service in the first global callback function is incremented by one.
3. The method according to claim 1 or 2, characterized in that, The method further includes: When the first virtualization service is deactivated, the callback count included in the first global callback function is decremented by one, and the first registration information stored in the relay layer of the system is deleted.
4. The method according to claim 3, characterized in that, The method further includes: When the callback count in the first global callback function is zero, delete the first global callback function and the registration information corresponding to the multiple virtualization services stored in the system layer.
5. The method according to claim 1 or 2, characterized in that, The method further includes: In response to receiving an incoming call, the third virtualization service and the fourth virtualization service are enabled, both of which are used to invoke the first process service; The registration callback is executed based on the first global callback function, and the third registration information and the fourth registration information are saved. The third registration information includes the device information and service information corresponding to the third virtualization service, and the fourth registration information includes the device information and service information corresponding to the fourth virtualization service.
6. The method according to claim 5, characterized in that, The third virtualization service is a call audio speaker service, and the fourth virtualization service is a call audio microphone service.
7. The method according to claim 1 or 2, characterized in that, The method further includes: In response to receiving a camera-related service, enable the camera virtualization service, which includes a camera registration service or a camera streaming service; The callback function corresponding to the camera virtualization service is registered, and the registration callback function corresponding to the camera virtualization service includes device information, service information, callback function information, and mode type; wherein, the camera registration service and the camera streaming service correspond to different mode types; Based on the callback function corresponding to the camera virtualization service, the second process service is invoked, and the second process is the camera process service.
8. The method according to claim 7, characterized in that, The mode type is the first mode; the registration of the callback function corresponding to the camera virtualization service includes: The status of the usage table and the service table are read respectively. The usage table is used to record the usage of inter-process channels, and the service table is used to record the usage of the corresponding camera virtualization service. Determine whether the first mode has already been registered in the service table; If the first mode is not registered in the service table, determine whether the first mode has already been registered in the usage table; If the first mode is not registered in the usage table, then create a camera AIDL service corresponding to the first mode; If the first mode has already been registered in the usage table, then delete the information corresponding to the first mode in the usage table and create a camera AIDL service corresponding to the first mode.
9. The method according to claim 8, characterized in that, The step of creating a camera AIDL service corresponding to the first mode includes: saving the created camera AIDL service to the service table using the first mode as the key, and saving the device information and service information corresponding to the first mode to the usage table using the first mode as the key.
10. The method according to claim 8, characterized in that, The method further includes: If the first mode has already been registered in the service table, determine whether the first mode has already been registered in the usage table; When the first mode has been registered in the usage table, the usage table is traversed to determine whether the device information and service information corresponding to the first mode have been registered in the usage table. If the first mode is not registered in the usage table, or if the device information and service information corresponding to the first mode are not registered in the usage table, the device information and service information corresponding to the first mode are saved to the usage table using the first mode as the key. The process ends when the device information and service information corresponding to the first mode have been registered in the usage table.
11. The method according to claim 7, characterized in that, The method further includes: When the camera virtualization service is deenabled, the callback function corresponding to the camera virtualization service is deleted.
12. The method according to claim 11, characterized in that, The callback function for deleting the camera virtualization service includes: The status of the usage table and the service table are read respectively. The usage table is used to record the usage of inter-process channels, and the service table is used to record the usage of the corresponding camera virtualization service. Traverse the usage table and determine whether the first mode has been registered in the service table; If the first mode has been registered in the service table, determine whether the device information and service information corresponding to the first mode have been registered in the usage table; Determine whether, after deleting the first mode from the usage table, there is still device information and service information using the first mode; If device information and service information using the first mode still exist, delete the device information and service information using the first mode from the usage table; If there is no longer any device information or service information using the first mode in the first mode, delete the first mode from the usage table.
13. The method according to claim 7, characterized in that, The method further includes: In response to receiving a notification exit event from the camera virtualization service, the first mode is deleted from the usage table and the first mode is deleted from the service table.
14. An electronic device, characterized in that, The device includes a processor and a memory coupled together, the memory being used to store a computer program that, when executed by the processor, causes the electronic device to perform the method of any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the electronic device to perform the method of any one of claims 1 to 13.
16. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the processors being configured to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 13.
Citation Information
Patent Citations
Data transmission method, electronic equipment and readable storage medium
CN115002384A
Method for acquiring video frame, electronic equipment and readable storage medium
CN115022570A