WO2024017351A1 - Method and apparatus for calling system service - Google Patents

Method and apparatus for calling system service Download PDF

Info

Publication number
WO2024017351A1
WO2024017351A1 PCT/CN2023/108459 CN2023108459W WO2024017351A1 WO 2024017351 A1 WO2024017351 A1 WO 2024017351A1 CN 2023108459 W CN2023108459 W CN 2023108459W WO 2024017351 A1 WO2024017351 A1 WO 2024017351A1
Authority
WO
WIPO (PCT)
Prior art keywords
target service
service
target
information
notification information
Prior art date
Application number
PCT/CN2023/108459
Other languages
French (fr)
Chinese (zh)
Inventor
陈康
贾灿
李加润
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024017351A1 publication Critical patent/WO2024017351A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Definitions

  • the embodiments of the present application relate to the field of computer technology, and specifically, to a method and device for calling system services.
  • a distributed system service is a system composed of multiple processors interconnected through communication lines. Normally, distributed system services only start to work in a cross-device scenario. In a single-machine scenario, distributed system services have no practical application, but occupy boot resources, resulting in unnecessary consumption of system resources to a certain extent. Therefore, it is necessary to provide a method and device for calling distributed system services to reduce the consumption of system resources.
  • Embodiments of the present application provide a method and device for calling system services, which can load or unload distributed system services on demand and reduce the consumption of system resources.
  • a method for calling a system service includes: a first device sending first notification information to a second device.
  • the first notification information includes information about a target service, and the information about the target service is the third device.
  • Information about the system service that a device needs to call, the first notification information is used to instruct the second device to load the target service; the first device receives the first response information from the second device, the first response information includes the target service A service handle of the service, which is used by the first device to call the target service on the second device.
  • the first response information received by the first device includes a service handle of the target service.
  • the loading result of the target service by the second device is successful, and the second device can send the service handle to the first device to facilitate the first device to call the target service on the second device.
  • the first device receives first response information from the second device, where the first response information is used to indicate that the target service failed to load on the second device.
  • the second device sends the result of the loading failure to the first device, and the first device determines whether the target service still needs to be called on the second device based on actual needs. If it still needs to be called, it continues to call the target service.
  • the second device sends notification information to instruct the second device to reload the target service.
  • the first device in a networking scenario, or when a target service needs to be loaded across devices, can send notification information to the second device. After receiving the notification information from the first device, the second device Load the target service that the first device needs to call.
  • the first device is the calling device, and the second device is the called device.
  • the called device that is, the second device, does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
  • the method before the first device sends the first notification information to the second device, the method further includes: the first device determines the target device and the target service, the The target device is a device that needs to load the target service, wherein the second device is the target device.
  • the first device can determine the system service that needs to be called and the device that needs to call the system service based on actual needs, and then provide the determined device, which is the target device, or the second device. Send notification information to instruct the second device to load the target service.
  • the called device does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
  • the first device determines the target device and the target service, including: the first device determines the target device and the target service according to task flow requirements.
  • the target service serves a distributed scheduling system
  • the first device can determine the target service and target device that need to be called based on task flow requirements.
  • the task flow requirement can be that the target service is loaded on the current device or the first device and needs to be transferred to other devices such as the second device for loading; or it can also be that the application corresponding to the target service is loaded on the current device.
  • the use on the previous device or the first device needs to be transferred to other devices such as the second device for use. This transfer may also be called switching or the like.
  • the first device can instruct the second device to load the target service according to the usage scenario or actual usage requirements.
  • the second device does not need to load the target service when it is turned on, but loads the target service according to the usage requirements, thereby avoiding unnecessary errors. Solve the problem of resource occupation in necessary scenarios and reduce the consumption of system resources.
  • the first device may determine the target service and the target device based on hardware coordination requirements.
  • the hardware collaboration requirement can be a split-screen display of the upper-layer application corresponding to the target service. That is to say, the first device calls the second device so that the application interface corresponding to the target service can be partially displayed on the first device. , and the other part is displayed on the target device.
  • the method further includes: the first device sending second notification information to the second device, the second notification information being used to instruct the first device to The call to the target service ends.
  • the first device after the first device determines that there is no application or service on the device that needs to continue to call the target service on the second device, it can send notification information to the second device to instruct the first device to call the target service.
  • the call of the service has ended.
  • the second device can determine whether it is necessary to uninstall the target service according to the actual call situation, so as to reduce the occupation of system resources.
  • the method before the first device sends the second notification information to the second device, the method further includes: the first device determines that the transfer of the target service ends.
  • the target service serves a distributed scheduling system
  • the first device determines whether the transfer of the target service has ended.
  • it sends the second notification information to the second device. , indicating that the call to the target service has ended, so that the second device can uninstall the target service and reduce unnecessary occupation of system resources.
  • the target service is a distributed hardware service.
  • the first device determines that the hardware collaboration task is completed, and then sends the second notification information to the second device to indicate that the call to the target service is completed. .
  • the first device determines that the call to the target service has ended based on actual needs, and notifies the second device so that the second device determines whether the target service needs to be uninstalled to reduce unnecessary occupation of system resources.
  • a method for calling system services includes: a second device receiving first notification information from a first device, where the first notification information includes information about a target service, and the information about the target service is: Information about the system service that the first device needs to call, the first notification information is used to instruct the second device to load the target service; the second device loads the target service; the second device sends a first response to the first device information, the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
  • the first device in a networking scenario, or when a target service needs to be loaded across devices, can send notification information to the second device.
  • the second device After receiving the notification information from the first device, the second device Load the target service that the first device needs to call.
  • the first device is the calling device, and the second device is the called device.
  • the second device does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
  • the second device loads the target service, including: the second device pulls up a process corresponding to the target service; the second device initializes the target service; The second device registers with the target service.
  • the second device after receiving the call notification from the first device, loads the target service so that the first device calls the target service on the second device. Based on this solution, the second device does not need to load the target service when it is powered on. Instead, it loads the target service after receiving the call request from other devices, thereby reducing the occupation of boot resources and avoiding unnecessary waste of resources.
  • the method further includes: the second device receiving second notification information from the first device, the second notification information being used to instruct the first device to The call to the target service ends.
  • the first device after the first device determines that there is no application or service on the device that needs to continue to call the target service on the second device, it can send notification information to the second device to instruct the first device to call the target service.
  • the call of the service has ended.
  • the second device can determine whether it is necessary to uninstall the target service according to the actual call situation, so as to reduce the occupation of system resources.
  • the method further includes: the second device checks the reference count of the target service and determines whether to uninstall the target service.
  • the second device checks the reference count of the target service, that is, checks whether the target service is still called.
  • the reference count of the target service is 0, that is, when the target service is not called, the second device can uninstall the target service. target service to reduce the occupation of system resources; when the reference count of the target service is not 0, that is, when there are still devices or other services calling the target service, the second device does not need to uninstall the target service to facilitate other devices. Or the service calls the target service directly.
  • a device for calling system services which is applied to a first device.
  • the device includes: a sending module, configured to send first notification information to a second device, where the first notification information includes information about the target service,
  • the information of the target service is the information of the system service that the first device needs to call.
  • the first notification information is used to instruct the second device to load the target service;
  • the receiving module is used to receive the first response from the second device.
  • the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
  • the device further includes: a processing module, configured to determine a target device and the target service, and the target device is a device that needs to load the target service, wherein the first The second device is the target device.
  • the processing module is specifically configured to determine the target device and the target service according to task flow requirements.
  • the sending module is further configured to send second notification information to the second device, where the second notification information is used to instruct the first device to serve the target. The call ends.
  • the processing module is also used to determine the end of the transfer of the target service.
  • a device for calling system services which is applied to a second device.
  • the device includes: a receiving module, configured to receive first notification information from the first device, where the first notification information includes information about the target service.
  • the information of the target service is the information of the system service that the first device needs to call, the first notification information is used to instruct the second device to load the target service;
  • the processing module is used to load the target service;
  • the sending module is used For sending first response information to the first device, the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
  • the processing module is specifically used to launch a process corresponding to the target service, initialize the target service, and register the target service.
  • the receiving module is further configured to receive second notification information from the first device, where the second notification information is used to instruct the first device to respond to the target.
  • the service call ends.
  • the processing module is also used to check the reference count of the target service and determine whether to uninstall the target service.
  • an electronic device in a fifth aspect, includes: a processor for calling and running a computer program from a memory, so that the electronic device executes the first aspect or any of the possible methods in the first aspect. Implementation method; or perform the first aspect or any possible implementation method of the first aspect.
  • the electronic device further includes: the memory and/or a communication interface, the memory is used to store the computer program; the communication interface is used to send and receive data/signaling.
  • an electronic device in a sixth aspect, includes a device as in the third aspect or any one of the implementations of the third aspect, or as in the fourth aspect or any one of the implementations of the fourth aspect. device.
  • a computer program storage medium stores program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute the implementation of the first aspect or any one of the first aspects.
  • a chip system in an eighth aspect, includes at least one processor.
  • the program instructions are executed in the at least one processor, as in the first aspect or any one of the implementations of the first aspect, The method, or the method in the second aspect or any one of the implementation manners of the second aspect is implemented.
  • Figure 1 is a system architecture diagram provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Figure 3 is a software structure block diagram of an electronic device provided by an embodiment of the present application.
  • Figure 4 is an interactive schematic diagram of a method for loading system services provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of a scenario for calling system services provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of a scenario for calling system services provided by an embodiment of the present application.
  • Figure 7 is an interactive schematic diagram of a method for uninstalling system services provided by an embodiment of the present application.
  • Figure 8 is an interactive schematic diagram of a method for calling system services provided by an embodiment of the present application.
  • Figure 9 is a structural block diagram of a device for calling system services provided by an embodiment of the present application.
  • Figure 10 is a structural block diagram of a device for calling system services provided by an embodiment of the present application.
  • Figure 1 is a schematic diagram of a system architecture applicable to embodiments of the present application.
  • Two or more electronic devices form a networking scenario, such as device A and device B shown in the figure.
  • Device A can call system services from device B.
  • Device B can also call system services from device A.
  • the device A and device B can be electronic devices that support the operation of distributed system services, such as mobile phones, computers, tablets, smart watches, large-screen devices, etc., and are not limited to the devices shown in Figure 1.
  • FIG. 2 shows a schematic structural diagram of the electronic device 100.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, compass 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195, etc.
  • SIM Subscriber identification module
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • image signal processor, ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • NPU neural-network processing unit
  • different processing units can be independent components or integrated in one or more processors.
  • electronic device 100 may also include one or more processors 110 .
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 may be a cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the electronic device 100 in processing data or executing instructions.
  • processor 110 may include one or more interfaces.
  • the interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, and a universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM card interface, and/or USB interface, etc.
  • the USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices.
  • the USB interface The 130 can also be used to connect headphones to play audio through them.
  • the interface connection relationships between the modules illustrated in the embodiments of the present application are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 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.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) network), Bluetooth (bluetooth, BT), global navigation satellite system ( Global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • Bluetooth blue, BT
  • GNSS Global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • electronic device 100 may include one or more display screens 194.
  • the display screen 194 in Figure 2 can be bent.
  • the above-mentioned display screen 194 can be bent means that the display screen 194 can be bent at any position to any angle and can be maintained at this angle.
  • the display screen 194 can be folded in half from the middle to the left and right. You can also fold it in half from the middle up and down.
  • the display screen 194 of the electronic device 100 may be a flexible screen.
  • flexible screens have attracted much attention due to their unique characteristics and huge potential.
  • flexible screens are more flexible and bendable. They can provide users with new interaction methods based on bendable characteristics and can meet more users' needs for electronic devices.
  • the foldable display screen on the electronic device can be switched between a small screen in a folded form and a large screen in an unfolded form at any time. Therefore, users The split-screen function is used more and more frequently on electronic devices equipped with foldable displays.
  • the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • 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 sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
  • Camera 193 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • electronic device 100 may include one or more cameras 193 .
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • the NPU can realize intelligent cognitive applications of the electronic device 100, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 121 may be used to store one or more computer programs including instructions.
  • the processor 110 can execute the above instructions stored in the internal memory 121 to cause the electronic device 100 to execute the methods provided in some embodiments of the present application, as well as various applications and data processing.
  • the internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store the operating system; the stored program area can also store one or more applications (such as photo galleries, contacts, etc.). The storage data area may store data created during use of the electronic device 100 (such as photos, contacts, etc.).
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc.
  • the processor 110 can cause the electronic device 100 to execute the instructions provided in the embodiments of the present application by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor 110 . methods, and other applications and data processing.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the sensor module 180 may 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, and an ambient light sensor. 180L, bone conduction sensor 180M, etc.
  • the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
  • a capacitive pressure sensor may include at least two parallel plates of conductive material.
  • the electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
  • the gyroscope can Sensor 180B determines the angular velocity of electronic device 100 about three axes (ie, X, Y, and Z axes).
  • the gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
  • Temperature sensor 180J is used to detect temperature.
  • the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K can be disposed on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
  • FIG. 3 is a software structure block diagram of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the first application is located in the application layer, that is to say, any application in the application layer can trigger the call to the remote system service.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer can include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
  • the window manager is used to manage window programs.
  • the window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • the data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the electronic device 100 .
  • call status management including connected, hung up, etc.
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, prompting text messages in the status bar, making beeps, electronic devices Vibration, indicator light flashing, etc.
  • System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (media libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG and PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition and layer processing.
  • 2D Graphics Engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
  • a distributed system is a loosely coupled system composed of multiple processors interconnected through communication lines. It can realize long-distance communication between nodes and usually has distribution, autonomy, parallelism and globality. Characteristics.
  • RPC Remote procedure call
  • Handle The handle is a reference identifier managed by the system. It can be relocated to a memory address by the system. It is equivalent to a special pointer. When an application wants to reference other systems, such as databases and operations, When accessing memory blocks or objects managed by the system, etc., handles must be used.
  • Reference counting is a memory management technology in computer programming languages. It refers to saving the number of references to resources (such as objects, memory or disk space, etc.). When the number of references becomes 0, it will be In its release process, the purpose of automatic resource management can be achieved using reference count technology.
  • Semaphore Also called a semaphore, it is a facility used in a multi-threaded environment and can be used to ensure that two or more key code segments are not called concurrently. Before entering a code segment, the thread must obtain a semaphore. After the code segment is completed, the thread releases the semaphore. Other threads that want to enter the code segment must wait until other threads release the semaphore before they can enter.
  • distributed system services are loaded when the electronic device is turned on. For example, if startup is configured in the configuration file of the process corresponding to the system service, when the electronic device is turned on, the process corresponding to the system service is pulled up. Start and register the system service.
  • distributed system services only start to work in a cross-device scenario. They have no practical effect in a single-machine scenario, but occupy boot resources, causing unnecessary consumption of system resources to a certain extent. Therefore, this application proposes a method of loading and unloading system services on demand. When device A/device B needs to call system services from device B/device A, device B/device A loads the system service. The following describes the method of calling system services provided by the embodiment of the present application with reference to Figures 4 to 8.
  • Figure 4 is an interactive schematic diagram of a method for calling system services provided by an embodiment of the present application.
  • the called device can load target system services on demand.
  • the method includes steps S401 to S406.
  • the first device determines the target device and target service.
  • the target service may be a system service that the first device requires the second device to load on demand, or in other words, the target service may be a system service that the first device needs to call.
  • the target device is a device that needs to load the target service, or in other words, the target device is a device that the first device needs to call the target service.
  • the target device may be a second device.
  • the target service may serve a distributed system, such as a distributed scheduling system service used to schedule distributed circulation components, or a distributed hardware service used to process hardware collaboration, etc.
  • the first device may determine the target device and the target service according to task flow requirements.
  • the task flow requirement can be that the target service is loaded on the current device or the first device and needs to be transferred to other devices such as the second device for loading; or it can also be that the application corresponding to the target service is loaded on the current device or the first device.
  • the use on one device needs to be transferred to other devices, or the target device, or the second device for use. This transfer may also be called switching or the like.
  • the user can select an application that needs to be transferred on device A, such as application #1, and can select a device that is networked with the device, such as device B.
  • device A detects the user's operation, it determines the target device and target service.
  • the device B is the second device, which is the target device, or the called device.
  • the device A is the first device, which is the calling device.
  • the target service is the system service corresponding to the application #1.
  • the first device may determine the target service and the target device according to hardware coordination requirements.
  • the hardware collaboration requirement can be a split-screen display of the upper-layer application corresponding to the target service. That is to say, the first device calls the second device so that the application interface corresponding to the target service can be partially displayed on the first device. Part of it is displayed on the target device.
  • device A can call device B to cause the slides to be presented on device B, and comments corresponding to the slides to be presented on device A.
  • S402 The first device sends the first notification information to the second device, and accordingly, the second device receives the first notification information from the first device.
  • the first notification information includes information about the target service.
  • the information about the target service is information about the system service that the first device needs to call.
  • the information about the target service can be the ID of the target service or the ID of the target service. Name, etc., this application does not limit this.
  • the first notification information may also be used to instruct the second device to load the target service.
  • the first device may send the first notification information to the second device through RPC.
  • the second device After receiving the first notification information from the first device, the second device loads the target service. Loading the target service by the second device may include steps S403 to S405.
  • the second device starts the process corresponding to the target service.
  • the second device can pull up the process corresponding to the target service or start the process corresponding to the target service for the second device.
  • the second device may initialize the target service so that the second device provides an application corresponding to the target service with the ability to run on the second device.
  • the second device registers the target service.
  • the second device registers with the target service and manages and maintains the target service so that the target service can run on the second device.
  • S406 The second device sends the first response information to the first device, and accordingly, the first device receives the first response information from the second device.
  • the first response information includes a service handle
  • the service handle is used by the first device to call the target service on the second device.
  • the service handle is also the handle corresponding to the target service.
  • the first device can determine the location and other information of the target service based on the service handle and call it.
  • the first response information may also be used to indicate that the loading result of the target service is successful.
  • the first response information is used to indicate that the loading result of the target service on the second device is a loading failure.
  • the first device can re-send notification information to the second device to instruct the second device to reload the target service, or the first device can give up calling the target service on the second device.
  • the target device in the distributed system service scenario, when the calling device needs to call the target service, the target device can load the target service. There is no need to load the system service in the boot or stand-alone scenario, thereby reducing boot resources. occupation to avoid unnecessary consumption of resources.
  • the target device can also uninstall the target service.
  • the following describes a method for uninstalling system services provided by the embodiment of the present application, as shown in Figure 7.
  • the method includes the following steps S701 to S705.
  • S701 The first device determines that the invocation of the target service is completed.
  • the end of the target service call can be specifically when the first device and the second device change from a networking scenario to a non-networking scenario, or a stand-alone scenario, that is, when the second device is not needed, the first device can independently meet the usage requirements. Scenes.
  • the first device determines that the target service call is completed because the first device detects that the target service exits running on the first device, or the first device receives a user instruction indicating that the target service call is completed, etc.
  • the first device determines that the invocation of the target service has ended.
  • the first device determines that the transfer of the target service has ended, or that the transfer of the upper-layer application corresponding to the target service has ended.
  • the first device determines that the invocation of the target service is completed by determining that the hardware collaboration task is completed, or that the cross-device display of the application corresponding to the target service is completed.
  • S702 The first device sends second notification information to the second device, and accordingly, the second device receives the second notification information from the first device.
  • the second notification information is used to indicate the end of the first device's call to the target service.
  • the second notification information can also be used to instruct the second device to uninstall the target service.
  • the second device checks the reference count of the target service.
  • the second device checks whether the target service is still called.
  • the reference count of the target service is not 0.
  • the reference count of the target service is 0.
  • the second device needs to check the reference count of the target service to confirm whether The target service needs to be uninstalled.
  • the second device checks the reference count of the target service within the preset period. If the reference count of the target service is 0 within the preset period, the second device can start the reference count of the target service. Service uninstallation process.
  • the second device confirms that the reference count of the target service is 0, that is, when the target service is not called, the second device releases resources such as memory and semaphore.
  • the process corresponding to the target service exits, and the second device uninstalls the target service.
  • the second device determines that the reference count of the target service is not 0, that is, after the first device completes the call to the target service, there are still other devices on the second device. If the target service is called on the second device, the second device may not uninstall the target service, so that other devices can call the target service on the second device.
  • the calling device after the calling device completes the call to the target service, the calling device sends notification information to the called device, and the called device determines that no other device calls the target service. , uninstall the target service and reduce the occupation of system resources. If it is determined that other devices still call the target service, retain the target service so that other devices can directly call the target service.
  • the above loading and unloading methods of system services can be combined and applied together in distributed scenarios.
  • the calling device and the called device can trigger the loading and unloading of system services according to actual application requirements.
  • the following takes the task flow scenario as an example, combined with the first
  • the specific modules in the device and the second device introduce the loading and unloading method of system services, as shown in Figure 8.
  • the method includes steps S801 to S816.
  • the first application or first service determines the target device and target service.
  • the first service is a system service on the first device that needs to call the target service.
  • the first application is an upper-layer application corresponding to the first service.
  • the first service and the target service can be the same service or different services. service, and the first service can serve the system that has been loaded.
  • the first application or the first service can be determined according to task flow requirements. For example, when the first application or the first service detects a user operation and needs to flow the first application to the second device for running, or when the first service needs to flow to the second device for loading, the first application or the first service determines the first application or the first service.
  • the second device is a target device
  • the first service is a target service.
  • the first service and the target service may be the same service.
  • the task can serve the target or the upper-layer application corresponding to the target.
  • This task flow can be a cross-device call and load of the target service, or it can be a cross-device running or use of the application corresponding to the target service.
  • this task flow can be that the user uses a music application on a mobile phone and now needs to continue to use the music application on a tablet, which can trigger the flow of the music application from the mobile phone to the tablet, and the music application can also be transferred back from the tablet. cell phone.
  • the first application or first service of the first device specifies the target device and target service (load remote system capability) to the system service management module of the first device.
  • the first application or the first service sends the information of the target device and the target service to the system service management module.
  • the information of the target device may be the name of the target device, or the identification of the target device, and the target service
  • the information can be the name of the target service, or the identification of the target service and other information.
  • the system service management module of the first device sends the first notification information to the system service management module of the second device.
  • the second device is also the target device determined by the first device.
  • Step S803 is similar to step S402. The only difference is that the first notification information can be sent by the system service management module of the first device and received by the system service management module of the second device. To avoid duplication, the content of this step will not be repeated. Again.
  • S804 The system service management module of the second device specifies the target service to the startup management module of the second device.
  • the system service management module of the second device can send the information of the target service to the startup management module, so that the startup management module can start the process corresponding to the target service.
  • system service management module of the second device can also send instruction information to the startup management module, instructing the startup management module to pull up the process corresponding to the target service.
  • S805 The startup management module of the second device starts the process corresponding to the target service, or starts the process corresponding to the target service.
  • S806 The system service management module of the second device initializes the target service.
  • the system service management module of the second device provides the application corresponding to the target service with the ability to run on the second device.
  • S807 The system service management module of the second device registers the target service.
  • the system service management module of the second device registers the target service, and manages and maintains the target service so that the target service can run on the second device.
  • S808 The system service management module of the second device sends the first response information to the system service management module of the first device.
  • Step S808 is similar to step S406. The only difference is that the first response information can be sent by the system service management module of the second device and received by the system service management module of the first device. To avoid duplication, the content of this step will not be repeated. Again.
  • This task transfer can be that the target service is only loaded on the first device before the transfer, and now needs to be loaded on the second device as well; or the upper-layer application corresponding to the target service can be switched from running on the first device. To run on the second device, the upper-layer application corresponding to the target service can also be switched from running on the second device to running on the first device.
  • the first service and the target service can serve the same system.
  • S810 The first application or first service of the first device notifies the system service management module of the first device that the invocation of the target service ends.
  • the first device determines that the task transfer is completed, that is to say, the first device determines that the transfer of the target service between the first device and the second device is completed, or that the scenario of the target service is determined by the group.
  • Network scenarios have become non-network scenarios, or stand-alone scenarios, or scenarios that do not require task flow.
  • the system service management module of the first device sends the second notification information to the system service management module of the second device.
  • the system service management module of the first device determines that the call of the first application or first service to the target service has ended, and checks whether there are other applications or services on the first device that call the target service. After determining that the first device has After no application or service calls the target service, the second notification information is sent to the system service management module of the second device.
  • the second notification information is used to indicate the end of the first device's call to the target service.
  • the second notification information may also be used to instruct the second device to uninstall the target service.
  • S812 The system service management module of the second device notifies the first process of the second device that the invocation of the target service has ended.
  • system service management module of the second device may also send instruction information to the first process to instruct the first process to exit running.
  • the first process is a process corresponding to the target service.
  • the first process checks whether the reference count of the target service is 0. That is to say, after the first device ends calling the target service, the first process checks whether there are still other devices calling the target service on the second device. target service.
  • the second device determines that the reference count of the target service is 0, that is to say, after the first device ends calling the target service on the second device, there is no other device on the second device.
  • the first process can release resources such as memory and semaphores.
  • the first process does not need to perform step S814.
  • the second device determines that the reference count of the target service is 0, it may choose not to release the resource. For example, when the system resources are sufficient, it is convenient for other subsequent devices to directly call the target service.
  • S815 The first process notifies the system service management module of the second device to uninstall or retain the target service.
  • the first process may notify the system service management module of the second device to uninstall the target service.
  • the first process may notify the system service management module of the second device to retain the target service.
  • S816 The system service management module of the second device uninstalls or retains the target service.
  • the system service management module of the second device retains the target service when the reference count of the target service is not 0, so that other devices or other services can directly call the target service on the second device. target service.
  • the system service management module of the second device uninstalls the target service when the reference count of the target service is 0 to reduce the occupation of system resources.
  • system service management module of the second device may not uninstall the target service when the reference count of the target service is 0, so that subsequent other devices can directly call the target service.
  • the called device loads the target. service, thereby reducing the boot memory usage and saving system resources; after the task transfer is completed, the called device will decide whether to uninstall the target service based on actual needs. Uninstalling the target service can save system resources, and retaining the target service will This can facilitate direct calling of the target service during the next task transfer.
  • the second device can call the target service on the third device.
  • the second device may perform the actions performed by the first device
  • the third device may perform the actions performed by the second device.
  • Figure 9 is a structural block diagram of a communication device provided according to a method embodiment of the present application.
  • the communication device can have the functions of the first device or the second device in the above method embodiment, and is used to execute the first device in the above method embodiment. The steps performed by the device or a second device.
  • the communication device 900 shown in Figure 9 can serve as the first device involved in the above method embodiment, and perform the steps performed by the first device in the above method embodiment.
  • the communication device may include a receiving module 910 and a sending module 920.
  • the receiving module 910 may be used to support the communication device 900 in receiving information, for example, performing S406, S808 and other receiving actions performed by the first device in FIGS. 4 to 8 .
  • the sending module 920 may be used to support the communication device 900 in sending information, for example, performing S402, S702, S803, S811 and other sending actions performed by the first device in FIGS. 4 to 8 .
  • the receiving module 910 and the sending module 920 may also be used to perform receiving or sending actions performed between the system service management module of the first device and the first application or the first service, such as steps S802 and S810 in FIG. 8 .
  • the communication device may also include a processing module 930, which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S401, S701, S801 and S809 in 6 are processing actions performed by the first device.
  • a processing module 930 which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S401, S701, S801 and S809 in 6 are processing actions performed by the first device.
  • the communication device 900 may also include a storage module 940 for storing program codes and data of the communication device 900 .
  • the communication device 900 shown in Figure 9 can serve as the second device involved in the above method embodiment, and perform the steps performed by the second device in the above method embodiment.
  • the communication device 900 may include a sending module 920 and a receiving module 910 .
  • the receiving module 910 may be used to support the communication device 900 in receiving information, for example, performing S402, S702, S803 and S811 in FIGS. 4 to 8 and other receiving actions performed by the second device.
  • the sending module 920 may be used to support the communication device 900 in sending information, for example, performing sending actions performed by the second device such as S406 and S808 in FIGS. 4 to 8 .
  • the receiving module 910 and the sending module 920 can also be used to perform receiving and sending actions between the system service management module, startup management module and the first process of the second device, such as steps S804, S812 and S815 in Figure 8.
  • the communication device may also include a processing module 930, which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S403, S404, S405, S703, S704, S705, S705, S806, S807, S813, S814 and S816 in 8 are the processing actions performed by the second device.
  • a processing module 930 which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S403, S404, S405, S703, S704, S705, S705, S806, S807, S813, S814 and S816 in 8 are the processing actions performed by the second device.
  • the communication device 900 may also include a storage module 940 for storing program codes and data of the communication device 900 .
  • Figure 10 is a schematic block diagram of a communication device 1000 provided by an embodiment of the present application.
  • the communication device 1000 includes: at least one processor 1010 and a transceiver 1020.
  • the processor 1010 is coupled to the memory 1030 and is used to execute instructions stored in the memory 1030 to control the transceiver 1020 to send signals and/or receive signals.
  • the communication device 1000 further includes a memory 1030 for storing instructions.
  • the above-mentioned processor 1010 and the memory 1030 can be combined into one processing device, and the processor 1010 is used to execute the program code stored in the memory 1030 to implement the above functions.
  • the memory 1030 can also be integrated into the processor 1010 in, or independently of processor 1010.
  • transceiver 1020 may include a receiver and a transmitter.
  • the transceiver 1020 may further include an antenna, and the number of antennas may be one or more.
  • the transceiver 1020 may be a communication interface or an interface circuit.
  • the chip When the communication device 1000 is a chip, the chip includes a transceiver module and a processing module.
  • the transceiver module may be an input-output circuit or a communication interface;
  • the processing module may be a processor, microprocessor, or integrated circuit integrated on the chip.
  • the first device/second device chip implements the functions of the first device/second device in the above method embodiment.
  • the first device/second device chip receives information from other modules (such as radio frequency modules or antennas) in the first device/second device, and the information is sent to the first device by the second device/first device or other devices.
  • device/second device; or, the first device/second device chip outputs information to other modules (such as radio frequency modules or antennas) in the first device/second device, and the information is the first device/second device Sent to the second device/first device, or other devices.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores computer programs or instructions.
  • the computer programs or instructions are executed by a computer (for example, a processor) to implement the steps in the embodiments of the present application. Some or all of the steps of any method performed by any device.
  • Embodiments of the present application also provide a computer program product containing instructions that, when run on a computer, cause some or all of the steps of any method executed by any device in the embodiments of the present application to be executed.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of modules is only a logical function division. In actual implementation, there may be other division methods.
  • multiple modules or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms.
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
  • the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

Provided in the embodiments of the present application are a method and apparatus for calling a system service. The method comprises: a first device sending first notification information to a second device, wherein the first notification information comprises information of a target service, that is, information of a system service needing to be called by the first device, and the first notification information is used for instructing the second device to load the target service; and after loading the target service, the second device sending first response information to the first device, wherein the first response information comprises a service handle of the target service, and the service handle is used for the first device to call the target service on the second device. By means of the method provided in the embodiments of the present application, a called device does not need to load a target service during startup, but loads the target service as required, such that the occupation of startup resources can be reduced, and the consumption of system resources is avoided.

Description

调用系统服务的方法和装置Methods and devices for calling system services
本申请要求在2022年7月22日提交中国国家知识产权局、申请号为202210871045.0的中国专利申请的优先权,发明名称为“调用系统服务的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the State Intellectual Property Office of China with application number 202210871045.0 on July 22, 2022, and the priority of the Chinese patent application titled "Method and Device for Calling System Services", which The entire contents are incorporated herein by reference.
技术领域Technical field
本申请实施例涉及计算机技术领域,具体地,涉及一种调用系统服务的方法和装置。The embodiments of the present application relate to the field of computer technology, and specifically, to a method and device for calling system services.
背景技术Background technique
分布式系统服务是由多个处理机通过通信线路互联构成的系统。通常情况下,分布式系统服务在跨设备场景下才开始真正工作,而在单机场景下,分布式系统服务没有实际应用,却占据了开机资源,一定程度上造成了系统资源的非必要耗费。因此,必要提供一种调用分布式系统服务的方法和装置,以减少系统资源的耗费。A distributed system service is a system composed of multiple processors interconnected through communication lines. Normally, distributed system services only start to work in a cross-device scenario. In a single-machine scenario, distributed system services have no practical application, but occupy boot resources, resulting in unnecessary consumption of system resources to a certain extent. Therefore, it is necessary to provide a method and device for calling distributed system services to reduce the consumption of system resources.
发明内容Contents of the invention
本申请实施例提供一种调用系统服务的方法和装置,能够按需加载或卸载分布式系统服务,减少系统资源的耗费。Embodiments of the present application provide a method and device for calling system services, which can load or unload distributed system services on demand and reduce the consumption of system resources.
第一方面,提供了一种调用系统服务的方法,该方法包括:第一设备向第二设备发送第一通知信息,该第一通知信息包括目标服务的信息,该目标服务的信息为该第一设备需要调用的系统服务的信息,该第一通知信息用于指示该第二设备加载该目标服务;该第一设备接收来自第二设备的第一响应信息,该第一响应信息包括该目标服务的服务句柄,该服务句柄用于该第一设备在该第二设备上调用该目标服务。In a first aspect, a method for calling a system service is provided. The method includes: a first device sending first notification information to a second device. The first notification information includes information about a target service, and the information about the target service is the third device. Information about the system service that a device needs to call, the first notification information is used to instruct the second device to load the target service; the first device receives the first response information from the second device, the first response information includes the target service A service handle of the service, which is used by the first device to call the target service on the second device.
在一种可能的实现方式中,第一设备接收的第一响应信息中包括该目标服务的服务句柄。在该方案中,第二设备对该目标服务的加载结果为加载成功,第二设备可以将服务句柄发送给第一设备,便于第一设备在第二设备上调用该目标服务。In a possible implementation manner, the first response information received by the first device includes a service handle of the target service. In this solution, the loading result of the target service by the second device is successful, and the second device can send the service handle to the first device to facilitate the first device to call the target service on the second device.
在另一种可能的实现方式中,该第一设备接收来自第二设备的第一响应信息,该第一响应信息用于指示该目标服务在该第二设备上加载失败。在该方案中,第二设备将加载失败的结果发送给第一设备,该第一设备根据实际需求确定是否仍需在该第二设备上调用该目标服务,若仍需调用,则继续向该第二设备发送通知信息,指示该第二设备重新加载该目标服务。In another possible implementation, the first device receives first response information from the second device, where the first response information is used to indicate that the target service failed to load on the second device. In this solution, the second device sends the result of the loading failure to the first device, and the first device determines whether the target service still needs to be called on the second device based on actual needs. If it still needs to be called, it continues to call the target service. The second device sends notification information to instruct the second device to reload the target service.
在本申请提供的实施例中,在组网场景下,或者需要跨设备加载目标服务时,第一设备可以向第二设备发送通知信息,在接收到第一设备的通知信息后,第二设备加载该第一设备需要调用的目标服务。该第一设备即调用设备,第二设备即被调用设备。基于该方案,被调用设备也就是第二设备无需在开机时加载该目标服务,而是根据使用需求加载该目标服务,从而能够避免非必要场景下的资源占用问题,减少系统资源的耗费。In the embodiments provided by this application, in a networking scenario, or when a target service needs to be loaded across devices, the first device can send notification information to the second device. After receiving the notification information from the first device, the second device Load the target service that the first device needs to call. The first device is the calling device, and the second device is the called device. Based on this solution, the called device, that is, the second device, does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
结合第一方面,在第一方面的某些实现方式中,在该第一设备向第二设备发送第一通知信息之前,该方法还包括:该第一设备确定目标设备和该目标服务,该目标设备为需要加载该目标服务的设备,其中,该第二设备为该目标设备。With reference to the first aspect, in some implementations of the first aspect, before the first device sends the first notification information to the second device, the method further includes: the first device determines the target device and the target service, the The target device is a device that needs to load the target service, wherein the second device is the target device.
在本申请提供的实施例中,第一设备可以根据实际需求确定需要调用的系统服务,以及需要在哪个设备上调用该系统服务,进而向该确定的设备也就是目标设备,或者说第二设备发送通知信息,指示该第二设备加载该目标服务。基于该方案,被调用设备无需在开机时加载该目标服务,而是根据使用需求加载该目标服务,从而能够避免非必要场景下的资源占用问题,减少系统资源的耗费。In the embodiments provided by this application, the first device can determine the system service that needs to be called and the device that needs to call the system service based on actual needs, and then provide the determined device, which is the target device, or the second device. Send notification information to instruct the second device to load the target service. Based on this solution, the called device does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
结合第一方面,在第一方面的某些实现方式中,该第一设备确定目标设备和该目标服务,包括:该第一设备根据任务流转需求确定该目标设备和该目标服务。With reference to the first aspect, in some implementations of the first aspect, the first device determines the target device and the target service, including: the first device determines the target device and the target service according to task flow requirements.
在一种可能的场景下,该目标服务为分布式调度系统服务,该第一设备可以根据任务流转需求确定需要调用的目标服务以及目标设备。该任务流转需求可以为该目标服务在当前设备或者说第一设备上的加载,需要流转至其他设备例如第二设备上进行加载;或者也可以为该目标服务对应的应用在当 前设备或者说第一设备上的使用,需要流转至其他设备例如第二设备上进行使用。该流转或者也可以称为切换等。基于该方案,第一设备可以根据使用场景或实际使用需求,指示第二设备加载目标服务,第二设备无需在开机时加载该目标服务,而是根据使用需求加载该目标服务,从而能够避免非必要场景下的资源占用问题,减少系统资源的耗费。In one possible scenario, the target service serves a distributed scheduling system, and the first device can determine the target service and target device that need to be called based on task flow requirements. The task flow requirement can be that the target service is loaded on the current device or the first device and needs to be transferred to other devices such as the second device for loading; or it can also be that the application corresponding to the target service is loaded on the current device. The use on the previous device or the first device needs to be transferred to other devices such as the second device for use. This transfer may also be called switching or the like. Based on this solution, the first device can instruct the second device to load the target service according to the usage scenario or actual usage requirements. The second device does not need to load the target service when it is turned on, but loads the target service according to the usage requirements, thereby avoiding unnecessary errors. Solve the problem of resource occupation in necessary scenarios and reduce the consumption of system resources.
在另一种可能的场景下,例如该目标服务为分布式硬件服务时,该第一设备可以根据硬件协同需求确定目标服务和目标设备。示例性地,该硬件协同需求可以为该目标服务对应的上层应用的分屏显示,也就是说,该第一设备调用第二设备,使得该目标服务对应的应用界面可以部分显示于第一设备,另一部分显示于该目标设备。In another possible scenario, for example, when the target service is a distributed hardware service, the first device may determine the target service and the target device based on hardware coordination requirements. For example, the hardware collaboration requirement can be a split-screen display of the upper-layer application corresponding to the target service. That is to say, the first device calls the second device so that the application interface corresponding to the target service can be partially displayed on the first device. , and the other part is displayed on the target device.
结合第一方面,在第一方面的某些实现方式中,该方法还包括:该第一设备向该第二设备发送第二通知信息,该第二通知信息用于指示该第一设备对该目标服务的调用结束。With reference to the first aspect, in some implementations of the first aspect, the method further includes: the first device sending second notification information to the second device, the second notification information being used to instruct the first device to The call to the target service ends.
在本申请提供的实施例中,第一设备确定本设备上没有应用或服务需要在该第二设备上继续调用该目标服务后,可以向第二设备发送通知信息,指示第一设备对该目标服务的调用已经结束,进而,第二设备可以根据实际调用情况确定是否需要卸载该目标服务,以减少系统资源的占用。In the embodiment provided by this application, after the first device determines that there is no application or service on the device that needs to continue to call the target service on the second device, it can send notification information to the second device to instruct the first device to call the target service. The call of the service has ended. Furthermore, the second device can determine whether it is necessary to uninstall the target service according to the actual call situation, so as to reduce the occupation of system resources.
结合第一方面,在第一方面的某些实现方式中,在该第一设备向该第二设备发送第二通知信息之前,该方法还包括:该第一设备确定该目标服务的流转结束。With reference to the first aspect, in some implementations of the first aspect, before the first device sends the second notification information to the second device, the method further includes: the first device determines that the transfer of the target service ends.
在一种可能的场景下,该目标服务为分布式调度系统服务,该第一设备判断目标服务的流转是否结束,在确定该目标服务的流转结束时,向该第二设备发送第二通知信息,指示对该目标服务的调用已经结束,以便第二设备卸载该目标服务,减少系统资源的非必要占用。In a possible scenario, the target service serves a distributed scheduling system, and the first device determines whether the transfer of the target service has ended. When it is determined that the transfer of the target service has ended, it sends the second notification information to the second device. , indicating that the call to the target service has ended, so that the second device can uninstall the target service and reduce unnecessary occupation of system resources.
该目标服务的流转结束,也可以为该目标服务对应的上层应用的流转结束。The transfer of the target service ends, or the transfer of the upper-layer application corresponding to the target service ends.
在另一种可能的场景下,该目标服务为分布式硬件服务,该第一设备确定该硬件协同任务结束,则向该第二设备发送该第二通知信息,指示对该目标服务的调用结束。In another possible scenario, the target service is a distributed hardware service. The first device determines that the hardware collaboration task is completed, and then sends the second notification information to the second device to indicate that the call to the target service is completed. .
在本申请提供的实施例中,第一设备根据实际需求确定对目标服务的调用结束,并通知第二设备,以便第二设备确定是否需要卸载该目标服务,以减少系统资源的非必要占用。In the embodiment provided by this application, the first device determines that the call to the target service has ended based on actual needs, and notifies the second device so that the second device determines whether the target service needs to be uninstalled to reduce unnecessary occupation of system resources.
第二方面,提供了一种调用系统服务的方法,该方法包括:第二设备接收来自第一设备的第一通知信息,该第一通知信息包括目标服务的信息,该目标服务的信息为该第一设备需要调用的系统服务的信息,该第一通知信息用于指示该第二设备加载该目标服务;该第二设备加载该目标服务;该第二设备向该第一设备发送第一响应信息,该第一响应信息包括该目标服务的服务句柄,该服务句柄用于该第一设备在该第二设备上调用该目标服务。In a second aspect, a method for calling system services is provided. The method includes: a second device receiving first notification information from a first device, where the first notification information includes information about a target service, and the information about the target service is: Information about the system service that the first device needs to call, the first notification information is used to instruct the second device to load the target service; the second device loads the target service; the second device sends a first response to the first device information, the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
在本申请提供的实施例中,在组网场景下,或者需要跨设备加载目标服务时,第一设备可以向第二设备发送通知信息,在接收到第一设备的通知信息后,第二设备加载该第一设备需要调用的目标服务。该第一设备即调用设备,第二设备即被调用设备。基于该方案,第二设备无需在开机时加载该目标服务,而是根据使用需求加载该目标服务,从而能够避免非必要场景下的资源占用问题,减少系统资源的耗费。In the embodiments provided by this application, in a networking scenario, or when a target service needs to be loaded across devices, the first device can send notification information to the second device. After receiving the notification information from the first device, the second device Load the target service that the first device needs to call. The first device is the calling device, and the second device is the called device. Based on this solution, the second device does not need to load the target service when it is powered on, but loads the target service according to usage requirements, thereby avoiding resource occupation problems in unnecessary scenarios and reducing the consumption of system resources.
结合第二方面,在第二方面的某些实现方式中,该第二设备加载该目标服务,包括:该第二设备拉起该目标服务对应的进程;该第二设备初始化该目标服务;该第二设备注册该目标服务。Combined with the second aspect, in some implementations of the second aspect, the second device loads the target service, including: the second device pulls up a process corresponding to the target service; the second device initializes the target service; The second device registers with the target service.
在本申请提供的实施例中,该第二设备在接收到该第一设备的调用通知后,加载该目标服务,以便第一设备在该第二设备上调用该目标服务。基于该方案,第二设备无需在开机时加载该目标服务,而是在接收到其他设备的调用需求后加载该目标服务,从而能够减少开机资源的占用,避免非必要的资源浪费。In the embodiment provided by this application, after receiving the call notification from the first device, the second device loads the target service so that the first device calls the target service on the second device. Based on this solution, the second device does not need to load the target service when it is powered on. Instead, it loads the target service after receiving the call request from other devices, thereby reducing the occupation of boot resources and avoiding unnecessary waste of resources.
结合第二方面,在第二方面的某些实现方式中,该方法还包括:该第二设备接收该第一设备的第二通知信息,该第二通知信息用于指示该第一设备对该目标服务的调用结束。With reference to the second aspect, in some implementations of the second aspect, the method further includes: the second device receiving second notification information from the first device, the second notification information being used to instruct the first device to The call to the target service ends.
在本申请提供的实施例中,第一设备确定本设备上没有应用或服务需要在该第二设备上继续调用该目标服务后,可以向第二设备发送通知信息,指示第一设备对该目标服务的调用已经结束,进而,第二设备可以根据实际调用情况确定是否需要卸载该目标服务,以减少系统资源的占用。In the embodiment provided by this application, after the first device determines that there is no application or service on the device that needs to continue to call the target service on the second device, it can send notification information to the second device to instruct the first device to call the target service. The call of the service has ended. Furthermore, the second device can determine whether it is necessary to uninstall the target service according to the actual call situation, so as to reduce the occupation of system resources.
结合第二方面,在第二方面的某些实现方式中,该方法还包括:该第二设备检查该目标服务的引用计数,确定是否卸载该目标服务。Combined with the second aspect, in some implementations of the second aspect, the method further includes: the second device checks the reference count of the target service and determines whether to uninstall the target service.
在本申请提供的实施例中,第二设备检查该目标服务的引用计数,也就是检查该目标服务是否仍被调用。在该目标服务的引用计数为0时,也就是该目标服务没有被调用时,第二设备可以卸载该目 标服务,以减少系统资源的占用;在该目标服务的引用计数不为0时,也就是仍然有设备或其他服务调用该目标服务时,第二设备可以不卸载该目标服务,以便于其他设备或服务直接调用该目标服务。In the embodiment provided by this application, the second device checks the reference count of the target service, that is, checks whether the target service is still called. When the reference count of the target service is 0, that is, when the target service is not called, the second device can uninstall the target service. target service to reduce the occupation of system resources; when the reference count of the target service is not 0, that is, when there are still devices or other services calling the target service, the second device does not need to uninstall the target service to facilitate other devices. Or the service calls the target service directly.
第三方面,提供了一种调用系统服务的装置,应用于第一设备,该装置包括:发送模块,用于向第二设备发送第一通知信息,该第一通知信息包括目标服务的信息,该目标服务的信息为该第一设备需要调用的系统服务的信息,该第一通知信息用于指示该第二设备加载该目标服务;接收模块,用于接收来自该第二设备的第一响应信息,该第一响应信息包括该目标服务的服务句柄,该服务句柄用于该第一设备在该第二设备上调用该目标服务。In a third aspect, a device for calling system services is provided, which is applied to a first device. The device includes: a sending module, configured to send first notification information to a second device, where the first notification information includes information about the target service, The information of the target service is the information of the system service that the first device needs to call. The first notification information is used to instruct the second device to load the target service; the receiving module is used to receive the first response from the second device. information, the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
结合第三方面,在第三方面的某些实现方式中,该装置还包括:处理模块,用于确定目标设备和该目标服务,该目标设备为需要加载该目标服务的设备,其中,该第二设备为该目标设备。In conjunction with the third aspect, in some implementations of the third aspect, the device further includes: a processing module, configured to determine a target device and the target service, and the target device is a device that needs to load the target service, wherein the first The second device is the target device.
结合第三方面,在第三方面的某些实现方式中,该处理模块具体用于,根据任务流转需求确定该目标设备和该目标服务。Combined with the third aspect, in some implementations of the third aspect, the processing module is specifically configured to determine the target device and the target service according to task flow requirements.
结合第三方面,在第三方面的某些实现方式中,该发送模块还用于,向该第二设备发送第二通知信息,该第二通知信息用于指示该第一设备对该目标服务的调用结束。In conjunction with the third aspect, in some implementations of the third aspect, the sending module is further configured to send second notification information to the second device, where the second notification information is used to instruct the first device to serve the target. The call ends.
结合第三方面,在第三方面的某些实现方式中,该处理模块还用于,确定该目标服务的流转结束。Combined with the third aspect, in some implementations of the third aspect, the processing module is also used to determine the end of the transfer of the target service.
第四方面,提供了一种调用系统服务的装置,应用于第二设备,该装置包括:接收模块,用于接收来自第一设备的第一通知信息,该第一通知信息包括目标服务的信息,该目标服务的信息为该第一设备需要调用的系统服务的信息,该第一通知信息用于指示该第二设备加载该目标服务;处理模块,用于加载该目标服务;发送模块,用于向该第一设备发送第一响应信息,该第一响应信息包括该目标服务的服务句柄,该服务句柄用于该第一设备在该第二设备上调用该目标服务。In a fourth aspect, a device for calling system services is provided, which is applied to a second device. The device includes: a receiving module, configured to receive first notification information from the first device, where the first notification information includes information about the target service. , the information of the target service is the information of the system service that the first device needs to call, the first notification information is used to instruct the second device to load the target service; the processing module is used to load the target service; the sending module is used For sending first response information to the first device, the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
结合第四方面,在第四方面的某些实现方式中,该处理模块具体用于,拉起该目标服务对应的进程,初始化该目标服务,注册该目标服务。Combined with the fourth aspect, in some implementations of the fourth aspect, the processing module is specifically used to launch a process corresponding to the target service, initialize the target service, and register the target service.
结合第四方面,在第四方面的某些实现方式中,该接收模块还用于,接收来自该第一设备的第二通知信息,该第二通知信息用于指示该第一设备对该目标服务的调用结束。In conjunction with the fourth aspect, in some implementations of the fourth aspect, the receiving module is further configured to receive second notification information from the first device, where the second notification information is used to instruct the first device to respond to the target. The service call ends.
结合第四方面,在第四方面的某些实现方式中,该处理模块还用于,检查该目标服务的引用计数,确定是否卸载该目标服务。Combined with the fourth aspect, in some implementations of the fourth aspect, the processing module is also used to check the reference count of the target service and determine whether to uninstall the target service.
第五方面,提供了一种电子设备,该电子设备包括:处理器,用于从存储器中调用并运行计算机程序,使得该电子设备执行如第一方面或该第一方面中任意一种可能的实现方式;或者执行如第一方面或该第一方面中任意一种可能的实现方式。In a fifth aspect, an electronic device is provided. The electronic device includes: a processor for calling and running a computer program from a memory, so that the electronic device executes the first aspect or any of the possible methods in the first aspect. Implementation method; or perform the first aspect or any possible implementation method of the first aspect.
结合第五方面,在第五方面的某些实现方式中,该电子设备还包括:该存储器和/或通信接口,该存储器用于存储该计算机程序;该通信接口用于收发数据/信令。In conjunction with the fifth aspect, in some implementations of the fifth aspect, the electronic device further includes: the memory and/or a communication interface, the memory is used to store the computer program; the communication interface is used to send and receive data/signaling.
第六方面,提供了一种电子设备,该电子设备包括如第三方面或第三方面中任意一种实现方式中的装置,或者如第四方面或第四方面中任意一种实现方式中的装置。In a sixth aspect, an electronic device is provided. The electronic device includes a device as in the third aspect or any one of the implementations of the third aspect, or as in the fourth aspect or any one of the implementations of the fourth aspect. device.
第七方面,提供了一种计算机程序存储介质,该计算机可读介质存储有程序代码,当该计算机程序代码在计算机上运行时,使得计算机执行如第一方面或第一方面中任意一种实现方式中的方法,或者,如第二方面或者第二方面中任意一种实现方式中的方法。In a seventh aspect, a computer program storage medium is provided. The computer-readable medium stores program code. When the computer program code is run on a computer, it causes the computer to execute the implementation of the first aspect or any one of the first aspects. The method in the method, or the method in the second aspect or any of the implementation methods of the second aspect.
第八方面,提供了一种芯片系统,该芯片系统包括至少一个处理器,当程序指令在该至少一个处理器中执行时,使得如第一方面或第一方面中的任意一种实现方式中的方法,或者,如第二方面或第二方面中的任意一种实现方式中的方法得以实现。In an eighth aspect, a chip system is provided. The chip system includes at least one processor. When the program instructions are executed in the at least one processor, as in the first aspect or any one of the implementations of the first aspect, The method, or the method in the second aspect or any one of the implementation manners of the second aspect is implemented.
附图说明Description of drawings
图1是本申请实施例提供的系统架构图。Figure 1 is a system architecture diagram provided by an embodiment of the present application.
图2是本申请实施例提供的一种电子设备的结构示意图。FIG. 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图3是本申请实施例提供的一种电子设备的软件结构框图。Figure 3 is a software structure block diagram of an electronic device provided by an embodiment of the present application.
图4是本申请实施例提供的一种加载系统服务的方法的交互示意图。Figure 4 is an interactive schematic diagram of a method for loading system services provided by an embodiment of the present application.
图5是本申请实施例提供的一种调用系统服务的场景示意图。Figure 5 is a schematic diagram of a scenario for calling system services provided by an embodiment of the present application.
图6是本申请实施例提供的一种调用系统服务的场景示意图。Figure 6 is a schematic diagram of a scenario for calling system services provided by an embodiment of the present application.
图7是本申请实施例提供的一种卸载系统服务的方法的交互示意图。Figure 7 is an interactive schematic diagram of a method for uninstalling system services provided by an embodiment of the present application.
图8是本申请实施例提供的一种调用系统服务的方法的交互示意图。 Figure 8 is an interactive schematic diagram of a method for calling system services provided by an embodiment of the present application.
图9是本申请实施例提供的一种调用系统服务的装置的结构框图。Figure 9 is a structural block diagram of a device for calling system services provided by an embodiment of the present application.
图10是本申请实施例提供的一种调用系统服务的设备的结构框图。Figure 10 is a structural block diagram of a device for calling system services provided by an embodiment of the present application.
具体实施方式Detailed ways
以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请以下各实施例中,“至少一个”、“一个或多个”是指一个、两个或两个以上。术语“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。The terminology used in the following examples is for the purpose of describing specific embodiments only and is not intended to limit the application. As used in the specification and appended claims of this application, the singular expressions "a", "an", "said", "above", "the" and "the" are intended to also Expressions such as "one or more" are included unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, "at least one" and "one or more" refer to one, two or more than two. The term "and/or" is used to describe the relationship between associated objects, indicating that there can be three relationships; for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, Where A and B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship.
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。Reference in this specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Therefore, the phrases "in one embodiment", "in some embodiments", "in other embodiments", "in other embodiments", etc. appearing in different places in this specification are not necessarily References are made to the same embodiment, but rather to "one or more but not all embodiments" unless specifically stated otherwise. The terms “including,” “includes,” “having,” and variations thereof all mean “including but not limited to,” unless otherwise specifically emphasized.
图1是本申请实施例适用的一种系统架构示意图,两个或两个以上的电子设备形成组网场景,例如图示的设备A和设备B,设备A可以从设备B上调用系统服务,设备B也可以从设备A上调用系统服务。该设备A和设备B可以为支持分布式系统服务运行的电子设备,例如手机、电脑、平板、智能手表和大屏设备等,而不仅限于图1中所示的设备。Figure 1 is a schematic diagram of a system architecture applicable to embodiments of the present application. Two or more electronic devices form a networking scenario, such as device A and device B shown in the figure. Device A can call system services from device B. Device B can also call system services from device A. The device A and device B can be electronic devices that support the operation of distributed system services, such as mobile phones, computers, tablets, smart watches, large-screen devices, etc., and are not limited to the devices shown in Figure 1.
示例性的,图2示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,指南针190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。For example, FIG. 2 shows a schematic structural diagram of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, compass 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的部件,也可以集成在一个或多个处理器中。在一些实施例中,电子设备100也可以包括一个或多个处理器110。其中,控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。在其他一些实施例中,处理器110中还可以设置存储器,用于存储指令和数据。示例性地,处理器110中的存储器可以为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。这样就避免了重复存取,减少了处理器110的等待时间,因而提高了电子设备100处理数据或执行指令的效率。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent components or integrated in one or more processors. In some embodiments, electronic device 100 may also include one or more processors 110 . Among them, the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions. In some other embodiments, the processor 110 may also be provided with a memory for storing instructions and data. By way of example, the memory in processor 110 may be a cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the electronic device 100 in processing data or executing instructions.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路间(inter-integrated circuit,I2C)接口,集成电路间音频(nter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,SIM卡接口,和/或USB接口等。其中,USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。该USB接口 130也可以用于连接耳机,通过耳机播放音频。In some embodiments, processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, and a universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM card interface, and/or USB interface, etc. Among them, the USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. The USB interface The 130 can also be used to connect headphones to play audio through them.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 . In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc. The power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In some other embodiments, the power management module 141 may also be provided in the processor 110 . In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 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.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,WiFi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) network), Bluetooth (bluetooth, BT), global navigation satellite system ( Global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像、视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、Miniled、MicroLed、Micro-oLed、量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或多个显示屏194。The display screen 194 is used to display images, videos, etc. Display 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode). emitting diode (AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or more display screens 194.
在本申请的一些实施例中,当显示面板采用OLED、AMOLED、FLED等材料时,上述图2中的显示屏194可以被弯折。这里,上述显示屏194可以被弯折是指显示屏可以在任意部位被弯折到任意角度,并可以在该角度保持,例如,显示屏194可以从中部左右对折。也可以从中部上下对折。In some embodiments of the present application, when the display panel uses materials such as OLED, AMOLED, FLED, etc., the display screen 194 in Figure 2 can be bent. Here, the above-mentioned display screen 194 can be bent means that the display screen 194 can be bent at any position to any angle and can be maintained at this angle. For example, the display screen 194 can be folded in half from the middle to the left and right. You can also fold it in half from the middle up and down.
电子设备100的显示屏194可以是一种柔性屏,目前,柔性屏以其独特的特性和巨大的潜力而备受关注。柔性屏相对于传统屏幕而言,具有柔韧性强和可弯曲的特点,可以给用户提供基于可弯折特性的新交互方式,可以满足用户对于电子设备的更多需求。对于配置有可折叠显示屏的电子设备而言,电子设备上的可折叠显示屏可以随时在折叠形态下的小屏和展开形态下大屏之间切换。因此,用户在 配置有可折叠显示屏的电子设备上使用分屏功能,也越来越频繁。The display screen 194 of the electronic device 100 may be a flexible screen. Currently, flexible screens have attracted much attention due to their unique characteristics and huge potential. Compared with traditional screens, flexible screens are more flexible and bendable. They can provide users with new interaction methods based on bendable characteristics and can meet more users' needs for electronic devices. For electronic devices equipped with a foldable display screen, the foldable display screen on the electronic device can be switched between a small screen in a folded form and a large screen in an unfolded form at any time. Therefore, users The split-screen function is used more and more frequently on electronic devices equipped with foldable displays.
电子设备100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点、亮度、肤色进行算法优化。ISP还可以对拍摄场景的曝光、色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。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 sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或多个摄像头193。Camera 193 is used to capture still images or video. The object passes through the lens to produce an optical image that is projected onto the 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, and then passes the electrical signal to the ISP to convert it into a digital image signal. ISP outputs digital image signals to DSP for processing. DSP converts digital image signals into standard RGB, YUV and other format image signals. In some embodiments, electronic device 100 may include one or more cameras 193 .
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1、MPEG2、MPEG3、MPEG4等。Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别、人脸识别、语音识别、文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can continuously learn by itself. The NPU can realize intelligent cognitive applications of the electronic device 100, such as image recognition, face recognition, speech recognition, text understanding, etc.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
内部存储器121可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器110可以通过运行存储在内部存储器121的上述指令,从而使得电子设备100执行本申请一些实施例中所提供的方法,以及各种应用以及数据处理等。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统;该存储程序区还可以存储一个或多个应用(比如图库、联系人等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如照片,联系人等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储部件,闪存部件,通用闪存存储器(universal flash storage,UFS)等。在一些实施例中,处理器110可以通过运行存储在内部存储器121的指令,和/或存储在设置于处理器110中的存储器的指令,来使得电子设备100执行本申请实施例中所提供的方法,以及其他应用及数据处理。电子设备100可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D、以及应用处理器等实现音频功能。例如音乐播放、录音等。Internal memory 121 may be used to store one or more computer programs including instructions. The processor 110 can execute the above instructions stored in the internal memory 121 to cause the electronic device 100 to execute the methods provided in some embodiments of the present application, as well as various applications and data processing. The internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store the operating system; the stored program area can also store one or more applications (such as photo galleries, contacts, etc.). The storage data area may store data created during use of the electronic device 100 (such as photos, contacts, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc. In some embodiments, the processor 110 can cause the electronic device 100 to execute the instructions provided in the embodiments of the present application by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor 110 . methods, and other applications and data processing. The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc.
传感器模块180可以包括压力传感器180A、陀螺仪传感器180B、气压传感器180C、磁传感器180D、加速度传感器180E、距离传感器180F、接近光传感器180G、指纹传感器180H、温度传感器180J、触摸传感器180K、环境光传感器180L、骨传导传感器180M等。The sensor module 180 may 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, and an ambient light sensor. 180L, bone conduction sensor 180M, etc.
其中,压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。Among them, the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor may include at least two parallel plates of conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is performed on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传 感器180B确定电子设备100围绕三个轴(即X、Y和Z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 . In some embodiments, the gyroscope can Sensor 180B determines the angular velocity of electronic device 100 about three axes (ie, X, Y, and Z axes). The gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。Fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。Temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
图3是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。FIG. 3 is a software structure block diagram of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, and each layer has clear roles and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer. The application layer can include a series of application packages.
如图3所示,应用程序包可以包括相机、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等。As shown in Figure 3, the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
其中,第一应用位于该应用程序层,也就是说,可以由应用程序层的任意一个应用程序触发对远端系统服务的调用。The first application is located in the application layer, that is to say, any application in the application layer can trigger the call to the remote system service.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架,应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图3所示,应用程序框架层可以包括窗口管理器、内容提供器、视图系统、电话管理器、资源管理器、通知管理器等。As shown in Figure 3, the application framework layer can include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
窗口管理器用于管理窗口程序,窗口管理器可以获取显示屏大小,判断是否有状态栏、锁定屏幕、截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频、图像、音频、拨打和接听的电话、浏览历史和书签、电话簿等。Content providers are used to store and retrieve data and make this data accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls that display text, controls that display pictures, etc. A view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide communication functions of the electronic device 100 . For example, call status management (including connected, hung up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串、图标、图片、布局文件、视频文件等等。The resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息、发出提示音、电子设备 振动、指示灯闪烁等。The notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, prompting text messages in the status bar, making beeps, electronic devices Vibration, indicator light flashing, etc.
系统库可以包括多个功能模块。例如:表面管理器(surface manager)、媒体库(media libraries)、三维图形处理库(例如:OpenGL ES)、2D图形引擎(例如:SGL)等。System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (media libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频、视频格式回放和录制以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4、H.264、MP3、AAC、AMR、JPG和PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG and PNG, etc.
三维图形处理库用于实现三维图形绘图、图像渲染、合成和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition and layer processing.
2D图形引擎是2D绘图的绘图引擎。2D Graphics Engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层至少包含显示驱动、摄像头驱动、音频驱动、传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
为便于理解本申请,首先对本申请涉及的专业术语进行解释。In order to facilitate understanding of this application, the professional terms involved in this application are first explained.
(1)分布式系统:分布式系统是多个处理机通过通信线路互联而构成的松散耦合的系统,能够实现节点之间的远距离通信,通常具有分布性、自治性、并行性和全局性的特征。(1) Distributed system: A distributed system is a loosely coupled system composed of multiple processors interconnected through communication lines. It can realize long-distance communication between nodes and usually has distribution, autonomy, parallelism and globality. Characteristics.
(2)远程过程调用(remote procedure call,RPC):RPC是指计算机A上的进程,调用另外一台计算机B上的进程,其中A上的调用进程被挂起,而B上的被调用进程开始执行,当值返回给A时,A进程继续执行。调用方可以通过使用参数将信息传送给被调用方,而后可以通过传回的结果得到信息。(2) Remote procedure call (RPC): RPC refers to a process on computer A that calls a process on another computer B. The calling process on A is suspended, and the called process on B Execution begins, and when the value is returned to A, the A process continues execution. The caller can pass information to the callee through the use of parameters, and then obtain the information through the returned results.
(3)句柄(handle):句柄是由系统所管理的引用标识,可以被系统重新定位到一个内存地址上,相当于一种特殊的指针,当一个应用程序要引用其他系统,如数据库、操作系统等所管理的内存块或对象时,就要使用句柄。(3) Handle: The handle is a reference identifier managed by the system. It can be relocated to a memory address by the system. It is equivalent to a special pointer. When an application wants to reference other systems, such as databases and operations, When accessing memory blocks or objects managed by the system, etc., handles must be used.
(4)引用计数:引用计数是计算机编程语言中一种内存管理技术,是指将资源(例如对象、内存或磁盘空间等)的被引用次数保存起来,当被引用次数变为0时就将其释放的过程,使用引用次数技术可以实现自动资源管理的目的。(4) Reference counting: Reference counting is a memory management technology in computer programming languages. It refers to saving the number of references to resources (such as objects, memory or disk space, etc.). When the number of references becomes 0, it will be In its release process, the purpose of automatic resource management can be achieved using reference count technology.
(5)信号量(semaphore):也称信号灯,是在多线程环境下使用的一种设施,可以用来保证两个或多个关键代码段不被并发调用。在进入一个代码段之前,线程必需获取一个信号量,在该代码段完成后,该线程释放信号量,其他想进入该代码段的线程必需等到其他线程释放信号量才可进入。(5) Semaphore: Also called a semaphore, it is a facility used in a multi-threaded environment and can be used to ensure that two or more key code segments are not called concurrently. Before entering a code segment, the thread must obtain a semaphore. After the code segment is completed, the thread releases the semaphore. Other threads that want to enter the code segment must wait until other threads release the semaphore before they can enter.
通常情况下,在电子设备开机时就加载分布式系统服务,例如,在系统服务对应的进程的配置文件中配置了开机启动的情况下,在电子设备开机时,该系统服务对应的进程被拉起,并注册该系统服务。然而,分布式系统服务在跨设备场景下才开始真正工作,在单机场景下没有实际作用,却占用了开机资源,一定程度上造成了系统资源的非必要耗费。因此,本申请提出了一种按需加载和卸载系统服务的方法,在设备A/设备B需要从设备B/设备A上调用系统服务时,设备B/设备A加载该系统服务。以下结合图4至图8介绍本申请实施例提供的调用系统服务的方法。Normally, distributed system services are loaded when the electronic device is turned on. For example, if startup is configured in the configuration file of the process corresponding to the system service, when the electronic device is turned on, the process corresponding to the system service is pulled up. Start and register the system service. However, distributed system services only start to work in a cross-device scenario. They have no practical effect in a single-machine scenario, but occupy boot resources, causing unnecessary consumption of system resources to a certain extent. Therefore, this application proposes a method of loading and unloading system services on demand. When device A/device B needs to call system services from device B/device A, device B/device A loads the system service. The following describes the method of calling system services provided by the embodiment of the present application with reference to Figures 4 to 8.
图4是本申请实施例提供的一种调用系统服务的方法的交互示意图,被调用设备可以按需加载目标系统服务,该方法包括步骤S401~S406。Figure 4 is an interactive schematic diagram of a method for calling system services provided by an embodiment of the present application. The called device can load target system services on demand. The method includes steps S401 to S406.
S401,第一设备确定目标设备和目标服务。S401. The first device determines the target device and target service.
该目标服务可以为该第一设备需要第二设备按需加载的系统服务,或者说,该目标服务可以为第一设备需要调用的系统服务。该目标设备为需要加载该目标服务的设备,或者说,该目标设备为该第一设备需要调用目标服务的设备,本申请中,该目标设备可以为第二设备。The target service may be a system service that the first device requires the second device to load on demand, or in other words, the target service may be a system service that the first device needs to call. The target device is a device that needs to load the target service, or in other words, the target device is a device that the first device needs to call the target service. In this application, the target device may be a second device.
该目标服务可以为分布式系统服务,例如用于调度分布式流转组件的分布式调度系统服务,又例如用于处理硬件协同的分布式硬件服务等。The target service may serve a distributed system, such as a distributed scheduling system service used to schedule distributed circulation components, or a distributed hardware service used to process hardware collaboration, etc.
在一种可能的实现方式中,该第一设备可以根据任务流转需求确定该目标设备和该目标服务。该任务流转需求可以为该目标服务在当前设备或者说第一设备上的加载,需要流转至其他设备例如第二设备上进行加载;或者也可以为该目标服务对应的应用在当前设备或者说第一设备上的使用,需要流转至其他设备、或者说目标设备、或者第二设备上进行使用。该流转或者也可以称为切换等。In a possible implementation, the first device may determine the target device and the target service according to task flow requirements. The task flow requirement can be that the target service is loaded on the current device or the first device and needs to be transferred to other devices such as the second device for loading; or it can also be that the application corresponding to the target service is loaded on the current device or the first device. The use on one device needs to be transferred to other devices, or the target device, or the second device for use. This transfer may also be called switching or the like.
示例性地,如图5所示,用户可以在设备A上选择需要流转的应用,如应用#1,且可以选择与本设备组网的设备,例如设备B。设备A检测到用户的操作后,确定目标设备和目标服务。该设备B为第二设备,也就是目标设备,或者说被调用设备,该设备A为第一设备,也就是调用设备,该目标服务为该应用#1对应的系统服务。For example, as shown in Figure 5, the user can select an application that needs to be transferred on device A, such as application #1, and can select a device that is networked with the device, such as device B. After device A detects the user's operation, it determines the target device and target service. The device B is the second device, which is the target device, or the called device. The device A is the first device, which is the calling device. The target service is the system service corresponding to the application #1.
在另一种可能的实现方式中,该第一设备可以根据硬件协同需求确定目标服务和目标设备。示例 性地,该硬件协同需求可以为该目标服务对应的上层应用的分屏显示,也就是说,该第一设备调用第二设备,使得目标服务对应的应用界面可以部分显示于第一设备,另一部分显示于该目标设备。如图6所示,例如幻灯片的演示,设备A可以通过调用设备B使得设备B上演示幻灯片,设备A上演示幻灯片对应的批注等内容。In another possible implementation, the first device may determine the target service and the target device according to hardware coordination requirements. Example Alternatively, the hardware collaboration requirement can be a split-screen display of the upper-layer application corresponding to the target service. That is to say, the first device calls the second device so that the application interface corresponding to the target service can be partially displayed on the first device. Part of it is displayed on the target device. As shown in Figure 6, for example, during a slide presentation, device A can call device B to cause the slides to be presented on device B, and comments corresponding to the slides to be presented on device A.
S402,第一设备向第二设备发送第一通知信息,相应地,该第二设备接收来自第一设备的第一通知信息。S402: The first device sends the first notification information to the second device, and accordingly, the second device receives the first notification information from the first device.
该第一通知信息包括目标服务的信息,该目标服务的信息为该第一设备需要调用的系统服务的信息,示例性地,该目标服务的信息可以为该目标服务的ID或者该目标服务的名称等,本申请对此不作限定。The first notification information includes information about the target service. The information about the target service is information about the system service that the first device needs to call. For example, the information about the target service can be the ID of the target service or the ID of the target service. Name, etc., this application does not limit this.
该第一通知信息还可以用于指示该第二设备加载该目标服务。The first notification information may also be used to instruct the second device to load the target service.
在一种可能的实现方式中,该第一设备可以通过RPC向该第二设备发送该第一通知信息。In a possible implementation, the first device may send the first notification information to the second device through RPC.
在接收到该第一设备的第一通知信息后,该第二设备加载该目标服务,该第二设备加载该目标服务可以包括步骤S403~S405。After receiving the first notification information from the first device, the second device loads the target service. Loading the target service by the second device may include steps S403 to S405.
S403,第二设备拉起目标服务对应的进程。S403. The second device starts the process corresponding to the target service.
第二设备拉起该目标服务对应的进程也可以为第二设备启动目标服务对应的进程。The second device can pull up the process corresponding to the target service or start the process corresponding to the target service for the second device.
S404,第二设备初始化目标服务。S404, the second device initializes the target service.
第二设备初始化目标服务可以为,第二设备为该目标服务对应的应用提供在第二设备上运行的能力。The second device may initialize the target service so that the second device provides an application corresponding to the target service with the ability to run on the second device.
S405,第二设备注册目标服务。S405, the second device registers the target service.
第二设备注册到该目标服务,并对该目标服务进行管理和维护,使得该目标服务能够在该第二设备上运行。The second device registers with the target service and manages and maintains the target service so that the target service can run on the second device.
S406,第二设备向第一设备发送第一响应信息,相应地,该第一设备接收来自该第二设备的第一响应信息。S406: The second device sends the first response information to the first device, and accordingly, the first device receives the first response information from the second device.
在一种可能的实现方式中,该第一响应信息包括服务句柄,该服务句柄用于该第一设备在该第二设备上调用该目标服务。该服务句柄也就是该目标服务对应的句柄,第一设备可以根据该服务句柄确定该目标服务的位置等信息并进行调用。In a possible implementation, the first response information includes a service handle, and the service handle is used by the first device to call the target service on the second device. The service handle is also the handle corresponding to the target service. The first device can determine the location and other information of the target service based on the service handle and call it.
该第一响应信息还可以用于指示该目标服务的加载结果为加载成功。The first response information may also be used to indicate that the loading result of the target service is successful.
在另一种可能的实现方式中,该第一响应信息用于指示该目标服务在该第二设备上的加载结果为加载失败。在该方案中,第一设备可以重新向该第二设备发送通知信息,指示第二设备重新加载该目标服务,或者,第一设备可以放弃在该第二设备上调用该目标服务。In another possible implementation manner, the first response information is used to indicate that the loading result of the target service on the second device is a loading failure. In this solution, the first device can re-send notification information to the second device to instruct the second device to reload the target service, or the first device can give up calling the target service on the second device.
基于本申请实施例提供的技术方案,可以在分布式系统服务场景下,在调用设备需要调用目标服务时,由目标设备加载目标服务,在开机或单机场景下无需加载系统服务,从而减少开机资源的占用,避免非必要的资源耗费。Based on the technical solutions provided by the embodiments of this application, in the distributed system service scenario, when the calling device needs to call the target service, the target device can load the target service. There is no need to load the system service in the boot or stand-alone scenario, thereby reducing boot resources. occupation to avoid unnecessary consumption of resources.
以上所描述的为系统服务加载的方法,在目标服务调用结束后,目标设备还可以卸载该目标服务,以下介绍本申请实施例提供的一种系统服务卸载的方法,如图7所示,该方法包括以下步骤S701~S705。For the method of loading system services described above, after the target service call is completed, the target device can also uninstall the target service. The following describes a method for uninstalling system services provided by the embodiment of the present application, as shown in Figure 7. The method includes the following steps S701 to S705.
S701,第一设备确定目标服务的调用结束。S701: The first device determines that the invocation of the target service is completed.
该目标服务调用结束具体可以为第一设备和第二设备由组网场景变成非组网场景,或者说单机场景,也就是不需要第二设备时,第一设备也可以独立满足使用需求的场景。第一设备确定目标服务调用结束可以为第一设备检测到目标服务在第一设备上退出运行,也可以为第一设备接收到用户指示,指示该目标服务的调用结束等。The end of the target service call can be specifically when the first device and the second device change from a networking scenario to a non-networking scenario, or a stand-alone scenario, that is, when the second device is not needed, the first device can independently meet the usage requirements. Scenes. The first device determines that the target service call is completed because the first device detects that the target service exits running on the first device, or the first device receives a user instruction indicating that the target service call is completed, etc.
在一种可能的实现方式中,第一设备确定目标服务的调用结束可以为第一设备确定该目标服务的流转结束,或者该目标服务对应的上层应用的流转结束。In a possible implementation manner, the first device determines that the invocation of the target service has ended. The first device determines that the transfer of the target service has ended, or that the transfer of the upper-layer application corresponding to the target service has ended.
在另一种可能的实现方式中,第一设备确定目标服务的调用结束可以为第一设备确定硬件协同任务结束,或者说该目标服务对应的应用的跨设备显示结束。In another possible implementation manner, the first device determines that the invocation of the target service is completed by determining that the hardware collaboration task is completed, or that the cross-device display of the application corresponding to the target service is completed.
S702,第一设备向第二设备发送第二通知信息,相应地,该第二设备接收来自该第一设备的第二通知信息。S702: The first device sends second notification information to the second device, and accordingly, the second device receives the second notification information from the first device.
该第二通知信息用于指示该第一设备对该目标服务的调用结束。The second notification information is used to indicate the end of the first device's call to the target service.
在一种可能的实现方式中,该第二通知信息还可以用于指示第二设备卸载该目标服务。 In a possible implementation, the second notification information can also be used to instruct the second device to uninstall the target service.
S703,第二设备检查该目标服务的引用计数。S703. The second device checks the reference count of the target service.
也就是说,第二设备检查该目标服务是否仍被调用,在有设备调用该目标服务时,该目标服务的引用计数不为0,在没有设备调用该目标服务时,该目标服务的引用计数为0。That is to say, the second device checks whether the target service is still called. When a device calls the target service, the reference count of the target service is not 0. When no device calls the target service, the reference count of the target service is is 0.
在第一设备结束在第二设备上对该目标服务的调用后,仍然可能存在其他的设备在第二设备上调用该目标服务,因此,第二设备需要检查该目标服务的引用计数,确认是否需要卸载该目标服务。After the first device ends calling the target service on the second device, there may still be other devices calling the target service on the second device. Therefore, the second device needs to check the reference count of the target service to confirm whether The target service needs to be uninstalled.
在一种可能的实现方式中,该第二设备检查该目标服务在预设周期内的引用计数,若在预设周期内该目标服务的引用计数为0,该第二设备可以启动对该目标服务的卸载流程。In a possible implementation, the second device checks the reference count of the target service within the preset period. If the reference count of the target service is 0 within the preset period, the second device can start the reference count of the target service. Service uninstallation process.
S704,第二设备释放资源。S704, the second device releases resources.
在一种可能的实现方式中,该第二设备确认该目标服务的引用计数为0,即该目标服务未被调用时,第二设备释放内存、信号量等资源。In a possible implementation manner, the second device confirms that the reference count of the target service is 0, that is, when the target service is not called, the second device releases resources such as memory and semaphore.
S705,第二设备卸载目标服务。S705, the second device uninstalls the target service.
在第二设备释放完系统资源后,该目标服务对应的进程退出,该第二设备卸载该目标服务。After the second device releases the system resources, the process corresponding to the target service exits, and the second device uninstalls the target service.
在另一种可能的实现方式中,该第二设备确定该目标服务的引用计数不为0,也就是说,在第一设备对该目标服务的调用结束后,仍然存在其他设备在第二设备上调用该目标服务,则第二设备可以不卸载该目标服务,以便其他设备在第二设备上调用该目标服务。In another possible implementation, the second device determines that the reference count of the target service is not 0, that is, after the first device completes the call to the target service, there are still other devices on the second device. If the target service is called on the second device, the second device may not uninstall the target service, so that other devices can call the target service on the second device.
基于本申请实施例提供的技术方案,可以在分布式场景下,在调用设备对目标服务的调用结束后,调用设备向被调用设备发送通知信息,被调用设备确定没有其他设备调用该目标服务时,卸载该目标服务,减少系统资源的占用,若确定仍有其他设备调用该目标服务时,保留该目标服务,以便于其他设备能够直接调用该目标服务。Based on the technical solutions provided by the embodiments of this application, in a distributed scenario, after the calling device completes the call to the target service, the calling device sends notification information to the called device, and the called device determines that no other device calls the target service. , uninstall the target service and reduce the occupation of system resources. If it is determined that other devices still call the target service, retain the target service so that other devices can directly call the target service.
上述系统服务的加载和卸载方法可以相结合,共同应用于分布式场景下,调用设备和被调用设备可以根据实际应用需求触发系统服务的加载和卸载,以下以任务流转场景为例,结合第一设备与第二设备中的具体模块,介绍系统服务的加载和卸载方法,如图8所示,该方法包括步骤S801至S816。The above loading and unloading methods of system services can be combined and applied together in distributed scenarios. The calling device and the called device can trigger the loading and unloading of system services according to actual application requirements. The following takes the task flow scenario as an example, combined with the first The specific modules in the device and the second device introduce the loading and unloading method of system services, as shown in Figure 8. The method includes steps S801 to S816.
S801,第一应用或第一服务确定目标设备和目标服务。S801. The first application or first service determines the target device and target service.
该第一服务为第一设备上需要调用目标服务的系统服务,该第一应用为该第一服务对应的上层应用,该第一服务与该目标服务可以为相同的服务,也可以为不同的服务,且该第一服务可以为已经加载完成的系统服务。The first service is a system service on the first device that needs to call the target service. The first application is an upper-layer application corresponding to the first service. The first service and the target service can be the same service or different services. service, and the first service can serve the system that has been loaded.
在一种可能的实现方式中,该第一应用或第一服务可以根据任务流转需求来确定。示例性地,该第一应用或第一服务在检测到用户操作,需要将该第一应用流转到第二设备上运行时,或者需要将第一服务流转到第二设备上加载时,确定该第二设备为目标设备,该第一服务为目标服务。在该实现方式中,该第一服务与目标服务可以为相同的服务。In a possible implementation, the first application or the first service can be determined according to task flow requirements. For example, when the first application or the first service detects a user operation and needs to flow the first application to the second device for running, or when the first service needs to flow to the second device for loading, the first application or the first service determines the first application or the first service. The second device is a target device, and the first service is a target service. In this implementation, the first service and the target service may be the same service.
该任务可以为目标服务,也可以为该目标服务对应的上层应用。该任务流转可以为该目标服务的跨设备调用和加载,或者也可以为该目标服务对应的应用的跨设备运行或使用。作为一个示例,该任务流转可以为用户在手机上使用音乐应用,现需在平板上继续使用该音乐应用,则可触发该音乐应用从手机流转至平板,该音乐应用还可以再从平板流转回手机。The task can serve the target or the upper-layer application corresponding to the target. This task flow can be a cross-device call and load of the target service, or it can be a cross-device running or use of the application corresponding to the target service. As an example, this task flow can be that the user uses a music application on a mobile phone and now needs to continue to use the music application on a tablet, which can trigger the flow of the music application from the mobile phone to the tablet, and the music application can also be transferred back from the tablet. cell phone.
S802,第一设备的第一应用或第一服务向该第一设备的系统服务管理模块指定目标设备和目标服务(load remote system ability)。S802: The first application or first service of the first device specifies the target device and target service (load remote system capability) to the system service management module of the first device.
也就是说,第一应用或第一服务向系统服务管理模块发送目标设备和目标服务的信息,该目标设备的信息可以为该目标设备的名称,或者该目标设备的标识等信息,该目标服务的信息可以为该目标服务的名称,或者该目标服务的标识等信息。That is to say, the first application or the first service sends the information of the target device and the target service to the system service management module. The information of the target device may be the name of the target device, or the identification of the target device, and the target service The information can be the name of the target service, or the identification of the target service and other information.
S803,第一设备的系统服务管理模块向第二设备的系统服务管理模块发送第一通知信息。S803. The system service management module of the first device sends the first notification information to the system service management module of the second device.
该第二设备也就是第一设备确定的目标设备。该步骤S803与步骤S402相类似,区别仅为该第一通知信息可以分别由第一设备的系统服务管理模块发送,由第二设备的系统服务管理模块接收,为避免重复,该步骤的内容不再赘述。The second device is also the target device determined by the first device. Step S803 is similar to step S402. The only difference is that the first notification information can be sent by the system service management module of the first device and received by the system service management module of the second device. To avoid duplication, the content of this step will not be repeated. Again.
S804,第二设备的系统服务管理模块向该第二设备的启动管理模块指定目标服务。S804: The system service management module of the second device specifies the target service to the startup management module of the second device.
该第二设备的系统服务管理模块可以向启动管理模块发送该目标服务的信息,用于启动管理模块拉起该目标服务对应的进程。The system service management module of the second device can send the information of the target service to the startup management module, so that the startup management module can start the process corresponding to the target service.
在一种可能的实现方式中,该第二设备的系统服务管理模块还可以向启动管理模块发送指示信息,指示该启动管理模块拉起该目标服务对应的进程。 In a possible implementation manner, the system service management module of the second device can also send instruction information to the startup management module, instructing the startup management module to pull up the process corresponding to the target service.
S805,第二设备的启动管理模块拉起该目标服务对应的进程,或者说启动目标服务对应的进程。S805: The startup management module of the second device starts the process corresponding to the target service, or starts the process corresponding to the target service.
S806,第二设备的系统服务管理模块初始化目标服务。S806: The system service management module of the second device initializes the target service.
也就是说,第二设备的系统服务管理模块为该目标服务对应的应用提供在第二设备上运行的能力。That is to say, the system service management module of the second device provides the application corresponding to the target service with the ability to run on the second device.
S807,第二设备的系统服务管理模块注册目标服务。S807: The system service management module of the second device registers the target service.
第二设备的系统服务管理模块注册目标服务,并对该目标服务进行管理和维护,使得该目标服务能够在该第二设备上运行。The system service management module of the second device registers the target service, and manages and maintains the target service so that the target service can run on the second device.
S808,第二设备的系统服务管理模块向第一设备的系统服务管理模块发送第一响应信息。S808: The system service management module of the second device sends the first response information to the system service management module of the first device.
该步骤S808与步骤S406相类似,区别仅为该第一响应信息可以分别由第二设备的系统服务管理模块发送,由第一设备的系统服务管理模块接收,为避免重复,该步骤的内容不再赘述。Step S808 is similar to step S406. The only difference is that the first response information can be sent by the system service management module of the second device and received by the system service management module of the first device. To avoid duplication, the content of this step will not be repeated. Again.
S809,任务流转。S809, task transfer.
该任务流转可以为该目标服务在流转前只在第一设备上完成加载,现需在第二设备上也进行加载;或者也可以为该目标服务对应的上层应用由在第一设备上运行切换至在第二设备上运行,该目标服务对应的上层应用也可以由在第二设备上运行切换至在第一设备上运行。This task transfer can be that the target service is only loaded on the first device before the transfer, and now needs to be loaded on the second device as well; or the upper-layer application corresponding to the target service can be switched from running on the first device. To run on the second device, the upper-layer application corresponding to the target service can also be switched from running on the second device to running on the first device.
在该任务流转场景下,该第一服务与该目标服务可以为相同的系统服务。In this task flow scenario, the first service and the target service can serve the same system.
S810,第一设备的第一应用或第一服务通知该第一设备的系统服务管理模块目标服务的调用结束。S810: The first application or first service of the first device notifies the system service management module of the first device that the invocation of the target service ends.
在一种可能的实现方式中,第一设备确定任务流转结束,也就是说第一设备确定目标服务的在第一设备与第二设备之间的流转结束,或者说该目标服务的场景由组网场景变成了非组网场景,或者单机场景,或者不需要任务流转的场景。In a possible implementation, the first device determines that the task transfer is completed, that is to say, the first device determines that the transfer of the target service between the first device and the second device is completed, or that the scenario of the target service is determined by the group. Network scenarios have become non-network scenarios, or stand-alone scenarios, or scenarios that do not require task flow.
S811,第一设备的系统服务管理模块向第二设备的系统服务管理模块发送第二通知信息。S811. The system service management module of the first device sends the second notification information to the system service management module of the second device.
该第一设备的系统服务管理模块确定该第一应用或第一服务对目标服务的调用结束,并检查该第一设备上有无其他应用或服务调用该目标服务,在确定该第一设备上没有应用或服务调用该目标服务后,向该第二设备的系统服务管理模块发送该第二通知信息。The system service management module of the first device determines that the call of the first application or first service to the target service has ended, and checks whether there are other applications or services on the first device that call the target service. After determining that the first device has After no application or service calls the target service, the second notification information is sent to the system service management module of the second device.
该第二通知信息用于指示该第一设备对该目标服务的调用结束。The second notification information is used to indicate the end of the first device's call to the target service.
在一种可能的实现方式中,该第二通知信息还可以用于指示该第二设备卸载该目标服务。In a possible implementation, the second notification information may also be used to instruct the second device to uninstall the target service.
S812,第二设备的系统服务管理模块通知该第二设备的第一进程目标服务的调用结束。S812: The system service management module of the second device notifies the first process of the second device that the invocation of the target service has ended.
在一种可能的实现方式中,该第二设备的系统服务管理模块还可以向该第一进程发送指示信息,指示该第一进程退出运行。In a possible implementation, the system service management module of the second device may also send instruction information to the first process to instruct the first process to exit running.
该第一进程为该目标服务对应的进程。The first process is a process corresponding to the target service.
S813,该第一进程检查引用计数。S813, the first process checks the reference count.
该第一进程检查该目标服务的引用计数是否为0,也就是说,在第一设备结束对该目标服务的调用后,该第一进程检查是否仍有其他设备在该第二设备上调用该目标服务。The first process checks whether the reference count of the target service is 0. That is to say, after the first device ends calling the target service, the first process checks whether there are still other devices calling the target service on the second device. target service.
S814,该第一进程释放资源。S814, the first process releases resources.
在一种可能的实现方式中,第二设备确定该目标服务的引用计数为0,也就是说,第一设备结束了在第二设备上对目标服务的调用后,也不存在其他设备在第二设备上调用目标服务,该第一进程可以释放内存、信号量等资源。In a possible implementation, the second device determines that the reference count of the target service is 0, that is to say, after the first device ends calling the target service on the second device, there is no other device on the second device. When the target service is called on the second device, the first process can release resources such as memory and semaphores.
在第二设备确定该目标服务的引用计数不为0时,则该第一进程无需执行该步骤S814。或者,在第二设备确定该目标服务的引用计数为0时,也可以选择不释放资源,例如,在系统资源充分时,为方便后续的其他设备能够直接调用该目标服务时。When the second device determines that the reference count of the target service is not 0, the first process does not need to perform step S814. Alternatively, when the second device determines that the reference count of the target service is 0, it may choose not to release the resource. For example, when the system resources are sufficient, it is convenient for other subsequent devices to directly call the target service.
S815,该第一进程通知该第二设备的系统服务管理模块卸载或保留该目标服务。S815: The first process notifies the system service management module of the second device to uninstall or retain the target service.
在一种可能的实现方式中,该第一进程确定该目标服务的引用计数为0,则可以通知该第二设备的系统服务管理模块卸载该目标服务。In a possible implementation manner, if the first process determines that the reference count of the target service is 0, it may notify the system service management module of the second device to uninstall the target service.
在另一种可能的实现方式中,该第一进程确定该目标服务的引用计数不为0,则可以通知该第二设备的系统服务管理模块保留该目标服务。In another possible implementation manner, if the first process determines that the reference count of the target service is not 0, it may notify the system service management module of the second device to retain the target service.
S816,该第二设备的系统服务管理模块卸载或保留该目标服务。S816: The system service management module of the second device uninstalls or retains the target service.
在一种可能的实现方式中,该第二设备的系统服务管理模块在该目标服务的引用计数不为0时,保留该目标服务,以便其他设备或其他服务在该第二设备上直接调用该目标服务。In a possible implementation, the system service management module of the second device retains the target service when the reference count of the target service is not 0, so that other devices or other services can directly call the target service on the second device. target service.
在一种可能的实现方式中,该第二设备的系统服务管理模块在该目标服务的引用计数为0时,卸载该目标服务,以减少系统资源的占用。 In a possible implementation manner, the system service management module of the second device uninstalls the target service when the reference count of the target service is 0 to reduce the occupation of system resources.
在一种可能的实现方式中,该第二设备的系统服务管理模块在该目标服务的引用计数为0时,也可以不卸载该目标服务,以便后续的其他设备能够直接调用该目标服务。In a possible implementation, the system service management module of the second device may not uninstall the target service when the reference count of the target service is 0, so that subsequent other devices can directly call the target service.
通过本申请提供的实施例,针对分布式调度服务时,在开机或单机场景下可以不用加载目标服务,而是在多台设备组网后需要进行跨设备流转时,由被调用设备加载该目标服务,从而减少开机内存的占用,节约系统资源;在任务流转结束后,由被调用设备根据实际需求自行决策是否需要卸载该目标服务,卸载该目标服务则能够节约系统资源,保留该目标服务则能够便于下次任务流转时直接调用该目标服务。Through the embodiments provided by this application, for distributed scheduling services, it is not necessary to load the target service in a boot or stand-alone scenario. Instead, when multiple devices are networked and need to be transferred across devices, the called device loads the target. service, thereby reducing the boot memory usage and saving system resources; after the task transfer is completed, the called device will decide whether to uninstall the target service based on actual needs. Uninstalling the target service can save system resources, and retaining the target service will This can facilitate direct calling of the target service during the next task transfer.
在一种可能的实现方式中,第一设备从第二设备上调用目标服务后,又需从第三设备上调用该目标服务时,例如该目标服务从第一设备流转至第二设备后,又需流转至第三设备时,可以由第二设备在第三设备上调用该目标服务。该方法具体可以由第二设备执行上述第一设备执行的动作,由第三设备执行上述第二设备执行的动作。In a possible implementation, after the first device calls the target service from the second device, when it needs to call the target service from the third device, for example, after the target service is transferred from the first device to the second device, When it needs to be transferred to a third device, the second device can call the target service on the third device. Specifically, in this method, the second device may perform the actions performed by the first device, and the third device may perform the actions performed by the second device.
上文结合图4至图8介绍了本申请所提供的系统服务的调用方法,以下结合图9和图10介绍能够支持以上方法实现的装置。The calling method of the system service provided by this application has been introduced above with reference to Figures 4 to 8. The device that can support the implementation of the above method will be introduced below with reference to Figures 9 and 10.
图9是根据本申请方法实施例提供的一种通信装置的结构框图,该通信装置可具备上述方法实施例中第一设备或第二设备的功能,并用于执行上述方法实施例中由第一设备或第二设备执行的步骤。Figure 9 is a structural block diagram of a communication device provided according to a method embodiment of the present application. The communication device can have the functions of the first device or the second device in the above method embodiment, and is used to execute the first device in the above method embodiment. The steps performed by the device or a second device.
在一种可能的实现方式中,如图9所示的通信装置900可作为上述方法实施例所涉及的第一设备,并执行上述方法实施例中由第一设备执行的步骤。In a possible implementation, the communication device 900 shown in Figure 9 can serve as the first device involved in the above method embodiment, and perform the steps performed by the first device in the above method embodiment.
如图9所示,该通信装置可以包括接收模块910和发送模块920。As shown in Figure 9, the communication device may include a receiving module 910 and a sending module 920.
接收模块910可用于支持通信装置900接收信息,例如执行图4至图8中的S406、S808等由第一设备执行的接收动作。The receiving module 910 may be used to support the communication device 900 in receiving information, for example, performing S406, S808 and other receiving actions performed by the first device in FIGS. 4 to 8 .
发送模块920可用于支持通信装置900发送信息,例如执行图4至图8中的S402、S702、S803和S811等由第一设备执行的发送动作。The sending module 920 may be used to support the communication device 900 in sending information, for example, performing S402, S702, S803, S811 and other sending actions performed by the first device in FIGS. 4 to 8 .
该接收模块910和发送模块920还可以用于执行第一设备的系统服务管理模块和第一应用或第一服务之间执行的接收或发送动作,例如图8中的步骤S802和S810。The receiving module 910 and the sending module 920 may also be used to perform receiving or sending actions performed between the system service management module of the first device and the first application or the first service, such as steps S802 and S810 in FIG. 8 .
可选地,该通信装置还可以包括处理模块930,该处理模块930与发送模块920和接收模块910耦合,可用于支持通信装置900执行上述方法实施例中的处理动作,例如执行图4至图6中的S401、S701、S801和S809等由第一设备执行的处理动作。Optionally, the communication device may also include a processing module 930, which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S401, S701, S801 and S809 in 6 are processing actions performed by the first device.
可选地,通信装置900还可以包括存储模块940,用于存储通信装置900的程序代码和数据。Optionally, the communication device 900 may also include a storage module 940 for storing program codes and data of the communication device 900 .
在另一种可能的实现方式中,如图9所示的通信装置900可作为上述方法实施例所涉及的第二设备,并执行上述方法实施例中由第二设备执行的步骤。In another possible implementation, the communication device 900 shown in Figure 9 can serve as the second device involved in the above method embodiment, and perform the steps performed by the second device in the above method embodiment.
如图9所示,该通信装置900可包括发送模块920和接收模块910。As shown in FIG. 9 , the communication device 900 may include a sending module 920 and a receiving module 910 .
接收模块910可用于支持通信装置900接收信息,例如执行图4至图8中的S402、S702、S803和S811等由第二设备执行的接收动作。The receiving module 910 may be used to support the communication device 900 in receiving information, for example, performing S402, S702, S803 and S811 in FIGS. 4 to 8 and other receiving actions performed by the second device.
发送模块920可用于支持通信装置900发送信息,例如执行图4至图8中的S406和S808等由第二设备执行的发送动作。The sending module 920 may be used to support the communication device 900 in sending information, for example, performing sending actions performed by the second device such as S406 and S808 in FIGS. 4 to 8 .
该接收模块910和发送模块920还可以用于执行第二设备的系统服务管理模块、启动管理模块和第一进程之间的接收和发送动作,例如图8中的步骤S804、S812和S815等。The receiving module 910 and the sending module 920 can also be used to perform receiving and sending actions between the system service management module, startup management module and the first process of the second device, such as steps S804, S812 and S815 in Figure 8.
可选地,该通信装置还可以包括处理模块930,该处理模块930与发送模块920和接收模块910耦合,可用于支持通信装置900执行上述方法实施例中的处理动作,例如执行图4至图8中的S403、S404、S405、S703、S704、S705、S705、S806、S807、S813、S814和S816等由第二设备执行的处理动作。Optionally, the communication device may also include a processing module 930, which is coupled to the sending module 920 and the receiving module 910, and may be used to support the communication device 900 in performing the processing actions in the above method embodiments, for example, executing the steps shown in FIG. 4 to FIG. S403, S404, S405, S703, S704, S705, S705, S806, S807, S813, S814 and S816 in 8 are the processing actions performed by the second device.
可选地,通信装置900还可以包括存储模块940,用于存储通信装置900的程序代码和数据。Optionally, the communication device 900 may also include a storage module 940 for storing program codes and data of the communication device 900 .
图10是本申请实施例提供的通信设备1000的示意性框图。如图所示,该通信设备1000包括:至少一个处理器1010和收发器1020。该处理器1010与存储器1030耦合,用于执行存储器1030中存储的指令,以控制收发器1020发送信号和/或接收信号。Figure 10 is a schematic block diagram of a communication device 1000 provided by an embodiment of the present application. As shown in the figure, the communication device 1000 includes: at least one processor 1010 and a transceiver 1020. The processor 1010 is coupled to the memory 1030 and is used to execute instructions stored in the memory 1030 to control the transceiver 1020 to send signals and/or receive signals.
可选地,该通信设备1000还包括存储器1030,用于存储指令。Optionally, the communication device 1000 further includes a memory 1030 for storing instructions.
在一些实施例中,上述处理器1010和存储器1030可以合成一个处理装置,处理器1010用于执行存储器1030中存储的程序代码来实现上述功能。具体实现时,该存储器1030也可以集成在处理器1010 中,或者独立于处理器1010。In some embodiments, the above-mentioned processor 1010 and the memory 1030 can be combined into one processing device, and the processor 1010 is used to execute the program code stored in the memory 1030 to implement the above functions. During specific implementation, the memory 1030 can also be integrated into the processor 1010 in, or independently of processor 1010.
在一些实施例中,收发器1020可以包括接收器(或者称,接收机)和发射器(或者称,发射机)。In some embodiments, transceiver 1020 may include a receiver and a transmitter.
收发器1020还可以进一步包括天线,天线的数量可以为一个或多个。收发器1020有可以是通信接口或者接口电路。The transceiver 1020 may further include an antenna, and the number of antennas may be one or more. The transceiver 1020 may be a communication interface or an interface circuit.
当该通信设备1000为芯片时,该芯片包括收发模块和处理模块。其中,收发模块可以是输入输出电路或通信接口;处理模块可以为该芯片上集成的处理器或者微处理器或者集成电路。When the communication device 1000 is a chip, the chip includes a transceiver module and a processing module. The transceiver module may be an input-output circuit or a communication interface; the processing module may be a processor, microprocessor, or integrated circuit integrated on the chip.
当上述通信装置为应用于第一设备/第二设备的芯片时,该第一设备/第二设备芯片实现上述方法实施例中第一设备/第二设备的功能。该第一设备/第二设备芯片从第一设备/第二设备中的其它模块(如射频模块或天线)接收信息,该信息是第二设备/第一设备、或者其他设备发送给该第一设备/第二设备的;或者,该第一设备/第二设备芯片向第一设备/第二设备中的其它模块(如射频模块或天线)输出信息,该信息是第一设备/第二设备发送给第二设备/第一设备、或者其他设备的。When the above communication device is a chip applied to the first device/second device, the first device/second device chip implements the functions of the first device/second device in the above method embodiment. The first device/second device chip receives information from other modules (such as radio frequency modules or antennas) in the first device/second device, and the information is sent to the first device by the second device/first device or other devices. device/second device; or, the first device/second device chip outputs information to other modules (such as radio frequency modules or antennas) in the first device/second device, and the information is the first device/second device Sent to the second device/first device, or other devices.
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序或指令,该计算机程序或指令被计算机(例如,处理器)执行,以实现本申请实施例中由任意装置执行的任意一种方法的部分或全部步骤。Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores computer programs or instructions. The computer programs or instructions are executed by a computer (for example, a processor) to implement the steps in the embodiments of the present application. Some or all of the steps of any method performed by any device.
本申请实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得本申请实施例中由任意装置执行的任意一种方法的部分或全部步骤被执行。Embodiments of the present application also provide a computer program product containing instructions that, when run on a computer, cause some or all of the steps of any method executed by any device in the embodiments of the present application to be executed.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。 The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (22)

  1. 一种调用系统服务的方法,其特征在于,所述方法包括:A method of calling system services, characterized in that the method includes:
    第一设备向第二设备发送第一通知信息,所述第一通知信息包括目标服务的信息,所述目标服务的信息为所述第一设备需要调用的系统服务的信息,所述第一通知信息用于指示所述第二设备加载所述目标服务;The first device sends first notification information to the second device. The first notification information includes information about a target service. The information about the target service is information about a system service that the first device needs to call. The first notification information The information is used to instruct the second device to load the target service;
    所述第一设备接收来自第二设备的第一响应信息,所述第一响应信息包括所述目标服务的服务句柄,所述服务句柄用于所述第一设备在所述第二设备上调用所述目标服务。The first device receives first response information from the second device. The first response information includes a service handle of the target service. The service handle is used by the first device to call on the second device. The target service.
  2. 根据权利要求1所述的方法,其特征在于,在所述第一设备向第二设备发送第一通知信息之前,所述方法还包括:The method according to claim 1, characterized in that, before the first device sends the first notification information to the second device, the method further includes:
    所述第一设备确定目标设备和所述目标服务,所述目标设备为需要加载所述目标服务的设备,The first device determines a target device and the target service, and the target device is a device that needs to load the target service,
    其中,所述第二设备为所述目标设备。Wherein, the second device is the target device.
  3. 根据权利要求2所述的方法,其特征在于,所述第一设备确定目标设备和所述目标服务,包括:The method of claim 2, wherein the first device determines the target device and the target service, including:
    所述第一设备根据任务流转需求确定所述目标设备和所述目标服务。The first device determines the target device and the target service according to task flow requirements.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, characterized in that the method further includes:
    所述第一设备向所述第二设备发送第二通知信息,所述第二通知信息用于指示所述第一设备对所述目标服务的调用结束。The first device sends second notification information to the second device, where the second notification information is used to indicate the end of the first device's call to the target service.
  5. 根据权利要求4所述的方法,其特征在于,在所述第一设备向所述第二设备发送第二通知信息之前,所述方法还包括:The method according to claim 4, characterized in that, before the first device sends the second notification information to the second device, the method further includes:
    所述第一设备确定所述目标服务的流转结束。The first device determines that the transfer of the target service is completed.
  6. 一种调用系统服务的方法,其特征在于,所述方法包括:A method of calling system services, characterized in that the method includes:
    第二设备接收来自第一设备的第一通知信息,所述第一通知信息包括目标服务的信息,所述目标服务的信息为所述第一设备需要调用的系统服务的信息,所述第一通知信息用于指示所述第二设备加载所述目标服务;The second device receives first notification information from the first device. The first notification information includes information about a target service. The information about the target service is information about a system service that the first device needs to call. The first device The notification information is used to instruct the second device to load the target service;
    所述第二设备加载所述目标服务;The second device loads the target service;
    所述第二设备向所述第一设备发送第一响应信息,所述第一响应信息包括所述目标服务的服务句柄,所述服务句柄用于所述第一设备在所述第二设备上调用所述目标服务。The second device sends first response information to the first device. The first response information includes a service handle of the target service. The service handle is used by the first device on the second device. Call the target service.
  7. 根据权利要求6所述的方法,其特征在于,所述第二设备加载所述目标服务,包括:The method of claim 6, wherein the second device loads the target service, including:
    所述第二设备拉起所述目标服务对应的进程;The second device pulls up the process corresponding to the target service;
    所述第二设备初始化所述目标服务;The second device initializes the target service;
    所述第二设备注册所述目标服务。The second device registers with the target service.
  8. 根据权利要求6或7所述的方法,其特征在于,所述方法还包括:The method according to claim 6 or 7, characterized in that, the method further includes:
    所述第二设备接收所述第一设备的第二通知信息,所述第二通知信息用于指示所述第一设备对所述目标服务的调用结束。The second device receives second notification information from the first device, and the second notification information is used to indicate that the first device's call to the target service has ended.
  9. 根据权利要求6至8中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 6 to 8, characterized in that the method further includes:
    所述第二设备检查所述目标服务的引用计数,确定是否卸载所述目标服务。The second device checks the reference count of the target service and determines whether to uninstall the target service.
  10. 一种调用系统服务的装置,应用于第一设备,其特征在于,包括:A device for calling system services, applied to a first device, characterized by including:
    发送模块,用于向第二设备发送第一通知信息,所述第一通知信息包括目标服务的信息,所述目标服务的信息为所述第一设备需要调用的系统服务的信息,所述第一通知信息用于指示所述第二设备加载所述目标服务;A sending module, configured to send first notification information to the second device, where the first notification information includes information about a target service, and the information about the target service is information about a system service that the first device needs to call. A notification message is used to instruct the second device to load the target service;
    接收模块,用于接收来自第二设备的第一响应信息,所述第一响应信息包括所述目标服务的服务句柄,所述服务句柄用于所述第一设备在所述第二设备上调用所述目标服务。A receiving module, configured to receive first response information from a second device, where the first response information includes a service handle of the target service, and the service handle is used by the first device to call on the second device The target service.
  11. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The device according to claim 10, characterized in that the device further includes:
    处理模块,用于确定目标设备和所述目标服务,所述目标设备为需要加载所述目标服务的设备。A processing module, configured to determine a target device and the target service, where the target device is a device that needs to load the target service.
  12. 根据权利要求11所述的装置,其特征在于,所述处理模块具体用于,根据任务流转需求确定所述目标设备和所述目标服务。The apparatus according to claim 11, wherein the processing module is specifically configured to determine the target device and the target service according to task flow requirements.
  13. 根据权利要求10至12中任一项所述的装置,其特征在于,所述发送模块还用于,向所述第二 设备发送第二通知信息,所述第二通知信息用于指示所述第一设备对所述目标服务的调用结束。The device according to any one of claims 10 to 12, characterized in that the sending module is further configured to send a message to the second The device sends second notification information, where the second notification information is used to indicate the end of the first device's call to the target service.
  14. 根据权利要求10至13中任一项所述的装置,其特征在于,所述处理模块还用于,确定所述目标服务的流转结束。The device according to any one of claims 10 to 13, wherein the processing module is further configured to determine the end of the transfer of the target service.
  15. 一种调用系统服务的装置,应用于第二设备,其特征在于,包括:A device for calling system services, applied to a second device, characterized by including:
    接收模块,用于接收来自第一设备的第一通知信息,所述第一通知信息包括目标服务的信息,所述目标服务的信息为所述第一设备需要调用的系统服务的信息,所述第一通知信息用于指示所述第二设备加载所述目标服务;A receiving module configured to receive first notification information from the first device, where the first notification information includes information about a target service, and the information about the target service is information about a system service that the first device needs to call, and the The first notification information is used to instruct the second device to load the target service;
    处理模块,用于加载所述目标服务;A processing module used to load the target service;
    发送模块,用于发送第一响应信息,所述第一响应信息包括所述目标服务的服务句柄,所述服务句柄用于所述第一设备在所述第二设备上调用所述目标服务。A sending module, configured to send first response information, where the first response information includes a service handle of the target service, and the service handle is used by the first device to call the target service on the second device.
  16. 根据权利要求15所述的装置,其特征在于,所述处理模块具体用于:The device according to claim 15, characterized in that the processing module is specifically used for:
    拉起所述目标服务对应的进程;Pull up the process corresponding to the target service;
    初始化所述目标服务;Initialize the target service;
    注册所述目标服务。Register the target service.
  17. 根据权利要求15或16所述的装置,其特征在于,所述接收模块还用于,接收第二通知信息,所述第二通知信息用于指示对所述目标服务的调用结束。The device according to claim 15 or 16, characterized in that the receiving module is further configured to receive second notification information, and the second notification information is used to indicate the end of calling the target service.
  18. 根据权利要求15至17中任一项所述的装置,其特征在于,所述处理模块还用于,检查所述目标服务的引用计数,确定是否卸载所述目标服务。The device according to any one of claims 15 to 17, wherein the processing module is further configured to check the reference count of the target service and determine whether to uninstall the target service.
  19. 一种电子设备,其特征在于,所述电子设备包括:处理器,用于从存储器中调用并运行计算机程序,使得所述电子设备执行如权利要求1至5中任一项所述的方法;或者执行如权利要求6至9中任一项所述的方法。An electronic device, characterized in that the electronic device includes: a processor for calling and running a computer program from a memory, so that the electronic device executes the method according to any one of claims 1 to 5; Or perform a method as claimed in any one of claims 6 to 9.
  20. 根据权利要求19所述的电子设备,其特征在于,所述电子设备还包括:所述存储器和/或通信接口,所述存储器用于存储所述计算机程序,所述通信接口用于收发数据/信令。The electronic device according to claim 19, characterized in that the electronic device further includes: the memory and/or a communication interface, the memory is used to store the computer program, and the communication interface is used to send and receive data/ signaling.
  21. 一种计算机程序存储介质,其特征在于,所述计算机可读介质存储有程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如权利要求1至5中任一项所述的方法,或者,如权利要求6至9中任一项所述的方法。A computer program storage medium, characterized in that the computer-readable medium stores program code. When the computer program code is run on a computer, it causes the computer to execute the method described in any one of claims 1 to 5. Method, or the method according to any one of claims 6 to 9.
  22. 一种芯片系统,其特征在于,所述芯片系统包括至少一个处理器,当程序指令在所述至少一个处理器中执行时,使得如权利要求1至5中任一项所述的方法,或者,如权利要求6至9中任一项所述的方法得以实现。 A chip system, characterized in that the chip system includes at least one processor, and when the program instructions are executed in the at least one processor, the method according to any one of claims 1 to 5 is performed, or , the method according to any one of claims 6 to 9 is implemented.
PCT/CN2023/108459 2022-07-22 2023-07-20 Method and apparatus for calling system service WO2024017351A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210871045.0A CN117472606A (en) 2022-07-22 2022-07-22 Method and device for calling system service
CN202210871045.0 2022-07-22

Publications (1)

Publication Number Publication Date
WO2024017351A1 true WO2024017351A1 (en) 2024-01-25

Family

ID=89617186

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/108459 WO2024017351A1 (en) 2022-07-22 2023-07-20 Method and apparatus for calling system service

Country Status (2)

Country Link
CN (1) CN117472606A (en)
WO (1) WO2024017351A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170359431A1 (en) * 2016-06-12 2017-12-14 Apple Inc. Notification Extensions for Applications
CN113329047A (en) * 2020-02-29 2021-08-31 华为技术有限公司 Distributed service scheduling method and related device
CN114222003A (en) * 2021-12-06 2022-03-22 Oppo广东移动通信有限公司 Service calling method, system, device, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170359431A1 (en) * 2016-06-12 2017-12-14 Apple Inc. Notification Extensions for Applications
CN113329047A (en) * 2020-02-29 2021-08-31 华为技术有限公司 Distributed service scheduling method and related device
CN114222003A (en) * 2021-12-06 2022-03-22 Oppo广东移动通信有限公司 Service calling method, system, device, equipment and storage medium

Also Published As

Publication number Publication date
CN117472606A (en) 2024-01-30

Similar Documents

Publication Publication Date Title
WO2020253758A1 (en) User interface layout method and electronic device
WO2020062294A1 (en) Display control method for system navigation bar, graphical user interface, and electronic device
WO2021063237A1 (en) Control method for electronic device, and electronic device
WO2021036770A1 (en) Split-screen processing method and terminal device
CN111182614B (en) Method and device for establishing network connection and electronic equipment
WO2021159746A1 (en) File sharing method and system, and related device
WO2021052200A1 (en) Device capability scheduling method and electronic device
WO2021223539A1 (en) Radio frequency resource allocation method and apparatus
WO2021078032A1 (en) User interface display method and electronic device
WO2021051982A1 (en) Method for calling hardware interface and electronic device
WO2021052311A1 (en) Method for displaying user interface according to color of rear case, and electronic device
WO2021254438A1 (en) Drive control method and related device
CN110830645B (en) Operation method, electronic equipment and computer storage medium
WO2021218429A1 (en) Method for managing application window, and terminal device and computer-readable storage medium
US20230236714A1 (en) Cross-Device Desktop Management Method, First Electronic Device, and Second Electronic Device
WO2021027727A1 (en) Method for information transmission and electronic device
WO2024032124A1 (en) Method for folding and unfolding scroll screen and related product
CN112437341B (en) Video stream processing method and electronic equipment
CN115941674B (en) Multi-device application connection method, device and storage medium
CN111381996A (en) Memory exception handling method and device
EP4224298A1 (en) Screen display method and electronic device
WO2024017351A1 (en) Method and apparatus for calling system service
WO2023001033A1 (en) Method for image startup, method for generating image, and electronic device
WO2024109198A1 (en) Window adjustment method and related apparatus
CN113542315B (en) Communication framework, business event processing method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23842413

Country of ref document: EP

Kind code of ref document: A1