Mode switching method and terminal equipment
By using asynchronous shutdown threads in the terminal device to simultaneously turn off and start the shooting mode threads, the problem of slow shooting mode switching speed in the prior art is solved, and the user experience and device performance are improved.
Patent Information
- Application Number
- CN202411135011.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2043-02-27
AI Technical Summary
The existing terminal devices are slow when switching shooting modes, which affects the user experience, mainly due to the delay caused by the system resource supply status.
Asynchronous processing is implemented by creating an asynchronous shutdown thread in the terminal device to turn off the current shooting mode and start the thread of the next shooting mode during the execution of that thread, thereby reducing the waiting time and increasing the switching speed.
Improves the speed of shooting mode switching and improves user experience, especially when switching multiple shooting modes quickly after power on or restart.
Smart Images

Figure CN119233089A_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese patent application filed with the China Patent Office on February 27, 2023, with application number 202310208362.9 and application name “Mode Switching Method and Terminal Device”. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of terminals, and in particular to a mode switching method and a terminal device. Background Art
[0003] At present, the camera applications of most terminal devices support multiple shooting modes, such as photo mode, video mode, portrait mode, etc. Users can freely choose the shooting mode and experience different shooting effects.
[0004] When the user turns on the phase switching shooting mode, due to the influence of system resource supply status, the speed of switching shooting mode is slow, affecting the user experience. Summary of the invention
[0005] The present application provides a mode switching method and a terminal device, which are conducive to increasing the speed of switching shooting modes and improving the user experience.
[0006] In a first aspect, the present application provides a mode switching method, which can be executed by a terminal device, and the method includes: in response to an operation of opening a camera application, displaying a first interface of the camera application, the first interface being an interface of a photo mode; in response to an operation of switching the shooting mode to a multi-lens recording mode at a first time point, displaying a second interface of the camera application at a second time point, the second interface being an interface of a multi-lens recording mode; between the first time point and the second time point, there is an overlap between the first time period and the second time period; the first time period is a time period for closing the photo mode based on a closing thread, and the second time period is a time period for starting the multi-lens recording mode based on a starting thread; in response to an operation of switching the shooting mode to the photo mode at a third time point, displaying a third interface of the camera application at a fourth time point, the third interface being an interface of the photo mode; between the third time point and the fourth time point, there is no overlap between the third time period and the fourth time point; the third time period is a time period for closing the multi-lens recording mode based on a closing thread, and the fourth time period is a time period for starting the shooting mode based on a starting thread.
[0007] In this application, a close thread is used to close a shooting mode, which may specifically include releasing the camera service resources of the shooting mode. An open thread is used to start a shooting mode.
[0008] It should be understood that after the terminal device is powered on or restarted, the terminal device will create a first close thread, an open thread, and a configure_streams (configuration stream) thread for the camera application, waiting for the camera application to issue an instruction to call.
[0009] Considering that there is no coupling between closing the photo mode based on the close thread and starting the multi-lens recording mode based on the open thread, based on the technical solution of the present application, the terminal device can create a second close thread when the camera application calls the close interface. The second close thread can also be called an asynchronous close thread. The terminal device closes the photo mode based on the asynchronous close thread. In other words, the close process of the photo mode is carried out in the asynchronous close thread.
[0010] In the process of closing the photo mode based on the asynchronous close thread, the terminal device can start the multi-lens video recording mode based on the open thread. That is, the open thread used to start the multi-lens video recording mode does not need to wait for the close thread used to close the photo mode to end before it can be executed, thereby realizing the simultaneous execution of the asynchronous close thread and the open thread. Therefore, between the first time point and the second time point, the time for closing the photo mode based on the closing thread (here is the asynchronous close thread) overlaps with the time for starting the multi-lens video recording mode based on the starting thread, which increases the speed of switching shooting modes, thereby improving the user experience.
[0011] However, not all shooting modes can release camera service resources by creating an asynchronous close thread. For example, in the scenario where the shooting mode is switched from multi-lens recording mode to photo mode, the multi-lens recording mode does not support the creation of an asynchronous close process. Therefore, the terminal device closes the multi-lens recording mode based on the first close thread, and after the first close thread ends, starts the photo mode based on the open thread. In other words, the first close thread and the open thread are executed serially. Therefore, between the third time point and the fourth time point, there is no overlap between the time of closing the multi-lens recording mode based on the closing thread (here is the first close thread) and the time of starting the photo mode based on the starting thread.
[0012] In combination with the first aspect, in certain implementations of the first aspect, in response to the operation of switching the shooting mode to the photo mode at the third time point, after displaying the third interface of the camera application at the fourth time point, the method further includes: switching the shooting mode to the video recording mode at the fifth time point; before configuring resources for the video recording mode, switching the shooting mode to the photo recording mode at the sixth time point; between the fifth time point and the sixth time point, there is no overlap between the fifth time point and the sixth time point; the fifth time period is a time period for closing the video recording mode based on the closing thread, and the sixth time period is a time period for starting the photo recording mode based on the starting thread. It should be noted that the closing thread in this implementation is the first close thread.
[0013] In conjunction with the first aspect, in certain implementations of the first aspect, after responding to the operation of switching the shooting mode to the multi-lens video recording mode at the first time point, the method further includes: creating a closing thread; and closing the shooting mode based on the closing thread. It should be noted that the closing thread in this implementation is an asynchronous close thread.
[0014] In combination with the first aspect, in certain implementations of the first aspect, creating a close thread includes: creating a close thread when preset conditions are met. The preset conditions include: the application package name indicated by the first preconfiguration parameter includes the application package name of the camera application, the shooting mode indicated by the second preconfiguration parameter does not include the photo mode, the last close thread at the current moment (here is the asynchronous close thread when the shooting mode was last switched) is in an idle state, and the CHI module has been initialized. Among them, the first preconfiguration parameter is used to indicate the application package name that can support the creation of a close thread, and the second preconfiguration parameter is used to indicate a shooting mode that does not support the creation of a close thread. It should be noted that the close thread in this implementation is an asynchronous close thread.
[0015] In combination with the first aspect, in some implementations of the first aspect, when a preset condition is met, after creating a closing thread, the method further includes: starting the multi-lens recording mode based on the starting thread; after the multi-lens recording mode is started, if the closing thread is completed, starting the configuration stream thread to configure resources for the multi-lens recording mode; at a second time point, displaying the second interface of the camera application, including: after the configuration stream thread is completed, at a second time point, displaying the second interface of the camera application. It should be noted that the closing thread in this implementation is an asynchronous close thread.
[0016] In conjunction with the first aspect, in some implementations of the first aspect, after the multi-camera recording mode is started, the method further includes: obtaining a thread status of a closing thread; and determining whether the closing thread is completed based on the thread status of the closing thread. It should be noted that the closing thread in this implementation is an asynchronous close thread.
[0017] In conjunction with the first aspect, in some implementations of the first aspect, determining whether the closing thread is completed based on the thread state of the closing thread includes: if the thread state of the closing thread is a terminated state, determining that the closing thread is completed; if the thread state of the closing thread is not a terminated state, determining that the closing thread is not completed. It should be noted that the closing thread in this implementation is an asynchronous close thread.
[0018] In a second aspect, the present application provides a terminal device, comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device performs the method of the first aspect.
[0019] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method of the first aspect is implemented.
[0020] In a fourth aspect, the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect.
[0021] In a fifth aspect, the present application provides a chip, the chip comprising a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.
[0022] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first or second aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the structure of a terminal device applicable to the embodiment of the present application;
[0024] Figure 2 It is a software structure block diagram of a terminal device to which the embodiment of the present application is applicable;
[0025] Figure 3 is a schematic diagram of a mode switching interface provided in an embodiment of the present application;
[0026] Figure 4 is a schematic diagram of a mode switching provided by an embodiment of the present application;
[0027] Figure 5 is a schematic diagram of another mode switching provided by an embodiment of the present application;
[0028] Figure 6is a schematic flow chart of a mode switching method provided in an embodiment of the present application;
[0029] Figure 7 is a schematic flow chart of another mode switching method provided in an embodiment of the present application;
[0030] Figure 8 is a schematic diagram of another mode switching interface provided in an embodiment of the present application;
[0031] Fig. 9 It is a schematic flow chart of another mode switching method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0033] In order to clearly describe the technical solutions of the embodiments of the present application, the relevant terms involved in the present application are first introduced in detail below.
[0034] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects, and do not limit their order. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0035] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0036] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or multiple.
[0037] Figure 1Schematic diagram of the structure of a terminal device applicable to the embodiment of the present application. Figure 1 As shown, the terminal device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identity module (SIM) card interface 195, etc.
[0038] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0039] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, a display processing unit (displayprocess unit, DPU), and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. In some embodiments, the terminal device 100 may also include one or more processors 110. Among them, the processor may be the nerve center and command center of the terminal device 100. The processor may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. A memory may also be set in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a high-speed cache memory. The memory may save instructions or data used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110 , and thus improves the efficiency of the terminal device 100 .
[0040] The wireless communication function of the terminal device 100 can be implemented by antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, antenna 1 can be reused as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0041] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier, etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0042] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0043] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include GSM, GPRS, CDMA, WCDMA, TD-SCDMA, LTE, GNSS, WLAN, NFC, FM, and / or IR technology. The above-mentioned GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0044] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed or a quantum dot light-emitting diode (QLED). In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0045] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, data files such as music, photos, and videos are stored in the external memory card.
[0046] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can enable the terminal device 100 to perform various functional applications and data processing by running the above instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data (such as photos, contacts, etc.) created during the use of the terminal device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. In some embodiments, the processor 110 can enable the terminal device 100 to perform various functional applications and data processing by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor 110.
[0047] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0048] In addition, on top of the above components, an operating system, such as an iOS operating system, an Android operating system, a Windows operating system, etc., runs in the terminal device 100. Application programs can be installed and run on the operating system. In other embodiments, there may be multiple operating systems running in the terminal device 100.
[0049] It should be understood that Figure 1 The hardware modules included in the terminal device shown are only illustrative descriptions and do not limit the specific structure of the terminal device. In fact, the terminal device provided in the embodiment of the present application may also include other hardware modules that have an interactive relationship with the hardware modules illustrated in the figure, which are not specifically limited here. For example, the terminal device may also include a flashlight, a micro-projection device, etc. For another example, if the terminal device is a personal computer (PC), then the terminal device may also include components such as a keyboard and a mouse.
[0050] The software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of a layered architecture as an example to exemplify the software structure of the terminal device 100.
[0051] Figure 2 It is a software structure diagram of the terminal device to which the embodiment of the present application is applicable. The layered architecture divides the software system of the terminal device 100 into several layers, and each layer has a clear role and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system may include an application layer (application, APP), an application framework layer (application framework), a hardware abstraction layer (hardware abstraction layer, HAL) and a kernel layer (kernel). In some embodiments, the terminal device also includes a hardware layer (for example, a display screen). In some embodiments, the Android system also includes an Android runtime (Android runtime) and a system library.
[0052] Exemplarily, the application layer may include a series of application packages, and the application layer runs the application by calling the application programming interface (API) provided by the application framework layer. Figure 2 As shown, the application package may include camera, calendar, map, phone, music, WLAN, Bluetooth, video, social, gallery, navigation, short message and other applications.
[0053] The application framework layer provides application programming interfaces (APIs) and programming services for the applications in the application layer. The framework layer includes some predefined functions. The framework layer provides programming services to the application layer through the API interface. It should be noted that in the embodiments of the present application, the programming service can be, for example, a camera service. In some embodiments, Figure 2 As shown, the framework layer includes a camera service framework and a media framework, wherein the media framework includes an encoder.
[0054] The hardware abstraction layer is an interface layer between the kernel layer and the hardware, which can be used to abstract the hardware. Figure 2 As shown, the hardware abstraction layer includes a camera interface.
[0055] The above kernel layer provides the underlying drivers for various hardware of the mobile phone. For example, Figure 2As shown, the kernel layer includes the camera driver module. The kernel layer also includes a process and thread manager, which is responsible for creating processes and threads, and terminating processes and threads. The underlying support for processes and threads is provided in the kernel layer.
[0056] The terminal device in the embodiment of the present application may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device may be a mobile phone, PC, smart TV, wearable device, tablet computer (Pad), computer with wireless transceiver function, virtual reality (VR) terminal device, augmented reality (AR) terminal device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, etc.
[0057] As an example but not limitation, in the embodiments of the present application, the terminal device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.
[0058] In addition, the terminal device can also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection. This application does not limit the specific form of the terminal device. It should be understood that in the embodiments of the present application, the terminal device can be a device for realizing the function of the terminal device, or it can be a device that can support the terminal device to realize the function, such as a chip system, which can be installed in the terminal. In the embodiments of the present application, the chip system can be composed of chips, and can also include chips and other discrete devices.
[0059] Figure 3 is a schematic diagram of a mode switching interface provided in an embodiment of the present application, Figure 3 The interface includes interface A, interface B and interface C. Taking the terminal device as a mobile phone as an example, in response to the user clicking the icon of the camera application on interface A, the mobile phone displays a photo taking interface as shown in interface B. It can be seen that interface B includes a preview area 01 and a shooting mode selection area 02. Preview area 01 can display a preview screen of the object to be photographed, and the user can select control 03 on interface B to shoot the object to be photographed.
[0060] For example, the user may click on a certain shooting mode in the shooting mode selection area 02 to switch the shooting mode, or the user may slide left or right in the shooting mode selection area 02 to switch the shooting mode.
[0061] Exemplarily, the camera application can support multiple shooting modes, such as photo, video, multi-lens video (also called multi-view video), time-lapse photography, ultra-wide angle, large aperture, night scene mode, portrait mode, etc. The shooting mode of the camera application in interface B is photo.
[0062] In response to the user selecting the recording mode in the B interface, the mobile phone displays the recording interface shown in the C interface. The preview area 01 can display a preview of the object to be photographed, and the user can select the control 03 in the C interface to record the object to be photographed.
[0063] based on Figure 2 the software architecture of the described terminal device, and Figure 3 The described camera application switches from photo mode to video mode. Figure 4 A schematic diagram of mode switching is introduced.
[0064] like Figure 4As shown, in the process of switching the camera application from the photo mode to the video mode, the camera application first calls the close process of the hardware abstraction layer to close the photo mode. The process of closing the photo mode may include: releasing the channel established by the photo mode, the resources applied, such as subsystem services, memory resources and input / output (I / O) resources, etc. After the photo mode is closed, the camera application calls the open process of the hardware abstraction layer to start the video mode of the camera application and obtain camera parameters and resources. After the startup process ends, the camera application calls the configure_streams process of the hardware abstraction layer to configure the platform session, pipeline and node, and perform hardware initialization, such as initializing the camera sensor (sensor) and configuring the video stream to be displayed. After that, the camera application sends a repeating instruction to the hardware abstraction layer to request the image collected by the camera sensor, and the hardware abstraction layer returns multiple frames of images to the camera application. The camera application displays the preview screen in the preview area according to the multiple frames of images. Figure 4 The process of switching shooting modes shown takes approximately 810 ms.
[0065] In the above-mentioned process of switching modes, the camera application first flushes the camera's usecase resources, and then calls the close process to close the photo mode. After the closing process of the photo mode is completed, the camera application calls the open process to start the video mode. After the starting process of the video mode is completed, the camera application calls the configure_streams process to configure the platform session, pipeline and node. Among them, the close process of the photo mode and the open process of the video mode are executed serially. In other words, only after the closing process of the photo mode is completed, the camera application will call the open process to start the video mode. For some terminal devices with poor performance, when the camera mode of the camera application is turned off, operations such as memory release, thread scheduling, and data processing cannot obtain central processing unit (CPU) resources in time, which will result in a longer time to turn off the photo mode, reduce the switching speed of the shooting mode, and thus affect the user experience.
[0066] In view of this, an embodiment of the present application provides a mode switching method, taking into account the previous shooting mode (for example Figure 3 The close process of the photo mode in the Figure 3There is no coupling between the open processes of the previous shooting mode and the video recording mode in the camera application. Therefore, the terminal device can create an asynchronous close thread when the camera application calls the close interface. The asynchronous close thread is used to close the previous shooting mode. The camera application can start the next shooting mode based on the open thread while closing the previous shooting mode based on the asynchronous close thread. In this way, the close process of the previous shooting mode and the open process of the next shooting mode can be carried out at the same time, reducing the time waiting for the close process of the previous shooting mode to be completed, which is conducive to improving the switching speed of the shooting mode, thereby improving the user experience.
[0067] The previous shooting mode and the next shooting mode described in the embodiment of the present application are relative to before and after the operation of switching the shooting mode is performed. The shooting mode before the operation of switching the shooting mode is performed is the previous shooting mode, and the shooting mode after the operation of switching the shooting mode is performed is the next shooting mode.
[0068] It should be noted that the close process in the embodiment of the present application refers to the process of closing a shooting mode based on a close thread (the asynchronous close thread or the first close thread in this article), and the process of closing a shooting mode based on an asynchronous close thread can also be called an asynchronous close process; the open process refers to the process of starting a shooting mode based on an open thread; the configure_streams process refers to the process of configuring camera service resources for a shooting mode based on the configure_streams thread.
[0069] based on Figure 2 the software architecture of the described terminal device, and Figure 3 The described camera application switches from photo mode to video mode. Figure 5 Another flowchart for switching shooting modes is introduced below.
[0070] Figure 5 FIG. 1 is a schematic diagram of another mode switching provided by an embodiment of the present application. Figure 5As shown, the camera application first calls the close process of the hardware abstraction layer to close the camera mode. The hardware abstraction layer creates an asynchronous close thread to carry the closing process of the camera mode. While the closing process is in progress, the camera application calls the open process of the hardware abstraction layer to start the video recording mode of the camera application. After the startup process is completed, the camera application calls the configure_streams process of the hardware abstraction layer to configure the platform session, pipeline and node, initialize the camera sensor, and configure the video stream to be displayed. After that, the camera application requests the hardware abstraction layer to draw the image, and the hardware abstraction layer returns multiple frames of images to the camera application. The camera application displays the preview screen in the preview area based on the multiple frames of images. Figure 5 The process of switching shooting modes shown takes approximately 700ms.
[0071] Figure 5 Schematic diagram of using asynchronous close thread to switch shooting mode provided by the embodiment of the present application. Figure 4 and Figure 5 It can be seen that since the closing process of the photo mode is carried out in the asynchronous close thread, the camera application can quickly call the startup process of the video mode without waiting for the closing process of the photo mode to end. The closing process of the photo mode and the startup process of the video mode can be executed at the same time, which improves the speed of switching shooting modes.
[0072] Combination Figure 2 , Figure 6 is Figure 5 A more detailed flow chart of a mode switching method 600 is provided based on FIG. The steps of the method 600 can be Figure 2 The camera application, application framework layer, hardware abstraction layer, and kernel layer shown interact and execute.
[0073] The application layer and the hardware abstraction layer need to go through the Java native interface (JNI) of the application framework layer to convert the Java instructions of the application layer into C++ instructions that can be recognized by the hardware abstraction layer. The JNI interface includes the close interface, open interface, configure_streams interface, etc.
[0074] exist Figure 6 In the described embodiment, the first shooting mode refers to the previous shooting mode or the shooting mode before switching (for example, Figure 3 The second shooting mode represents the next shooting mode or the switched shooting mode (for example Figure 3Here, the first shooting mode is the photo mode, and the second shooting mode is the video mode. In addition, the second shooting mode may also be other modes such as the multi-lens video mode, which is not limited here.
[0075] It should be understood that the transmission between layers or modules in the embodiments of the present application is actually achieved through function calls.
[0076] The method 600 includes S601 to S630, and the specific steps are as follows:
[0077] S601, in response to a user operation of switching a first shooting mode to a second shooting mode in a camera interface, a camera application sends a mode switching instruction to an application framework layer, where the mode switching instruction is used to instruct to switch the first shooting mode of the camera application to the second shooting mode.
[0078] Optionally, the com.hihonor.camera process of the camera application sends the mode switching instruction to the camera server process of the application framework layer by calling the close interface of the application framework layer.
[0079] S602: The application framework layer sends the mode switching instruction to the hardware abstraction layer.
[0080] Optionally, the application framework layer sends the mode switching instruction to the android.hardware.camera.provider@2.4-server_64 process (hereinafter referred to as the provider process) of the hardware abstraction layer through the close interface.
[0081] After S601 and S602, the camera application can pass the mode switching instruction to the hardware abstraction layer by calling the close interface of the application framework layer, so as to call the close thread of the hardware abstraction layer to close the first shooting mode.
[0082] It should be understood that after the terminal device is turned on or restarted, the provider process of the hardware abstraction layer will create the first close thread, open thread and configure_streams thread for the camera application, waiting for the camera application to issue instructions for calling.
[0083] S603, the hardware abstraction layer determines whether the conditions for creating an asynchronous close thread are met. If so, execute S604.
[0084] It should be noted that the asynchronous close thread in this application may also be referred to as the second close thread. The first close thread and the second close thread are two different threads.
[0085] In this step, the asynchronous close thread is used to close the first shooting mode and release the camera service resources requested by the first shooting mode. Optionally, the following preset conditions need to be considered to determine whether to create an asynchronous close thread: whether the current application package name and the shooting mode of the current application meet the requirements for creating an asynchronous close thread, whether the asynchronous close thread at the last mode switch at the current moment (which can be called the last asynchronous close thread) is in an idle state, and the initialization state of the current CHI module.
[0086] The situations where the preset conditions are met include: the current application package name and the shooting mode of the current application meet the requirements for creating an asynchronous close thread, the last asynchronous close thread at the current moment is in an idle state, and the CHI module has been initialized.
[0087] Optionally, when determining whether the current application package name and shooting mode meet the requirements for creating an asynchronous close thread, the hardware abstraction layer can check the configuration parameters in the product.xml file to determine whether the switch of the asynchronous close thread is turned on, whether the application package name matches the configured application package name, and whether the shooting mode of the current application supports the creation of an asynchronous close thread. It should be noted that the current application in the embodiment of the present application is a camera application, the current application package name is the application package name of the camera application, and the shooting mode of the current application refers to the previous shooting mode of the camera application, that is, the first shooting mode in the embodiment of the present application.
[0088] Exemplarily, the "isAvailable" parameter in the configuration parameters in the product.xml file is the main switch for configuring the asynchronous close thread. When the "isAvailable" parameter is configured to "0", it means that the switch of the asynchronous close thread is not turned on; when the "isAvailable" parameter is configured to "1", it means that the switch of the asynchronous close thread is turned on.
[0089] Exemplarily, the "avoidMode" parameter (which may be referred to as the second pre-configured parameter) in the product.xml file indicates that certain shooting modes of the camera application do not execute or support the creation of asynchronous close threads. Exemplarily, the shooting modes that do not support the creation of asynchronous close threads include multi-lens video recording. To obtain the "avoidMode" parameter, it is necessary to ask the camera application or print the value of "tag:cameraSceneMode" in the hardware abstraction layer.
[0090] Exemplarily, the "supportAppNameList" parameter (which may be referred to as the first pre-configuration parameter) in the product.xml file indicates the pre-configured application package name that can support the creation of asynchronous close threads.
[0091] Optionally, when determining whether the last asynchronous close thread is in an idle state, the hardware abstraction layer can determine whether the global handle of the asynchronous thread is empty. If the global handle of the last asynchronous close thread is empty, it means that the last asynchronous close thread is in an idle state, that is, the last asynchronous close thread has been executed; if the global handle of the last asynchronous close thread is not empty, it means that the last asynchronous close thread is not in an idle state, that is, the last asynchronous close thread is not completed.
[0092] It should be noted that if the previous asynchronous close thread is not completed before starting this asynchronous close thread, the two asynchronous close threads may operate a data structure or global variable at the same time, resulting in data confusion and thread safety issues. Therefore, judging whether the previous asynchronous close thread is idle here can avoid data confusion and improve the safety of this asynchronous close thread.
[0093] Optionally, in some abnormal or test scenarios, after the terminal device starts the open process of the second shooting mode, it immediately starts to execute the close process of the second shooting mode, and does not execute the configure_streams process of the second shooting mode, that is, it does not configure the corresponding resources for the second shooting mode, so there is no need to release the resources of the second shooting mode. This situation belongs to an abnormal camera process. In this abnormal camera process, since there is no need to release resources, the execution speed of the close process of the second shooting mode can be accelerated, and no asynchronous close thread is created to carry the close process of the second shooting mode.
[0094] Optionally, the hardware abstraction layer can determine whether the current process belongs to a normal camera process by detecting the initialization state of the current CHI module. The initialization of the CHI module is related to the configure_streams process. If the terminal device does not execute the configure_streams process, the CHI module is not initialized. If the terminal device executes the configure_streams process, the CHI module will be initialized. Exemplarily, the terminal device can set a flag bit to indicate the initialization state of the CHI module. When the flag bit is "true", it indicates that the CHI module has been initialized; when the flag bit is "false", it indicates that the CHI module has not been initialized.
[0095] Optionally, the hardware abstraction layer can configure thread attributes and priorities for the asynchronous close thread when creating the asynchronous close thread to ensure that the asynchronous close thread works properly.
[0096] Optionally, if the hardware abstraction layer determines that the conditions for creating an asynchronous close thread are not met, the terminal device executes the following Figure 4 The described process of switching shooting modes does not create an asynchronous close thread. The camera application calls the established close thread in the hardware abstraction layer to execute the close process of the first shooting mode. After the close process of the first shooting mode is completed, the open process of the second shooting mode is executed.
[0097] S604, the hardware abstraction layer sends an instruction to create an asynchronous close thread to the kernel layer.
[0098] Optionally, the hardware abstraction layer sends the instruction to create the asynchronous close thread to the kernel layer by calling an application programming interface (API) interface provided by the kernel layer. Exemplarily, the API interface provided by the kernel layer is a "thread_create" interface.
[0099] S605: The kernel layer creates an asynchronous close thread.
[0100] Optionally, the hardware abstraction layer writes parameters for creating an asynchronous close thread in the API interface, and the thread manager of the kernel layer creates the asynchronous close thread according to the parameters in the API interface. After the asynchronous close thread is created, the thread manager of the kernel layer starts the asynchronous close thread to release the camera service resources of the first shooting mode.
[0101] S606: The kernel layer starts an asynchronous close thread to execute a close process of the first shooting mode.
[0102] Taking the Android system as an example, processes and threads are managed by a thread manager at the kernel layer. The thread manager is responsible for allocating processes or threads to be executed to the CPU, and the CPU executes the processes or threads allocated by the thread manager. Optionally, the kernel layer starts an asynchronous close thread, including: the thread manager at the kernel layer allocates the asynchronous close thread to the CPU, and the CPU starts the asynchronous close thread to release the camera service resources of the first shooting mode.
[0103] S607: The kernel layer sends the creation result to the hardware abstraction layer.
[0104] In this step, the creation result indicates that the asynchronous close thread has been created.
[0105] S608, the hardware abstraction layer sends a first feedback result (result) to the application framework layer, indicating that the close process of the first shooting mode has been completed.
[0106] In this step, after receiving the creation result, the hardware abstraction does not need to wait for the close process of the first shooting mode to end, but immediately returns the first feedback result to the application framework layer by calling the close interface of the application framework layer. It should be understood that the hardware abstraction layer returns the first feedback result to the application framework layer based on the first close thread, and in fact the asynchronous close thread for closing the first shooting mode is still in progress.
[0107] S609: The application framework layer sends a first feedback result to the camera application.
[0108] After S608 and S609, the hardware abstraction layer can pass the first feedback result to the camera application by calling the close interface of the application framework layer. After receiving the first feedback result, the camera application can execute S610, and the open process does not need to wait for the close process to end, so that the asynchronous close thread and open thread are executed simultaneously.
[0109] S610: The camera application sends an instruction to execute an open process to the application framework layer. The instruction to execute the open process is used to instruct to start an open thread of the second shooting mode.
[0110] Optionally, the com.hihonor.camera process of the camera application sends the instruction to execute the open process to the camera server process of the application framework layer by calling the open interface of the application framework layer.
[0111] S611, the application framework layer sends the instruction to execute the open process to the hardware abstraction layer.
[0112] Optionally, the application framework layer sends the instruction for executing the open process to the provider process of the hardware abstraction layer through an open interface.
[0113] After S610 and S611, the camera application can pass the instruction for executing the open process to the hardware abstraction layer by calling the open interface of the application framework layer, so as to start the open thread of the hardware abstraction layer to execute the open process of the second shooting mode.
[0114] S612, the hardware abstraction layer sends an instruction to start an open thread to the kernel layer, where the instruction to start an open thread is used to instruct the kernel layer to start an open thread to execute an open process of the second shooting mode.
[0115] S613: The kernel layer starts an open thread to execute an open process of the second shooting mode.
[0116] Optionally, the kernel layer starts an open thread, including: a thread manager of the kernel layer assigns the open thread to a CPU, and the CPU starts to execute an open process of the second shooting mode and configures camera parameters and resources of the second shooting mode.
[0117] S614, after the open process of the second shooting mode is completed, the kernel layer sends a second feedback result to the hardware abstraction layer.
[0118] In this step, the second feedback result is used to indicate that the open process of the second shooting mode has ended.
[0119] S615: The hardware abstraction layer sends the second feedback result to the application framework layer.
[0120] S616: The application framework layer sends the second feedback result to the camera application.
[0121] S617, the camera application sends an instruction to execute the configure_streams process to the application framework layer, where the instruction to execute the configure_streams process is used to instruct to start the configure_streams thread of the second shooting mode.
[0122] S618, the application framework layer sends the instruction to execute the configure_streams process to the hardware abstraction layer.
[0123] Optionally, the application framework layer sends the instruction for executing the configure_streams process to the provider process of the hardware abstraction layer through the configure_streams interface.
[0124] After S617 and S618, the camera application can pass the instruction for executing the configure_streams process to the hardware abstraction layer by calling the configure_streams interface of the application framework layer, so as to start the configure_streams thread of the hardware abstraction layer to execute the configure_streams process of the second shooting mode.
[0125] S619, the hardware abstraction layer detects whether the asynchronous close thread is finished.
[0126] In this step, after receiving the instruction to execute the configure_streams process from the application framework layer, the hardware abstraction layer first detects whether the asynchronous close thread has ended, that is, detects whether the release of resources based on the asynchronous close thread has been completed. After determining that the asynchronous close thread has ended, the hardware abstraction layer instructs the kernel layer to start the configure_streams thread. Since the asynchronous close thread and the configure_streams thread have a lot of coupling in channel creation and memory application, for example, both apply for the same memory space, then the memory space applied for the second shooting mode may be released by the asynchronous close thread, resulting in an abnormality in the camera application obtaining the camera service resources of the second shooting mode. Therefore, before instructing the kernel layer to start the configure_streams thread, the hardware abstraction layer needs to first detect whether the asynchronous close thread has ended, and then start the configure_streams thread when the asynchronous close thread has ended, which is conducive to the camera application to normally obtain the camera service resources of the second shooting mode and avoid abnormalities in the camera process.
[0127] As can be seen from the description of S606, the thread manager of the kernel layer allocates the asynchronous close thread to the CPU, and the CPU executes the asynchronous close thread of the first shooting mode to release the camera service resources of the first shooting mode.
[0128] Exemplarily, in the code logic, the hardware abstraction layer can configure thread blocking in the configure_streams process. If the asynchronous close thread has not ended, but the camera application has been scheduled to the configure_streams process, then in the process of executing the configure_streams process, the hardware abstraction layer detects whether the asynchronous close thread is completed. If not, the hardware abstraction layer instructs the thread manager not to assign the configure_streams thread to the CPU by calling the sleep interface of the thread manager. After waiting for the asynchronous close thread to complete, the hardware abstraction layer instructs the thread manager to assign the configure_streams thread to the CPU, and the CPU executes the configure_streams process; if it has been completed, the hardware abstraction layer instructs the kernel layer to start the configure_streams thread.
[0129] The asynchronous close thread has different thread states from the beginning to the end, such as the initial state (new), running state (runnable), waiting state (waiting), terminated state (terminated), etc. When detecting whether the asynchronous close thread has ended, the hardware abstraction layer calls the pthread_join interface of the thread manager to instruct the thread manager to check the CPU stack to see whether the thread state of the asynchronous close thread is the terminated state. When the hardware abstraction layer calls the pthread_join interface in the configure_streams thread, the configure_streams thread will be in a blocked state until the CPU returns a termination instruction to the thread manager through the pthread_join interface, indicating that the thread state of the asynchronous close thread is the terminated state, and the configure_streams thread will continue to execute. After receiving the termination instruction through the pthread_join interface, the thread manager will notify the hardware abstraction layer that it can continue to execute the configure_streams thread.
[0130] S620, when the asynchronous close thread ends, the hardware abstraction layer sends an instruction to start the configure_streams thread to the kernel layer, where the instruction to start the configure_streams thread is used to instruct the kernel layer to start the configure_streams thread to execute the configure_streams process of the second shooting mode.
[0131] S621: The kernel layer starts the configure_streams thread to execute the configure_streams process of the second shooting mode.
[0132] Optionally, the kernel layer starts the configure_streams thread, including: the thread manager of the kernel layer assigns the configure_streams thread to the CPU, and the CPU starts to execute the configure_streams process of the second shooting mode to configure the platform session, pipeline and node of the second shooting mode.
[0133] S622: After the configure_streams process of the second shooting mode ends, the kernel layer sends a third feedback result to the hardware abstraction layer.
[0134] In this step, the third feedback result is used to indicate that the configure_streams process of the second shooting mode has ended.
[0135] S623, the kernel layer sends the image data to the hardware abstraction layer.
[0136] During the execution of the configure_streams process, when the camera sensor node is created, the hardware abstraction layer will send hardware initialization instructions to the kernel layer. After receiving the hardware initialization instructions, the kernel layer starts to initialize the camera sensor. After the hardware initialization is completed, the camera sensor starts to collect image data and returns the image data to the hardware abstraction layer through the kernel layer.
[0137] S624: The hardware abstraction layer sends the third feedback result to the application framework layer.
[0138] S625: The application framework layer sends the third feedback result to the camera application.
[0139] S626, the camera application sends a start instruction to the application framework layer, where the start instruction is used to request to obtain image data.
[0140] In this step, the image data is image data collected by a camera sensor as described in S623.
[0141] S627, the application framework layer sends a repeating instruction to the hardware abstraction layer, where the repeating instruction is used to instruct the hardware abstraction layer to return image data frame by frame and indicate the storage space for the image data.
[0142] S628, the hardware abstraction layer sends the image data to the application framework layer.
[0143] In this step, the hardware abstraction layer copies each frame of image data to the storage space for transmission.
[0144] S629, the application framework layer sends the image data to the camera application.
[0145] In the description of the above method 600, because the close process and the open process of the camera application are not coupled when switching shooting modes, the open thread of the hardware abstraction layer can be called to execute the open process of the second shooting mode when executing the close process of the first shooting mode. In addition, there is idle time between the end of the open process of the second shooting mode and the start of the configure_streams process of the second shooting mode. Usually, the duration of this idle time can meet the duration required to execute the close process of the first shooting mode. In this way, the terminal device can make full use of the device hardware resources (CPU and memory), and fully schedule the idle CPU to process the asynchronous close thread through software parallel processing, which will not bring additional cost burden to the terminal device and effectively improve the speed of mode switching.
[0146] In summary, the following combination Figure 6 The interaction process within the terminal device described and Figure 8 The scenario shown is described as follows Figure 7 Another mode switching method is shown.
[0147] Figure 7 700 is a schematic flow chart of another mode switching method 700 provided in an embodiment of the present application. The steps of method 700 can be executed by a terminal device. In the embodiment of the present application, the terminal device is a mobile phone as an example. Method 700 includes S701 to S703, and the specific steps are as follows:
[0148] S701, in response to an operation of opening a camera application, displaying a first interface of the camera application, where the first interface is an interface of a photographing mode.
[0149] See also Figure 8 The first interface displayed after the user opens the camera application of the terminal device can refer to Figure 8 The A interface in.
[0150] S702, in response to an operation of switching the shooting mode to the multi-lens video recording mode at a first time point, displaying a second interface of the camera application at a second time point, the second interface being an interface of the multi-lens video recording mode.
[0151] At the second time point, the second interface displayed by the terminal device can refer to Figure 8 In the B interface.
[0152] Combination Figure 6 As described above, in response to the operation of switching the shooting mode to the multi-lens recording mode at the first time point, the terminal device can execute S601 to S630, and the second interface in this step can be understood as the preview interface in S630.
[0153] Between the first time point and the second time point, the first time period and the second time period overlap. The first time period is a time period for closing the camera mode based on the closing thread, and the second time period is a time period for starting the multi-lens video recording mode based on the starting thread. It should be understood that the closing thread here refers to the second close thread mentioned above, that is, the asynchronous closing thread. Since the close process of the camera mode is implemented based on the second close thread, during the process of the second close thread executing the close process of the camera mode, since the open thread is also executing the open process of the multi-lens video recording mode at the same time, the time period for closing the camera mode based on the closing thread overlaps with the time period for starting the multi-lens video recording mode based on the starting thread.
[0154] S703, in response to the operation of switching the shooting mode to the photographing mode at the third time point, at a fourth time point, displaying a third interface of the camera application, the third interface being an interface of the photographing mode.
[0155] At the fourth time point, the third interface displayed by the terminal device can refer to Figure 8 The C interface in .
[0156] Combination Figure 6 In response to the operation of switching the shooting mode to the photo mode, the terminal device first executes S601 to S603. When determining whether the condition for creating an asynchronous close thread is met in S603, since the multi-lens recording mode does not support the creation of an asynchronous close thread, that is, the determination result of the condition "whether the currently applied shooting mode supports asynchronous close threads" is no, the terminal device can execute the following steps: Figure 4 The serial mode described, that is, the terminal device does not create an asynchronous close thread to carry the close process of the multi-lens recording mode, but calls the first close thread established in the hardware abstraction layer to first execute the close process of the multi-lens recording mode, and after the close process of the multi-lens recording mode is completed, the open process of the photographing mode is executed, and after the open process of the photographing mode is completed, the configure_streams process of the photographing mode is executed. Therefore, between the third time point and the fourth time point, the third time period is the time period for closing the multi-lens recording mode based on the closing thread, and the fourth time period is the time period for starting the shooting mode based on the starting thread. The closing thread here refers to the first close thread.
[0157] It should be noted that for the shooting mode of multi-lens recording, since multi-lens recording requires opening the rear camera first and then the front camera, the two cameras work independently and are also closed independently when closed. The terminal device cannot maintain two asynchronous close threads to work at the same time, that is, it is impossible to close the multi-lens recording by creating an asynchronous close thread. Therefore, between the third time point and the fourth time point, there is no overlap between the time period when the camera mode is closed based on the closing thread and the time period when the multi-lens recording mode is started based on the starting thread.
[0158] Usually, when a terminal device is abnormal or the stability of the camera application of the terminal device is tested, the camera application will quickly switch back and forth between one shooting mode and another. Figure 8 Another mode switching method is introduced.
[0159] Fig. 9900 is a schematic flow chart of another mode switching method 900 provided in an embodiment of the present application. The steps of method 900 can be performed by a terminal device. The present application embodiment takes a mobile phone as an example for the terminal device. The steps of method 900 can be performed after S703. Method 900 includes S901 and S902, and the specific steps are as follows:
[0160] S901, switching the shooting mode to the video recording mode at a fifth time point;
[0161] S902: Before configuring resources for the video recording mode, switch the shooting mode to the photo taking mode at a sixth time point.
[0162] Between the fifth time point and the sixth time point, the fifth time period is a time period for closing the video recording mode based on the closing thread, and the sixth time period is a time period for starting the photo taking mode based on the starting thread.
[0163] It should be noted that the time interval between the fourth time point and the fifth time point is very short, and the time interval between the fifth time point and the sixth time point is very short. It can be understood that the terminal device quickly switches from the photo mode to the video mode, and then quickly switches from the video mode to the photo mode. In this rapid and frequent switching process, the terminal device immediately executes the close process of the video mode after the open process of the video mode ends, and does not execute the configure_streams process of the video mode. Therefore, the camera service resources are not allocated to the video mode. When the video mode is quickly switched to the photo mode, the terminal device does not need to release the camera service resources for the video mode. In this way, the execution speed of the close process of the video mode will be accelerated and can be completed in a very short time. Therefore, in this scenario, the mobile phone does not create an asynchronous close thread to carry the close process of the video mode.
[0164] The embodiment of the present application provides a terminal device, which can be a first terminal device, a second terminal device or a third terminal device. The terminal device includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.
[0165] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0166] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0167] In one possible implementation, a computer-readable medium may include random access memory (RAM), read-only memory (ROM), compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that is intended to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and optical disk as used herein include optical disk, laser disk, optical disk, digital versatile disk (DVD), floppy disk and Blu-ray disk, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.
[0168] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.
[0169] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0170] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above are only specific implementation methods of the present application and are not used to limit the protection scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. A mode switching method, characterized in that: include: In response to an operation of opening a camera application, displaying a first interface of the camera application, where the first interface is an interface of a first shooting mode; In response to an operation of switching the first shooting mode to the second shooting mode at a first time point, displaying a second interface of the camera application at a second time point, the second interface being an interface of the second shooting mode; In a first time period, the first shooting mode is turned off, and in a second time period, the second shooting mode is started, wherein the first time period is between the first time point and the second time point, and the second time period is between the first time point and the second time point, and the first time period and the second time period overlap.
2. The method according to claim 1, characterized in that The second interface includes images captured by at least two cameras; the method further includes: In response to the operation of switching the second shooting mode to the first shooting mode at a third time point, at a fourth time point, displaying a third interface of the camera application, the third interface being an interface of the first shooting mode; In a third time period, the second shooting mode is turned off, and in a fourth time period, the first shooting mode is started, wherein the third time period is between the third time point and the fourth time point, and the fourth time period is between the third time point and the fourth time point, and there is no overlap between the third time period and the fourth time period.
3. The method according to claim 2, characterized in that After, in response to the operation of switching the second shooting mode to the first shooting mode at the third time point, displaying the third interface of the camera application at a fourth time point, the method further includes: At a fifth time point, switching the first shooting mode to a third shooting mode; Before configuring resources for the third shooting mode, switching the third shooting mode to the first shooting mode at a sixth time point; In the fifth time period, the third shooting mode is turned off, and in the sixth time period, the first shooting mode is started, wherein the fifth time period is between the fifth time point and the sixth time point, and the sixth time point is between the fifth time point and the sixth time point, and there is no overlap between the fifth time period and the sixth time period.
4. The method according to claim 1, characterized in that After the operation of switching the first shooting mode to the second shooting mode in response to the first time point, the method further includes: Create a shutdown thread; The first shooting mode is closed based on the closing thread.
5. The method according to claim 4, characterized in that The creating and closing thread comprises: When the preset conditions are met, the closing thread is created; The preset conditions include: the application package name indicated by the first preconfiguration parameter includes the application package name of the camera application, the shooting mode indicated by the second preconfiguration parameter does not include the first shooting mode, the last closed thread at the current moment is in an idle state, and the CHI module has been initialized; The first preconfiguration parameter is used to indicate the application package name that can support the creation of the shutdown thread, and the second preconfiguration parameter is used to indicate the shooting mode that does not support the creation of the shutdown thread.
6. The method according to claim 5, characterized in that In the case where the preset condition is met, after creating the closing thread, the method further includes: Starting the second shooting mode based on the starting thread; After the second shooting mode is started, if the shutdown thread is completed, start the configuration flow thread to configure resources for the second shooting mode; At the second time point, displaying the second interface of the camera application includes: After the configuration stream thread is completed, at the second time point, a second interface of the camera application is displayed.
7. The method according to claim 6, characterized in that After the second shooting mode is started, the method further includes: Obtaining the thread status of the closed thread; Based on the thread status of the shutdown thread, it is determined whether the shutdown thread is completed.
8. The method according to claim 7, characterized in that The determining whether the closing thread is completed based on the thread state of the closing thread includes: If the thread state of the closing thread is a terminated state, determining that the closing thread is completed; If the thread state of the shutdown thread is not a terminated state, it is determined that the shutdown thread is not completed.
9. A terminal device, characterized in that: include: processor and memory, wherein The memory is used to store computer programs; The processor is configured to call and execute the computer program so that the terminal device executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 8.
11. A computer program product, characterized in that The invention comprises a computer program which, when being executed, causes a computer to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method for switching photographing mode, and electronic device
CN103716535A
Shooting power saving method and apparatus
CN104113642A
Mobile terminal camera running method and device
CN104735359A
Shooting mode switching method and device, storage medium and program product
CN113422903A
Field dynamic effect insertion method and device in shooting, storage medium and program product
CN113473005A
