Method and device for multi-application camera sharing of Linux compatible Android system

By porting virtual video device drivers and creating camera server programs in Linux-compatible Android systems, transforming the camera framework and hal layer, the function of sharing cameras for multiple applications is realized, solving the problem of camera exclusiveness in the existing technology and improving the user experience.

CN119781862APending Publication Date: 2025-04-08KYLIN CORP
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411944541.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, applications of Linux and Android systems only allow one application to use the camera at the same time, and multiple applications cannot share the camera, resulting in poor user experience.

Method used

By porting the virtual video device driver to the Linux-compatible Android system environment, create a camera server program, and transform the Android Framework layer camera framework and hal layer, so that multiple applications can share the same camera.

Benefits of technology

It realizes that multiple Linux applications and multiple Android applications can use cameras at the same time, greatly improving the user experience and solving the problem of a single application exclusive camera.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781862A_ABST
    Figure CN119781862A_ABST
Patent Text Reader

Abstract

The invention provides a multi-application camera sharing method and device for a Linux-compatible Android system, and the method comprises the steps: transplanting a virtual video device driver to an environment with the Linux-compatible Android system, creating a camera server program at a Linux system side, creating a Linux side system service configuration file, carrying out the self-starting along with the startup, transforming an Android Framework layer camera frame, and carrying out the self-starting of the camera frame. A plurality of Android applications can call the same camera device at the same time; and transforming an Android side camera hal layer, so that the Android side camera hal layer can read camera data from camera virtual equipment and send the camera data to an application layer. According to the method and the device, a plurality of Linux applications and a plurality of Android applications can share the same camera, so that the user experience is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of information technology, and in particular relates to a method and device for sharing a camera by multiple applications in a Linux-compatible Android system. Background Art

[0002] No matter it is Linux system or Android system, or Linux compatible with Android environment, only one application is allowed to use the camera at the same time. If the camera is occupied by an application, another application will be denied to open the camera again, or it can be opened but the original application using the camera will be interrupted. If multiple applications want to share the camera, for example, the user wants to record a video or start a live broadcast in the background, and at the same time wants to use another application to take a photo, this is impossible under current technical conditions, which brings a very bad experience to users. Summary of the invention

[0003] The purpose of the present invention is to provide a method and device for sharing a camera among multiple applications in a Linux-compatible Android system, so that multiple Linux applications and multiple Android applications can share the same camera, greatly improving the user experience.

[0004] In order to achieve the above object, the technical solution of the present invention is as follows:

[0005] A method for sharing a camera among multiple applications in a Linux-compatible Android system, comprising:

[0006] S1. Transplant the virtual video device driver to the Linux-compatible Android system environment and load it into the kernel layer kernel;

[0007] S2. Create a camera server program on the Linux system side to monitor the application's request to open the camera and to be responsible for collecting video from the real camera and sending it to the camera virtual device;

[0008] S3, creates a Linux-side system service configuration file and starts it automatically when the computer is turned on. The service is responsible for loading the virtual video device driver, creating two camera virtual devices, and starting the camera server program at the same time;

[0009] S4, modify the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time;

[0010] S5, transform the Android side camera hal layer so that it can read camera data from the camera virtual device and send it to the application layer.

[0011] Furthermore, the creation of the camera server program in step S2 specifically includes:

[0012] S201, receiving standard input parameters;

[0013] S202, using Netlink socket programming to receive the message of opening and closing the camera sent by the kernel layer driver;

[0014] S203, creating socket communication, receiving the camera opening message sent by the hal layer of the Android side camera, and modifying the camera to obtain video stream parameter information;

[0015] S204, creating a thread for operating the camera using the ioctl system call and the v4l2 standard interface after receiving a command to turn on or off the camera;

[0016] S205, using mmap to obtain video stream data from the real camera device file, and using the write function to write the data to the virtual camera device file;

[0017] S206, when receiving a request to close the camera, releasing the memory mapping area and the cache, closing the camera, and exiting the thread;

[0018] S207, compile and generate a binary file as the camera server program.

[0019] Furthermore, the creation of the Linux-side system service configuration file in step S3 specifically includes:

[0020] S301, defining execution actions of the service, including loading a virtual video device driver module, configuring two virtual camera devices, and setting easily identifiable labels for the virtual camera devices;

[0021] S302, starting the camera server program, and taking the real camera device as input and the virtual camera device as output;

[0022] S303, setting the automatic startup at boot time, automatic restart when the service is killed, and the restart time interval.

[0023] Furthermore, the method of transforming the Android Framework layer camera framework in step S4 specifically includes:

[0024] S401. Increase the value of mMaxCost in the ClientManager constructor of the framework.

[0025] S402. Modify the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority.

[0026] Furthermore, step S5 specifically includes:

[0027] S501, modifying the hal layer camera driver of the Android side camera, establishing socket communication with the Linux side camera server program; sending the camera command issued by the Android application to the camera server program;

[0028] S502, modify the open function, send the request to open the camera to the camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. The Android side camera hal layer operates the virtual camera after obtaining the file descriptor.

[0029] Another aspect of the present invention further provides a Linux-compatible Android system multi-application shared camera device, comprising:

[0030] Driver module: port the virtual video device driver to the Linux-compatible Android system environment and load it into the kernel layer;

[0031] Camera server module: Create a camera server program on the Linux system side to monitor the application's request to open the camera, and be responsible for capturing video from the real camera and sending it to the camera virtual device;

[0032] Service module: Create a system service configuration file on the Linux side and start it automatically when the computer is turned on. The service is responsible for loading the virtual video device driver, creating two camera virtual devices, and starting the camera server program at the same time;

[0033] Framework transformation module: transforms the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time;

[0034] HAL layer transformation module: Transform the HAL layer of the Android camera so that it can read camera data from the camera virtual device and send it to the application layer.

[0035] Furthermore, the camera server module includes a camera server program creation unit, which includes: receiving standard input parameters; using Netlink socket programming to receive messages from the kernel layer driver to open and close the camera; creating socket communication, receiving the camera opening message sent by the Android side camera hal layer, and modifying the camera to obtain video stream parameter information; creating a thread for using ioctl system calls and v4l2 standard interfaces to operate the camera after receiving commands to open and close the camera; using mmap to obtain video stream data from the real camera device file, and using the write function to write the data to the virtual camera device file; when receiving a request to close the camera, releasing the memory mapping area and cache, closing the camera, and exiting the thread; compiling and generating a binary file as the camera server program.

[0036] Furthermore, the service module includes a system service configuration unit, which includes: defining the execution actions of the service, including loading a virtual video device driver module, configuring two virtual camera devices, and setting easily identifiable labels for the virtual camera devices; starting the camera server program, and using the real camera device as input and the virtual camera device as output; setting self-start at startup, automatic restart when the service is killed, and the restart time interval.

[0037] Furthermore, the framework modification module includes: increasing the mMaxCost in the ClientManager constructor of the framework; modifying the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority.

[0038] Furthermore, the hal layer transformation module includes:

[0039] Driver modification unit: modify the hal layer camera driver of the Android camera, establish socket communication with the Linux camera server program; send the camera command issued by the Android application to the camera server program;

[0040] Function transformation unit: Transform the open function, send the request to open the camera to the camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. The Android side camera hal layer operates the virtual camera after obtaining the file descriptor.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] 1. The present invention creates a linux-side camera server program to uniformly manage the requirements of linux applications and Android applications for operating cameras, allowing multiple linux applications and multiple android applications to use the camera at the same time;

[0043] 2. The present invention transforms the camera framework of the Android Framework layer, solving the limitation that multiple applications are not allowed to call the camera at the same time;

[0044] 3. The present invention establishes a communication mechanism between the Linux and Android hal layers, so that the Android system and the Linux system are integrated, allowing the Linux end to control the camera, and allowing the Android system to use the camera like a Linux application. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic diagram of the overall framework of Example 1 of the present invention;

[0046] Figure 2 is a schematic diagram of the workflow of the camera server of Embodiment 1 of the present invention;

[0047] Figure 3 This is a schematic diagram of the process of collecting video data by the camera server according to Embodiment 1 of the present invention;

[0048] Figure 4 It is a schematic diagram of the communication process between the Android side camera HAL layer and the camera server in Example 1 of the present invention. DETAILED DESCRIPTION

[0049] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0050] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0051] Embodiment 1:

[0052] This embodiment proposes a method for enabling multiple applications to share a camera when Linux is compatible with the Android system. The method is applied in a Linux compatible Android system running environment and includes the following steps:

[0053] S1, transplant the virtual video device driver to the Linux compatible Android system environment. In this embodiment, the virtual video device adopts v4l2loopback and is loaded into the kernel in the form of ko;

[0054] S2, creates a camera server program on the Linux system side to monitor the application's request to open the camera and is responsible for capturing video from the real camera and sending it to the virtual device;

[0055] S3, creates a Linux-side system service configuration file and starts it automatically when the computer is turned on. The service is responsible for loading the v4l2loopback driver, creating two camera virtual devices, and starting the camera server program at the same time;

[0056] S4, modify the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time;

[0057] S5, transform the Android camera hal layer so that it can read camera data from the camera virtual device and send it to the application layer.

[0058] The overall framework diagram constructed in the above method is as follows Figure 1 As shown in the figure, the Android system and the Linux system share a kernel and share peripherals such as cameras. The Android camera application controls the camera through the framework interface, and then establishes socket communication with the Liunx-side camera server through the camera hal layer, and sends the camera operation command to cameraserver1, so as to achieve the effect of using the camera in the Linux application; at the same time, the camera server virtualizes the physical camera device / dev / video0 into two device nodes / dev / video6 and / dev / video7, representing the front and rear cameras respectively; the v4l2loopback driver receives the camera use request from the Linux app, notifies the cameraserver through the netlink socket, and the camera server uniformly manages the camera operation request of the camera application.

[0059] The specific descriptions of each step in the above method are as follows:

[0060] 1. In step S1, porting the v4l2loopback driver to a Linux-compatible Android system environment includes the following steps:

[0061] 1. The Linux-compatible Android system operating environment is to use a docker container to load an Android image on the Linux system, so that the Linux and Android systems share the same Linux kernel;

[0062] 2. Get the v4l2loopback camera driver file;

[0063] 3. Modify the opem / close interface, establish a broadcast mechanism, and use the Netlink socket to realize the communication between the kernel process and the user process, so as to receive the application process's request to open and close the camera, and send this message to the camera server program created in step S2;

[0064] 4. Compile the driver file, generate the ko file, and copy the ko file to the lib library storage location corresponding to the system environment kernel.

[0065] 2. Creating a camera server program on the Linux system side in step S2 includes the following steps:

[0066] 1. Write the Linux main program of the camera server program and receive standard input parameters. The parameter types include the real camera device file path, the device file path to be virtualized, and the initial values ​​of the camera data resolution, frame rate, data format, etc. that the application needs to obtain;

[0067] 2. Use Netlink socket programming to receive broadcasts related to opening and closing the camera from the kernel driver;

[0068] 3. Create socket communication, receive the camera opening message sent by the hal layer of the Android camera, and modify the camera to obtain video stream parameter information, including resolution, frame rate, data format, etc.;

[0069] 4. Create a thread to operate the camera using the ioctl system call and v4l2 standard interface after receiving the command to open or close the camera, including querying and setting various properties of the camera, such as resolution, frame rate, color space, etc.;

[0070] 5. Use mmap to obtain video stream data from the real camera device file, and use the write function to write the data to the virtual camera device file;

[0071] 6. When receiving a request to close the camera, release the memory mapping area and cache, close the camera, and exit the thread;

[0072] 7. Compile and generate a binary file called camera server.

[0073] The workflow of the camera server is as follows Figure 2 As shown, the camera server is started with the system service configuration file in step S3, and the startup command is as follows: Figure 2, virtualize two virtual camera device nodes from the real camera, i.e. / dev / video0; then start a while loop to monitor the camera application request. If it is a request to open the camera, then determine whether the current reference count flag, i.e. App_num, is greater than 0. If not, open the real camera, start collecting video stream data and write it to the virtual device node. If so, directly read the video stream data from the virtual device node, and add 1 to the reference count flag; if it is a request to close the camera, then determine whether the reference count flag is equal to 0. If so, close the video device and stop video acquisition. If not, continue video acquisition and reduce the reference count flag by 1; if the command issued is to modify the video stream acquisition parameter command, then send the issued video acquisition parameters to the driver layer, and re-acquire data according to the set parameters.

[0074] The process of collecting video data by camera server is as follows: Figure 3 shown.

[0075] 3. In step S3, a Linux-side system service configuration file is created and automatically started when the computer is turned on, including the following steps:

[0076] 1. Define the execution actions of the service, including loading the v4l2loopback driver module, configuring two virtual camera devices, and setting two easily identifiable labels for them such as "rear" and "front";

[0077] 2. Start the binary file cameraservice generated in step S2, and use the real camera device, usually / dev / video0, as input, and the virtual camera device, usually / dev / video6 and / dev / video7, as output;

[0078] 3. Set the system to start automatically at boot and restart automatically when the service is killed. The restart interval is 10 seconds.

[0079] Fourth, in step S4, the Android Framework layer camera framework is modified so that multiple Android applications can call the same camera device at the same time; the following steps are included:

[0080] 1. First of all, the Android camera framework does not allow multiple apps to use the camera at the same time, even if multiple apps open cameras with different IDs. To address this restriction, you can make the following changes: increase the mMaxCost in the ClientManager constructor in the framework / av / services / camera / libcameraservice / utils / ClientManager.h file, such as multiplying it by 10. The principle of the above change is that when opening a camera, it will detect whether there is a conflict at present, and judge the number of currently opened cameras in the wouldEvictLocked function of the above file. If the number of opened cameras is greater than mMaxCost, the current app will be considered as having a conflict, pushed to the conflict list, and then disconnected in the camera service.

[0081] 2. For the same camera, if there is an app that opens the camera, and another app tries to open the camera, and the priority of the app is lower than that of the already opened app, the current app will be turned off; if the current priority is higher than the already opened app, the camera in the already opened app will be turned off; To solve this problem, modify the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority;

[0082] At this point, the Framework layer camera service no longer detects the number of cameras opened, nor the app priority, removing the restriction that multiple upper-layer apps can open cameras at the same time.

[0083] 5. In step S5, the Android side camera hal layer is modified so that it can read the camera data from the camera virtual device and send it to the application layer, as follows:

[0084] After the Android Framework layer camera framework layer has released the permission for multiple Android applications to open the camera at the same time, the camera opening process can be called to the hal layer normally; however, it is still not possible to operate the virtual camera like a real camera and obtain the video stream from the virtual camera device. Therefore, the following steps are used to achieve this effect:

[0085] 1. Modify the hal layer camera driver on the Android side and establish socket communication with the camera server program created in step S2; send commands such as opening and closing the camera and modifying camera parameters issued by the Android application to the camera server program on the Linux side;

[0086] 2. Modify the open function, send the request to open the camera to the Linux camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. After the Androidhal layer obtains the file descriptor, it can operate the virtual camera like a real physical camera;

[0087] 3. Since the cameraaid sent by the Android application layer when opening the camera is usually 0 or 1, 0 represents the rear camera, and 1 represents the front camera. The front camera requires mirroring of the camera data. Therefore, it is necessary to ensure that the virtual camera opened when the cameraaid is 0 is the virtual camera device labeled "rear" in S3, and the virtual camera opened when the cameraaid is 1 is the virtual camera labeled "front" in S3;

[0088] The communication process between the Android camera hal layer and the camera server is as follows Figure 4 As shown in the figure, the Android application initiates a command to control the camera, which is called to the HAL layer layer by layer. The camera HAL layer driver sends commands such as opening, closing, and obtaining video stream parameters to the Linux camera server through socket communication. If it is an opening command, the camera server returns the file descriptor obtained after opening the camera to the Android side, so that the Android application can control the camera like the Linux application. If it is a command to close the camera or obtain video stream parameter modification commands, the corresponding command will be executed to control the camera.

[0089] Through transplantation, modification and other technical measures, the above method enables multiple Linux applications and multiple Android applications to share the same camera, solving the problem that only one application is allowed to use the same physical camera at the same time on both Linux and Android systems, greatly improving the user experience.

[0090] Embodiment 2:

[0091] This embodiment proposes a Linux-compatible Android system multi-application shared camera device, including:

[0092] Driver module: port the virtual video device driver to the Linux-compatible Android system environment and load it into the kernel layer;

[0093] Camera server module: Create a camera server program on the Linux system side to monitor the application's request to open the camera, and be responsible for capturing video from the real camera and sending it to the camera virtual device;

[0094] Service module: Create a system service configuration file on the Linux side and start it automatically when the computer is turned on. The service is responsible for loading the virtual video device driver, creating two camera virtual devices, and starting the camera server program at the same time;

[0095] Framework transformation module: transforms the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time;

[0096] HAL layer transformation module: Transform the HAL layer of the Android camera so that it can read camera data from the camera virtual device and send it to the application layer.

[0097] Among them, the camera server module includes a camera server program creation unit, and the camera server program creation unit includes: receiving standard input parameters; using Netlink socket programming to receive messages from the kernel layer driver to open and close the camera; creating socket communication, receiving the camera opening message sent by the Android side camera hal layer, and modifying the camera to obtain video stream parameter information; creating a thread for using ioctl system calls and v4l2 standard interfaces to operate the camera after receiving commands to open and close the camera; using mmap to obtain video stream data from the real camera device file, and using the write function to write the data to the virtual camera device file; when receiving a request to close the camera, releasing the memory mapping area and cache, and closing the camera and exiting the thread; compiling and generating a binary file as the camera server program.

[0098] Among them, the service module includes a system service configuration unit, which includes: defining the execution action of the service, including loading a virtual video device driver module, configuring two virtual camera devices, and setting easily identifiable labels for the virtual camera devices; starting the camera server program, and using the real camera device as input and the virtual camera device as output; setting the automatic start at boot, and automatically restarting when the service is killed, as well as the restart time interval.

[0099] The framework modification module includes: increasing the mMaxCost in the ClientManager constructor of the framework; modifying the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority.

[0100] Among them, the hal layer transformation modules include:

[0101] Driver modification unit: modify the hal layer camera driver of the Android camera, establish socket communication with the Linux camera server program; send the camera command issued by the Android application to the camera server program;

[0102] Function transformation unit: Transform the open function, send the request to open the camera to the camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. The Android side camera hal layer operates the virtual camera after obtaining the file descriptor.

[0103] The Linux-compatible Android system multi-application shared camera device proposed in this embodiment can implement the Linux-compatible Android system multi-application shared camera method proposed in Embodiment 1, and has the same technical effect as Embodiment 1.

[0104] The above-mentioned embodiments are only preferred implementations of the present invention, and are only used to help understand the method and core ideas of the present application. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions under the idea of ​​the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A method for sharing a camera among multiple applications in a Linux-compatible Android system, characterized in that: include: S1. Transplant the virtual video device driver to the Linux-compatible Android system environment and load it into the kernel layer kernel; S2. Create a camera server program on the Linux system side to monitor the application's request to open the camera and to be responsible for collecting video from the real camera and sending it to the camera virtual device; S3, creates a Linux-side system service configuration file and starts it automatically when the computer is turned on. The service is responsible for loading the virtual video device driver, creating two camera virtual devices, and starting the camera server program at the same time; S4, modify the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time; S5, transform the Android side camera hal layer so that it can read camera data from the camera virtual device and send it to the application layer.

2. The method for sharing a camera among multiple applications in a Linux-compatible Android system according to claim 1, characterized in that: The creation of the camera server program in step S2 specifically includes: S201, receiving standard input parameters; S202, using Netlink socket programming to receive messages from the kernel layer driver to open and close the camera; S203, creating socket communication, receiving the camera opening message sent by the hal layer of the Android side camera, and modifying the camera to obtain video stream parameter information; S204, creating a thread for operating the camera using the ioctl system call and the v4l2 standard interface after receiving a command to turn on or off the camera; S205, using mmap to obtain video stream data from the real camera device file, and using the write function to write the data to the virtual camera device file; S206, when receiving a request to close the camera, releasing the memory mapping area and the cache, closing the camera, and exiting the thread; S207, compile and generate a binary file as the camera server program.

3. The method for sharing a camera among multiple applications in a Linux-compatible Android system according to claim 1, characterized in that: The creation of the Linux-side system service configuration file in step S3 specifically includes: S301, defining execution actions of the service, including loading a virtual video device driver module, configuring two virtual camera devices, and setting easily identifiable labels for the virtual camera devices; S302, starting the camera server program, and taking the real camera device as input and the virtual camera device as output; S303, setting the automatic startup at boot time, automatic restart when the service is killed, and the restart time interval.

4. The method for sharing a camera among multiple applications in a Linux-compatible Android system according to claim 1, characterized in that: The method of transforming the Android Framework layer camera framework described in step S4 specifically includes: S401. Increase the value of mMaxCost in the ClientManager constructor of the framework. S402. Modify the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority.

5. The method for sharing a camera among multiple applications in a Linux-compatible Android system according to claim 1, characterized in that: Step S5 specifically includes: S501, modifying the hal layer camera driver of the Android side camera, establishing socket communication with the Linux side camera server program; sending the camera command issued by the Android application to the camera server program; S502, modify the open function, send the request to open the camera to the camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. The Android side camera hal layer operates the virtual camera after obtaining the file descriptor.

6. A Linux-compatible Android system multi-application shared camera device, characterized in that: include: Driver module: port the virtual video device driver to the Linux-compatible Android system environment and load it into the kernel layer; Camera server module: Create a camera server program on the Linux system side to monitor the application's request to open the camera, and be responsible for capturing video from the real camera and sending it to the camera virtual device; Service module: Create a system service configuration file on the Linux side and start it automatically when the computer is turned on. The service is responsible for loading the virtual video device driver, creating two camera virtual devices, and starting the camera server program at the same time; Framework transformation module: transforms the Android Framework layer camera framework so that multiple Android applications can call the same camera device at the same time; HAL layer transformation module: Transform the HAL layer of the Android camera so that it can read camera data from the camera virtual device and send it to the application layer.

7. The Linux-compatible Android system multi-application shared camera device according to claim 6, characterized in that: The camera server module includes a camera server program creation unit, which includes: receiving standard input parameters; using Netlink socket programming to receive messages for opening and closing the camera sent by the kernel layer driver; creating socket communication, receiving the camera opening message sent by the Android side camera hal layer, and modifying the camera to obtain video stream parameter information; creating a thread for using ioctl system calls and v4l2 standard interfaces to operate the camera after receiving commands to open and close the camera; using mmap to obtain video stream data from a real camera device file, and using a write function to write the data to a virtual camera device file; when receiving a request to close the camera, releasing the memory mapping area and cache, closing the camera, and exiting the thread; compiling and generating a binary file as a camera server program.

8. The Linux-compatible Android system multi-application shared camera device according to claim 6, characterized in that: The service module includes a system service configuration unit, which includes: defining the execution actions of the service, including loading a virtual video device driver module, configuring two virtual camera devices, and setting easily identifiable labels for the virtual camera devices; starting the camera server program, and using the real camera device as input and the virtual camera device as output; setting the automatic start at boot, and automatically restarting when the service is killed, as well as the restart time interval.

9. The Linux-compatible Android system multi-application shared camera device according to claim 6, characterized in that: The framework modification module includes: increasing the mMaxCost in the ClientManager constructor of the framework; modifying the logic of detecting application priority in the wouldEvictLocked function so that the camera service no longer detects application priority.

10. The Linux-compatible Android system multi-application shared camera device according to claim 6, characterized in that: The hal layer transformation modules include: Driver modification unit: modify the hal layer camera driver of the Android camera, establish socket communication with the Linux camera server program; send the camera command issued by the Android application to the camera server program; Function transformation unit: Transform the open function, send the request to open the camera to the camera server program through socket communication, and receive the file descriptor returned by the camera server program after opening the virtual camera. The Android side camera hal layer operates the virtual camera after obtaining the file descriptor.

Citation Information

Cited By

  • Camera access method and related apparatus

    CN122534314A