WO2023015956A1 - 控制摄像头的方法、电子设备及计算机可读存储介质 - Google Patents

控制摄像头的方法、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2023015956A1
WO2023015956A1 PCT/CN2022/089557 CN2022089557W WO2023015956A1 WO 2023015956 A1 WO2023015956 A1 WO 2023015956A1 CN 2022089557 W CN2022089557 W CN 2022089557W WO 2023015956 A1 WO2023015956 A1 WO 2023015956A1
Authority
WO
WIPO (PCT)
Prior art keywords
camera
priority
information
service
application
Prior art date
Application number
PCT/CN2022/089557
Other languages
English (en)
French (fr)
Inventor
武文斌
吴洋
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2023015956A1 publication Critical patent/WO2023015956A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Definitions

  • the present application relates to the field of terminal technology, and in particular to a method for controlling a camera, electronic equipment, and a computer-readable storage medium.
  • An electronic device usually includes multiple processes, and different processes in the multiple processes can implement different services.
  • the multiple processes include application program processes, always on (always on, AO) service processes, and the like.
  • the AO service also known as smart perception service
  • the AO service implemented by the AO service process means that if the electronic device detects the opportunity to perform human eye detection, it will turn on the front camera for human eye detection. It is determined that when the user is looking at the screen, the corresponding service is executed according to the scene involved in the AO service. For example, in the case where the AO service includes gazing at the non-stop screen scene, if the user's operation on the electronic device is not detected within a period of time, the front camera is automatically turned on to perform face detection and eye gaze algorithm. Calculate to determine whether the user is watching the screen, and when it is determined that the user is watching the screen, keep the screen on.
  • the present application provides a method for controlling a camera, an electronic device, and a computer-readable storage medium, which solves the problem of camera usage conflict between two processes in the prior art.
  • a method for controlling a camera comprising:
  • the second process requests to open the target camera
  • the system priority of the second process in the system priority is higher than the system priority of the first process
  • the adjusting the priority of the system includes:
  • the priority of the first process is arranged before the priority of the second process, so
  • the above process priority information includes custom priority ordering among different processes.
  • the system priority ranking of the first process and the second process is adjusted, so that the final priority ranking can meet the actual needs of the user, thereby improving user experience.
  • the second process request to open the target camera includes:
  • the second process obtains the camera information of the camera that can support the second process to realize the corresponding service
  • the second process issues a second instruction for requesting to open the camera corresponding to the camera information, and the second instruction carries the camera information;
  • the second process requests to open the target camera.
  • the second process issues a second instruction, and carries the determined camera information in the second instruction, so that the electronic device determines that the second process pre-requests to turn on the target camera according to the second instruction.
  • the second instruction further carries second identification information of the second process, for example, the second identification information is a label of the second process.
  • the second process acquires camera information of a camera that can support the second process to implement a corresponding service, including:
  • the second process queries a camera list, the camera list includes a plurality of camera information, and each camera information in the plurality of camera information corresponds to a camera capability;
  • the camera information capable of supporting the second process to implement the camera capability of the corresponding service is determined from the plurality of camera information.
  • the second process determines the camera information that can support the corresponding service by querying the camera capability, so as to generate the second instruction according to the determined camera information.
  • the method also includes:
  • the second process starts a monitoring module, and the monitoring module is used to monitor the state of the camera;
  • the second process monitors the notification that the target camera is turned off through the monitoring module, it determines whether to re-request to turn on the target camera according to business requirements.
  • the monitoring module to monitor the status of the camera, the status of the camera can be perceived in real time, so that the second process can judge whether the camera needs or can be turned on according to the actual business requirements, and the effectiveness of using the camera is improved.
  • the method further includes:
  • the third process requests to open the target camera
  • the second process is an AO service process
  • the third process is an application program process.
  • the AO business process has opened the target camera
  • the application process also requests to open the target camera
  • the priority of the AO service process is lower than the priority of the application process. Therefore, the camera opened by the AO service process is closed, and the camera requested by the application process is opened. In this way, the situation that the camera cannot be turned on when the user needs to use it is avoided.
  • the target camera after opening the target camera according to the request of the third process, it further includes:
  • the second process monitors the notification of the camera status change through the monitoring module.
  • the camera service module after the camera service module opens the camera requested by the application program process, it notifies the AO service process of the change of the camera state. In this way, the AO business process will monitor the status of the camera notified by the camera service module through the monitoring function, so that the AO business process can subsequently determine whether to execute the AO business according to the camera status. For example, in the case where the AO service includes the scene of watching the screen continuously, after the AO service receives the notification of the change of the camera status, although it does not detect that the user is operating the electronic device for a period of time, it is determined that the application process is in progress. The target camera, so human eye detection may not be performed.
  • the first process is an application process
  • the second process is an AO service process
  • the third process is an application process
  • the AO service process is used to detect Perform the specified action when the user looks at the screen.
  • the target camera corresponds to a plurality of camera information
  • each camera information in the plurality of camera information corresponds to a camera capability
  • a physical camera is provided with multiple camera information, so that the physical camera can capture pictures in multiple formats to support different services.
  • a device for controlling a camera includes a camera service module and a first process module, and the first process module is used to run a second process:
  • the camera service module is configured to open the target camera according to the first instruction of the first process
  • the first process module is configured to request to open the target camera
  • the camera service module is configured to determine the system priority of the first process and the second process, and the system priority of the second process in the system priority is higher than that of the first process system priority;
  • the camera service module is configured to adjust the system priority order to obtain the first priority order of the first process and the second process;
  • the camera service module is configured to notify the second process of failure to open the target camera based on the first priority.
  • the camera service module is used for:
  • the priority of the first process is arranged before the priority of the second process, so
  • the above process priority information includes custom priority ordering among different processes.
  • the first process module is used to obtain the camera information of the camera that can support the second process to realize the corresponding service
  • the first process module is configured to issue a second instruction for requesting to open the camera corresponding to the camera information to the camera service module, and the second instruction carries the camera information;
  • the camera service module is configured to determine that the second process requests to open the target camera.
  • the first process module is used for:
  • the camera list includes a plurality of camera information, and each camera information in the plurality of camera information corresponds to a camera capability;
  • the camera information capable of supporting the second process to implement the camera capability of the corresponding service is determined from the plurality of camera information.
  • the first process module is used to start the monitoring module, and the monitoring module is used to monitor the state of the camera;
  • the first process module is configured to detect that the target camera has been turned off through the monitoring module. In the case of a notification, it is determined whether to request to open the target camera again according to business requirements.
  • the device further includes a second process module, the second process module is used to run a third process, the target camera is closed in the first process, and the second process has opened the behind the target camera;
  • the second process module is used to request to open the target camera
  • the camera service module is used to determine the system priority of the second process and the third process, the system priority of the second process is higher than the system priority of the third process;
  • the camera service module is configured to adjust the system priority of the second process and the third process, and obtain the second priority of the second process and the third process;
  • the camera service module is configured to close the target camera that has been opened by the second process based on the second priority order;
  • the camera service module is configured to open the target camera according to the request of the third process.
  • the camera service module opens the target camera according to the request of the third process, it sends a notification of camera state change to the second process;
  • the first process module is configured to monitor the notification of the camera status change through the monitoring module.
  • the first process is an application process
  • the second process is an AO service process
  • the third process is an application process
  • the AO service process is used to detect Perform the specified action when the user looks at the screen.
  • the target camera corresponds to a plurality of camera information
  • each camera information in the plurality of camera information corresponds to a camera capability
  • an electronic device in a third aspect, includes a memory and a processor;
  • the memory is used to store programs that support the electronic device in executing the method described in the first aspect above, and to store data involved in implementing the method described in the first aspect above; the processor is configured to A program stored in the memory is executed.
  • a computer-readable storage medium wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer is made to execute the method described in any one of the above-mentioned first aspects.
  • a computer program product containing instructions, which, when run on a computer, causes the computer to execute the method described in the first aspect above.
  • the second process requests to open the target camera, and determines the system priority of the first process and the second process, and the system priority of the second process in the system priority is higher than that of the first process.
  • the system priorities of the first process and the second process are adjusted to obtain a first priority. In the first priority, the priority of the first process is higher than that of the second process. Therefore, notifying the second process to open the target camera fails. This solves the problem of camera use conflicts between two processes.
  • FIG. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 2 is a software structural block diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another application scenario provided by the embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a method for controlling a camera provided in an embodiment of the present application
  • FIG. 6 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of another method for controlling a camera according to an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 11 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 12 is a schematic flowchart of another method for controlling a camera provided in an embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of an apparatus for controlling a camera provided by an embodiment of the present application.
  • the method provided in the embodiment of the present application may be executed by an electronic device, and the electronic device is configured with a front camera, and the number of the front camera may be one or more.
  • the electronic device is further configured with one or more rear cameras, which is not limited in this embodiment of the present application.
  • one or more application programs may be installed in the electronic device, and each of the one or more application programs can open a camera configured in the electronic device, so as to collect images through the camera.
  • the one or more application programs may include a camera, payment application software, and the like. For example, if the application is a camera, the user can open the front camera through the camera to take a selfie.
  • the electronic device supports the AO service.
  • the electronic device may include, but not limited to, a mobile phone, a tablet computer, an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), Devices such as notebook computers, netbooks, and personal digital assistants (PDAs) are not limited in this embodiment of the present application.
  • a mobile phone a tablet computer
  • an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device an ultra-mobile personal computer (ultra-mobile personal computer, UMPC)
  • UMPC ultra-mobile personal computer
  • Devices such as notebook computers, netbooks, and personal digital assistants (PDAs) are not limited in this embodiment of the present application.
  • FIG. 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components.
  • the illustrated components can be realized in hardware, software or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit, NPU
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input and output
  • subscriber identity module subscriber identity module
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flashlight, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 may be coupled to the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through the Bluetooth headset.
  • the PCM interface can also be used for audio communication, sampling, quantizing and encoding the analog signal.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interface includes camera serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI), etc.
  • the processor 110 communicates with the camera 193 through the CSI interface to realize the shooting function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to realize the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193 , the display screen 194 , the wireless communication module 160 , the audio module 170 , the sensor module 180 and so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100 , and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones and play audio through them. This interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules shown in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is configured to receive a charging input from a charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 can receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 is charging the battery 142 , it can also supply power to the electronic device 100 through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be disposed in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be set in the same device.
  • the wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low-frequency baseband signal is passed to the application processor after being processed by the baseband processor.
  • the application processor outputs sound signals through audio equipment (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent from the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wireless Fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite, etc. applied on the electronic device 100.
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR techniques, etc.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • code division multiple access code division multiple access
  • CDMA broadband Code division multiple access
  • WCDMA wideband code division multiple access
  • time division code division multiple access time-division code division multiple access
  • TD-SCDMA time-division code division multiple access
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a Beidou navigation satellite system (beidou navigation satellite system, BDS), a quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • Beidou navigation satellite system beidou navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
  • the electronic device 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used for processing the data fed back by the camera 193 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin color.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be located in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos in various encoding formats, for example: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG moving picture experts group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, so as 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 saving music, video and other files in the external memory card.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like.
  • the storage data area can store data created during the use of the electronic device 100 (such as audio data, phonebook, etc.) and the like.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • the electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal.
  • the audio module 170 may also be used to encode and decode audio signals.
  • the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .
  • Speaker 170A also referred to as a "horn" is used to convert audio electrical signals into sound signals.
  • Electronic device 100 can listen to music through speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the receiver 170B can be placed close to the human ear to receive the voice.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can put his mouth close to the microphone 170C to make a sound, and input the sound signal to the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 may be provided with two microphones 170C, which may also implement a noise reduction function in addition to collecting sound signals. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions, etc.
  • the earphone interface 170D is used for connecting wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors.
  • a capacitive pressure sensor may be comprised of at least two parallel plates with conductive material.
  • the electronic device 100 determines the intensity of pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device 100 .
  • the angular velocity of the electronic device 100 around three axes may be determined by the gyro sensor 180B.
  • the gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shaking of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip leather case.
  • the electronic device 100 when the electronic device 100 is a clamshell machine, the electronic device 100 can detect opening and closing of the clamshell according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to recognize the posture of the electronic device 100, and be applied to applications such as horizontal and vertical screen switching, pedometer, etc.
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 may measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may use the distance sensor 180F for distance measurement to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100.
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user is holding the electronic device 100 close to the ear to make a call, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, automatic unlock and lock screen in pocket mode.
  • the ambient light sensor 180L is used for sensing ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to application locks, take pictures with fingerprints, answer incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to implement a temperature treatment strategy. For example, when the temperature reported by the temperature sensor 180J exceeds the threshold, the electronic device 100 may reduce the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from being shut down abnormally due to the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also known as "touch panel”.
  • the touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the position of the display screen 194 .
  • the bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the human pulse and receive the blood pressure beating signal. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone, combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vibrating bone mass of the vocal part acquired by the bone conduction sensor 180M, so as to realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.
  • the keys 190 include a power key, a volume key and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • 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 .
  • the motor 191 can generate a vibrating reminder.
  • the motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • touch operations applied to different applications may correspond to different vibration feedback effects.
  • the motor 191 may also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the SIM card interface 195 is used for connecting a SIM card.
  • the SIM card can be connected and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
  • the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards may be the same or different.
  • the SIM card interface 195 is also compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as calling and data communication.
  • the electronic device 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
  • the software structure of the electronic device 100 is exemplarily described by taking an Android system with a layered architecture as an example.
  • FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces.
  • the Android system is divided into five layers, which are application layer, application framework layer, system layer, extension layer, and kernel layer from top to bottom.
  • the application layer can consist of a series of application packages.
  • the application package can include AO perception, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • AO perception is used to perceive the timing of human eye detection according to the service, and notify the AO module in the extension layer.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer can include window managers, content providers, view systems, resource managers, notification managers, etc.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make it accessible to applications.
  • Said data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebook, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on.
  • the view system can be used to build applications.
  • a display interface can consist of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electric device 100 .
  • the management of call status including connected, hung up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify the download completion, message reminder, etc.
  • the notification manager can also be a notification that appears on the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window.
  • prompting text information in the status bar issuing a prompt sound, vibrating the electronic device, and flashing the indicator light, etc.
  • the Android Runtime includes core library and virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application program layer and the application program framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system layer includes camera service module, system library, and Android runtime (Android runtime).
  • the camera service module is used to detect whether there is a camera use conflict between the screen-watching service and other services (such as services implemented by application processes) during the AO service validation process, and determine whether the problem occurs When there is a conflict, the conflict problem is resolved.
  • the application program process is used to run the application program of the application layer.
  • the camera service module can perceive the usage of all cameras in the electronic device, for example, it can perceive which cameras are being opened and which process is used to open these cameras.
  • a system library can include multiple function modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of various commonly used audio and video formats, as well as still 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.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing, etc.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the extension layer includes some content customized by developers according to their own needs.
  • the extension layer is also called a custom layer, or a vendor (developer) layer, or a chip extension layer.
  • the extension layer includes an AO module, and the AO module is used to run the AO business process.
  • the AO module is responsible for enabling or disabling the human eye detection service. In the case of opening the human eye detection service, request the camera service module to open the camera and receive pictures, and then perform human eye detection to realize the AO service.
  • the extension layer also includes a plurality of modules included in a hardware abstract layer (Hardware Abstract Layer, hal).
  • hal Hardware Abstract Layer
  • the hal layer plays an intermediary role, separating hardware and software from each other. The main purpose of this layer is to allow software to run on hardware it was not intended to run on.
  • the multiple modules in the hal layer include but are not limited to at least one of the following modules: bluetooth, camera, and sensors.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver.
  • the workflow of the software and hardware of the electronic device 100 will be exemplarily described below in conjunction with capturing and photographing scenes.
  • a corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into original input events (including touch coordinates, time stamps of touch operations, and other information). Raw input events are stored at the kernel level.
  • the application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Take the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon as an example.
  • the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer.
  • Camera 193 captures still images or video.
  • the electronic device is a mobile phone as an example for illustration.
  • the mobile phone when the user is not operating the mobile phone, if the mobile phone is not performing other services (such as playing video), the mobile phone will automatically turn off the screen after a period of time, which may affect the user experience.
  • the mobile phone if the mobile phone turns on the incoming call ring mode, when the mobile phone receives a call, if the volume of the mobile phone's incoming call is louder, it will cause interference to other users.
  • an AO service is proposed.
  • the AO service can detect whether the user is looking at the screen of the mobile phone, and perform specified operations according to the detection results. For example, in the above-mentioned first scenario, it is determined that the user keeps the screen on when it is determined that the user is looking at the screen. As another example, in the second scenario above, when it is determined that the user is looking at the screen, the volume of the incoming call is automatically reduced.
  • the user can manually enable the AO service in the mobile phone. Please refer to FIG. 3 for example.
  • the user wants to enable the AO service in the mobile phone, he can select the setting option in the mobile phone, as shown in (a) in FIG. 3 .
  • the mobile phone opens the setting page, for example, the setting page is shown in (b) in FIG. 3 .
  • the setting page provides an "accessibility” option, the user clicks the "accessibility” option, and in response to the user's trigger operation on the "accessibility” option, the mobile phone opens the accessibility page, as shown in (c) in Figure 3.
  • the "smart perception” option is included in the auxiliary function page, as shown by 31 in (c) of FIG. 3 .
  • the user can select the "smart perception” option, and in response to the user's trigger operation on the "smart perception” option, the mobile phone opens the smart perception page, as shown in (d) in Figure 3 .
  • the Smart Sensing page includes the items “Gaze at the non-stop screen” and “Gaze at the screen to reduce the volume of incoming calls”. There is a switch corresponding to "Gaze at the non-stop screen", which is used to turn on or off the service of "Gaze at the non-stop screen", and “Gaze at the screen to reduce the volume of incoming calls”. There is a switch corresponding to the "Volume” item, which is used to turn on or off the service of reducing the volume of incoming calls by looking at the screen.
  • the AO service When at least one of the service of watching the non-stop screen service and the service of reducing the volume of incoming calls by watching the screen is turned on, the AO service is turned on.
  • the AO service uses the front camera to collect images during the validation process.
  • the front camera can still be turned on normally.
  • the user wants to take a photo with the front camera, the user can trigger the camera icon in the mobile phone, as shown in (a) in FIG. 4 .
  • the mobile phone turns on the camera, as shown in (b) of FIG. 4 .
  • the phone turns on the front-facing camera by default after detecting a user action on the camera icon.
  • the rear camera is turned on by default.
  • the currently opened interface includes the front camera option 41, when the user When you want to take pictures with the front camera, you can trigger the front camera option 41.
  • the mobile phone turns on the front camera. In this way, the user can take pictures through the opened front camera.
  • the mobile phone has turned on the front-facing camera to take pictures.
  • the AO service pre-opens the front-facing camera, it will fail to open, that is, AO
  • the entry into force of the service will not affect other services to open the front camera.
  • the AO service when the user does not need to use the AO service, the AO service may be turned off on the setting page shown in (d) of FIG. 3 above.
  • the user wants to turn off the non-stop screen service, he manually slides the switch corresponding to the item "Non-stop screen” to the left, and responds to the user's operation of sliding the switch corresponding to the "Non-stop screen” item to the left , the mobile phone turns off the always-on screen service.
  • the user wants to turn off the service of gazing at the screen to reduce the volume of incoming calls manually slide the switch corresponding to the item "Gaze at the screen to reduce the volume of incoming calls" to the left. Operation, turn off the mobile phone and stare at the screen to reduce the volume of incoming calls. In the case that both the non-stop screen watching service and the screen watching the incoming call volume reduction service are turned off, it is determined that the AO service is turned off.
  • the mobile phone can also automatically start the AO service when it detects that the current preset condition is met.
  • the preset conditions can be set according to actual needs. For example, after the mobile phone detects that the user turns on the phone and unlocks the screen, it automatically turns on the service of watching the screen continuously and the service of reducing the volume of incoming calls while watching the screen, so as to automatically turn on the AO service.
  • FIG. 5 is a schematic diagram of a module framework according to an exemplary embodiment, mainly including an AO perception module 51 , an AO module 52 , a camera service module 53 , and an application program module 54 .
  • the AO module 52 is used to run the AO service process
  • the application module 54 is used to run other application processes.
  • FIG. 2 for the position of each module in the software architecture.
  • the camera use conflict involved in the embodiment of the present application includes two scenarios: one scenario is that the application module 54 has opened the front camera, and the AO module 52 pre-opens the front camera; the other scenario is that the AO module 52 has opened the front camera. camera, the application module 54 pre-opens the front camera.
  • one scenario is that the application module 54 has opened the front camera, and the AO module 52 pre-opens the front camera; the other scenario is that the AO module 52 has opened the front camera. camera, the application module 54 pre-opens the front camera.
  • the method for controlling the camera provided by the embodiment of the present application will be introduced for these two scenarios respectively.
  • the interaction process of each module includes:
  • the AO perception module 51 perceives the timing of human eye detection.
  • the electronic device senses the timing of human eye detection through the AO sensing module 51 .
  • the AO perception module 51 perceives the opportunity for human eye detection, it notifies the AO module 52 to execute the AO service, and then enters the following step (2). Otherwise, if the human eye detection timing is not reached, the AO sensing module 51 continues to sense.
  • the AO module 52 determines the camera information 6 of the camera to be turned on.
  • the AO module 52 after receiving the notification from the AO perception module 51, the AO module 52 queries the camera list.
  • the camera list includes multiple camera information, and each camera information corresponds to a camera capability.
  • the AO module 52 determines the camera information of the cameras that can support the AO service according to the camera capability corresponding to each camera information. Exemplarily, the camera information of the cameras that can support the AO service is 6.
  • the camera information in this embodiment of the present application corresponds to a logical concept of a camera.
  • a physical camera may correspond to multiple camera functions, different camera functions in the multiple camera functions can output images in different formats.
  • a front camera can capture 2D RGB (red green blue, red, green and blue) images, and images in common formats. Therefore, for a physical camera, multiple camera information can usually be set correspondingly at the bottom layer.
  • Each camera information in the multiple camera information corresponds to a camera capability of the physical camera. Different camera capabilities are used to indicate the corresponding business scenarios.
  • the camera characteristics used below can also be understood as each camera information corresponds to a logical camera. For example, there are 3 camera information corresponding to the front camera, which are 1, 3, and 6 respectively.
  • the camera capability corresponding to the camera information 6 can capture images required by the AO service, and the camera capability corresponding to the camera information 1 can capture images in common formats.
  • each camera capability can be configured through a camera configuration file, for example, each camera configuration file can be configured in a camera module in the hal layer.
  • the camera information set at the bottom layer can be recorded in the form of a list, and each camera information corresponds to a camera capability, that is, the bottom layer of the electronic device can be set with a camera list, and multiple camera lists are recorded.
  • the camera information, and the camera capability corresponding to each camera information in the plurality of camera information can be recorded in the form of a list, and each camera information corresponds to a camera capability, that is, the bottom layer of the electronic device can be set with a camera list, and multiple camera lists are recorded.
  • the camera information included in a physical camera may correspond to a camera list. It is not difficult to understand that when the electronic device is configured with multiple physical cameras, the electronic device corresponds to multiple camera lists. Exemplarily, assuming that the electronic device includes a front camera and a rear camera, the front camera corresponds to a camera list, and the rear camera corresponds to a camera list. For example, the camera list corresponding to the front camera includes 3 camera information, and the camera list corresponding to the rear camera includes 5 camera information.
  • the electronic device may also use one camera list to record camera information of different physical cameras, that is, there may be only one camera list in the electronic device.
  • the physical camera corresponding to each camera information may be determined according to a preset corresponding rule, and the preset corresponding rule is used to indicate the corresponding relationship between the camera information and the physical camera. For example, if the camera information is any of 1, 3, and 6, the corresponding physical camera is the front camera; if the camera information is any of 0, 2, 4, 5, and 7, the corresponding physical camera is rear camera.
  • camera information exists in the form of a list.
  • camera information may also be recorded in other ways, for example, camera information may also be recorded in a collective manner, which is not limited in this embodiment of the present application.
  • the AO module 52 only stores the camera information of the camera that can realize the AO service, for example, only the camera information 6 is stored, that is, the AO module 52 does not need to query the camera list, and directly obtains the stored camera information , and use the obtained camera information as the camera information of the camera to be opened.
  • the AO module 52 sends a second instruction to the camera service module 53, and the second instruction is used to request the camera service module 53 to open the camera corresponding to the determined camera information.
  • the second instruction may carry the tag and the determined camera information.
  • This label is used to uniquely identify the AO service process running in the AO module 52 .
  • the label of a process is negotiated between the process and the camera service module, so that the process and the camera service module can identify each other's services. This label will not change if the electronic device is replaced or restarted.
  • the tag is used by the camera service module 53 to determine who sent the second command, so that after determining the priority order, it can send a notification of failure to open the camera to the AO business process corresponding to the tag or send a closed AO module 52 Notifications for opened cameras.
  • the tag is also used by the camera service module 53 to subsequently query the priority of the AO business process from the customized process priority information.
  • the format of the second instruction may be a preset format, and the preset format may be set according to actual needs.
  • the second command is opencamera(1_aoservice), wherein, opencamera means to open the camera, 1 in brackets means the camera information of the camera to be opened, and aoservice is a label. Therefore, the meaning of the second instruction is that the AO business process requests to open the camera corresponding to the camera information 1.
  • the AO module 52 sends the second instruction by calling the vndk interface.
  • the camera service module 53 inquires about the application program process that has opened the camera.
  • the camera service module 53 parses the second instruction to determine the meaning of the second instruction. In addition, the carried camera information and tags are analyzed from the second instruction. In addition, in order to determine whether the camera requested to be opened by the AO module 52 conflicts with other opened cameras, the camera service module 53 determines which camera is being opened and which application process is using the opened camera. For example, the camera information of the camera opened by the application process is 6. For another example, the camera information of the camera opened by the application process is 1.
  • the camera service module 53 queries the system priority score of the process.
  • the processes described here include application program processes and AO service processes.
  • the camera service module 53 queries the system priority score of the AO service process according to the process number of the AO service process, and queries the system priority score of the application process according to the process number of the application process.
  • the application program process described here refers to the process that has opened the camera, that is, the process determined in the above step (4).
  • the system priority score of a process changes dynamically with the running status of the process.
  • processes running in the background have a higher system priority score than processes running in the foreground.
  • system priority score of the process running at the bottom layer (also called a resident process) is higher than that of the process running at the application layer.
  • the camera service module 53 determines whether there is a camera usage conflict between the AO business process and the application program process.
  • the camera service module 53 judges whether there is a camera usage conflict between the AO business process and the application process according to the camera information pre-opened by the AO business process and the camera information opened by the application process.
  • the camera information pre-opened by the AO business process is the same as the camera information already opened by the application process, it is determined that there is a camera usage conflict between the AO business process and the application process.
  • the camera information pre-opened by the AO business process and the camera information opened by the application process correspond to the same physical camera (for example, the same front camera), then determine the AO business process and the application process There is a camera usage conflict issue.
  • the camera service module opens the requested camera for the AO module 52.
  • the camera service module carries in the second instruction according to the AO module 52 For camera information, call the corresponding camera configuration file from the hal layer to open the corresponding camera.
  • the camera service module 53 determines the system priority ranking according to the system priority scores of the processes.
  • the system priority sorting is determined according to the system priority score of the AO service process and the system priority score of the application program process.
  • the system priority of the AO business process is higher than that of the application process, so in the system priority ranking, the priority of the AO business process higher than the priority of the application process.
  • the system priority ranking can also be first determined according to the system priority scores of the queried processes, and then Then judge the conflict. At this time, if it is determined that there is a conflict, the following step (8) is performed; otherwise, if it is determined that there is no conflict, the camera service module opens the requested camera for the AO module 52 .
  • the camera service module 53 adjusts the system priority order according to the self-defined process priority information.
  • the system priority of the AO business process is higher than that of the application program process.
  • the AO business process The priority is higher than the priority of the application program process, resulting in the above first scenario, the front camera function of the application program module 54 is turned off, and the front camera function for realizing the AO service is turned on; affecting user experience.
  • the electronic device In the second scenario above, when the user wants to take a selfie, the electronic device cannot turn on the front camera because the AO service is being implemented.
  • the process priority information customized by the electronic device needs to adjust the system priority ranking so that the adjusted priority ranking meets the user's requirements. Actual demand.
  • the user-defined process priority information can be preset by the user according to actual needs, and stored in a designated storage area of the electronic device.
  • the customized process priority information includes priority information of one or more processes, and each priority information in the one or more priority information is used to indicate the priority of the corresponding process.
  • the priority information can be Is the serial number, the smaller the serial number, the higher the priority.
  • the customized process priority information includes the priority information of multiple processes
  • the priority information of different processes can be distinguished by the identification information of the process, wherein the identification information Contains tags or application identifiers, which can be used to uniquely identify an application.
  • the application identifier may be an application package name or an application ID.
  • the customized process priority information exists in the form of a list, that is, a customized priority list may be pre-stored in the electronic device.
  • the customized priority list includes identification information of multiple processes, and the identification information of each process in the multiple processes corresponds to a priority information.
  • the customized priority list is shown in Table 1.
  • the priority of the AO service process is usually set to be the lowest, so as to prevent the AO service from affecting the use of the front camera by other services.
  • aoservice represents the identification information of the AO business process
  • systemserver2d_old represents the identification information of the secure payment process
  • netstat-anpgrep-xj represents the identification information of the camera process.
  • the priority information is a serial number.
  • the priority information may also be other identifiers such as characters, which is not limited in this embodiment of the present application.
  • the customized process priority information includes identification information of processes with low priority, which can be understood as a white list. For example, it includes the label of the AO business process, but does not include the application identifier of the application process. In this case, the priority of the AO business process is determined to be lower than the priority of the application process, that is, the priority in the system priority sorting The sorting is readjusted.
  • the customized process priority also includes identification information of other processes.
  • the AO service process has the lowest priority.
  • the customized process priority information includes the label of the AO business process and the application ID of the application process, and there is a sorting relationship between the label of the AO business process and the application ID of the application process, indicating Prioritization between AO business processes and application processes.
  • the priorities of the AO service process and the application process are determined according to the order of the tags of the AO service process and the application identifications of the application process.
  • the priority of the AO service process is lower than that of the application program process, and at this time, the following step (9) is performed.
  • the camera service module 53 notifies the AO business process of failure to open the camera.
  • the camera service module determines the AO business process according to the label of the AO business process, the application identifier, and the customized process priority information and the priority sorting of the application process, wherein the high priority process in the priority sorting is the process capable of opening the front camera. In this way, the problem of camera usage conflict between the application program process and the AO service is solved.
  • the AO module 52 carries the label of the AO service process in the second instruction as an example for illustration.
  • the camera service module 53 may obtain the tag of the AO business process in other ways.
  • the camera service module 53 may also query the label of the AO service process according to the process number of the AO service process, which is not limited in this embodiment of the present application.
  • the AO module 52 starts the monitoring function after determining the camera information to be turned on (that is, after the above step (2)), so as to monitor the status change notification of all cameras through the monitoring function.
  • the camera service module 53 may notify the AO module 52 after subsequently determining that the application process finishes using the camera. After the AO module 52 monitors this notification through the monitoring function, it can judge whether to request to turn on the camera again according to business requirements. For example, taking the AO service including the non-stop screen service as an example, if no user operation is detected within a period of time, it is determined to request to turn on the camera again.
  • the monitoring function is enabled after determining the information of the camera to be turned on, so that the state of the camera can be perceived in real time, so that the AO module 52 can judge whether it is necessary or possible to turn on the front camera according to actual business needs, which improves the front-facing camera. Availability of camera usage.
  • the camera service module 53 includes multiple sub-modules, and the camera service module 53 realizes the above operations through the interaction of the multiple sub-modules.
  • the multiple submodules include a camera service submodule and a process information service submodule.
  • FIG. 6 is a schematic diagram of an interaction flow of multiple submodules according to an exemplary embodiment.
  • the interaction process includes:
  • the camera service submodule receives a second instruction.
  • the second instruction comes from the AO module 52 .
  • the camera service module provides the AcameraManager submodule in the hal layer, and the AcameraManager submodule provides a calling interface for the underlying process, so that the underlying process can call the provided calling interface when it needs to open the camera, so as to use the
  • the command to open the camera is sent to the AcameraManager submodule, and then forwarded to the camera service submodule by the AcameraManager submodule.
  • the AO module 52 sends the second instruction to the AcameraManager submodule.
  • the AcameraManager submodule verifies the second instruction before forwarding the second instruction.
  • the verification method specifically includes: determining whether the format of the second instruction is a preset format, and determining whether the camera information carried in the second instruction is legal, when the format of the second instruction is a preset format and the camera information carried in the second instruction When it is legal, it is determined that the verification is passed. Otherwise, if the format of the second instruction is not a preset format, and/or the camera information carried in the second instruction is illegal, it is determined that the verification fails.
  • determining whether the camera information carried in the second instruction is legal refers to determining whether the camera information carried in the second instruction belongs to the camera list, and if so, determining that it is legal. If not, it is determined to be illegal.
  • the AcameraManager submodule If the AcameraManager submodule passes the verification of the second instruction, it forwards the second instruction to the camera service submodule, and correspondingly, the camera service submodule receives the second instruction. Otherwise, if the AcameraManager sub-module fails to pass the verification of the second instruction, a notification of failure to open the camera is returned to the AO module 52 .
  • the camera service submodule is a CamerService module.
  • the camera service module provides the AcameraManager submodule at the hal layer as an example to facilitate the underlying process call.
  • the camera service module also provides the cameraManager submodule at the application framework layer, so that the upper application process can call it when the camera is pre-opened, that is, the application process forwards the instruction for requesting to open or close the camera through the cameraManager submodule Process it for the camera service module.
  • the camera service submodule verifies the second command, and parses out the tag.
  • the camera service submodule checks the second instruction again after receiving the second instruction.
  • the verification process of the second instruction by the camera service submodule includes: judging whether the format of the second instruction is a preset format. If the format of the second instruction is a preset format, it is determined that the verification is passed; otherwise, if the format of the second instruction is not a preset format, it is determined that the verification fails.
  • the camera service submodule parses the second instruction to obtain the carried camera information and tag from the second instruction.
  • the camera service submodule calls the handleEvictionLocked code to perform subsequent conflict handling through handleEvictionLocked, which specifically includes the following content. Otherwise, if the verification fails, the AO module 52 is notified of failure to open the camera.
  • the camera service submodule requests the process information service submodule to query the system priority score of the process.
  • the process described here includes the AO service process and the application program process that has opened the camera.
  • the process information service submodule queries the system priority score of the process.
  • the process service information sub-module can query the system priority score of the AO business process according to the process number of the AO business process, and query the system priority of the application process according to the process number of the application process Fraction value.
  • the process information service module queries the system priority scores of the above two processes through the getProcessStatesScoresFromPids code.
  • the process information service submodule returns the system priority score of the process.
  • the process information service submodule sends the queried system priority score to the camera service submodule.
  • the camera service submodule judges whether there is a conflict, and if there is a conflict, go to step 607.
  • the judging manner may refer to step (6) in the above embodiment, which will not be repeated here.
  • the conflict judgment can be implemented by calling the wouldEvict code.
  • the camera service submodule calls the camera configuration file configured at the bottom layer to open the corresponding camera.
  • the camera service submodule determines a rejection request list according to the system priority score of the process.
  • the denial request list includes relevant information of processes with low priority.
  • the related information includes, but is not limited to, identification information of a corresponding process (such as an application identification or a label), and camera information of a pre-opened or opened camera.
  • the reject request list may be defined as evictList.
  • the camera service submodule determines the system priority ranking according to the system priority score of the process, and then determines the rejection request list according to the system priority ranking.
  • the process with the lowest priority in the system priority sorting is an application process
  • the application label of the application process and the camera information of the camera opened by the application process are included in the rejected request list.
  • the rejection request list is empty.
  • the camera service submodule updates the rejection request list according to the customized process priority information.
  • the camera service submodule adjusts the system priority according to the customized process priority information.
  • the priority of the AO business process is lower than that of the application process.
  • the camera service submodule replaces the relevant information of the application process included in the rejection request list with the relevant information of the AO business process.
  • the replaced rejection request list includes the label of the AO business process, the AO pre-request The camera information of the opened camera.
  • the rejected request list can be updated by calling the updateEvictedList code.
  • the camera service submodule handles conflicts.
  • the rejection request list includes information about the process of currently pre-opening the camera, a notification indicating failure to open the camera is returned. Otherwise, if the denial request list includes information about processes that have opened the camera, close the opened camera to disconnect the camera.
  • the camera service submodule feeds back a notification indicating failure to open the camera to the AO module 52 .
  • the method for turning on the camera in the above embodiment will be introduced next by taking the flow chart shown in FIG. 7 as an example.
  • the method is applied to the above-mentioned electronic equipment, and the method may include the following content:
  • the application process has opened the camera.
  • the camera information of the camera opened by the application process is 1.
  • the application program process is a camera process, and the camera process has opened the camera 1 to take pictures.
  • the AO service process pre-requests to turn on the camera.
  • the AO service includes the scene of watching the screen continuously.
  • the AO service process starts to execute the AO service.
  • the AO The business process pre-requests to turn on the camera.
  • the AO service process queries the camera list to determine the first camera information.
  • the AO service process determines camera capabilities capable of supporting the AO service according to camera capabilities recorded in the camera list, and obtains camera information corresponding to the determined camera capabilities from the camera list.
  • the camera information obtained from the camera list is 6, that is, the first camera information is 6.
  • the first camera information mentioned in the embodiment of the present application refers to the camera information determined by the process of pre-requesting to turn on the camera
  • the second camera information refers to the camera information corresponding to the turned on camera
  • the AO service process enables the monitoring function.
  • the AO business process starts the monitoring module to perform the monitoring function through the monitoring module, and the monitoring module is responsible for monitoring the status change notifications of all cameras.
  • the AO service process issues a second instruction to turn on the camera.
  • the second instruction carries the label of the AO service process, and further, the second instruction may also carry the first camera information determined in step 703 .
  • the AO business process sends the second instruction to the camera service module.
  • the camera service module After the camera service module receives the second command, it can determine who issued the second command according to the tag carried in the second command, so that it can be queried from the customized process priority information according to the tag carried in the second command Priority information of the AO business process.
  • the camera service module determines whether there is a conflict.
  • the conflict mentioned here refers to the camera use conflict.
  • the camera service module obtains the camera information of the currently opened camera, and obtains the information of the second camera. Afterwards, the camera service module determines which physical camera the first camera information corresponds to, and determines which physical camera the second camera information corresponds to, so as to determine whether there is a conflict. For example, if the first camera information and the second camera information correspond to the same front camera, that is, the camera pre-opened by the AO business process and the camera opened by the application process are the same front camera, then it is determined that there is conflict.
  • step 707 If it is determined that there is a conflict, enter the following step 707. Otherwise, if there is no conflict, go to step 713 as follows.
  • the camera service module acquires system priority sorting.
  • the camera service module prioritizes the AO business process and the application process according to the system priority of the AO business process and the system priority of the application process to obtain the system priority.
  • the priority of AO business processes is higher than that of application processes.
  • the camera service module adjusts the system priority order according to the user-defined process priority information.
  • the customized process priority information only includes the identification information of processes with low priority, for example, only the label of the AO business process is included in the customized process priority information, and the label of the application process is not included.
  • Application identification at this time, it can be determined that the priority of the AO business process is lower than the priority of the application program process, so in the adjusted system prioritization, the priority of the AO business process is lower than the priority of the application program process.
  • the application process is working normally, but the camera service module notifies the AO business process that it fails to open the camera.
  • the electronic device allows the process with a higher priority to open the camera, so the application process continues to use the currently opened camera, and the AO business process opens the front camera fail.
  • the camera service module determines that the AO business process fails to open the front camera, it sends a failure notification to the AO business process.
  • the AO service receives the failure notification, it is determined that the application process is using the front camera, so it is determined that the front camera cannot be opened currently to implement the AO service.
  • the method further includes steps 710 to 712 as follows.
  • the application process requests the camera service module to turn off the camera.
  • the camera service module closes the camera, and sends a notification of camera status change to the AO business process.
  • the camera status change notification is used to notify the AO business process that the application process has closed the camera.
  • the camera closed by the camera service module mentioned here refers to the camera requested to be closed by the application process.
  • the AO service process opens the camera corresponding to the first camera information.
  • the AO business process opens the front camera corresponding to the camera information 6, so as to output images normally through the front camera.
  • the AO business process closes the front-facing camera after the image is output normally.
  • the application module 54 detects that the camera is pre-opened.
  • the application program process is a camera process.
  • a user's trigger operation on the camera icon in the electronic device it indicates that the user wants to open the camera through the camera. At this time, it indicates that the camera process pre-requests to open the camera.
  • the application module 54 determines the camera information to be opened.
  • the application process determines camera capabilities that can support the application process to implement corresponding services according to the camera capabilities recorded in the camera list, and obtains camera information corresponding to the determined camera capabilities from the camera list.
  • the application program module 54 sends a first instruction to the camera service module 53, where the first instruction is used to request to turn on the camera.
  • the first instruction is used to request the camera service module 53 to open the camera corresponding to the determined camera information.
  • the camera service module 53 inquires about the process of opening the camera and the camera information of the opened camera.
  • the application process that has opened the camera is an AO service process, and the camera information of the opened camera is 6.
  • the camera service module 53 queries the system priority score of the process.
  • the processes described here include AO service processes and application process.
  • the camera service module 53 judges whether there is a camera usage conflict between the AO business process and the application program process.
  • the camera service module 53 determines the system priority ranking according to the system priority scores of the processes.
  • the camera service module 53 adjusts the system priority order according to the self-defined process priority information.
  • steps 805 to 808 For specific implementation of steps 805 to 808, reference may be made to (5) to (8) in the above-mentioned embodiment shown in FIG. 5 .
  • the camera service module 53 closes the camera opened by the AO business process, and opens the camera requested by the application module 54 to open.
  • the camera service module closes the camera that the AO business process has opened, and starts the application The process requests to open the camera to ensure that the application process can normally open the front camera.
  • the camera service module closes the camera opened by the AO business process, and after opening the camera requested by the application program process, notifies the AO business process of the status of the camera.
  • the camera service module sends a change notification to the AO business process, so as to notify the AO business process that the state of the front camera has changed through the change notification.
  • the AO service process cleans up and releases the camera resources used when implementing the AO service.
  • the application module 54 uses the camera.
  • the application program module 54 requests the camera service module 53 to turn off the camera.
  • the application process finishes using the front camera, it requests the camera service module to close the front camera.
  • the camera service module closes the front camera opened by the application process.
  • the camera service module 53 closes the camera.
  • the camera service module 53 notifies the AO module 52 that the camera is turned off.
  • the AO module 52 Since the AO module 52 has enabled the monitoring function, the AO module 52 will monitor the status of the camera through the monitoring function. When the notification of the status change of the front camera is detected, it can be determined that the application process has closed the front camera.
  • the AO module 52 determines whether the camera needs to be turned on again according to service requirements.
  • the AO service includes the scene of watching the screen continuously, when no operation of the electronic device by the user is detected for a period of time, it is determined to turn on the front camera again.
  • the AO module 52 when the AO module 52 has opened the front camera, if the application module 54 also requests to open the front camera, then according to the self-defined process priority information, determine the AO business process and the application process sorted by priority. When the priority of the AO business process is lower than that of the application program process, the camera opened by the AO module 52 is closed, and the camera requested by the application program module 54 is opened.
  • the internal implementation process of the camera service module 53 can refer to the embodiment shown in FIG. 6 above, which will not be repeated here.
  • the method for turning on the camera in the above-mentioned embodiment in FIG. 8 will be introduced through the flow chart shown in 9.
  • the method is applied to the above-mentioned electronic equipment, and the method may include the following content:
  • the camera information of the camera opened by the AO business process is 6.
  • the monitoring function is enabled during the effective process of the AO service, and the monitoring function is used to monitor the notification of the camera status change in the electronic device.
  • the application process pre-requests to open the camera.
  • the application process queries the camera list to determine the information of the first camera.
  • the camera information obtained from the camera list is 1.
  • the application program process issues a first instruction to turn on the camera.
  • the first instruction carries the camera information determined in step 903 .
  • the application process sends the first instruction to the camera service module.
  • the camera service module After receiving the first instruction, the camera service module obtains the application identification of the application process that issued the first instruction, so as to determine the priority information of the application process according to the application identification and the customized process priority information.
  • the camera service module judges whether there is a conflict.
  • the camera service module determines which physical camera the camera information carried in the first instruction corresponds to, and determines which physical camera is currently opened by the application process, so as to determine whether there is a conflict. If the camera pre-opened by the AO business process and the camera already opened by the application process are the same front camera, it is determined that there is a conflict.
  • step 906 If it is determined that there is a conflict, go to step 906 as follows. Otherwise, if there is no conflict, enter the following step 911.
  • the camera service module acquires system priority ordering.
  • the camera service module prioritizes the AO business process and the application process according to the system priority of the AO business process and the system priority of the application process to obtain the system priority.
  • the priority of AO business processes is higher than that of application processes.
  • the camera service module adjusts the system priority order according to the user-defined process priority information.
  • the priority of the AO business process is lower than that of the application process, so in the adjusted priority order, the priority of the AO business process is lower than that of the application process The priority of the application process.
  • the camera service module closes the camera opened by the AO business process, and opens the camera opened by the application process request.
  • the camera service module After the camera service module starts the camera requested by the application program process, it enters the following step 912 . Since the AO business process has enabled the monitoring function, the AO business process will monitor the status of the camera notified by the camera service module through the monitoring function. In this case, it can be determined that the application process is opening the camera.
  • the application process outputs images through the camera.
  • the picture is output normally through the front camera.
  • the application process requests the camera service module to turn off the camera.
  • the application process finishes using the front camera, it requests the camera service module to close the front camera.
  • the camera service module closes the front camera opened by the application process.
  • the camera service module notifies the AO business process of the status of the camera, that is, enters the following step 912 .
  • the AO business process since the AO business process has enabled the monitoring function, the AO business process will monitor the status of the camera notified by the camera service module at this time through the monitoring function. In this case, it can be determined that the application process has turned off the front camera .
  • the application process when the AO business process has opened the front camera, if the application process also requests to open the front camera, then according to the self-defined process priority information, determine the AO business process and the application process. Prioritize. When the priority of the AO business process is lower than that of the application process, close the camera opened by the AO business process, and open the camera requested by the application process.
  • the camera service module opens the requested camera for the application process.
  • the camera service module opens the camera corresponding to the camera information 1 for the application process, so that the application process can normally output images through the camera.
  • the camera service module after the camera service module opens the camera requested by the application program process, it notifies the AO service process of the change of the camera state, that is, enters the following step 912 .
  • the AO business process will monitor the status of the camera notified by the camera service module through the monitoring function, so that the AO business process can subsequently determine whether to execute the AO business according to the camera status. For example, in the case where the AO service includes the scene of watching the screen continuously, after the AO service receives the notification of the change of the camera status, although it does not detect that the user is operating the electronic device for a period of time, it is determined that the application process is in progress.
  • the camera corresponding to camera information 1 is used, so human eye detection may not be performed.
  • the application process After the application process normally outputs the picture, the application process requests the camera service module to close the camera corresponding to camera information 1. In one embodiment, after the camera service module closes the camera opened by the application program process, it notifies the AO business process of the change of the camera state, so that the AO business process can subsequently determine whether to perform human eye detection according to business requirements.
  • the camera service module notifies the AO service process of the camera status.
  • the AO service process monitors the status of the camera through the monitoring function.
  • the AO business process determines whether to reopen the front camera according to business requirements. For example, if the AO service includes the scene of watching the screen continuously, when no operation of the electronic device by the user is detected for a period of time, it is determined to turn on the front camera again.
  • FIG. 10 is a schematic flowchart of a method for controlling a camera provided in an embodiment of the present application.
  • the method can be applied to the above-mentioned electronic device, and the method can include the following:
  • Step 1001 Turn on the target camera according to the first instruction of the first process.
  • the first process is an application program process.
  • the first process is a camera process.
  • the first instruction carries camera information, and the camera corresponding to the camera information is a target camera.
  • the first instruction is used to request to open the target camera.
  • the target camera is a front camera.
  • this step is performed by the above-mentioned camera service module.
  • the target camera corresponds to multiple camera information, and each camera information in the multiple camera information corresponds to a camera capability. That is, one physical camera may correspond to one or more camera information, and each camera information corresponds to a camera capability.
  • Step 1002 the second process requests to open the target camera.
  • the second process is an AO service process
  • the AO service process is used to perform a specified operation when the human eye detection opportunity detects that the user is looking at the screen.
  • the specified operation is determined according to the scene included in the AO service. For example, in the case that the AO service includes the scene of watching the screen continuously, the specified operation is to keep the screen on.
  • the specific implementation of the second process requesting to open the target camera may include: the second process acquires camera information of a camera that can support the second process to implement a corresponding service.
  • the second process issues a second instruction for requesting to turn on the camera corresponding to the camera information, and the second instruction carries the camera information. If the camera information carried in the second instruction corresponds to the target camera, it is determined that the second process requests to open the target camera.
  • the specific realization that the second process obtains the camera information of the camera that can support the second process to realize the corresponding service may include: the second process queries the camera list, and the camera list includes multiple camera information, and the multiple camera Each camera information in the information corresponds to a camera capability. According to the camera capability corresponding to each camera information, the camera information capable of supporting the second process to realize the camera capability of the corresponding service is determined from the plurality of camera information.
  • the second process sends a second instruction to the camera service module.
  • the camera service module judges whether the camera information carried in the second instruction corresponds to the target camera. If so, it is determined that the second process requests to open the target camera.
  • the camera service module determines whether there is a camera use conflict. For example, if the camera information carried in the second command issued by the second process is the same as the camera information that the first process has opened, it is determined that there is a conflict, or if the camera information carried in the second command is the same as the camera information that the first process has opened If the camera information corresponds to the same physical camera, it is determined that there is a conflict. If there is a conflict, enter the following step 1003.
  • the second process before the second process sends the second instruction, the second process starts the monitoring module, and the monitoring module is used to monitor the status of the camera.
  • Step 1003 Determine the system priority ranking of the first process and the second process, in which the system priority of the second process is higher than that of the first process.
  • the specific implementation of determining the system priority of the first process and the second process may include: obtaining the system priority score of the first process according to the process number of the first process, and obtaining the system priority score of the first process according to the process number of the second process
  • the process ID obtains the system priority score of the second process.
  • the system priority ranking of the first process and the second process is determined.
  • Step 1004 Adjust the system priority order to obtain the first priority order of the first process and the second process.
  • the specific implementation of adjusting the priority order of the system may include: according to the first identification information of the first process, the second identification information of the second process, and the process priority information, the priority order of the first process Prior to the priority of the second process, the process priority information includes a custom priority ranking among different processes.
  • the first identification information of the first process is an application identification.
  • the second identification information of the second process is a label.
  • the second identification information is aoservice, and the first identification information is appid.
  • the process priority information includes the second identification information, but does not include the first identification information. At this time, it is determined that the priority of the first process is higher than the priority of the second process, that is, in the first priority sorting, the priority of the first process is ranked before the priority of the second process.
  • the process priority information includes first identification information and second identification information. At this time, according to the priority information corresponding to the first identification information and the priority information corresponding to the second identification information, determine The priority of the first process is higher than the priority of the second process, so in the first priority sorting, the priority of the first process is ranked before the priority of the second process.
  • Step 1005 Notify the second process of failure to open the target camera based on the first priority ordering.
  • the electronic device Since the priority of the first process is prior to the priority of the second process in the first priority sorting, the electronic device notifies the second process that it fails to open the target camera. At this point the second process continues to use the target camera.
  • the AO business process normally opens the front camera
  • the application process normally opens the front camera
  • the method also includes the following steps.
  • the second process monitors the notification that the target camera is turned off through the monitoring module, it is determined whether to request to turn on the target camera again according to business requirements.
  • the second process starts the monitoring module, and when the notification that the target camera is turned off is detected through the monitoring module, it means that the first process has turned off the target camera. At this point, the second process then determines whether to reopen the camera according to business requirements. For example, if no user operation is detected for a period of time, it is determined to reopen the front camera.
  • the target camera is turned on according to the first instruction of the first process.
  • the second process requests to open the target camera, and determines the system priority of the first process and the second process, and the system priority of the second process in the system priority is higher than that of the first process.
  • the system priorities of the first process and the second process are adjusted to obtain a first priority. In the first priority, the priority of the first process is higher than that of the second process. Therefore, notifying the second process to open the target camera fails. This solves the problem of camera use conflicts between two processes.
  • the electronic device after the first process turns off the target camera and the second process turns on the target camera, please refer to FIG. 11 , the electronic device also performs the following operations.
  • Step 1101 the third process requests to open the target camera.
  • the third process is an application program process.
  • the third process is a camera process.
  • the third process sends a third instruction to the camera service module, and the third instruction carries the camera information of the camera to be turned on.
  • Step 1102 Determine the system priority ranking of the second process and the third process, the system priority of the second process is higher than the system priority of the third process.
  • Step 1103 Adjust the system priorities of the second process and the third process to obtain the second priorities of the second process and the third process.
  • Step 1104 Based on the second priority sorting, close the target camera that has been opened by the second process.
  • the priority of the third process is ranked before the priority of the second process, so the electronic device closes the target camera opened by the second process.
  • the above-mentioned camera service module closes the target camera that has been opened by the second process.
  • Step 1105 Open the target camera according to the request of the third process.
  • the camera service module opens the target camera according to the camera information carried in the third instruction.
  • the electronic device turns on the target camera according to the request of the third process, it further performs the following operations.
  • Step 1106 Send a notification of camera state change to the second process.
  • the camera service module may notify the second process, for example, the camera service module sends a notification of camera state change to the second process.
  • Step 1107 the second process monitors the notification of camera state change through the monitoring module.
  • the second process monitors the camera status change notification through the monitoring module, it can be determined that the third process is currently opening the target camera, so that the second process will not execute the AO service even when the human eye detection time is reached. .
  • FIG. 12 is a flow chart of a method for controlling a camera according to another exemplary embodiment.
  • the method can include the following:
  • the first process is an application program process
  • the second process is an AO service process
  • the customized process priority information includes the label of the AO business process, it may be determined that the customized process priority information includes the priority information of the AO business process. Similarly, if the customized process priority information includes the application identifier, it can be determined that the customized process priority information includes the priority information of the application program process.
  • the customized process priority information when the customized process priority information includes the priority information of the AO service process and/or the priority information of the application program process, the following step 1204 is performed. Otherwise, if the customized process priority information does not include the priority information of the AO service process and does not include the priority information of the application program process, perform the following step 1205 .
  • the electronic device before determining the priority order of the AO business process and the application program process according to the label of the AO business process, the application identifier, and the customized process priority information, the electronic device first queries whether Including the label and application identification of the AO business process, so as to determine whether the customized process priority information includes the priority information of the AO business process and whether the priority information of the application program process is included. In the case where it is determined that the customized process priority information includes the label and/or application identifier of the AO service process, it indicates that the prioritization of the AO service process and the application program process can be determined according to the customized process priority information.
  • the priority of the AO business process and the application process is determined according to the system priority of the AO business process and the system priority of the application process. level sort.
  • the self-defined process priority information includes the priority information and application of the AO business process Priority information for program processes. If it is included, then prioritize the AO business process and application process according to the user-defined process priority information; otherwise, prioritize the AO business process and application process according to the system priority. In this way, it can be ensured that without customizing the priority of the AO business process and the application process, the priority of the two can still be determined according to the system priority, so as to determine which process opens the camera and avoid conflicts caused by System chaos and so on.
  • FIG. 13 is a structural block diagram of an apparatus for controlling a camera provided in an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
  • the device includes a camera service module 1310 and a first process module 1320 , and the first process module 1320 is used to run a second process: as an example of this application, the first process module 1320 is the above-mentioned AO module 52 .
  • the camera service module 1310 is configured to open the target camera according to the first instruction of the first process
  • the first process module 1320 is used to request to open the target camera
  • the camera service module 1310 is configured to determine the system priority of the first process and the second process, and the system priority of the second process in the system priority is higher than the system priority of the first process;
  • the camera service module 1310 is configured to adjust the priority of the system to obtain the first priority of the first process and the second process;
  • the camera service module 1310 is configured to notify the second process of failure to open the target camera based on the first priority.
  • the camera service module 1310 is used for:
  • the priority of the first process is arranged before the priority of the second process, and the process priority information includes the difference between different processes custom prioritization.
  • the first process module 1320 is used to obtain the camera information of the camera that can support the second process to realize the corresponding service;
  • the first process module 1320 is configured to issue a second instruction for requesting to open a camera corresponding to the camera information to the camera service module 1310, and the second instruction carries the camera information;
  • the camera service module 1310 is configured to determine that the second process requests to open the target camera.
  • the first process module 1320 is used to:
  • the camera list includes multiple camera information, and each camera information in the multiple camera information corresponds to a camera capability
  • the camera information capable of supporting the second process to realize the camera capability of the corresponding service is determined from the plurality of camera information.
  • the first process module 1320 is used to start the monitoring module, and the monitoring module is used to monitor the state of the camera;
  • the first process module 1320 is used to determine whether to re-request according to business requirements when the monitoring module detects the notification that the target camera has been closed. Turn on the target camera.
  • the device further includes a second process module 1330 configured to run a third process.
  • the second process module 1330 is the above-mentioned application program module 54 . After the first process closes the target camera, the second process has opened the target camera;
  • the second process module 1330 is used to request to open the target camera
  • the camera service module 1310 is used to determine the system priority of the second process and the third process, the system priority of the second process is higher than the system priority of the third process;
  • the camera service module 1310 is configured to adjust the system priority of the second process and the third process, and obtain the second priority of the second process and the third process;
  • the camera service module 1310 is configured to close the target camera that has been opened by the second process based on the second priority ordering
  • the camera service module 1310 is used for opening the target camera according to the request of the third process.
  • the camera service module 1310 opens the target camera according to the request of the third process, it sends a notification of camera status change to the second process;
  • the first process module 1320 is configured to monitor the notification of camera status change through the monitoring module.
  • the first process is an application process
  • the second process is an AO business process
  • the third process is an application process
  • the AO business process is used to perform a specified operation when the user's eyes are detected when the user is looking at the screen.
  • the target camera corresponds to multiple camera information, and each camera information in the multiple camera information corresponds to a camera capability.
  • the target camera is turned on according to the first instruction of the first process.
  • the second process requests to open the target camera, and determines the system priority of the first process and the second process, and the system priority of the second process in the system priority is higher than that of the first process.
  • the system priorities of the first process and the second process are adjusted to obtain a first priority. In the first priority, the priority of the first process is higher than that of the second process. Therefore, notifying the second process to open the target camera fails. This solves the problem of camera use conflicts between two processes.
  • the disclosed devices and methods may be implemented in other ways.
  • the system embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the methods of the above embodiments in the present application can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium.
  • the computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable medium may at least include: any entity or device capable of carrying computer program codes to electronic equipment, recording media, computer memory, read-only memory (ROM, Read-Only Memory), random-access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
  • ROM read-only memory
  • RAM random-access memory
  • electrical carrier signals telecommunication signals
  • software distribution media Such as U disk, mobile hard disk, magnetic disk or optical disk, etc.
  • computer readable media may not be electrical carrier signals and telecommunication signals under legislation and patent practice.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Studio Devices (AREA)

Abstract

本申请提供了一种控制摄像头的方法、电子设备及计算机可读存储介质,涉及终端技术领域。该方法包括:根据第一进程的第一指令打开目标摄像头。第二进程请求打开目标摄像头。确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级。调整系统优先级排序,得到第一进程与第二进程的第一优先级排序。基于第一优先级排序,通知第二进程打开目标摄像头失败。解决了两个进程发生摄像头使用冲突的问题。

Description

控制摄像头的方法、电子设备及计算机可读存储介质
本申请要求于2021年8月9日提交到国家知识产权局、申请号为202110911919.6、申请名称为“控制摄像头的方法、电子设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端技术领域,尤其涉及一种控制摄像头的方法、电子设备及计算机可读存储介质。
背景技术
电子设备中通常包括多个进程,多个进程中的不同进程可以实现不同的业务。示例性地,多个进程包括应用程序进程、一直开启(always on,AO)业务进程等。其中AO业务进程实现的AO业务(又称智慧感知业务)是指,若电子设备检测到需要进行人眼检测的时机时,则打开前置摄像头以进行人眼检测,当根据人眼检测的结果确定用户在注视屏幕时,根据AO业务涉及的场景执行对应的业务。示例性地,在AO业务包括注视不息屏场景的情况下,如果在一段时间内未检测到用户对电子设备的操作,则自动打开前置摄像头,以进行人脸检测和人眼注视算法的计算,从而判断用户是否在注视屏幕,并当确定用户在注视屏幕时,保持屏幕继续处于点亮状态。
然而,在电子设备中,在一个进程已打开摄像头的情况下,另一个进程也需要打开该摄像头,譬如相机进程已打开前置摄像头,AO业务进程也请求打开该前置摄像头。此时就会导致两个进程发生摄像头使用冲突的问题。
发明内容
本申请提供一种控制摄像头的方法、电子设备及计算机可读存储介质,解决了现有技术中两个进程发生摄像头使用冲突的问题。
为达到上述目的,本申请采用如下技术方案:
第一方面,提供一种控制摄像头的方法,所述方法包括:
根据第一进程的第一指令打开目标摄像头;
第二进程请求打开所述目标摄像头;
确定所述第一进程与所述第二进程的系统优先级排序,所述系统优先级排序中所述第二进程的系统优先级高于所述第一进程的系统优先级;
调整所述系统优先级排序,得到所述第一进程与所述第二进程的第一优先级排序;
基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败。
如此,解决了两个进程发生摄像头使用冲突的问题。另外,获取第一进程和第二进程的系统优先级排序,之后,对系统优先级排序进行调整,如此,在不修改原系统框架的基础上,使得最终得到的第一优先级排序能够符合用户的实际需求,从而提高了用户体验。
作为本申请的一个示例,所述调整所述系统优先级排序,包括:
根据所述第一进程的第一标识信息、所述第二进程的第二标识信息、进程优先级信息,将所述第一进程的优先级排于所述第二进程的优先级之前,所述进程优先级信息包括不同进程之间的自定义的优先级排序。
如此,根据自定义的优先级排序,调整第一进程和第二进程的系统优先级排序,以使得最终的优先级排序能够符合用户的实际需求,从而提高用户体验。
作为本申请的一个示例,所述第二进程请求打开所述目标摄像头,包括:
所述第二进程获取能够支持所述第二进程实现对应业务的摄像头的摄像头信息;
所述第二进程下发用于请求打开所述摄像头信息对应的摄像头的第二指令,所述第二指令中携带所述摄像头信息;
若所述第二指令中携带的摄像头信息对应的是所述目标摄像头,则确定第二进程请求打开所述目标摄像头。
如此,第二进程下发第二指令,并在第二指令中携带所确定的摄像头信息,以使得电子设备根据第二指令,确定第二进程预请求打开目标摄像头。
作为本申请的一个示例,第二指令中还携带第二进程的第二标识信息,示例性地,第二标识信息为第二进程的标签。
作为本申请的一个示例,所述第二进程获取能够支持所述第二进程实现对应业务的摄像头的摄像头信息,包括:
所述第二进程查询摄像头列表,所述摄像头列表中包括多个摄像头信息,且所述多个摄像头信息中的每个摄像头信息与一种摄像头能力对应;
根据所述每个摄像头信息对应的摄像头能力,从所述多个摄像头信息中确定能够支持所述第二进程实现对应业务的摄像头能力的摄像头信息。
也即第二进程通过查询摄像头能力来确定能够支持其实现对应业务的摄像头信息,以便于根据所确定的摄像头信息,生成第二指令。
作为本申请的一个示例,所述方法还包括:
所述第二进程启动监听模块,所述监听模块用于监听摄像头状态;
所述基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败之后,还包括:
在所述第二进程通过所述监听模块监听到所述目标摄像头已关闭的通知的情况下,根据业务需求确定是否重新请求打开所述目标摄像头。
如此,通过启动监听模块来监听摄像头状态,如此可以实时感知摄像头的状态,以便于第二进程根据实际业务需求判断是否需要或能够打开摄像头,提高了对摄像头使用的有效性。
作为本申请的一个示例,在所述第一进程关闭所述目标摄像头,所述第二进程已打开所述目标摄像头之后,所述方法还包括:
第三进程请求打开所述目标摄像头;
确定所述第二进程与所述第三进程的系统优先级排序,所述第二进程的系统优先级高于所述第三进程的系统优先级;
调整所述第二进程与所述第三进程的系统优先级排序,得到所述第二进程与所述第三进程的第二优先级排序;
基于所述第二优先级排序,关闭所述第二进程已打开的所述目标摄像头;
根据所述第三进程的请求打开所述目标摄像头。
示例性地,第二进程为AO业务进程,第三进程为应用程序进程。在AO业务进程已打开目标摄像头的情况下,若应用程序进程也请求打开目标摄像头,则通过调整AO业务进程和应用程序进程的系统优先级排序,确定AO业务进程和应用程序进程的第二优先级排序,在第二优先级排序中,AO业务进程的优先级低于应用程序进程的优先级,因此,关闭AO业务进程已打开的摄像头,并开启应用程序进程请求打开的摄像头。如此,避免了当用户需要使用摄像头时无法打开的情况。
作为本申请的一个示例,所述根据所述第三进程的请求打开所述目标摄像头之后,还包括:
向所述第二进程发送摄像头状态变更的通知;
所述第二进程通过所述监听模块监听所述摄像头状态变更的通知。
在一个实施例中,相机服务模块打开应用程序进程请求打开的摄像头后,通知AO业务进程摄像头状态的变更情况。如此,AO业务进程会通过监听功能监听到此时相机服务模块所通知的摄像头的状态,以便于AO业务进程后续根据摄像头状态确定是否执行AO业务。譬如,在AO业务包括注视不息屏场景的情况下,AO业务在接收到摄像头状态的变更情况的通知后,虽然在一段时间内未检测到用户在操作电子设备,但由于确定应用程序进程正在目标摄像头,所以可以不进行人眼检测。
作为本申请的一个示例,所述第一进程为应用程序进程,所述第二进程为AO业务进程,所述第三进程为应用程序进程,所述AO业务进程用于在人眼检测时机检测到用户注视屏幕时执行指定操作。
作为本申请的一个示例,所述目标摄像头对应有多个摄像头信息,所述多个摄像头信息中的每个摄像头信息对应一种摄像头能力。
也即对于一个物理摄像头设置有多个摄像头信息,从而使得该物理摄像头能够拍摄出多种格式的图片,以支持不同的业务。
第二方面,提供一种控制摄像头的装置,所述装置包括相机服务模块和第一进程模块,所述第一进程模块用于运行第二进程:
所述相机服务模块,用于根据第一进程的第一指令打开目标摄像头;
所述第一进程模块,用于请求打开所述目标摄像头;
所述相机服务模块,用于确定所述第一进程与所述第二进程的系统优先级排序,所述系统优先级排序中所述第二进程的系统优先级高于所述第一进程的系统优先级;
所述相机服务模块,用于调整所述系统优先级排序,得到所述第一进程与所述第二进程的第一优先级排序;
所述相机服务模块,用于基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败。
作为本申请的一个示例,所述相机服务模块用于:
根据所述第一进程的第一标识信息、所述第二进程的第二标识信息、进程优先级信息,将所述第一进程的优先级排于所述第二进程的优先级之前,所述进程优先级信息包括不同进程之间的自定义的优先级排序。
作为本申请的一个示例;
所述第一进程模块用于获取能够支持所述第二进程实现对应业务的摄像头的摄像头信息;
所述第一进程模块用于向所述相机服务模块下发用于请求打开所述摄像头信息对应的摄像头的第二指令,所述第二指令中携带所述摄像头信息;
若所述第二指令中携带的摄像头信息对应的是所述目标摄像头,则所述相机服务模块用于确定第二进程请求打开所述目标摄像头。
作为本申请的一个示例,所述第一进程模块用于:
查询摄像头列表,所述摄像头列表中包括多个摄像头信息,且所述多个摄像头信息中的每个摄像头信息与一种摄像头能力对应;
根据所述每个摄像头信息对应的摄像头能力,从所述多个摄像头信息中确定能够支持所述第二进程实现对应业务的摄像头能力的摄像头信息。
作为本申请的一个示例;
所述第一进程模块,用于启动监听模块,所述监听模块用于监听摄像头状态;
所述相机服务模块基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败之后,所述第一进程模块用于通过所述监听模块监听到所述目标摄像头已关闭的通知的情况下,根据业务需求确定是否重新请求打开所述目标摄像头。
作为本申请的一个示例,所述装置还包括第二进程模块,所述第二进程模块用于运行第三进程,在所述第一进程关闭所述目标摄像头,所述第二进程已打开所述目标摄像头之后;
所述第二进程模块用于请求打开所述目标摄像头;
所述相机服务模块用于确定所述第二进程与所述第三进程的系统优先级排序,所述第二进程的系统优先级高于所述第三进程的系统优先级;
所述相机服务模块用于调整所述第二进程与所述第三进程的系统优先级排序,得到所述第二进程与所述第三进程的第二优先级排序;
所述相机服务模块用于基于所述第二优先级排序,关闭所述第二进程已打开的所述目标摄像头;
所述相机服务模块用于根据所述第三进程的请求打开所述目标摄像头。
作为本申请的一个示例,所述相机服务模块根据所述第三进程的请求打开所述目标摄像头之后,向所述第二进程发送摄像头状态变更的通知;
所述第一进程模块,用于通过所述监听模块监听所述摄像头状态变更的通知。
作为本申请的一个示例,所述第一进程为应用程序进程,所述第二进程为AO业务进程,所述第三进程为应用程序进程,所述AO业务进程用于在人眼检测时机检测到用户注视屏幕时执行指定操作。
作为本申请的一个示例,所述目标摄像头对应有多个摄像头信息,所述多个摄像头信息中的每个摄像头信息对应一种摄像头能力。
第三方面,提供一种电子设备,所述电子设备包括包括存储器和处理器;
所述存储器用于存储支持所述电子设备执行上述第一方面所述的方法的程序,以及存储用于实现上述第一方面所述的方法所涉及的数据;所述处理器被配置为用于执 行所述存储器中存储的程序。
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行如上述第一方面任意一项所述的方法。
第五方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。
上述第二方面、第三方面、第四方面和第五方面所获得的技术效果与上述第一方面中对应的技术手段获得的技术效果近似,在这里不再赘述。
本申请提供的技术方案至少可以带来以下有益效果:
根据第一进程的第一指令打开目标摄像头。第二进程请求打开目标摄像头,确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级。对第一进程和第二进程的系统优先级排序进行调整,得到第一优先级排序,第一优先级排序中第一进程的优先级高于第二进程的优先级。因此,通知第二进程打开目标摄像头失败。如此解决了两个进程发生摄像头使用冲突的问题。
附图说明
图1为本申请实施例提供的一种电子设备的结构示意图;
图2为本申请实施例提供的一种电子设备的软件结构框图;
图3为本申请实施例提供的一种应用场景的示意图;
图4为本申请实施例提供的另一种应用场景的示意图;
图5为本申请实施例提供的一种控制摄像头的方法的流程示意图;
图6为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图7为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图8为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图9为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图10为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图11为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图12为本申请实施例提供的另一种控制摄像头的方法的流程示意图;
图13为本申请实施例提供的一种控制摄像头的装置的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
应当理解的是,本申请提及的“多个”是指两个或两个以上。在本申请的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,为了便于清楚描述本申请的技术方案,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。
在对本申请实施例提供的方法进行详细介绍之前,先对本申请实施例涉及的执行主体进行简单介绍。本申请实施例提供的方法可以由电子设备来执行,电子设备配置有前置摄像头,前置摄像头的数量可以为一个或者多个。在一个实施例中,电子设备还配置有一个或者多个后置摄像头,本申请实施例对此不作限定。另外,电子设备中可以安装一个或者多个应用程序,且该一个或者多个应用程序中的每个应用程序能够打开电子设备中配置的摄像头,以通过摄像头进行图像采集。示例性地,该一个或者多个应用程序可以包括相机、支付应用软件等。譬如应用程序为相机,用户可以通过相机打开前置摄像头进行自拍。另外,电子设备支持AO业务。
作为一种示例,电子设备可以包括但不限于手机、平板电脑、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、笔记本电脑、上网本、个人数字助理(personal digital assistant,PDA)之类的设备,本申请实施例对此不作限定。
请参阅图1,图1是本申请实施例提供的一种电子设备的结构示意图。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路 (inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备100供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication, NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图 像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。 在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动终端设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备100的姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子 设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或 N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图2是本申请实施例的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为五层,从上至下分别为应用程序层,应用程序框架层,系统层,扩展层,以及内核层。
应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括AO感知,相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
AO感知用于根据业务感知人眼检测的时机,并通知给扩展层中的AO模块。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统层包括相机服务模块、系统库、安卓运行时(Android runtime)。
在本申请实施例中,相机服务模块用于在AO业务生效过程中,检测注视屏幕不息屏业务与其他业务(如由应用程序进程实现的业务)是否发生摄像头使用冲突问题,并在确定发生冲突时,解决冲突问题,其具体实现请参见下文所述实施例。其中,应用程序进程用于运行应用层的应用程序。
另外,相机服务模块能够感知电子设备中所有摄像头的使用情况,譬如可以感知有哪些摄像头正在被打开,以及打开这些摄像头的进程分别是哪个进程。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
扩展层中包括开发商根据自身需求自定义的一些内容。在一些实施例中,扩展层又称为自定义层,或者称为ventor(开发商)层、或者称为芯片扩展层等。
作为本申请的一个示例,扩展层中包括AO模块,AO模块用于运行AO业务进程。具体地,AO模块负责开启或者关闭人眼检测业务。在开启人眼检测业务的情况下,向相机服务模块请求开启摄像头并接收图片,然后进行人眼检测,以实现AO业务。
进一步地,扩展层中还包括硬件抽象层(Hardware Abstract Layer,hal)所包括的多个模块。其中,hal层起着中介作用,将硬件和软件彼此分离开来。这一层的主要目的是允许软件运行在它不打算运行的硬件上。在一个实施例中,hal层中的多个模块包括但不限于如下模块中的至少一个:蓝牙(bluetooth)、相机(camera)、传感器(sensors)。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用 内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。
在介绍完本申请实施例涉及的执行主体后,接下来对本申请实施例涉及的应用场景进行简单介绍。这里以电子设备是手机为例进行说明。
在一个场景中,在用户不操作手机的情况下,如果手机也没有在执行其他业务(譬如播放视频),则经过一段时间后,手机就会自动息屏,如此可能会影响用户体验。在另一个场景中,若手机开启来电响铃模式,则当手机来电时,如果手机的来电音量较大,则会给其他用户带来干扰。
针对上述两种场景存在的问题,提出了一种AO业务,AO业务在生效时可以检测用户是否在注视手机的屏幕,并根据检测结果,执行指定操作。譬如,在上述第一个场景中,确定用户在注视屏幕的情况下,保持屏幕处于点亮状态。又如,在上述第二个场景中,确定用户在注视屏幕的情况下,自动减弱来电音量。
在一个实施例中,可以由用户手动开启手机中的AO业务。示例性地请参考图3,当用户想要开启手机中的AO业务时,可以选中手机中的设置选项,如图3中的(a)图所示。响应于用户对手机中的设置选项的触发操作,手机打开设置页面,譬如设置页面如图3中的(b)图所示。设置页面中提供有“辅助功能”选项,用户点击“辅助功能”选项,响应于用户对“辅助功能”选项的触发操作,手机打开辅助功能页面,如图3中的(c)图所示。辅助功能页面中包括“智慧感知”选项,如图3中的(c)图中的31所示。用户可以选中“智慧感知”选项,响应于用户对“智慧感知”选项的触发操作,手机打开智慧感知页面,如图3中的(d)图所示。智慧感知页面中包括“注视不息屏”项和“注视屏幕减弱来电音量”项,其中“注视不息屏”对应有一个开关,用于开启或关闭注视不息屏业务,“注视屏幕减弱来电音量”项对应有一个开关,用于开启或关闭注视屏幕减弱来电音量业务。
示例性的,以“注视不息屏”为例,当用户想要开启注视不息屏业务时,可以手动向右滑动“注视不息屏”项对应的开关,如图3中的(d)图所示。响应于用户对“注视不息屏”项对应的开关向右滑动的操作,手机开启注视不息屏业务。
示例性的,再以“注视屏幕减弱来电音量”为例,当用户想要开启注视屏幕减弱来电音量业务时,可以手动向右滑动“注视屏幕减弱来电音量”项对应的开关。响应于用户对“注视屏幕减弱来电音量”项对应的开关向右滑动的操作,手机开启注视屏幕减弱来电音量业务。
在注视不息屏业务和注视屏幕减弱来电音量业务中的至少一个业务被开启的情况下,AO业务开启。AO业务在生效过程中使用前置摄像头采集图像。作为本申请的一个示例,尽管AO业务处于开启状态,如果手机中的其他业务预使用该前置摄像头,仍可以正常打开该前置摄像头。譬如请参考图4,当用户想要使用前置摄像头拍照时,用户可以触发手机中的相机图标,如图4中的(a)图所示。响应于用户对相机图标的触发操作,手机打开摄像头,如图4中的(b)图所示。在一个示例中,手机在检测到用户对相机图标的触发操作后默认打开前置摄像头。在另一示例中,手机在检测到用户对相机图标的触发操作后默认打开后置摄像头,请参考图4中的(b)图,在当前打开的界面中包括前置摄像头选项41,当用户想要通过前置摄像头拍照时,可以触发前 置摄像头选项41。响应于用户对前置摄像头选项41的触发操作时,手机打开前置摄像头。如此,用户即可通过打开的前置摄像头进行拍照。
作为本申请的一个示例,如果手机中的其他业务正在使用前置摄像头,譬如手机已打开前置摄像头以进行拍照,此时如果AO业务预打开该前置摄像头,则会打开失败,也即AO业务的生效不会影响其他业务打开该前置摄像头。
在一个实施例中,当用户不需要使用AO业务时,可以在上述图3中的(d)图所示的设置页面中关闭AO业务。示例性地,当用户想要关闭注视不息屏业务时,手动向左滑动“注视不息屏”项对应的开关,响应于用户对“注视不息屏”项对应的开关向左滑动的操作,手机关闭注视不息屏业务。另外,当用户想要关闭注视屏幕减弱来电音量业务时,手动向左滑动“注视屏幕减弱来电音量”项对应的开关,响应于用户对“注视屏幕减弱来电音量”项对应的开关向左滑动的操作,手机关闭注视屏幕减弱来电音量业务。在注视不息屏业务和注视屏幕减弱来电音量业务均关闭的情况下,确定AO业务已关闭。
需要说明的是,上述仅是以由用户手动开启AO业务为例进行说明。在另一实施例中,手机还可以在检测到当前满足预置条件的情况下自动启动AO业务。其中预置条件可以根据实际需求进行设置。譬如,手机在检测到用户开机解锁屏幕后,自动开启注视不息屏业务和注视屏幕减弱来电音量业务,以自动开启AO业务。进一步地,手机在自动开启AO业务的情况下,控制上述“注视不息屏”项对应的开关处于开启状态,以及控制上述“注视屏幕减弱来电音量”项对应的开关处于开启状态。如此,当用户不想开启AO业务时,可以基于上述设置路径(即,设置-辅助功能-智慧感知)进入智慧感知页面,以在智慧感知页面中手动关闭注视不息屏业务和注视屏幕减弱来电音量业务,以手动关闭AO业务。
在介绍完本申请实施例涉及的执行主体和应用场景后,接下来结合附图对本申请实施例提供的控制摄像头的方法进行详细介绍。
请参考图5,图5是根据一示例性实施例示出的一种模块框架示意图,主要包括AO感知模块51、AO模块52、相机服务模块53、应用程序模块54。AO模块52用于运行AO业务进程,应用程序模块54用于运行其他应用程序进程。其中,各个模块在软件架构中的位置请参考图2。
本申请实施例涉及的摄像头使用冲突包括两种场景:一种场景是,应用程序模块54已打开前置摄像头,AO模块52预打开前置摄像头;另一种场景是,AO模块52已打开前置摄像头,应用程序模块54预打开前置摄像头。接下来将分别针对这两种场景对本申请实施例提供的控制摄像头的方法进行介绍。
首先针对第一种场景下的控制摄像头的方法进行介绍,此时,各个模块的交互流程包括:
(1)AO感知模块51感知人眼检测时机。
在一个示例中,在AO业务处于开启状态的情况下,电子设备通过AO感知模块51感知人眼检测时机。当AO感知模块51感知到需要人眼检测的时机时,通知AO模块52执行AO业务,此时进入如下步骤(2)。否则,若未到达人眼检测时机,则AO 感知模块51继续感知。
(2)AO模块52确定待打开的摄像头的摄像头信息6。
作为本申请的一个示例,AO模块52接收到AO感知模块51的通知后,查询摄像头列表,摄像头列表中包括多个摄像头信息,每个摄像头信息对应一种摄像头能力。AO模块52根据每个摄像头信息对应的摄像头能力,确定能够支持实现AO业务的摄像头的摄像头信息,示例性地,能够支持实现AO业务的摄像头的摄像头信息为6。
需要说明的是,本申请实施例中的摄像头信息对应的是逻辑概念上的摄像头。具体地,由于一个物理摄像头可能会对应有多种摄像头功能,多种摄像头功能中的不同摄像头功能可以输出不同格式的图像,譬如某前置摄像头既可以拍摄用于实现AO业务的2D RGB(red green blue,红绿蓝)图像,又可以拍摄普通格式的图像。因此,针对一个物理摄像头,通常可以在底层对应设置多个摄像头信息,多个摄像头信息中的每个摄像头信息对应该物理摄像头的一种摄像头能力,不同的摄像头能力用于指示在对应的业务场景下使用的摄像头特性,也可以理解为每个摄像头信息对应一个逻辑的摄像头。譬如前置摄像头对应设置有3个摄像头信息,分别为1,3,6。其中,摄像头信息6对应的摄像头能力能够拍摄出AO业务所需的图像,摄像头信息1对应的摄像头能力能够拍摄出普通格式的图像。作为示例而非限定,每种摄像头能力可以通过一个摄像头配置文件进行配置,比如每个摄像头配置文件可以配置在hal层中的camera模块中。
作为本申请的一个示例,底层设置的摄像头信息可以通过列表的形式进行记录,且每个摄像头信息对应一种摄像头能力,也即电子设备的底层可以设置有摄像头列表,摄像头列表中记录有多个摄像头信息、以及多个摄像头信息中每个摄像头信息对应的摄像头能力。
在一个示例中,一个物理摄像头包括的摄像头信息可以对应一个摄像头列表,不难理解,当电子设备配置有多个物理摄像头时,电子设备中对应有多个摄像头列表。示例性地,假设电子设备包括一个前置摄像头和一个后置摄像头,则前置摄像头对应有一个摄像头列表,后置摄像头对应有一个摄像头列表。譬如,前置摄像头对应的摄像头列表中包括3个摄像头信息,后置摄像头对应的摄像头列表中包括5个摄像头信息。
在另一个示例中,电子设备还可以通过一个摄像头列表来记录不同物理摄像头的摄像头信息,也即,电子设备中也可以仅存在一个摄像头列表。此时可以根据预置的对应规则,确定各个摄像头信息对应的物理摄像头,预置的对应规则用于指示摄像头信息与物理摄像头之间的对应关系。譬如,若摄像头信息是1,3,6中的任一个,则对应的物理摄像头是前置摄像头,若摄像头信息是0,2,4,5,7中的任一个,则对应的物理摄像头是后置摄像头。
需要说明的是,上述仅是以摄像头信息以列表的形式存在为例进行说明。在另一实施例中,还可以通过其他方式记录摄像头信息,譬如还可以采用集合的方式记录摄像头信息,本申请实施例对此不作限定。
作为本申请的另一示例,AO模块52中仅存储有能够实现AO业务的摄像头的摄像头信息,譬如仅存储有摄像头信息6,也即AO模块52不需要查询摄像头列表,直 接获取存储的摄像头信息,将获取的摄像头信息作为待打开的摄像头的摄像头信息。
(3)AO模块52向相机服务模块53发送第二指令,第二指令用于请求相机服务模块53打开所确定的摄像头信息对应的摄像头。
作为本申请的一个示例,第二指令中可以携带有标签和所确定的摄像头信息。
该标签用于唯一地标识AO模块52中运行的AO业务进程。在一个实施例中,一个进程的标签是该进程与相机服务模块之间协商好的,使得该进程与相机服务模块可以识别对方业务。在更换或者重启电子设备的情况下,该标签不会发生变更。
一方面,该标签用于相机服务模块53确定第二指令是谁发送的,以便于后续在确定优先级排序后,向标签对应的AO业务进程发送打开摄像头失败的通知或者发送已关闭AO模块52所打开的摄像头的通知。另一方面,该标签还用于相机服务模块53后续从自定义的进程优先级信息中查询AO业务进程的优先级。
作为示例而非限定,第二指令的格式可以为预设格式,预设格式可以根据实际需求进行设置。
示例性地,第二指令为opencamera(1_aoservice),其中,opencamera表示打开摄像头的意思,括号中的1表示待打开的摄像头的摄像头信息,aoservice为标签。所以第二指令的含义是,AO业务进程请求打开摄像头信息1对应的摄像头。
作为本申请的一个示例,AO模块52通过调用vndk接口,发送第二指令。
(4)相机服务模块53查询已打开摄像头的应用程序进程。
相机服务模块53接收到第二指令后,对第二指令进行解析,以确定第二指令的含义。另外从第二指令中解析出所携带的摄像头信息和标签。此外,为了判断AO模块52请求打开的摄像头是否与其他已被打开的摄像头存在冲突,相机服务模块53确定哪个摄像头正在被打开,以及哪个应用程序进程正在使用该已被打开的摄像头。譬如,该应用程序进程已打开的摄像头的摄像头信息为6。再如,该应用程序进程已打开的摄像头的摄像头信息为1。
这里需要说明的是,由于电子设备中所有进程开启或关闭摄像头都需要经过相机服务模块53来执行,譬如其他应用程序进程预打开某个摄像头时,向相机服务模块53发送请求打开该某个摄像头的请求,如此,相机服务模块53调用hal层的camera模块为其打开该某个摄像头;当其他应用程序进程预关闭该某个摄像头时,向相机服务模块53发送请求关闭该某个摄像头的请求,如此,相机服务模块53调用hal层的camera模块为其关闭该某个摄像头。因此,相机服务模块53是能够感知哪个摄像头被打开,以及哪个进程正在使用已被打开的摄像头。
(5)相机服务模块53查询进程的系统优先级分值。
这里所述的进程包括应用程序进程和AO业务进程。
作为一个示例,相机服务模块53根据AO业务进程的进程号查询AO业务进程的系统优先级分值,以及根据应用程序进程的进程号查询应用程序进程的系统优先级分值。其中,这里所述的应用程序进程是指已打开摄像头的进程,也即是上述步骤(4)中所确定的进程。
一个进程的系统优先级分值的高低随着该进程的运行状态动态变化。通常情况下,后台运行的进程的系统优先级分值高于前台运行的系统优先级分值。另外,底层运行 的进程(又称为常驻进程)的系统优先级分值高于应用层运行的进程的系统优先级分值。
(6)相机服务模块53判断AO业务进程和应用程序进程是否存在摄像头使用冲突问题。
在实施中,相机服务模块53根据AO业务进程预打开的摄像头信息和应用程序进程已打开的摄像头信息,判断AO业务进程和应用程序进程是否存在摄像头使用冲突问题。
在一个示例中,若AO业务进程预打开的摄像头信息和应用程序进程已打开的摄像头信息相同,则确定AO业务进程和应用程序进程存在摄像头使用冲突问题。
在另一个示例中,若AO业务进程预打开的摄像头信息和应用程序进程已打开的摄像头信息对应的是同一个物理摄像头(譬如是同一个前置摄像头),则确定AO业务进程和应用程序进程存在摄像头使用冲突问题。
如果存在冲突,则进入如下步骤(7);如果不存在冲突,则相机服务模块为AO模块52打开所请求的摄像头,示例性地,相机服务模块根据AO模块52发送的第二指令中携带的摄像头信息,从hal层调用对应的摄像头配置文件,从而打开对应的摄像头。
(7)相机服务模块53根据进程的系统优先级分值,确定系统优先级排序。
也即系统优先级排序是根据AO业务进程的系统优先级分值和应用程序进程的系统优先级分值确定的。
由于AO业务进程是处于底层的进程,应用程序进程是处于上层的进程,所以AO业务进程的系统优先级高于应用程序进程的系统优先级,所以在系统优先级排序中,AO业务进程的优先级高于应用程序进程的优先级。
需要说明的是,上述步骤(6)和(7)没有严格的先后执行顺序,也即在一个实施例中,也可以先根据所查询的进程的系统优先级分值确定系统优先级排序,然后再进行冲突判断。此时,若确定存在冲突,则执行如下步骤(8),否则,若确定不存在冲突,则相机服务模块为AO模块52打开所请求的摄像头。
(8)相机服务模块53根据自定义的进程优先级信息,调整系统优先级排序。
由于AO业务进程是处于底层的进程,应用程序进程是处于上层的进程,所以AO业务进程的系统优先级高于应用程序进程的系统优先级,如此,在系统优先级排序中,AO业务进程的优先级高于应用程序进程的优先级,导致上述第一场景中,应用程序模块54的前置摄像头功能被关闭,而打开实现AO业务的前置摄像头功能;影响用户体验。而对于上述第二场景中,用户想要自拍时,电子设备由于正在实现AO业务,所以导致无法打开前置摄像头。
由于系统优先级排序与用户的体验需求不相符,所以在本申请实施例中,电子设备自定义的进程优先级信息,需要调整系统优先级排序,以使得调整后得到的优先级排序符合用户的实际需求。
自定义的进程优先级信息可以由用户根据实际需求预先进行设置,并存储在电子设备的某个指定的存储区域内。自定义的进程优先级信息包括一个或者多个进程的优先级信息,一个或者多个优先级信息中的每个优先级信息用于指示对应的进程的优先 级,示例性地,优先级信息可以是序号,序号越小对应的优先级越高。
在自定义的进程优先级信息包括多个进程的优先级信息的情况下,在自定义的进程优先级信息中,不同进程的优先级信息可以通过进程的标识信息进行区分,其中,该标识信息包括标签或应用标识,应用标识能够用于唯一地标识一个应用程序。示例性地,应用标识可以为应用包名或者应用ID等。
作为本申请的一个示例,自定义的进程优先级信息以列表的形式存在,也即电子设备中可以预先存储有自定义的优先级列表。自定义的优先级列表中包括多个进程的标识信息,且多个进程中的每个进程的标识信息对应有一个优先级信息。示例性地,自定义的优先级列表如表1所示。
表1
标识信息 优先级信息
netstat-anpgrep-xj 1
systemserver2d_old 2
aoservice 3
...... ......
作为本申请的一个示例,AO业务进程的优先级通常设置的最低,以避免AO业务影响其他业务使用前置摄像头。示例性地,在上述表1中,aoservice代表AO业务进程的标识信息;systemserver2d_old代表安全支付进程的标识信息;netstat-anpgrep-xj代表相机进程的标识信息。
需要说明的是,上述仅是以优先级信息是序号为例进行说明,在另一实施例中,优先级信息还可以是字符等其他标识符,本申请实施例对此不作限定。
另外还需要说明的是,上述仅是以列表的形式记录自定义的进程优先级信息为例进行说明,在另一实施例中,还可以采用其他方式进行记录,譬如,还可以采用集合等方式进行记录,本申请实施例对此不作限定。
作为本申请的一个示例,自定义的进程优先级信息中包括优先级低的进程的标识信息,可以理解为是一个白名单。譬如其中包括AO业务进程的标签,不包括应用程序进程的应用标识,在该种情况下,确定AO业务进程的优先级低于应用程序进程的优先级,也即将系统优先级排序中的优先级排序重新进行调整。
可选地,自定义的进程优先级中还包括其他进程的标识信息,在该种情况下,AO业务进程与其他进程的标识信息之间存在排序,以指示AO业务进程与其他进程之间的优先级排序。示例性地,AO业务进程的优先级最低。
作为本申请的另一个示例,自定义的进程优先级信息中包括AO业务进程的标签和应用程序进程的应用标识,且AO业务进程的标签和应用程序进程的应用标识之间存在排序关系,指示AO业务进程与应用程序进程之间的优先级排序。在该种情况下,根据AO业务进程的标签和应用程序进程的应用标识的排列顺序,确定AO业务进程和应用程序进程的优先级排序。
作为本申请的一种示例,AO业务进程的优先级低于应用程序进程的优先级,此时执行如下步骤(9)。
(9)相机服务模块53通知AO业务进程打开摄像头失败。
在本申请实施例中,在AO业务进程与应用程序进程打开前置摄像头出现冲突的情况下,相机服务模块根据AO业务进程的标签、应用标识、自定义的进程优先级信息,确定AO业务进程和应用程序进程的优先级排序,其中,优先级排序中高优先级的进程是能够打开前置摄像头的进程。如此解决了应用程序进程与AO业务之间的摄像头使用冲突的问题。
需要说明的是,上述实施例中仅是以AO模块52在第二指令中携带AO业务进程的标签为例进行说明。在另一实施例中,相机服务模块53还可能通过其他方式获取AO业务进程的标签。譬如,相机服务模块53还可以根据AO业务进程的进程号查询AO业务进程的标签,本申请实施例对此不作限定。
另外作为本申请的一个示例,AO模块52在确定待打开的摄像头信息后(也即在上述步骤(2)之后)启动监听功能,以通过监听功能监听所有摄像头的状态的变更通知。相机服务模块53在后续确定应用程序进程使用完摄像头后,可以通知AO模块52。AO模块52通过监听功能监听到这一通知后,可以根据业务需求判断是否再次请求打开摄像头。譬如,以AO业务包括注视不息屏业务为例,若在一段时间内未检测到用户操作,则确定重新请求打开摄像头。
值得一提的是,上述在确定待打开的摄像头信息后开启监听功能,如此可以实时感知摄像头的状态,以便于AO模块52根据实际业务需求判断是否需要或能够打开前置摄像头,提高了对前置摄像头使用的有效性。
作为本申请的一个示例,相机服务模块53中包括多个子模块,相机服务模块53通过多个子模块的交互实现上述操作。示例性地,多个子模块包括相机服务子模块、进程信息服务子模块。接下来对多个子模块的交互过程进行介绍。请参考图6,图6是根据一示例性实施例示出的多个子模块的交互流程示意图。作为示例而非限定,该交互流程包括:
601:相机服务子模块接收第二指令。
根据前文所述可知,第二指令来自AO模块52。
在一个示例中,相机服务模块在hal层提供了AcameraManager子模块,AcameraManager子模块为底层的进程提供了调用接口,使得底层的进程在需要打开摄像头时可以调用所提供的调用接口,以将用于打开摄像头的指令发送至AcameraManager子模块,由AcameraManager子模块再转发给相机服务子模块。譬如,在本申请实施例中,AO模块52将第二指令发送至AcameraManager子模块。
在一个实施例中,如图6所示,AcameraManager子模块在转发第二指令之前,对第二指令进行校验。校验方法具体包括:确定第二指令的格式是否为预置格式,以及确定第二指令中携带的摄像头信息是否合法,当第二指令的格式为预置格式且第二指令中携带的摄像头信息合法时,确定校验通过。否则,若第二指令的格式不是预置格式,和/或,第二指令中携带的摄像头信息不合法,则确定校验未通过。
其中,确定第二指令中携带的摄像头信息是否合法是指,确定第二指令中携带的摄像头信息是否属于摄像头列表,若属于,则确定合法。若不属于,则确定不合法。
若AcameraManager子模块对第二指令校验通过,则将第二指令转发给相机服务子模块,相应的,相机服务子模块接收第二指令。否则,若AcameraManager子模块对第二指令校验未通过,则向AO模块52返回打开摄像头失败的通知。
在一个实施例中,相机服务子模块为CamerService模块。
需要说明的是,这里是以相机服务模块在hal层提供AcameraManager子模块,以便于底层的进程调用为例进行说明。另外,相机服务模块还在应用程序框架层提供了cameraManager子模块,以便于上层的应用程序进程预打开摄像头时调用,也即应用程序进程将用于请求打开或关闭摄像头的指令通过cameraManager子模块转发给相机服务模块进行处理。
602:相机服务子模块对第二指令进行校验,并解析出标签。
为了避免对恶意请求进行处理,相机服务子模块接收第二指令后,再次对第二指令进行校验。在一个示例中,相机服务子模块对第二指令的校验过程包括:判断第二指令的格式是否为预置格式。若第二指令的格式是预置格式,则确定验证通过,否则,若第二指令的格式不是预置格式,则确定验证未通过。
作为一种示例,对第二指令校验通过后,相机服务子模块对第二指令进行解析,以从第二指令中获取所携带的摄像头信息和标签。另外,相机服务子模块调用handleEvictionLocked代码,以通过handleEvictionLocked执行后续的冲突处理,具体包括如下内容。否则,若校验未通过,则通知AO模块52打开摄像头失败。
603:相机服务子模块请求进程信息服务子模块查询进程的系统优先级分值。
这里所述的进程包括AO业务进程和已经打开摄像头的应用程序进程。
604:进程信息服务子模块查询进程的系统优先级分值。
在一种可能的实现方式中,进程服务信息子模块可以根据AO业务进程的进程号,查询AO业务进程的系统优先级分值,以及根据应用程序进程的进程号,查询应用程序进程的系统优先级分值。
示例性地,进程信息服务模块通过getProcessStatesScoresFromPids代码,查询上述两个进程的系统优先级分值。
605:进程信息服务子模块返回进程的系统优先级分值。
也即,进程信息服务子模块将查询到的系统优先级分值发送给相机服务子模块。
606:相机服务子模块判断是否存在冲突,存在冲突,进入步骤607。
示例性地,判断方式可以参见上文实施例中的步骤(6),这里不再重复赘述。
在一个示例中,可以通过调用wouldEvict代码实现冲突判断。
若不存在冲突,则相机服务子模块调用底层配置的摄像头配置文件,以打开对应的摄像头。
607:相机服务子模块根据进程的系统优先级分值,确定拒绝请求列表。
其中,拒绝请求列表包括优先级低的进程的相关信息。示例性地,该相关信息包括但不限于对应的进程的标识信息(如应用标识或标签)、预打开或已打开的摄像头的摄像头信息。在一个实施例中,拒绝请求列表可以定义为evictList。
在本申请实施例中,相机服务子模块根据进程的系统优先级分值确定系统优先级排序,之后,根据系统优先级排序确定拒绝请求列表。示例性地,系统优先级排序中 优先级低的进程是应用程序进程,则拒绝请求列表中包括应用程序进程的应用标签、应用程序进程已打开的摄像头的摄像头信息。
需要说明的是,若相机服务子模块确定不存在冲突,则拒绝请求列表为空。
608:相机服务子模块根据自定义的进程优先级信息,更新拒绝请求列表。
在一个示例中,相机服务子模块根据自定义的进程优先级信息,调整系统优先级排序,在调整后的优先级排序中,AO业务进程的优先级低于应用程序进程的优先级。该种情况下,相机服务子模块将拒绝请求列表中包括的应用程序进程的相关信息替换为AO业务进程的相关信息,譬如,替换后的拒绝请求列表中包括AO业务进程的标签、AO预请求打开的摄像头的摄像头信息。
作为本申请的一个示例,可以通过调用updateEvictedList代码更新拒绝请求列表。
609:相机服务子模块处理冲突。
在实施中,若拒绝请求列表中包括当前预打开摄像头的进程的相关信息,则返回用于指示打开摄像头失败的通知。否则,若拒绝请求列表中包括已打开摄像头的进程的相关信息,则关闭已打开的摄像头,以断开摄像头连接。
示例性地,拒绝请求列表中包括AO业务进程的相关信息,则相机服务子模块向AO模块52反馈用于指示打开摄像头失败的通知。
为了便于理解,接下来以图7所示的流程图为例,对上述实施例中的打开摄像头方法进行介绍。该方法应用于上述电子设备中,该方法可以包括如下内容:
701:应用程序进程已打开摄像头。
示例性地,应用程序进程已打开的摄像头的摄像头信息是1。譬如,应用程序进程是相机进程,相机进程已打开摄像头1进行拍照。
702:AO业务进程预请求打开摄像头。
在一个示例中,AO业务包括注视不息屏场景,当在持续一段时间内用户未操作电子设备时,譬如检测到在8s内用户没有操作电子设备,AO业务进程开始执行AO业务,此时AO业务进程预请求打开摄像头。
703:AO业务进程查询摄像头列表,确定第一摄像头信息。
在实施中,AO业务进程根据摄像头列表中记录的摄像头能力,确定能够支持AO业务的摄像头能力,并从摄像头列表中获取所确定的摄像头能力对应的摄像头信息。示例性地,从摄像头列表中获取的摄像头信息是6,也即第一摄像头信息为6。
需要说明的是,本申请实施例中所述的第一摄像头信息是指预请求打开摄像头的进程确定的摄像头信息,第二摄像头信息是指已打开的摄像头对应的摄像头信息。
704:AO业务进程开启监听功能。
AO业务进程启动监听模块,以通过监听模块执行监听功能,监听模块负责监听所有摄像头的状态的变更通知。
705:AO业务进程下发打开摄像头的第二指令。
第二指令中携带AO业务进程的标签,进一步地,第二指令中还可以携带步骤703中所确定的第一摄像头信息。
示例性地,AO业务进程向相机服务模块发送第二指令。相机服务模块接收到第 二指令后,根据第二指令所携带的标签可以确定第二指令是谁下发的,便于后续根据第二指令中携带的标签,从自定义的进程优先级信息中查询AO业务进程的优先级信息。
706:相机服务模块判断是否存在冲突。
当然,这里所述的冲突是指摄像头使用冲突。譬如,相机服务模块获取当前已打开的摄像头的摄像头信息,得到第二摄像头信息。之后,相机服务模块确定第一摄像头信息对应的是哪个物理摄像头,以及确定第二摄像头信息对应的是哪个物理摄像头,从而判断是否存在冲突。示例性地,若第一摄像头信息与第二摄像头信息对应的是同一个前置摄像头,也即AO业务进程预打开的摄像头和应用程序进程已打开的摄像头是同一个前置摄像头,则确定存在冲突。
若确定存在冲突,则进入如下步骤707。否则,若不存在冲突,则进入如下步骤713。
707:相机服务模块获取系统优先级排序。
相机服务模块根据AO业务进程的系统优先级和应用程序进程的系统优先级,对AO业务进程和应用程序进程进行优先级排序,得到系统优先级排序。在系统优先级排序,AO业务进程的优先级高于应用程序进程的优先级。
708:相机服务模块根据自定义的进程优先级信息,调整系统优先级排序。
作为本申请的一个示例,自定义的进程优先级信息中仅包括优先级低的进程的标识信息,譬如在自定义的进程优先级信息中仅包括AO业务进程的标签,不包括应用程序进程的应用标识,此时,可以确定AO业务进程的优先级低于应用程序进程的优先级,所以,调整后的系统优先级排序中,AO业务进程的优先级低于应用程序进程的优先级。
709:应用程序进程正常工作,相机服务模块通知AO业务进程打开摄像头失败。
也即,由于应用程序进程的优先级高于AO业务进程的优先级,电子设备允许优先级高的进程打开摄像头,所以,应用程序进程继续使用当前已打开的摄像头,AO业务进程打开前置摄像头失败。
在一个实施例中,相机服务模块确定AO业务进程打开前置摄像头失败后,向AO业务进程发送失败通知。AO业务接收失败通知后,确定应用程序进程正在使用前置摄像头,从而确定当前无法打开前置摄像头实现AO业务。
至此已解决了摄像头使用冲突的问题。在一个实施例中,该方法还包括如下步骤710至步骤712。
710:应用程序进程请求相机服务模块关闭摄像头。
711:相机服务模块关闭摄像头,并向AO业务进程发送摄像头状态变更的通知。
该摄像头状态变更的通知用于通知AO业务进程应用程序进程已关闭摄像头。
不难理解,这里所述的相机服务模块关闭的摄像头是指应用程序进程请求关闭的摄像头。
712:AO业务进程通过监听功能监听到摄像头状态变更的通知后,根据业务需求判断是否需要重新打开摄像头。
713:AO业务进程打开第一摄像头信息对应的摄像头。
示例性地,AO业务进程打开摄像头信息6对应的前置摄像头,以通过该前置摄像头正常出图。另外,在正常出图后,AO业务进程关闭前置摄像头。
接下来针对上述第二个场景(也即AO模块52已打开摄像头,应用程序模块54请求打开摄像头)下控制摄像头的方法进行介绍,此时,请参考图8,图5中各个模块的交互流程包括:
801:应用程序模块54检测到预打开摄像头。
在一个示例中,当检测到用户对应用程序进程对应的应用程序图标的触发操作时,确定应用程序进程预请求打开摄像头。示例性地,应用程序进程是相机进程,当检测到用户对电子设备中的相机图标的触发操作时,说明用户想要通过相机打开摄像头,此时说明相机进程预请求打开摄像头。
802:应用程序模块54确定待打开的摄像头信息。
在实施中,应用程序进程根据摄像头列表中记录的摄像头能力,确定能够支持应用程序进程实现对应业务的摄像头能力,并从摄像头列表中获取所确定的摄像头能力对应的摄像头信息。
803:应用程序模块54向相机服务模块53发送第一指令,第一指令用于请求打开摄像头。
也即第一指令用于请求相机服务模块53打开所确定的摄像头信息对应的摄像头。
804:相机服务模块53查询已打开摄像头的进程和所打开的摄像头的摄像头信息。
示例性地,假设已打开摄像头的应用程序进程为AO业务进程,所打开的摄像头的摄像头信息为6。
805:相机服务模块53查询进程的系统优先级分值。
这里所述的进程包括AO业务进程和应用程序进程。
806:相机服务模块53判断AO业务进程和应用程序进程是否存在摄像头使用冲突问题。
807:相机服务模块53根据进程的系统优先级分值,确定系统优先级排序。
808:相机服务模块53根据自定义的进程优先级信息,调整系统优先级排序。
步骤805至步骤808的具体实现可以参见上述图5所示实施例中的(5)至(8)。
809:相机服务模块53关闭AO业务进程已打开的摄像头,并开启应用程序模块54请求打开的摄像头。
作为本申请的一个示例,由于调整后的系统优先级排序中,AO业务进程的优先级低于应用程序进程的优先级,所以,相机服务模块关闭AO业务进程已打开的摄像头,并开启应用程序进程请求打开的摄像头,以保证应用程序进程能够正常打开前置摄像头。
作为本申请的一个示例,相机服务模块关闭AO业务进程已打开的摄像头,并开启应用程序进程请求打开的摄像头之后,通知AO业务进程摄像头的状态。
示例性地,相机服务模块向AO业务进程发送变更通知,以通过该变更通知来通知AO业务进程前置摄像头的状态已发生变更。相应的,AO业务进程接收到变更通知后,清理和释放在实现AO业务时所使用的摄像头资源。
810:应用程序模块54使用摄像头。
也即应用程序进程打开前置摄像头后,通过前置摄像头正常出图。
811:应用程序模块54请求相机服务模块53关闭摄像头。
在一个实施例中,应用程序进程使用完前置摄像头后,请求相机服务模块关闭该前置摄像头。相应的,相机服务模块关闭应用程序进程已打开的前置摄像头。
812:相机服务模块53关闭摄像头。
813:相机服务模块53通知AO模块52已关闭摄像头。
由于AO模块52开启了监听功能,所以AO模块52会通过监听功能监听摄像头的状态,当监听到前置摄像头状态变更的通知,此时可以确定应用程序进程已关闭前置摄像头。
814:AO模块52根据业务需求,确定是否需要重新打开摄像头。
譬如,若AO业务包括注视不息屏场景,则当在持续一段时间段内未检测到用户对电子设备的操作时,确定重新打开前置摄像头。
在上述实施例中,在AO模块52已打开前置摄像头的情况下,若应用程序模块54也请求打开该前置摄像头,则根据自定义的进程优先级信息,确定AO业务进程和应用程序进程的优先级排序。当AO业务进程的优先级低于应用程序进程的优先级时,关闭AO模块52已打开的摄像头,并开启应用程序模块54请求打开的摄像头。
需要说明的是,在上述场景中相机服务模块53的内部实现流程可以参见上述图6所示实施例,这里不再赘述。
为了便于理解,接下来通过9所示的流程图对上述图8实施例中的打开摄像头方法进行介绍。该方法应用于上述电子设备中,该方法可以包括如下内容:
901:AO业务进程已打开摄像头。
示例性地,AO业务进程已打开的摄像头的摄像头信息是6。
需要说明的是,如前文所述,AO业务在生效过程中开启了监听功能,该监听功能用于监听电子设备中的摄像头状态变更的通知。
902:应用程序进程预请求打开摄像头。
903:应用程序进程查询摄像头列表,确定第一摄像头信息。
示例性地,从摄像头列表中获取的摄像头信息是1。
904:应用程序进程下发打开摄像头的第一指令。
第一指令中携带步骤903中所确定的摄像头信息。
示例性地,应用程序进程向相机服务模块发送第一指令。相机服务模块接收到第一指令后,获取下发第一指令的应用程序进程的应用标识,以便于后续根据应用标识和自定义的进程优先级信息确定应用程序进程的优先级信息。
905:相机服务模块判断是否存在冲突。
相机服务模块确定第一指令中携带的摄像头信息对应的是哪个物理摄像头,以及确定应用程序进程当前已打开的是哪个物理摄像头,从而判断是否存在冲突。若AO业务进程预打开的摄像头和应用程序进程已打开的摄像头是同一个前置摄像头,则确定存在冲突。
若确定存在冲突,则进入如下步骤906。否则,若不存在冲突,则进入如下步骤911。
906:相机服务模块获取系统优先级排序。
相机服务模块根据AO业务进程的系统优先级和应用程序进程的系统优先级,对AO业务进程和应用程序进程进行优先级排序,得到系统优先级排序。在系统优先级排序,AO业务进程的优先级高于应用程序进程的优先级。
907:相机服务模块根据自定义的进程优先级信息,调整系统优先级排序。
作为本申请的一个示例,在自定义的进程优先级信息中,AO业务进程的优先级低于应用程序进程的优先级,所以,调整后的优先级排序中,AO业务进程的优先级低于应用程序进程的优先级。
908:相机服务模块关闭AO业务进程已打开的摄像头,并开启应用程序进程请求打开的摄像头。
在一个实施例中,相机服务模块开启应用程序进程请求打开的摄像头后,进入如下步骤912。由于AO业务进程开启了监听功能,所以AO业务进程会通过监听功能监听到此时相机服务模块所通知的摄像头的状态,在该种情况下,可以确定应用程序进程正在打开摄像头。
909:应用程序进程通过摄像头出图。
示例性地,应用程序进程打开前置摄像头后,通过前置摄像头正常出图。
910:应用程序进程请求相机服务模块关闭摄像头。
在一个实施例中,应用程序进程使用完前置摄像头后,请求相机服务模块关闭该前置摄像头。相应的,相机服务模块关闭应用程序进程已打开的前置摄像头。
之后,相机服务模块通知AO业务进程摄像头的状态,也即进入如下步骤912。相应的,由于AO业务进程开启了监听功能,所以AO业务进程会通过监听功能监听到此时相机服务模块所通知的摄像头的状态,在该种情况下,可以确定应用程序进程已关闭前置摄像头。
在上述实施例中,在AO业务进程已打开前置摄像头的情况下,若应用程序进程也请求打开该前置摄像头,则根据自定义的进程优先级信息,确定AO业务进程和应用程序进程的优先级排序。当AO业务进程的优先级低于应用程序进程的优先级时,关闭AO业务进程已打开的摄像头,并开启应用程序进程请求打开的摄像头。
911:相机服务模块为应用程序进程打开所请求打开的摄像头。
譬如在实施中,相机服务模块为应用程序进程打开摄像头信息1对应的摄像头,如此,应用程序进程即可通过该摄像头正常出图。
在一个实施例中,相机服务模块打开应用程序进程请求打开的摄像头后,通知AO业务进程摄像头状态的变更情况,也即进入如下步骤912。如此,AO业务进程会通过监听功能监听到此时相机服务模块所通知的摄像头的状态,以便于AO业务进程后续根据摄像头状态确定是否执行AO业务。譬如,在AO业务包括注视不息屏场景的情况下,AO业务在接收到摄像头状态的变更情况的通知后,虽然在一段时间内未检测到用户在操作电子设备,但由于确定应用程序进程正在使用摄像头信息1对应的摄像头,所以可以不进行人眼检测。
应用程序进程在正常出图后,应用程序进程请求相机服务模块关闭摄像头信息1对应的摄像头。在一个实施例中,相机服务模块关闭应用程序进程已打开的摄像头后,通知AO业务进程摄像头状态的变更情况,如此,以便于AO业务进程后续根据业务需求确定是否进行人眼检测。
912:相机服务模块通知AO业务进程摄像头状态。
913:AO业务进程通过监听功能监听摄像头状态。
914:AO业务进程根据业务需求判断是否需要重新打开摄像头。
示例性地,AO业务进程在确定应用程序进程已关闭前置摄像头后,根据业务需求,确定是否需要重新打开前置摄像头。譬如,若AO业务包括注视不息屏场景,则当在持续一段时间段内未检测到用户对电子设备的操作时,确定重新打开前置摄像头。
请参考图10,图10是本申请实施例提供的一种控制摄像头的方法的示意性流程图,作为示例而非限定,该方法可以应用于上述电子设备中,该方法可以包括如下内容:
步骤1001:根据第一进程的第一指令打开目标摄像头。
作为本申请的一个示例,第一进程为应用程序进程,示例性的,第一进程为相机进程。
第一指令中携带摄像头信息,该摄像头信息对应的摄像头是目标摄像头。第一指令用于请求打开目标摄像头。在本申请的一个示例中,目标摄像头为前置摄像头。
作为本申请的一个示例,该步骤由上述相机服务模块执行。
作为本申请的一个示例,目标摄像头对应有多个摄像头信息,多个摄像头信息中的每个摄像头信息对应一种摄像头能力。也即,一个物理摄像头可能对应有一个或者多个摄像头信息,每个摄像头信息对应一种摄像头能力。
步骤1002:第二进程请求打开目标摄像头。
作为本申请的一个示例,第二进程为AO业务进程,AO业务进程用于在人眼检测时机检测到用户注视屏幕时执行指定操作。指定操作根据AO业务包括的场景确定,示例性地,在AO业务包括注视不息屏场景的情况下,指定操作是保持屏幕处于点亮状态。
作为本申请的一个示例,第二进程请求打开目标摄像头的具体实现可以包括:第二进程获取能够支持第二进程实现对应业务的摄像头的摄像头信息。第二进程下发用于请求打开摄像头信息对应的摄像头的第二指令,第二指令中携带摄像头信息。若第二指令中携带的摄像头信息对应的是目标摄像头,则确定第二进程请求打开目标摄像头。
作为本申请的一个示例,第二进程获取能够支持第二进程实现对应业务的摄像头的摄像头信息的具体实现可以包括:第二进程查询摄像头列表,摄像头列表中包括多个摄像头信息,且多个摄像头信息中的每个摄像头信息与一种摄像头能力对应。根据每个摄像头信息对应的摄像头能力,从多个摄像头信息中确定能够支持第二进程实现对应业务的摄像头能力的摄像头信息。
作为本申请的一个示例,第二进程向相机服务模块下发第二指令。相应的,相机 服务模块判断第二指令中携带的摄像头信息对应的是否是目标摄像头。若是,则确定第二进程请求打开目标摄像头。
不难理解,当第二进程请求打开目标摄像头时,说明存在摄像头使用冲突问题。作为本申请的一个示例,由相机服务模块判断是否存在摄像头使用冲突。譬如,若第二进程下发的第二指令中携带的摄像头信息与第一进程已打开的摄像头信息相同,则确定存在冲突,或者,若第二指令中携带的摄像头信息与第一进程已打开的摄像头信息对应的是同一个物理摄像头,则确定存在冲突。在存在冲突的情况下进入如下步骤1003。
另外作为本申请的一个示例,第二进程在发送第二指令之前,第二进程启动监听模块,监听模块用于监听摄像头状态。
步骤1003:确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级。
作为本申请的一个示例,确定第一进程与第二进程的系统优先级排序的具体实现可以包括:根据第一进程的进程号获取第一进程的系统优先级分值,以及根据第二进程的进程号获取第二进程的系统优先级分值。根据第一进程的系统优先级分值和第二进程的系统优先级分值,确定第一进程与第二进程的系统优先级排序。
步骤1004:调整系统优先级排序,得到第一进程与第二进程的第一优先级排序。
作为本申请的一个示例,调整系统优先级排序的具体实现可以包括:根据第一进程的第一标识信息、第二进程的第二标识信息、进程优先级信息,将第一进程的优先级排于第二进程的优先级之前,进程优先级信息包括不同进程之间的自定义的优先级排序。
示例性地,第一进程的第一标识信息为应用标识。第二进程的第二标识信息为标签。譬如,第二标识信息为aoservice,第一标识信息为appid。
示例性地,进程优先级信息如表1所示。
作为本申请的一个示例,进程优先级信息中包括第二标识信息,但不包括第一标识信息。此时,确定第一进程的优先级高于第二进程的优先级,也即在第一优先级排序中,第一进程的优先级排于第二进程的优先级之前。
作为本申请的另一个示例,进程优先级信息中包括第一标识信息和第二标识信息,此时,且根据第一标识信息对应的优先级信息和第二标识信息对应的优先级信息,确定第一进程的优先级高于第二进程的优先级,所以,在第一优先级排序中,第一进程的优先级排于第二进程的优先级之前。
步骤1005:基于第一优先级排序,通知第二进程打开目标摄像头失败。
由于第一优先级排序中第一进程的优先级排于第二进程的优先级之前,所以,电子设备通知第二进程打开目标摄像头失败。此时第二进程继续使用目标摄像头。
当然不难理解,在一个实施例中,第一进程与第二进程打开不同摄像头时,不存在冲突,譬如电子设备配置有两个前置摄像头,AO业务进程和应用程序进程分别打开不同的前置摄像头,在该种情况下,AO业务进程正常打开前置摄像头,并且,应用程序进程正常打开前置摄像头。
至此已解决了摄像头使用冲突的问题。作为本申请的一个示例,该方法还包括如 下步骤。
在第二进程通过监听模块监听到目标摄像头已关闭的通知的情况下,根据业务需求确定是否重新请求打开目标摄像头。
如前文所述,第二进程启动了监听模块,当通过监听模块监听到目标摄像头已关闭的通知时,说明第一进程已经关闭目标摄像头。此时,第二进程再根据业务需求确定是否重新打开摄像头。譬如若在一段时间内未检测到用户操作,则确定重新打开前置摄像头。
在本申请实施例中,根据第一进程的第一指令打开目标摄像头。第二进程请求打开目标摄像头,确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级。对第一进程和第二进程的系统优先级排序进行调整,得到第一优先级排序,第一优先级排序中第一进程的优先级高于第二进程的优先级。因此,通知第二进程打开目标摄像头失败。如此解决了两个进程发生摄像头使用冲突的问题。
作为本申请的一个示例,在第一进程关闭目标摄像头,第二进程已打开目标摄像头之后,请参考图11,电子设备还执行如下操作。
步骤1101:第三进程请求打开目标摄像头。
作为本申请的一个示例,第三进程为应用程序进程,示例性的,第三进程为相机进程。
作为本申请的一个示例,第三进程向相机服务模块发送第三指令,第三指令中携带待打开的摄像头的摄像头信息。
步骤1102:确定第二进程与第三进程的系统优先级排序,第二进程的系统优先级高于第三进程的系统优先级。
其具体实现可以参见上述确定第一进程与第二进程的系统优先级排序的实现方式,这里不再重复赘述。
步骤1103:调整第二进程与第三进程的系统优先级排序,得到第二进程与第三进程的第二优先级排序。
其具体实现可以参见上述调整第一进程与第二进程的系统优先级排序的实现方式,这里不再重复赘述。
步骤1104:基于第二优先级排序,关闭第二进程已打开的目标摄像头。
作为本申请的一个示例,第二优先级排序中,第三进程的优先级排于第二进程的优先级之前,所以电子设备关闭第二进程已打开的目标摄像头。示例性地,由上述相机服务模块关闭第二进程已打开的目标摄像头。
步骤1105:根据第三进程的请求打开目标摄像头。
作为本申请的一个示例,由相机服务模块根据第三指令中携带的摄像头信息,打开目标摄像头。
至此已经解决了摄像头使用冲突的问题。作为本申请的一个示例,电子设备在根据第三进程的请求打开目标摄像头之后,还执行如下操作。
步骤1106:向第二进程发送摄像头状态变更的通知。
作为本申请的一个示例,相机服务模块在根据第三进程的请求打开目标摄像头之后,可以通知第二进程,譬如,相机服务模块向第二进程发送摄像头状态变更的通知。
步骤1107:第二进程通过监听模块监听摄像头状态变更的通知。
作为本申请的一个示例,第二进程通过监听模块监听摄像头状态变更的通知之后,可以确定当前第三进程正在打开目标摄像头,如此,即使到达人眼检测时机,第二进程也不会执行AO业务。
需要说明的是,上述是以默认该自定义的进程优先级信息中包括第一进程和/或第二进程的优先级信息为例进行说明。接下来请参考图12,图12是根据另一示例性实施例示出的一种控制摄像头的方法流程图。该方法可以包括如下内容:
1201至1202请参见上述图10所示实施例中的1001至1002,这里不再重复赘述。
1203:根据第一标识信息和第二标识信息,查询自定义的进程优先级信息中是否包括第一进程的优先级信息和/或第二进程的优先级信息。
作为本申请的一个示例,第一进程是应用程序进程,第二进程是AO业务进程。
如果自定义的进程优先级信息中包括AO业务进程的标签,可以确定自定义的进程优先级信息中包括AO业务进程的优先级信息。同理,若自定义的进程优先级信息中包括应用标识,则可以确定自定义的进程优先级信息中包括应用程序进程的优先级信息。
在一个实施例中,在自定义的进程优先级信息中包括AO业务进程的优先级信息和/或应用程序进程的优先级信息的情况下,执行如下步骤1204。否则,若自定义的进程优先级信息中不包括AO业务进程的优先级信息且不包括应用程序进程的优先级信息,则执行如下步骤1205。
1204:根据第一标识信息、第二标识信息、自定义的进程优先级信息,确定第一优先级排序。
也就是说,在根据AO业务进程的标签、应用标识、自定义的进程优先级信息,确定AO业务进程和应用程序进程的优先级排序之前,电子设备先查询自定义的进程优先级信息中是否包括AO业务进程的标签和应用标识,从而判断自定义的进程优先级信息中是否包括AO业务进程的优先级信息,以及是否包括应用程序进程的优先级信息。在确定自定义的进程优先级信息中包括AO业务进程的标签和/或应用标识的情况下,说明可以根据自定义的进程优先级信息,确定AO业务进程和应用程序进程的优先级排序。
1205:根据第一进程的系统优先级和第二进程的系统优先级,确定第一优先级排序。
也即若自定义的进程优先级信息中不包括AO业务进程的标签和应用标识,则根据AO业务进程的系统优先级和应用程序进程的系统优先级,确定AO业务进程和应用程序进程的优先级排序。
在本申请实施例中,在根据自定义的进程优先级信息对AO业务进程和应用程序进程优先级排序之前,先查询自定义的进程优先级信息中是否包括AO业务进程的优先级信息和应用程序进程的优先级信息。在包括的情况下,再根据自定义的进程优先 级信息对AO业务进程和应用程序进程优先级排序,否则,根据系统优先级对AO业务进程和应用程序进程进行优先级排序。如此可以保证在没有对AO业务进程和应用程序进程的优先级进行自定义的情况下,仍可以根据系统优先级确定这两者的优先级排序,从而确定哪个进程打开摄像头,避免因冲突而导致系统混乱等情况。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的控制摄像头的方法,图13是本申请实施例提供的一种控制摄像头的装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图13,该装置包括相机服务模块1310和第一进程模块1320,第一进程模块1320用于运行第二进程:作为本申请的一个示例,第一进程模块1320为上述AO模块52。
相机服务模块1310,用于根据第一进程的第一指令打开目标摄像头;
第一进程模块1320,用于请求打开目标摄像头;
相机服务模块1310,用于确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级;
相机服务模块1310,用于调整系统优先级排序,得到第一进程与第二进程的第一优先级排序;
相机服务模块1310,用于基于第一优先级排序,通知第二进程打开目标摄像头失败。
作为本申请的一个示例,相机服务模块1310用于:
根据第一进程的第一标识信息、第二进程的第二标识信息、进程优先级信息,将第一进程的优先级排于第二进程的优先级之前,进程优先级信息包括不同进程之间的自定义的优先级排序。
作为本申请的一个示例;
第一进程模块1320用于获取能够支持第二进程实现对应业务的摄像头的摄像头信息;
第一进程模块1320用于向相机服务模块1310下发用于请求打开摄像头信息对应的摄像头的第二指令,第二指令中携带摄像头信息;
若第二指令中携带的摄像头信息对应的是目标摄像头,则相机服务模块1310用于确定第二进程请求打开目标摄像头。
作为本申请的一个示例,第一进程模块1320用于:
查询摄像头列表,摄像头列表中包括多个摄像头信息,且多个摄像头信息中的每个摄像头信息与一种摄像头能力对应;
根据每个摄像头信息对应的摄像头能力,从多个摄像头信息中确定能够支持第二进程实现对应业务的摄像头能力的摄像头信息。
作为本申请的一个示例;
第一进程模块1320,用于启动监听模块,监听模块用于监听摄像头状态;
相机服务模块1310基于第一优先级排序,通知第二进程打开目标摄像头失败之后,第一进程模块1320用于通过监听模块监听到目标摄像头已关闭的通知的情况下,根据业务需求确定是否重新请求打开目标摄像头。
作为本申请的一个示例,装置还包括第二进程模块1330,第二进程模块1330用于运行第三进程,示例性地,第二进程模块1330为上述应用程序模块54。在第一进程关闭目标摄像头,第二进程已打开目标摄像头之后;
第二进程模块1330用于请求打开目标摄像头;
相机服务模块1310用于确定第二进程与第三进程的系统优先级排序,第二进程的系统优先级高于第三进程的系统优先级;
相机服务模块1310用于调整第二进程与第三进程的系统优先级排序,得到第二进程与第三进程的第二优先级排序;
相机服务模块1310用于基于第二优先级排序,关闭第二进程已打开的目标摄像头;
相机服务模块1310用于根据第三进程的请求打开目标摄像头。
作为本申请的一个示例,相机服务模块1310根据第三进程的请求打开目标摄像头之后,向第二进程发送摄像头状态变更的通知;
第一进程模块1320,用于通过监听模块监听摄像头状态变更的通知。
作为本申请的一个示例,第一进程为应用程序进程,第二进程为AO业务进程,第三进程为应用程序进程,AO业务进程用于在人眼检测时机检测到用户注视屏幕时执行指定操作。
作为本申请的一个示例,目标摄像头对应有多个摄像头信息,多个摄像头信息中的每个摄像头信息对应一种摄像头能力。
在本申请实施例中,根据第一进程的第一指令打开目标摄像头。第二进程请求打开目标摄像头,确定第一进程与第二进程的系统优先级排序,系统优先级排序中第二进程的系统优先级高于第一进程的系统优先级。对第一进程和第二进程的系统优先级排序进行调整,得到第一优先级排序,第一优先级排序中第一进程的优先级高于第二进程的优先级。因此,通知第二进程打开目标摄像头失败。如此解决了两个进程发生摄像头使用冲突的问题。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到电子设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (12)

  1. 一种控制摄像头的方法,其特征在于,所述方法包括:
    根据第一进程的第一指令打开目标摄像头;
    第二进程请求打开所述目标摄像头;
    确定所述第一进程与所述第二进程的系统优先级排序,所述系统优先级排序中所述第二进程的系统优先级高于所述第一进程的系统优先级;
    调整所述系统优先级排序,得到所述第一进程与所述第二进程的第一优先级排序;
    基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败。
  2. 根据权利要求1所述的方法,其特征在于,所述调整所述系统优先级排序,包括:
    根据所述第一进程的第一标识信息、所述第二进程的第二标识信息、进程优先级信息,将所述第一进程的优先级排于所述第二进程的优先级之前,所述进程优先级信息包括不同进程之间的自定义的优先级排序。
  3. 根据权利要求1所述的方法,其特征在于,所述第二进程请求打开所述目标摄像头,包括:
    所述第二进程获取能够支持所述第二进程实现对应业务的摄像头的摄像头信息;
    所述第二进程下发用于请求打开所述摄像头信息对应的摄像头的第二指令,所述第二指令中携带所述摄像头信息;
    若所述第二指令中携带的摄像头信息对应的是所述目标摄像头,则确定第二进程请求打开所述目标摄像头。
  4. 根据权利要求3所述的方法,其特征在于,所述第二进程获取能够支持所述第二进程实现对应业务的摄像头的摄像头信息,包括:
    所述第二进程查询摄像头列表,所述摄像头列表中包括多个摄像头信息,且所述多个摄像头信息中的每个摄像头信息与一种摄像头能力对应;
    根据所述每个摄像头信息对应的摄像头能力,从所述多个摄像头信息中确定能够支持所述第二进程实现对应业务的摄像头能力的摄像头信息。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述方法还包括:
    所述第二进程启动监听模块,所述监听模块用于监听摄像头状态;
    所述基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败之后,还包括:
    在所述第二进程通过所述监听模块监听到所述目标摄像头已关闭的通知的情况下,根据业务需求确定是否重新请求打开所述目标摄像头。
  6. 根据权利要求1所述的方法,其特征在于,在所述第一进程关闭所述目标摄像头,所述第二进程已打开所述目标摄像头之后,所述方法还包括:
    第三进程请求打开所述目标摄像头;
    确定所述第二进程与所述第三进程的系统优先级排序,所述第二进程的系统优先级高于所述第三进程的系统优先级;
    调整所述第二进程与所述第三进程的系统优先级排序,得到所述第二进程与所述 第三进程的第二优先级排序;
    基于所述第二优先级排序,关闭所述第二进程已打开的所述目标摄像头;
    根据所述第三进程的请求打开所述目标摄像头。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述第三进程的请求打开所述目标摄像头之后,还包括:
    向所述第二进程发送摄像头状态变更的通知;
    所述第二进程通过监听模块监听所述摄像头状态变更的通知,所述监听模块用于监听摄像头状态。
  8. 根据权利要求6或7所述的方法,其特征在于,所述第一进程为应用程序进程,所述第二进程为AO业务进程,所述第三进程为应用程序进程,所述AO业务进程用于在人眼检测时机检测到用户注视屏幕时执行指定操作。
  9. 根据权利要求1-3、6-8中任一项所述的方法,其特征在于,所述目标摄像头对应有多个摄像头信息,所述多个摄像头信息中的每个摄像头信息对应一种摄像头能力。
  10. 一种电子设备,其特征在于,所述电子设备包括包括存储器和处理器;
    所述存储器用于存储支持所述电子设备执行权利要求1-9任一项所述的方法的程序,以及存储用于实现权利要求1-9任一项所述的方法所涉及的数据;所述处理器被配置为用于执行所述存储器中存储的程序。
  11. 一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,其特征在于,当其在计算机上运行时,使得计算机执行权利要求1-9任一项所述的方法。
  12. 一种控制摄像头的方法,其特征在于,所述方法包括:
    根据第一进程的第一指令打开目标摄像头,所述第一进程为应用程序进程;
    第二进程请求打开所述目标摄像头,所述第二进程为AO业务进程,所述AO业务进程是系统进程,所述AO业务进程用于在检测到用户注视屏幕时指示其他进程执行指定操作;
    确定所述第一进程与所述第二进程的系统优先级排序,所述系统优先级排序中所述第二进程的系统优先级高于所述第一进程的系统优先级;
    根据所述第一进程的应用标识、所述第二进程的标签、自定义的进程优先级信息,调整所述系统优先级排序,得到所述第一进程与所述第二进程的第一优先级排序,所述进程优先级信息包括不同进程之间的自定义的优先级排序;
    基于所述第一优先级排序,通知所述第二进程打开所述目标摄像头失败。
PCT/CN2022/089557 2021-08-09 2022-04-27 控制摄像头的方法、电子设备及计算机可读存储介质 WO2023015956A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110911919.6A CN113778641B (zh) 2021-08-09 2021-08-09 控制摄像头的方法、电子设备及计算机可读存储介质
CN202110911919.6 2021-08-09

Publications (1)

Publication Number Publication Date
WO2023015956A1 true WO2023015956A1 (zh) 2023-02-16

Family

ID=78837281

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/089557 WO2023015956A1 (zh) 2021-08-09 2022-04-27 控制摄像头的方法、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN113778641B (zh)
WO (1) WO2023015956A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117692540A (zh) * 2023-08-16 2024-03-12 荣耀终端有限公司 业务管理方法、电子设备及计算机可读存储介质
CN117707719A (zh) * 2023-06-29 2024-03-15 荣耀终端有限公司 进程管理的方法、电子设备及可读存储介质
CN117725941A (zh) * 2024-02-02 2024-03-19 荣耀终端有限公司 扫码方法及电子设备
CN117971305A (zh) * 2024-03-28 2024-05-03 荣耀终端有限公司 操作系统的升级方法、服务器及电子设备
CN118450035A (zh) * 2023-09-12 2024-08-06 荣耀终端有限公司 电子设备的控制方法、电子设备以及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778641B (zh) * 2021-08-09 2022-08-19 荣耀终端有限公司 控制摄像头的方法、电子设备及计算机可读存储介质
CN116700815B (zh) * 2022-10-21 2024-04-26 荣耀终端有限公司 硬件资源控制方法、电子设备及可读存储介质
CN118450251A (zh) * 2023-12-22 2024-08-06 荣耀终端有限公司 摄像头使能优先级的管理方法、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120281095A1 (en) * 2009-11-27 2012-11-08 Sentry Technology Corporation Enterprise management system and auditing method employed thereby
CN106339268A (zh) * 2016-09-12 2017-01-18 广东欧珀移动通信有限公司 应用程序控制方法和智能终端
CN108429879A (zh) * 2018-02-13 2018-08-21 广东欧珀移动通信有限公司 电子设备、摄像头控制方法及相关产品
CN112399232A (zh) * 2019-08-18 2021-02-23 海信视像科技股份有限公司 一种显示设备、摄像头优先级使用的控制方法及装置
CN113778641A (zh) * 2021-08-09 2021-12-10 荣耀终端有限公司 控制摄像头的方法、电子设备及计算机可读存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100785104B1 (ko) * 2005-10-19 2007-12-12 엘지전자 주식회사 이동통신 단말기의 자원 관리 장치 및 방법
US9400677B2 (en) * 2013-01-02 2016-07-26 Apple Inc. Adaptive handling of priority inversions using transactions
CN103677848B (zh) * 2013-12-27 2018-11-16 厦门雅迅网络股份有限公司 一种基于Android的摄像头控制方法
CN103793246B (zh) * 2014-01-22 2017-09-05 深圳Tcl新技术有限公司 协调摄像头资源的方法及系统
US10212326B2 (en) * 2016-11-18 2019-02-19 Microsoft Technology Licensing, Llc Notifications for control sharing of camera resources
CN107589994B (zh) * 2017-08-16 2020-12-01 深圳市爱培科技术股份有限公司 应用进程优先级管理的方法、设备、系统及存储介质
CN109462726B (zh) * 2017-09-06 2021-01-19 比亚迪股份有限公司 摄像头的控制方法和装置
CN112363836A (zh) * 2020-11-12 2021-02-12 四川长虹电器股份有限公司 一种Android系统相机资源管控的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120281095A1 (en) * 2009-11-27 2012-11-08 Sentry Technology Corporation Enterprise management system and auditing method employed thereby
CN106339268A (zh) * 2016-09-12 2017-01-18 广东欧珀移动通信有限公司 应用程序控制方法和智能终端
CN108429879A (zh) * 2018-02-13 2018-08-21 广东欧珀移动通信有限公司 电子设备、摄像头控制方法及相关产品
CN112399232A (zh) * 2019-08-18 2021-02-23 海信视像科技股份有限公司 一种显示设备、摄像头优先级使用的控制方法及装置
CN113778641A (zh) * 2021-08-09 2021-12-10 荣耀终端有限公司 控制摄像头的方法、电子设备及计算机可读存储介质

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117707719A (zh) * 2023-06-29 2024-03-15 荣耀终端有限公司 进程管理的方法、电子设备及可读存储介质
CN117692540A (zh) * 2023-08-16 2024-03-12 荣耀终端有限公司 业务管理方法、电子设备及计算机可读存储介质
CN118450035A (zh) * 2023-09-12 2024-08-06 荣耀终端有限公司 电子设备的控制方法、电子设备以及存储介质
CN117725941A (zh) * 2024-02-02 2024-03-19 荣耀终端有限公司 扫码方法及电子设备
CN117971305A (zh) * 2024-03-28 2024-05-03 荣耀终端有限公司 操作系统的升级方法、服务器及电子设备

Also Published As

Publication number Publication date
CN113778641A (zh) 2021-12-10
CN113778641B (zh) 2022-08-19

Similar Documents

Publication Publication Date Title
WO2023015956A1 (zh) 控制摄像头的方法、电子设备及计算机可读存储介质
US20220247857A1 (en) Full-screen display method for mobile terminal and device
EP3964954A1 (en) Processing method and apparatus for waiting scenario in application
US20230351048A1 (en) Application Permission Management Method and Apparatus, and Electronic Device
CN111913750B (zh) 一种应用程序管理方法、装置及设备
EP4086780A1 (en) File sharing method and system, and related device
EP4192058A1 (en) Bluetooth communication method, terminal device, and computer-readable storage medium
EP4096204B1 (en) Method for controlling communication service state, terminal device and readable storage medium
EP4095664A1 (en) Split-screen display method and electronic device
US11973895B2 (en) Call method and apparatus
EP4130955A1 (en) Method for managing application window, and terminal device and computer-readable storage medium
EP4395294A1 (en) Quick photographing method, electronic device, and computer readable storage medium
CN114115770B (zh) 显示控制的方法及相关装置
CN112527476A (zh) 资源调度方法及电子设备
CN114095599B (zh) 消息显示方法和电子设备
CN113805797A (zh) 网络资源的处理方法、电子设备及计算机可读存储介质
CN113438366B (zh) 信息通知的交互方法、电子设备和存储介质
EP4421602A1 (en) Management method for application card, electronic device, and storage medium
WO2022242412A1 (zh) 杀应用的方法及相关设备
EP4239464A1 (en) Method for invoking capabilities of other devices, electronic device, and system
WO2021129453A1 (zh) 一种截屏方法及相关设备
CN114826636B (zh) 访问控制系统及相关方法和设备
WO2024078315A1 (zh) 一种应用控制方法、电子设备和系统
EP4394636A1 (en) Application display method, electronic device, and storage medium
WO2024114212A1 (zh) 跨设备切换焦点的方法、电子设备及系统

Legal Events

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

Ref document number: 22854956

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22854956

Country of ref document: EP

Kind code of ref document: A1