Method and device for displaying application component and electronic equipment
Patent Information
- Application Number
- CN202480000732.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-26
- Filing Date
- 2024-03-07
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, the efficiency and reliability of display application components are low and have strong dependence on target applications, resulting in poor user experience, especially when the application components are not displayed in time during booting or restarting.
By directly obtaining data from application components from persistent storage areas, avoiding waiting for the target application to provide data, thereby improving data acquisition efficiency and updating displayed application components if necessary to ensure their quality and accuracy.
It improves the display efficiency and reliability of application components, reduces dependence on target applications, and ensures that rich application component information can be displayed quickly during startup, restart or front- and back-end switching, improving user experience.
Smart Images

Figure CN119384656A_ABST
Abstract
Description
Method, device and electronic device for displaying application components
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on May 26, 2023, with application number 2023106155772 and application name “Method, device and electronic device for displaying application components”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a method, device, and electronic device for displaying application components. Background Art
[0003] Electronic devices can be installed with a variety of applications, each providing different services. Electronic devices can display application components on the desktop. Application components are a form of interface display that can carry information or operations related to the target application, enabling direct service delivery and reducing user experience hierarchies.
[0004] Currently, you can pull up the target application, obtain the data corresponding to the application component from the target application, and then display the application component based on the obtained data. However, this operation of displaying the application component is very complicated and highly dependent on the target application. Therefore, the efficiency and reliability of displaying the application component are low.
[0005] Summary of the Invention
[0006] In view of this, the present application provides a method, apparatus, and electronic device for displaying application components, which can improve the efficiency and reliability of displaying application components.
[0007] In order to achieve the above-mentioned objectives, in a first aspect, an embodiment of the present application provides a method for displaying an application component, comprising: in response to a first operation, obtaining first data from a persistent storage area, the first operation being used to trigger the display of a first application component, the first data including at least part of the data corresponding to the first application component; based on the first data, displaying the first application component.
[0008] In an embodiment of the present application, since a first operation can trigger the display of a first application component, first data is retrieved from a persistent storage area in response to the first operation, where the first data includes at least a portion of the data corresponding to the first application component. Therefore, the first application component can be displayed based on the first data. Since the first data is retrieved directly from the persistent storage area without waiting for the target application to provide the first data, the efficiency of obtaining the first data is improved, thereby improving the efficiency of displaying the first application component. This also reduces the display of the first application component's dependence on the target application, improves the reliability of displaying the first application component, and alleviates the issue of users seeing a blank first application component or the inability to display the first application component.
[0009] In some embodiments, the duration of waiting for the target application to provide the first data includes the duration of the host application communicating with the target application to obtain the first data. In some embodiments, the duration of waiting for the target application to provide the first data may also include the duration of launching the target application.
[0010] In some embodiments, application components may include service cards (referred to as cards) and widgets. It is understood that in actual applications, application components may include more or fewer software modules or units that can carry relevant information or related operations of the target application, or application components may have other names, such as tiles, business cards, etc.
[0011] In some embodiments, the method further includes: obtaining second data from a target application corresponding to the first application component, the second data including at least part of the data corresponding to the first application component; and updating the displayed first application component based on the second data.
[0012] There is no restriction on the order of when the first data is retrieved from the persistent storage area and when the second data is retrieved from the target application corresponding to the first application component. There is also no restriction on the order of when the first data is retrieved and when the second data is retrieved. Therefore, regardless of whether the first or second data is retrieved first, the first application component is displayed based on the first data first, and then the displayed first application component is updated based on the second data. Three possible scenarios are described below: Scenario 1: The first data is retrieved first. In this case, the first application component can be displayed based on the first data. When the second data is retrieved, the displayed first application component is updated based on the second data. Scenario 2: The first and second data are retrieved simultaneously. Again, the application component is displayed based on the first data first, and then the displayed first application component is updated based on the second data. Scenario 3: The second data is retrieved first. In this case, the first application component may still not be displayed. Instead, the first application component may be displayed based on the first data first, and then the displayed first application component is updated based on the second data, once the first data is retrieved. As can be seen, in all three scenarios, the first application component can be displayed first, and then updated, resulting in a more consistent and organized display of the application components, providing users with a more consistent visual experience.
[0013] It should be noted that obtaining the second data from the target application of the first application component may include directly obtaining the second data from the target application, or may include indirectly obtaining the second data from the target application.
[0014] In some embodiments, the second data of the target application can be obtained through middleware such as application component management service. In some embodiments, the host application can request middleware such as application component management service to send the second data to the host application at intervals of a third time period. The third time period can be a preset time period. In some embodiments, when the host application switches to the foreground, it can send a first notification to middleware such as application component management service, the first notification is used to indicate that the host application is currently in the foreground and / or the first application component is visible, and the middleware such as application component management service responds to the first notification and sends the second data to the host application; when the host application switches to the background, it can send a second notification to middleware such as application component management service, the second notification is used to indicate that the host application is currently in the background and / or the first application component is not visible, and the middleware such as application component management service stops sending the second data to the host application in response to the second notification.
[0015] For example, at time t1, the host application switches to the background and sends a second notification to the application component management service. At time t2, the host application switches to the foreground and sends a first notification to the application component management service. If the application component management service receives the second data sent by the target application at time t3 between t1 and t2, the application component management service can store the second data and send the second data to the host application after receiving the first notification at time t2. If the application component management service receives the second data sent by the target application at time t4 before time t1 or at time t5 after time t2, the application component management service immediately sends the second data to the host application.
[0016] In some implementations, communication may be performed directly with the target application, thereby directly acquiring the second data from the target application.
[0017] In some embodiments, the method further includes: in response to the first operation, obtaining second data from the target application corresponding to the first application component, the second data including at least part of the data corresponding to the first application component; if the time when the first data is obtained is earlier than the time when the second data is obtained, displaying the first application component based on the first data; and updating the displayed first application component based on the second data.
[0018] In some embodiments, if the time when the first data is acquired is equal to or later than the time when the second data is acquired, the first application component is displayed based on the second data.
[0019] In response to the first operation, the first data is obtained from the persistent storage area, and the second data can also be obtained from the target application corresponding to the first application component. If the time when the first data is obtained is earlier than the time when the second data is obtained, the first application component can be displayed based on the first data first, and then the second data can be obtained from the target application. The displayed first application component is updated based on the second data, so that the displayed first application component includes richer details or updated information, ensuring the quality and accuracy of the first application component. If the time when the first data is obtained is equal to or later than the time when the second data is obtained, the first application component can be displayed directly based on the second data. In other words, the efficiency of displaying the first application component including richer details or updated information can be improved, further improving the user experience.
[0020] In some embodiments, after displaying the first application component based on the first data, the method further includes: obtaining second data from a target application corresponding to the first application component, the second data including at least part of the data corresponding to the first application component; and updating the displayed first application component based on the second data.
[0021] Because the first operation can trigger the display of the first application component, first data can be retrieved from the persistent storage area in response to the first operation, and the first application component can be displayed based on the first data. This allows the first application component to be displayed as quickly as possible while reducing dependence on the target application, thereby improving the efficiency and reliability of displaying the first application component. Second data can also be obtained from the target application. The second data may indicate more details about the first application component than the first data, or the second data may be more recent than the first data. Updating the displayed first application component based on the second data can ensure that the displayed first application component includes richer details or updated information, thereby ensuring the quality and accuracy of the first application component.
[0022] In some implementations, before acquiring the second data from the target application corresponding to the first application component, the method includes: launching the target application.
[0023] In some embodiments, the method further includes updating the first data in the persistent storage area based on the second data. The updated new first data includes more or updated information, so that when the first operation is next responded to, the first application component can be displayed based on the new first data, thereby improving the quality and accuracy of the display of the first application component in response to the first operation.
[0024] In some embodiments, the first operation is a power-on operation or a restart operation, thereby improving the efficiency of obtaining the first data in the case of power-on or restart, thereby improving the efficiency of displaying the first application component, and reducing the dependence of the display of the first application component on the target application, improving the reliability of displaying the first application component, and improving the problem that the user sees a blank first application component or cannot display the first application component when starting or restarting. In some embodiments, the first operation is an operation of switching the host application of the first application component from the background to the foreground, thereby improving the efficiency of obtaining the first data in the case of switching the host application from the background to the foreground, thereby improving the efficiency of displaying the first application component, and reducing the dependence of the display of the first application component on the target application, improving the reliability of displaying the first application component, and improving the problem that the user sees a blank first application component or cannot display the first application component when switching the first application component from the background to the foreground.
[0025] In some implementations, the manner in which the first application component is displayed may be determined based on the type of the first operation.
[0026] In some embodiments, if the first operation is a power-on operation or a restart operation, and the first data is obtained first, the first application component is first displayed based on the first data, and then the displayed first application component is updated based on the obtained second data; if the first operation is a power-on operation or a restart operation, and the second data is obtained first, the first application component is directly displayed based on the second data; if the first operation is an operation to switch the host application from the background to the foreground, the first application component can always be displayed based on the first data first, and then the displayed first application component is updated based on the second data.
[0027] Alternatively, in other embodiments, if the first operation is an operation of switching the host application from the background to the foreground, and the first data is obtained first, the first application component is first displayed based on the first data, and then the displayed first application component is updated based on the obtained second data; if the first operation is an operation of switching the host application from the background to the foreground, and the second data is obtained first, the first application component is directly displayed based on the second data; if the first operation is a power-on operation or a restart operation, the first application component can always be displayed based on the first data first, and then the displayed first application component is updated based on the second data.
[0028] In some embodiments, the method further includes: if the host application of the first application component switches from the foreground to the background, deleting third data from the cache area, wherein the third data is used to display part or all of the application components belonging to the host application, and the part or all of the application components include the first application component.
[0029] The host application in the foreground can be switched to the background, and the third data can be deleted from the cache area, where the third data is used to display part or all of the application components belonging to the host application, thereby reducing the cache occupied by the host application and part or all of the application components belonging to the host application, so that more application components can be created while occupying the same size of cache; or, less cache can be occupied while creating the same number of application components.
[0030] In some embodiments, the third data may include at least one of fourth data of the partial or complete application component read from a persistent storage area and intermediate data generated based on the fourth data. In some embodiments, the fourth data may be data obtained from a target application for the partial or complete application component. In some embodiments, the third data includes views of the partial or complete application component belonging to the host application.
[0031] In some embodiments, the third data can be used to display the first application component. In some embodiments, the third data can include other data in the first data in addition to the screenshot of the first application component. In some embodiments, the third data can include other data in the second data in addition to the screenshot of the first application component. In some embodiments, the third data can include intermediate data generated based on the first data or the second data for displaying the first application component, such as a view.
[0032] Since the first data or the second data can be stored in a persistent storage area, even if the third data is deleted from the cache when the host application is switched to the background, the third data can be generated again using the first data or the second data when the first application component is switched to the foreground again, thereby displaying the first application component. However, for other application components belonging to the host application, the data corresponding to these other application components may not be persistently stored before the host application is switched to the background. In this case, to ensure that these other application components can be quickly and reliably displayed when the host application is switched to the foreground again, the data corresponding to these other application components may not be deleted from the cache.
[0033] In some embodiments, deleting the third data from the cache area includes: if a first condition is met, deleting the third data from the cache area, wherein the first condition includes at least one of the following: the duration of the host application being switched to the background is greater than or equal to a first duration; the number of application components belonging to the host application is greater than or equal to a first number; the time since the last deletion of the third data from the cache area is greater than or equal to a second duration.
[0034] That is, the frequency of deleting the third data from the cache area can be adjusted through the first condition, so that when the first application component is frequently switched between the foreground and the background, there is no need to frequently read and write the cache area or render the first application component, so that the first application component can be displayed more quickly and a smoother switching effect of the first application component can be provided.
[0035] When the first condition includes that the duration of time the host application is switched to the background is greater than or equal to the first duration, the longer the first duration is, the longer the third data is retained in the cache area, thereby enabling the host application to provide a smoother application component switching effect when it is switched to the foreground within a longer period of time after being switched to the background.
[0036] When the first condition includes that the number of application components belonging to the host application is greater than or equal to the first number, when the number of application components belonging to the host application is large (i.e., greater than or equal to the first number), the third data can be deleted from the cache area in a timely manner to save more cache. When the number of application components belonging to the host application is small (i.e., less than the first number), the third data in the cache area is retained, so that when the application component is switched to the foreground again, a smoother application component switching effect can be provided.
[0037] When the first condition includes that the time since the last deletion of the third data from the cache area is greater than or equal to the second time, the shorter the second time, the more frequent the deletion of the third data from the cache area, and the stronger the cache saving effect; the longer the second time, the less frequent the deletion of the third data from the cache area, thereby enabling the application component to provide a smoother application component switching effect when switching from the background to the foreground multiple times.
[0038] In some implementations, the first duration may be 1 minute, the first number may be 7, and the second duration may be 3 minutes.
[0039] In some implementations, a view of the first application component may be obtained based on the first data rendering, and the view may be displayed on a display screen.
[0040] In some embodiments, the first data includes at least one of text data corresponding to the first application component, image data corresponding to the first application component, configuration data corresponding to the text data, and configuration data corresponding to the image data. The view can be generated by laying out the text data and image data based on the structural data corresponding to the first application component (e.g., determining the position and rotation angle of the text data and image data in the first application component), loading the text data based on the configuration data corresponding to the text data, and loading the image data based on the configuration data corresponding to the image data.
[0041] In some embodiments, the configuration data corresponding to the text data can be used to indicate properties of the text data, such as font, font size, color, background, etc. In some embodiments, the configuration data can be represented by a JavaScript Object Notation (JSON) string.
[0042] In some embodiments, the configuration data corresponding to the image data may be used to indicate attributes of the image data, such as image name, image size, image storage location, etc. In some embodiments, the configuration data may be represented by an array.
[0043] In some implementations, the data corresponding to the application component may include structural data, which may be used to organize and manage other data corresponding to the application component.
[0044] In some implementations, the view may be stored in a cache.
[0045] In some embodiments, the first data includes a screenshot of the first application component, which can be the same as or similar to the view of the first application component obtained by rendering. Therefore, the screenshot can be displayed to achieve a visual effect that is the same as or similar to displaying the view of the first application component.
[0046] In some embodiments, the persistent storage area includes a device encrypted storage area, and obtaining the first data from the persistent storage area includes: obtaining the first data from the device encrypted storage area before the electronic device where the first application component is located is unlocked.
[0047] The persistent storage area may include a device encrypted storage area, so that the first data can be obtained from the device encrypted storage area before the electronic device is unlocked. By obtaining the first data in advance, the first application component can be displayed more quickly after unlocking, thereby improving the efficiency of displaying the first application component and user experience. For example, after the electronic device is powered on or restarted, but before unlocking, the first data can be obtained from the device encrypted storage area to render the view of the first application component. Therefore, when the electronic device is unlocked, the first application component can be displayed immediately when the host application such as the desktop and the negative one screen is displayed.
[0048] In some implementations, to ensure the security of the host application, the persistent storage area can only be accessed by the host application. The persistent storage area can be referred to as a sandbox of the host application.
[0049] In a second aspect, an embodiment of the present application provides a device for displaying an application component, including:
[0050] an acquisition module, configured to acquire first data from a persistent storage area in response to a first operation, wherein the first operation is used to trigger display of a first application component, and the first data includes at least part of data corresponding to the first application component;
[0051] A display module is configured to display the first application component based on the first data.
[0052] In some embodiments, the acquisition module is further configured to acquire second data from a target application corresponding to the first application component, where the second data includes at least part of the data corresponding to the first application component;
[0053] The display module is further configured to update the displayed first application component based on the second data.
[0054] In some embodiments, the device further comprises:
[0055] An updating module is configured to update the first data in the persistent storage area based on the second data.
[0056] In some embodiments, the device further comprises:
[0057] A deletion module is used to delete third data from the cache area if the host application of the first application component switches from the foreground to the background, and the third data is used to display some or all application components belonging to the host application, and the some or all application components include the first application component.
[0058] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute any one of the methods described in the first aspect above when calling the computer program.
[0059] In a fourth aspect, an embodiment of the present application provides a chip system, which includes a processor coupled to a memory, and the processor executes a computer program stored in the memory to implement any method described in the first aspect above.
[0060] The chip system may be a single chip or a chip module composed of multiple chips.
[0061] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements any of the methods described in the first aspect when the computer program is executed by a processor.
[0062] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute any one of the methods described in the first aspect above.
[0063] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] FIG1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0065] FIG2 is a schematic diagram of a display interface provided in an embodiment of the present application;
[0066] FIG3 is a schematic diagram of another display interface provided in an embodiment of the present application;
[0067] FIG4 is a schematic diagram of the structure of an application component system provided in an embodiment of the present application;
[0068] FIG5 is a schematic diagram of an application component provided in an embodiment of the present application;
[0069] FIG6 is a flowchart of a method for displaying application components provided by an embodiment of the present application;
[0070] FIG7 is a flowchart of another method for displaying application components provided by an embodiment of the present application;
[0071] FIG8 is a flowchart of a method for displaying application components provided by an embodiment of the present application;
[0072] FIG9 is a schematic diagram of another application component provided in an embodiment of the present application;
[0073] FIG10 is a flowchart of another method for displaying application components provided by an embodiment of the present application;
[0074] FIG11 is a flowchart of a method for switching application components provided in an embodiment of the present application;
[0075] FIG12 is a flowchart of another method for displaying application components provided by an embodiment of the present application;
[0076] FIG13 is a schematic structural diagram of a device for displaying application components provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The method for displaying an application component provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0078] 1 is a schematic diagram of the structure of an electronic device 100 according to an embodiment of the present application. The electronic device 100 may include a processor 110, a memory 120, a communication module 130, a display screen 140, and the like.
[0079] The processor 110 may include one or more processing units, and the memory 120 is used to store program codes and data. In the embodiment of the present application, the processor 110 may execute computer-executable instructions stored in the memory 120 to control and manage the actions of the electronic device 100.
[0080] In some implementations, the memory 120 may include a first memory and a second memory.
[0081] The first memory may include a cache area, which may be used to store temporary data. In some embodiments, when the first memory loses power, the data stored in the cache area will disappear. In some embodiments, the cache area is capable of high-speed data exchange. In some embodiments, the cache area can directly exchange data with the processor 110 of the electronic device. In some embodiments, the first memory may include a random-access memory (RAM) or a cache.
[0082] The second memory may include a persistent storage area, which can be used to store persistent data. In some embodiments, when the second memory loses power, the data in the persistent storage area will continue to be retained. In some embodiments, the second memory may include a secure digital memory (SD), a double data rate synchronous dynamic random access memory (DDR), a flash memory (FLASH), an embedded multi-media card (eMMC), or an electrically erasable programmable read-only memory (EEPROM). In some embodiments, the persistent storage area may include a device encrypted storage area, wherein data in the device encrypted storage area can be read and written to before the electronic device is unlocked. In some embodiments, an application may correspond to a persistent storage area, and the electronic device 100 may allocate the persistent storage area to the application when the application is installed and reclaim the persistent storage area when the application is uninstalled. The persistent storage area can only be accessed by the application and may also be referred to as the "sandbox" of the application.
[0083] In some embodiments, the memory 120 may include a third memory including a cache area and a persistent storage area.
[0084] In some embodiments, the processor 110 may include an application processor (AP) and a graphics processing unit (GPU). The electronic device 100 may implement display functions using the GPU, the display screen 140, and the AP. The GPU is a microprocessor for image processing that connects the display screen 140 and the AP. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0085] The display screen 140 is used to display images, videos, and the like. The display screen 140 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device 100 can include one or N display screens 140, where N is a positive integer greater than one.
[0086] The communication module 130 can be used for communication between various internal modules of the electronic device 100, or for communication between the electronic device 100 and other external electronic devices. For example, if the electronic device 100 communicates with other electronic devices via a wired connection, the communication module 130 may include an interface, such as a USB interface. The USB interface may be an interface that complies with USB standards, such as a Mini USB interface, a Micro USB interface, or a USB Type-C interface. The USB interface can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
[0087] Alternatively, the communication module 130 may include an audio device, a radio frequency circuit, a Bluetooth chip, a wireless fidelity (Wi-Fi) chip, a near-field communication (NFC) module, etc., and can realize the interaction between the electronic device 100 and other electronic devices in a variety of different ways.
[0088] Optionally, the electronic device 100 may further include a peripheral device 150 , such as a mouse, a keyboard, a speaker, a microphone, and the like.
[0089] It should be understood that, other than the various components or modules listed in FIG1 , the embodiments of the present application do not specifically limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0090] In order to facilitate understanding of the technical solutions in the embodiments of the present application, the application scenarios of the embodiments of the present application are first introduced below.
[0091] A variety of applications can be installed in electronic devices, and different applications can provide different services, thus bringing a variety of experiences to users. However, with the increasing number of applications installed in electronic devices and the increasing number of services provided by each application, users often need to perform complex operations to open the target application or target service. Therefore, in order to achieve direct service access and reduce the level of experience, electronic devices can display application components. This application component can be used to carry relevant information or related operations of the target application. Users can directly view this information through the application component or obtain corresponding services through these operations.
[0092] In some embodiments, application components may include service cards (referred to as cards) and widgets. It is understood that in actual applications, application components may include more or fewer software modules or units that can carry relevant information or related operations of the target application, or application components may have other names, such as tiles, business cards, etc.
[0093] The following will be combined with the scene of displaying video cards (also called video components) to specifically describe the application components. Please refer to Figures 2 and 3, which are schematic diagrams of a display interface provided by an embodiment of the present application.
[0094] Figure 2 is the negative one screen interface. The user can enter the negative one screen interface by sliding the desktop of the electronic device to the right. In some embodiments, the user can add a video card from the negative one screen application. For example, the user can click the "More" button in the negative one screen interface, and the electronic device will display a card adding option in response to the user clicking the "More" button. The user can determine the video application as the target application based on the card adding option, thereby adding a video card to the negative one screen interface. In some embodiments, the user can long press the icon of the video application on the desktop, and the electronic device will display a card adding option in response to the user long pressing the icon of the video application, and the user can add a video card to the negative one screen interface based on the card adding option. It can be understood that in actual applications, video cards can also be added to the negative one screen interface in other ways.
[0095] As shown in Figure 2, the negative one screen interface includes a "Huawei Video" card, which includes the identity information of the video application, the video information being played, and multiple control buttons. The identity information of the video application can be used to indicate the identity of the target application. In some embodiments, the identity information can include the icon of the video application and the name of the video application. The video information being played can be used to indicate information related to the currently playing video. In some embodiments, the video information can include the video window and the video name. The control buttons can be used to control the playback process of the video. In some embodiments, the control buttons can include a volume bar, a video progress bar, a fast forward button, a fast rewind button, and a next video button.
[0096] When the electronic device displays the negative-one screen interface shown in Figure 2, the user can see a video card and, based on the identity information of the video application, determine that the content in the video card comes from the video application. Based on the information of the currently playing video, the user can determine that the currently playing video image and video title are "Bravely Step Forward." The user can also control the video process using control buttons, such as adjusting the volume by dragging the volume bar or adjusting the playback progress by dragging the video progress bar.
[0097] In some embodiments, a user can click on a blank area of a video card. In response to the user's click on the blank area, the electronic device can launch a video application and directly jump to the video playback interface shown in FIG3 . In some embodiments, the video playback interface can include more information than the video card. For example, as shown in FIG3 , it can also include video attribute information, a video list, and a comment field. Video attribute information can include information such as the number of plays, video type, and video description. The video list can include more playable videos, making it easier for the user to select one to play. The comment field can be used to receive user comments on the currently playing video.
[0098] Alternatively, the user can click on the video application icon on the desktop, and the electronic device can, in response to the user's click on the icon, launch the video application and display the main interface of the video application. The user continues to search for options related to the currently playing video in the main interface, and thus gradually finds the video playback interface shown in FIG3 .
[0099] As can be seen in Figure 2, the video card not only intuitively and conveniently displays the currently playing video and related information to the user, but also displays multiple control buttons to facilitate user control of the video playback process. Furthermore, the user can directly access the video playback interface through the video card, avoiding the tedious operation of searching for the video playback interface layer by layer.
[0100] 4 is a schematic diagram of the structure of an application component system provided by an embodiment of the present application. The system may include a host application 410, an application component management service 420, and a target application 430.
[0101] Host application 410 is a user of application components. Host application 410 can obtain data corresponding to application component 411 and display application component 411. In some embodiments, host application 410 can control the display location of application component 411. In some embodiments, host application 410 can be used to add application component 411, delete application component 411, and request updates to application component 411. In some embodiments, host application 410 can include system applications such as desktop applications and negative-one-screen applications. Of course, it is understood that in actual applications, host application 410 can also be other system applications or third-party applications.
[0102] The application component management service 420 can manage the application component 411. In some embodiments, the application component management service 420 can obtain data corresponding to the application component 411 from the target application 430 and provide the data to the host application 410. In some embodiments, the application component management service 420 can be used to implement communication between the host application 410 and the target application 420. In some embodiments, the application component management service 420 can be implemented as a system service. In some embodiments, the application component management service 420 can be omitted, and the host application 410 and the target application 430 can communicate directly, or the host application 410 and the target application 430 can communicate through other middleware. In some embodiments, at least part of the functions of the application component management service 420 can be integrated into the host application 410 or the target application 430.
[0103] Target application 430 is an application component provider. Target application 430 can provide data corresponding to application component 411 to host application 410. In some embodiments, target application 430 can request host application 410 to create application component 411, delete application component 411, or notify host application 410 to update application component 411. For example, target application 430 can be the aforementioned video application, and application component 411 can be the aforementioned video application component.
[0104] The data corresponding to the application component can be used to display the application component. The data corresponding to the application component will be specifically described below in conjunction with the weather card (also referred to as a weather component) shown in FIG5 .
[0105] In some embodiments, the data corresponding to the application component may include text data. For example, in the weather card shown in FIG5 , the text data corresponding to the weather card may include: "27°C", "Yanta District", "Sandstorm and High Wind Warning", "30°C / 17°C", "16:00", "16:00", "17:00", "18:00", "19:00", "19:18", "29°C", "30°C", "28°C", "25°C", "Sunset", "Yesterday", "Today", "Tomorrow", "Friday", "Saturday", "Good", and "Mild".
[0106] In some embodiments, the data corresponding to the application component may include configuration data corresponding to the text data. This configuration data may be used to indicate properties of the text data, such as font, size, color, and background. In some embodiments, this configuration data may be represented by a JSON string. Of course, in actual applications, this configuration data may also be represented by other types of data structures.
[0107] In some embodiments, the data corresponding to the application component may include image data. For example, in the weather card shown in FIG5 , the image data corresponding to the weather card may include a background image of the weather card, icons representing sunset / sunny / cloudy / light rain / moderate rain, a line vector diagram representing temperature changes, and a screenshot of the weather card shown in FIG5 .
[0108] In some embodiments, the data corresponding to the application component may include configuration data corresponding to the image data. This configuration data may be used to indicate attributes of the image data, such as the image name, image size, image storage location, etc. In some embodiments, this configuration data may be represented by an array. Of course, in actual applications, this configuration data may also be represented by other types of data structures.
[0109] In some embodiments, the data corresponding to the application component may include structural data, which can be used to organize and manage other data corresponding to the application component. In some embodiments, the structural data may include one or more of a layout object, an application component object, an auxiliary class object, a mapping relationship, a callback function, and a context container object.
[0110] The following describes a method for displaying an application component, using the scenario of displaying a weather card. Please continue to refer to Figures 4 and 5 above. When the host application 410 displays a weather card, the host application 410 can launch the target application 430 through the application component management service 420, where the target application 430 can be a weather application. The target application 430 can send data corresponding to the weather card to the host application 410 through the application component management service 420, including the text data, image data, configuration data corresponding to the text data, configuration data corresponding to the image data, and structural data mentioned above. The host application 410 stores the received data in a cache and renders the generated view (as shown in Figure 5) based on the received data. The host application 410 displays the view on the display screen of the electronic device, thereby presenting the weather card to the user. On the one hand, the process of displaying the application component is highly dependent on the target application 430. If the host application 410 cannot launch the target application 430, the application component cannot be displayed in a timely manner. For example, when an electronic device is turned on or restarted, the electronic device needs to be unlocked before the target application can be launched, resulting in the electronic device being unable to display the application components for a period of time after unlocking, resulting in a poor user experience. On the other hand, if a large number of application components are added, the host application 410 will occupy a large amount of memory, affecting the performance of the electronic device.
[0111] In order to solve at least part of the above technical problems, an embodiment of the present application provides another method for displaying application components.
[0112] The technical solution of the present application is described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Among them, the method shown in the embodiment of the present application can be applied to the electronic device mentioned above, specifically, it can be used in the host application of the electronic device.
[0113] Please refer to Figure 6, which is a flowchart of a method for displaying application components provided in an embodiment of the present application. This method can display application components as quickly as possible when starting or restarting. It should be noted that this method is not limited to the specific order described in Figure 6 and below. It should be understood that in other embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:
[0114] S601, in response to a first operation, obtaining first data from a persistent storage area, where the first operation is a power-on operation or a restart operation, and the first data includes at least part of data corresponding to a first application component.
[0115] The first operation may be used to trigger the display of the first application component. It should be noted that the first application component may be any application component belonging to any host application.
[0116] In some embodiments, the first data may include at least one of text data corresponding to the first application component, image data corresponding to the first application component, configuration data corresponding to the text data, configuration data corresponding to the image data, and structural data corresponding to the first application component.
[0117] Take the weather card shown in FIG5 as an example.
[0118] The text data corresponding to the weather card may include: "27℃", "Yanta District", "Sandstorm and strong wind warning", "30℃ / 17℃", "16:00", "16:00", "17:00", "18:00", "19:00", "19:18", "29℃", "30℃", "28℃", "25℃", "Sunset", "Yesterday", "Today", "Tomorrow", "Friday", "Saturday", "Good" and "Mild".
[0119] The configuration data corresponding to the text data may include the font, size, and color of each character.
[0120] The image data corresponding to the weather card may include: a background image of the weather card, an icon indicating cloudy weather, an icon indicating sunny weather, an icon indicating light rain, a line vector diagram of temperature changes, and a screenshot of the card as shown in FIG5 .
[0121] The configuration data corresponding to the image data may include the storage location, transparency, image name and size, etc. of each of the above image data.
[0122] The structural data corresponding to the weather card can be used to organize and manage the above-mentioned text data, image data, configuration data corresponding to the text data, and configuration data corresponding to the image data.
[0123] In some embodiments, the persistent storage area may correspond to the host application, that is, the persistent storage area can only be accessed by the host application. In some embodiments, the persistent storage area can be allocated to the host application when the host application is installed. Of course, in actual applications, the persistent storage area can also be allocated to the host application in other ways.
[0124] In some embodiments, the persistent storage area may include a device encrypted storage area, so that the first data can be obtained from the device encrypted storage area before the electronic device is unlocked. By obtaining the first data in advance, the first application component can be displayed more quickly after unlocking, thereby improving the efficiency of displaying the first application component and user experience.
[0125] In some embodiments, the persistent storage area may not correspond to the host application or the persistent storage area may be accessible to applications other than the host application. For example, the persistent storage area may be a shared storage area between the host application of the first application component and the target application. The target application may store the data corresponding to the first application component in the shared storage area, and the host application may obtain the data from the shared storage area.
[0126] In some implementations, the first data may be obtained from a persistent storage area and stored in a cache area to facilitate subsequent processing of the first data.
[0127] In some embodiments, the first data may be obtained from the target application in advance and stored in the persistent storage area. In some embodiments, the target application may be requested to add the first application component, and the first data returned by the target application may be obtained and stored in the persistent storage area. In some embodiments, update data sent by the target application may be obtained, and the first data included in the update data may be stored in the persistent storage area. Of course, in actual applications, the first data may also be obtained from the target application at other times and through other methods.
[0128] It should be noted that the form in which the first data is stored in the persistent storage area may include text documents, extensible markup language (XML), images, graphics, data tables, JSON, comma-separated values (CSV), databases or unformatted files, etc. The embodiment of the present application does not limit the specific form in which the first data is stored in the persistent storage area.
[0129] S602: Display a first application component based on the first data.
[0130] When the first data is obtained, the first application component can be displayed based on the first data. Since the first data can be obtained directly from the persistent storage area without waiting for the target application to provide the first data, the efficiency of obtaining the first data is improved, thereby improving the efficiency of displaying the first application component, reducing the dependence of the display of the first application component on the target application, and improving the reliability of the display of the first application component.
[0131] In some embodiments, the duration of waiting for the target application to provide the first data includes the duration of the host application communicating with the target application to obtain the first data. In some embodiments, the duration of waiting for the target application to provide the first data may also include the duration of launching the target application.
[0132] In some embodiments, a view of the first application component can be rendered based on the first data and displayed on a display screen. In some embodiments, the text data and image data can be laid out based on the structural data corresponding to the first application component (e.g., determining the position and rotation angle of the text data and image data in the first application component), and the text data can be loaded based on the configuration data corresponding to the text data, and the image data can be loaded based on the configuration data corresponding to the image data, thereby generating the view. In some embodiments, the view can be stored in a cache area.
[0133] Taking the weather card shown in Figure 5 as an example, the first data includes text data, image data, configuration data corresponding to the text data, configuration data corresponding to the image data, and structure data corresponding to the weather card. Based on the structural data corresponding to the weather card, the position and rotation angle of text data such as "27℃", "Yanta District", "Sandstorm and Strong Wind Warning", "30℃ / 17℃", "16:00", "16:00", "17:00", "18:00", "19:00", "19:18", "29℃", "30℃", "28℃", "25℃", "Sunset", "Yesterday", "Today", "Tomorrow", "Friday", "Saturday", "Good" and "Mild" as well as image data such as the background image of the weather card, the icon indicating cloudy, the icon indicating sunny, the icon indicating light rain, and the line vector diagram of temperature changes can be determined. Based on the configuration data corresponding to the text data, the font, size and font size of each text data can be determined, and each font data can be loaded. Based on the configuration data corresponding to the image data, the transparency of the background image, the icon indicating cloudy, the icon indicating sunny, the icon indicating light rain, and the line vector diagram of temperature changes can be determined, and the background image, the icon indicating cloudy, the icon indicating sunny, the icon indicating light rain, and the line vector diagram of temperature changes can be loaded, thereby displaying the weather card shown in Figure 5.
[0134] In some embodiments, the first data does not include text data, image data, configuration data corresponding to the text data, configuration data corresponding to the image data, and some of the structural data. Accordingly, this portion of data can be ignored or obtained through other means. In some embodiments, this portion of data can be preset data, thereby eliminating the need to obtain this portion of data from the target application. In some embodiments, this portion of data can be obtained from the target application, thereby reducing the amount of data obtained from the target application and improving the efficiency of displaying the first application component.
[0135] In some embodiments, the first data includes a screenshot of the first application component, which can be the same as or similar to the view of the first application component obtained by rendering. Therefore, the screenshot can be displayed to achieve a visual effect that is the same as or similar to displaying the view of the first application component.
[0136] Still taking the example of displaying the weather card shown in Figure 5, the first data includes a screenshot of the weather card shown in Figure 5, so the screenshot can be directly displayed.
[0137] In some embodiments, the first data can be stored in a cache, and a view of the first application component can be rendered in the cache. In some embodiments, the cache can be used to store data used to display the first application component. In some embodiments, the cache can be used to store at least one of the first data and intermediate data generated based on the first data for displaying the first application component. In some embodiments, the cache can store the view of the first application component.
[0138] In an embodiment of the present application, since a power-on or restart operation can trigger the display of a first application component, first data is retrieved from a persistent storage area in response to the power-on or restart operation, where the first data includes at least a portion of the data corresponding to the first application component. Therefore, the first application component can be displayed based on the first data. Since the first data is retrieved directly from the persistent storage area without waiting for the target application to provide the first data, the efficiency of obtaining the first data is improved, thereby improving the efficiency of displaying the first application component. This also reduces the dependence of the display of the first application component on the target application, improves the reliability of displaying the first application component, and alleviates the problem of users seeing a blank first application component or the inability to display the first application component during power-on or restart.
[0139] Please refer to Figure 7, which is a flowchart of a method for displaying application components provided in an embodiment of the present application. This method can display the first application component as quickly as possible when the host application of the first application component is switched from the background to the foreground. It should be noted that this method is not limited to Figure 7 and the specific order described below. It should be understood that in other embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. This method includes the following steps:
[0140] S701, in response to a first operation, obtaining first data from a persistent storage area, the first operation being an operation of switching a host application of a first application component from a background to a foreground, the first data including at least part of data corresponding to the first application component.
[0141] The first operation may be used to trigger display of the first application component.
[0142] In some embodiments, the operation mode of the first operation may correspond to the host application. In some embodiments, if the host application is a desktop application, the first operation may include an operation of returning to the desktop. In some embodiments, if the host application is a negative one screen application, the first operation may include an operation of calling the negative one screen.
[0143] S702: Display a first application component based on the first data.
[0144] It should be noted that the method of executing S701-S702 can refer to the relevant description in the aforementioned S601-S602, which will not be repeated here.
[0145] In an embodiment of the present application, since the operation of switching the host application of the first application component from the background to the foreground can trigger the display of the first application component, in response to the operation of switching the first application component from the background to the foreground, first data is obtained from the persistent storage area, wherein the first data includes at least a portion of the data corresponding to the first application component, and thus the first application component can be displayed based on the first data. Since the first data is obtained directly from the persistent storage area without waiting for the target application to provide the first data, the efficiency of obtaining the first data is improved, thereby improving the efficiency of displaying the first application component, reducing the dependence of the display of the first application component on the target application, improving the reliability of displaying the first application component, and improving the problem of the user seeing a blank first application component or being unable to display the first application component when switching the first application component from the background to the foreground.
[0146] Please refer to Figure 8, which is a flowchart of a method for displaying application components provided in an embodiment of the present application. This method can be applied after the methods shown in Figures 6 and 7 above, so as to update the displayed first application component. It should be noted that this method is not limited to the specific order shown in Figure 8 and the following. It should be understood that in other embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:
[0147] S801: Launch the target application.
[0148] The target application is used to provide data corresponding to the first application component. For example, for the weather card shown in FIG5 , the target application may be a weather application.
[0149] In some implementations, the target application can be launched through the application component management service. Of course, in actual applications, the target application can also be launched through other methods.
[0150] It should be noted that when the target application is already in the launched state, S801 may be omitted.
[0151] S802: Acquire second data from the target application, where the second data includes at least part of the data corresponding to the first application component.
[0152] In some embodiments, the second data may include at least one of text data corresponding to the first application component, image data corresponding to the first application component, configuration data corresponding to the text data, configuration data corresponding to the image data, and structural data corresponding to the first application component. In some embodiments, the second data may include more data than the first data, or the second data may not be completely identical to the first data.
[0153] Take the weather card shown in Figure 5 as an example. The weather card shown in Figure 5 is based on the first data. The first data indicates the weather of the previous day, and the second data can indicate the weather of today. Alternatively, the first data indicates the weather at a previous moment, and the second data can indicate the weather at the current moment.
[0154] It should be noted that obtaining the second data from the target application of the first application component may include directly obtaining the second data from the target application, or may include indirectly obtaining the second data from the target application.
[0155] In some embodiments, the second data of the target application can be obtained through middleware such as an application component management service. In some embodiments, the host application can request the middleware such as the application component management service to send the second data to the host application at intervals of a third duration. The third duration can be a preset duration. In some embodiments, when the host application switches to the foreground, it can send a first notification to the middleware such as the application component management service. The first notification indicates that the host application is currently in the foreground and / or the first application component is visible. In response to the first notification, the middleware such as the application component management service sends the second data to the host application. When the host application switches to the background, it can send a second notification to the middleware such as the application component management service. The second notification indicates that the host application is currently in the background and / or the first application component is not visible. In response to the second notification, the middleware such as the application component management service stops sending the second data to the host application. In some embodiments, an update request can be sent to the application component management service to request the second data from the target application. The application component management service launches the target application, obtains the second data from the target application, and returns the second data.
[0156] For example, at time t1, the host application switches to the background and sends a second notification to the application component management service. At time t2, the host application switches to the foreground and sends a first notification to the application component management service. If the application component management service receives the second data sent by the target application at time t3 between t1 and t2, the application component management service can store the second data and send the second data to the host application after receiving the first notification at time t2. If the application component management service receives the second data sent by the target application at time t4 before time t1 or at time t5 after time t2, the application component management service immediately sends the second data to the host application.
[0157] In some implementations, communication may be performed directly with the target application, thereby directly acquiring the second data from the target application.
[0158] S803: Update the displayed first application component based on the second data.
[0159] Since the second data is obtained from the target application after the first application component is displayed based on the first data obtained from the persistent storage area, the second data can indicate more details than the first data, or the second data can be more updated than the first data. Therefore, updating the displayed first application component based on the second data can make the displayed first application component include richer details or include updated information.
[0160] For example, when the computer is turned on, a weather card as shown in FIG5 can be displayed on the desktop based on the first data in the persistent storage area. The weather card shown in FIG5 can show the weather of the previous day. Therefore, the user can immediately see the weather card when the computer is turned on, rather than a blank card. After the weather card as shown in FIG5 is displayed, the weather application can be opened, and the second data can be obtained from the weather application. Based on the second data, a weather card as shown in FIG9 can be displayed. The weather card shown in FIG9 can show the weather of today.
[0161] In some implementations, the view of the first application component may be updated based on the second data, and the updated view may be displayed on a display screen.
[0162] It should be noted that the method of obtaining the view of the first application component based on the second data rendering can be the same as or similar to the method of obtaining the view of the first application component based on the first data rendering, and will not be described in detail here.
[0163] In some embodiments, the second data can be stored in a cache, and the view of the first application component can be rendered in the cache. In some embodiments, the cache can be used to store at least one of the second data and intermediate data generated based on the second data for displaying the first application component. In some embodiments, the cache can store an updated view of the first application component.
[0164] In some embodiments, the first data in the persistent storage area can be updated based on the second data. The updated new first data includes more or updated information, so that the first application component can be displayed based on the new first data when responding to the first operation next time, thereby improving the quality and accuracy of displaying the first application component when responding to the first operation.
[0165] In some embodiments, the first data may be deleted and the second data may be stored as the new first data. In some embodiments, the first data may be retained and the second data may be stored as the new first data. Of course, in actual applications, the first data in the persistent storage area may be updated based on the second data in other ways.
[0166] In some implementations, the second data may be obtained from the target application at any time, and then updated based on the first data in the second data persistent storage area.
[0167] In an embodiment of the present application, since a first operation can trigger the display of a first application component, first data can be retrieved from a persistent storage area in response to the first operation, and the first application component can be displayed based on the first data. This allows the first application component to be displayed as quickly as possible while reducing dependence on the target application, thereby improving the efficiency and reliability of displaying the first application component. Second data can also be obtained from the target application. The second data can indicate more details about the first application component than the first data, or the second data can be more recent than the first data. In this way, updating the displayed first application component based on the second data can ensure that the displayed first application component includes richer details or updated information, thereby ensuring the quality and accuracy of the first application component.
[0168] Please refer to Figure 10, which is a flow chart of a method for displaying application components provided in an embodiment of the present application. The method can be obtained by combining the methods shown in Figures 6 to 8 above, so that when the first data is obtained earlier, the first application component is first displayed based on the first data, and then the displayed first application component is updated based on the second data, or, when the second data is obtained earlier, the card is directly displayed based on the second data. It should be noted that the method is not limited to Figure 10 and the specific order described below. It should be understood that in other embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:
[0169] S1001, in response to a first operation, obtaining first data from a persistent storage area, and obtaining second data from a target application corresponding to a first application component.
[0170] In some implementations, the first data may be retrieved from the persistent storage area first, and then the second data may be retrieved from the target application corresponding to the first application component. This allows the first data to be retrieved earlier, further reducing the latency in displaying the first application component in response to the first operation. It is understood that in actual applications, the second data may also be retrieved from the target application corresponding to the first application component first, and then the first data may be retrieved from the persistent storage area; alternatively, the first data may be retrieved from the persistent storage area and the second data may be retrieved from the target application corresponding to the first application component simultaneously.
[0171] It should be noted that the method of executing S1001 to obtain the first data from the persistent storage area can refer to the relevant description in the aforementioned S601, and the method of obtaining the second data from the target application corresponding to the first application component can refer to the relevant description in the aforementioned S801-S802.
[0172] S1002: If the time when the first data is obtained is earlier than the time when the second data is obtained, execute S1003; otherwise, execute S1005.
[0173] If the time when the first data is acquired is equal to or later than the time when the second data is acquired, S1005 may be executed.
[0174] S1003: Display a first application component based on the first data.
[0175] It should be noted that, for the manner of executing S1003 to display the first application component based on the first data, reference may be made to the relevant description in the aforementioned S602.
[0176] S1004: Update the displayed first application component based on the second data.
[0177] It should be noted that, for the manner of executing S1004 to update the displayed first application component based on the second data, reference may be made to the relevant description in the aforementioned S803.
[0178] S1005: Display the first application component based on the second data.
[0179] It should be noted that the manner of performing S1005 to display the first application component based on the second data may be the same as or similar to the manner of performing S601 to display the first application component based on the first data.
[0180] In an embodiment of the present application, in response to the first operation, the first data can be obtained from the persistent storage area, and the second data can also be obtained from the target application corresponding to the first application component. If the time when the first data is obtained is earlier than the time when the second data is obtained, the first application component can be displayed based on the first data first, and then the second data can be obtained from the target application. The displayed first application component is updated based on the second data, so that the displayed first application component includes richer details or updated information, thereby ensuring the quality and accuracy of the first application component. If the time when the first data is obtained is equal to or later than the time when the second data is obtained, the first application component can be displayed directly based on the second data. That is, the efficiency of displaying the first application component including richer details or updated information can be improved, further improving the user experience.
[0181] It is understood that the first application component may be displayed in a different manner regardless of the timing of obtaining the first data and the second data. In some embodiments, the second data may be obtained from the target application corresponding to the first application component, the second data including at least a portion of the data corresponding to the first application component; and the displayed first application component may be updated based on the second data.
[0182] There is no restriction on the order of when the first data is retrieved from the persistent storage area and when the second data is retrieved from the target application corresponding to the first application component. There is also no restriction on the order of when the first data is retrieved and when the second data is retrieved. Therefore, regardless of whether the first or second data is retrieved first, the first application component is displayed based on the first data first, and then the displayed first application component is updated based on the second data. Three possible scenarios are described below: Scenario 1: The first data is retrieved first. In this case, the first application component can be displayed based on the first data. When the second data is retrieved, the displayed first application component is updated based on the second data. Scenario 2: The first and second data are retrieved simultaneously. Again, the application component is displayed based on the first data first, and then the displayed first application component is updated based on the second data. Scenario 3: The second data is retrieved first. In this case, the first application component may still not be displayed. Instead, the first application component may be displayed based on the first data first, and then the displayed first application component is updated based on the second data, once the first data is retrieved. As can be seen, in all three scenarios, the first application component can be displayed first, and then updated, resulting in a more consistent and organized display of the application components, providing users with a more consistent visual experience.
[0183] In some implementations, the manner in which the first application component is displayed may be determined based on the type of the first operation.
[0184] In some embodiments, if the first operation is a power-on operation or a restart operation, and the first data is obtained first, the first application component is first displayed based on the first data, and then the displayed first application component is updated based on the obtained second data; if the first operation is a power-on operation or a restart operation, and the second data is obtained first, the first application component is directly displayed based on the second data; if the first operation is an operation to switch the host application from the background to the foreground, the first application component can always be displayed based on the first data first, and then the displayed first application component is updated based on the second data.
[0185] Alternatively, in other embodiments, if the first operation is an operation of switching the host application from the background to the foreground, and the first data is obtained first, the first application component is first displayed based on the first data, and then the displayed first application component is updated based on the obtained second data; if the first operation is an operation of switching the host application from the background to the foreground, and the second data is obtained first, the first application component is directly displayed based on the second data; if the first operation is a power-on operation or a restart operation, the first application component can always be displayed based on the first data first, and then the displayed first application component is updated based on the second data.
[0186] Please refer to Figure 11, which is a flowchart of a method for switching application components provided in an embodiment of the present application. This method can be applied after the method shown in Figure 6 above, or before or after the method shown in Figure 7 above, so as to switch the foreground and background of the host application of the first application component, and release the cache occupied by the host application when the host application switches to the background, saving device resources. It should be noted that this method is not limited to Figure 11 and the specific order described below. It should be understood that in other embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps therein can be omitted or deleted. The method comprises the following steps:
[0187] S1101: Switch the host application of the first application component from the foreground to the background.
[0188] In some implementations, the host application of the first application component may be switched from the foreground to the background in response to the second operation, wherein the second operation may be used to trigger the switching of the first application component from the foreground to the background.
[0189] In some embodiments, the operation mode of the second operation can correspond to the host application. In some embodiments, the host application is a desktop application, and the second operation can include an operation of opening any application. In some embodiments, the host application is a negative one screen application, and the second operation can include an operation of exiting the negative one screen.
[0190] S1102, deleting third data from the cache area, where the third data includes data for displaying part or all of the application components belonging to the host application, where the part or all of the application components include the first application component.
[0191] Deleting the third data from the cache frees up the cache occupied by the third data, thereby reducing the cache occupied by the host application and at least some application components belonging to the host application. This allows more application components to be created while occupying the same amount of cache; or, alternatively, allows a smaller cache to be occupied while creating the same number of application components.
[0192] In some embodiments, the third data may include at least one of fourth data of the partial or entire application component read from a persistent storage area and intermediate data generated based on the fourth data. In some embodiments, the fourth data may be data obtained from a target application for the partial or entire application component. In some embodiments, the third data includes views of the partial or entire application component belonging to the host application.
[0193] In some embodiments, the third data can be used to display the first application component. In some embodiments, the third data can include other data in the first data in addition to the screenshot of the first application component. In some embodiments, the third data can include other data in the second data in addition to the screenshot of the first application component. In some embodiments, the third data can include intermediate data generated based on the first data or the second data for displaying the first application component, such as a view.
[0194] Since the first data or the second data can be stored in a persistent storage area, even if the third data is deleted from the cache when the host application is switched to the background, the third data can be generated again using the first data or the second data when the first application component is switched to the foreground again, thereby displaying the first application component. However, for other application components belonging to the host application, the data corresponding to these other application components may not be persistently stored before the host application is switched to the background. In this case, to ensure that these other application components can be quickly and reliably displayed when the host application is switched to the foreground again, the data corresponding to these other application components may not be deleted from the cache.
[0195] Among them, the screenshot of the first application component can be an image obtained by taking a screenshot of the view when the view of the first application component is displayed. The screenshot can include the same visual information as the view. As long as the screenshot is retained in the cache area, even if other data in the first data except the screenshot is deleted from the cache area when the first application component is switched to the background, the screenshot can be displayed again when the first application component is switched to the foreground again, thereby achieving the same visual effect as displaying the view of the first application component, that is, the first application component can be displayed.
[0196] In some embodiments, it is possible to determine whether the first condition is satisfied. If so, the third data is deleted from the cache; otherwise, the third data is not deleted from the cache. That is, the frequency of deleting the third data from the cache can be adjusted based on the first condition. This eliminates the need to frequently read and write the cache or render the first application component when the foreground and background of the first application component are frequently switched. This allows for faster display of the first application component and smoother switching between the first application component.
[0197] In some embodiments, the first condition may be pre-set. In some embodiments, the first condition may be set by a user, a manufacturer of an electronic device, or a manufacturer of a host application. It is understood that the present application does not limit the timing and manner of setting the first condition.
[0198] In some embodiments, the first condition may include at least one of the following: the duration of time the host application is switched to the background is greater than or equal to the first duration; the number of application components belonging to the host application is greater than or equal to the first number; the time since the last time the third data was deleted from the cache area is greater than or equal to the second duration.
[0199] When the first condition includes that the duration of time the host application is switched to the background is greater than or equal to the first duration, the longer the first duration is, the longer the third data is retained in the cache area, thereby enabling the host application to provide a smoother application component switching effect when it is switched to the foreground within a longer period of time after being switched to the background.
[0200] When the first condition includes that the number of application components belonging to the host application is greater than or equal to the first number, when the number of application components belonging to the host application is large (i.e., greater than or equal to the first number), the third data can be deleted from the cache area in a timely manner to save more cache. When the number of application components belonging to the host application is small (i.e., less than the first number), the third data in the cache area is retained, so that when the application component is switched to the foreground again, a smoother application component switching effect can be provided.
[0201] When the first condition includes that the time since the last deletion of the third data from the cache area is greater than or equal to the second time, the shorter the second time, the more frequent the deletion of the third data from the cache area, and the stronger the cache saving effect; the longer the second time, the less frequent the deletion of the third data from the cache area, thereby enabling the application component to provide a smoother application component switching effect when switching from the background to the foreground multiple times.
[0202] In some embodiments, the first duration, the first number, and the second duration can be pre-set. In some embodiments, the first duration, the first number, and the second duration can be set by the user, the manufacturer of the electronic device, or the manufacturer of the host application. In some embodiments, the first duration can be 1 minute, the first number can be 7, and the second duration can be 3 minutes. It is understandable that the embodiments of the present application do not limit the timing, method, and specific numerical values for setting the first duration, the first number, and the second duration. For example, the first duration, the first number, and the second duration can also be other numerical values.
[0203] In an embodiment of the present application, the host application in the foreground can be switched to the background, and the third data can be deleted from the cache area, where the third data is used to display part or all of the application components belonging to the host application, thereby reducing the cache occupied by the host application and part or all of the application components belonging to the host application, so that more application components can be created while occupying the same size of cache; or, when creating the same number of application components, less cache can be occupied.
[0204] Please refer to Figure 12, which is a flow chart of a method for displaying application components provided in an embodiment of the present application. This method can be obtained by combining the methods shown in Figures 6 to 8 and Figure 11. It should be noted that this method is not limited to Figure 12 and the specific order described below. It should be understood that in other embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:
[0205] S1201 , the host application 410 requests the target application 430 to add a first application component.
[0206] In some implementations, the host application 410 may request the target application 430 to add the first application component through the first application component management service 420 .
[0207] S1202 , the target application 430 returns data 1 to the host application 410 .
[0208] The data 1 obtained by the host application 410 can be used as the second data mentioned above.
[0209] S1203 , the host application 410 displays the first application component based on the data 1 and stores the data 1 persistently.
[0210] The data 1 in the persistent storage area can be used as the first data mentioned above.
[0211] In some implementations, the host application 410 may store the data 1 in a persistent storage area corresponding to the host application 410 .
[0212] In some embodiments, the host application 410 may render and generate a view 1 of the first application component based on the acquired data 1, and then display the view 1. The rendered view 1 may be stored in a cache area, and the view 1 may serve as the third data mentioned above.
[0213] S1204 , when the host application 410 is switched to the background, the cache occupied by views of some or all application components belonging to the host application 410 is released.
[0214] Releasing the cache occupied by views of some or all application components belonging to the host application 410 may include deleting the view of each application component in the cache.
[0215] In some implementations, views of some or all application components may include View 1 .
[0216] S1205 , when the host application 410 is switched to the foreground, the first application component is displayed based on the data 1 in the persistent storage area.
[0217] In some embodiments, the host application 410 can obtain data 1 from the persistent storage area, re-render and generate view 1 of the first application component based on data 1, and then display view 1.
[0218] S1206 , the target application 430 sends data 2 to the host application 410 .
[0219] The data 2 can be used to update the first application component for display, and can be used as the second data mentioned above.
[0220] In some embodiments, the host application 410 may launch the target application 430 and request the target application 430 to update the first application component. In response to the request, the target application 430 returns data 2 to the host application 410 .
[0221] In some implementations, the target application 430 may send the data 2 to the host application 410 through the application component management service 420 .
[0222] S1207 , the host application 410 updates the displayed first application component based on data 2 , and updates data 1 in the persistent storage area to data 2 .
[0223] The data 2 in the persistent storage area can be used as the first data mentioned above.
[0224] In some embodiments, the host application 410 may overwrite the data 1 in the persistent storage area. In other embodiments, the host application 410 may delete the data 1 and save the data 2.
[0225] S1208 , the host application 410 deletes data 2 in the persistent storage area.
[0226] S1209 , the host application 410 requests the target application 430 to delete the first application component.
[0227] Host application 410 can delete data 2 from the persistent storage area and the first application component. After that, host application 410 can again request target application 430 to add the first application component. It is also understandable that host application 410 can first delete data 2 from the persistent storage area and then delete the first application component, or first delete the first application component and then delete data 2 from the persistent storage area.
[0228] In some implementations, the host application 410 may request the target application 430 to delete the first application component through the application component management service 420 .
[0229] S1210, the target application 430 deletes the first application component.
[0230] In the method shown in FIG. 12 , steps S1201-S1203 add a first application component to host application 410 and persistently store data corresponding to the first application component; steps S1204-S1205 switch host application 410 between the foreground and background; steps S1206-S1207 update persistently stored data corresponding to the first application component and update the displayed first application component; and steps S1208-S1210 delete the data corresponding to the first application component and the first application component from host application 410. It is understood that at least one of steps S1201-S1209 may be omitted, the order of at least two of steps S1201-S1209 may be reversed, and at least one of steps S1201-S1210 may be performed multiple times.
[0231] For example, S1204-S1205 can be executed multiple times to implement multiple foreground and background switching of the first application component; S1206-S1207 can be executed multiple times to implement multiple updates of data corresponding to the first application component in the persistent storage area and / or updates of the displayed first application component.
[0232] For another example, the order of executing S1204-S1205 may be after the order of executing S1206-S1207, that is, first updating the data corresponding to the first application component in the persistent storage area and / or updating the displayed first application component, and then switching the first application component between the foreground and the background.
[0233] For another example, S1206 and S1207 may be executed after S1204, so that when the first application component is switched to the background, the data corresponding to the first application component in the persistent storage area is updated, and S1204 may be executed again after S1207, so that when the first application component is switched to the foreground, the first application component is displayed based on the updated data corresponding to the first application component in the persistent storage area.
[0234] For another example, S1208 may be executed but S1209 may not be executed, that is, only the data corresponding to the first application component in the persistent storage area may be deleted, but the first application component may be retained. Then, when the first application component needs to be displayed later, the host application 410 may obtain the data corresponding to the first application component from the target application 430 again.
[0235] 13 is a schematic diagram of a device 1300 for displaying application components according to an embodiment of the present invention. The device 1300 includes an acquisition module 1301 and a display module 1302 .
[0236] An acquisition module 1301 is configured to acquire first data from a persistent storage area in response to a first operation, wherein the first operation is configured to trigger display of a first application component, and the first data includes at least a portion of data corresponding to the first application component;
[0237] The display module 1302 is configured to display the first application component based on the first data.
[0238] In some embodiments, the acquisition module 1301 is further configured to, in response to the first operation, acquire second data from the target application corresponding to the first application component, where the second data includes at least a portion of the data corresponding to the first application component;
[0239] Display module 1302 is further configured to display the first application component based on the first data if the first data is acquired earlier than the second data, and update the displayed first application component based on the second data. If the first data is acquired at a time equal to or later than the second data, display the first application component based on the second data.
[0240] In some embodiments, the acquisition module 1301 is further used to obtain second data from the target application corresponding to the first application component, where the second data includes at least part of the data corresponding to the first application component; the display module 1302 is further used to update the displayed first application component based on the second data.
[0241] In some implementations, the device 1300 is further configured to launch the target application.
[0242] In some embodiments, the apparatus 1300 further comprises:
[0243] The update module is used to update the first data in the persistent storage area based on the second data.
[0244] In some embodiments, the apparatus 1300 further comprises:
[0245] The deletion module is used to delete third data from the cache area if the host application of the first application component switches from the foreground to the background, where the third data is used to display some or all application components belonging to the host application, including the first application component.
[0246] In some embodiments, the deletion module is further configured to:
[0247] If a first condition is satisfied, the third data is deleted from the cache area, wherein the first condition includes at least one of the following:
[0248] The duration for which the host application is switched to the background is greater than or equal to the first duration;
[0249] The number of application components belonging to the host application is greater than or equal to the first number;
[0250] The duration since the third data was last deleted from the cache area is greater than or equal to the second duration.
[0251] In some embodiments, the persistent storage area includes a device encrypted storage area;
[0252] The acquisition module 1301 is further configured to acquire the first data from the device encryption storage area before the electronic device where the first application component is located is unlocked.
[0253] The device 1300 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0254] Based on the same inventive concept, an embodiment of the present application further provides an electronic device comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the method described in the above method embodiment when the computer program is called.
[0255] The electronic device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.
[0256] Based on the same inventive concept, an embodiment of the present application further provides a chip system, which includes a processor coupled to a memory, and executes a computer program stored in the memory to implement the method described in the above method embodiment.
[0257] The chip system may be a single chip or a chip module composed of multiple chips.
[0258] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in the above method embodiment is implemented.
[0259] An embodiment of the present application further provides a computer program product. When the computer program product is run on an electronic device, the electronic device implements the method described in the above method embodiment when executing the computer program product.
[0260] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may at least include: any entity or device capable of carrying computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.
[0261] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0262] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0263] In the embodiments provided in this application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0264] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0265] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0266] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0267] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0268] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0269] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for displaying an application component, characterized in that: include: In response to a first operation, obtaining first data from a persistent storage area, wherein the first operation is used to trigger display of a first application component, and the first data includes at least part of data corresponding to the first application component; Based on the first data, the first application component is displayed.
2. The method according to claim 1, characterized in that The method further comprises: Acquire second data from a target application corresponding to the first application component, where the second data includes at least part of the data corresponding to the first application component; Based on the second data, the displayed first application component is updated.
3. The method according to claim 2, characterized in that The method further comprises: Based on the second data, the first data in the persistent storage area is updated.
4. The method according to any one of claims 1 to 3, characterized in that: The first operation is a power-on operation or a restart operation, or the first operation is an operation of switching a host application of the first application component from a background to a foreground.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: If the host application of the first application component switches from the foreground to the background, third data is deleted from the cache area, and the third data is used to display some or all application components belonging to the host application, and the some or all application components include the first application component.
6. The method according to claim 5, characterized in that The third data includes views of the part or all of the application components belonging to the host application.
7. The method according to claim 5 or 6, characterized in that: The deleting the third data from the buffer area includes: If a first condition is met, deleting the third data from the cache area, wherein the first condition includes at least one of the following: The duration for which the host application is switched to the background is greater than or equal to the first duration; The number of application components belonging to the host application is greater than or equal to a first number; The duration from the last deletion of the third data from the cache area is greater than or equal to the second duration.
8. The method according to any one of claims 1 to 7, characterized in that: The first data includes at least one of text data corresponding to the first application component, image data corresponding to the first application component, configuration data corresponding to the text data, and configuration data corresponding to the image data.
9. The method according to any one of claims 1 to 8, characterized in that: The persistent storage area includes a device encryption storage area, and obtaining the first data from the persistent storage area includes: Before the electronic device where the first application component is located is unlocked, the first data is obtained from the device encryption storage area.
10. A device for displaying application components, characterized in that: include: an acquisition module, configured to acquire first data from a persistent storage area in response to a first operation, wherein the first operation is used to trigger display of a first application component, and the first data includes at least part of data corresponding to the first application component; A display module is used to display the first application component based on the first data.
11. The device according to claim 10, characterized in that The acquisition module is further configured to acquire second data from a target application corresponding to the first application component, wherein the second data includes at least part of the data corresponding to the first application component; The display module is further used to update the displayed first application component based on the second data.
12. The device according to claim 11, characterized in that The device also includes: An updating module is used to update the first data in the persistent storage area based on the second data.
13. The device according to any one of claims 10 to 12, characterized in that: The device also includes: A deletion module is used to delete third data from a cache area if the host application of the first application component switches from the foreground to the background, wherein the third data is used to display some or all application components belonging to the host application, and the some or all application components include the first application component.
14. An electronic device, characterized in that: include: A memory and a processor, the memory being used to store a computer program; and the processor being used to execute the method according to any one of claims 1 to 9 when calling the computer program.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
16. A computer program product, characterized in that When the computer program product is run on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 9.