CN115113946A - Method and device for optimizing starting of camera - Google Patents

Method and device for optimizing starting of camera Download PDF

Info

Publication number
CN115113946A
CN115113946A CN202110285997.XA CN202110285997A CN115113946A CN 115113946 A CN115113946 A CN 115113946A CN 202110285997 A CN202110285997 A CN 202110285997A CN 115113946 A CN115113946 A CN 115113946A
Authority
CN
China
Prior art keywords
camera
background service
target background
service process
attribute
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110285997.XA
Other languages
Chinese (zh)
Inventor
赵齐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Genius Technology Co Ltd
Original Assignee
Guangdong Genius Technology Co Ltd
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 Guangdong Genius Technology Co Ltd filed Critical Guangdong Genius Technology Co Ltd
Priority to CN202110285997.XA priority Critical patent/CN115113946A/en
Publication of CN115113946A publication Critical patent/CN115113946A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Abstract

The invention belongs to the field of intelligent equipment, and discloses a method and a device for optimizing camera starting, wherein the method comprises the following steps: rc file defines the killing process service of the target background service process; and when the camera starts connection, triggering the progress killing service to close the target background service progress. By the method and the device, the background process which does not influence the operation of the system can be accurately killed when the camera is opened, the memory of the killed background process is released, the available memory of the system is increased for the operation of the camera, and the camera operation jam is reduced.

Description

Method and device for optimizing starting of camera
Technical Field
The invention relates to the field of intelligent equipment, in particular to a method and a device for optimizing camera starting.
Background
Along with the increase of diversified demands of users on intelligent terminal products, terminal functions such as mobile phones, panel circuits (PADs) and intelligent wearable devices are continuously innovated, and the application range of the mobile phones, the panel circuits and the intelligent wearable devices is continuously expanded.
At present, on Android equipment with low memory, a camera with a little higher pixel occupies a large memory, and the remaining available memory of the system is small, so that the operation after the camera is opened is very unsmooth, and the user experience is influenced.
Disclosure of Invention
The invention aims to provide a method and a device for optimizing camera starting, and solves the problems.
The technical scheme provided by the invention is as follows:
in one aspect, a method for optimizing camera startup is provided, including:
rc file defines the killing process service of the target background service process;
and when the camera starts connection, triggering the progress killing service to close the target background service progress.
Further preferably, the method further comprises the following steps:
marking a target background service process, wherein the target background service process comprises a closable background service process;
and when the starting of the target background service process is monitored, saving the process ID of the target background service process.
Further preferably, when the camera starts to connect, the process killing service is triggered to execute the process of closing the corresponding target background service, including:
and triggering the corresponding killing process service based on the process ID of the target background service process so as to close the target background service process.
Further preferably, the method further comprises the following steps:
acquiring attributes of the camera;
and when the attribute of the camera is the enable-to-start attribute, closing the automatic restart path of the target background service process.
Further preferably, the closing the automatic restart path of the target background service process when the attribute of the camera is the enable-to-start attribute includes:
and closing the automatic restarting path of the target background service process based on a preset closing identifier.
Further preferably, before the triggering the progress killing service to close the target background service process when the camera starts connection, the method includes:
when the camera starts connection, setting the enabling attribute of the camera as an enabling opening attribute.
Further preferred, comprising:
setting an enable attribute of the camera to an enable-off attribute when the camera is off.
An optimized camera startup device comprising:
the definition module is used for defining the killing process service of the target background service process in the init.rc file;
and the triggering module is used for triggering the progress killing service when the camera starts connection so as to close the target background service progress.
Further preferably, the method further comprises the following steps:
the system comprises a marking module, a sending module and a receiving module, wherein the marking module is used for marking a target background service process, and the target background service process comprises a closable background service process;
and the storage module is used for storing the process ID of the target background service process when the starting of the target background service process is monitored.
Further preferably, the triggering module is further configured to:
and triggering the corresponding killing process service based on the process ID of the target background service process so as to close the target background service process.
The method and the device for optimizing the starting of the camera, provided by the invention, have the following technical effects at least:
according to the method for optimizing the camera starting, disclosed by the invention, the memory can be effectively managed, and the camera can be quickly started.
Drawings
The invention is described in further detail below with reference to the following figures and detailed description:
FIG. 1 is a schematic diagram of one embodiment of an optimized camera startup method of the present invention;
fig. 2 is a schematic diagram of an embodiment of an optimized camera activation apparatus according to the present invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In this context, it is to be understood that, unless otherwise explicitly stated or limited, the terms "mounted," "connected," and "connected" are to be construed broadly and may include, for example, a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In addition, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, without inventive effort, other drawings and embodiments can be derived from them.
Example one
The invention provides an embodiment of a method for optimizing camera startup, as shown in fig. 1, comprising:
and S100, defining the killing process service of the target background service process in the init.
Specifically, a service of kill _ pid is defined in the init.rc file, and is specially used for a process corresponding to the pid stored in the sys.update.pid by kill.
Illustratively, a start file, i.e., an init.rc file, is stored in the linux system, and this is generally a script file that is automatically executed before an application is started.
Specifically, the background service process pid to be killed is stored in a system attribute, such as sys.
Rc may directly define service, similar to the following manner:
service prd_pid/system/bin/prod_cmd
user root
disabled
oneshot
seclabel u:r:xtc_init:s0
since the operation of opening the camera is a performance bottleneck, the pid killing process is directly saved in the embodiment, the speed of the process pid which needs killing is higher than that of the process pid which needs killing and is used by other manufacturers, and meanwhile, the consumption of CPU resources is lower.
S200, when the camera starts connection, triggering the progress killing service to close the target background service progress.
Specifically, when the camera hardware executes to camera service:: connect, the attribute sys.camera.enable is set to true, and this service kill _ pid is triggered, the corresponding background process is killed, and sys.camera.enable is set to false when the camera exits.
Rc may initiate a defined service by setting attribute monitoring, for example, when the code below is to change to true, it will initiate a service on property named prd _ pid. The killing process is a pid process corresponding to kill one by one.
According to the method for optimizing the camera starting, disclosed by the invention, the memory can be effectively managed, and the camera can be quickly started.
Example two
Based on the foregoing embodiment, the same parts in the foregoing embodiment are not described in detail in this embodiment, and this embodiment provides a method for optimizing camera startup, which preferably further includes:
and marking target background service processes, wherein the target background service processes comprise closable background service processes.
And when the starting of the target background service process is monitored, saving the process ID of the target background service process.
Preferably, when the camera starts to connect, the process killing service is triggered to execute the process of closing the corresponding target background service, including:
and triggering the corresponding killing process service based on the process ID of the target background service process so as to close the target background service process.
Rc file, before defining the killing service of the target background service process, the background service process that can be killed needs to be marked, which specifically includes: the method comprises the steps of finding a type of processes which run in a system background frequently but can be killed at any time, using the processes as target background service processes, and storing pid (global id) of the target background service processes when the target background service processes are started.
Illustratively, the pid of the update process is saved in sys.
In this embodiment, since the camera needs to occupy a large amount of cpu resources when being turned on, for example, since there are too many pixels of the camera, the cpu processing load is large, so that the camera is stuck when being turned on regularly and when taking a picture.
In order to reduce the use of the cpu as much as possible and improve the whole performance of the system, the corresponding process ID is recorded when the related process which needs to be killed, namely the target background service process is started, and the system does not need to repeatedly query the target background service process through the cpu, so that the load of the cpu can be reduced, and the efficiency of the cpu is further improved.
In this embodiment, the method further includes: and when the attribute of the camera is the enable-to-start attribute, closing the automatic restart path of the target background service process.
Preferably, the closing an automatic restart path of a target background service process when the attribute of the camera is an enable attribute includes:
and closing the automatic restarting path of the target background service process based on the preset closing identifier.
Specifically, under normal conditions, the android service process can be restarted within 5s after being killed, the performance of the camera is affected, and compared with the situation that the process can be repeatedly and automatically restarted after other manufacturers kill the service process.
Because the restarting service needs to occupy system resources, when the camera is detected to be in use, the camera is not allowed to be restarted after being stopped by the cpu, so that the load of the cpu is reduced, and the performance of the use of the camera is optimized.
In the embodiment, the shutdown identifier is set, so that the killed service process is not permitted to be restarted in the use process of the camera, and repeated restarting of the background service process is avoided.
Preferably, before the closing an automatic restart path of a target background service process when the attribute of the camera is an enable attribute, the method includes:
setting an enable attribute of the camera to an enable on attribute.
Specifically, it is determined that if sys.camera.enable is true, the system does not permit the killed background service process to automatically restart.
Preferably, the method comprises the following steps:
setting an enable attribute to an enable close attribute to turn off the camera when the camera is turned off.
In the embodiment, when the camera is opened, the background process which does not affect the operation of the system is accurately killed, the memory of the background process is released, the available memory of the system is increased for the operation of the camera, and the operating jam of the camera is reduced. Meanwhile, the pid coming kill process is directly appointed, and the CPU occupation is smaller.
Initiate service defined in init.rc by setting attribute sys.camera.enable to belong to asynchronous process operation, without affecting the performance of opening the camera main thread.
EXAMPLE III
In another aspect, the present invention further provides an embodiment of an optimized camera activation apparatus, as shown in fig. 2, including:
the defining module 100 is configured to define a killing service of a target background service process in an init.
The triggering module 200 is configured to trigger the anti-progress service to close the target background service progress when the camera starts connection.
Preferably, the method further comprises the following steps:
and the marking module is used for marking the target background service process, and the target background service process comprises a closable background service process.
And the storage module is used for storing the process ID of the target background service process when the starting of the target background service process is monitored.
Preferably, the triggering module is further configured to:
and triggering the corresponding killing process service based on the process ID of the target background service process so as to close the target background service process.
In the embodiment, when the camera is opened, the background process which does not affect the operation of the system is accurately killed, the memory of the background process is released, the available memory of the system is increased for the operation of the camera, and the operation jam of the camera is reduced. Meanwhile, the pid coming kill process is directly appointed, and the CPU occupation is smaller.
Initiate service defined in init.rc by setting attribute sys.camera.enable to belong to asynchronous process operation, without affecting the performance of opening the camera main thread.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or recited in detail in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/electronic device and method may be implemented in other ways. The above-described embodiments of the apparatus/electronic device are merely exemplary, and the described modules or units may be divided into only one logical functional division for practical implementation, and may have another division manner. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for optimizing camera startup, comprising:
rc file defines the killing process service of the target background service process;
and when the camera starts connection, triggering the progress killing service to close the target background service progress.
2. The method for optimizing camera startup of claim 1, further comprising:
marking a target background service process, wherein the target background service process comprises a closable background service process;
and when the starting of the target background service process is monitored, saving the process ID of the target background service process.
3. The method for optimizing camera startup according to claim 2, wherein the triggering the progress killing service to execute the closing of the corresponding target background service process when the camera starts the connection comprises:
and triggering the corresponding killing process service based on the process ID of the target background service process so as to close the target background service process.
4. The method for optimizing camera startup of claim 1, further comprising:
acquiring attributes of the camera;
and when the attribute of the camera is the enable-to-start attribute, closing the automatic restart path of the target background service process.
5. The method for optimizing camera booting according to claim 4, wherein the closing the automatic restart path of the target background service process when the attribute of the camera is an enable attribute comprises:
and closing the automatic restarting path of the target background service process based on a preset closing identifier.
6. The optimized camera startup method according to claim 1, wherein before the triggering the progress killing service to close the target background service process when the camera starts connecting, the method comprises:
when the camera starts to connect, setting the enabling attribute of the camera as an enabling opening attribute.
7. The method for optimizing the startup of the camera according to any one of claims 1 to 6, comprising:
setting an enable attribute of the camera to an enable-off attribute when the camera is off.
8. An optimized camera activation device, comprising:
the definition module is used for defining the killing process service of the target background service process in the init.rc file;
and the triggering module is used for triggering the progress killing service when the camera starts connection so as to execute the process of closing the target background service.
9. The optimized camera launching device of claim 8, further comprising:
the system comprises a marking module, a sending module and a receiving module, wherein the marking module is used for marking a target background service process, and the target background service process comprises a closable background service process;
and the storage module is used for storing the process ID of the target background service process when the starting of the target background service process is monitored.
10. The optimized camera launching device of claim 9, wherein the triggering module is further configured to:
and triggering the corresponding killing process service based on the saved process ID of the target background service process so as to close the target background service process.
CN202110285997.XA 2021-03-17 2021-03-17 Method and device for optimizing starting of camera Pending CN115113946A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110285997.XA CN115113946A (en) 2021-03-17 2021-03-17 Method and device for optimizing starting of camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110285997.XA CN115113946A (en) 2021-03-17 2021-03-17 Method and device for optimizing starting of camera

Publications (1)

Publication Number Publication Date
CN115113946A true CN115113946A (en) 2022-09-27

Family

ID=83322924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110285997.XA Pending CN115113946A (en) 2021-03-17 2021-03-17 Method and device for optimizing starting of camera

Country Status (1)

Country Link
CN (1) CN115113946A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024538A (en) * 2012-11-12 2013-04-03 北京奇虎科技有限公司 Memory management method and system
WO2015196967A1 (en) * 2014-06-24 2015-12-30 北京奇虎科技有限公司 Method and apparatus for application to permanently reside in background of operating system
CN105824668A (en) * 2016-03-16 2016-08-03 广东欧珀移动通信有限公司 Process control method, process control device and terminal equipment
CN106250223A (en) * 2016-07-28 2016-12-21 宇龙计算机通信科技(深圳)有限公司 A kind of background process management method and terminal unit
CN108307236A (en) * 2018-02-01 2018-07-20 深圳创维-Rgb电子有限公司 A kind of method, storage medium and the smart television of smart television memory optimization

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103024538A (en) * 2012-11-12 2013-04-03 北京奇虎科技有限公司 Memory management method and system
WO2015196967A1 (en) * 2014-06-24 2015-12-30 北京奇虎科技有限公司 Method and apparatus for application to permanently reside in background of operating system
CN105824668A (en) * 2016-03-16 2016-08-03 广东欧珀移动通信有限公司 Process control method, process control device and terminal equipment
CN106250223A (en) * 2016-07-28 2016-12-21 宇龙计算机通信科技(深圳)有限公司 A kind of background process management method and terminal unit
CN108307236A (en) * 2018-02-01 2018-07-20 深圳创维-Rgb电子有限公司 A kind of method, storage medium and the smart television of smart television memory optimization

Similar Documents

Publication Publication Date Title
RU2686673C1 (en) Device and method of terminal control and terminal
CN101814035B (en) Method and system to enable fast platform restart
WO2017211226A1 (en) Method for displaying media file, terminal, and storage medium
CN107113307B (en) Management method, device, system and memory, the unmanned plane of external equipment
CN109753297A (en) Method for upgrading software, device and readable storage medium storing program for executing when terminal standby
WO2014012504A1 (en) Method, device, and mobile terminal for api interception
CN107943270B (en) Application service control method and device, storage medium and mobile terminal
CN112463239A (en) BIOS and BMC interaction option default value modification method, system, terminal and storage medium
CN109976886B (en) Kernel remote switching method and device
EP1880280A2 (en) System and method for providing bundle group termination in an osgi service platform
CN111240753A (en) Loading method of bootstrap program, storage medium and embedded terminal
CN110738156B (en) Face recognition system and method based on message middleware
CN112698712B (en) Method and apparatus for energy consumption management
CN105116991A (en) Terminal power saving method and apparatus
CN107547277B (en) Method for realizing virtualization control board and network communication equipment
CN115113946A (en) Method and device for optimizing starting of camera
CN111966425A (en) Process cleaning method and device, storage medium and mobile terminal
CN108769518B (en) Camera interaction method and device, electronic equipment and computer readable storage medium
CN116501392A (en) Starting method and device of microprocessor, storage medium and electronic equipment
CN113535368B (en) Task processing method and device and electronic equipment
CN107179911B (en) Method and equipment for restarting management engine
CN110430318B (en) Mobile terminal WIFI calling control method, mobile terminal and storage medium
CN112925478B (en) Camera storage space control method, intelligent terminal and computer readable storage medium
JP2022507883A (en) Exception handling method, terminal device and storage medium
CN110740382B (en) Method, device, television and medium for avoiding undesired automatic restart of television

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination