Method, apparatus, device and system for sharing camera

CN116916146BActive Publication Date: 2026-11-03CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211351245.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2026-11-03
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

Security applications on existing devices have been occupying camera resources for a long time, causing other applications to be unable to use or simultaneously use camera resources.

Method used

By occupying the camera's primary application process for an extended period, image acquisition requests from multiple secondary application processes are collected across processes, establishing an image acquisition channel. This channel is then used to fill the image storage areas of multiple application processes with image data, thereby enabling the sharing of camera data.

Benefits of technology

Without modifying the Android system's camera services and architecture, it enables camera resource sharing, improving usability and rapid deployment capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116916146B_ABST
    Figure CN116916146B_ABST
Patent Text Reader

Abstract

The application provides a method for sharing a camera, comprising: obtaining image acquisition information of at least one second application process by a first application process which long-term occupies the camera, wherein the image acquisition information at least comprises an image storage address; establishing a first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process; and sending a first image acquisition request of the first application process and a second image acquisition request of the second application process to a camera service layer based on the first image acquisition channel, so that the camera service layer sends image data collected by the camera to an image storage area of the first application process and an image storage area of the second application process based on the first image acquisition request and the second image acquisition request. Meanwhile, the application also provides a device and a system for sharing the camera, which can realize camera sharing among multiple application processes without modifying the camera service and architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to camera sharing technology, specifically to a method, apparatus, device, and system for sharing cameras. Background Technology

[0002] Currently, for some devices with security functions, the security applications on these devices require long-term use of camera resources, which prevents other applications on the device (such as video call applications) from using camera resources, or from using camera resources simultaneously with the security applications. Summary of the Invention

[0003] To address the existing technical problems, the technical solution of this application is implemented as follows:

[0004] According to one aspect of this application, a method for sharing a camera is provided, applied to a first application of long-term camera occupancy, the method comprising:

[0005] Image acquisition information of at least one second application process is obtained through the first application process, and the image acquisition information includes at least an image storage address;

[0006] A first image acquisition channel is established based on the image storage address of the first application process and the image storage address of the second application process;

[0007] Based on the first image acquisition channel, the first image acquisition request of the first application process and the second image acquisition request of the second application process are sent to the camera service layer, so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0008] In the above scheme, obtaining image acquisition information from at least one second application process through the first application process includes:

[0009] The first application process collects image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface, and the image acquisition requests carry the image acquisition information.

[0010] In the above scheme, before obtaining image acquisition information from at least one second application process through the first application process, the method further includes:

[0011] The first application process receives at least one first service call request sent by a second application process for the camera sharing service interface.

[0012] In response to the first service call request, a communication connection is established with the second application process through the camera sharing service interface.

[0013] In the above scheme, the image acquisition information also includes template information for image acquisition;

[0014] Before sending the first image acquisition request of the first application process and the second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel, the method further includes:

[0015] Based on the template information and the image storage address of the second application process, a second image acquisition request is generated for the second application process.

[0016] In the above scheme, before establishing the first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process, the method further includes:

[0017] Release the second image acquisition channel established between the first application process and the camera service layer. The second image acquisition channel is characterized as being used only by the first application process.

[0018] The method in the above scheme further includes:

[0019] The first application process deserializes the target image storage address sent by the second application process to obtain the image storage address of the second application process.

[0020] According to a second aspect of this application, a method for sharing a camera is provided, the method comprising:

[0021] The second application process sends a first service call request to the first application process that has been occupying the camera for a long time.

[0022] If the first service call request is successfully responded to, a communication connection is established between the first application process and the second application.

[0023] Based on the communication connection, image acquisition information is sent to the first application process, and the image acquisition information includes at least image storage address and template information;

[0024] Image data captured by the camera is obtained through the image storage area corresponding to the image storage address; wherein, the image storage area is allocated by the camera service layer from the image cache synthesis service layer; the image data is sent by the camera service layer to the image storage area based on the image acquisition request sent by the first application process, and the image acquisition request is generated by the first application process according to the image storage address and the template information.

[0025] According to a third aspect of this application, a device for sharing a camera is provided, the device comprising:

[0026] The acquisition unit is used to acquire image acquisition information of at least one second application process through a first application process that occupies the camera for a long time, wherein the image acquisition information includes at least an image storage address;

[0027] An establishment unit is used to establish a first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process;

[0028] The sending unit is configured to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel; so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0029] According to a fourth aspect of this application, a system for sharing a camera is provided, the system comprising:

[0030] The camera sharing service layer is set up in the first application process that occupies the camera for a long time. It is used to collect image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface. The image acquisition request carries the image storage address.

[0031] The first application is used to establish a first image acquisition channel based on the image storage address of the second application process and the image storage address of the first application process; and to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel.

[0032] At least one second application is configured to establish a communication connection with the camera sharing service layer through the camera sharing service interface, send an image acquisition request to the camera sharing service layer based on the communication connection, and obtain the image data acquired by the camera from the image storage area corresponding to the image storage address of the second application process through the first application process;

[0033] The camera service layer is used to send the image data captured by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0034] According to a fifth aspect of this application, an electronic device for sharing a camera is provided, the electronic device comprising:

[0035] The processor and the memory used to store computer programs that can run on the processor.

[0036] When the processor runs the computer program, it executes the method steps in any of the above-described methods for sharing a camera.

[0037] The camera sharing method, apparatus, device, and system provided in this invention collect image acquisition requests from multiple second application processes in a cross-process manner by having a first application process that permanently occupies the camera. An image acquisition channel is then established between the first application process and the multiple second application processes, and image data is filled into the image storage areas of the multiple application processes based on this image acquisition channel. Thus, camera data sharing can be achieved simply by having an application process that permanently occupies the camera, without requiring system customization. This facilitates the rapid deployment of camera sharing capabilities and enhances practicality. Attached Figure Description

[0038] Figure 1 This is a schematic diagram illustrating the method for sharing a camera in this application. Figure 1 ;

[0039] Figure 2 This is a schematic diagram illustrating the method for sharing a camera in this application. Figure 2 ;

[0040] Figure 3 This is a schematic diagram illustrating the method for sharing a camera in this application. Figure 3 ;

[0041] Figure 4 This is a schematic diagram of the device structure for sharing a camera in this application;

[0042] Figure 5 This is a schematic diagram of the system composition of the shared camera in this application;

[0043] Figure 6 This is a schematic diagram of the structural composition of the electronic device in this application. Detailed Implementation

[0044] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0045] Figure 1 This is a schematic diagram illustrating the implementation of the method for sharing a camera in this application. Figure 1This method is applied to the primary application of cameras in electronic devices that require prolonged use. The method includes:

[0046] Step 101: Obtain image acquisition information from at least one second application process through the first application process, wherein the image acquisition information includes at least an image storage address;

[0047] Step 102: Establish a first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process;

[0048] Step 103: Based on the first image acquisition channel, send the first image acquisition request of the first application process and the second image acquisition request of the second application to the camera service layer, so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0049] In this application, the electronic device is an electronic device with an Android operating system and image acquisition capabilities, and the electronic device has at least one first application that needs to occupy the camera for an extended period of time, such as a security application or a video recording application. When the electronic device has at least one second application, the electronic device can obtain the image acquisition information of the at least one second application through the process of the first application. Here, the second application can be a video call application or a camera application, i.e., an application that does not occupy the camera for an extended period of time.

[0050] In this application, the first application process may have a camera sharing service. The electronic device can receive a first service call request sent by at least one second application process for the camera sharing service through the first application process. The first application process responds to the first service call request to establish a communication connection with the second application process through the camera sharing service interface of the camera sharing service.

[0051] In this application, the electronic device can collect image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface in the first application process, wherein the image acquisition request may carry the image acquisition information.

[0052] Here, the image acquisition information includes, but is not limited to, the image storage address (Surface object) of the second application process and template data. The image storage address allows allocation of an image storage area for the second application process, and the template data determines the type of image acquisition request for the second application process. For example, the template data could be: TEMPLATE_PREVIEW (preview template) or TEMPLATE_STILL_CAPTURE (photo template). The preview template corresponds to a series of consecutive image acquisition requests, while the photo template corresponds to a single image acquisition request.

[0053] In this application, after the electronic device obtains image acquisition information from the second application process through the first application process, it can re-establish an image acquisition channel (referred to as the first image acquisition channel) based on the image storage address carried in the image acquisition information and the image storage address of the first application process. This releases the image acquisition channel (referred to as the second image acquisition channel) established between the first application process and the camera service layer. The second image acquisition channel is designed for operation only by the first application process. This is because the first application in the electronic device is in a state of long-term camera occupancy. When the second application does not access the camera, the second image acquisition channel established between the first application and the camera service layer is only for the use of the first application process. Other application processes cannot access the camera through this second image acquisition channel. Therefore, when the second application accesses the camera, it is necessary to re-establish an image acquisition channel through the first application process that allows multiple application processes to access the camera simultaneously. Thus, the first image acquisition channel enables multiple application processes to use the camera simultaneously.

[0054] In this application, after the electronic device establishes a first image acquisition channel that can be used by multiple application processes through the first application process, the first application process can also generate an image acquisition request (referred to as a second image acquisition request) for the second application process based on the image storage address and template data of the second application process. Then, the first application process sends the first image acquisition request of the first application process and the second image acquisition request of the second application process together to the camera service layer through the first image acquisition channel.

[0055] After receiving the first and second image capture requests, the camera service layer prioritizes the received requests according to the Android operating system's sorting method. Based on the sorting result, it retrieves a target image capture request (CaptureRequest) from the request queue (this could be from the first application or the second application) and sends it to the camera device. The camera service layer then requests an image storage area from the image buffer compositing service layer (SurfaceFlinger) based on the GraphicBufferProducer object carried in the CaptureRequest's Surface. Simultaneously, it establishes a mapping between the second application's image storage address and this image storage area, ensuring that the image storage area is mapped to the second application process. This allows the second application to obtain the image data captured by the camera from this image storage area.

[0056] The camera device retrieves the target image storage area (GraphicBuffer) corresponding to the target image storage address (Surface object) carried in the target image acquisition request, and then sends the currently acquired image data to the target image storage area (GraphicBuffer) through the camera device. Here, the target image storage area includes the image storage area corresponding to the image storage address of the first application process and the image storage area corresponding to the image storage address of the second application process. In this way, the second application can achieve camera sharing through the first application process without modifying the Android system's camera service and camera architecture.

[0057] Figure 2 This is a schematic diagram illustrating the method for sharing a camera in this application. Figure 2 ,like Figure 2 As shown, the system comprises five parts: a first application 21, a second application 22, a camera sharing service 23, a camera service 24, and an image buffering and compositing service 25. The first application 21, for example, is a security application (App) that requires long-term camera access. The second application 22 establishes a connection with the camera sharing service 23 within the first application 21 process via AIDL (Android Interface Definition Language). The process of the second application 22 sends an image storage address (Surface) and an image capture (CaptureRequest) template to the process of the first application 21. The process of the first application 21 creates an image capture request based on the parameters of the Surface and CaptureRequest template passed by the process of the second application 22.

[0058] (CaptureRequest), and send the CaptureRequest to the camera service 24.

[0059] (CameraService) The CameraService notifies the camera to render the image storage address object (Surface object) of the second application process 22.

[0060] The detailed technical process of this method includes:

[0061] 1) The process of the first application 21 obtains the camera manager through the service interface;

[0062] Here, after the first application process starts, it uses the standard Camera API V2 to access the camera through the Camera Framework.

[0063] 2) The process of the first application 21 opens the camera device through the camera manager;

[0064] 3) The first application 21's process creates an image acquisition channel;

[0065] Here, after the process of the first application 21 obtains the CameraDevice of the specified camera, it creates an image acquisition channel (Capture Session).

[0066] 4) The first application 21 sets the image storage address (Surface) A of the first application 21 process;

[0067] 5) The process of the first application 21 generates an image acquisition request A based on the image storage address A;

[0068] 6) The process of the first application 21 sends an image acquisition request A to the camera service 24;

[0069] Here, since the first application needs to occupy the camera for a long time, the camera service will continuously add the first application process's image capture request A (CaptureRequestA) to the camera service queue.

[0070] 7) Camera driver 26 retrieves an image acquisition request A from the request queue;

[0071] Here, the most recently entered image acquisition request is usually retrieved from the request queue, meaning the camera service uses a first-in, first-out (FIFO) strategy.

[0072] 8) The camera driver 26 drives the camera hardware 27 to fill the image data captured by the camera into the image storage area A corresponding to the image acquisition request A.

[0073] The above describes the specific process for using the camera only in the first application. The following section introduces the camera sharing process for the second application.

[0074] 9) The process of the second application 22 calls the camera sharing service 23 in the process of the first application 21 in a cross-process manner through the service interface.

[0075] Here, the service interface can be an AIDL interface. The camera sharing service 23 is started when the process of the first application 21 starts. When the process of the second application 22 opens the specified camera through the camera manager, if the camera opens successfully, it means that the camera is not occupied and can be used normally through the standard camera application interface of the Android system; if the camera fails to open, it means that the camera is occupied, and a connection is established with the camera sharing service (ShareCameraService) 23 of the first application 21 process through the AIDL interface.

[0076] 10) Camera sharing service 23 returns Binder parameters to the process of the second application 22;

[0077] 11) The process of the second application 22 sends image acquisition information to the camera sharing service 23 based on the Binder parameters.

[0078] Here, the image acquisition information includes at least image storage address B and image template data; specifically, image storage address B can be a Surface container, such as ImageReader, SurfaceView, SurfaceTexture, etc. Then, the serialized SurfaceB and image template data are encapsulated to obtain a serialized data packet, which is then sent to the camera service 23.

[0079] Here, the image template data can be, for example, a TEMPLATE_PREVIEW preview template or a TEMPLATE_STILL_CAPTURE photo template.

[0080] 12) The camera sharing service 23 deserializes the image storage address B sent by the second application 22 to obtain the image storage address B.

[0081] 13) The first application 21 recreates the image acquisition channel based on the image storage address A of the process of the first application 21 and the image storage address B of the process of the second application 22, while releasing the image acquisition channel originally created by the process of the first application 21.

[0082] Here, the image acquisition channel originally created by the first application process 21 could only be used for communication between the first application process 21 and the camera service. The newly created image acquisition channel can be used for communication between multiple application processes and the camera service simultaneously.

[0083] 14) The first application 21 process generates an image acquisition request B for the second application 22 process based on the image storage address B and the image template data of the second application 22 process;

[0084] 15) The first application 21 process sends the image acquisition request A of the first application 21 process and the image acquisition request B of the second application 22 process to the camera service 24 based on the recreated image acquisition channel;

[0085] 16) The camera service 24 prioritizes the received image acquisition requests, retrieves the target image acquisition request from the request queue through the camera driver, and sends the target image acquisition request to the camera device.

[0086] 17) The camera device fills the acquired image data into the image storage area A corresponding to the first application process and the image storage area B corresponding to the second application process based on the image storage address carried in the target image acquisition request.

[0087] Here, the camera device obtains the image storage address (Surface object) carried in the target image acquisition request, and requests the allocation of an image storage area from the image buffer compositing service layer (SurfaceFlinger) 25 through the graphics buffer producer (GraphicBufferProducer) to obtain the image storage area (GraphicBuffer) corresponding to the Surface object. Simultaneously, a mapping relationship is established between the image storage address of the second application process and this image storage area, so that the image storage area is mapped to the second application process. Then, the acquired image data is written to this image storage area. Here, this image storage area can be image storage area A corresponding to the first application process and image storage area B corresponding to the second application process.

[0088] Here, image storage region A (GraphicBuffer A) and image storage region B (GraphicBuffer B) are memory-mapped as anonymous shared memory to the first application process and the second application process, respectively.

[0089] This application collects image acquisition requests from multiple application processes in a cross-process manner by having a primary application that continuously occupies the camera. Then, it fills the image storage areas of these multiple application processes with image data through an image acquisition channel established by the primary application for all application processes. This eliminates the need to modify the Android system's camera service or architecture; camera data sharing can be achieved solely through the application layer that continuously occupies the camera. No system customization is required, facilitating the rapid deployment of camera sharing capabilities and enhancing practicality.

[0090] Figure 3 This is a schematic diagram illustrating the method for sharing a camera in this application. Figure 3 ,like Figure 3 As shown, this method is applied to a second application in an electronic device, and the method includes:

[0091] Step 301: Send the first service call request to the first application process that has been occupying the camera for a long time;

[0092] Step 302: If the first service call request is successfully responded to, a communication connection is established with the first application process;

[0093] Step 303: Send image acquisition information to the first application process based on the communication connection. The image acquisition information includes at least an image storage address and template information.

[0094] Step 304: Obtain the image data captured by the camera through the image storage area corresponding to the image storage address; wherein, the image storage area is allocated by the camera service layer from the image cache synthesis service layer; the image data is sent by the camera service layer to the image storage area based on the image acquisition request sent by the first application process, and the image acquisition request is generated by the first application process according to the image storage address and the template information.

[0095] Here, the second application is as described above. Figure 1 and Figure 2 The application corresponding to the second application process in the middle is the same as the above. Figure 1 , Figure 2 The provided methods for sharing cameras belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0096] Figure 4 This is a schematic diagram of the device structure for sharing a camera in this application, as shown below. Figure 4 As shown, the device includes:

[0097] The acquisition unit 401 is used to acquire image acquisition information of at least one second application process through a first application process that occupies the camera for a long time, wherein the image acquisition information includes at least an image storage address.

[0098] Establishment unit 402 is used to establish a first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process;

[0099] The sending unit 403 is configured to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel; so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0100] In a preferred embodiment, the acquisition unit 401 is specifically used to collect image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface in the first application process, wherein the image acquisition request carries the image acquisition information.

[0101] In a preferred embodiment, the device further includes:

[0102] The receiving unit 404 is configured to receive, through the first application process, a first service call request sent by at least one second application process for the camera sharing service interface; and in response to the first service call request, establish a communication connection with the second application through the camera sharing service interface.

[0103] In a preferred embodiment, the image acquisition information further includes template information for image acquisition;

[0104] The device also includes:

[0105] The generation unit 405 is used to generate a second image acquisition request for the second application process based on the template information and the image storage address of the second application process.

[0106] In a preferred embodiment, the device further includes:

[0107] Release unit 406 is used to release the second image acquisition channel established between the first application process and the camera service layer, wherein the second image acquisition channel is characterized as being used only by the first application process.

[0108] In a preferred embodiment, the device further includes:

[0109] Processing unit 407 is used to deserialize the target image storage address sent by the second application process through the first application process to obtain the image storage address of the second application process.

[0110] It should be noted that the device provided in the above embodiments is only illustrated by the division of the above-described program modules when implementing shared cameras. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. Furthermore, the device provided in the above embodiments is similar to the one described above... Figure 1 The provided methods for sharing cameras belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0111] Figure 5 This is a schematic diagram of the system composition of the shared camera in this application, as shown below. Figure 5 As shown, the system includes:

[0112] The camera sharing service layer 501 is set in the first application process that occupies the camera for a long time. It is used to collect image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface. The image acquisition request carries the image storage address.

[0113] The first application 502 has a first application process, which is used to establish a first image acquisition channel based on the image storage address of the second application process and the image storage address of the first application process; and to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel.

[0114] At least one second application 503 has a second application process, configured to establish a communication connection with the camera sharing service layer through the camera sharing service interface, send an image acquisition request to the camera sharing service layer based on the communication connection; and to obtain image data acquired by the camera from the image storage area corresponding to the image storage address of the second application process through the first application process.

[0115] The camera service layer 504 is used to send the image data captured by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

[0116] It should be noted that the shared camera system provided in the above embodiments is different from the one described above. Figure 2The provided methods for sharing cameras belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0117] Figure 6 This is a schematic diagram of the structural composition of the electronic device in this application, such as... Figure 6 As shown, electronic device 600 can be a computer device based on the Android operating system, including but not limited to computers with image acquisition functions, digital broadcasting terminals, information transceivers, medical devices, fitness equipment, personal digital assistants, and other terminals or servers. Here, servers include but are not limited to physical servers and cloud servers. Figure 6 The illustrated electronic device 600 includes at least one processor 601, a memory 602, at least one network interface 604, and a user interface 603. The network interface 604 can communicate with an external database for data access and manipulation. This external database may be a database system deployed on a computer outside this device, not a hardware component of this computer device, and provides database services to the outside via a network. The network interface 604 can also communicate with a message queue entity to place messages generated by this hardware entity into the message queue entity or consume messages from the message queue entity. This message queue may be a message queue system deployed on a computer outside this device, not a hardware component of this computer device, and provides message services to the outside via a network. The network interface 604 can also send network packets to the network interface of the system under test and receive response packets. This system under test may be a network application system deployed on a computer outside this device, not a hardware component of this computer device, and provides application services to the outside via a network.

[0118] The various components in electronic device 600 are coupled together via bus system 605. It is understood that bus system 605 is used to implement communication between these components. In addition to a data bus, bus system 605 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 6 The general designated all buses as Bus System 605.

[0119] The user interface 603 may include a monitor, keyboard, mouse, trackball, click wheel, buttons, touchpad, or touch screen.

[0120] It is understood that memory 602 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 602 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0121] In this embodiment, the memory 602 is used to store various types of data to support the operation of the electronic device 600. Examples of such data include: any computer program used to operate on the electronic device 600, such as the operating system 6021 and application program 6022; contact data; phonebook data; messages; pictures; audio, etc. The operating system 6021 includes various system programs, such as a framework layer, core library layer, driver layer, etc., used to implement various basic services and handle hardware-based tasks. The application program 6022 includes at least one application that requires prolonged camera access, for example, a security application. The application program 6022 may also include other applications that do not require prolonged camera access, such as video calling software, media players, browsers, etc., used to implement various application services. Programs implementing the methods of this embodiment can be included in the application program 6022.

[0122] The methods disclosed in the embodiments of this application can be applied to or implemented by processor 601. Processor 601 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 601 or by instructions in software form. The processor 601 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 601 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 602. Processor 601 reads the information in memory 602 and combines it with its hardware to complete the steps of the aforementioned method.

[0123] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned network access method.

[0124] In an exemplary embodiment, this application also provides a computer-readable storage medium, such as a memory 602 including a computer program, which can be executed by a processor 601 of an electronic device 600 to complete the steps described in the foregoing method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM; it may also be various devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0125] A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, perform any of the method steps of any of the network access methods described above.

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

[0127] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0128] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0129] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0130] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0131] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for sharing a camera, characterized in that, The method is applied to a primary application of electronic devices where cameras are occupied for extended periods. The method includes: The camera sharing service in the first application process collects image acquisition requests from at least one second application process in a cross-process manner. The image acquisition requests carry the image acquisition information, which includes at least an image storage address. The second application is an application that does not occupy the camera for extended periods. A first image acquisition channel is established based on the image storage address of the first application process and the image storage address of the second application process; Based on the first image acquisition channel, the first image acquisition request of the first application process and the second image acquisition request of the second application process are sent to the camera service layer, so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

2. The method according to claim 1, characterized in that, Before acquiring image acquisition information from at least one second application process through the first application process, the method further includes: The first application process receives at least one first service call request sent by a second application process for the camera sharing service. If the first application process successfully responds to the first service call request, a communication connection is established between the first application process and the second application process through the camera sharing service.

3. The method according to claim 1, characterized in that, The image acquisition information also includes template information for image acquisition; Before sending the first image acquisition request of the first application process and the second image acquisition request of the second application to the camera service layer based on the first image acquisition channel, the method further includes: Based on the template information and the image storage address of the second application process, a second image acquisition request is generated for the second application process.

4. The method according to claim 1, characterized in that, Before establishing the first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process, the method further includes: Release the second image acquisition channel established between the first application process and the camera service layer. The second image acquisition channel is characterized as being used only by the first application process.

5. The method according to claim 1, characterized in that, The method further includes: The first application process deserializes the target image storage address sent by the second application process to obtain the image storage address of the second application process.

6. A method for sharing a camera, characterized in that, The method is applied to a second application of an electronic device, the method comprising: The second application process sends a first service call request to the first application process that has been occupying the camera for a long time, for the camera sharing service in the first application process; wherein, the second application is an application that has not been occupying the camera for a long time. If the first service call request is successfully responded to, a communication connection is established with the first application process; Based on the communication connection, image acquisition information is sent to the first application process. The image acquisition information includes at least an image storage address and template information. The image acquisition information is carried in an image acquisition request of at least one second application process. The image acquisition request of the at least one second application process is collected by the first application in a cross-process manner through the camera sharing service in the first application process. Image data captured by the camera is obtained through the image storage area corresponding to the image storage address; wherein, the image storage area is allocated by the camera service layer from the image cache synthesis service layer; the image data is sent by the camera service layer to the image storage area based on the image acquisition request sent by the first application process, and the image acquisition request is generated by the first application process according to the image storage address and the template information.

7. A device for sharing a camera, characterized in that, The device includes: The acquisition unit is configured to collect image acquisition requests from at least one second application process in a cross-process manner through a camera sharing service in a first application process that has been occupying the camera for an extended period of time. The image acquisition requests carry the image acquisition information, and the image acquisition information includes at least an image storage address. The second application is an application that does not occupy the camera for an extended period of time. An establishment unit is used to establish a first image acquisition channel based on the image storage address of the first application process and the image storage address of the second application process; The sending unit is configured to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel; so that the camera service layer sends the image data acquired by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

8. A system for sharing a camera, characterized in that, The system includes: A camera sharing service layer is set up in the first application process that occupies the camera for a long time. It is used to collect image acquisition requests from at least one second application process in a cross-process manner through the camera sharing service interface. The image acquisition request carries an image storage address. The second application is an application that does not occupy the camera for a long time. The first application is used to establish a first image acquisition channel based on the image storage address of the second application process and the image storage address of the first application process; and to send a first image acquisition request of the first application process and a second image acquisition request of the second application process to the camera service layer based on the first image acquisition channel. At least one second application is configured to establish a communication connection with the camera sharing service layer through the camera sharing service interface, send an image acquisition request to the camera sharing service layer based on the communication connection, and obtain the image data acquired by the camera from the image storage area corresponding to the image storage address of the second application process through the first application process; The camera service layer is used to send the image data captured by the camera to the image storage area of ​​the first application process and the image storage area of ​​the second application process based on the first image acquisition request and the second image acquisition request.

9. An electronic device for sharing a camera, characterized in that, The electronic device includes: The processor and the memory used to store computer programs that can run on the processor. When the processor runs the computer program, it executes the method steps of the shared camera method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for sharing camera by multiple applications and computer readable storage medium

    CN112579322A

  • Single-camera calling method and device, terminal and readable storage medium

    CN114205529A