Application snapshot acquisition method and device, electronic equipment and medium
By determining the first size parameter of the target display interface and capturing an application snapshot, the problems of large memory consumption and slow speed in the existing technology are solved, and more efficient application snapshot acquisition is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, capturing application snapshots of applications running in the foreground according to the screen size parameters consumes a large amount of memory and takes a long time, resulting in low acquisition efficiency.
By responding to the application snapshot generation command, the first size parameter corresponding to the target display interface is determined, and an application snapshot is captured based on this parameter, thereby reducing memory usage and speeding up the capture process.
It reduces the memory usage of application snapshots, improves the efficiency of obtaining application snapshots, and shortens the capture time.
Smart Images

Figure CN121722464A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of electronic equipment technology, and in particular to an application snapshot acquisition method, apparatus, electronic device, and medium. Background Technology
[0002] During the use of electronic devices, the process of capturing application snapshots is as follows: The electronic device captures an application snapshot of the application running in the foreground according to the size of the buffer allocated by the system. Here, the buffer refers to the area storing the image data of the captured application snapshot, and the size of the buffer allocated by the system corresponds to the screen size parameters. However, capturing application snapshots of applications running in the foreground according to the screen size parameters consumes a lot of memory and takes more time to capture application snapshots, resulting in low efficiency in obtaining application snapshots. Summary of the Invention
[0003] To overcome the problems existing in related technologies, this disclosure provides an application snapshot acquisition method, apparatus, electronic device, and medium.
[0004] According to a first aspect of the present disclosure, an application snapshot acquisition method is provided, comprising:
[0005] In response to detecting an application snapshot generation instruction, a first size parameter corresponding to the target display interface of the target application is determined; the application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application being the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface;
[0006] Based on the first size parameter, capture an application snapshot corresponding to the target display interface.
[0007] In some embodiments, the method further includes:
[0008] In response to the target application switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, an application snapshot generation instruction is generated.
[0009] In some embodiments, generating the application snapshot generation instruction in response to the target application's running state switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, includes:
[0010] In response to the target application's running state switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, the application identifier of the target application is obtained;
[0011] When the application identifier is a preset application identifier, an application snapshot generation instruction is generated.
[0012] In some embodiments, the method further includes:
[0013] Save the application snapshot.
[0014] In some embodiments, the method further includes:
[0015] In response to a hot start of the target application, the application snapshot is adjusted and the adjusted application snapshot is displayed.
[0016] In some embodiments, adjusting the application snapshot includes:
[0017] Based on the second size parameter, the application snapshot is adjusted to obtain the adjusted application snapshot; the second size parameter is used to characterize the size of the display screen of the electronic device, and the first size parameter is smaller than the second size parameter.
[0018] In some embodiments, the method further includes:
[0019] Identify at least one display layer within the task container corresponding to the target application;
[0020] The topmost display layer among the at least one display layers is determined as the target display interface.
[0021] In some embodiments, determining the first size parameter corresponding to the target display interface of the target application in response to detecting an application snapshot generation instruction includes:
[0022] In response to the application snapshot generation instruction, a target parameter is determined, which is used to characterize whether to capture an application snapshot based on the size parameter of the source image corresponding to the currently displayed interface of the target application.
[0023] When the target parameter represents the size parameter of the source image corresponding to the currently displayed interface of the target application, the first size parameter is obtained.
[0024] In some embodiments, determining the target parameter includes:
[0025] The target parameter is determined by the system service process and then sent to the display process.
[0026] Obtaining the first size parameter includes:
[0027] The first size parameter is obtained through the display process.
[0028] According to a second aspect of the present disclosure, an application snapshot acquisition apparatus is provided, comprising:
[0029] The determination module is configured to determine a first size parameter corresponding to the target display interface of the target application in response to detecting an application snapshot generation instruction; the application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application is the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface;
[0030] The processing module is configured to capture an application snapshot corresponding to the target display interface based on the first size parameter.
[0031] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0032] processor;
[0033] Memory used to store processor-executable instructions;
[0034] The processor is configured to execute the application snapshot acquisition method as described in the first aspect of this disclosure.
[0035] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the application snapshot acquisition method as described in the first aspect of the present disclosure.
[0036] The method described above has the following advantages: This method can capture the application snapshot corresponding to the target display interface based on the size of the source image corresponding to the target display interface, thereby reducing the memory of the application snapshot and saving memory usage. Furthermore, it can speed up the capture speed of the application snapshot and improve the efficiency of obtaining the application snapshot.
[0037] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0039] Figure 1 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment.
[0040] Figure 2 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment.
[0041] Figure 3 This is a schematic diagram illustrating the drawing and display of an application snapshot according to an exemplary embodiment.
[0042] Figure 4 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment.
[0043] Figure 5 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment.
[0044] Figure 6 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment.
[0045] Figure 7 This is a block diagram illustrating an application snapshot acquisition device according to an exemplary embodiment.
[0046] Figure 8 This is a block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0047] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0048] During the use of electronic devices, warm starts utilize application snapshots to quickly access the application's display interface, thus avoiding issues such as black screens and flickering caused by slow interface loading. Application snapshots are taken when the current application exits or the electronic device's screen is turned off. Current native application snapshot acquisition methods include: the electronic device captures an application snapshot of the application running in the foreground, according to the system-allocated buffer size. Here, the buffer refers to the area storing the image data of the captured application snapshot, and the system-allocated buffer size corresponds to the screen size parameters.
[0049] However, for some applications, the required buffer size for application snapshots is much smaller than the system-allocated buffer size. If application snapshots of foreground applications are still captured according to the system-allocated buffer size, i.e., according to the screen size parameters, it will consume more memory and take more time to capture application snapshots, resulting in low efficiency in obtaining application snapshots.
[0050] To address the aforementioned issues, this disclosure provides an application snapshot acquisition method. In response to detecting an application snapshot generation instruction, this disclosure determines a first size parameter corresponding to the target display interface of a target application; and based on the first size parameter, captures an application snapshot corresponding to the target display interface. The application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, where the target application is the currently running application in the foreground, and the first size parameter characterizes the size of the source image corresponding to the target display interface. Thus, this disclosure can capture an application snapshot corresponding to the target display interface based on the size of the source image, thereby reducing the memory footprint of the application snapshot, saving memory usage, and accelerating the snapshot capture process, thus improving the efficiency of obtaining application snapshots.
[0051] The application snapshot acquisition method provided in this disclosure is executed by an electronic device, which may specifically be a mobile phone, tablet computer, laptop, smart robot, smart wearable device, or other smart device. Furthermore, the electronic device also has various hardware resources and energy storage devices that provide power for the operation of these hardware resources.
[0052] Figure 1 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 1 The method includes the following steps:
[0053] Step S101: In response to detecting the application snapshot generation instruction, determine the first size parameter corresponding to the target display interface of the target application; the application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application is the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface.
[0054] The target application can be any application, such as a game application. The target display interface is the display interface of the target application, which displays the content of the target application. For example, when the target application is a game application, the target display interface can be an interface displaying game scenes and game characters.
[0055] A source image refers to a raw, unprocessed image file. Source images provide the original images for image analysis and processing. Source images have the following characteristics: First, they are uncompressed or unprocessed images stored in a lossless format; second, they include raw pixel data directly obtained from camera sensors or scanning devices; third, they contain all the information of the image, such as pixel brightness, color, and image contrast; fourth, they can be represented in different file formats, such as JPEG (Joint Photographic Experts Group), GIF (Graphics Interchange Format), and RAW (unprocessed).
[0056] In some embodiments, an application snapshot refers to a snapshot of the application's current state. Obtaining an application snapshot can capture the application's currently displayed content. By acquiring an application snapshot, various data information about the application can be determined, such as timestamps, application state, and background data.
[0057] In some embodiments, the application snapshot generation instruction can also be an instruction automatically generated by the electronic device. For example, when an application switches from running in the foreground to running in the background, the electronic device will automatically generate an application snapshot generation instruction to obtain the content of the application's current display interface.
[0058] In some embodiments, the size parameter can refer to the resolution size of the image, which can be used to characterize the number of pixels in the horizontal and vertical directions of the image. For example, the size parameter of an image can be 1920 pixels * 1080 pixels.
[0059] It should be noted that different size parameters correspond to different buffer sizes. When capturing application snapshots, you can first obtain the buffer size required for the captured application snapshot, and then determine the first size parameter based on the required buffer size.
[0060] Step S102: Based on the first size parameter, capture the application snapshot corresponding to the target display interface.
[0061] In some embodiments, the content corresponding to the target display page can be cropped according to the size corresponding to the first size parameter to obtain an application snapshot corresponding to the target display interface. Accordingly, the size parameter of the application snapshot corresponding to the target display interface is the same as the first size parameter.
[0062] In some embodiments, the electronic device captures an application snapshot corresponding to the target display interface based on a first size parameter, and writes the image data of the captured application snapshot into the buffer corresponding to the target display interface.
[0063] The following describes the process of capturing a snapshot of the application interface corresponding to the target display screen, with the electronic device as the execution subject:
[0064] The SurfaceFlinger (display engine) process obtains the buffer size of the source image corresponding to the target display interface, and allocates this buffer size to the RenderEngine (rendering engine) component. The RenderEngine component determines a first size parameter based on the received buffer size, and then uses the RenderEngine component and the first size parameter to draw an application snapshot corresponding to the target display interface (during the application snapshot drawing process, the RenderEngine component writes the image data of the application snapshot into the buffer). SurfaceFlinger is the core service in the system responsible for graphics rendering and screen display. It receives graphics buffers from the application, composites at least one image buffer, and then displays it on the screen. The RenderEngine component is the core component in the system for graphics rendering; it is responsible for drawing the application's graphics and interface elements onto the screen.
[0065] In this embodiment of the disclosure, by obtaining the first size parameter of the target display interface and capturing an application snapshot based on the first size parameter, the memory usage of the application snapshot can be reduced, the capture speed of the application snapshot can be accelerated, the time for capturing the application snapshot can be saved, and the efficiency of obtaining the application snapshot can be improved.
[0066] In some embodiments, application snapshots can be applied to the application's hot restart process, as described below. Figure 2 The illustrated embodiment describes the process of warm-starting an application based on an application snapshot.
[0067] Figure 2 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 2 The method includes the following steps:
[0068] Step S201: In response to the target application's running state switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, an application snapshot generation instruction is generated.
[0069] In some embodiments, switching the running state of the target application from the foreground to the background may include continuing to run in the background after the target application has exited, for example, an audio playback application continuing to run in the background after exiting; the display interface of the electronic device may switch from the target application's display interface to the recent tasks thumbnail interface. It should be noted that when the target application is in the foreground running state and the electronic device switches from a screen-on state to a screen-off state, the target application will automatically switch to the background running state.
[0070] In some embodiments, in response to the target application switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, the application identifier of the target application can be obtained, and when the application identifier is a preset application identifier, an application snapshot generation instruction is generated. At this time, the application snapshot generation instruction is used to instruct the electronic device to capture an application snapshot according to the application snapshot acquisition method shown in steps S101-S102. The preset application identifier may include the application identifier of an application whose source image size is smaller than the screen size; for example, the preset application identifier may be a preset game application identifier, a preset audio application identifier, etc. In one example, the application data of the target application can be obtained, and the application's package name can be obtained from the application data to obtain the application identifier of the target application.
[0071] It should be noted that, in response to the target application switching from a foreground to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, when the application identifier is not a preset application identifier, the electronic device will also generate an application snapshot generation instruction. It should be noted that this application snapshot generation instruction differs from the application snapshot generation instruction shown in the previous embodiment. In this case, the application snapshot generation instruction instructs the electronic device to capture an application snapshot according to the native application snapshot acquisition method. The native application snapshot acquisition method instructs the capture of an application snapshot corresponding to the display interface based on the display screen's size parameters.
[0072] Step S202: In response to detecting the application snapshot generation instruction, determine the first size parameter corresponding to the target display interface of the target application.
[0073] The specific content of step S202 can be referred to step S101 in the above embodiment, and will not be repeated here.
[0074] Step S203: Based on the first size parameter, capture the application snapshot corresponding to the target display interface.
[0075] The specific content of step S203 can be referred to step S102 in the above embodiment, and will not be repeated here.
[0076] Step S204: Save the application snapshot.
[0077] In some embodiments, the acquired application snapshot can be saved to the electronic device's cache. If the application snapshot is needed in subsequent processes, it can be directly accessed from the cache.
[0078] Step S205: In response to a hot start of the target application, adjust the application snapshot and display the adjusted application snapshot.
[0079] A warm start of an application refers to the process of bringing an application that is already running in the background to the foreground. During a warm start, the application process remains in the system's memory; therefore, a warm start does not require recreating the process, but only restoring the application data and rendering the display interface.
[0080] In some embodiments, a cached application snapshot can be retrieved, and the display interface can be drawn based on the application snapshot. In some embodiments, the application snapshot can be adjusted, and the adjusted application snapshot can be displayed. In one example, adjusting the application snapshot may include: adjusting the size and / or display effects of the application snapshot, such as zooming in / out on the application snapshot, or adding UI (User Interface) animations to the original application snapshot.
[0081] In some embodiments, the application snapshot can be adjusted based on a second size parameter to obtain an adjusted application snapshot; the second size parameter is used to characterize the size of the display screen of the electronic device, and the first size parameter is smaller than the second size parameter.
[0082] In other words, the application snapshot can be enlarged based on the second size parameter, and the enlarged application snapshot can be displayed on the display interface of the electronic device. In one example, the application snapshot can be enlarged based on the proportional relationship between the first size parameter and the second size parameter.
[0083] It should be noted that the second size parameter and the first size parameter may not be proportionally related. Therefore, the application snapshot can be adaptively adjusted based on the first and second size parameters. Without affecting the viewing experience, the size parameter of the adjusted application snapshot can have a certain error compared to the second size parameter.
[0084] See one example. Figure 3The diagram shown illustrates the drawing and display of an application snapshot. The application snapshot can be drawn according to the first size parameter a*b of the source image, and the application snapshot can be enlarged according to the second size parameter c*d, and the enlarged application snapshot can be displayed.
[0085] In this embodiment, an application snapshot captured based on a first size parameter can be directly invoked, and the snapshot can be enlarged and displayed on the screen based on a second size parameter. Since the application snapshot captured based on the first size parameter occupies less memory, the system can load the application snapshot faster during a warm boot, thereby reducing user waiting time and avoiding black screen and flickering issues during the waiting process, thus improving the user experience.
[0086] In some embodiments, the target display interface can be determined among multiple interfaces, and then the size parameters of the target display interface can be determined. The following is an example... Figure 4 The illustrated embodiment explains the process of determining the target display interface and the first size parameter.
[0087] Figure 4 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 4 The method includes the following steps:
[0088] Step S401: Determine at least one display layer in the task container corresponding to the target application.
[0089] In some embodiments, the task container corresponding to the target application may refer to the task corresponding to the target application. In one example, the task container corresponding to the target application includes at least one display layer, each display layer corresponding to a UI layer. For example, the UI layer may include a background layer, a content layer, button and control layers, etc. It should be noted that stacking at least one display layer together can generate complex UI effects.
[0090] Step S402: Determine the topmost display layer among at least one display layer as the target display interface.
[0091] In some embodiments, the topmost display layer in at least one display layer refers to the top-level display layer. It should be noted that the top-level display layer can refer to the display layer corresponding to the currently displayed interface on the screen.
[0092] In some embodiments, the topmost display layer among at least one display layer can be determined in the following ways: First, in the interface design, each display layer corresponds to a Z-axis position; the higher the layer's level, the larger the Z-value. Therefore, the Z-value of each display layer can be determined, and the display layer with the highest Z-value is identified as the topmost display layer. Second, each display layer possesses its own attribute information; accordingly, the display order of each display layer can be determined based on its attribute information, thereby identifying the topmost display layer. Third, the display order of at least one display layer can be viewed using a defined tool or command, thereby identifying the topmost display layer.
[0093] Step S403: In response to the application snapshot generation instruction, determine the target parameters. The target parameters are used to characterize whether to capture an application snapshot based on the size parameters of the source image corresponding to the currently displayed interface of the target application.
[0094] The target parameter can be a Boolean value. When the target parameter is true, it means that the application snapshot will be taken based on the size of the source image corresponding to the currently displayed interface of the target application. Conversely, when the target parameter is false, it means that the application snapshot will not be taken based on the size of the source image corresponding to the currently displayed interface of the target application, but will be taken based on the size of the display screen.
[0095] It should be noted that, in response to the application snapshot generation command, the target parameter can be determined to be true. That is, in response to the application snapshot generation command, the target parameter characterization will be based on the size parameters of the source image corresponding to the currently displayed interface of the target application to capture an application snapshot.
[0096] In some embodiments, the target parameter can be determined by a system service process and then sent to the display process. The process of determining and sending the target parameter is described below, with the electronic device as the executing entity:
[0097] In response to the application snapshot generation command, the System_server process sets the target parameter (boolean type) of the needCaptureSourceLayer parameter class in the LayerCaptureArgs parameter class to true, and then sends the LayerCaptureArgs parameter class to the SurfaceFlinger process (display process) via the System_server process. The SystemServer process is a crucial process in the system, responsible for starting and managing most system services. The LayerCaptureArgs parameter class is a parameter class used in the system to capture a specific layer of the image. The needCaptureSourceLayer parameter class indicates whether the source layer needs to be captured when taking a screenshot or capturing a layer. Correspondingly, when the target parameter of the needCaptureSourceLayer parameter class is true, it indicates that the source layer needs to be captured; conversely, when the target parameter of the needCaptureSourceLayer parameter class is false, it indicates that the source layer does not need to be captured.
[0098] Step S404: When the target parameter characterizes the application snapshot based on the size parameter of the source image corresponding to the currently displayed interface of the target application, the first size parameter is obtained.
[0099] In some embodiments, the first size parameter can be obtained through a display process. The process of obtaining the first size parameter is described below with reference to various processes, with the electronic device as the executing entity:
[0100] After receiving the LayerCaptureArgs parameter class through the SurfaceFlinger process, the SurfaceFlinger process determines that the target parameter (boolean type) of the needCaptureSourceLayer parameter class in the LayerCaptureArgs parameter class is true. Then, the SurfaceFlinger process determines at least one display layer in the task container corresponding to the target application, and identifies the topmost display layer among the at least one display layer as the target display interface. After that, the SurfaceFlinger process obtains the buffer size of the source image corresponding to the target display interface, and determines the first size parameter based on the buffer size.
[0101] This disclosure discloses a process for obtaining a first size parameter based on process pairs. Through each process, an accurate first size parameter can be obtained, thereby enabling the capture of an application snapshot.
[0102] In some embodiments, the process of capturing application snapshots and performing application hot restarts involves scheduling interactions between multiple processes. The following describes... Figure 5 The illustrated examples illustrate the process of capturing application snapshots and performing application hot starts.
[0103] Figure 5 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment, performed by an electronic device. Figure 5 The document illustrates that, in response to a target application switching from a foreground to a background running state, or an electronic device switching from a screen-on to a screen-off state, the application identifier of the target application is obtained through the System_server process. When the application identifier matches a preset application identifier, an application snapshot generation instruction is generated. The generation of the application snapshot instruction can be determined by the AbsAppSnapshotController class in the System_server process; the AbsAppSnapshotController class is a management service related to application snapshots.
[0104] In response to the application snapshot generation command, the System_server process determines the target parameters and sends them to the display process. Simultaneously, the ScreenCapture class in the System_server process exposes the application snapshot capture interface and calls the application snapshot acquisition method in the SurfaceFlinger process. Specifically, the System_server process sets the target parameter (boolean type) of the needCaptureSourceLayer parameter class in the LayerCaptureArgs parameter class to true and sends the LayerCaptureArgs parameter class to the SurfaceFlinger process.
[0105] The first size parameter is obtained through the display process. Specifically, the SurfaceFlinger process can be used to traverse and filter the visible display layers in the current task, identify the topmost display layer among all display layers, and determine this display layer as the target display interface. Then, the buffer size and dimension parameters of the target display interface are determined.
[0106] The SurfaceFlinger process allocates the buffer size and dimensions of the target display interface to the RenderEngine component, which then captures an application snapshot. The RenderEngine component, a part of the SurfaceFlinger process, is used to draw the application snapshot corresponding to the target display interface using the RenderEngine component and the first dimensions (during the drawing process, the RenderEngine component writes the image data of the application snapshot into the buffer). The SurfaceFlinger process then sends the application snapshot to the cache.
[0107] In response to a hot start of the target application, a cached application snapshot is retrieved through the System_server process. This cached application snapshot can be accessed via the ActivityRecord parameter class in the System_server process. In the system, each Activity has a corresponding ActivityRecord object, which records information such as the Activity's launch information, state, task, and process.
[0108] The display of application snapshots is handled by the System_server process. Specifically, the TaskOrganizer interface within the System_server process can be used to manage the display of application snapshots, allowing the system to organize and control tasks based on different window modes.
[0109] By adjusting the application snapshot through the SurfaceFlinger process and the second size parameter, the adjusted application snapshot is obtained and displayed on the screen.
[0110] In some embodiments, the following is by Figure 6 The illustrated examples illustrate the process of capturing application snapshots and performing application hot starts.
[0111] Figure 6 This is a flowchart illustrating an application snapshot acquisition method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 6 The method includes the following steps:
[0112] Step S601: Determine at least one display layer in the task container corresponding to the target application.
[0113] Step S602: Determine the topmost display layer among at least one display layer as the target display interface.
[0114] Step S603: In response to the target application's running state switching from foreground running state to background running state, or in response to the electronic device switching from screen-on state to screen-off state, obtain the application identifier of the target application.
[0115] Step S604: When the application identifier is a preset application identifier, generate an application snapshot generation instruction.
[0116] Step S605: In response to the application snapshot generation instruction, determine the target parameters. The target parameters are used to characterize whether to capture an application snapshot based on the size parameters of the source image corresponding to the currently displayed interface of the target application.
[0117] Step S606: When the target parameter characterizes the application snapshot captured based on the size parameter of the source image corresponding to the currently displayed interface of the target application, the first size parameter is obtained; the first size parameter is used to characterize the size of the source image corresponding to the target display interface.
[0118] Step S607: Based on the first size parameter, capture the application snapshot corresponding to the target display interface.
[0119] Step S608: Save the application snapshot.
[0120] Step S609: In response to the target application's hot start, adjust the application snapshot based on the second size parameter to obtain the adjusted application snapshot, and display the adjusted application snapshot.
[0121] In some embodiments, this disclosure can obtain the memory size of the application snapshot determined by the current application snapshot acquisition method, as well as the memory size of the application snapshot determined by the native application snapshot acquisition method. As shown in Table 1, taking an application snapshot with a color depth of 32 bits as an example, the following analysis examines the memory size of the application snapshot corresponding to the display interface of the same application under different application snapshot acquisition methods, and the optimization percentage of the application snapshot acquisition method shown in this disclosure, from the perspectives of a 2K display and a 1080P display.
[0122] Table 1: Memory Usage of Application Snapshots
[0123]
[0124]
[0125] The first application snapshot refers to the application snapshot determined based on the size parameters of the source image, the second application snapshot refers to the application snapshot determined under a 2K display, and the third application snapshot refers to the application snapshot determined under a 1080p display. Based on the content shown in Table 1, it can be determined that the memory occupied by the first application snapshot is significantly reduced compared to the memory occupied by the second and third application snapshots. Therefore, the application snapshot acquisition method shown in this embodiment can more conveniently and quickly capture application snapshots that save more memory.
[0126] Figure 7 This is a block diagram illustrating an application snapshot acquisition device configured in an electronic device, according to an exemplary embodiment. See also... Figure 7 The device includes:
[0127] The determination module 701 is configured to determine a first size parameter corresponding to the target display interface of the target application in response to detecting an application snapshot generation instruction; the application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application is the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface;
[0128] The processing module 702 is configured to capture an application snapshot corresponding to the target display interface based on a first size parameter.
[0129] In some embodiments, the processing module 702 is configured to:
[0130] In response to the target application switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, an application snapshot generation instruction is generated.
[0131] In some embodiments, the processing module 702 is configured to:
[0132] In response to the target application's running state switching from foreground to background, or in response to the electronic device switching from screen on to screen off, obtain the application identifier of the target application;
[0133] When the application is identified as a preset application identifier, an application snapshot generation instruction is generated.
[0134] In some embodiments, the processing module 702 is configured to:
[0135] Save an application snapshot.
[0136] In some embodiments, the processing module 702 is configured to:
[0137] In response to a hot start of the target application, adjust the application snapshot and display the adjusted application snapshot.
[0138] In some embodiments, the processing module 702 is configured to:
[0139] Based on the second size parameter, the application snapshot is adjusted to obtain the adjusted application snapshot; the second size parameter is used to characterize the size of the display screen of the electronic device, and the first size parameter is smaller than the second size parameter.
[0140] In some embodiments, the determining module 701 is configured to:
[0141] Identify at least one display layer within the task container corresponding to the target application;
[0142] The topmost display layer in at least one display layer is identified as the target display interface.
[0143] In some embodiments, the determining module 701 is configured to:
[0144] In response to the application snapshot generation command, the target parameters are determined. The target parameters are used to characterize whether to capture the application snapshot based on the size parameters of the source image corresponding to the currently displayed interface of the target application.
[0145] When the target parameter characterizes the application snapshot based on the size parameters of the source image corresponding to the currently displayed interface of the target application, the first size parameter is obtained.
[0146] In some embodiments, the determining module 701 is configured to:
[0147] The target parameters are determined through the system service process and then sent to the display process.
[0148] Obtain the first dimension parameters, including:
[0149] Obtain the first size parameter by displaying the process.
[0150] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0151] This disclosure also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the application snapshot acquisition method described above.
[0152] Figure 8 This is a block diagram of an electronic device 800 according to an exemplary embodiment.
[0153] Reference Figure 8 The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0154] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0155] Memory 804 is configured to store various types of data to support the operation of electronic device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0156] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0157] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0158] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0159] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0160] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 can detect the on / off state of electronic device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0161] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0162] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0163] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0164] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the application snapshot acquisition method provided by an exemplary embodiment of this disclosure.
[0165] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0166] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for obtaining application snapshots, characterized in that, include: In response to the detection of an application snapshot generation command, the first size parameter corresponding to the target display interface of the target application is determined; The application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application being the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface; Based on the first size parameter, capture an application snapshot corresponding to the target display interface.
2. The application snapshot acquisition method according to claim 1, characterized in that, The method further includes: In response to the target application switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, an application snapshot generation instruction is generated.
3. The application snapshot acquisition method according to claim 1, characterized in that, The step of generating the application snapshot generation instruction in response to the target application's running state switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, includes: In response to the target application's running state switching from a foreground running state to a background running state, or in response to the electronic device switching from a screen-on state to a screen-off state, the application identifier of the target application is obtained; When the application identifier is a preset application identifier, an application snapshot generation instruction is generated.
4. The application snapshot acquisition method according to claim 1, characterized in that, The method further includes: Save the application snapshot.
5. The application snapshot acquisition method according to claim 1 or 4, characterized in that, The method further includes: In response to a hot start of the target application, the application snapshot is adjusted and the adjusted application snapshot is displayed.
6. The application snapshot acquisition method according to claim 5, characterized in that, Adjusting the application snapshot includes: Based on the second size parameter, the application snapshot is adjusted to obtain the adjusted application snapshot; the second size parameter is used to characterize the size of the display screen of the electronic device, and the first size parameter is smaller than the second size parameter.
7. The application snapshot acquisition method according to claim 1, characterized in that, The method further includes: Identify at least one display layer within the task container corresponding to the target application; The topmost display layer among the at least one display layers is determined as the target display interface.
8. The application snapshot acquisition method according to claim 1, characterized in that, The step of determining the first size parameter corresponding to the target display interface of the target application in response to detecting an application snapshot generation instruction includes: In response to the application snapshot generation instruction, a target parameter is determined, which is used to characterize whether to capture an application snapshot based on the size parameter of the source image corresponding to the currently displayed interface of the target application. When the target parameter represents the size parameter of the source image corresponding to the currently displayed interface of the target application, the first size parameter is obtained.
9. The application snapshot acquisition method according to claim 8, characterized in that, The determination of the target parameters includes: The target parameter is determined by the system service process and then sent to the display process. Obtaining the first size parameter includes: The first size parameter is obtained through the display process.
10. An application snapshot acquisition device, characterized in that, include: The determination module is configured to determine a first size parameter corresponding to the target display interface of the target application in response to detecting an application snapshot generation instruction; the application snapshot generation instruction is used to instruct the generation of a snapshot of the target application, the target application is the application currently running in the foreground, and the first size parameter is used to characterize the size of the source image corresponding to the target display interface; The processing module is configured to capture an application snapshot corresponding to the target display interface based on the first size parameter.
11. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to perform the application snapshot acquisition method as described in any one of claims 1-9.
12. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the application snapshot acquisition method as described in any one of claims 1-9.