CN111638966A - Resource acquisition method and device and electronic equipment - Google Patents

Resource acquisition method and device and electronic equipment Download PDF

Info

Publication number
CN111638966A
CN111638966A CN202010470948.9A CN202010470948A CN111638966A CN 111638966 A CN111638966 A CN 111638966A CN 202010470948 A CN202010470948 A CN 202010470948A CN 111638966 A CN111638966 A CN 111638966A
Authority
CN
China
Prior art keywords
target
resource
application
application programs
application program
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
CN202010470948.9A
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202010470948.9A priority Critical patent/CN111638966A/en
Publication of CN111638966A publication Critical patent/CN111638966A/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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/522Barrier synchronisation

Abstract

The application discloses a resource obtaining method and device and electronic equipment, belongs to the technical field of communication, and can solve the problem that an application program cannot normally run due to resource conflict. The specific scheme comprises the following steps: respectively generating resource requests by the running N application programs, wherein the resource requests are used for requesting to call target resources; respectively transmitting target resources to the N application programs through the target process; n application programs call target resources simultaneously; wherein N is an integer greater than 1. The method is applied to a scene that a plurality of application programs request to call the same resource.

Description

Resource acquisition method and device and electronic equipment
Technical Field
The application belongs to the technical field of communication, and particularly relates to a resource acquisition method and device and electronic equipment.
Background
With the development of communication technology, the intelligent degree of electronic equipment is continuously improved. In the case where the electronic device is running one application, the user may trigger the electronic device to run another application.
Generally, to prevent resource conflicts, an electronic device may prohibit two applications from editing or accessing the same resource at the same time. For example, in the case where the application a uses a camera, the application B cannot use the camera. For example, when the application a edits a certain file, the application B cannot edit the file. Therefore, when the user triggers the electronic device to run two applications, if the two applications need to access the same resource, one of the two applications cannot run normally due to resource conflict.
Disclosure of Invention
The embodiment of the application aims to provide a resource obtaining method, a resource obtaining device and electronic equipment, and the problem that an application program cannot normally run due to resource conflict can be solved.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a resource obtaining method, where the method includes: respectively generating resource requests by the running N application programs, wherein the resource requests are used for requesting to call target resources; respectively transmitting target resources to the N application programs through the target process; n application programs call target resources simultaneously; wherein N is an integer greater than 1.
In a second aspect, an embodiment of the present application provides a resource acquisition apparatus, including: a processing module and a communication module. The processing module is used for respectively generating resource requests through the running N application programs, and the resource requests are used for requesting to call target resources; the communication module is used for transmitting target resources to the N application programs through the target processes respectively; the processing module is also used for simultaneously calling the target resources transmitted by the communication module through the N application programs; wherein N is an integer greater than 1.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method as provided in the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium on which a program or instructions are stored, which when executed by a processor implement the steps of the method as provided in the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method as provided in the first aspect.
In the embodiment of the application, N running application programs respectively generate resource requests, and the resource requests are used for requesting to call target resources; respectively transmitting target resources to the N application programs through the target process; n application programs call target resources simultaneously; wherein N is an integer greater than 1. According to the scheme, under the condition that a plurality of application programs request the same resource, the target resource requested by the plurality of application programs can be obtained through the target process, and the target resource is transmitted to each application program in the plurality of application programs through the target process, namely the target process is the only process for accessing the target resource, so that the plurality of application programs can call the target resource at the same time even if the plurality of application programs request the same resource, the problem of resource conflict is avoided, and the normal operation of the plurality of application programs is ensured.
Drawings
Fig. 1 is a schematic diagram of a resource acquisition method according to an embodiment of the present invention;
fig. 2 is a second schematic diagram of a resource acquisition method according to an embodiment of the present invention;
fig. 3 is a third schematic diagram of a resource obtaining method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an interface for displaying a target identifier according to an embodiment of the present invention;
FIG. 5 is a fourth schematic diagram illustrating a resource obtaining method according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating comparison before and after ending a target process according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a resource acquisition apparatus according to an embodiment of the present invention;
fig. 8 is a second schematic structural diagram of a resource acquisition apparatus according to an embodiment of the present invention;
FIG. 9 is a hardware diagram of an electronic device provided by an embodiment of the present application;
fig. 10 is a second hardware schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application are capable of operation in sequences other than those illustrated or described herein. The objects distinguished by "first" and "second" are usually one type, and the number of the objects is not limited, for example, the first input may be one or more. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the description of the embodiments of the present application, unless otherwise specified, "a plurality" means two or more, for example, a plurality of applications means two or more applications and the like.
Generally, to prevent resource conflicts, an electronic device prohibits two applications and more than two applications from editing or accessing the same resource at the same time. However, when a user triggers the electronic device to run multiple applications, if the multiple applications need to access the same resource, one of the multiple applications may not run normally due to resource conflict. In order to avoid the problem that the application program cannot normally run due to resource conflict, embodiments of the present invention provide a resource obtaining method, which can be specifically applied to the following scenarios:
scene one, when a user triggers the electronic device to run an application program a and an application program B, if the application program a and the application program B both need to use a camera of the electronic device to acquire data, for example, the application program a needs to perform a video call with other electronic devices through the camera, and the application program B needs to take a picture or scan a two-dimensional code through the camera, then the electronic device can acquire the data acquired by the camera through a target process, and then transmit the data acquired by the camera to the application program a and the application program B through the target process, so that the application program a can perform a video call with other electronic devices through the camera, and the application program B can take a picture or scan the two-dimensional code through the camera.
And in a second scenario, when the user triggers the electronic device to run the application program a and the application program B, if the application program a and the application program B both need to operate the same file, for example, the application program a needs to add or delete the content of one file, and the application program B needs to share the file with other electronic devices, the electronic device may copy the file through the target process to obtain two copies, and then transmit the two copies to the application program a and the application program B, so that the application program a and the application program B may obtain one copy of the file respectively.
In the embodiment of the invention, N running application programs respectively generate resource requests which are used for requesting to call target resources; respectively transmitting target resources to the N application programs through the target process; n application programs call target resources simultaneously; wherein N is an integer greater than 1. According to the scheme, under the condition that a plurality of application programs request the same resource, the target resource requested by the plurality of application programs can be obtained through the target process, and the target resource is transmitted to each application program in the plurality of application programs through the target process, namely the target process is the only process for accessing the target resource, so that the plurality of application programs can call the target resource at the same time even if the plurality of application programs request the same resource, the problem of resource conflict is avoided, and the normal operation of the plurality of application programs is ensured.
The resource acquisition method, the resource acquisition device, and the electronic device provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present application provides a resource acquisition method, where an execution subject of the method may be a resource acquisition device, and the method may include S101 to S103 described below.
S101, the resource acquisition device generates resource requests through the running N application programs respectively.
The resource request is used for requesting to call a target resource, and N is an integer greater than 1.
Optionally, the target resource may be any one of: target file, target sensor.
Optionally, the resource acquiring device may run N applications simultaneously. The N applications may be applications that are started by the resource acquisition device triggered by the user, or applications that are started in response to the start of the operating system of the resource acquisition device. The method can be determined according to actual use requirements, and the embodiment of the invention is not limited.
Optionally, in the process of running the N applications, the interfaces of the N applications may be displayed in any one of the following implementation manners:
one implementation is that the interfaces of the N applications are all displayed on the screen of the resource acquisition device, that is, the N applications are all the applications running in the foreground of the resource acquisition device. For example, the interfaces of N applications may be displayed on the screen of the resource acquisition device in a split-screen manner, that is, the screen is divided into N display areas, and one display area correspondingly displays an interface of one application. It can be understood that the interfaces of the N applications may also be displayed on the screen of the resource acquisition device in an overlapping manner.
Another implementation manner is that the interface of a part of the N applications is displayed on the screen of the resource acquisition device, and another part of the applications runs in the background, that is, a part of the N applications runs in the foreground, and another part of the N applications runs in the background.
Optionally, when N is an integer greater than or equal to 2, the time for transmitting the resource request to the resource obtaining device by the N applications may be the same or different. For example, taking N applications including application a and application B as an example, application a may transmit a resource request to the resource acquisition device before application B transmits a resource request; or transmitting the resource request to the resource acquisition device after the application program B transmits the resource request; the resource request may also be transmitted to the resource acquisition device at the same time as the application B transmits the resource request.
Optionally, the resource request may be used to request a target file, such as a picture and a document, in the resource acquiring device, or may be used to request a target sensor, such as a camera and a microphone, in the resource acquiring device. The embodiment of the invention does not limit the type of the resource request transmitted by the N application programs and the type of the resource requested to be acquired, and can be determined according to the actual use requirement.
It should be noted that the resource requests transmitted by the N applications are used for requesting the same resource. For example, in the case where the resource request transmitted by the application a is used to request acquisition of a target picture, the resource request transmitted by the application B is also used to request acquisition of the target picture.
S102, the resource acquisition device transmits target resources to the N application programs through the target processes respectively.
In the embodiment of the present invention, N applications in the resource acquisition device may transmit the resource request to the processor of the resource acquisition device. After the processor of the resource obtaining device obtains the resource request, the processor of the resource obtaining device may determine a target resource according to the resource request, and obtain the target resource through a target process. Then, the resource acquiring device may transmit the target resource to the N application programs through the target processes, respectively.
In this embodiment of the present invention, if N is 1 (that is, one application requests to acquire a target resource), the resource acquisition apparatus may acquire the target resource through a target process, and transmit the target resource to the one application through the target process, that is, execute the above S102; alternatively, the one application program may directly acquire the target resource, that is, the target resource is acquired by using the resource acquiring method in the prior art. If N is an integer greater than 1 (i.e., the plurality of applications request to acquire the target resource), the resource acquisition device may acquire the target resource through the target process, and transmit the target resource to each of the plurality of applications through the target process.
Optionally, the target process may implement communication with the N applications in an inter-process communication (ipc) manner, such as a pipe (pipe), a named pipe (named pipe), a message (message) queue, a shared memory, a memory map (mapped memory), a semaphore (semaphore), and a socket (socket).
For example, the target process realizes communication with N applications in a memory mapping manner. After the target process acquires the target resource, the target process may store the target resource in the first file. Then, the N application programs may establish a connection channel with the first file through a file channel (filechannel), and perform read-write operation on the first file through the file channel. In order to prevent the N applications from generating a conflict when accessing the first file, each of the N applications may map the first file into the memory space, so that the applications may access the target resource in the first file in the memory space.
Specifically, the communication between the target process and the N application programs implemented in a memory mapping manner may include at least two scenarios:
scene 1:
the N applications read only (read only) access the target resource acquired by the target process, that is, the N applications only need to acquire data in the target resource and do not need to modify the data. When the application program performs memory mapping, the mapping mode may be set to a read-only mode, and a read-only buffer is generated in the memory space, so that the application program may access the content in the buffer in a read-only manner.
Scene 2:
the application program needs to modify the acquired target resource. When the application program performs memory mapping, the mapping mode may be set to a read-write (read-write) mode, and a readable and writable buffer may be generated in the memory space. After the application modifies the target resource in the buffer, the operating system writes the modified resource back to the first file at a certain time, and the write-back operation is a thread-safe operation. Then, the target process can detect whether the first file is modified, and if the target process detects that the first file is modified, the modified content can be reflected to the target resource; if the target process does not detect that the first file is changed, no operation is required to be executed.
Optionally, the process of the target process detecting whether the first file is modified may be initiated by the target process actively, or may be initiated by an application program triggered by the application program after the first file is modified by the application program. The method can be determined according to actual use requirements, and the embodiment of the invention is not limited.
Optionally, when the target resource includes the target sensor and the N application programs include the first application program and the second application program, the resource acquisition device may transmit the first data acquired by the target sensor to the first application program through the target process, and transmit the second data acquired by the target sensor to the second application program through the target process.
For example, a first application is an application a, a second application is an application B, the first data is a data stream including a plurality of frame images, and the second data is a frame image in the data stream. If the user triggers the resource acquisition device to run the video call function of the application program a, the application program a needs to transmit a first data request to the resource acquisition device, where the first data request may be used to request to access a data stream acquired by a camera. After the resource acquisition device acquires the first data request, the data stream acquired by the camera can be acquired through the target process, the data stream is determined as first data, and the data stream is transmitted to the application program A, so that the resource acquisition device can be ensured to keep normal video conversation with other resource acquisition devices through the application program A. In the process that the application program A keeps a normal video call with other resource acquisition devices, if a user triggers the resource acquisition device to operate the code scanning payment function of the application program B, the application program B generates a second data request, and the second data request is used for requesting to access a two-dimensional code picture acquired by a camera, namely one frame of image in a data stream acquired by the camera. After the resource acquisition device acquires the second data request, the data stream acquired by the camera can be acquired through the target process, a frame of two-dimensional code picture meeting the scanning requirement is determined from the data stream, then the resource acquisition device can determine the two-dimensional code picture meeting the scanning requirement as second data, and the two-dimensional code picture is transmitted to the application program B, so that the resource acquisition device can realize the code scanning payment function under the condition that the application program A and other resource acquisition devices keep normal video conversation.
It should be noted that the first application and the second application refer to running applications with different functions, that is, the first application and the second application may be subroutines for implementing different functions in different applications, or may be subroutines for implementing different functions in one application.
Optionally, the N application programs may include a third application program and a fourth application program. After the resource obtaining apparatus transmits the target resource to the third application program and the fourth application program through the target process, the third application program may perform the first operation on the target resource, and the fourth application program may perform the second operation on the target resource.
Alternatively, the first operation and the second operation may be the same type of operation, or may be different types of operations. For example, where the target resource is a file, the first operation and the second operation may be at least one of: editing operations, deleting operations, sharing operations, copying operations, moving operations, and the like.
For example, the third application is an application a, the fourth application is an application B, the first operation is an editing operation on the target resource, and the second operation is a sharing operation on the target resource. If the user triggers the resource acquisition device to run application a and wants to edit the target document through application a, such as adding, deleting, and changing the content in the target document, application a may generate a resource request requesting access to the target document. After the resource obtaining device obtains the resource request, a target document may be obtained through the target process, and the target document is copied to obtain the copy 1, and then the resource obtaining device may transmit the copy 1 to the application program a, so that the application program a may perform an editing operation on the copy 1. In the process that the resource obtaining device edits the copy 1 through the application program a, if the user triggers the resource obtaining device to run the application program B and wants to share the target document with other resource obtaining devices through the application program B, the application program B may generate a resource request for requesting access to the target document. After the resource acquisition device acquires the resource request, the target document can be acquired through the target process, the target document is copied to obtain the copy 2, and then the resource acquisition device can transmit the copy 2 to the application program B, so that the application program B can share the target document with other resource acquisition devices. After the resource acquisition apparatus finishes editing the copy 1 through the application program a, the resource acquisition apparatus may replace the target document with the copy 1.
S103, the resource acquisition device calls the target resource through the N application programs at the same time.
After the resource acquisition device transmits the target resources to the N application programs through the target processes, the N application programs can simultaneously call the target resources and execute corresponding operations using the target resources. For example, if the target resource is a camera and the N applications are subroutines of application a for implementing different functions, application a may implement a code scanning payment function while maintaining a normal video call.
In the embodiment of the application, when multiple applications request the same resource, the target resource requested by the multiple applications can be acquired through the target process, and the target resource is transmitted to each application in the multiple applications through the target process, that is, the target process is the only process for accessing the target resource, so that even if the multiple applications request the same resource, the multiple applications can call the target resource at the same time, thereby avoiding the problem of resource conflict and ensuring the normal operation of the multiple applications.
Optionally, in order to achieve the purpose that the resource acquiring apparatus transmits the target resource through the target process, the resource acquiring apparatus may first create a target process. Specifically, the resource acquiring apparatus may create the target process when N applications are running and the N applications have not generated resource requests, or may create the target process when N applications are running and resource requests are generated.
Exemplarily, with reference to fig. 1, as shown in fig. 2, before the above S102, the resource obtaining method provided in the embodiment of the present invention may further include the following S104.
S104, under the condition that the resource acquisition device runs N application programs and the N application programs do not generate resource requests, establishing a target process; alternatively, the target process is created after the N applications being run generate resource requests, respectively.
Optionally, the resource obtaining apparatus may create the target process when a preset condition is met, or create the target process when the user target input is obtained.
Optionally, the preset condition may be that the resource obtaining device is running N application programs, and the N application programs have not generated resource requests, or that the resource obtaining device generates resource requests through the running N application programs, or that the resource obtaining device obtains a resource request for a target resource generated by another application program when the target resource is occupied by one application program. Specifically, the method for creating the target process by the resource acquisition device under the condition that the preset condition is met may include the following three ways:
in a first mode
Before the above S101, the resource acquisition device may execute the above S104. That is, the resource acquisition device may create the target process while N applications are running and the N applications have not yet generated resource requests.
In the case where the resource acquisition apparatus runs M applications, there may be a case where N applications request access to the same resource among the M applications, where M is an integer greater than 1 and M is greater than or equal to N. Therefore, the resource acquisition means can create the target process while running M applications, that is, while running N applications. When the N application programs need to access the same resource, the N application programs may transmit a resource request to the target process, and accordingly, the target process may obtain the resource request transmitted by the N application programs. The target process may then obtain the target resource based on the resource request and transmit the target resource to the N applications.
Mode two
After S101 and before S102, the resource acquisition device may execute S104. That is, the resource acquisition means may create the target process after the N application programs being run generate resource requests, respectively.
When N running applications need to access the same resource, where N is an integer greater than 1, the N applications may generate resource requests. After the resource acquisition device acquires the resource requests generated by the N application programs, a target process can be created. Then, the resource acquiring device may call the target process to acquire the target resource, and transmit the target resource to the N applications through the target process.
Mode III
If the resource acquiring device acquires a resource request for a target resource generated by another application program under the condition that the target resource is occupied by one application program, the resource acquiring device can suspend the application program occupying the target resource and create the target resource, and then the resource acquiring device can acquire the target resource through a target process and transmit the target resource to the suspended application program and the application program generating the resource request through the target process, so that the suspended application program can end the suspended state.
Optionally, the target input may be touch input, voice input, gesture input, or the like. For example, the touch input may be a click input or a long-press input of a target control displayed by the resource acquisition device by a user, and the target control may be used to trigger the resource acquisition device to create a target process.
For example, the target input is taken as a click input of the user on a target control displayed by the resource acquisition device. When a user wants to trigger two application programs to request the same resource, the user can click and input the target control, and the resource acquisition device can respond to the click and input to create a target process.
In the embodiment of the invention, because the same resource cannot be accessed by a plurality of application programs at the same time, the resource acquisition device can create the target process after acquiring the resource request generated by any application program in the plurality of application programs; the target process may also be created in a case where the resource acquisition apparatus is running N applications. Therefore, the resource acquisition device can acquire the target resource through the target process and respectively transmit the acquired target resource to the plurality of application programs.
Optionally, after the target process is created, the user does not know that multiple applications can be triggered to request the same resource at the same time, and therefore, the resource obtaining apparatus may display a target identifier after the target process is created, where the target identifier may be used to indicate that the target process is running.
Exemplarily, referring to fig. 2, as shown in fig. 3, in the resource acquiring method according to the embodiment of the present invention, after S104, the resource acquiring method according to the embodiment of the present invention may further include S105 described below.
And S105, displaying the target identification by the resource acquisition device.
The target identifier may be used to indicate that the target process is running.
Optionally, the resource obtaining apparatus may display the target identifier in any area of the screen. For example, the resource acquisition device may display the target identifier in a center region of the screen, a region near a side edge in the screen, or a corner region in the screen, or the like.
Optionally, the display position of the target identifier may be changed according to a user input. For example, the initial display position of the target identifier is the upper left corner area of the screen, and after the user performs drag input on the target identifier, the resource acquisition device may cancel displaying the target identifier in the upper left corner area of the screen and display the target identifier in the lower right corner area of the screen in response to the drag input.
It should be noted that, in the embodiment of the present invention, the display characteristics, such as the shape, size, color, and transparency, of the target mark are not limited.
For example, the target id may be a circle id labeled "share management". Assume that the application a run by the resource acquisition device is in a video call state and the application B run by the resource acquisition device is in a code scanning payment state. As shown in fig. 4 (a), in the case where the application a and the application B are in the split-screen display mode, the resource acquisition means may display the circle indicator on the boundary line of the two interfaces. As shown in fig. 4 (B), in the case where the application a and the application B are in the superimposition display mode, the resource acquisition means may display the circle indicator on the interface having a large area.
In the embodiment of the present invention, after the resource acquisition device creates the target process, the resource acquisition device may display the target identifier for indicating that the target process is running, so that the user may determine that the target process is running according to the target identifier. Thus, on one hand, a user can trigger a plurality of application programs of the resource acquisition device to request the same resource under the condition that the target process is established; on the other hand, the user can know the running condition of the target process in time.
Optionally, since the user may not want to have multiple applications access the same resource at the same time, after the resource obtaining apparatus displays the target identifier, the user may perform a first input on the target identifier, so that the resource obtaining apparatus ends the target process in response to the first input. After the resource acquiring device finishes the target process, if the user triggers the resource acquiring device to run a plurality of applications and there are at least two applications in the plurality of applications requesting to access the same resource, the resource acquiring device may transmit the target resource to the application with the highest priority in the at least two applications.
Exemplarily, referring to fig. 3, as shown in fig. 5, in the resource acquisition method provided in the embodiment of the present invention, after S103 described above, the resource acquisition method provided in the embodiment of the present invention may further include S106 to S108 described below.
S106, the resource acquisition device receives a first input of the target identification from the user.
Optionally, the first input may be a touch input of the target identifier by the user. For example, the first input may be a click input or a long press input of the user on the target identification, or the like.
S107, the resource acquisition device responds to the first input and ends the target process.
Alternatively, the resource acquisition means may end the target process and cancel displaying the target identifier in response to the first input.
And S108, if the at least two running application programs respectively generate resource requests, the resource acquisition device calls the target resource through the target application program.
The target application program is an application program with the highest priority level in the at least two application programs.
Optionally, the resource obtaining apparatus may determine, as the application with the highest priority, the application that transmits the resource request first among the at least two applications, may also determine, as the application with the highest priority, the application with the highest frequency of use among the at least two applications, and may also determine, as the application with the highest priority, the application that is in a foreground running state among the at least two applications. The method can be determined according to actual use requirements, and the embodiment of the invention is not limited.
Optionally, after the resource obtaining device transmits the target resource to the target application program, a resource lock may be added to the target resource, and when the target resource is in a locked state, other application programs cannot access the target resource. After the target application program finishes processing the target resource, the resource acquisition device can release the resource lock of the target resource, i.e. the locked state of the target resource is adjusted to be the unlocked state, so that other application programs can access the target resource.
Illustratively, the target resource is taken as the file M. As shown in fig. 6 (a), in the process of executing the target process by the resource acquiring apparatus, if the application a and the application B generate resource requests for acquiring the file M, respectively, the target process may transmit the called file M to the application a and the application B, respectively, and then the application a may edit the file M and the application B may share the file M. As shown in (B) of fig. 6, after the resource acquiring apparatus ends the target process in response to the first input, if the application a and the application B generate resource requests for acquiring the file M, respectively, and the priority of the application a is higher than that of the application B, the resource acquiring apparatus may transfer the called file M to the application a, and lock and edit the file M by the application a. In the case where the file M is in the locked state, the application B cannot perform the deletion operation on the file M.
It should be noted that the above-mentioned embodiment shown in fig. 5 is described by taking as an example that the resource acquisition device executes S106 to S108 after executing the above-mentioned S101 to S103, and it is understood that after S105, in the case that the resource acquisition device does not execute the above-mentioned S102 and S103, the resource acquisition device may also execute S106 to S108.
In the embodiment of the present invention, since the resource acquiring device may end the target process in response to the first input, and transmit the called target resource to the application program with the highest priority level among the at least two application programs when at least two application programs exist in the plurality of application programs to generate the resource request for the same resource, the user may control whether the resource acquiring device operates the target process according to the actual use requirement, thereby increasing the flexibility of the resource acquiring device in operating the target process.
It should be noted that, in the resource obtaining method provided in the embodiment of the present application, the execution main body may be a resource obtaining device, or a control module in the resource obtaining device, configured to execute the resource obtaining method. The resource acquisition device provided in the embodiment of the present application is described with an example in which the resource acquisition device executes the resource acquisition method.
As shown in fig. 7, an embodiment of the present application provides a resource obtaining apparatus 700, where the resource obtaining apparatus 700 may be an electronic device or a functional module in the electronic device. The resource acquisition apparatus 700 may include a processing module 701 and a communication module 702. The processing module 701 may be configured to generate resource requests through the N running applications, where the resource requests are used to request to call a target resource. The communication module 702 may be configured to transmit the target resource to the N applications via the target process, respectively. The processing module 701 may also be configured to call, by the N application programs, the target resource transmitted by the communication module 702 at the same time; wherein N is an integer greater than 1.
Optionally, in this embodiment of the present application, the processing module 701 may be further configured to create a target process when N application programs are running and the N application programs have not generated resource requests; alternatively, the target process is created after the N applications being run generate resource requests, respectively.
Optionally, with reference to fig. 7, as shown in fig. 8, the resource obtaining apparatus 700 provided in the embodiment of the present application may further include a display module 703. The display module 703 may be configured to display a target identifier after the processing module 701 creates the target process, where the target identifier is used to indicate that the target process is running.
Optionally, with reference to fig. 7, as shown in fig. 8, the resource obtaining apparatus 700 provided in the embodiment of the present application may further include a receiving module 704. The receiving module 704 may be configured to receive a first input of the target identifier from the user after the display module 703 displays the target identifier. The processing module 701 may be further configured to end the target process in response to the first input received by the receiving module 704. The communication module 702 may further be configured to, if the at least two running applications generate resource requests respectively, invoke the target resource by the target application, where the target application is an application with the highest priority level in the at least two applications.
Optionally, in this embodiment of the application, the target resource may be any one of the following: target file, target sensor.
Optionally, in this embodiment of the application, the target resource includes a target sensor; the N applications include a first application and a second application. The processing module 701 may be specifically configured to transmit first data acquired by the target sensor to the first application program through the target process, and transmit second data acquired by the target sensor to the second application program through the target process.
In the embodiment of the application, in the case that multiple applications request the same resource, since the resource obtaining device can obtain the target resource requested by the multiple applications through the target process and respectively transmit the target resource to each application in the multiple applications through the target process, that is, the target process is the only process for accessing the target resource, even if the multiple applications request the same resource, the multiple applications can call the target resource at the same time, thereby avoiding the problem of resource conflict and ensuring the normal operation of the multiple applications.
The resource acquisition device in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiment of the present application is not particularly limited.
The resource acquisition device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The resource obtaining apparatus provided in this embodiment of the present application may be the electronic device in the foregoing method embodiment, or may be a function template of the electronic device, which is capable of implementing each process implemented in the method embodiments of fig. 1 to fig. 6, and is not described here again to avoid repetition.
Optionally, an electronic device 900 is further provided in this embodiment of the present application, and includes a processor 901 as shown in fig. 9, a memory 902, and a program or an instruction stored in the memory 902 and executable on the processor 901, where the program or the instruction is executed by the processor 901 to implement each process of the foregoing resource obtaining method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
Fig. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010. Among them, the input unit 1004 may include a graphic processor 10041 and a microphone 10042, the display unit 1006 may include a display panel 10061, the user input unit 1007 may include a touch panel 10071 and other input devices 10072, and the memory 1009 may include an application 10091 and an operating system 10092.
Those skilled in the art will appreciate that the electronic device 1000 may further comprise a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 1010 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 10 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is not repeated here.
The processor 1010 may be configured to generate resource requests through the N running applications, respectively, where the resource requests are used to request to call a target resource; respectively transmitting target resources to the N application programs through the target process; simultaneously calling the target resource through the N application programs; wherein N is an integer greater than 1.
In the embodiment of the present invention, when multiple application programs request the same resource, the electronic device may obtain the target resource requested by the multiple application programs through the target process, and transmit the target resource to each of the multiple application programs through the target process, that is, the target process is the only process for accessing the target resource, so that even if the multiple application programs request the same resource, the multiple application programs can call the target resource at the same time, thereby avoiding the problem of resource conflict and ensuring the normal operation of the multiple application programs.
Optionally, the processor 1010 may be further configured to create a target process when N application programs are running and the N application programs have not generated resource requests; alternatively, the target process is created after the N applications being run generate resource requests, respectively.
In the embodiment of the invention, because the same resource cannot be accessed by a plurality of application programs at the same time, the electronic equipment can create the target process after acquiring the resource request generated by any application program in the plurality of application programs; the target process may also be created in the case where the electronic device is running N applications. Therefore, the electronic equipment can acquire the target resource through the target process and respectively transmit the acquired target resource to the plurality of application programs.
Optionally, the display unit 1006 may be configured to display a target identifier after the processor 1010 creates the target process, where the target identifier is used to indicate that the target process is running.
In the embodiment of the present invention, after the electronic device creates the target process, the target identifier indicating that the target process is running may be displayed, so that the user may determine that the target process is running according to the target identifier. Thus, on one hand, a user can trigger multiple application programs of the electronic equipment to request the same resource under the condition that the target process is created; on the other hand, the user can know the running condition of the target process in time.
Alternatively, the user input unit 1007 may be configured to receive a first input of the target identifier from the user after the display unit 1006 displays the target identifier.
The processor 1010 may be configured to end the target process in response to the first input received by the user input unit 1007. If the at least two running application programs respectively generate resource requests, the target application program calls the target resource, and the target application program is the application program with the highest priority level in the at least two application programs.
In the embodiment of the present invention, since the resource acquiring device may end the target process in response to the first input, and transmit the called target resource to the application program with the highest priority level among the at least two application programs when at least two application programs exist in the plurality of application programs to generate the resource request for the same resource, the user may control whether the resource acquiring device operates the target process according to the actual use requirement, thereby increasing the flexibility of the resource acquiring device in operating the target process.
It should be understood that in the embodiment of the present application, the input Unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042, and the graphics processor 1041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts, a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 1009 may be used for storing software programs as well as various data, including but not limited to applications 10091 and operating system 10092. Processor 1010 may integrate an application processor that handles primarily operating systems, user interfaces, applications, etc. and a modem processor that handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 1010.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the process of the embodiment of the resource obtaining method is implemented, and the same technical effect can be achieved, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device in the above embodiment. Readable storage media, including computer-readable storage media, such as a computer-read-only memory (ROM), a random-access memory (RAM), a magnetic or optical disk, and so forth.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the embodiment of the resource obtaining method, and the same technical effect can be achieved.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes several instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the methods provided in the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (14)

1. A method for resource acquisition, the method comprising:
respectively generating resource requests by the running N application programs, wherein the resource requests are used for requesting to call target resources;
transmitting the target resources to the N application programs through a target process respectively;
the N application programs call the target resource simultaneously;
wherein N is an integer greater than 1.
2. The method of claim 1, further comprising:
creating the target process if the N applications are running and the N applications have not generated resource requests; alternatively, the first and second electrodes may be,
creating the target process after the running N application programs respectively generate resource requests.
3. The method of claim 2, wherein after the creating the target process, the method further comprises:
and displaying a target identification, wherein the target identification is used for indicating that the target process is running.
4. The method of claim 3, wherein after displaying the target identification, the method further comprises:
receiving a first input of the target identification by a user;
in response to the first input, ending the target process;
if the running at least two application programs respectively generate the resource requests, a target application program calls the target resource, and the target application program is an application program with the highest priority level in the at least two application programs.
5. The method according to any one of claims 1 to 4, wherein the target resource is any one of: target file, target sensor.
6. The method of claim 5, wherein the target resource comprises the target sensor;
the N application programs comprise a first application program and a second application program;
the transmitting the target resources to the N application programs by the target process, respectively, includes:
and transmitting first data acquired by the target sensor to the first application program through the target process, and transmitting second data acquired by the target sensor to the second application program through the target process.
7. A resource acquisition device is characterized by comprising a processing module and a communication module;
the processing module is used for respectively generating resource requests through the running N application programs, and the resource requests are used for requesting to call target resources;
the communication module is used for transmitting the target resources to the N application programs through target processes respectively;
the processing module is further configured to call the target resource transmitted by the communication module through the N application programs simultaneously;
wherein N is an integer greater than 1.
8. The resource acquisition apparatus according to claim 7,
the processing module is further configured to create the target process when the N application programs are running and no resource request is generated by the N application programs; or creating the target process after the running N application programs respectively generate resource requests.
9. The resource acquisition device according to claim 8, wherein the resource acquisition device further comprises a display module;
the display module is configured to display a target identifier after the target process is created, where the target identifier is used to indicate that the target process is running.
10. The resource acquisition device according to claim 9, wherein the resource acquisition device further comprises a receiving module;
the receiving module is used for receiving a first input of a user to the target identifier after the display module displays the target identifier;
the processing module is further configured to end the target process in response to the first input received by the receiving module;
the communication module is further configured to, if the running at least two application programs respectively generate the resource requests, invoke the target resource by a target application program, where the target application program is an application program with a highest priority level among the at least two application programs.
11. The apparatus according to any one of claims 7 to 10, wherein the target resource is any one of: target file, target sensor.
12. The resource acquisition apparatus according to claim 11, wherein the target resource includes the target sensor; the N application programs comprise a first application program and a second application program;
the processing module is specifically configured to transmit first data acquired by the target sensor to the first application program through the target process, and transmit second data acquired by the target sensor to the second application program through the target process.
13. An electronic device comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the resource acquisition method of any one of claims 1-6.
14. A readable storage medium, on which a program or instructions are stored, which when executed by a processor, implement the steps of the resource acquisition method according to any one of claims 1 to 6.
CN202010470948.9A 2020-05-28 2020-05-28 Resource acquisition method and device and electronic equipment Pending CN111638966A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010470948.9A CN111638966A (en) 2020-05-28 2020-05-28 Resource acquisition method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010470948.9A CN111638966A (en) 2020-05-28 2020-05-28 Resource acquisition method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN111638966A true CN111638966A (en) 2020-09-08

Family

ID=72331327

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010470948.9A Pending CN111638966A (en) 2020-05-28 2020-05-28 Resource acquisition method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111638966A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256536A (en) * 2020-10-29 2021-01-22 维沃移动通信(深圳)有限公司 Information display method and device
CN112379877A (en) * 2020-11-13 2021-02-19 武汉蓝星科技股份有限公司 Programming system of embedded end multi-process GUI program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006241A (en) * 2010-12-17 2011-04-06 天津曙光计算机产业有限公司 Method for receiving message through buffer area shared by multiple applications
CN104918112A (en) * 2014-03-13 2015-09-16 深圳Tcl新技术有限公司 Camera resource application method and device
CN106897146A (en) * 2017-02-09 2017-06-27 青岛海信移动通信技术股份有限公司 The data processing method and the terminal with microphone of a kind of microphone of terminal
CN110825708A (en) * 2019-09-23 2020-02-21 武汉智美互联科技有限公司 Multi-process file reading and writing method
CN111105521A (en) * 2019-11-21 2020-05-05 视联动力信息技术股份有限公司 Data reading method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006241A (en) * 2010-12-17 2011-04-06 天津曙光计算机产业有限公司 Method for receiving message through buffer area shared by multiple applications
CN104918112A (en) * 2014-03-13 2015-09-16 深圳Tcl新技术有限公司 Camera resource application method and device
CN106897146A (en) * 2017-02-09 2017-06-27 青岛海信移动通信技术股份有限公司 The data processing method and the terminal with microphone of a kind of microphone of terminal
CN110825708A (en) * 2019-09-23 2020-02-21 武汉智美互联科技有限公司 Multi-process file reading and writing method
CN111105521A (en) * 2019-11-21 2020-05-05 视联动力信息技术股份有限公司 Data reading method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256536A (en) * 2020-10-29 2021-01-22 维沃移动通信(深圳)有限公司 Information display method and device
CN112379877A (en) * 2020-11-13 2021-02-19 武汉蓝星科技股份有限公司 Programming system of embedded end multi-process GUI program

Similar Documents

Publication Publication Date Title
US20220342850A1 (en) Data transmission method and related device
WO2014109502A1 (en) Touch event processing method and portable device implementing the same
US11853526B2 (en) Window display method, window switching method, electronic device, and system
KR101343587B1 (en) Data transfering method using direction information and mobile device using the method
CN111190748B (en) Data sharing method, device, equipment and storage medium
WO2021098695A1 (en) Information sharing method and electronic device
US20240111473A1 (en) Distributed display method and terminal for application interface
CN112749362B (en) Control creation method, device, equipment and storage medium
CN111638966A (en) Resource acquisition method and device and electronic equipment
JP6982277B2 (en) Information terminal equipment, information processing system and display control program
CN114077411A (en) Data transmission method and device
CN113794795B (en) Information sharing method and device, electronic equipment and readable storage medium
EP3835967A1 (en) Card data display method and apparatus, and storage medium
CN111259441B (en) Device control method, device, storage medium and electronic device
CN112449110A (en) Image processing method and device and electronic equipment
CN111817944A (en) Picture sharing method and device and electronic equipment
WO2022242628A1 (en) Screen casting method, apparatus, and device, and storage medium
CN112711636B (en) Data synchronization method, device, equipment and medium
CN112312058B (en) Interaction method and device and electronic equipment
JP2014238667A (en) Information terminal, information processing program, information processing system, and information processing method
CN112448884A (en) Content saving method and device
CN117827709B (en) Method, device, equipment and storage medium for realizing direct memory access
JP2024000370A (en) System and terminal device
CN117899472A (en) Object rendering method, device, medium and equipment
CN114398129A (en) Shared object sharing method and device, electronic equipment and readable storage medium

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