CN112363836A - Android system camera resource control method - Google Patents

Android system camera resource control method Download PDF

Info

Publication number
CN112363836A
CN112363836A CN202011263763.7A CN202011263763A CN112363836A CN 112363836 A CN112363836 A CN 112363836A CN 202011263763 A CN202011263763 A CN 202011263763A CN 112363836 A CN112363836 A CN 112363836A
Authority
CN
China
Prior art keywords
camera
application
foreground
foreground application
resources
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
CN202011263763.7A
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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN202011263763.7A priority Critical patent/CN112363836A/en
Publication of CN112363836A publication Critical patent/CN112363836A/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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/66Remote control of cameras or camera parts, e.g. by remote control devices
    • H04N23/661Transmitting camera control signals through networks, e.g. control via the Internet

Abstract

The invention discloses a method for managing and controlling Android system camera resources, which is characterized in that the process state of camera application is acquired through application process information in system service, and on the basis that the priority of the camera application of foreground application is smaller than that of background service, the judgment of the process state of the camera application is increased to distinguish whether the camera application is a foreground process or not, so that the camera resources are managed, and the foreground application can rob the camera resources of the background service.

Description

Android system camera resource control method
Technical Field
The invention relates to the field of Android smart televisions, in particular to a method for controlling camera resources of an Android system.
Background
At present, management and control of camera resources in an Android system are mainly performed in a system service (CameraService), and the flow of the management and control is as follows:
under the condition that an application A uses a camera, an application B applies for using the camera, firstly, open action is executed to acquire a camera object, so that the camera object enters a system service (CameraServer) to be connected (Connect), the system service (CameraServer) starts a control mechanism of camera resources while the camera object is connected, the size of a progress score (curAdj) of the application A using the camera and the size of a progress score (curAdj) of the application B applying for using the camera are compared to determine which application uses the camera resources, and the lower the progress score (curAdj), the higher the priority of the camera used by the application is.
Since the object to which the foreground application is directed is a user, it is necessary to ensure that the foreground application can acquire the camera resource under any circumstances. The original camera resource management and control mechanism mainly takes the process score as the judgment basis of the camera use priority, and does not distinguish whether the process state is the foreground or the background. When the process score of foreground application is higher than background service process, the priority of camera use of foreground application is lower than background service, and at the moment, the foreground application cannot use the camera, so that user behavior is blocked, and user product experience is influenced.
Therefore, the existing camera management and control mechanism has the condition that foreground application cannot acquire background service camera resources.
Disclosure of Invention
The invention aims to provide a method for controlling camera resources of an Android system, which can ensure that foreground applications opened by a user can acquire the camera resources of background services in a camera resource control mechanism in system services. Namely, when the camera use priority of the foreground application is lower than that of the background service, the foreground application can be ensured to preempt the camera resource of the background service.
In order to achieve the technical effects, the invention provides the following technical scheme:
a method for controlling Android system camera resources comprises the following steps: .
(1) The foreground application A is started and connected with the camera;
(2) executing a camera resource management and control function wooldEvictLocked ();
(3) determining whether the camera is being used by other application B; if not, the foreground application successfully acquires the camera resources, and the control flow is finished; if yes, continuing to perform the next step;
(4) respectively acquiring process scores of foreground application and other application B, if the process score of the foreground application A is smaller than that of the other application B, automatically disconnecting the other application B from the camera by the system, releasing the camera, acquiring camera resources by the foreground application A, and ending the control flow; if the process score of the foreground application A is larger than the process scores of the other applications B, carrying out the next step;
(5) acquiring the process state of a foreground application A, judging whether the foreground application A is a foreground process, if so, automatically disconnecting the connection between an application B using a camera and the camera by a system, releasing the camera, acquiring camera resources by the foreground application A, and ending a control flow; if not, the camera resources of the other applications B cannot be preempted, and the control flow is ended.
A further technical solution is that, before the foreground application a is started, the background service is using the camera.
Compared with the prior art, the invention has the following beneficial effects: the object oriented by the foreground application is a user, so that the foreground application is required to be ensured to occupy the camera resource certainly, and the problem that the foreground application in the Android system cannot occupy the camera resource of the background service is mainly solved based on the method. The method comprises the steps of acquiring a process state (procState) of a camera application through application process information in a system service (Cameraservice), and increasing judgment of the process state of the camera application on the basis that the camera use priority of a foreground application is smaller than that of a background service to distinguish whether the camera application is a foreground process or not, so that camera resources are controlled, and the foreground application can certainly occupy the camera resources of the background service.
Drawings
Fig. 1 is a flowchart illustrating a camera resource management and control method according to the present invention.
Detailed Description
The invention will be further explained and explained with reference to the drawings and the embodiments.
Example 1
As shown in fig. 1, the present invention provides a method for controlling resources of an Android system camera, including the following steps: .
(1) The foreground application A is started and connected with the camera;
(2) executing a camera resource management and control function wooldEvictLocked ();
(3) determining whether the camera is being used by other application B; if not, the foreground application successfully acquires the camera resources, and the control flow is finished; if yes, continuing to perform the next step;
(4) respectively acquiring process scores of foreground application and other application B, if the process score of the foreground application A is smaller than that of the other application B, automatically disconnecting the other application B from the camera by the system, releasing the camera, acquiring camera resources by the foreground application A, and ending the control flow; if the process score of the foreground application A is larger than the process scores of the other applications B, carrying out the next step;
(5) acquiring the process state of a foreground application A, judging whether the foreground application A is a foreground process, if so, automatically disconnecting the connection between an application B using a camera and the camera by a system, releasing the camera, acquiring camera resources by the foreground application A, and ending a control flow; if not, the camera resources of the other applications B cannot be preempted, and the control flow is ended.
Before the foreground application A is started, the background service uses the camera.
Although the present invention has been described herein with reference to the illustrated embodiments thereof, which are intended to be preferred embodiments of the present invention, it is to be understood that the invention is not limited thereto, and that numerous other modifications and embodiments can be devised by those skilled in the art that will fall within the spirit and scope of the principles of this disclosure.

Claims (2)

1. A method for controlling Android system camera resources is characterized by comprising the following steps: .
(1) The foreground application A is started and connected with the camera;
(2) executing a camera resource management and control function wooldEvictLocked ();
(3) determining whether the camera is being used by other application B; if not, the foreground application successfully acquires the camera resources, and the control flow is finished; if yes, continuing to perform the next step;
(4) respectively acquiring process scores of foreground application and other application B, if the process score of the foreground application A is smaller than that of the other application B, automatically disconnecting the other application B from the camera by the system, releasing the camera, acquiring camera resources by the foreground application A, and ending the control flow; if the process score of the foreground application A is larger than the process scores of the other applications B, carrying out the next step;
(5) acquiring the process state of a foreground application A, judging whether the foreground application A is a foreground process, if so, automatically disconnecting the connection between an application B using a camera and the camera by a system, releasing the camera, acquiring camera resources by the foreground application A, and ending a control flow; if not, the camera resources of the other applications B cannot be preempted, and the control flow is ended.
2. The Android system camera resource management and control method of claim 1, wherein a background service is using a camera before the foreground application A is started.
CN202011263763.7A 2020-11-12 2020-11-12 Android system camera resource control method Pending CN112363836A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011263763.7A CN112363836A (en) 2020-11-12 2020-11-12 Android system camera resource control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011263763.7A CN112363836A (en) 2020-11-12 2020-11-12 Android system camera resource control method

Publications (1)

Publication Number Publication Date
CN112363836A true CN112363836A (en) 2021-02-12

Family

ID=74514547

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011263763.7A Pending CN112363836A (en) 2020-11-12 2020-11-12 Android system camera resource control method

Country Status (1)

Country Link
CN (1) CN112363836A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778641A (en) * 2021-08-09 2021-12-10 荣耀终端有限公司 Method for controlling camera, electronic device and computer readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103257939A (en) * 2013-04-02 2013-08-21 北京小米科技有限责任公司 Method, device and equipment for acquiring images
CN103559080A (en) * 2011-02-14 2014-02-05 微软公司 Constrained Execution of Background Application Code on Mobile Devices
CN103793246A (en) * 2014-01-22 2014-05-14 深圳Tcl新技术有限公司 Method and system for coordinating camera resources
CN104052909A (en) * 2014-06-19 2014-09-17 深圳市中兴移动通信有限公司 Shooting method and device
CN104838360A (en) * 2012-09-04 2015-08-12 微软技术许可有限责任公司 Quota-based resource management
CN107423125A (en) * 2017-07-27 2017-12-01 上海传英信息技术有限公司 A kind of camera shooting control method and shooting control system for intelligent terminal
CN109144728A (en) * 2018-08-22 2019-01-04 Oppo广东移动通信有限公司 The occupancy control method and device of camera applications

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559080A (en) * 2011-02-14 2014-02-05 微软公司 Constrained Execution of Background Application Code on Mobile Devices
CN104838360A (en) * 2012-09-04 2015-08-12 微软技术许可有限责任公司 Quota-based resource management
CN103257939A (en) * 2013-04-02 2013-08-21 北京小米科技有限责任公司 Method, device and equipment for acquiring images
CN103793246A (en) * 2014-01-22 2014-05-14 深圳Tcl新技术有限公司 Method and system for coordinating camera resources
CN104052909A (en) * 2014-06-19 2014-09-17 深圳市中兴移动通信有限公司 Shooting method and device
CN107423125A (en) * 2017-07-27 2017-12-01 上海传英信息技术有限公司 A kind of camera shooting control method and shooting control system for intelligent terminal
CN109144728A (en) * 2018-08-22 2019-01-04 Oppo广东移动通信有限公司 The occupancy control method and device of camera applications

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GAOJIAN.SHI: "Android CameraService对多进程同时使用不同相机的限制分析", 《HTTPS://WWW.IT610.COM/ARTICLE/1295071944214913024.HTM》 *
冻云-FROZENCLOUD: "2.4camera多进程互斥控制", 《HTTPS://BLOG.CSDN.NET/IOIOL/ARTICLE/DETAILS/103460264》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778641A (en) * 2021-08-09 2021-12-10 荣耀终端有限公司 Method for controlling camera, electronic device and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN110855536B (en) Operation control method and device, household appliance and storage medium
US20130247035A1 (en) Techniques for managing virtual machine (vm) states
EP2530599A1 (en) Method and mobile terminal for realizing audio transmission
CN104503828B (en) A kind of process management method and terminal
WO2009147802A1 (en) Priority controller and priority control method
US10492245B2 (en) Call termination method, application processor, and modem
CN105744367B (en) Wireless quick networking methods on Android TV
JP2014503867A (en) Method and apparatus for cross-process communication and computer storage medium
WO2016045190A1 (en) Switching method, switching system and terminal for system and/or application program
CN107015972B (en) Method, device and system for migrating machine room services
CN112463066B (en) Method and equipment for controlling burst service quality of distributed block storage logical volume
CN112363836A (en) Android system camera resource control method
CN105426169A (en) Method for automatic adjustment of network card identification order in Windows system
CN114244642B (en) Control method and device of equipment, computer readable storage medium and processor
CN105242964A (en) Application operation monitoring method and system
CN112416290A (en) Audio management method based on audio focus
WO2021043021A1 (en) Memory write-back method and apparatus, and terminal and storage medium
US10028130B2 (en) Methods for updating a cache memory of a telecommunications terminal
CN106714084A (en) Method for rapidly connecting android smart device with Bluetooth
CN113791888A (en) Linux application process management method and device
CN112650541B (en) Application program starting acceleration method, system, equipment and storage medium
CN112035249A (en) Application program network proportion adjusting method and device and storage medium
CN107809323B (en) Resource control method, device and system
CN107333150A (en) The method that management and control is installed in Android intelligent television application
CN108737208B (en) Connection synchronization method and device based on secure gateway deep packet detection and computer

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210212