Camera distribution method and electronic equipment

The camera allocation method in electronic devices addresses the challenge of restoring near-distance viewing reminders by managing camera usage and notification between function modules, ensuring efficient resource use and timely recovery of the reminder function.

CN117729425BActive Publication Date: 2025-03-25HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310492723.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-04
Publication Date
2025-03-25
Estimated Expiration
2043-05-04

AI Technical Summary

Technical Problem

Existing electronic devices face challenges in restoring the near-distance viewing reminder functionality after other functions have used the camera, leading to inefficient CPU resource usage and delayed recovery of the reminder function.

Method used

A method for camera allocation in electronic devices that allows the camera to be released from one function module and allocated to another, enabling timely recovery of the near-distance viewing reminder functionality by sending notification messages and managing camera usage priorities.

Benefits of technology

Ensures efficient CPU resource management and timely reactivation of the near-distance viewing reminder function by properly handling camera allocation and release between different function modules, preventing continuous attempts to open the camera and reducing resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117729425B_ABST
    Figure CN117729425B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a camera allocation method and an electronic device, which relates to the field of electronic technology and is used to solve the problem that the close-up viewing reminder function cannot be restored in time after other functional modules exit the use of the camera. The method is applied to an electronic device, which includes a camera, and a first functional module and a second functional module that support the use of the camera to implement corresponding functions; the first function corresponding to the first functional module is in an on state, and the current camera is allocated to the second functional module. The method includes: obtaining a first operation for the second functional module; in response to the first operation, releasing the camera from the second functional module, and allocating the camera to the first functional module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of electronic technology, and in particular to a camera allocation method and electronic equipment. Background Art

[0002] When a user uses an electronic device, if the distance between the user's eyes and the electronic device display screen is too close, the user's eyesight is easily damaged. Therefore, in order to protect the user's eyesight when the user uses the electronic device, the electronic device can monitor the distance between the user's eyes and the electronic device display screen when the user uses the electronic device, and remind the user when it is detected that the distance between the user's eyes and the display screen is too close.

[0003] In the related art, in order to realize the function of close-up viewing reminder, a camera can be used to obtain the image in front of the display screen. However, the camera of an electronic device can usually only be used by one functional module at a time. Under the premise of turning on the close-up viewing reminder function, if other functional modules need to use the camera, and the camera use priority of other functional modules is higher than that of the close-up viewing reminder module, the close-up viewing reminder function will be forced to be interrupted. How to restore the close-up viewing reminder function has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide a camera allocation method and an electronic device, which are used to solve the problem that the close-range viewing reminder function cannot be restored in time after other functional modules exit the use of the camera.

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

[0006] In a first aspect, a camera allocation method is provided, the method being applied to an electronic device, the electronic device comprising a camera, and a first function module and a second function module supporting the use of the camera to implement corresponding functions; a first function corresponding to the first function module is in an enabled state, and the current camera is allocated to the second function module. The method comprises:

[0007] In the case where the camera is assigned to the second functional module, if the second functional module needs to exit the use of the camera, the user can initiate a first operation for the second functional module. In response to the first operation, the electronic device releases the camera from the second functional module. Since the first function corresponding to the first functional module is in an on state, the electronic device will also assign the camera to the first functional module after releasing the camera. Thus, the first functional module can use the camera to implement the first function. In this way, the first functional module can call the camera in time to implement the first function after the camera is released. At the same time, the first functional module does not need to continue trying to open the camera, which can avoid the waste of CPU resources.

[0008] In a possible implementation of the first aspect, the electronic device further includes a camera function module, and in response to the first operation, releasing the camera from the second function module and assigning the camera to the first function module may specifically include:

[0009] In response to the first operation, the camera function module releases the camera from the second function module, and triggers the sending of a notification message to the first function module that the camera has been released. After receiving the notification message, the first function module can sense that the camera has been released. After that, the first function module can call the camera. The first function module sends a first camera call instruction to the camera function module based on the notification message. In response to the first camera call instruction, the camera function module assigns the camera to the first function module. In this way, after other function modules release the camera, the camera function module can trigger the sending of a notification message to the first function module to inform the first function module of the message that the camera has been released, so that the first function module can call the camera in time to start the first function.

[0010] In a possible implementation of the first aspect, the first function module has a lower priority for using the camera than the second function module. Thus, when the first function module is using the camera, if the second function module requests to call the camera, the electronic device will allocate the right to use the camera to the second function module. That is, the second function module is allowed to seize the priority for using the camera of the first function module. However, when the second function module is using the camera, if the first function module requests to call the camera, the electronic device will not allow the first function module to seize the right to use the camera of the second function module.

[0011] In another possible implementation of the first aspect, before acquiring the first operation for the second functional module, the method further includes: acquiring a second operation for the second functional module. In response to the second operation, the electronic device allocates the camera to the second functional module.

[0012] In another possible implementation of the first aspect, before obtaining the second operation for the second functional module, the method further includes: obtaining a third operation for the first functional module. Since the third operation for the first functional module occurs before the first operation for the second functional module, it means that the camera is not currently assigned to other functional modules. Therefore, in response to the third operation, the electronic device starts the first function and can assign the camera to the first functional module. That is to say, in this implementation, before the second operation for the second functional module is obtained, the camera has been assigned to the first functional module. The above-mentioned assignment of the camera to the second functional module in response to the second operation may specifically include: in response to the second operation, the electronic device needs to first release the camera from the first functional module. Only then can the camera be assigned to the second functional module.

[0013] In this solution, if the first function is turned on first, the camera will be assigned to the first function module. If the function corresponding to the second function module is turned on later, the second function module will seize the right to use the camera, temporarily interrupting the first function. At this time, the camera needs to be released from the first function module and then assigned to the second function module. Then, when the second function module releases the camera, the first function module is notified of the camera being released, so that the first function module can call the camera back in time and resume the first function.

[0014] In another possible implementation of the first aspect, if the first functional module calls the camera first and the second functional module calls the camera later, before allocating the camera to the second functional module in response to the second operation, the method may further include: determining the priority of the first functional module and the second functional module for using the camera. In this implementation, the electronic device may specifically allocate the camera to the second functional module in response to the second operation after determining that the second functional module has a higher priority for using the camera than the first functional module.

[0015] In another possible implementation of the first aspect, the electronic device also includes a camera function module. After obtaining the third operation for the first function module, the above method may also include: the first function module initiates a first registration request to register a camera release callback function. In response to the first registration request, the electronic device may add a registration record of the camera release callback function by the first function module. In this way, when the camera release callback function is called, a notification message can be sent to the first function module based on the registration record. Afterwards, after the camera is released, the camera function module can trigger the call of the camera release callback function, and, based on the registration record, after the camera release callback function is called, a notification message that the camera is released can be sent to the first function module.

[0016] In this solution, when the first function module starts the first function, the camera release callback function can be registered. In response to the registration request for registering the camera release callback function initiated by the first function module, the electronic device can add a registration record of the camera release callback function by the first function module in the electronic device. Afterwards, if the camera use right of the first function module is preempted by other function modules (such as the second function module), when the other function module releases the camera, the electronic device can call the camera release callback function and send a notification message of the camera being released to the first function module. Thereby, the first function module can perceive that the camera is released in time, and call the camera again in time to realize the first function.

[0017] In another possible implementation of the first aspect, the electronic device further includes a camera function module. The first function is started first, and the second function module calls the camera later. Since the camera is in an idle state when the first function module is started, the electronic device can directly assign the camera to the first function module, that is, the first function module can obtain the right to use the camera. However, after that, when the second function module calls the camera, the right to use the camera will be assigned to the second function module, that is, the right to use the camera is preempted by the second function module. In this implementation, the first function module can register the camera release callback function when the right to use the camera is preempted. Specifically, after the camera is released from the first function module in response to the second operation, the method further includes: the first function module initiates a second registration request to register the camera release callback function. In response to the second registration request, a registration record of the first function module for the camera release callback function is added. Similarly, after the camera is released, the camera function module can trigger the call of the camera release callback function, and based on the registration record, after calling the camera release callback function, a notification message that the camera is released can be sent to the first function module.

[0018] In this way, the first functional module can register the camera release callback function when the camera use right is seized by other functional modules, and can also trigger the camera release callback function to be called by the camera functional module when the second functional module quits using the camera, and send a notification message to the first functional module. Similarly, the first functional module can sense that the camera is released in time, call the camera again in time, and restore the first function.

[0019] In another possible implementation of the first aspect, the electronic device further includes a camera function module. The first function module may request to call the camera after the camera is assigned to the second function module. That is, after the camera is assigned to the second function module in response to the second operation, the method further includes: obtaining a fourth operation for the first function module. In response to the fourth operation, the electronic device starts the first function. Since the current camera is in an occupied state, the electronic device cannot assign the camera to the first function module. Therefore, after starting the first function, the first function module may first register the camera release callback function so as to timely perceive the message that the camera is released when other function modules release the camera. That is, in response to the fourth operation, the first function module will also initiate a third registration request for the camera release callback function. In response to the third registration request, the electronic device adds a registration record of the camera release callback function by the first function module. Similarly, after the camera is released, the camera function module may trigger the call of the camera release callback function, and based on the registration record, after calling the camera release callback function, a notification message that the camera is released may be sent to the first function module. In this way, the first function module may timely perceive the message that the camera is released after the camera is released by other function modules, and call the camera in time to realize the first function.

[0020] In another possible implementation of the first aspect, when the camera is assigned to the second functional module, after the electronic device obtains the fourth operation for the first functional module, in response to the fourth operation, the electronic device starts the first function and determines the priority of the first functional module and the second functional module for using the camera. In the case of determining that the priority of the first functional module for using the camera is lower than that of the second functional module, the electronic device will not immediately assign the camera to the first functional module in response to the fourth operation, but the first functional module will first register the camera release callback function. Afterwards, after the second functional module releases the camera, the electronic device can call the camera release callback function and send a notification message to the first functional module. Thereby, the first functional module can call the camera in time after receiving the notification message, and then the electronic device can assign the camera to the first functional module.

[0021] In another possible implementation of the first aspect, the first functional module includes a close-up viewing reminder module. In this implementation, after the camera is assigned to the first functional module (i.e., the close-up viewing reminder module), the method further includes: the close-up viewing reminder module acquires an image captured by the camera. Furthermore, the close-up viewing reminder module analyzes the image, and based on the result of analyzing the image, reminds the user of the viewing distance.

[0022] In a second aspect, a camera allocation method is provided. The method is applied to an electronic device, which includes a camera, a camera function module, a first function module and a second function module that support using the camera to implement corresponding functions; a first function corresponding to the first function module is in an on state, and the current camera is allocated to the second function module.

[0023] The method includes:

[0024] The second function module sends a camera release instruction to the camera function module; in response to the camera release instruction sent by the second function module, the camera function module releases the camera and assigns the camera to the first function module. In this way, the first function module can call the camera in time to implement the first function after the camera is released. At the same time, the first function module does not need to continuously try to open the camera, which can avoid the waste of CPU resources.

[0025] In another possible implementation of the second aspect, the above-mentioned allocation of the camera to the first functional module may specifically include: the camera functional module sends a notification message to the first functional module that the camera is released. Based on the notification message, the first functional module sends a second camera call instruction to the camera functional module. In response to the second camera call instruction, the camera functional module allocates the camera to the first functional module. In this solution, after the second functional module releases the camera, the camera functional module actively notifies the first functional module of the message that the camera is released. This can avoid the first functional module from being unable to perceive the message that the camera is released in time, and can also avoid the first functional module from continuously trying to open the camera, which can avoid the waste of CPU resources.

[0026] In a possible implementation of the second aspect, before the second function module sends a camera release instruction to the camera function module, the method further includes: the second function module sends a third camera call instruction to the camera function module; in response to the second camera call instruction, the camera function module assigns the camera to the second function module. When the second function module needs to use the camera, it can send the third camera call instruction to the camera function module, and then the camera function module can assign the camera to the second function module.

[0027] In another possible implementation of the second aspect, the first function module has a lower priority for using the camera than the second function module. Thus, when the first function module is using the camera, if the second function module requests to call the camera, the electronic device will allocate the right to use the camera to the second function module. That is, the second function module is allowed to seize the priority for using the camera of the first function module. However, when the second function module is using the camera, if the first function module requests to call the camera, the electronic device will not allow the first function module to seize the right to use the camera of the second function module.

[0028] In another possible implementation of the second aspect, before the second function module sends the third camera call instruction to the camera function module, the method further includes: in response to the opening operation of the first function, the first function module starts the first function. And, the first function module sends the fourth camera call instruction to the camera function module. After receiving the fourth camera call instruction, the camera function module allocates the camera to the first function module in response to the fourth camera call instruction.

[0029] In this embodiment, after the camera is assigned to the first functional module, if the second functional module initiates a third camera call instruction, then in response to the third camera call instruction, the camera functional module needs to release the camera from the first functional module before it can assign the camera to the second functional module.

[0030] In this solution, if the first function is turned on first, the camera will be assigned to the first function module. If the function corresponding to the second function module is turned on later, the second function module will seize the right to use the camera, temporarily interrupting the first function. At this time, the camera needs to be released from the first function module and then assigned to the second function module. Then, when the second function module exits the use of the camera, the camera function module notifies the first function module of the message that the camera has been released, so that the first function module can promptly call the camera again and restore the first function.

[0031] In another possible implementation of the second aspect, the electronic device also includes a HIDL camera interface service module. After the first function module starts the first function, the method further includes: the first function module sends a fourth registration request to the HIDL camera interface service module to register a camera release callback function. In response to the fourth registration request, the registered camera release callback function adds the registration record of the camera release callback function by the first function module. In this embodiment, the camera function module sends a notification message that the camera is released to the first function module, which may specifically include: the camera function module triggers the sending of a first notification message that the camera is released to the HIDL camera interface service module. In response to the first notification message, the HIDL camera interface service module calls the camera release callback function and sends a second notification message that the camera is released to the first function module.

[0032] In this solution, the first function module registers the camera release callback function in the HIDL camera interface service module when it is started. Afterwards, when the first function is turned on, if other function modules quit using the camera, the camera function module notifies the HIDL camera interface service module, so that the HIDL camera interface service module calls the camera release callback function to notify the first function module of the camera being released. Thus, the first function module can sense that the camera is released in time, and call the camera again in time to realize the first function.

[0033] In another possible implementation of the second aspect, after the camera function module releases the camera from the first function module in response to the third camera call instruction, the method further includes: the first function module sends a fifth registration request to the HIDL camera interface service module to register the camera release callback function. In response to the fifth registration request, the camera release callback function is registered to add the registration record of the camera release callback function by the first function module. In this embodiment, the camera function module sends a notification message that the camera is released to the first function module, which may specifically include: the camera function module triggers the sending of a first notification message that the camera is released to the HIDL camera interface service module. In response to the first notification message, the HIDL camera interface service module calls the camera release callback function based on the registration record, and sends a second notification message that the camera is released to the first function module.

[0034] In this solution, when the camera is seized by other function modules, the first function module releases the camera from the first function module, and then the first function module registers the camera release callback function. In this way, when the second function module quits using the camera, the camera function module can also trigger the HIDL camera interface service module to call the camera release callback function, and send a notification message of the camera being released to the first function module based on the registration record. Similarly, the first function module can perceive the camera being released in time, and call the camera again in time to achieve the first function.

[0035] In another possible implementation of the second aspect, the first function module may also be started after the camera is assigned to the second function module. In this embodiment, after the camera function module assigns the camera to the second function module in response to the third camera call instruction, the above method also includes: in response to the opening operation of the first function, the first function module starts the first function. The first function module sends the sixth registration request to the HIDL camera interface service module, and the HIDL camera interface service module first adds the registration record of the first function module for the camera release callback function. Afterwards, when the second function module sends a camera release instruction to the camera function module, the camera function module triggers the HIDL camera interface service module to call the camera release callback function, and sends a notification message of the camera being released to the first function module based on the registration record.

[0036] In this solution, if the camera is in an occupied state when the first functional module is started, the first functional module can first register a camera release callback function. When the functional module that occupies the camera quits using the camera, the camera functional module triggers the HIDL camera interface service module to call the camera release callback function, and notifies the first functional module of the camera being released based on the registration record. In this way, the first functional module can call the camera in time after the camera is released to implement the first function.

[0037] In a third aspect, an electronic device is provided, comprising: a processor, a camera, and a memory; the memory and the camera are respectively coupled to the processor. The camera is used to collect images. The memory is used to store computer-executable instructions, and when the electronic device is running, the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the camera allocation method as described in any one of the first aspects above.

[0038] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer can execute the camera allocation method of any one of the above-mentioned first aspects.

[0039] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute the camera allocation method of any one of the above-mentioned first aspects.

[0040] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0041] Among them, the technical effects brought about by any design method in the second to sixth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1A A schematic diagram of a scenario in which a user uses a smart screen provided in an embodiment of the present application;

[0043] Figure 1B A schematic diagram of a display interface of a smart screen provided in an embodiment of the present application;

[0044] Figure 1C A schematic diagram of a display interface of a smart screen provided in an embodiment of the present application;

[0045] Figure 1D A schematic diagram of a display interface of a smart screen provided in an embodiment of the present application;

[0046] Figure 1E A schematic diagram of a display interface of a smart screen provided in an embodiment of the present application;

[0047] Figure 2A A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0048] Figure 2B A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of a process of calling a camera by a close-up viewing reminder module provided in an embodiment of the present application;

[0050] Figure 4A A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0051] Figure 4B A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0052] Figure 4C A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0053] Figure 5 A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0054] Figure 6 A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0055] Figure 7 A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0056] Figure 8 A schematic diagram of the software architecture of the smart screen provided in the embodiment of the present application;

[0057] Fig. 9 A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0058] Fig.10 A schematic diagram of a flow chart of a camera allocation method provided in an embodiment of the present application;

[0059] Fig.11 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] When a user uses an electronic device, if the distance between the user's eyes and the electronic device display screen is too close, the user's eyesight is easily damaged. Therefore, in order to protect the user's eyesight as much as possible when the user uses the electronic device, the electronic device can monitor the distance between the user's eyes and the electronic device display screen when the electronic device is used, and remind the user when it is detected that the distance between the user's eyes and the display screen is too close.

[0061] In such Figure 1A In the scenario shown, when user 10 is using smart screen 1, smart screen 1 can monitor the distance between the user's eyes (or face) and the display screen. In some embodiments, when smart screen 1 detects that the distance between the user's eyes and the display screen of smart screen 1 is too close, it can remind the user 10. For example, smart screen 1 can display the following on the display screen: Figure 1B The prompt information 11 shown is used to remind the user of the viewing distance.

[0062] Some teenagers or children may not have enough self-control, and when using electronic devices, their eyes are prone to being too close to the display screen. Currently, some electronic devices have a youth mode or a child mode, which is specifically designed for teenagers or children to use electronic devices. In the youth mode or the child mode, a close viewing reminder function is provided. Parents can turn on the close viewing mode reminder function in the youth mode or the child mode.

[0063] In some embodiments, Figure 1C As shown, the smart screen 1 can display application icons of multiple applications installed on the smart screen in the display interface 12 of all applications. These include icons corresponding to applications such as media center, settings, clock, application store, children's mode, and family camera. In the interface 12, the user can select the icon 12a corresponding to the children's mode to enter the function setting interface of the children's mode, such as Figure 1D The function setting interface 13 of the children's mode provided by the smart screen 1 shown.

[0064] The function setting interface 13 includes a switch 14 for the child mode, and the switch 14 is used to turn the child mode on or off. The function setting interface 13 also includes a switch 15 for the close viewing reminder function. The switch 15 is used to turn the close viewing reminder function on or off. After the close viewing reminder function of the smart screen 1 is turned on, the smart screen 1 can monitor the distance between the eyes of the user watching the smart screen 1 and the display screen of the smart screen 1 in the child mode. And, when it is detected that the distance between the user's eyes and the display screen of the smart screen 1 is too close, a prompt message is issued, such as Figure 1B The prompt message 11 is shown.

[0065] Figure 1D The function setting interface 13 shown also includes a switch 16 for lying position reminder, a switch 17 for only close viewing and lying position reminder for children, a setting option 18 for single use duration, etc. Among them, switch 16 is used to turn on or off the reminder function of monitoring whether the user is in a lying position to watch the smart screen 1, switch 17 is used to turn on or off the switch for only distance and lying position reminders for children, and setting option 18 is used to set the maximum time allowed for children to use the smart screen 1 at a time. It should be understood that in other embodiments, the function setting interface 13 may also include other setting options or switches.

[0066] In some embodiments, after the user sets different functions provided by the child mode application, the child mode application will save the user's settings for each function. Figure 1DIn the interface shown, each function is set to the following modes: close viewing reminder function is turned on, lying down reminder function is turned on, close viewing reminder and lying down reminder function are turned off only for children, and the single use time is limited to 30 minutes. Figure 1D The switch 14) shown will remind you according to the mode set by the above functions.

[0067] In the related art, in order to realize the function of close-up viewing reminder, the camera of the smart screen 1 can be used to obtain the image in front of the display screen, and whether it is necessary to remind the user of the viewing distance based on the image analysis. Figure 1D After the switch 15 shown is operated to turn on the close-up viewing reminder function, the smart screen 1 can enter the following Figure 1D At the same time, the smart screen 1 can raise the hidden camera (such as Figure 1D The camera 20 shown in the figure is then used to capture the image in front of the display screen.

[0068] However, the camera of the smart screen 1 can usually only be used by one functional module at a time. Under the premise of turning on the close-up viewing reminder function, if other functional modules need to use the camera, and the camera use priority of other functional modules is higher than that of the close-up viewing reminder module, the close-up viewing reminder function will be forced to be interrupted. It should be noted that in other embodiments, the above-mentioned close-up viewing reminder function can also be named as a distance reminder function, a vision protection function, etc.

[0069] Taking the other functional module as an example, the family camera has a higher priority for the use of the camera than the close-up viewing reminder module. Therefore, when the close-up viewing reminder function is turned on, if the user turns on the family camera, the camera will be occupied by the family camera. Moreover, during the process of the family camera using the camera, the close-up viewing reminder module cannot use the camera, so the close-up viewing reminder will be forced to be interrupted. In other words, the smart screen can no longer monitor and remind the user of the distance between the eyes and the display screen. In some embodiments, when the camera is preempted by other functional modules, the smart screen can display a prompt message on the display screen.

[0070] After turning on the close-up viewing reminder function of the children's mode, the user can select the "Return" option in interface 13 to return to the previous state. Figure 1CThe all-application interface 12 shown. In some embodiments, after turning on the child mode, some applications may not be supported for children in the child mode. Therefore, after the user selects the "return" option in the interface 13, the user can also return to the all-application interface displayed only to children, where the icons of some applications displayed in the interface 12 are no longer displayed to children. In the embodiment of the present application, the function of allowing the use of the family camera in the child mode is used as an example for explanation. That is, when the user selects the "return" option in the interface 13 and returns to the interface of all applications, the icon 12b of the family camera is still displayed in the interface.

[0071] Furthermore, after turning on the child mode, in the interface of all applications, users can also choose Figure 1C The home camera icon 12b shown in FIG. Figure 1E The home camera interface 21 shown in FIG. 21. After opening the home camera and entering interface 21, the home camera will seize the use of the camera of the smart screen, resulting in the close-up viewing reminder module being unable to use the camera for close-up viewing reminders. In this scenario, the smart screen 1 can display the following on the display screen: Figure 1E The prompt information 22 of the interface shown is used to remind the user that the close-up viewing reminder function is temporarily unavailable.

[0072] Users can Figure 1E Select the "Exit" option 23 in the interface 21 shown to exit the home camera. After the user exits the home camera, the camera will be released. At this time, the camera becomes idle again. Since the close viewing reminder function is still on, the smart screen should restore the close viewing reminder function after the home camera exits the use of the camera. However, the close viewing reminder module is usually unable to perceive that the camera has been released in time. That is, after the home camera exits the use of the camera, the close viewing reminder module cannot call the camera in time, that is, the smart screen cannot restore the close viewing reminder function in time.

[0073] exist Figure 1E The interface of the family camera shown also includes the function options "shoot" option 24, "record" option 25, and "gallery" option 26 provided by the family camera. Among them, the "shoot" option 24 is used for the user to shoot images with the family camera; the "record" option 25 is used for the user to record videos with the family camera; the "gallery" option 26 is used for the user to view images and videos shot with the family camera. The specific operation process of the user using the family camera to shoot images or record videos through the "shoot" option 24 or the "record" option 25, and the user using the "gallery" option 26 to view images, can refer to the description in the relevant technology, and will not be repeated in the embodiment of the present application. It should be understood that in other embodiments, the function interface of the family camera may also include other function options.

[0074] Based on this, an embodiment of the present application provides a method for allocating a camera. Under the premise that the first function corresponding to the first function module is in an on state and the current camera is assigned to the second function module, after detecting the first operation for the second function module, the smart screen responds to the first operation and releases the camera from the second function module. Then, since the first function is in an on state, the smart screen allocates the camera to the first function module so that the first function module uses the camera to implement the first function. In this way, as long as the first function is in an on state, the smart screen can allocate the camera to the first function module after other function modules exit using the camera (i.e., release the camera). Thereby, the first function module can call the camera in time to implement the first function.

[0075] Exemplarily, the first functional module may be the above-mentioned close-viewing reminder module or other functional modules that need to perceive in real time whether the camera is available, and the second functional module may be the above-mentioned home camera functional module, video call functional module or other modules that need to use the camera to implement corresponding functions. In some embodiments, the second functional module has a higher priority for using the camera than the first functional module. After the first functional module is started, it can be resident in the background of the electronic device.

[0076] In some embodiments, the above method can be applied to electronic devices including cameras. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a personal computer (PC), a smart screen, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a wearable device such as a smart watch, an artificial intelligence (AI) speaker, and a vehicle-mounted device, or various teaching aids (such as a learning machine, an early education machine), a smart toy, a portable robot, a personal digital assistant (PDA), an augmented reality (AR)\virtual reality (VR) device, a media player and other devices, or a device with a mobile office function, a device with a smart home function, a device with an audio and video entertainment function, a device supporting smart travel, etc. The embodiment of the present application does not impose any special restrictions on the specific form of the device.

[0077] like Figure 2AThe figure is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 130, a power module 140, a communication interface 150, a wireless communication module 160, an audio module 170, a display screen 180, a camera 190, and a button 191.

[0078] Exemplarily, the electronic device 100 may be the above-mentioned smart screen 1. It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0079] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the camera allocation method in the embodiment of the present application.

[0080] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0081] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0082] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0083] The internal memory 130 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 130. The internal memory 130 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.).

[0084] In addition, the internal memory 130 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0085] The power module 140 may be used to receive power input and provide power to the processor 110 , the internal memory 130 , the wireless communication module 160 , the display screen 180 , the camera 190 , etc. In some embodiments, the power module 140 may also be disposed in the processor 110 .

[0086] The communication interface 150 can be used to communicate with external devices such as a control device, a set-top box, a router, and a USB flash drive. The communication interface 150 can be any possible interface such as a network port or a universal serial bus (USB) interface.

[0087] The USB interface is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.

[0088] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via an antenna, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna.

[0089] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.

[0090] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110. The audio module 170 can include a speaker 170A and a microphone 170B.

[0091] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or conduct a video conference through the speaker 170A.

[0092] Microphone 170B, also known as a "microphone", is used to convert sound signals into electrical signals. When making a video call, video conference, or using a voice assistant, the user can speak by putting their mouth close to the microphone 170B to input the sound signal into the microphone 170B. The electronic device 100 can be provided with at least one microphone 170B. In other embodiments, the electronic device 100 can be provided with two microphones 170B, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170B to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0093] The display screen 180 is used to display images, videos, etc. The electronic device 100 implements the display function through the GPU, the display screen 180, and the application processor. The GPU is a microprocessor for image processing, connecting the display screen 180 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0094] The camera 190 is used to capture still images or videos. In some embodiments, the electronic device 100 may include 1 or N cameras 190, where N is a positive integer greater than 1. In some embodiments, the camera 190 may be a lifting camera. Typically, the lifting camera is hidden inside the electronic device 100 and is not visible to the user. When a user uses the electronic device 100 to make a video call or video conference with other users, the lifting camera can pop up from the top of the electronic device 100, so that the lifting camera can capture the user's image and send the user's image to the device of other users through the wireless communication module 160 and the antenna. In other embodiments, the camera 190 may also be embedded inside the display screen of the electronic device 100.

[0095] The key 191 includes a power key, a volume key, and a setting key. The key 191 can be a mechanical key or a touch key. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0096] The camera allocation methods in the following embodiments can all be implemented in the electronic device 100 having the above hardware structure.

[0097] Figure 2B It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0098] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and the native C / C++ library, the hardware abstraction layer (HAL), and the kernel layer.

[0099] The application layer can include a series of application packages.

[0100] like Figure 2B As shown, the application package may include applications such as media center, settings, clock, application store, two-way mode, home camera, first function module and second function module.

[0101] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0102] like Figure 2B As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, an input manager, and the like.

[0103] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.

[0104] Content providers are used to store and retrieve data and make it accessible to applications. This data can include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0105] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0106] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0107] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0108] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.

[0109] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.

[0110] The Android runtime includes the core library and the Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly uses the ahead-of-time (AOT) compilation technology and the just-in-time (JIT) compilation technology.

[0111] The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks, etc. The core library provides an API for users to develop Android applications.

[0112] The native C / C++ library can include multiple functional modules, such as surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.

[0113] Among them, the surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES provides drawing and operation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 100.

[0114] The hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer. The hardware abstraction layer can include display module, audio module, camera module (camera HAL) and Bluetooth module.

[0115] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0116] In the embodiment of the present application, when applications such as children's mode and family camera need to use the camera, the camera service module (camera server) of the framework layer can call the camera module (camera HAL) of the HAL layer, and then the camera HAL calls the camera hardware (camera hardware) to implement it. Further, the camera HAL calls the camera driver of the kernel layer to drive the camera to provide corresponding functional services for the application.

[0117] The camera allocation method proposed in the embodiment of the present application can be specifically applied to a scenario where, after a first function module that needs to use a camera to implement is started, the function implemented by the first function module using the camera is forced to be interrupted because the camera is preempted by a second function module with a higher priority for use by other cameras. In this scenario, if the second function module exits the use of the camera, it means that the camera is released and returns to an idle state. In the camera allocation method provided in the embodiment of the present application, when it is detected that the second function module exits the use of the camera, a first notification message can be sent to the first function module to notify the first function module that the camera is released. In this way, the first function module can promptly perceive that the camera is released, and then call the camera again to promptly restore the function implemented by the first function module using the camera.

[0118] Taking the first functional module as a close-up viewing reminder module, and the close-up viewing reminder module calling the camera to implement the close-up viewing reminder function as an example, the specific process of the close-up viewing reminder module calling the camera is introduced. The close-up viewing reminder module can be a functional module in the child mode application. Alternatively, the close-up viewing reminder module can also be an independent application. Figure 3 As shown, it is the specific implementation process of the close-range viewing reminder module calling the camera in some embodiments of the present application.

[0119] In response to the opening operation of the close-up viewing reminder function, the close-up viewing reminder module sends a camera call instruction to the camera function module.

[0120] Among them, the camera function module may include a camera server module of the framework layer and a camera HAL module of the HAL layer.

[0121] The camera service module starts the camera in response to the camera calling instruction. In addition, in response to the camera calling instruction, the camera function module also allocates the camera to the close-range viewing reminder module.

[0122] It should be noted that after the camera is assigned to the close-up viewing reminder module, the close-up viewing reminder module can control the camera and transmit images with the camera.

[0123] The camera collects images. The camera sends the images to the camera function module. Afterwards, the camera function module sends the images collected by the camera to the close-up viewing reminder module.

[0124] The close-viewing reminder module analyzes the image and determines whether it is necessary to remind the user to pay attention to the viewing distance according to the analysis result.

[0125] Providing reminders to users for close viewing mainly involves monitoring the distance between the user's eyes and the display screen, and reminding the user to pay attention to the viewing distance when the distance between the user's eyes and the display screen is too close. Therefore, in some embodiments, it is specifically possible to detect whether the distance between the user's eyes and the display screen is less than a preset distance to determine whether it is necessary to remind the user of the viewing distance. Furthermore, if it is detected that the distance between the user's eyes and the display screen is less than a preset distance, the smart screen can remind the user to watch closely. Among them, analyzing the image to determine the distance between the user's eyes and the display screen can be specifically implemented through algorithms such as image analysis, related neural network models, etc. The specific implementation process can refer to the introduction in the relevant technology and will not be repeated in the embodiments of this application.

[0126] The camera of the smart screen is usually set near the display screen of the smart screen, such as Figure 1D The camera 20 shown is arranged above the display screen of the smart screen and is a hidden lifting camera. Then, if the distance between the user's eyes and the display screen is closer, the user's eyes will account for a larger proportion of the image captured by the camera. On the contrary, if the distance between the user's eyes and the display screen is farther, the user's eyes will account for a smaller proportion of the image captured by the camera. Therefore, in other embodiments, the close viewing reminder module can also detect whether the proportion of the user's eyes in the image captured by the camera is greater than a preset proportion to determine whether it is necessary to remind the user of the viewing distance. Furthermore, if it is determined that the proportion of the user's eyes in the image captured by the camera is greater than the preset proportion, the smart screen can remind the user to watch closely.

[0127] It should be understood that the preset distance and preset proportion in the above embodiments can be set to any appropriate value according to the actual situation, and are not limited in the embodiments of the present application. In other embodiments, the smart screen can also analyze the image captured by the camera in other ways, and decide whether to remind the user of the viewing distance based on the analysis results.

[0128] If it is determined according to the analysis result that a reminder is needed, the close-viewing reminder module sends a reminder message. If it is determined according to the analysis result that a reminder is not needed, new images can continue to be received for analysis, and it is determined whether a reminder is needed.

[0129] The following is a brief description of the technical terms that may be involved in the embodiments of the present application.

[0130] Hardware Abstraction Layer Interface Definition Language (HIDL) is the interface between Android framework and Android HAL. HIDL is designed for inter-process communication.

[0131] The following will describe in detail the camera allocation method provided by the embodiment of the present application in conjunction with the accompanying drawings. Figure 4A , which is a flow chart of the camera allocation method provided in an embodiment of the present application. In this embodiment, the electronic device is a smart screen, the first functional module is a close-up viewing reminder module, and the second functional module is a home camera functional module. It should be understood that in other embodiments, the first functional module and the second functional module can also be other functional modules. The method includes S201-S210, wherein:

[0132] S201. Smart screen starts.

[0133] S202. The smart screen obtains the startup operation for the close-range viewing reminder module.

[0134] In some embodiments, S202 may specifically be a user starting a close-up viewing reminder module. In some embodiments, the close-up viewing reminder module may be a function of a child mode. Figure 1D In the interface shown, switch 15 is turned on to activate the close-up viewing reminder function.

[0135] S203. In response to the startup operation of the close-up viewing reminder module, the smart screen starts the close-up viewing reminder function.

[0136] S204. The smart screen assigns the camera to the close viewing reminder module.

[0137] S205. The smart screen obtains the startup operation for the home camera function module.

[0138] In some embodiments, the home camera function module can call the camera after startup. Therefore, the smart screen can start the home camera function module after obtaining the startup operation for the home camera function module. Afterwards, in order to realize the function of the home camera, the home camera function module will send a camera call instruction of the camera.

[0139] S206. In response to the start-up operation for the home camera function module, the camera is released from the close-range viewing reminder module.

[0140] S207. The smart screen assigns the camera to the home camera function module.

[0141] After the smart screen assigns the camera to the home camera function module, the related functions of the home camera can be used.

[0142] S208. The smart screen receives an exit operation for the home camera function module.

[0143] It should be noted that the above-mentioned startup operation for the close-up viewing reminder module, and the startup operation and exit operation for the home camera function module can also be named with other names. For example, the exit operation for the home camera function module can be named the first operation, the startup operation for the home camera function module can be named the second operation, and the startup operation for the close-up viewing reminder module can be named the third operation, and so on.

[0144] S209. In response to the exit operation on the home camera function module, the smart screen releases the camera from the home camera function module.

[0145] Since the close viewing reminder function is still turned on, after the camera is released from the home camera function module, the smart screen can reallocate the camera to the close viewing reminder module, such as S210.

[0146] S210. The smart screen assigns the camera to the close-range viewing reminder module.

[0147] It is understandable that after S210, the close viewing reminder module can obtain the image captured by the camera and analyze whether it is necessary to remind the user of the viewing distance based on the image. Specifically, when the close viewing reminder module analyzes the image and determines that the user's viewing distance is too close, it sends a reminder message to the user.

[0148] In some embodiments, the above S210 can specifically be that the smart screen first sends a notification message to the close viewing reminder module that the camera is released, and then the close viewing reminder module initiates a camera call instruction to the camera based on the notification message. Since the current camera has been released and is in an idle state, in response to the camera call instruction sent by the close viewing reminder module, the smart screen can assign the camera to the close viewing reminder module. It should be noted that in order to distinguish the camera call instructions sent by different functional modules at different times, "first" and "second" can be used to distinguish different camera call instructions. Exemplarily, the camera call instruction sent by the above-mentioned close viewing reminder module based on the notification message can be named the first camera call instruction.

[0149] Furthermore, in some embodiments, the smart screen sends a notification message to the close-up viewing reminder module after the camera is released, which can be achieved by calling the camera release callback function. It is understandable that before the smart screen calls the camera release callback function to send a notification message to the close-up viewing reminder module, the close-up viewing reminder module needs to register the camera release callback function first. The camera release callback function is used to call after the camera is released, and after calling the camera release callback function, it can trigger the sending of a notification message to the functional module that has registered the camera release callback function.

[0150] The close-up viewing reminder module registers the camera release callback function, and when the camera is occupied, it can wait for the smart screen to call the camera release callback function to obtain a notification message that the camera has been released. In addition, after receiving the notification message that the camera has been released, the close-up viewing reminder module can call the camera. In some embodiments, the close-up viewing reminder module can register the camera release callback function while starting the close-up viewing reminder function. In this way, if the close-up viewing reminder module is using the camera and the right to use the camera is preempted by other functional modules, the smart screen can also obtain the camera release message sent by calling the camera release callback function after other functional modules release the camera.

[0151] That is, in some embodiments, after S202 above, the method further includes: the close viewing reminder module initiates a registration request for the camera release callback function. In response to the registration request, the smart screen can add a registration record of the close viewing reminder module registering the camera release callback function. Afterwards, as long as it is detected that the camera is released (such as S209 above), the smart screen can call the camera release callback function and send a notification message of the camera being released to the registered camera release callback function (close viewing reminder module) based on the registration record.

[0152] In other embodiments, the close viewing reminder module may also register the camera release callback function after the camera usage rights are seized by other functional modules. That is, in some embodiments, after the above S206, the above method also includes: the close viewing reminder module initiates a registration request for the camera release callback function. Similarly, in response to the registration request, the smart screen can add a registration record of the camera release callback function by the close viewing reminder module. In this way, after the above S209, the smart screen can also call the camera release callback function, and send a notification message of the camera being released to the registered camera release callback function (close viewing reminder module) based on the registration record.

[0153] In the technical solution provided in the embodiment of the present application, the close-up viewing reminder module registers the camera release callback function when it is started, or when the camera use right is seized by other functional modules. The close-up viewing reminder module can promptly perceive the notification message sent by the smart screen by calling the camera release callback function after the camera is released by other functional modules (such as the home camera functional module). In this way, it is convenient for the close-up viewing reminder module to re-request to call the camera in time, so that the smart screen can reallocate the camera to the close-up viewing reminder module.

[0154] In the technical solution provided in the embodiment of the present application, when the close-up viewing reminder function is turned on, if the camera is assigned to the home camera or other functional modules, after the home camera or other functional modules release the camera, the smart screen will reallocate the camera to the close-up viewing reminder module. In this way, the close-up viewing reminder module can promptly regain the right to use the camera after the camera is released, so as to implement the close-up viewing reminder function. At the same time, when the camera is occupied by other functional modules, the close-up viewing reminder module does not need to continuously try to open the camera, which can avoid wasting CPU resources.

[0155] In the above embodiments, the close-up viewing reminder module is started first, and the home camera function module is started later. In other embodiments, the close-up viewing reminder module may also be started after the home camera function module is started. That is to say, before the close-up viewing reminder module is started, the smart screen has assigned the camera to the home camera function module, and when the close-up viewing reminder module is started, the camera is in an occupied state. At this time, the close-up viewing reminder module can first start the close-up viewing reminder function module in the background, but because the camera is occupied, the close-up viewing reminder function cannot remind normally. At the same time, the close-up viewing reminder module can request to register a camera release callback function, so that after the camera is released, the smart screen sends a notification message that the camera is released to the close-up viewing reminder module by calling the camera release callback function.

[0156] Please refer to Figure 4B , is a flow chart of a camera allocation method provided in an embodiment of the present application. The method includes S301-S309. Among them:

[0157] S301. Smart screen starts.

[0158] S302. The smart screen obtains the startup operation for the home camera function module.

[0159] S303. In response to the startup operation for the home camera function module, the smart screen assigns the camera to the home camera function module.

[0160] S304. The smart screen obtains the startup operation for the close-range viewing reminder function module.

[0161] S305. In response to the startup operation of the close-up viewing reminder module, the smart screen starts the close-up viewing reminder function.

[0162] As can be seen from the description of the above embodiment, the current camera is occupied by the home camera function module, and the close-up viewing reminder module cannot obtain the right to use the camera, so the close-up viewing reminder function cannot be used normally. Therefore, the close-up viewing reminder module can first register the camera release callback function, that is, the close-up viewing reminder module initiates a registration request for the camera release callback function. In some embodiments, after S304, if it is detected that the current camera is occupied, the close-up viewing reminder module can initiate a registration request for the camera release callback function.

[0163] S306. The smart screen adds a close viewing reminder module to register the camera release callback function.

[0164] It should be noted that the above S307 may specifically include: the smart screen receives a registration request for the camera release callback function initiated by the close viewing reminder module; in response to the registration request, the smart screen adds a registration record of the camera release callback function by the close viewing reminder module.

[0165] S307. The smart screen obtains the exit operation for the home camera function module.

[0166] S308. In response to the exit operation on the home camera function module, the smart screen releases the camera from the home camera function module.

[0167] S309. The smart screen calls the camera release callback function and assigns the camera to the close viewing reminder module based on the registration record.

[0168] Afterwards, the close viewing reminder module can implement the close viewing reminder function based on the camera.

[0169] The specific implementation of S301-S309 can refer to the description in the embodiments of S201-S210, which will not be elaborated here.

[0170] In the technical solution provided in the embodiment of the present application, if the user starts the close-up viewing reminder function module after the camera is assigned to the home camera or other functional modules, the close-up viewing reminder module cannot directly obtain the right to use the camera. At this time, while starting the close-up viewing reminder function module, the close-up viewing reminder module registers the camera release callback function. In this way, the close-up viewing reminder module can promptly perceive that the camera is released after the camera is released, call the camera in time, and obtain the right to use the camera, so as to realize the close-up viewing reminder function. At the same time, when the camera is occupied by other functional modules, the close-up viewing reminder module does not need to continuously try to open the camera, which can avoid the waste of CPU resources.

[0171] Further, the following describes the interaction between the functional modules in the electronic device. Figure 4C , which is a flow chart of the camera allocation method provided in an embodiment of the present application. In this embodiment, the electronic device is a smart screen, the first functional module is a close-up viewing reminder module, and the second functional module is a home camera functional module. It should be understood that in other embodiments, the first functional module and the second functional module can also be other functional modules. The method includes S401-S413, wherein:

[0172] S401. In response to an operation of turning on the close-up viewing reminder function, the close-up viewing reminder module sends a camera call instruction to the camera function module.

[0173] In some embodiments, the close-up viewing reminder function may be a function module in the children's mode application. Figure 1D In some other embodiments, the close-up viewing reminder function may also be an independent application, or may also be a small program.

[0174] In the case where the close viewing reminder module is a functional module in a certain application, the application may be a child mode application. In combination with the above description, it can be seen that if the user sets the close viewing reminder function to be turned on in advance in the child mode, then as long as the user turns on the child mode, the close viewing reminder module will be automatically turned on. Therefore, in some embodiments, if the close viewing reminder function of the child mode is turned on by default, then the above S401 may also include: in response to the turning on operation of the child mode, when the close viewing reminder function is turned on, the close viewing reminder module sends a camera call instruction to the camera function module.

[0175] As can be seen from the description of the above embodiments, in some embodiments, the camera function module includes a camera server module and a camera HAL module of the HAL layer. In this embodiment, the close-up viewing reminder module in S401 may specifically send a camera call instruction to the camera server module.

[0176] It should be noted that the operation of turning on the close-up viewing reminder function in the above S401 can also be understood as the operation of turning on or starting the close-up viewing reminder module.

[0177] S402. The camera function module responds to the camera calling instruction and starts the camera.

[0178] As can be seen from the description of the above embodiments, in some embodiments, the camera function module includes a camera server module of the framework layer and a camera HAL module of the HAL layer. In this embodiment, the above S402 may specifically include: in response to the camera call instruction, the camera server module starts the camera through the camera HAL module.

[0179] In some embodiments, after receiving the camera call instruction sent by the close-up viewing reminder module, the camera function module can first determine whether the current camera is in an idle state. If it is determined that the camera is in an idle state, it means that the camera can be called, and the camera function module can start the camera in response to the camera call instruction.

[0180] In other embodiments, before receiving the camera call instruction sent by the close-up viewing reminder module, the camera may also be used by other functional modules (such as the third functional module), that is, when receiving the camera call instruction sent by the close-up viewing reminder module, the camera is in an occupied state. In this case, the camera functional module may first notify the third functional module that is using the camera to release the camera, and then start the camera in response to the camera call instruction of the close-up viewing reminder module.

[0181] If, upon receiving the camera call instruction sent by the close-up viewing reminder module, the camera function module detects that the camera is occupied by the third function module, the camera function module may first compare the use priority of the camera by the third function module and the close-up viewing reminder module. If it is determined that the use priority of the camera by the close-up viewing reminder module is higher than the use priority of the camera by the third function module, the camera function module may notify the third function module to release the camera. Afterwards, the camera function module responds to the camera call instruction sent by the close-up viewing reminder module and starts the camera.

[0182] In other embodiments, if the close-up viewing reminder module has a lower priority for using the camera than the third functional module, then the camera call instruction received from the close-up viewing reminder module when the camera is assigned to the third functional module should not be responded to. In other words, when the camera is being used by the third functional module with a higher priority, the close-up viewing reminder function cannot be started normally.

[0183] In the technical solution provided by the embodiment of the present application, when the close-viewing reminder module requests to use the camera, the camera function module can start the camera in response to the camera call instruction sent by the close-viewing reminder module when the current camera is in an idle state or when no other function module with a higher priority for using the camera is currently using the camera. In this way, it can be ensured that the camera is only used by one function module at a time, avoiding the problem of camera resource preemption.

[0184] S403. The camera function module assigns the camera to the close-range viewing reminder module.

[0185] The camera function module allocates the camera to the close-up viewing reminder module, which can also be referred to as the camera function module allocating the camera resources to the close-up viewing reminder module. The camera resources may include the camera's hardware resources and / or software resources.

[0186] S404. The close-viewing reminder module controls the camera and transmits image data to the camera.

[0187] After the camera function module assigns the camera to the close-up viewing reminder module, the close-up viewing reminder module obtains the control and use rights of the camera. At this time, the close-up viewing reminder module can collect images through the camera and analyze whether the viewing distance of the user in the image needs to be reminded.

[0188] Combining the above Figure 3 As can be seen from the description, the close-up viewing reminder module collects images through the camera, and specifically needs to transmit the images between the camera and the close-up viewing reminder module through the camera function module. In some embodiments, the above S404 may specifically include: the close-up viewing reminder module controls the camera to collect images, and the camera sends the images to the camera function module. Afterwards, since the control and use rights of the current camera belong to the close-up viewing reminder module, the camera function module sends the images collected by the camera to the close-up viewing reminder module.

[0189] It can be seen from the above description that, under the premise of turning on the close-up viewing reminder function, the close-up viewing reminder module can control the camera to collect images through the camera function module. In some embodiments, after the close-up viewing reminder module obtains the camera assigned by the camera function module, it sends a first control instruction to the camera through the camera function module, and the first control instruction can be used to control the camera to collect images once every preset time. In other embodiments, the close-up viewing reminder module can also send a second control instruction to the camera through the camera service module every preset time, and the second control instruction is used to instruct the camera to collect an image once. Among them, the preset time can be set to 5 minutes (min), 1 minute, 30 seconds (s), etc. according to actual conditions.

[0190] Furthermore, once the camera completes an image acquisition, it can send the acquired image to the close-up viewing module through the camera function module. Moreover, after the close-up viewing reminder module obtains the image, it can analyze the image to determine whether it is necessary to remind the user of the viewing distance. From the above description, it can be seen that the close-up viewing reminder module analyzes the image to determine the distance between the user's eyes and the display screen of the smart screen in the image. When the distance between the user's eyes and the display screen is close, it is easy for viewing the smart screen to damage the user's eyesight. Therefore, when analyzing the image to determine that the distance between the user's eyes and the display screen is close, the close-up viewing reminder module can remind the user to pay attention to the viewing distance.

[0191] S405. In response to the opening operation of the home camera, the home camera function module sends a camera call instruction to the camera function module.

[0192] In some embodiments, the home camera function may be an independent application. For example, the user may enable the close-up viewing reminder function by: Figure 1C Select the icon 12b corresponding to the home camera in the interface 12 shown to open the home camera application and enter the following Figure 1E The interface 21 of the home camera is shown. In other embodiments, the home camera function may also be a functional module in a certain application, or may also be a small program, etc.

[0193] It can be understood that the above S405 can also be expressed as the camera function module receiving the camera calling instruction sent by the home camera function module, and the camera calling instruction is sent by the home camera function module in response to the opening operation of the home camera.

[0194] S406. The camera function module responds to the camera call instruction and allocates the camera to the home camera function module.

[0195] Since the camera is usually only allowed to be used by one functional module at a time, some electronic devices set different usage priorities for different applications or different functional modules to use the camera. When multiple applications or functional modules request to use the camera at the same time, the camera functional module can decide to allocate the camera to the application or functional module with the highest usage priority among the applications or functional modules that initiate the request, based on the order of the camera usage priorities set in advance.

[0196] In some embodiments, after S405, the camera function module receives the camera call instruction sent by the family camera function module, and the camera function module may first compare the use priority of the camera by the close-up viewing reminder module and the family camera function module. Further, the above S406 may specifically include: in the case where it is determined that the use priority of the family camera for the camera is higher than that of the close-up viewing reminder module, in response to the camera call instruction, the camera is allocated to the family camera function module. Since the use priority of the family camera for the camera is higher than the use priority of the close-up viewing reminder module, when receiving the camera call instruction from the family camera function module, the camera function module allows the family camera to turn on the camera.

[0197] Since the smart screen has assigned the camera to the close viewing reminder module before S406, the camera function module needs to release the camera from the close viewing reminder module before assigning the camera to the home camera function module in response to the camera call instruction of the home camera function module. In some embodiments, the camera function module releases the camera from the close viewing reminder module, which may specifically include: the camera function module sends a third control instruction to the close viewing reminder module, and the third control instruction is used to control the close viewing reminder module to release the camera. Afterwards, the close viewing reminder module may send a camera release instruction in response to the third control instruction to release the camera. In other embodiments, the camera function module releases the camera from the close viewing reminder module, which may also be achieved by other methods, which will not be repeated in the embodiments of the present application.

[0198] In some embodiments, in order to distinguish the camera call instructions sent by the close-up viewing reminder module from those sent by the home camera function module, they can be named "first", "second", etc. For example, the camera call instruction sent by the home camera function module in S406 can be named the third camera call instruction, the camera call instruction in S401 can be named the fourth camera call instruction, and so on.

[0199] S407. The home camera function module controls the camera and transmits image data to the camera.

[0200] It is understandable that after the camera function module assigns the camera to the home camera function module, the home camera function module obtains the control right and the use right of the camera. At this time, the home camera function module can control the camera to perform operations such as shooting and recording.

[0201] In some embodiments, the above S407 may specifically include the home camera function module obtaining the real-time image captured by the camera and displaying the image on the display screen of the smart screen. For example, after the user starts the home camera, the smart screen will enter Figure 1E The interface 21 shown, in which the picture displayed on the display screen of the smart screen 1 is the picture taken in real time by the current camera, which includes a portrait.

[0202] In some other embodiments, the above S407 may also include a home camera function module to control the camera to capture images, record videos, etc. For example, after the user starts the home camera, the smart screen will enter Figure 1E The interface 21 shown in the figure, in which the user can capture an image, i.e. take a photo, by selecting the function option "shoot" option 24 provided by the home camera; or the user can also record a video by selecting the function option "record" option 25 provided by the home camera.

[0203] Furthermore, after the user uses the home camera to shoot images or record videos through the camera through the options provided by the home camera, the images and videos shot by the camera can be stored in a preset designated path. Figure 1E The "Gallery" option in the interface shown is used to view the captured images and recorded videos.

[0204] It should be understood that in other embodiments, the home camera function module transmits image data with the camera and can also be used for other functions.

[0205] S408. In response to the exit operation of the home camera, the home camera function module sends a camera release instruction to the camera function module.

[0206] For example, the user's exit operation on the home camera may be as follows: Figure 1E In the interface 21 shown, select the "Exit" option. Usually, when the user chooses to exit the home camera, it means that the home camera will exit the use of the camera, and the home camera function module releases the camera. Therefore, in S408, when the smart screen detects the user's exit operation on the home camera, the home camera function module sends a camera release instruction to the camera function module to instruct the home camera function module to release the camera.

[0207] It should be noted that the above-mentioned opening and exiting operations of the close-viewing reminder module function and the home camera can be operated by the user. Alternatively, the above-mentioned opening and exiting operations can also be automatically triggered by the smart screen based on other instructions (such as timing instructions, calling instructions of other functional modules, etc.).

[0208] S409. In response to the camera release instruction, the camera function module releases the camera from the home camera function module.

[0209] S410. The camera function module sends a first notification message to the close-range viewing reminder module.

[0210] In the embodiment of the present application, since the user has turned on the close-up viewing reminder function before turning on the family camera, after the family camera exits the use of the camera, the close-up viewing reminder module should be restored to use the camera to continue to remind the user of the viewing distance. Therefore, in order to enable the close-up viewing reminder module to perceive the message that the camera has been released as soon as possible, in the embodiment of the present application, after detecting the user's exit operation on the family camera, the camera function module actively sends a first notification message to the close-up viewing reminder module. The first notification message is used to inform the close-up viewing reminder module that the current camera has been released and returned to an idle state, so that the close-up viewing reminder module can re-call the camera and implement the close-up viewing reminder function.

[0211] It can be understood that S410 can also be represented as the close-range viewing reminder module receiving the first notification message from the camera function module.

[0212] In some embodiments, after executing S409 to release the camera, the camera function module may query whether the close-up viewing reminder function is turned on. If the close-up viewing reminder function is found to be turned on, the camera function module executes S410 to send a first notification message to the close-up viewing reminder module.

[0213] In some embodiments, the camera function module can directly interact with the close-up viewing reminder module to obtain whether the close-up viewing reminder function is in an on state. Exemplarily, after executing S409 to release the camera, the camera function module sends a query request to the close-up viewing reminder module, then receives a response result returned by the close-up viewing reminder module, and determines whether the close-up viewing reminder function is in an on state according to the response result.

[0214] In other embodiments, the close-up viewing reminder function is in a closed state, and the close-up viewing reminder module may not be able to receive a query request or respond to the query request. Therefore, in this embodiment, the camera function module may also send a query request to the close-up viewing reminder module after executing S409 to release the camera, and determine whether the close-up viewing reminder function is in an open state based on whether a response message returned from the close-up viewing reminder module is received within a preset time period. Further, if a response message returned by the close-up viewing reminder module is received within a preset time period, it indicates that the close-up viewing reminder function is in an open state. If no response message returned by the close-up viewing reminder module is received within a preset time period, it indicates that the close-up viewing reminder module is in a closed state.

[0215] In addition to interacting with the close viewing reminder module to obtain the status of the close viewing reminder function, the smart screen can also set an identifier to indicate whether the close viewing reminder function is turned on. Exemplarily, after the smart screen starts the close viewing reminder function, the smart screen can set the identifier to 1 to indicate that the close viewing reminder function is in the on state; after turning off the close viewing reminder function, the smart screen can set the identifier to 0 to indicate that the close viewing reminder function is in the off state. Furthermore, after the camera function module executes S409 to release the camera, it can be determined whether the close viewing reminder function is in the on state by querying the value of this identifier.

[0216] In the technical solution provided in the embodiment of the present application, after the camera function module releases the camera, if it detects that the close-up viewing reminder function is turned on, the camera function module sends a first notification message to the close-up viewing reminder module, so as to notify the close-up viewing reminder module that the camera has been released, so that the close-up viewing reminder module can re-call the camera as soon as possible to restore the close-up viewing reminder function.

[0217] It is understandable that the above-mentioned close-viewing reminder module can also be replaced by other modules that use the camera to implement the corresponding function. That is, after executing S409 to release the camera by the home camera function module, the camera function module inquires whether there is a function that needs to be implemented by the camera in an on state, and then the camera function module responds to the camera release instruction and sends a first notification message that the camera is released to the function module corresponding to the function.

[0218] In some embodiments, the camera function module in S410 sends a first notification message to the close-up viewing reminder module, which can be triggered to send the first notification message to the close-up viewing reminder module after the camera is released. Further, the triggering of sending the first notification message to the close-up viewing reminder module can be implemented by calling the camera release callback function after the camera is released. Among them, the registration process of the camera release callback function and the specific implementation process of the camera function module calling the camera release callback function after the camera is released can refer to the detailed description of the following embodiments, which will not be repeated here.

[0219] S411. The close-viewing reminder module sends a camera call instruction to the camera function module based on the first notification message.

[0220] Since the first notification message indicates that the current camera has been released, the close-up viewing reminder module can call the camera again after receiving the first notification message to implement the close-up viewing reminder function. In an embodiment of the present application, the close-up viewing reminder module sends a camera call instruction to the camera function module again after receiving the first notification message from the camera function module. In some embodiments, in order to distinguish it from other camera call instructions, the camera call instruction sent by the close-up viewing reminder module in S411 can be named a second camera call instruction.

[0221] S412. The camera function module responds to the camera call instruction and assigns the camera to the close-range viewing reminder module.

[0222] It can be seen from the description of the above embodiment that in S409 the camera function module releases the camera in response to the camera release instruction of the home camera function module. Therefore, before the camera function module assigns the camera to the close viewing reminder module in S412, it is necessary to restart the camera first and then assign the camera to the close viewing reminder module.

[0223] S413. The close-viewing reminder module controls the camera and transmits image data to the camera.

[0224] At this point, the close-viewing reminder module regains control and use rights of the camera. Afterwards, the close-viewing reminder module can obtain images collected by the camera through the camera function module, and analyze the images to determine whether it is necessary to remind the user of the viewing distance.

[0225] In the camera allocation method provided in the embodiment of the present application, under the premise that the close-up viewing reminder module uses the camera for close-up viewing reminders, if the camera is preempted by functional modules such as the home camera, when the functional modules such as the home camera exit the use of the camera, the camera functional module will send a first notification message to the close-up viewing reminder module. In this way, the close-up viewing reminder module can promptly perceive that the camera has been released. Afterwards, the close-up viewing reminder module can promptly re-call the camera to continue monitoring and reminding the user's viewing distance. Avoid the problem of being unable to restore the close-up viewing reminder in time when the close-up viewing reminder is turned on and then exiting the home camera functional module. At the same time, it can also avoid the problem of CPU resource waste caused by the close-up viewing reminder module constantly polling and trying to open the camera during the use of the home camera, thereby improving the performance of the smart screen.

[0226] As can be seen from the description of the above embodiment, the above S410 can be implemented by calling the camera release callback function. The camera release callback function is registered and generated by the close-up viewing reminder module. In some embodiments, the close-up viewing reminder module can register the camera release callback function immediately after starting. Please refer to Figure 5 After the smart screen detects that the user turns on the close-up viewing reminder function, the method may further include S501:

[0227] S501. The close-viewing reminder module registers a camera release callback function.

[0228] The camera release callback function may be used to call the camera release callback function after the camera is released, and to trigger the function module that has registered the camera release callback function to send a first notification message that the camera is released.

[0229] In some embodiments, after the close viewing reminder module registers the camera release callback function, the smart screen can add a registration record of the close viewing reminder module for the camera release callback function. Afterwards, after the camera is released by other functional modules, the camera service module can trigger the call of the camera release callback function, and based on the registration record, send a notification message to the functional module that has registered the camera release callback function. That is to say, in an embodiment of the present application, after the close viewing reminder module registers the camera release callback function, if the camera is released by other functional modules, the camera functional module will trigger the call of the camera release callback function. According to the registration record, it can be determined that the close viewing reminder module has registered the camera release callback function. Therefore, calling the camera release callback function will send a notification message to the close viewing reminder module that the camera has been released.

[0230] Furthermore, in some embodiments, the close-up viewing reminder module registers a camera release callback function, and specifically, the close-up viewing reminder module registers a camera release callback function in the HAL layer.

[0231] Further, such as Figure 6 As shown, the above S501 may specifically include S501 a and S501 b:

[0232] S501 a. The close-viewing reminder module sends a registration request for a camera release callback function to the HIDL camera interface service module.

[0233] The HIDL camera interface service module is a camera interface service module (HIDL service camera proxy, hereinafter referred to as HIDL camera interface service module) in the hardware abstraction layer interface definition language service. It can be understood that the above S501a can also be understood as the HIDL camera interface service module receiving the registration request for the camera release callback function sent by the close-up viewing reminder module.

[0234] S501 b. In response to the registration request, the HIDL camera interface service module adds a registration record of the close-viewing reminder module for the camera release callback function.

[0235] In an embodiment in which the close viewing reminder module registers a camera release callback function, after the camera function module is released from the cameras of other function modules, the camera release callback function can be called to enable the camera function module to send a first notification message to the close viewing reminder module.

[0236] It should be noted that the above S501 can be executed after S401 and S402, or before S401 and S402, or S401, S402 and S501 can be executed synchronously. In the embodiment of the present application, the execution order of S401, S402 and S501 is not explicitly limited.

[0237] In combination with the above S501 in the embodiment of the present application, it can be known that after the close-viewing reminder module is started, the camera release callback function is registered. Therefore, after the camera is released from the home camera function module in S409, the camera function module can call the camera release callback function to send a first notification message to the close-viewing reminder module based on the registration record. Please continue to refer to Figure 5 The above S410 may specifically include S410a:

[0238] S410a. The camera function module triggers the call of the camera release callback function, and sends a first notification message to the close-up viewing reminder module based on the registration record.

[0239] In the embodiment where the close-viewing reminder module registers the camera release callback function in the HIDL camera interface service module, please continue to refer to Figure 6 , the above S410a may specifically include S601 and S602:

[0240] S601. The camera function module sends a second notification message to the HIDL camera interface service module.

[0241] The second notification message is used to notify the HIDL camera interface service module that the camera is released. Therefore, after receiving the second notification message, the HIDL camera interface service module can call the camera release callback function to send the first notification message to the close-up viewing reminder module based on the registration record.

[0242] In some embodiments, the above S410a may specifically be that the camera HAL module in the camera function module sends the second notification message to the HIDL camera interface service module.

[0243] S602. The HIDL camera interface service module responds to the second notification message, calls the camera release callback function, and sends a first notification message to the close viewing reminder module based on the registration record.

[0244] It can be seen from the description of the above embodiment that the second notification message is used to notify the HIDL camera interface service module that the camera is released. Therefore, after receiving the second notification message, the HIDL camera interface service module can call the camera release callback function to trigger the sending of the first notification message to the close viewing reminder module.

[0245] In some embodiments, for the camera function module, before the camera is released, it may not be clear whether there are any function modules that have registered the camera release callback function, or which function modules have registered the camera release callback function. Therefore, before the camera function module sends the second notification message to the HIDL camera interface service module, the camera function module can first query in the registration record which function modules have registered the camera release callback function. Afterwards, after the camera is released, the camera function module can send a first notification message to the function modules that have registered the camera release callback function. In an embodiment of the present application, the close-up viewing reminder module registers the camera release callback function after startup. Therefore, in this embodiment, the camera function module can send a second notification message to the HIDL camera interface service module so that the HIDL camera interface service module sends a first notification message to the close-up viewing reminder module.

[0246] Specifically, in some embodiments, after releasing the camera from the home camera function module, the camera function module may query the HIDL camera interface service module to find out which function modules have registered the camera release callback function.

[0247] In the embodiment of the present application, after the close-up viewing reminder module is started, a camera release callback function is registered. After the camera is released, the camera function module can call the camera release callback function. After the camera release callback function is called, a first notification message can be triggered to be sent to the close-up viewing reminder module, so that the close-up viewing reminder module can perceive the message that the camera is released in time, so that the close-up viewing reminder module can timely call the camera again to restore the close-up viewing reminder function.

[0248] In combination with the description of the above embodiment, it can be seen that if the camera is in an idle state when the close-up viewing reminder function is activated, the camera will be assigned to the close-up viewing reminder module, that is, Figure 4C S403 and S404 shown. After that, the home camera is started, which will seize the control and use rights of the camera, resulting in a temporary interruption of the close-up viewing reminder module. Therefore, in some embodiments, the close-up viewing reminder module can register the camera release callback function when the camera is seized, so that when the home camera function module exits the use of the camera, it can call the camera release callback function to notify the close-up viewing reminder module of the camera being released. This ensures that the close-up viewing reminder module can re-call the camera in time and restore the close-up viewing reminder function.

[0249] As can be seen from the above embodiments, the process in which the close-viewing reminder module is seized by the family camera function module from the control and use right of the camera may specifically include releasing the camera from the close-viewing reminder module, and then the camera function module assigning the camera to the family camera function module. Figure 7 As shown, S406 may specifically include S406a-S406c:

[0250] S406a. The camera function module sends a third control instruction to the close-range viewing reminder module in response to the camera call instruction.

[0251] S406b. In response to the third control instruction, the close-up viewing reminder module releases the camera.

[0252] At the same time, after the close-up viewing function module releases the camera, the close-up viewing reminder module can register the camera release callback function, such as Figure 7 S701 shown:

[0253] S701. The close-viewing reminder module registers a camera release callback function.

[0254] It should be noted that the above S701 can be executed before S406b, or after S406b, or S701 and S406b can be executed at the same time. In the embodiment of the present application, the execution order of S701 and S406b is not limited.

[0255] S406c. The camera function module assigns the camera to the home camera function module.

[0256] Understandably, in Figure 7 In the illustrated embodiment, when the home camera exits the use of the camera, the camera function module can send a first notification message to the close viewing reminder module by triggering a call back function to release the camera.

[0257] In the technical solution provided in the embodiment of the present application, when the close-viewing reminder module is started, if the camera is in an idle state, it can immediately obtain the control and use rights of the camera. Afterwards, the camera is assigned to other functional modules such as a home camera, and the camera of the close-viewing reminder module is preempted, and the close-viewing reminder function will be temporarily interrupted. At this time, when the close-viewing reminder module releases the camera, it can register a camera release callback function, so that the camera function module can call the camera release callback function after other functional modules exit the use of the camera to notify the close-viewing reminder module of the news that the camera has been released. Thereby, it can also be ensured that the close-viewing reminder module promptly calls the camera again, and the close-viewing reminder function is restored in time.

[0258] In addition, in the embodiment where the camera function module sends the first notification message to the close-up viewing reminder module by triggering and calling the camera release callback function, if the camera has been assigned to other function modules (such as the third function module, etc.) before the close-up viewing reminder function is activated, and the close-up viewing reminder module has a lower priority for using the camera than the third function module. In response to the activation operation of the close-up viewing reminder function, the close-up viewing reminder function can be activated first, but because the camera is occupied by other function modules, the close-up viewing reminder function cannot be implemented normally at this time.

[0259] In order for the close-up viewing reminder module to call the camera in time to implement the close-up viewing reminder function when the third functional module exits the use of the camera, although the camera cannot be used, the close-up viewing reminder module can first register the camera release callback function. In this way, when the third functional module exits the use of the camera, the camera functional module can also trigger the call of the camera release callback function in time, and send a first notification message to the close-up viewing reminder module based on the registration record. After receiving the first notification message, the close-up viewing reminder module can call the camera in time to implement the close-up viewing reminder function.

[0260] In some embodiments, the third functional module may be a functional module related to video calls, etc. It is understandable that the third functional module may also be replaced by the above-mentioned home camera functional module.

[0261] In some embodiments, Figure 8 As shown, it is a schematic diagram of the software architecture of the smart screen provided in the embodiment of the present application, which shows the functional modules related to the camera allocation method proposed in the embodiment of the present application, and the data flow between the various functional modules.

[0262] exist Figure 8 In the illustrated embodiment, the camera function module can be specifically divided into: a camera service module located at the application framework layer, and a camera hardware abstraction module located at the hardware abstraction layer.

[0263] Combination Figure 8 The following is a description of the complete process of the camera allocation method provided in the embodiment of the present application. Please refer to Fig. 9 In this embodiment, the close-viewing reminder module is a function of the child mode application (APK), and the family camera function is a family camera application.

[0264] First, the user turns on the smart screen's child mode. After that, the child mode determines whether the close viewing reminder function is turned on. After detecting that the child mode has turned on the close viewing reminder function, the child mode registers the camera release callback function in the HIDL servicecamera proxy. In addition, the child mode starts the camera (camera HAL) through the camera server module. After that, the child mode obtains image data through the camera HAL, analyzes the image data to monitor the user's viewing distance, and reminds the user when the viewing distance is detected to be too close.

[0265] Then, the user turns on the smart screen's home camera. After the home camera is turned on, it will take over the control and use of the camera. At this time, the close-up viewing reminder function of the child mode will be temporarily interrupted.

[0266] After that, the user turns off the family camera. During the process of turning off the family camera, the family camera will release the camera through cameraserver control. After the camera is released, cameraHalf calls the camera release callback function from the HIDL service cameraproxy, triggering the first notification message to be sent to the child mode to notify the child mode that the camera has been released.

[0267] After receiving the first notification message, the child mode can re-read and call the camera through the camera server module, and obtain the image collected by the camera for analysis. After that, the user's viewing distance can be continuously monitored and reminded according to the result of the image analysis.

[0268] Fig.10 A flowchart of a method for allocating cameras provided in an embodiment of the present application. In this embodiment, the user first turns on the child mode, and the child mode will obtain whether the close-up viewing reminder function is turned on in the saved records. If the close-up viewing reminder module is not turned on, the user can manually turn on the close-up viewing reminder function in the function setting interface of the child mode. After detecting that the close-up viewing reminder function is turned on, the close-up viewing reminder module can register the camera release callback function in the HIDLservice camera proxy.

[0269] Afterwards, it can be determined that the camera is available. If the camera is available when the child mode is turned on (or the close viewing reminder function is turned on), the camera can be directly assigned to the close viewing reminder module. Afterwards, the close viewing reminder module can obtain the image captured by the camera and analyze the image to determine the user's viewing distance. And, when the image analysis determines that the user's viewing distance is too close, the user is reminded.

[0270] If the camera is not available when the child mode is turned on (or the close-up viewing reminder function is turned on), you need to wait for the HIDL service camera proxy to call the camera release callback function to send a notification message that the camera has been released. After determining that the notification message of the camera being released has been received, the close-up viewing reminder module can call the camera, and the smart screen can also assign the camera to the close-up viewing reminder module. After that, the close-up viewing reminder module can obtain the image captured by the camera for analysis, and monitor and remind the user's viewing distance based on the results of the image analysis.

[0271] After detecting that the camera is released, the camera HAL will send a notification message to the HIDL service cameraproxy. After receiving the notification message, the HIDL service camera proxy will call the camera release callback function and send a notification message of the camera being released to the close viewing reminder module that has registered the camera release callback function.

[0272] Furthermore, in the process where the close-viewing reminder module obtains the image captured by the camera and monitors and reminds the user of the close viewing distance based on the results of image analysis, the right to use the camera may be preempted by other functional modules. Since the close-viewing reminder module registers the camera release callback function when the close-viewing reminder function is turned on. Therefore, after detecting that the camera is preempted, the close-viewing reminder module can detect whether it has received the notification message of the camera being released sent by the HIDLservice camera proxy. And after receiving the notification message of the camera being released, the camera is called again to obtain the image captured by the camera and restore the close-viewing reminder function.

[0273] Some other embodiments of the present application provide a computer device, which may be the above-mentioned electronic device (such as smart screen 1). The computer device may include: a memory and one or more processors. The memory is coupled to the processor. The memory is also used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the computer device may execute the various functions or steps performed by the smart screen 1 in the above-mentioned method embodiment. When the computer device is an electronic device, its structure can refer to Figure 2A The structure of the electronic device 100 is shown.

[0274] The present application also provides a chip system, such as Fig.11 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as the memory of a computer device). For another example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read the instructions stored in the memory and send the instructions to the processor 1101. When the instruction is executed by the processor 1101, the computer device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0275] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as the smart screen 1), the electronic device executes each function or step executed by the smart screen 1 in the above-mentioned method embodiment.

[0276] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the smart screen 1 in the above method embodiment. The computer may be an electronic device, such as the smart screen 1.

[0277] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0278] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0279] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0280] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0281] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0282] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A camera allocation method, characterized in that: The method is applied to an electronic device, the electronic device comprising a camera, and a first functional module and a second functional module supporting the use of the camera to implement corresponding functions; The first function corresponding to the first function module is in an enabled state, and the camera is currently assigned to the second function module; the method includes: Acquire a third operation for the first functional module; In response to the third operation, starting the first function and assigning the camera to the first functional module; Acquire a second operation for the second functional module; Based on the fact that the use priority of the second functional module for the camera is higher than the use priority of the first functional module for the camera, in response to the second operation, allocating the camera to the second functional module; Wherein, after acquiring the third operation for the first functional module, or after allocating the camera to the second functional module in response to the second operation, the method further comprises: the first functional module initiating a registration request for registering a camera release callback function; in response to the registration request, adding a registration record of the first functional module for the camera release callback function; Acquire a first operation for the second functional module; In response to the first operation, releasing the camera from the second functional module and assigning the camera to the first functional module; The allocating the camera to the first functional module comprises: After releasing the camera from the second functional module, calling the camera release callback function, and sending a notification message of the camera being released to the first functional module based on the registration record of the camera release callback function; The first functional module sends a first camera calling instruction to the camera based on the notification message; Based on the first camera calling instruction, the camera is assigned to the first functional module.

2. The method according to claim 1, characterized in that The electronic device further includes a camera function module, and in response to the first operation, releasing the camera from the second function module includes: The camera function module releases the camera from the second function module in response to the first operation; The calling of the camera release callback function and sending a notification message of the camera being released to the first functional module based on the registration record of the camera release callback function include: the camera functional module triggers sending a notification message of the camera being released to the first functional module; The first function module sends a first camera calling instruction to the camera based on the notification message, including: the first function module sends the first camera calling instruction to the camera function module based on the notification message; The allocating the camera to the first functional module based on the first camera calling instruction includes: in response to the first camera calling instruction, the camera functional module allocating the camera to the first functional module.

3. The method according to claim 1, characterized in that In response to the second operation, allocating the camera to the second functional module includes: In response to the second operation, the camera is released from the first functional module, and the camera is allocated to the second functional module.

4. The method according to any one of claims 1 to 3, characterized in that The first functional module includes a close-up viewing reminder module; After assigning the camera to the first functional module, the method further includes: The close-viewing reminder module obtains the image captured by the camera; The close-viewing reminder module analyzes the image and reminds the user of the viewing distance according to the result obtained by analyzing the image.

5. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a camera; the memory and the camera are respectively coupled to the processor; The camera is used to capture images; the memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1 to 4.

6. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Resource allocation method and electronic equipment

    CN103106117A