[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2020237545A1 - Camera starting method and related apparatus - Google Patents

Camera starting method and related apparatus Download PDF

Info

Publication number
WO2020237545A1
WO2020237545A1 PCT/CN2019/089121 CN2019089121W WO2020237545A1 WO 2020237545 A1 WO2020237545 A1 WO 2020237545A1 CN 2019089121 W CN2019089121 W CN 2019089121W WO 2020237545 A1 WO2020237545 A1 WO 2020237545A1
Authority
WO
WIPO (PCT)
Prior art keywords
camera
application
thread
target
camera application
Prior art date
Application number
PCT/CN2019/089121
Other languages
French (fr)
Chinese (zh)
Inventor
李军
王泽权
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980090943.9A priority Critical patent/CN113366819B/en
Priority to PCT/CN2019/089121 priority patent/WO2020237545A1/en
Publication of WO2020237545A1 publication Critical patent/WO2020237545A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/725Cordless telephones

Definitions

  • This application relates to the field of electronic technology, and in particular to a camera activation method and related devices.
  • the embodiments of the present application provide a camera startup method and related devices, which can concurrently execute opening a camera application and a target camera associated with the camera application, thereby improving the startup speed of the camera application.
  • an embodiment of the present application provides a camera startup method applied to an electronic device, and the method includes:
  • the first thread is started and the camera application is started through the first thread to display the camera preview interface, and the second thread is started and passed through the second thread.
  • the thread notifies the system service to perform a preset operation to start the target camera associated with the camera application;
  • the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
  • an embodiment of the present application provides a camera activation device, which is applied to an electronic device, the camera activation device includes a processing unit and a communication unit, wherein:
  • the processing unit is configured to start a first thread and start the camera application through the first thread to display the camera preview interface when the selection operation for the application icon of the camera application on the desktop is detected, and start the second Thread and notify the system service to execute a preset operation through the second thread to start the target camera associated with the camera application;
  • the preset operation includes the following operations: determining whether the selected application is a camera application according to the intent received through the communication unit; when it is detected that the selected application is the camera application, opening The target camera associated with the camera application.
  • embodiments of the present application provide an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be processed by the above
  • the above-mentioned program includes instructions for executing the steps in any method of the first aspect of the embodiments of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the foregoing computer-readable storage medium stores a computer program for electronic data exchange, wherein the foregoing computer program enables a computer to execute In one aspect, some or all of the steps described in any method.
  • embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute For example, some or all of the steps described in any method of the first aspect.
  • the computer program product may be a software installation package.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • FIG. 1 is a schematic flowchart of a camera startup method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another camera startup method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another camera starting method provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Fig. 5 is a block diagram of functional units of a camera starting device provided by an embodiment of the present application.
  • the electronic device involved in the embodiments of the application may be an electronic device with camera activation capability.
  • the electronic device may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or devices connected to a wireless modem.
  • Other processing equipment, and various forms of user equipment User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), etc.
  • FIG. 1 is a schematic flowchart of a method for starting a camera provided in an embodiment of the present application, which is applied to an electronic device.
  • the camera startup method includes:
  • the electronic device obtains a selection operation for an application icon of a camera application on a desktop.
  • the process of enabling the camera is that when the user clicks on the application icon of a certain camera application, the desktop determines whether it is a camera application, and if so, sends the intent intent to the system service, and the system service completes the intent.
  • the camera application process is created.
  • the camera application will read the identification of the camera that currently needs to be opened, and then execute the opening of the camera, so that the camera is opened and the camera application interface is presented as a camera preview interface.
  • This series of operations are all serial. Therefore, from a visual point of view, the user cannot see the camera preview interface immediately after opening the camera application, because the camera may not be opened yet.
  • the first thread and the second thread are started at the same time. Two threads can complete the work of the above one thread, thereby saving part of time and improving the startup efficiency of the camera application.
  • S102 The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
  • camera applications are camera applications.
  • Camera applications include system camera applications and third-party camera applications.
  • system camera applications can present a camera preview interface after opening the application.
  • the camera preview interface may be displayed directly after opening the application, such as the light camera, B612 camera, and other applications, and some may display the camera preview interface after opening the application after corresponding operations, such as beauty Camera, Meitu Xiuxiu and other applications.
  • the camera application in this application mainly refers to an application that can directly present a camera preview interface after opening the camera application.
  • S103 The electronic device simultaneously starts a second thread and notifies the system service to perform a preset operation through the second thread to start the target camera associated with the camera application.
  • the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
  • the intent is mainly to solve the communication between the various components of the Android application, and is responsible for describing the action of an operation in the application, the action related data, and additional data.
  • the system service can find the corresponding component according to the description of the intent, and Pass the intent to the called component and complete the invocation of the component. Therefore, the intent acts as a media intermediary, specifically providing information about the mutual invocation of components.
  • the intent is used to tell the system to open a certain camera. This action corresponds to the rear camera 1.
  • the system can determine whether to open the rear camera 1 based on this intent.
  • the system service After detecting the selection operation of the application icon for the desktop, the system service will receive an intent related to the application icon.
  • the system service can determine whether the selected application is a camera application based on the received intent. If it is, You need to start two threads to open the camera application and the camera respectively. If not, you only need to start one thread to open the application.
  • starting the camera application is also executed by the system service, and then the camera application opens the camera, and in this application embodiment, after starting the first thread to start the camera application, it can also be started
  • the second thread can notify the system service to perform preset operations to open the target camera, that is, the system service uses two threads to realize opening the camera application and opening the target camera associated with the camera application, instead of waiting for the camera application
  • the camera application executes to turn on the camera.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • the system service determines whether the selected application is a camera application according to the received intent, including: the system service reads the application package name of the camera application after parsing the intent; The system service determines whether the camera application is a camera application according to the application package name.
  • Intent needs to indicate where this communication request comes from, where to go, how to go, and the initiator carries the data content of this communication request, the receiver unpacks the received intent packet, and if the initiator requests to judge the reception As a result of the processing by the party, the intent is responsible for allowing the receiver to return the response data content.
  • the system service After receiving the intent sent by the desktop, the system service analyzes the intent and reads the analysis result, and can determine whether the camera application is a camera application according to the application package name of the camera application selected by the user. In fact, before the two threads are executed at the same time, it is known that the camera application is targeted, but in the second thread, it will be judged again whether the target object is a camera application.
  • the second thread by parsing the intent and reading the application package name of the camera application, it can be determined again whether the current target application is a camera application, and at the same time, the camera application can also be obtained Related information, determine the target task is to open the camera of the camera application.
  • opening the target camera associated with the camera application includes: the system service determines whether the camera application is Have the authority to open the camera of the electronic device; if so, the system opens the target camera with this service.
  • some applications may have the permission to use the camera of the electronic device, and some applications do not have the permission to use the camera, and the electronic device has at least one front camera and at least one rear camera.
  • the user can set it so that Some applications (such as camera applications dedicated to facial beautification) only have the permission to use the front camera.
  • Some applications such as camera applications dedicated to facial beautification
  • the front camera can be used directly when opening such applications.
  • some applications can You only have permission to use the rear camera.
  • the advantage of this is that you can directly use the rear camera when opening such applications.
  • the system service will detect whether the camera application has permission to open the target camera, and if so, will it agree to open the target camera in advance.
  • the system service does not have the permission to open the camera before the application is fully started.
  • the system service needs to determine whether there is permission to open the camera before opening the camera. If so, perform the opening camera application association If it is not the target camera, the second thread is ended, and the camera application is executed to open the camera.
  • opening the target camera associated with the camera application includes: the system service reads the target camera And determine the target camera according to the identity; the system service calls the camera open program and opens the target camera.
  • each camera application is associated with a target camera. Since the electronic device has multiple cameras, when using the camera application, the user can determine which camera is currently being used through settings. After exiting the application, when the camera application is opened again, Directly use the camera used before closing the application last time, that is, the target camera. For example, the electronic device has four cameras, and each camera corresponds to an identity. When the camera application was exited last time, the second camera was used. Therefore, the second camera is the target camera associated with the camera application, and the system service reads the target After the identification of the camera, you can know that the second camera is to be opened. The system service opens the target camera by calling the camera open program. Among them, if the program requests camera open during operation but does not actually obtain the permission to operate the camera, it will cause the camera open to fail to open all the time. Therefore, the target camera has the permission to open camera.
  • the method further includes: notifying the system service to send a notification message to the camera application through the second thread, and ending In the second thread, the notification message is used to notify the camera application that the target camera has been opened.
  • the second thread after the target camera is opened, the second thread will notify the system service to send a notification message to the camera application function, and terminate the second thread. At this time, the first thread is still running. After the camera application is opened in the first thread, the camera application will receive this notification message to know that the camera has been opened.
  • a notification message is sent to the camera application being started by the first thread through the second thread to inform the camera application that the target camera is already open at this time, so that in the first thread, the camera application does not need to be opened after it is started.
  • the target camera but directly uses the target camera that has been opened, which is conducive to the camera application interface can quickly present the camera preview interface.
  • the method further includes: informing the camera application to turn on the target camera when it is detected that the camera application has not received the notification message through the first thread.
  • the camera application function does not know whether the camera is turned on at this time, it may have been turned on but the notification message has not been received, or it may not have been turned on and therefore cannot be received Notification message, at this time, the camera application needs to take the initiative to open the target camera.
  • the camera application when it receives a notification message from the second thread, it does not need to turn on the camera. If it receives a notification message from the second thread, the target camera can be used directly, eliminating the need for the camera application This process of opening the camera.
  • the method before starting the first thread and starting the camera application through the first thread to display the camera preview interface, the method further includes: determining whether the application icon corresponding to the selection operation is all The application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
  • the application to be started is the camera application. Therefore, in the process of starting the camera application, two threads are started. One thread is used to start the camera application, and the other thread is used to open the camera. Therefore, after starting the camera application, the application interface can be directly presented as the camera preview interface, because the camera is already turned on at this time.
  • an embodiment of the present application provides a camera startup method that opens the camera device in advance, speeds up the startup time of the camera application, recognizes the camera click operation in advance, reads the camera to be opened, and starts the thread to complete the operation of opening the camera.
  • the desktop sends the application intent that needs to be started to the Activity Manager Service (AMS), where AMS has functions such as managing Activity behavior, controlling the activity life cycle, dispatching message events, and memory management.
  • AMS Activity Manager Service
  • the AMS process is actually the System Server process of the system service. It is just a service started by the system service. It runs in a thread of the system service.
  • the user clicks the application icon in the Launcher program it will notify AMS to enable the main activity of the application.
  • AMS parses the intent, reads the package name of the application to be opened, and identifies whether it is a camera application. If it is, AMS reads whether the camera application that needs to be opened has the permission to open the camera of the electronic device, if it is, AMS reads the camera that needs to be opened For example, the electronic device has a front camera and three rear cameras, so there are four camera IDs. AMS determines which camera of the electronic device needs to be opened based on the ID of the camera to be opened. After reading the camera’s identity, AMS starts the thread to perform the Camera open operation to open the camera, and after creating the Camera object, the Camera object is sent to another thread. At this time, in another thread, the opening has been executed.
  • the camera application the camera application will receive the Camera object that opened the camera, the camera application will first determine whether the passed Camera object is empty, if it is not, it means that the camera has been opened, and there is no need to execute the Camera open method, if it is, it means that If the camera is not opened successfully, the camera application needs to execute the opening of the camera.
  • the application currently to be launched by the electronic device is a camera application
  • the selection operation for the application is to open the camera application and display the camera preview interface
  • the camera operation and the camera application start are just opened. Parallel execution to improve the camera startup time, users do not need a long waiting time when opening the camera application, and can use the camera faster.
  • the selection operation is a touch operation on the touch display screen of the electronic device; the determining whether the application icon corresponding to the selection operation is the application icon of the camera application includes : Determine that the application icon of the camera application is in the target display area of the application desktop; when the selection operation is acquired, determine the touch area corresponding to the selection operation; when the touch area and the target are detected When the display area matches, it is determined that the application icon selected by the selection operation is the application icon of the camera application.
  • the electronic device when the selection operation for the application icon of the camera application on the desktop is detected, the electronic device first obtains the selection operation, and then determines the application icon of the camera application selected during the selection operation. Since the electronic device now has multiple camera applications, the target display area of these multiple camera applications on the application desktop can be determined first. Therefore, when the selection operation is obtained, the touch area corresponding to the selection operation can be immediately determined. It is determined whether the application icon selected by the selection operation is an application icon of a camera application, and there is no need for the desktop to determine the selected application through a series of processes such as obtaining the application identifier and analyzing the application identity.
  • the method further includes: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, controlling the target camera to remain in an open state.
  • the camera after opening the camera application, the camera will be opened to present the camera preview interface. Since the camera is called by the camera application and controlled to open and close, the camera is closed after exiting the application interface, for example, during video During a call, if you quit the application interface of the currently open camera, the caller cannot see the face or sees the picture freezes, because the camera is actually turned off at this time. In this application, the camera is turned on and off by the system service. Therefore, even after exiting the application interface, the camera can be kept open, that is, the application can close the camera and the system service can also close the camera.
  • the application scene of the camera application is recognized.
  • the camera application function is in the video shooting scene or the video call scene, it can be set so that after exiting the camera preview interface, or after the shooting interface, the camera can still be kept in In the open state, continue to record or shoot video.
  • the camera can be closed after exiting the application interface of the camera application.
  • the system service can control the opening and closing of the camera. In this type of scenario, after the front desk exits the application interface, you can continue to shoot and record the video without turning off the camera, thereby improving user experience.
  • FIG. 2 is a schematic flowchart of a camera startup method provided by an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the camera startup method includes:
  • S201 The electronic device obtains a selection operation for an application icon of a camera application on the desktop.
  • S202 The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
  • S203 The electronic device starts a second thread and notifies the system service through the second thread to determine whether the selected application is a camera application according to the received intent.
  • the electronic device notifies the system service to send a notification message to the camera application through the second thread, and ends the second thread, where the notification message is used to notify the camera application that the target camera has been turn on.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • the second thread sends a notification message to the camera application being started by the first thread to inform the camera application that the target camera has been opened at this time, so that in the first thread, the camera application does not need to open the target camera after the camera application is started. It is to directly use the opened target camera, which is conducive to the camera application interface can quickly present the camera preview interface.
  • FIG. 3 is a schematic flowchart of a camera startup method provided by an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the camera startup method includes:
  • S301 The electronic device obtains a selection operation for an application icon of the camera application on the desktop.
  • S302 The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
  • S303 The electronic device starts a second thread and notifies the system service through the second thread to determine whether the selected application is a camera application according to the received intent.
  • the electronic device notifies the system service to send a notification message to the camera application through the second thread, and ends the second thread, where the notification message is used to notify the camera application that the target camera has been turn on.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • the second thread sends a notification message to the camera application being started by the first thread to inform the camera application that the target camera has been opened at this time, so that in the first thread, the camera application does not need to open the target camera after the camera application is started. It is to directly use the opened target camera, which is conducive to the camera application interface can quickly present the camera preview interface.
  • the camera can be closed.
  • special application scenarios such as video shooting scenes and video call scenes
  • the system service can control the opening and closing of the camera, in such scenes
  • FIG. 4 is a schematic structural diagram of an electronic device 400 provided by an embodiment of the present application.
  • the electronic device 400 has one or Multiple application programs and operating systems.
  • the electronic device 400 includes a processor 410, a memory 420, a communication interface 430, and one or more programs 421, wherein the one or more programs 421 are stored in the In the memory 420 and configured to be executed by the processor 410, the one or more programs 421 include instructions for executing the following steps;
  • the first thread is started and the camera application is started through the first thread to display the camera preview interface, and the second thread is started and passed through the second thread.
  • the thread notifies the system service to perform a preset operation to start the target camera associated with the camera application;
  • the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • the instructions in the program are specifically used to perform the following operations: the system service parses the intent Then read the application package name of the camera application; the system service determines whether the camera application is a camera application according to the application package name.
  • the system service when the system service detects that the selected application is the camera application, in terms of opening the target camera associated with the camera application, the instructions in the program are specifically used to execute The following operations: the system service determines whether the camera application has the permission to open the camera of the electronic device; if so, the system opens the target camera by the service.
  • the instructions in the program are specifically used to execute The following operations: the system service reads the identity of the target camera, and determines the target camera according to the identity; the system service calls the camera open program and opens the target camera.
  • the instructions in the program are specifically used to perform the following operations: notify the system service to the camera through the second thread
  • the application sends a notification message and ends the second thread, where the notification message is used to notify the camera application that the target camera has been opened.
  • the instructions in the program are specifically used to perform the following operations: when the first thread detects that the camera application has not received the notification message, notify the camera application to open the Target camera.
  • the instructions in the program are specifically used to perform the following operations: determining the selection operation Whether the corresponding application icon is the application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
  • the selection operation is a touch operation on the touch display screen of the electronic device; in the aspect of determining whether the application icon corresponding to the selection operation is the application icon of the camera application ,
  • the instructions in the program are specifically used to perform the following operations: determine that the application icon of the camera application is in the target display area of the application desktop; when the selection operation is obtained, determine the touch area corresponding to the selection operation When detecting that the touch area and the target display area match, determine that the application icon selected by the selection operation is the application icon of the camera application.
  • the instructions in the program are specifically used to perform the following operations: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, control the The target camera remains open.
  • the electronic device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the method example.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 5 is a block diagram of the functional unit composition of the camera activation device 500 involved in an embodiment of the present application.
  • the camera starting device 500 is applied to electronic equipment, and includes a processing unit 501 and a communication unit 502, wherein,
  • the processing unit 501 is configured to start a first thread and start the camera application through the first thread to display the camera preview interface when the selection operation for the application icon of the camera application on the desktop is detected, and at the same time start the first thread Two threads and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application;
  • the preset operation includes the following operations: determining whether the selected application is a camera application according to the intent received through the communication unit 502; when it is detected that the selected application is the camera application, Open the target camera associated with the camera application.
  • the camera starting device 500 may further include a storage unit 503, which is used to store program codes and data of the electronic device.
  • the processing unit 501 may be a processor
  • the communication unit 502 may be a touch screen or a transceiver
  • the storage unit 503 may be a memory.
  • the electronic device when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
  • the processing unit 501 is specifically configured to: control the system service to parse the intent and then read The application package name of the camera application; and for controlling the system service to determine whether the camera application is a camera application according to the application package name.
  • the processing unit 501 when the system service detects that the selected application is the camera application and opens the target camera associated with the camera application, the processing unit 501 is specifically configured to: control The system service determines whether the camera application has the permission to open the camera of the electronic device; if so, the system uses the service to open the target camera.
  • the processing unit 501 when the system service detects that the selected application is the camera application and opens the target camera associated with the camera application, the processing unit 501 is specifically configured to: control The system service reads the identity of the target camera, and determines the target camera according to the identity; and is used to control the system service to call the camera open program and open the target camera.
  • the processing unit 501 is specifically configured to: notify the system service to send a notification message to the camera application through the second thread , And end the second thread, and the notification message is used to notify the camera application that the target camera has been opened.
  • the processing unit 501 is specifically configured to notify the camera application to turn on the target camera when it is detected through the first thread that the camera application does not receive the notification message.
  • the processing unit 501 is specifically configured to: determine the application icon corresponding to the selection operation Whether it is the application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
  • the selection operation is a touch operation on the touch display screen of the electronic device; in the aspect of determining whether the application icon corresponding to the selection operation is the application icon of the camera application
  • the processing unit 501 is specifically configured to: determine that the application icon of the camera application is in the target display area of the application desktop; and, when the selection operation is acquired, determine the touch area corresponding to the selection operation; And for determining that the application icon selected by the selection operation is the application icon of the camera application when it is detected that the touch area and the target display area match.
  • the processing unit 501 is specifically configured to: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, control the target camera to remain at Open state.
  • An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method as recorded in the above method embodiment ,
  • the aforementioned computer includes electronic equipment.
  • the embodiments of the present application also provide a computer program product.
  • the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program.
  • the above-mentioned computer program is operable to cause a computer to execute any of the above-mentioned method embodiments. Part or all of the steps of the method.
  • the computer program product may be a software installation package, and the above-mentioned computer includes electronic equipment.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other various media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)
  • Studio Devices (AREA)
  • Stored Programmes (AREA)
  • Telephone Function (AREA)

Abstract

The present application discloses a camera starting method and a related apparatus, which are applied to an electronic device. The method comprises: when a selection operation for an application icon of a camera application on a desktop is detected, starting a first thread and starting, by means of the first thread, the camera application to display a camera preview interface, and simultaneously starting a second thread and informing, by means of the second thread, a system service to perform a preset operation to start a target camera associated with the camera application, wherein, the preset operation comprises the following operations: determining whether a selected application is a camera-type application according to a received intent; and when it is detected that the selected application is the camera-type application, turning on a target camera associated with the camera application. By means of the embodiments of the present application, the turning on of a camera application and a target camera associated with the camera application can be executed concurrently, thereby improving the starting efficiency of the camera application.

Description

相机启动方法及相关装置Camera starting method and related device 技术领域Technical field
本申请涉及电子技术领域,尤其涉及一种相机启动方法及相关装置。This application relates to the field of electronic technology, and in particular to a camera activation method and related devices.
背景技术Background technique
现有技术中,在启动相机类应用的过程中,用户在点击相机类应用的应用图标后,看到应用界面逐渐放大且整个过程应用界面是黑色的,在一定的等待时间后才看到相机预览界面,因为在打开应用的过程中,若摄像头还未打开,则应用界面会出现黑屏的状况,只有在打开摄像头之后,才能看到相机预览界面,而对于用户在拍摄一些转瞬即逝的景物时,需要在很短的时间内进行抓拍,而在等待相机应用打开摄像头的过程中,可能会错过想要抓拍的景物和事物。In the prior art, in the process of starting camera applications, after the user clicks on the application icon of the camera application, the user sees that the application interface is gradually enlarged and the application interface is black during the whole process, and the camera is only seen after a certain waiting time Preview interface, because in the process of opening the application, if the camera is not turned on, the application interface will have a black screen. Only after turning on the camera can you see the camera preview interface, and for the user to shoot some transient scenes When you need to take a snapshot in a short time, while waiting for the camera application to open the camera, you may miss the scenes and things you want to capture.
发明内容Summary of the invention
本申请实施例提供一种相机启动方法及相关装置,可以并发执行打开相机应用和该相机应用关联的目标摄像头,从而提高相机应用的启动速度。The embodiments of the present application provide a camera startup method and related devices, which can concurrently execute opening a camera application and a target camera associated with the camera application, thereby improving the startup speed of the camera application.
第一方面,本申请实施例提供一种相机启动方法,应用于电子设备,所述方法包括:In the first aspect, an embodiment of the present application provides a camera startup method applied to an electronic device, and the method includes:
在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;When the selection operation for the application icon of the camera application on the desktop is detected, the first thread is started and the camera application is started through the first thread to display the camera preview interface, and the second thread is started and passed through the second thread. The thread notifies the system service to perform a preset operation to start the target camera associated with the camera application;
其中,所述预设操作包括以下操作:根据接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
第二方面,本申请实施例提供一种相机启动装置,应用于电子设备,所述相机启动装置包括处理单元和通信单元,其中,In a second aspect, an embodiment of the present application provides a camera activation device, which is applied to an electronic device, the camera activation device includes a processing unit and a communication unit, wherein:
所述处理单元,用于在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程 并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;The processing unit is configured to start a first thread and start the camera application through the first thread to display the camera preview interface when the selection operation for the application icon of the camera application on the desktop is detected, and start the second Thread and notify the system service to execute a preset operation through the second thread to start the target camera associated with the camera application;
其中,所述预设操作包括以下操作:根据通过所述通信单元接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the intent received through the communication unit; when it is detected that the selected application is the camera application, opening The target camera associated with the camera application.
第三方面,本申请实施例提供一种电子设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面任一方法中的步骤的指令。In a third aspect, embodiments of the present application provide an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be processed by the above The above-mentioned program includes instructions for executing the steps in any method of the first aspect of the embodiments of the present application.
第四方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面任一方法中所描述的部分或全部步骤。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the foregoing computer-readable storage medium stores a computer program for electronic data exchange, wherein the foregoing computer program enables a computer to execute In one aspect, some or all of the steps described in any method.
第五方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面任一方法中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute For example, some or all of the steps described in any method of the first aspect. The computer program product may be a software installation package.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或背景技术中的技术方案,下面将对本申请实施例或背景技术中所需要使用的附图进行说明。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the following will describe the drawings that need to be used in the embodiments of the present application or the background art.
图1是本申请实施例提供的一种相机启动方法的流程示意图;FIG. 1 is a schematic flowchart of a camera startup method provided by an embodiment of the present application;
图2是本申请实施例提供的另一种相机启动方法的流程示意图;2 is a schematic flowchart of another camera startup method provided by an embodiment of the present application;
图3是本申请实施例提供的另一种相机启动方法的流程示意图;FIG. 3 is a schematic flowchart of another camera starting method provided by an embodiment of the present application;
图4是本申请实施例提供的一种电子设备的结构示意图;4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图5是本申请实施例提供的一种相机启动装置的功能单元组成框图。Fig. 5 is a block diagram of functional units of a camera starting device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to enable those skilled in the art to better understand the solution of the application, the technical solutions in the embodiments of the application will be clearly and completely described below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only It is a part of the embodiments of this application, not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the protection scope of this application.
以下分别进行详细说明。Detailed descriptions are given below.
本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third" and "fourth" in the description and claims of the application and the drawings are used to distinguish different objects, rather than describing a specific order . In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes unlisted steps or units, or optionally also includes Other steps or units inherent to these processes, methods, products or equipment.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference to "embodiments" herein means that a specific feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art clearly and implicitly understand that the embodiments described herein can be combined with other embodiments.
本申请实施例所涉及到的电子设备可以是具备相机启动能力的电子设备,该电子设备可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。The electronic device involved in the embodiments of the application may be an electronic device with camera activation capability. The electronic device may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or devices connected to a wireless modem. Other processing equipment, and various forms of user equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device), etc.
下面对本申请实施例进行详细介绍。The following describes the embodiments of the present application in detail.
请参阅图1,图1是本申请实施例提供了一种相机启动方法的流程示意图,应用于电子设备。本相机启动方法包括:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a method for starting a camera provided in an embodiment of the present application, which is applied to an electronic device. The camera startup method includes:
S101,所述电子设备获取针对桌面上的相机应用的应用图标的选取操作。S101. The electronic device obtains a selection operation for an application icon of a camera application on a desktop.
其中,现有技术中,启用相机的流程为,获取到用户点击某个相机应用的应用图标时,桌面判断是否是相机类应用,如果是,则发送意图intent给系统服务,系统服务在完成intent 解析后,创建相机应用进程,该相机应用则会读取当前需要打开的摄像头的身边标识,然后执行摄像头的打开,实现打开摄像头以及相机应用界面呈现为相机预览界面。这一系列的操作,都是串行的,因此,用户从视觉上看的话,打开相机应用后并不能马上看到相机预览界面,因为这时可能摄像头还未打开。Among them, in the prior art, the process of enabling the camera is that when the user clicks on the application icon of a certain camera application, the desktop determines whether it is a camera application, and if so, sends the intent intent to the system service, and the system service completes the intent. After parsing, the camera application process is created. The camera application will read the identification of the camera that currently needs to be opened, and then execute the opening of the camera, so that the camera is opened and the camera application interface is presented as a camera preview interface. This series of operations are all serial. Therefore, from a visual point of view, the user cannot see the camera preview interface immediately after opening the camera application, because the camera may not be opened yet.
其中,和现有技术不同的是,本申请实施例提供的相机启动方法中,在获取到针对桌面上的相机应用的应用图标的选取操作时,同时启动了第一线程和第二线程,通过两个线程可以完成上述一个线程的工作,从而,可以节省部分时间,提高相机应用的启动效率。Among them, different from the prior art, in the camera startup method provided by the embodiments of the present application, when the selection operation for the application icon of the camera application on the desktop is obtained, the first thread and the second thread are started at the same time. Two threads can complete the work of the above one thread, thereby saving part of time and improving the startup efficiency of the camera application.
S102,所述电子设备启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面。S102: The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
其中,相机应用为相机类应用,相机类应用包括系统相机应用和第三方相机应用,一般系统相机应用在打开应用后,即可呈现出相机预览界面,而针对某些第三方相机应用,有的可能在打开应用后可以直接呈现出相机预览界面,如轻颜相机,B612相机,无他相机等应用,有的可能在打开应用后通过相应的操作后才可呈现出相机预览界面,如美颜相机,美图秀秀等应用。本申请中的相机类应用主要指打开相机应用后,可以直接呈现出相机预览界面的应用。Among them, camera applications are camera applications. Camera applications include system camera applications and third-party camera applications. Generally, system camera applications can present a camera preview interface after opening the application. For some third-party camera applications, some The camera preview interface may be displayed directly after opening the application, such as the light camera, B612 camera, and other applications, and some may display the camera preview interface after opening the application after corresponding operations, such as beauty Camera, Meitu Xiuxiu and other applications. The camera application in this application mainly refers to an application that can directly present a camera preview interface after opening the camera application.
S103,所述电子设备同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头。S103: The electronic device simultaneously starts a second thread and notifies the system service to perform a preset operation through the second thread to start the target camera associated with the camera application.
其中,所述预设操作包括以下操作:根据接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
其中,intent主要是解决安卓应用的各项组件之间的通信,负责对应用中的一次操作的动作、动作涉及数据、附加数据进行描述,系统服务可以根据intent的描述,找到对应的组件,并将intent传递给被调用的组件并完成组件的调用,因此,intent起着一个媒体中介的作用,专门提供组件互相调用的相关信息。例如,intent用于告诉系统,要做打开某个摄像头的动作,此动作对应的是后置摄像头1,系统则可以根据这个intent,确定是否需要打开后置摄像头1。在检测到针对桌面的应用图标的选取操作之后,系统服务则会接收到一个和该应用图标相关的intent,系统服务可以根据接收到的intent确定被选取的应用是否为相机类应用,如果是,则需要启动两个线程,分别实现打开相机应用和摄像头,如果不是,则只 需要启动一个线程,实现打开应用。Among them, the intent is mainly to solve the communication between the various components of the Android application, and is responsible for describing the action of an operation in the application, the action related data, and additional data. The system service can find the corresponding component according to the description of the intent, and Pass the intent to the called component and complete the invocation of the component. Therefore, the intent acts as a media intermediary, specifically providing information about the mutual invocation of components. For example, the intent is used to tell the system to open a certain camera. This action corresponds to the rear camera 1. The system can determine whether to open the rear camera 1 based on this intent. After detecting the selection operation of the application icon for the desktop, the system service will receive an intent related to the application icon. The system service can determine whether the selected application is a camera application based on the received intent. If it is, You need to start two threads to open the camera application and the camera respectively. If not, you only need to start one thread to open the application.
其中,一般情况下,启动相机应用也是由系统服务来执行后,然后再由相机应用去打开摄像头,而申本请实施例中,在启动第一线程实现启动相机应用后,同时,还可以启动第二线程,第二线程可以通知系统服务执行预设操作,实现打开目标摄像头,即系统服务通过两个线程,分别去实现打开相机应用和打开相机应用关联的目标摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头。Among them, under normal circumstances, starting the camera application is also executed by the system service, and then the camera application opens the camera, and in this application embodiment, after starting the first thread to start the camera application, it can also be started The second thread, the second thread can notify the system service to perform preset operations to open the target camera, that is, the system service uses two threads to realize opening the camera application and opening the target camera associated with the camera application, instead of waiting for the camera application After startup, the camera application executes to turn on the camera.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
在一个可能的示例中,所述系统服务根据接收到的intent确定被选取的应用是否为相机类应用,包括:所述系统服务解析所述intent后读取所述相机应用的应用包名;所述系统服务根据所述应用包名确定所述相机应用是否为相机类应用。In a possible example, the system service determines whether the selected application is a camera application according to the received intent, including: the system service reads the application package name of the camera application after parsing the intent; The system service determines whether the camera application is a camera application according to the application package name.
其中,Intent在安卓中的核心作用就是跳转,同时可以携带必要的信息,将intent作为一个信息桥梁。Intent需要表明本次通信请求从哪里来,到哪里去,怎么走,以及发起方携带本次通信请求的数据内容,接收方对收到的intent数据包进行解包,以及如果发起方要求判断接收方的处理结果,intent就要负责让接收方传回应答的数据内容。系统服务在接收到由桌面发送的intent后,通过对intent进行解析并读取解析结果,可以根据用户选取的相机应用的应用包名,确定该相机应用是否为相机类应用。实际上,在同时执行两个线程之前,已经知道针对的是相机类应用,但是在第二线程中,还会再一次判断目标对象是否为相机类应用。Among them, the core role of Intent in Android is to jump, and it can carry necessary information at the same time, using intent as an information bridge. Intent needs to indicate where this communication request comes from, where to go, how to go, and the initiator carries the data content of this communication request, the receiver unpacks the received intent packet, and if the initiator requests to judge the reception As a result of the processing by the party, the intent is responsible for allowing the receiver to return the response data content. After receiving the intent sent by the desktop, the system service analyzes the intent and reads the analysis result, and can determine whether the camera application is a camera application according to the application package name of the camera application selected by the user. In fact, before the two threads are executed at the same time, it is known that the camera application is targeted, but in the second thread, it will be judged again whether the target object is a camera application.
可见,本示例中,在第二线程中,通过对intent进行解析后读取相机应用的应用包名,可再次确定当前的目标应用是否为相机类应用,同时,还可以获取到针对相机应用的相关信息,确定目标任务是打开相机应用的摄像头。It can be seen that in this example, in the second thread, by parsing the intent and reading the application package name of the camera application, it can be determined again whether the current target application is a camera application, and at the same time, the camera application can also be obtained Related information, determine the target task is to open the camera of the camera application.
在一个可能的示例中,所述系统服务在检测到所述被选取的应用为所述相机类应用时, 打开所述相机应用关联的目标摄像头,包括:所述系统服务确定所述相机应用是否有打开所述电子设备的摄像头的权限;若是,所述系统该服务打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application, opening the target camera associated with the camera application includes: the system service determines whether the camera application is Have the authority to open the camera of the electronic device; if so, the system opens the target camera with this service.
其中,针对相机类应用,可能有的应用具有使用电子设备摄像头的权限,有的应用没有使用摄像头的权限,并且电子设备具有至少一个前置摄像头和至少一个后置摄像头,用户可以通过设置,使得某些应用(如专门用于人脸美颜的相机类应用)只拥有前置摄像头的使用权限,这样做的好处是打开这类应用时可以直接使用前置摄像头,同理,某些应用可以只拥有后置摄像头的使用权限,这样做的好处是打开这类应用时可以直接使用后置摄像头。系统服务会检测相机应用是否有打开目标摄像头的权限,如果有,才会同意提前打开目标摄像头。Among them, for camera applications, some applications may have the permission to use the camera of the electronic device, and some applications do not have the permission to use the camera, and the electronic device has at least one front camera and at least one rear camera. The user can set it so that Some applications (such as camera applications dedicated to facial beautification) only have the permission to use the front camera. The advantage of this is that the front camera can be used directly when opening such applications. Similarly, some applications can You only have permission to use the rear camera. The advantage of this is that you can directly use the rear camera when opening such applications. The system service will detect whether the camera application has permission to open the target camera, and if so, will it agree to open the target camera in advance.
其中,对于安全等级较高的相机类应用,可以设置只有相机应用才可以打开电子设备的摄像头,例如,打开相机应用后,需要用户进行身份验证,在身份验证通过后才可打开摄像头,针对这类相机应用,在应用完全启动之前,系统服务是没有打开摄像头的权限的。Among them, for camera applications with a higher security level, you can set that only the camera application can open the camera of the electronic device. For example, after opening the camera application, the user is required to perform identity verification, and the camera can be turned on after the identity verification is passed. For camera-like applications, the system service does not have the permission to open the camera before the application is fully started.
可见,本示例中,由于此时第一线程中的相机应用还未完全成功启动,因此,系统服务在打开摄像头之前,需要先判断是否有打开摄像头的权限,如果是,再执行打开相机应用关联的目标摄像头,如果不是,则结束第二线程,由相机应用去执行打开摄像头。It can be seen that in this example, because the camera application in the first thread has not been fully successfully started at this time, the system service needs to determine whether there is permission to open the camera before opening the camera. If so, perform the opening camera application association If it is not the target camera, the second thread is ended, and the camera application is executed to open the camera.
在一个可能的示例中,所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头,包括:所述系统服务读取所述目标摄像头的身份标识,并根据所述身份标识确定所述目标摄像头;所述系统服务调用camera open程序,并打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application, opening the target camera associated with the camera application includes: the system service reads the target camera And determine the target camera according to the identity; the system service calls the camera open program and opens the target camera.
其中,每个相机应用都关联有一个目标摄像头,由于电子设备有多个摄像头,用户在使用相机应用时,可以通过设置确定当前使用哪一个摄像头,在退出应用后,再次打开该相机应用时,直接使用上次关闭应用前使用的摄像头,即目标摄像头。举例说明,电子设备有四个摄像头,每个摄像头都对应有一个身份标识,相机应用上次退出时,使用的摄像头二,因此摄像头二即为相机应用关联的目标摄像头,系统服务读取到目标摄像头的身份标识后即可知道要打开的是摄像头二。系统服务通过调用camera open程序,打开目标摄像头,其中,若程序在运行中请求camera open而实际上并未获得操作camera的权限,会导致camera open一直打开失败,因此,目标摄像头为有打开权限的摄像头。Among them, each camera application is associated with a target camera. Since the electronic device has multiple cameras, when using the camera application, the user can determine which camera is currently being used through settings. After exiting the application, when the camera application is opened again, Directly use the camera used before closing the application last time, that is, the target camera. For example, the electronic device has four cameras, and each camera corresponds to an identity. When the camera application was exited last time, the second camera was used. Therefore, the second camera is the target camera associated with the camera application, and the system service reads the target After the identification of the camera, you can know that the second camera is to be opened. The system service opens the target camera by calling the camera open program. Among them, if the program requests camera open during operation but does not actually obtain the permission to operate the camera, it will cause the camera open to fail to open all the time. Therefore, the target camera has the permission to open camera.
可见,本示例中,在系统服务打开摄像头的过程中,通过读取目标摄像头的身份标识, 确定要打开的目标摄像头为电子设备的哪一个摄像头,从而,可铜鼓调用camera open程序打开目标摄像头。It can be seen that in this example, in the process of opening the camera by the system service, by reading the identity of the target camera, it is determined which camera of the electronic device the target camera to be opened is, so that the copper drum can call the camera open program to open the target camera.
在一个可能的示例中,所述系统服务打开所述相机应用关联的目标摄像头之后,所述方法还包括:通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。In a possible example, after the system service opens the target camera associated with the camera application, the method further includes: notifying the system service to send a notification message to the camera application through the second thread, and ending In the second thread, the notification message is used to notify the camera application that the target camera has been opened.
其中,在第二线程中,打开目标摄像头之后,第二线程会通知系统服务向相机应用功能发送通知消息,并结束第二线程,此时,第一线程仍在运行过程中。在第一线程打开相机应用后,相机应用即会接收到这个通知消息从而知晓摄像头已经打开。Among them, in the second thread, after the target camera is opened, the second thread will notify the system service to send a notification message to the camera application function, and terminate the second thread. At this time, the first thread is still running. After the camera application is opened in the first thread, the camera application will receive this notification message to know that the camera has been opened.
可见,本示例中,通过第二线程向第一线程正在启动的相机应用发送通知消息,告知相机应用此时目标摄像头已经打开,从而在第一线程中,相机应用启动完成后可以不用再去打开目标摄像头,而是直接使用已经打开的目标摄像头,有利于相机应用界面可以迅速呈现出相机预览界面。It can be seen that in this example, a notification message is sent to the camera application being started by the first thread through the second thread to inform the camera application that the target camera is already open at this time, so that in the first thread, the camera application does not need to be opened after it is started. The target camera, but directly uses the target camera that has been opened, which is conducive to the camera application interface can quickly present the camera preview interface.
在一个可能的示例中,所述方法还包括;通过所述第一线程在检测到所述相机应用未接收到所述通知消息时,通知所述相机应用打开所述目标摄像头。In a possible example, the method further includes: informing the camera application to turn on the target camera when it is detected that the camera application has not received the notification message through the first thread.
其中,若在第一线程中,检测到相机应用为接收到通知消息,此时相机应用功能不知道摄像头是否打开,可能是已经打开了但是没有接收到通知消息,可能是没有打开所以接收不到通知消息,此时,相机应用需要主动去打开目标摄像头。Among them, if in the first thread, it is detected that the camera application has received a notification message, the camera application function does not know whether the camera is turned on at this time, it may have been turned on but the notification message has not been received, or it may not have been turned on and therefore cannot be received Notification message, at this time, the camera application needs to take the initiative to open the target camera.
可见,本示例中,相机应用在接收到来自第二线程的通知消息时,则不用再去打开摄像头,若是接收到了第二线程的通知消息,则可以直接使用目标摄像头,省去了由相机应用去打开摄像头的这个过程。It can be seen that in this example, when the camera application receives a notification message from the second thread, it does not need to turn on the camera. If it receives a notification message from the second thread, the target camera can be used directly, eliminating the need for the camera application This process of opening the camera.
在一个可能的示例中,所述启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面之前,所述方法还包括:确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标;若是,确定所述选取操作是否对应打开所述相机应用并显示所述相机应用的相机预览界面。In a possible example, before starting the first thread and starting the camera application through the first thread to display the camera preview interface, the method further includes: determining whether the application icon corresponding to the selection operation is all The application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
其中,在启动两个线程之前,已经知道要启动的应用为相机应用,因此,在启动相机应用的过程中,可是启动两个线程,通过一个线程来启动相机应用,通过另一个线程来打开摄像头,从而,在启动相机应用之后,应用界面可以直接呈现为相机预览界面,因为此时摄像头已经打开了。Among them, before starting the two threads, it is known that the application to be started is the camera application. Therefore, in the process of starting the camera application, two threads are started. One thread is used to start the camera application, and the other thread is used to open the camera. Therefore, after starting the camera application, the application interface can be directly presented as the camera preview interface, because the camera is already turned on at this time.
举例说明,本申请实施例提供一种相机启动方法,将打开相机设备提前进行,加快相机应用启动时间,通过提前识别相机点击操作,读取需要打开的摄像头,启动线程完成打开摄像头的操作。在检测到用户点击相机应用时,桌面发送需要启动的应用intent给活动管理服务(Activity Manager Service,AMS),其中,AMS具有管理Activity行为、控制Activity生命周期、派发消息事件、内存管理等功能,AMS进程实际上是系统服务System Server进程,只是系统服务启动的一个服务,运行在系统服务某个线程中,用户在Launcher程序里点击应用图标时,会通知AMS启用应用的主Activity。AMS解析intent,读取要打开的应用包名,识别是否为相机类应用,如果是,AMS读取需要打开的相机应用是否有打开电子设备摄像头的权限,如果是,AMS读取需要打开的摄像头的身边标识,例如,电子设备有一个前置摄像头和三个后置摄像头,因此有四个摄像头标识,AMS根据待打开的摄像头的身份标识,确定需要打开的是电子设备的哪个摄像头。在读取到摄像头的身份标识后,AMS启动线程执行Camera open操作,实现打开摄像头,并创建Camera对象后将该Camera对象发送给另一个线程,此时,在另外一个线程中,已经执行了打开相机应用,相机应用会接收到打开相机的Camera对象,相机应用首先会判断传递的Camera对象是否为空,如果不是则表明摄像头已经打开,则不需要再执行Camera的open方法,如果是,则表明摄像头没有打开成功,则需要相机应用自己去执行打开摄像头。For example, an embodiment of the present application provides a camera startup method that opens the camera device in advance, speeds up the startup time of the camera application, recognizes the camera click operation in advance, reads the camera to be opened, and starts the thread to complete the operation of opening the camera. When detecting that the user clicks on the camera application, the desktop sends the application intent that needs to be started to the Activity Manager Service (AMS), where AMS has functions such as managing Activity behavior, controlling the activity life cycle, dispatching message events, and memory management. The AMS process is actually the System Server process of the system service. It is just a service started by the system service. It runs in a thread of the system service. When the user clicks the application icon in the Launcher program, it will notify AMS to enable the main activity of the application. AMS parses the intent, reads the package name of the application to be opened, and identifies whether it is a camera application. If it is, AMS reads whether the camera application that needs to be opened has the permission to open the camera of the electronic device, if it is, AMS reads the camera that needs to be opened For example, the electronic device has a front camera and three rear cameras, so there are four camera IDs. AMS determines which camera of the electronic device needs to be opened based on the ID of the camera to be opened. After reading the camera’s identity, AMS starts the thread to perform the Camera open operation to open the camera, and after creating the Camera object, the Camera object is sent to another thread. At this time, in another thread, the opening has been executed. The camera application, the camera application will receive the Camera object that opened the camera, the camera application will first determine whether the passed Camera object is empty, if it is not, it means that the camera has been opened, and there is no need to execute the Camera open method, if it is, it means that If the camera is not opened successfully, the camera application needs to execute the opening of the camera.
可见,本示例中,在确定电子设备当前要启动的应用为相机类应用,且针对该应用的选取操作为打开所述相机应用并显示相机预览界面时,件刚打开相机操作和相机应用的启动并行执行,以提高相机启动时间,用户在打开相机应用时不需要较长的等待时间,可以更快地使用到摄像头。It can be seen that, in this example, when it is determined that the application currently to be launched by the electronic device is a camera application, and the selection operation for the application is to open the camera application and display the camera preview interface, the camera operation and the camera application start are just opened. Parallel execution to improve the camera startup time, users do not need a long waiting time when opening the camera application, and can use the camera faster.
在一个可能的示例中,所述选取操作为针对所述电子设备的触控显示屏的触控操作;所述确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标,包括:确定所述相机类应用的应用图标在应用桌面的目标显示区域;在获取到所述选取操作时,确定所述选取操作对应的触控区域;在检测到所述触控区域和所述目标显示区域匹配时,确定所述选取操作选取的应用图标为所述相机类应用的应用图标。In a possible example, the selection operation is a touch operation on the touch display screen of the electronic device; the determining whether the application icon corresponding to the selection operation is the application icon of the camera application includes : Determine that the application icon of the camera application is in the target display area of the application desktop; when the selection operation is acquired, determine the touch area corresponding to the selection operation; when the touch area and the target are detected When the display area matches, it is determined that the application icon selected by the selection operation is the application icon of the camera application.
其中,在获取到针对应用桌面上的多个应用图标的选取操作后,需要马上判断待启动的应用是否为相机类应用,如果是,则需要启动两个线程,如果不是,则不需要进行多线程处理。Among them, after obtaining the selection operation for multiple application icons on the application desktop, it is necessary to immediately determine whether the application to be started is a camera application, if it is, two threads need to be started, if not, no more Thread processing.
其中,在检测到针对桌面上的相机应用的应用图标的选取操作时,电子设备是先获取到的选取操作,再确定到该选取操作时选取的相机应用的应用图标。由于电子设备现在有多个相机类应用,可先确定这多个相机类应用在应用桌面上的目标显示区域,从而,在获取到选取操作时,可以根据该选取操作对应的触控区域,马上确定该选取操作选取的应用图标是否为相机类应用的应用图标,不需要桌面通过获取应用标识,对应用身份进行解析等一系类过程确定选取的应用。Wherein, when the selection operation for the application icon of the camera application on the desktop is detected, the electronic device first obtains the selection operation, and then determines the application icon of the camera application selected during the selection operation. Since the electronic device now has multiple camera applications, the target display area of these multiple camera applications on the application desktop can be determined first. Therefore, when the selection operation is obtained, the touch area corresponding to the selection operation can be immediately determined. It is determined whether the application icon selected by the selection operation is an application icon of a camera application, and there is no need for the desktop to determine the selected application through a series of processes such as obtaining the application identifier and analyzing the application identity.
可见,本示例中,通过确定选取操作对应的触控区域是否为相机类应用的应用图标在应用桌面上的目标显示区域,可以迅速判断出待启动的应用是否为相机类应用,从而,确定是否需要进行多线程处理。It can be seen that in this example, by determining whether the touch area corresponding to the selected operation is the target display area of the application icon of the camera application on the application desktop, it can be quickly determined whether the application to be launched is a camera application, and thus, whether Multi-threaded processing is required.
在一个可能的示例中,所述方法还包括:在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后,控制所述目标摄像头保持在打开状态。In a possible example, the method further includes: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, controlling the target camera to remain in an open state.
其中,一般情况下,在打开相机应用后会打开摄像头呈现出相机预览界面,由于摄像头是相机应用去调用并控制打开和关闭的,在退出应用界面后,摄像头就关闭了,例如,在进行视频通话时,若退出了当前打开摄像头的应用界面,通话对象便无法看到人脸或者看到画面卡顿了,因为此时摄像头其实已经关闭了。而本申请中,摄像头是由系统服务去控制打开和关闭是,因此,即使在退出应用界面后,也可以让摄像头保持在打开状态,即应用可以去关闭摄像头,系统服务也可以去关闭摄像头。Among them, in general, after opening the camera application, the camera will be opened to present the camera preview interface. Since the camera is called by the camera application and controlled to open and close, the camera is closed after exiting the application interface, for example, during video During a call, if you quit the application interface of the currently open camera, the caller cannot see the face or sees the picture freezes, because the camera is actually turned off at this time. In this application, the camera is turned on and off by the system service. Therefore, even after exiting the application interface, the camera can be kept open, that is, the application can close the camera and the system service can also close the camera.
其中,对相机应用的应用场景进行识别,在检测到相机应用功能处于视频拍摄场景,或者视频通话场景时,可以通过设置使得在退出相机预览界面之后,或者是拍摄界面之后,仍然可以保持摄像头处于打开状态下,继续录制视频或者拍摄视频。Among them, the application scene of the camera application is recognized. When it is detected that the camera application function is in the video shooting scene or the video call scene, it can be set so that after exiting the camera preview interface, or after the shooting interface, the camera can still be kept in In the open state, continue to record or shoot video.
可见,本示例中,在正常情况下,退出相机应用的应用界面后,即可关闭摄像头,而针对特殊应用场景如视频拍摄场景和视频通话场景,由于系统服务可以控制摄像头的打开和关闭,因此在这类场景下前台退出应用界面之后,可以不用关闭摄像头,继续视频的拍摄和录制,从而,可以提高用户体验。It can be seen that in this example, under normal circumstances, the camera can be closed after exiting the application interface of the camera application. For special application scenarios such as video shooting scenes and video call scenes, the system service can control the opening and closing of the camera. In this type of scenario, after the front desk exits the application interface, you can continue to shoot and record the video without turning off the camera, thereby improving user experience.
与所述图1所示的实施例一致的,请参阅图2,图2是本申请实施例提供的一种相机启动方法的流程示意图,应用于电子设备。如图所示,本相机启动方法包括:Consistent with the embodiment shown in FIG. 1, please refer to FIG. 2. FIG. 2 is a schematic flowchart of a camera startup method provided by an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the camera startup method includes:
S201,所述电子设备获取针对桌面上的相机应用的应用图标的选取操作。S201: The electronic device obtains a selection operation for an application icon of a camera application on the desktop.
S202,所述电子设备启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面。S202: The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
S203,所述电子设备启动第二线程并通过所述第二线程通知系统服务根据接收到的intent确定被选取的应用是否为相机类应用。S203: The electronic device starts a second thread and notifies the system service through the second thread to determine whether the selected application is a camera application according to the received intent.
S204,所述电子设备在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。S204: When detecting that the selected application is the camera application, the electronic device opens a target camera associated with the camera application.
S205,所述电子设备通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。S205. The electronic device notifies the system service to send a notification message to the camera application through the second thread, and ends the second thread, where the notification message is used to notify the camera application that the target camera has been turn on.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
此外,通过第二线程向第一线程正在启动的相机应用发送通知消息,告知相机应用此时目标摄像头已经打开,从而在第一线程中,相机应用启动完成后可以不用再去打开目标摄像头,而是直接使用已经打开的目标摄像头,有利于相机应用界面可以迅速呈现出相机预览界面。In addition, the second thread sends a notification message to the camera application being started by the first thread to inform the camera application that the target camera has been opened at this time, so that in the first thread, the camera application does not need to open the target camera after the camera application is started. It is to directly use the opened target camera, which is conducive to the camera application interface can quickly present the camera preview interface.
与所述图1、图2所示的实施例一致的,请参阅图3,图3是本申请实施例提供的一种相机启动方法的流程示意图,应用于电子设备。如图所示,本相机启动方法包括:Consistent with the embodiments shown in FIG. 1 and FIG. 2, please refer to FIG. 3. FIG. 3 is a schematic flowchart of a camera startup method provided by an embodiment of the present application, which is applied to an electronic device. As shown in the figure, the camera startup method includes:
S301,所述电子设备获取针对桌面上的相机应用的应用图标的选取操作。S301: The electronic device obtains a selection operation for an application icon of the camera application on the desktop.
S302,所述电子设备启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面。S302: The electronic device starts a first thread and starts the camera application through the first thread to display a camera preview interface.
S303,所述电子设备启动第二线程并通过所述第二线程通知系统服务根据接收到的intent确定被选取的应用是否为相机类应用。S303: The electronic device starts a second thread and notifies the system service through the second thread to determine whether the selected application is a camera application according to the received intent.
S304,所述电子设备在检测到所述被选取的应用为所述相机类应用时,打开所述相机 应用关联的目标摄像头。S304: When detecting that the selected application is the camera application, the electronic device turns on the target camera associated with the camera application.
S305,所述电子设备通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。S305. The electronic device notifies the system service to send a notification message to the camera application through the second thread, and ends the second thread, where the notification message is used to notify the camera application that the target camera has been turn on.
S306,所述电子设备在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后,控制所述目标摄像头保持在打开状态。S306: When the camera application is in a video shooting scene or a video call scene, the electronic device controls the target camera to remain in an open state after exiting the application interface of the camera application.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
此外,通过第二线程向第一线程正在启动的相机应用发送通知消息,告知相机应用此时目标摄像头已经打开,从而在第一线程中,相机应用启动完成后可以不用再去打开目标摄像头,而是直接使用已经打开的目标摄像头,有利于相机应用界面可以迅速呈现出相机预览界面。In addition, the second thread sends a notification message to the camera application being started by the first thread to inform the camera application that the target camera has been opened at this time, so that in the first thread, the camera application does not need to open the target camera after the camera application is started. It is to directly use the opened target camera, which is conducive to the camera application interface can quickly present the camera preview interface.
此外,在正常情况下,退出相机应用的应用界面后,即可关闭摄像头,而针对特殊应用场景如视频拍摄场景和视频通话场景,由于系统服务可以控制摄像头的打开和关闭,因此在这类场景下前台退出应用界面之后,可以不用关闭摄像头,继续视频的拍摄和录制,从而,可以提高用户体验。In addition, under normal circumstances, after exiting the application interface of the camera application, the camera can be closed. For special application scenarios such as video shooting scenes and video call scenes, because the system service can control the opening and closing of the camera, in such scenes After exiting the application interface from the front desk, you can continue to shoot and record the video without turning off the camera, thereby improving user experience.
与所述图1、图2、图3所示的实施例一致的,请参阅图4,图4是本申请实施例提供的一种电子设备400的结构示意图,该电子设备400运行有一个或多个应用程序和操作系统,如图所示,该电子设备400包括处理器410、存储器420、通信接口430以及一个或多个程序421,其中,所述一个或多个程序421被存储在所述存储器420中,并且被配置由所述处理器410执行,所述一个或多个程序421包括用于执行以下步骤的指令;Consistent with the embodiments shown in FIG. 1, FIG. 2, and FIG. 3, please refer to FIG. 4. FIG. 4 is a schematic structural diagram of an electronic device 400 provided by an embodiment of the present application. The electronic device 400 has one or Multiple application programs and operating systems. As shown in the figure, the electronic device 400 includes a processor 410, a memory 420, a communication interface 430, and one or more programs 421, wherein the one or more programs 421 are stored in the In the memory 420 and configured to be executed by the processor 410, the one or more programs 421 include instructions for executing the following steps;
在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程 通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;When the selection operation for the application icon of the camera application on the desktop is detected, the first thread is started and the camera application is started through the first thread to display the camera preview interface, and the second thread is started and passed through the second thread. The thread notifies the system service to perform a preset operation to start the target camera associated with the camera application;
其中,所述预设操作包括以下操作:根据接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
在一个可能的示例中,在所述系统服务根据接收到的intent确定被选取的应用是否为相机类应用方面,所述程序中的指令具体用于执行以下操作:所述系统服务解析所述intent后读取所述相机应用的应用包名;所述系统服务根据所述应用包名确定所述相机应用是否为相机类应用。In a possible example, in terms of the system service determining whether the selected application is a camera application according to the received intent, the instructions in the program are specifically used to perform the following operations: the system service parses the intent Then read the application package name of the camera application; the system service determines whether the camera application is a camera application according to the application package name.
在一个可能的示例中,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述程序中的指令具体用于执行以下操作:所述系统服务确定所述相机应用是否有打开所述电子设备的摄像头的权限;若是,所述系统该服务打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application, in terms of opening the target camera associated with the camera application, the instructions in the program are specifically used to execute The following operations: the system service determines whether the camera application has the permission to open the camera of the electronic device; if so, the system opens the target camera by the service.
在一个可能的示例中,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述程序中的指令具体用于执行以下操作:所述系统服务读取所述目标摄像头的身份标识,并根据所述身份标识确定所述目标摄像头;所述系统服务调用camera open程序,并打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application, in terms of opening the target camera associated with the camera application, the instructions in the program are specifically used to execute The following operations: the system service reads the identity of the target camera, and determines the target camera according to the identity; the system service calls the camera open program and opens the target camera.
在一个可能的示例中,所述系统服务打开所述相机应用关联的目标摄像头之后,所述程序中的指令具体用于执行以下操作:通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。In a possible example, after the system service opens the target camera associated with the camera application, the instructions in the program are specifically used to perform the following operations: notify the system service to the camera through the second thread The application sends a notification message and ends the second thread, where the notification message is used to notify the camera application that the target camera has been opened.
在一个可能的示例中,所述程序中的指令具体用于执行以下操作:通过所述第一线程 在检测到所述相机应用未接收到所述通知消息时,通知所述相机应用打开所述目标摄像头。In a possible example, the instructions in the program are specifically used to perform the following operations: when the first thread detects that the camera application has not received the notification message, notify the camera application to open the Target camera.
在一个可能的示例中,所述启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面之前,所述程序中的指令具体用于执行以下操作:确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标;若是,确定所述选取操作是否对应打开所述相机应用并显示所述相机应用的相机预览界面。In a possible example, before starting the first thread and starting the camera application through the first thread to display the camera preview interface, the instructions in the program are specifically used to perform the following operations: determining the selection operation Whether the corresponding application icon is the application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
在一个可能的示例中,所述选取操作为针对所述电子设备的触控显示屏的触控操作;在所述确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标方面,所述程序中的指令具体用于执行以下操作:确定所述相机类应用的应用图标在应用桌面的目标显示区域;在获取到所述选取操作时,确定所述选取操作对应的触控区域;在检测到所述触控区域和所述目标显示区域匹配时,确定所述选取操作选取的应用图标为所述相机类应用的应用图标。In a possible example, the selection operation is a touch operation on the touch display screen of the electronic device; in the aspect of determining whether the application icon corresponding to the selection operation is the application icon of the camera application , The instructions in the program are specifically used to perform the following operations: determine that the application icon of the camera application is in the target display area of the application desktop; when the selection operation is obtained, determine the touch area corresponding to the selection operation When detecting that the touch area and the target display area match, determine that the application icon selected by the selection operation is the application icon of the camera application.
在一个可能的示例中,所述程序中的指令具体用于执行以下操作:在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后,控制所述目标摄像头保持在打开状态。In a possible example, the instructions in the program are specifically used to perform the following operations: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, control the The target camera remains open.
上述实施例主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing embodiment mainly introduces the solution of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that, in order to implement the above-mentioned functions, the electronic device includes hardware structures and/or software modules corresponding to each function. Those skilled in the art should easily realize that in combination with the units and algorithm steps of the examples described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
本申请实施例可以根据所述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。所述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present application may divide the electronic device into functional units according to the method example. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
图5是本申请实施例中所涉及的相机启动装置500的功能单元组成框图。该相机启动装置500应用于电子设备,包括处理单元501和通信单元502,其中,FIG. 5 is a block diagram of the functional unit composition of the camera activation device 500 involved in an embodiment of the present application. The camera starting device 500 is applied to electronic equipment, and includes a processing unit 501 and a communication unit 502, wherein,
所述处理单元501,用于在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;The processing unit 501 is configured to start a first thread and start the camera application through the first thread to display the camera preview interface when the selection operation for the application icon of the camera application on the desktop is detected, and at the same time start the first thread Two threads and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application;
其中,所述预设操作包括以下操作:根据通过所述通信单元502接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the intent received through the communication unit 502; when it is detected that the selected application is the camera application, Open the target camera associated with the camera application.
其中,所述相机启动装置500还可以包括存储单元503,用于存储电子设备的程序代码和数据。所述处理单元501可以是处理器,所述通信单元502可以是触控显示屏或者收发器,存储单元503可以是存储器。Wherein, the camera starting device 500 may further include a storage unit 503, which is used to store program codes and data of the electronic device. The processing unit 501 may be a processor, the communication unit 502 may be a touch screen or a transceiver, and the storage unit 503 may be a memory.
可以看出,在本申请实施例中,电子设备在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头,由于电子设备在启动第一线程实现启动相机应用后,同时,还可以并发执行启动第二线程去打开相机应用关联的摄像头,而不是在等到相机应用启动后,由相机应用去执行打开摄像头,从而,使得相机应用可以更快的使用摄像头,使得应用界面呈现为相机预览界面,有利于提高相机类应用的启动速度。It can be seen that, in this embodiment of the application, when the electronic device detects the selection operation for the application icon of the camera application on the desktop, it starts the first thread and starts the camera application through the first thread to display the camera preview Interface, start the second thread at the same time and notify the system service through the second thread to perform a preset operation to start the target camera associated with the camera application. Since the electronic device starts the first thread to start the camera application, it can also Concurrent execution starts the second thread to open the camera associated with the camera application, instead of waiting for the camera application to start, the camera application executes to open the camera, so that the camera application can use the camera faster and the application interface is presented as a camera preview The interface helps improve the startup speed of camera applications.
在一个可能的示例中,在所述系统服务根据接收到的intent确定被选取的应用是否为相机类应用方面,所述处理单元501具体用于:控制所述系统服务解析所述intent后读取所述相机应用的应用包名;以及用于控制所述系统服务根据所述应用包名确定所述相机应用是否为相机类应用。In a possible example, in terms of the system service determining whether the selected application is a camera application according to the received intent, the processing unit 501 is specifically configured to: control the system service to parse the intent and then read The application package name of the camera application; and for controlling the system service to determine whether the camera application is a camera application according to the application package name.
在一个可能的示例中,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述处理单元501具体用于:控制所述系统服务确定所述相机应用是否有打开所述电子设备的摄像头的权限;若是,所述系统该服务打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application and opens the target camera associated with the camera application, the processing unit 501 is specifically configured to: control The system service determines whether the camera application has the permission to open the camera of the electronic device; if so, the system uses the service to open the target camera.
在一个可能的示例中,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述处理单元501具体用于:控制所述系统服务读取所述目标摄像头的身份标识,并根据所述身份标识确定所述目标摄像头;以及用于控制所述系统服务调用camera open程序,并打开所述目标摄像头。In a possible example, when the system service detects that the selected application is the camera application and opens the target camera associated with the camera application, the processing unit 501 is specifically configured to: control The system service reads the identity of the target camera, and determines the target camera according to the identity; and is used to control the system service to call the camera open program and open the target camera.
在一个可能的示例中,所述系统服务打开所述相机应用关联的目标摄像头之后,所述处理单元501具体用于:通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。In a possible example, after the system service opens the target camera associated with the camera application, the processing unit 501 is specifically configured to: notify the system service to send a notification message to the camera application through the second thread , And end the second thread, and the notification message is used to notify the camera application that the target camera has been opened.
在一个可能的示例中,所述处理单元501具体用于:通过所述第一线程在检测到所述相机应用未接收到所述通知消息时,通知所述相机应用打开所述目标摄像头。In a possible example, the processing unit 501 is specifically configured to notify the camera application to turn on the target camera when it is detected through the first thread that the camera application does not receive the notification message.
在一个可能的示例中,所述启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面之前,所述处理单元501具体用于:确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标;若是,确定所述选取操作是否对应打开所述相机应用并显示所述相机应用的相机预览界面。In a possible example, before starting the first thread and starting the camera application through the first thread to display the camera preview interface, the processing unit 501 is specifically configured to: determine the application icon corresponding to the selection operation Whether it is the application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
在一个可能的示例中,所述选取操作为针对所述电子设备的触控显示屏的触控操作;在所述确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标方面,所述处理单元501具体用于:确定所述相机类应用的应用图标在应用桌面的目标显示区域;以及用于在获取到所述选取操作时,确定所述选取操作对应的触控区域;以及用于在检测到所述触控区域和所述目标显示区域匹配时,确定所述选取操作选取的应用图标为所述相机类应用的应用图标。In a possible example, the selection operation is a touch operation on the touch display screen of the electronic device; in the aspect of determining whether the application icon corresponding to the selection operation is the application icon of the camera application The processing unit 501 is specifically configured to: determine that the application icon of the camera application is in the target display area of the application desktop; and, when the selection operation is acquired, determine the touch area corresponding to the selection operation; And for determining that the application icon selected by the selection operation is the application icon of the camera application when it is detected that the touch area and the target display area match.
在一个可能的示例中,所述处理单元501具体用于:在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后,控制所述目标摄像头保持在打开状态。In a possible example, the processing unit 501 is specifically configured to: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, control the target camera to remain at Open state.
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤,上述计算机包括电子设备。An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method as recorded in the above method embodiment , The aforementioned computer includes electronic equipment.
本申请实施例还提供一种计算机程序产品,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包,上述计算机包括电子设备。The embodiments of the present application also provide a computer program product. The above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program. The above-mentioned computer program is operable to cause a computer to execute any of the above-mentioned method embodiments. Part or all of the steps of the method. The computer program product may be a software installation package, and the above-mentioned computer includes electronic equipment.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知 悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described sequence of actions. Because according to this application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other various media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable memory, and the memory can include: flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above examples are only used to help understand the methods and core ideas of the application; A person of ordinary skill in the art, based on the idea of the present application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation of the present application.

Claims (20)

  1. 一种相机启动方法,其特征在于,应用于电子设备,所述方法包括:A method for starting a camera, characterized in that it is applied to an electronic device, and the method includes:
    在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;When the selection operation for the application icon of the camera application on the desktop is detected, the first thread is started and the camera application is started through the first thread to display the camera preview interface, and the second thread is started and passed through the second thread. The thread notifies the system service to perform a preset operation to start the target camera associated with the camera application;
    其中,所述预设操作包括以下操作:根据接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the received intent; when detecting that the selected application is the camera application, opening the camera application association The target camera.
  2. 根据权利要求1所述的方法,其特征在于,所述系统服务根据接收到的intent确定被选取的应用是否为相机类应用,包括:The method according to claim 1, wherein the system service determines whether the selected application is a camera application according to the received intent, comprising:
    所述系统服务解析所述intent后读取所述相机应用的应用包名;The system service reads the application package name of the camera application after parsing the intent;
    所述系统服务根据所述应用包名确定所述相机应用是否为相机类应用。The system service determines whether the camera application is a camera application according to the application package name.
  3. 根据权利要求1或2所述的方法,其特征在于,所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头,包括:The method according to claim 1 or 2, wherein when the system service detects that the selected application is the camera application, opening the target camera associated with the camera application includes:
    所述系统服务确定所述相机应用是否有打开所述电子设备的摄像头的权限;The system service determines whether the camera application has permission to open the camera of the electronic device;
    若是,所述系统该服务打开所述目标摄像头。If so, the system opens the target camera for this service.
  4. 根据权利要求1或2所述的方法,其特征在于,所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头,包括:The method according to claim 1 or 2, wherein when the system service detects that the selected application is the camera application, opening the target camera associated with the camera application includes:
    所述系统服务读取所述目标摄像头的身份标识,并根据所述身份标识确定所述目标摄像头;The system service reads the identity of the target camera, and determines the target camera according to the identity;
    所述系统服务调用camera open程序,并打开所述目标摄像头。The system service calls the camera open program and opens the target camera.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述系统服务打开所述相机应用关联的目标摄像头之后,所述方法还包括:The method according to any one of claims 1 to 4, wherein after the system service opens the target camera associated with the camera application, the method further comprises:
    通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。The system service is notified by the second thread to send a notification message to the camera application and ends the second thread, and the notification message is used to notify the camera application that the target camera has been opened.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括;The method of claim 5, wherein the method further comprises;
    通过所述第一线程在检测到所述相机应用未接收到所述通知消息时,通知所述相机应用打开所述目标摄像头。When it is detected that the camera application has not received the notification message through the first thread, the camera application is notified to turn on the target camera.
  7. 根据权利要求1所述的方法,其特征在于,所述启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面之前,所述方法还包括:The method according to claim 1, wherein before the starting the first thread and starting the camera application through the first thread to display the camera preview interface, the method further comprises:
    确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标;Determining whether the application icon corresponding to the selection operation is an application icon of the camera application;
    若是,确定所述选取操作是否对应打开所述相机应用并显示所述相机应用的相机预览界面。If yes, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
  8. 根据权利要求7所述的方法,其特征在于,所述选取操作为针对所述电子设备的触控显示屏的触控操作;所述确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标,包括:8. The method according to claim 7, wherein the selection operation is a touch operation on the touch screen of the electronic device; and the determining whether the application icon corresponding to the selection operation is the camera type The application icon of the application, including:
    确定所述相机类应用的应用图标在应用桌面的目标显示区域;Determining that the application icon of the camera application is in the target display area of the application desktop;
    在获取到所述选取操作时,确定所述选取操作对应的触控区域;When the selection operation is acquired, determining the touch area corresponding to the selection operation;
    在检测到所述触控区域和所述目标显示区域匹配时,确定所述选取操作选取的应用图标为所述相机类应用的应用图标。When it is detected that the touch area matches the target display area, it is determined that the application icon selected by the selection operation is the application icon of the camera application.
  9. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后,控制所述目标摄像头保持在打开状态。When the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, the target camera is controlled to remain in the open state.
  10. 一种相机启动装置,其特征在于,应用于电子设备,所述相机启动装置包括处理单元和通信单元,其中,A camera activation device, characterized in that it is applied to electronic equipment, the camera activation device includes a processing unit and a communication unit, wherein,
    所述处理单元,用于在检测到针对桌面上的相机应用的应用图标的选取操作时,启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面,同时启动第二线程并通过所述第二线程通知系统服务执行预设操作以启动所述相机应用关联的目标摄像头;The processing unit is configured to start a first thread and start the camera application through the first thread to display the camera preview interface when the selection operation for the application icon of the camera application on the desktop is detected, and start the second Thread and notify the system service to execute a preset operation through the second thread to start the target camera associated with the camera application;
    其中,所述预设操作包括以下操作:根据通过所述通信单元接收到的intent确定被选取的应用是否为相机类应用;在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头。Wherein, the preset operation includes the following operations: determining whether the selected application is a camera application according to the intent received through the communication unit; when it is detected that the selected application is the camera application, opening The target camera associated with the camera application.
  11. 根据权利要求10所述的相机启动装置,其特征在于,在所述系统服务根据接收到的intent确定被选取的应用是否为相机类应用方面,所述处理单元具体用于:控制所述系统服务解析所述intent后读取所述相机应用的应用包名;以及用于控制所述系统服务根据所述应用包名确定所述相机应用是否为相机类应用。The camera activation device according to claim 10, wherein the system service determines whether the selected application is a camera application according to the received intent, the processing unit is specifically configured to: control the system service After parsing the intent, reading the application package name of the camera application; and controlling the system service to determine whether the camera application is a camera application according to the application package name.
  12. 根据权利要求10或11所述的相机启动装置,其特征在于,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述处理单元具体用于:控制所述系统服务确定所述相机应用是否有打开所述电子设备的摄像头的权限;若是,所述系统该服务打开所述目标摄像头。The camera activation device according to claim 10 or 11, wherein when the system service detects that the selected application is the camera application, the target camera aspect associated with the camera application is opened, The processing unit is specifically configured to: control the system service to determine whether the camera application has the permission to open the camera of the electronic device; if so, the system opens the target camera by the service.
  13. 根据权利要求10或11所述的相机启动装置,其特征在于,在所述系统服务在检测到所述被选取的应用为所述相机类应用时,打开所述相机应用关联的目标摄像头方面,所述处理单元具体用于:控制所述系统服务读取所述目标摄像头的身份标识,并根据所述身份标识确定所述目标摄像头;以及用于控制所述系统服务调用camera open程序,并打开所述目标摄像头。The camera activation device according to claim 10 or 11, wherein when the system service detects that the selected application is the camera application, the target camera aspect associated with the camera application is opened, The processing unit is specifically configured to: control the system service to read the identity of the target camera, and determine the target camera according to the identity; and to control the system service to call the camera open program and open The target camera.
  14. 根据权利要求10-13任一项所述的相机启动装置,其特征在于,所述系统服务打开所述相机应用关联的目标摄像头之后,所述处理单元具体用于:通过所述第二线程通知所述系统服务向所述相机应用发送通知消息,并结束所述第二线程,所述通知消息用于通知所述相机应用所述目标摄像头已打开。The camera activation device according to any one of claims 10-13, wherein after the system service opens the target camera associated with the camera application, the processing unit is specifically configured to: notify via the second thread The system service sends a notification message to the camera application and ends the second thread, where the notification message is used to notify the camera application that the target camera has been opened.
  15. 根据权利要求14所述的相机启动装置,其特征在于,所述处理单元具体用于:通过所述第一线程在检测到所述相机应用未接收到所述通知消息时,通知所述相机应用打开所述目标摄像头。The camera activation device according to claim 14, wherein the processing unit is specifically configured to notify the camera application when it is detected that the camera application has not received the notification message through the first thread Turn on the target camera.
  16. 根据权利要求10所述的相机启动装置,其特征在于,所述启动第一线程并通过所述第一线程启动所述相机应用以显示相机预览界面之前,所述处理单元具体用于:确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标;若是,确定所述选取操作是否对应打开所述相机应用并显示所述相机应用的相机预览界面。The camera startup device according to claim 10, wherein before the first thread is started and the camera application is started through the first thread to display the camera preview interface, the processing unit is specifically configured to: determine Whether the application icon corresponding to the selection operation is an application icon of the camera application; if so, it is determined whether the selection operation corresponds to opening the camera application and displaying the camera preview interface of the camera application.
  17. 根据权利要求16所述的相机启动装置,其特征在于,所述选取操作为针对所述电子设备的触控显示屏的触控操作;在所述确定所述选取操作对应的应用图标是否为所述相机类应用的应用图标方面,所述处理单元具体用于:确定所述相机类应用的应用图标在应用桌面的目标显示区域;以及用于在获取到所述选取操作时,确定所述选取操作对应的触控区域;以及用于在检测到所述触控区域和所述目标显示区域匹配时,确定所述选取操作选取的应用图标为所述相机类应用的应用图标。The camera activation device according to claim 16, wherein the selection operation is a touch operation on the touch screen of the electronic device; in the determining whether the application icon corresponding to the selection operation is Regarding the application icon of the camera application, the processing unit is specifically configured to: determine that the application icon of the camera application is in the target display area of the application desktop; and to determine the selection when the selection operation is obtained The touch area corresponding to the operation; and when detecting that the touch area matches the target display area, determine that the application icon selected by the selection operation is the application icon of the camera application.
  18. 根据权利要求10所述的相机启动装置,其特征在于,所述处理单元具体用于:在所述相机类应用处于视频拍摄场景或视频通话场景时,在退出所述相机应用的应用界面后, 控制所述目标摄像头保持在打开状态。The camera activation device according to claim 10, wherein the processing unit is specifically configured to: when the camera application is in a video shooting scene or a video call scene, after exiting the application interface of the camera application, Control the target camera to remain in the open state.
  19. 一种电子设备,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-9任一项所述的方法中的步骤的指令。An electronic device, comprising a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, The program includes instructions for performing the steps in the method according to any one of claims 1-9.
  20. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。A computer-readable storage medium, characterized in that it stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute the method according to any one of claims 1-9.
PCT/CN2019/089121 2019-05-29 2019-05-29 Camera starting method and related apparatus WO2020237545A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980090943.9A CN113366819B (en) 2019-05-29 2019-05-29 Camera starting method, related device, electronic equipment and storage medium
PCT/CN2019/089121 WO2020237545A1 (en) 2019-05-29 2019-05-29 Camera starting method and related apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/089121 WO2020237545A1 (en) 2019-05-29 2019-05-29 Camera starting method and related apparatus

Publications (1)

Publication Number Publication Date
WO2020237545A1 true WO2020237545A1 (en) 2020-12-03

Family

ID=73552454

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/089121 WO2020237545A1 (en) 2019-05-29 2019-05-29 Camera starting method and related apparatus

Country Status (2)

Country Link
CN (1) CN113366819B (en)
WO (1) WO2020237545A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767707A (en) * 2021-01-11 2021-05-07 深圳智优停科技有限公司 Parking space sensor and parking space sensing shooting system
CN115484386A (en) * 2021-06-16 2022-12-16 荣耀终端有限公司 Video shooting method and electronic equipment

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116193244A (en) * 2021-11-25 2023-05-30 Oppo广东移动通信有限公司 Camera module initializing method and device, computer readable medium and electronic equipment
CN114554078B (en) * 2022-01-10 2023-01-31 荣耀终端有限公司 Camera calling method and electronic equipment
CN116744106B (en) * 2022-10-25 2024-04-30 荣耀终端有限公司 Control method of camera application and terminal equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333704A (en) * 2014-11-28 2015-02-04 广东欧珀移动通信有限公司 Photographing scene previewing method, photographing scene previewing device and terminal
CN105120112A (en) * 2015-09-25 2015-12-02 维沃移动通信有限公司 Camera starting method for mobile terminal and mobile terminal
EP3166288A2 (en) * 2015-11-05 2017-05-10 BlackBerry Limited Device configuration dependent on bar-code on accessory

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8169461B2 (en) * 2007-09-28 2012-05-01 Sony Ericsson Mobile Communications Ab Method and system for a quick start camera application in a camera
CN105898149A (en) * 2016-06-01 2016-08-24 广东欧珀移动通信有限公司 Camera starting method and system
CN106027900A (en) * 2016-06-22 2016-10-12 维沃移动通信有限公司 Photographing method and mobile terminal
CN106572299B (en) * 2016-10-31 2020-02-28 北京小米移动软件有限公司 Camera opening method and device
CN109819168B (en) * 2019-01-31 2020-09-01 维沃移动通信有限公司 Camera starting method and mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333704A (en) * 2014-11-28 2015-02-04 广东欧珀移动通信有限公司 Photographing scene previewing method, photographing scene previewing device and terminal
CN105120112A (en) * 2015-09-25 2015-12-02 维沃移动通信有限公司 Camera starting method for mobile terminal and mobile terminal
EP3166288A2 (en) * 2015-11-05 2017-05-10 BlackBerry Limited Device configuration dependent on bar-code on accessory

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767707A (en) * 2021-01-11 2021-05-07 深圳智优停科技有限公司 Parking space sensor and parking space sensing shooting system
CN112767707B (en) * 2021-01-11 2023-10-31 深圳智优停科技有限公司 Parking stall inductor and parking stall response shooting system
CN115484386A (en) * 2021-06-16 2022-12-16 荣耀终端有限公司 Video shooting method and electronic equipment
CN115484386B (en) * 2021-06-16 2023-10-31 荣耀终端有限公司 Video shooting method and electronic equipment

Also Published As

Publication number Publication date
CN113366819B (en) 2022-08-16
CN113366819A (en) 2021-09-07

Similar Documents

Publication Publication Date Title
WO2020237545A1 (en) Camera starting method and related apparatus
CN109152095B (en) Wireless network connection method for terminal
CN107766128B (en) Method and device for starting application
CN107861814B (en) Resource allocation method and equipment
CN107783803B (en) System optimization method and device of intelligent terminal, storage medium and intelligent terminal
CN106098061B (en) Voice interaction method and device based on android system
EP2843979A1 (en) Method and apparatus for preventing sound recording during the call
CN108132735B (en) Terminal and application control method
WO2019085840A1 (en) Resource adjustment method and apparatus
WO2022100724A1 (en) Video playback method and apparatus
CN107888965B (en) Image gift display method and device, terminal, system and storage medium
WO2020094036A1 (en) Wireless network connection method for terminal
CN110618806B (en) Application program control method and device, electronic equipment and storage medium
US20130205302A1 (en) Information processing terminal and resource release method
CN112751971A (en) Voice playing method and device and electronic equipment
CN112468833A (en) Live broadcast interactive information processing method, device, terminal, server and storage medium
WO2021114709A1 (en) Live video interaction method and apparatus, and computer device
CN111538574B (en) Task stack management method, device, terminal and storage medium
CN111465016B (en) Control method and device
CN116578422A (en) Resource allocation method and electronic equipment
EP3174244B1 (en) Video communication ending method and apparatus, computer program and recording medium
WO2022028607A1 (en) Virtual resource acquisition method and apparatus
CN112395242B (en) Multi-chip control method, device, electronic equipment and computer readable storage medium
CN117472321B (en) Audio processing method and device, storage medium and electronic equipment
WO2024160136A1 (en) Task scheduling method and apparatus, and electronic device

Legal Events

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

Ref document number: 19930616

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: 19930616

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19930616

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19930616

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC DATED 18.05.2022 (EPO FORM 1205A)