Display state determination method and electronic equipment
By sending display status parameters in the Widget component, the problem of insufficient Widget functionality is solved, enabling richer features and more efficient resource management, thus improving the user experience.
Patent Information
- Application Number
- CN202410397754.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-02
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-04-02
AI Technical Summary
At present, the functions of Widget are limited and cannot meet the growing needs of users.
In response to the operation, the first application sends parameters to the second application to indicate the display state of the Widget component. The second application determines the display state of the Widget component based on the parameters, including the hidden state and the visible state, and sends parameters to optimize resource usage when preset conditions are met.
It enriches the functionality of Widgets, improves the user experience, optimizes system resource usage, and enhances the timeliness and security of Widget components.
Smart Images

Figure CN120821518A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and more particularly, to a method for determining a display state and an electronic device. Background Art
[0002] A widget is a small component in the Android system that typically displays the content of one application within the display interface of another application. For example, the weather widget displayed on the desktop is a component that displays the content of a weather application via a widget.
[0003] However, at the current stage, the functions that Widget can achieve are limited and cannot meet the growing needs of users.
[0004] Based on this, how to enrich the functions of Widget has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a method for determining a display state, which can enrich the functionality of a Widget.
[0006] In a first aspect, a method for determining a display state is provided, the method being applied to an electronic device, comprising:
[0007] In response to a first operation, the first application sends a first parameter to the second application. The first parameter is used to indicate the display state of the first component, where the display state includes a hidden state and a visible state. The first application is an application that displays the first component, and the second application is an application that provides display data for the first component. The first operation is used to modify the display state of the first component, and the first component is a component generated based on a widget.
[0008] The second application determines a display state of the first component based on the first parameter.
[0009] The first application is equivalent to a Widget host application, the second application is equivalent to a Widget providing application, and the first component is equivalent to a Widget component.
[0010] A method for determining a display state provided in an embodiment of the present application is applied to an electronic device, including: in response to a first operation, a first application sends a first parameter to a second application, the first parameter is used to indicate the display state of a first component, the display state includes a hidden state and a visible state, the first application is an application that displays the first component, the second application is an application that provides display data for the first component, the first operation is used to modify the display state of the first component, the first component is a component generated based on a widget, and the second application determines the display state of the first component based on the first parameter. In this way, the second application that provides display data for the widget component can determine the display state of the widget component based on the first parameter. Compared with traditional methods, the embodiment of the present application enriches the functionality of the widget.
[0011] In combination with the first aspect, in certain embodiments of the first aspect, the electronic device includes a first module, the first module includes a first unit, and the first application sends a first parameter to the second application, including: the first application sends the first parameter to the first unit in the first module; the first unit of the first module receives the first parameter and sends the first parameter to the second application.
[0012] The first module is equivalent to the Widget lifecycle control module in the basic service layer, and the first unit is equivalent to the lifecycle management unit in the Widget lifecycle control module.
[0013] In combination with the first aspect, in certain embodiments of the first aspect, the first module also includes a second unit, and the first unit of the first module receives the first parameter and sends the first parameter to the second application, including: the first unit receives the first parameter and instructs the second unit to determine whether the status of the electronic device meets the preset conditions; if the status of the electronic device meets the preset conditions, the second unit instructs the first unit to send the first parameter to the second application.
[0014] Among them, the second unit is equivalent to the rule execution unit.
[0015] The method for determining the display status provided in an embodiment of the present application first instructs the second unit to determine whether the status of the electronic device meets the preset conditions when the first application sends the first parameter to the second application, and then instructs the first unit to send the first parameter to the second application when the status of the electronic device meets the preset conditions. This is equivalent to sending the first parameter only when the status of the electronic device meets the preset conditions, so that the second application determines the display status of the Widget component based on the first parameter, which can avoid the situation where the second application determines the display status of the Widget component based on the first parameter and occupies system resources when the status of the electronic device is not suitable.
[0016] In conjunction with the first aspect, in certain embodiments of the first aspect, the preset condition includes:
[0017] The first component is a component in the preset list;
[0018] The time interval between two consecutive displays of the first component is shorter than the preset time interval;
[0019] The power level of the electronic device is higher than the preset power threshold;
[0020] The temperature of the electronic device is lower than a preset temperature threshold.
[0021] It is understandable that when the power level of the electronic device is higher than the preset power threshold and the temperature of the electronic device is lower than the preset temperature threshold, the electronic device is in a normal working state.
[0022] The preset list may be a list determined based on a user's selection.
[0023] In combination with the first aspect, in certain embodiments of the first aspect, the preset conditions are stored in the cloud server, and the second unit determines whether the status of the electronic device meets the preset conditions, including: the second unit requests the cloud server to obtain the preset conditions; the cloud server sends the preset conditions to the second unit; and the second unit determines whether the status of the electronic device meets the preset conditions.
[0024] In the method for determining the display status provided in the embodiment of the present application, the preset conditions are stored in the cloud server. When the second unit determines whether the status of the electronic device meets the preset conditions, it needs to request the preset conditions from the cloud server. Then, after receiving the preset conditions sent by the cloud server, it can determine whether the status of the electronic device meets the preset conditions. Since the preset conditions are stored in the cloud server, the preset conditions will not be lost due to storage failures in the electronic device. This can improve the security of the preset conditions and thus improve the reliability of determining whether the status of the electronic device meets the preset conditions. At the same time, the preset conditions are stored in the cloud server, so that storing the preset conditions will not occupy the memory of the electronic device.
[0025] In combination with the first aspect, in certain embodiments of the first aspect, the preset condition is stored in the second unit, and the second unit determines whether the state of the electronic device meets the preset condition, including: the second unit reads the pre-stored preset condition; the second unit determines whether the state of the electronic device meets the preset condition.
[0026] In the method for determining the display status provided in an embodiment of the present application, the preset conditions are stored in the second unit. When the second unit determines whether the status of the electronic device meets the preset conditions, it only needs to read the pre-stored preset conditions to determine whether the status of the electronic device meets the preset conditions. In this way, the electronic device does not need to obtain the preset conditions from the cloud server, avoiding the situation where the preset conditions cannot be obtained due to communication failure between the electronic device and the cloud server.
[0027] In combination with the first aspect, in certain embodiments of the first aspect, the value of the first parameter includes a first value, and the first value is used to indicate that the first component is in a visible state. The second application determines the display state of the first component based on the first parameter, including: the second application parses the first parameter to obtain the value of the first parameter; if the value of the first parameter is the first value, then the display state of the first component is determined to be a visible state.
[0028] It's understood that the first parameter can be the extras parameter in the intent, where the intent is parsed by overriding the OnReceive() method of the App Widget Provider base class. The value of the first parameter can be the value of the key "WIDGET_LIFECYCLE" in the extras parameter. If the key "WIDGET_LIFECYCLE" in the extras parameter is "Onshow", the value of the first parameter is the first value.
[0029] In combination with the first aspect, in certain embodiments of the first aspect, the value of the first parameter also includes a second value, and the second value is used to indicate that the first component is in a hidden state. The method also includes: if the value of the first parameter is the second value, determining that the display state of the first component is a hidden state.
[0030] It's understood that the first parameter can be the extras parameter in the intent, where the intent is parsed by overriding the OnReceive() method of the App Widget Provider base class. The value of the first parameter can be the value of the key "WIDGET_LIFECYCLE" in the extras parameter. If the value of the key "WIDGET_LIFECYCLE" in the extras parameter is "Onhide", the value of the first parameter is the second value.
[0031] In combination with the first aspect, in certain embodiments of the first aspect, the method further includes: if the display state of the first component is a visible state, updating the first component according to a preset period; if the display state of the first component is a hidden state, stopping updating the first component according to the preset period.
[0032] The method for determining the display status provided in the embodiment of the present application is, when it is determined that the display status of the first component is a visible state, updating the first component according to a preset period. When the display status of the first component is a visible state, the user is usually more willing to view the display content of the first component. Therefore, updating the first component according to the preset period can be more in line with the user's wishes and improve the user experience; when the display status of the first component is a hidden state, stopping updating the first component according to the preset period. When the display status of the first component is a hidden state, the user is less willing to view the display content of the first component. Therefore, stopping updating the first component according to the preset period can reduce the system resources consumed by updating the first component in the electronic device.
[0033] In combination with the first aspect, in some embodiments of the first aspect, the method further includes: determining the number of times the first component is displayed based on the display state of the first component.
[0034] For example, since the first application sends the first parameter to the second application in response to the first operation of modifying the display state of the first component, each time the first parameter is sent to the second application, the display state of the first component changes. The electronic device only needs to count the number of times the first parameter is received to determine the number of times the first component is displayed.
[0035] In combination with the first aspect, in some embodiments of the first aspect, the method further includes: the second application determining the number of times the first component is displayed based on the display state of the first component.
[0036] It is understandable that the second application is an application that provides display data for the first component, that is, the second application is an application that provides the first component. Therefore, the second application can determine the display times of the first component based on the number of times the first parameter is obtained statistically.
[0037] In combination with the first aspect, in some embodiments of the first aspect, the first component is a widget component, the first application is a widget host application, and the second application is an application that provides display data for the widget component.
[0038] In combination with the first aspect, in certain embodiments of the first aspect, the method also includes: in response to the second operation, the first application sends a second parameter to the second application, where the second parameter is used to indicate the addition of the first component; the second application sends first data to the first application based on the second parameter, where the first data is data for adding the first component; and the first application adds the first component based on the first data.
[0039] The second parameter may refer to the onEnable() function, and the first data may refer to the remoteViews required to add the Widget component.
[0040] In combination with the first aspect, in certain embodiments of the first aspect, the above-mentioned response to the second operation, the first application sends the second parameter to the second application, including: in response to the second operation, the first application sends the second parameter and the third parameter to the second application, the third parameter is used to indicate the update of the first component; the second application sends second data to the first application based on the third parameter, the second data is data for updating the first component; the first application updates the first component based on the second data.
[0041] The second parameter may refer to the onEnable() function, and the second data may refer to the remoteViews required to update the Widget component.
[0042] In combination with the first aspect, in certain embodiments of the first aspect, the method also includes: the first application sends a third parameter to the second application according to a preset period, and the third parameter is used to indicate the update of the first component; the second application sends second data to the first application based on the third parameter, and the second data is data for updating the first component; the first application updates the first component based on the second data.
[0043] Among them, the third parameter may refer to the onAppWidgetOptionsChanged() function, and the second data may refer to the remoteViews required to update the Widget component.
[0044] An embodiment of the present application provides a method for determining a display status, in which a first application sends a third parameter to a second application according to a preset period, where the third parameter is used to indicate an update of a first component; the second application sends second data to the first application based on the third parameter, where the second data is data for updating the first component; the first application updates the first component based on the second data, so that the first component can be periodically updated according to a preset period, thereby improving the timeliness of displaying the first component.
[0045] In combination with the first aspect, in certain embodiments of the first aspect, the method also includes: in response to a third operation, the first application sends a third parameter to the second application, and the third parameter is used to indicate the deletion of the first component; the second application clears the running data of the first component based on the third parameter.
[0046] The third parameter may refer to an onDisable() function and / or an onDeleted() function. Clearing the running data of the first component may include releasing resources or stopping background services to clean up system resources, or releasing all Widget component resources.
[0047] Exemplarily, when the third parameter is the onDeleted() function, clearing the running data of the first component may mean releasing resources or stopping background services to clean up system resources.
[0048] Exemplarily, when the third parameter is the onDisable() function, clearing the running data of the first component may refer to releasing all Widget component resources.
[0049] In a second aspect, a device for determining a display state is provided, comprising a unit for executing any of the methods described in the first aspect. The device may be a server, a terminal device, or a chip within the terminal device. The device may include an input unit and a processing unit.
[0050] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory for storing computer program code, and when the processor executes the computer program code stored in the memory, the terminal device executes any one of the methods in the first aspect.
[0051] When the device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect.
[0052] In one possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to perform: in response to a first operation, a first application sends a first parameter to a second application, the first parameter is used to indicate the display state of a first component, the display state includes a hidden state and a visible state, the first application is an application that displays the first component, the second application is an application that provides display data for the first component, the first operation is used to modify the display state of the first component, and the first component is a component generated based on a widget; the second application determines the display state of the first component based on the first parameter.
[0053] In a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by a function calling device, the function calling device executes any one of the display status determination methods in the first aspect.
[0054] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed by a function calling device, causes the function calling device to execute any one of the device methods in the first aspect.
[0055] A method for determining a display state provided in an embodiment of the present application is applied to an electronic device, including: in response to a first operation, a first application sends a first parameter to a second application, the first parameter is used to indicate the display state of a first component, the display state includes a hidden state and a visible state, the first application is an application that displays the first component, the second application is an application that provides display data for the first component, the first operation is used to modify the display state of the first component, the first component is a component generated based on a widget, and the second application determines the display state of the first component based on the first parameter. In this way, the second application that provides display data for the widget component can determine the display state of the widget component based on the first parameter. Compared with traditional methods, the embodiment of the present application enriches the functionality of the widget. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a software structure diagram of an electronic device at this stage;
[0057] Figure 2 is a software structure block diagram of an electronic device applicable to an embodiment of the present application;
[0058] Figure 3 This is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0059] Figure 4 This is a flow chart of a method for determining a display state provided in an embodiment of the present application;
[0060] Figure 5 is a flowchart of a method for determining whether to transmit an exposure event provided by an embodiment of the present application;
[0061] Figure 6 is a flowchart of another method for determining a display state provided in an embodiment of the present application;
[0062] Figure 7 1 is a flow chart of a method for determining the type of event to be transmitted provided in an embodiment of the present application;
[0063] Figure 8 is a flowchart of another method for determining a display state provided in an embodiment of the present application;
[0064] Figure 9 is a schematic diagram of another application scenario provided by an embodiment of the present application;
[0065] Figure 10 is a schematic diagram of another application scenario provided by an embodiment of the present application;
[0066] Figure 11 is a flowchart of another method for determining a display state provided in an embodiment of the present application;
[0067] Figure 12 is a flowchart of another method for determining a display state provided in an embodiment of the present application;
[0068] Figure 13 The figure is a schematic diagram of a hardware system of an electronic device applicable to the present application. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0070] In the following, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the technical features indicated. Therefore, a feature specified as "first," "second," or "third" may explicitly or implicitly include one or more of the features.
[0071] To facilitate understanding, some of the examples given are provided for reference to the description of concepts related to the embodiments of the present application.
[0072] 1. Widget.
[0073] A widget is a small component in the Android system that typically displays the content of one application within the display interface of another application. For example, a weather widget displayed on the desktop is a widget that displays the content of the weather application within the desktop application.
[0074] 2. Widget host application.
[0075] A widget host application can refer to an application that displays related content. For example, when content from a weather application is displayed on a desktop application, the widget host application refers to the desktop application.
[0076] 3. Provide Widget application.
[0077] Providing a Widget application may refer to providing an application program for displaying content. For example, when displaying content in a weather application on a desktop application, providing a Widget application refers to the weather application.
[0078] 4. Widget component.
[0079] A widget component may refer to a component that displays widget application information on a widget host application. For example, when displaying content from a weather application on a desktop application, the widget component refers to a component that displays the content from the weather application on the desktop application.
[0080] Currently, electronic devices can display static information or provide interactive operations through widgets. By using widgets, developers can provide users with a more convenient way to view application information and perform related operations, improving the user experience. The functions that widgets can achieve include:
[0081] A. Add the Widget component to the Widget host application.
[0082] Electronic devices can add widget components to a widget host application using the onEnable() method. When adding a widget component, developers can perform initialization settings. For example, initialization settings include starting a background service or registering a broadcast receiver.
[0083] B. Update the Widget component.
[0084] An electronic device can update a widget component at a preset interval, thereby updating the widget component. For example, an electronic device can update the text and / or images displayed in a widget component at a preset interval. When the update time indicated by the preset interval arrives, the electronic device calls the onUpdate() function to update the widget component.
[0085] C. Adjust the size of the Widget component.
[0086] Electronic devices can layout and display widget components in different sizes. When the size of a widget component changes, the electronic device can call the onAppWidgetOptionsChanged() function to change the size of the widget component.
[0087] D. Remove the Widget component.
[0088] When a Widget component is removed from a Widget host application, some cleanup operations are usually performed, such as releasing resources or stopping background services. The electronic device can call the onDeleted() function to perform the cleanup operation.
[0089] E. Release the Widget component.
[0090] It's understood that a widget host application can include multiple widget components from the same application. For example, a desktop application might display two weather widgets. In this case, when the last weather widget is removed from the desktop application, the corresponding resources can be released. The electronic device can call the onDisable() function to release the widget component's resources.
[0091] The following combination Figure 1 The software structure diagram of the electronic device shown illustrates how the electronic device implements the functions of the above-mentioned Widget.
[0092] The software system of an electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. Below, the Android system with a layered architecture is used as an example to illustrate the software structure of an electronic device.
[0093] like Figure 1 As shown, the layered architecture of electronic devices divides software into several layers, each with clear roles and divisions of labor. Layers communicate with each other via software interfaces. In some embodiments, the Android system is divided into four layers: from top to bottom, the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0094] The application layer may include a series of application packages.
[0095] like Figure 1 As shown, the application package may include applications such as a Widget host application and a Widget providing application.
[0096] The Widget host application may refer to a desktop application or a negative one screen application, which is not limited in the present embodiment. The Widget host application may include a Widget component module, which may be used to process operations related to the Widget component.
[0097] The Widget application may be an application that provides display content of the Widget component. For example, the Widget host application may be a weather application, a calendar application, a music player application, etc., which is not limited in this embodiment of the present application.
[0098] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0099] like Figure 1 As shown, the application framework layer may include a Widget manager, etc.
[0100] The Widget Manager can be used to obtain corresponding data from the Widget-providing application based on the update instructions of the Widget host application. The Widget Manager can also be used to manage the size of the Widget component.
[0101] For example, after the Widget host application sends an update instruction to the Widget manager, the Widget manager sends a broadcast to multiple Widget-providing applications. The broadcast carries at least one of the onEnable() function, onUpdate() function, onAppWidgetOptionsChanged() function, onDeleted() function, and onDisable() function. After receiving the broadcast, the target Widget-providing application corresponding to the Widget component to be updated obtains the relevant business data and returns the relevant business data to the Widget manager. Based on these business data, the Widget manager sends the above-mentioned business data information to the Widget host application. The Widget host application performs corresponding operations based on the business data information.
[0102] It is understandable that the above-mentioned update instruction may instruct at least one of adding the Widget component to the Widget host application, updating the Widget component, adjusting the size of the Widget component, removing the Widget component, and releasing the Widget component. Exemplarily, the update instruction instructs to add the Widget component to the Widget host application, and the Widget manager sends a broadcast carrying the onEnable() function to multiple Widget-providing applications. After receiving the broadcast, the target Widget-providing application parses the broadcast, obtains the onEnable() function, and then returns the business data required to add the Widget component to the Widget host application to the Widget manager based on the onEnable() function. The Widget manager then sends the business data to the Widget host application so that the Widget host application displays the Widget component based on the business data.
[0103] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
[0104] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0105] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0106] The system library can include multiple functional modules.
[0107] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, Wi-Fi drivers, etc.
[0108] It should be noted that the electronic device mentioned in the embodiments of the present application may include more or fewer modules in the above-mentioned electronic devices. For example, the electronic device may also include a memory, a timer, etc.
[0109] It is understood that the update instruction can instruct at least one of adding a widget component to a widget host application, updating a widget component, resizing a widget component, removing a widget component, or releasing a widget component. In other words, at this stage, the widget can only perform the following functions: adding a widget component to a widget host application, updating a widget component, resizing a widget component, removing a widget component, and releasing a widget component. The widget does not support the function of counting the number of times a widget component has been viewed.
[0110] In view of this, a method for determining a display status provided in an embodiment of the present application is applied to an electronic device, including: in response to a first operation, a first application sends a first parameter to a second application, the first parameter is used to indicate the display status of a first component, the display status includes a hidden state and a visible state, the first application is an application that displays the first component, the second application is an application that provides display data for the first component, the first operation is used to modify the display status of the first component, the first component is a component generated based on a widget, and the second application determines the display status of the first component based on the first parameter. In this way, the second application that provides display data for the widget component can determine the display status of the widget component based on the first parameter. Compared with traditional methods, the embodiments of the present application enrich the functions of the widget.
[0111] The method for determining the display state provided in the embodiments of the present application can be applied to electronic devices. Optionally, the electronic device includes a terminal device, which can also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the terminal device.
[0112] The software system of the electronic device to which the display state determination method provided in the embodiment of the present application is applied can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device.
[0113] The layered architecture of electronic devices divides software into several layers, each with distinct roles and divisions of labor. Layers communicate with each other via software interfaces. In some embodiments, the Android system is divided into four layers: from top to bottom, the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer. Optionally, a basic service layer may be included between the application layer and the application framework layer.
[0114] For example, the software structure diagram of the electronic device can be as follows: Figure 2 shown.
[0115] The application layer can include a series of application packages.
[0116] For example, Figure 2 The Widget host application and the Widget providing application shown in .
[0117] The Widget host application may be a desktop application or a negative-one-screen application, and this is not limited in the present embodiment. The following description will take the case where the Widget host application is a desktop application as an example. The desktop application may include a Widget component module and an exposure processing module. The Widget component module may be used to obtain relevant data from the Widget application and process the relevant data. For example, the relevant data may be displayed on the desktop.
[0118] The exposure processing module is used to transmit exposure events. An exposure event can refer to an event that displays a widget component. For example, the widget component is on the negative one screen, and the electronic device is currently displaying the main interface of a desktop application. When the electronic device switches from the desktop application's main interface to the negative one screen in response to a user's swipe, the widget component is exposed once, indicating that an exposure event for the widget component has occurred.
[0119] The provided Widget application can be an application corresponding to a component displayed on the Widget host application through the Widget. For example, a weather application, an audio player application, and a calendar event application. This embodiment of the present application does not limit this.
[0120] Optionally, the basic service layer includes a Widget lifecycle control module.
[0121] The Widget lifecycle control module can receive the exposure event delivered by the exposure processing module, and based on the exposure event, call the Framework interface through the Widget manager to broadcast the exposure event.
[0122] The Widget lifecycle control module can also obtain control rules to determine whether to call the broadcast sending interface in the Widget manager to broadcast the exposure event.
[0123] The Widget lifecycle control module may obtain the control rules from a cloud server or from a target address in an electronic device, which is not limited in this embodiment of the present application.
[0124] The control rules may include whether to allow the Widget component to obtain the number of exposures, the minimum time interval between obtaining two exposures, whether to allow obtaining the number of exposures in low power mode, and whether to allow obtaining the number of exposures in high temperature mode.
[0125] For example, a Widget component can obtain the number of exposures by calling the onShow() function. Each time the onShow() function is called, the Widget component is exposed once.
[0126] For another example, the Widget component can obtain the time difference between two adjacent calls to the onShow() function. If the time difference is greater than the above minimum time interval, the Widget component is exposed twice; if the time difference is less than or equal to the above minimum time interval, the Widget component is exposed once.
[0127] For another example, the Widget component can obtain the remaining power of the electronic device. If the remaining power of the electronic device is greater than a preset power threshold, the Widget component is determined to be exposed once when the onShow() function is called; if the remaining power of the electronic device is less than or equal to the preset power threshold, the onShow() function is not called.
[0128] For another example, the Widget component can obtain the temperature value of the electronic device's temperature sensor. If the temperature value is less than a preset temperature threshold, the Widget component is exposed once when the onShow() function is called; if the temperature value is greater than or equal to the preset temperature threshold, the onShow() function is not called.
[0129] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0130] like Figure 2 As shown, the application framework layer may include a Widget manager, etc.
[0131] The Widget Manager can be used to obtain corresponding data from the Widget-providing application based on the update instructions of the Widget host application. The Widget Manager can also be used to manage the size of the Widget component.
[0132] For example, after the Widget host application sends an update instruction to the Widget manager, the Widget manager sends a broadcast to multiple Widget-providing applications. The broadcast carries at least one of the onEnable() function, onUpdate() function, onAppWidgetOptionsChanged() function, onDeleted() function, onDisable() function, onShow() function, and onHide() function. After receiving the broadcast, the target Widget-providing application corresponding to the Widget component to be updated obtains the relevant business data and returns the relevant business data to the Widget manager. Based on these business data, the Widget manager sends the above-mentioned business data information to the Widget host application. The Widget host application performs corresponding operations based on the business data information.
[0133] It is understandable that the above update instruction may instruct at least one of adding the Widget component to the Widget host application, updating the Widget component, adjusting the size of the Widget component, removing the Widget component, releasing the Widget component, exposing the Widget component, and hiding the Widget component.
[0134] For example, if the update instruction indicates to expose a widget component, the widget manager sends a broadcast containing the onShow() function to multiple widget-providing applications. After receiving the broadcast, the target widget-providing application parses the broadcast and retrieves the onShow() function. Based on the onShow() function, the target widget-providing application determines that the widget component is in the exposed state, that is, the displayed state.
[0135] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
[0136] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0137] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0138] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, Wi-Fi drivers, etc.
[0139] It should be noted that the electronic device mentioned in the embodiments of the present application may include more or fewer modules in the above-mentioned electronic device.
[0140] The application scenarios provided by the embodiments of the present application are described below with reference to the accompanying drawings.
[0141] Figure 3 (a) to Figure 3 (d) is a schematic diagram of an application scenario of the method for determining the display state provided in an embodiment of the present application. Figure 3As shown in (a) in FIG, a weather component 10A1 is displayed on the electronic device desktop interface 10A. The desktop application can be a Widget host application, and the weather component can be a Widget component. At this time, the Widget component is in a visible state, so the number of exposures of the Widget component can be counted. The user slides the display interface 10A from left to right, as shown in FIG. Figure 3 In response to the user's sliding operation, the electronic device display interface switches to the following Figure 3 The interface 10B of the negative one screen shown in (c) in FIG. At this time, the Widget component is in an invisible state. When the user slides the interface 10B from right to left, as shown in FIG. Figure 3 As shown in (d) in the figure, in response to the user's sliding operation, the electronic device display interface switches back to Figure 3 The desktop interface shown in (a) in the figure. At this time, the widget component is visible, so the number of widget component exposures can be counted again.
[0142] In this way, the electronic device can update the widget component when it is in the exposed state. When the widget component is in the unexposed state, the user generally does not care whether the widget component's content changes. Therefore, stopping the widget component from being updated when it is in the unexposed state can avoid unnecessary updates that waste system resources.
[0143] Alternatively, the electronic device may count the number of exposures each time the Widget component is in an exposed state. In some possible cases, the Widget application corresponding to the Widget component needs to determine the number of exposures of the Widget component, thereby providing personalized services to the user based on the number of exposures of the Widget component.
[0144] It should be understood that the above is an example of an application scenario and does not limit the application scenario of this application.
[0145] The following combination Figures 4 to 12 The method for determining the display status provided in the embodiment of the present application is described in detail.
[0146] Figure 4 A flowchart of a method for determining a display state provided in an embodiment of the present application is shown below. Figure 4 The embodiment shown focuses on describing the specific process of how the electronic device adds the Widget component and records an exposure event after adding the Widget component. Figure 4 As shown, the method includes:
[0147] S101 : In response to a user adding a Widget component, the Widget host application obtains a WidgetID from a Widget manager.
[0148] The WidgetID can refer to the identification information corresponding to the added widget component. For example, the widget component added by the user can be a component of a weather application, and the WidgetID is the identification information corresponding to the weather application. The widget host application cannot directly determine the WidgetID of the widget component. Therefore, after the user adds the widget component, the widget host application can request the WidgetID from the widget manager.
[0149] A widget host application may refer to an application that displays a widget component, such as a desktop application or a negative-one-screen application. Components displayed on the desktop or the negative-one-screen are typically widget components.
[0150] S102: The Widget manager allocates a WidgetID.
[0151] Based on the request of the Widget host application, the Widget manager obtains the identification information corresponding to the Widget component added by the user, that is, the WidgetID.
[0152] S103: The Widget manager returns the WidgetID to the Widget host application.
[0153] S104 . The Widget host application obtains remoteViews corresponding to the WidgetID from the Widget manager based on the WidgetID.
[0154] Among them, remoteViews can be used to indicate the size, shape and other information of the Widget component.
[0155] S105: The Widget manager sends a component addition broadcast to the Widget providing application.
[0156] The added component broadcast may include an onEnable() function, so that after the Widget application receives the added component broadcast, it can parse the onEnable() function and then perform initialization settings based on the onEnable() function, such as starting background services or registering broadcast receivers.
[0157] Providing a Widget application may refer to an application corresponding to the display content of the Widget component. For example, if the Widget component is a weather component, providing a Widget application may indicate a weather application; if the Widget component is a music player component, providing a Widget application may indicate a music player application.
[0158] S106: The Widget manager broadcasts to the Widget application update component.
[0159] It's understandable that when a widget is first added, it's also updated. Therefore, when the widget manager sends a widget-adding broadcast to the widget-providing application, it also sends a widget-updating broadcast. This component-updating broadcast can include an onUpdate() function. Upon receiving the widget-providing application's update broadcast, the widget-providing application can parse the onUpdate() function and, based on it, update the widget's display content, such as text and images.
[0160] It should be noted that the Widget application can update the display content of the Widget component when parsing the onUpdate() function, or can update the display content of the Widget component according to a preset period, which is not limited in this embodiment of the present application.
[0161] For example, when a widget component is added for the first time, the electronic device can update the displayed content of the widget component in response to the initial addition of the widget component. This is equivalent to updating the displayed content of the widget component once when the widget component is first displayed. The electronic device can then update the displayed content of the widget component according to a preset period.
[0162] For example, after a Widget component has been added, the electronic device updates the display content of the Widget component once every preset time interval according to a preset cycle.
[0163] S107: Provide the Widget application with remoteViews based on the add component broadcast and the update component broadcast.
[0164] Among them, remoteViews can be used to indicate the size, shape and other information of the Widget component. A Widget application (such as a weather application) can obtain the size, shape and other information of the displayed Widget component (such as a weather component) as remoteViews.
[0165] S108: Provide the Widget application to return remoteViews to the Widget manager.
[0166] A Widget application (eg, a weather application) can return remoteViews that display information such as the size and shape of the Widget component (eg, a weather component) to the Widget manager.
[0167] S109. The Widget manager sends an update instruction to the Widget host application, wherein the update instruction carries remoteViews.
[0168] S110 : The Widget host application adds a Widget component based on the update instruction.
[0169] The Widget host application (eg, a desktop application) may display the Widget component (eg, a weather component) on the desktop based on the remoteViews carried in the update instruction.
[0170] The electronic device has successfully added the widget component to the widget host application, meaning that the widget component is displayed on the widget host application. The widget host application then transmits an exposure event to the widget providing application, indicating that the widget component has been exposed once. This is explained in detail below through steps S111 to S129.
[0171] S111 . The Widget host application transmits a first event to an event distribution unit in a Widget lifecycle control module.
[0172] The Widget lifecycle control module may include an event distribution unit. When determining that the current event is an exposure event, the event distribution unit may transmit the exposure event to other units in the Widget lifecycle control module, for example, to the lifecycle management unit.
[0173] The Widget component on the Widget host application can include two states, a visible state and a hidden state. The Widget component on the Widget host application is not always in a visible state. For example, the desktop application is displayed through multiple interfaces, namely the first screen interface, the second screen interface and the third screen interface, and the weather component is displayed on the second screen interface. When the user slides the display interface of the mobile phone to the second screen interface, the weather component is displayed on the second screen interface, and the weather component is in a visible state. When the user slides the display interface of the mobile phone to the first screen interface, or the third screen interface, the weather component is not displayed thereon, and the weather component is in a hidden state. When the Widget component switches from a hidden state to a visible state, it is equivalent to the Widget component being exposed once.
[0174] After a user performs any operation in a widget host application, the widget host application transmits a first event to the event dispatch unit in the widget lifecycle control module. This first event can be used to indicate the current user operation performed in the widget host application. The widget host application can include an exposure processing module. When a widget component switches from a hidden state to a visible state, or vice versa, the exposure processing module can record the operation and send a first event indicating the user operation to the event dispatch unit in the widget lifecycle control module.
[0175] S112. The event distribution unit identifies whether the first event is an exposure event.
[0176] If the first event is an operation in which the user switches the Widget component from a hidden state to a visible state, the first event is an exposure event; if the first event is an operation in which the user switches the Widget component from a visible state to a hidden state, the first event is a hiding event.
[0177] If the first event is an exposure event, the event distribution unit identifies and transmits the exposure event to the lifecycle management unit in the Widget lifecycle control module, that is, executing S113.
[0178] S113. The event distribution unit transmits the exposure event to the lifecycle management unit.
[0179] The lifecycle management unit is the core unit in the Widget Lifecycle Control Module, responsible for receiving external events such as exposure, hiding, and removal. It also schedules the rule processing management unit, rule execution management unit, and rule execution unit in the Widget Lifecycle Control Module to handle external events. Based on the processing results, it then determines whether to call the framework interface to send an update broadcast.
[0180] After receiving the exposure event from the event distribution unit, the lifecycle management unit can obtain a rule list from the rule execution management unit in the widget lifecycle control module. The rule list includes multiple preset conditions. Only when the electronic device meets the preset conditions will it further transmit the widget exposure event to the widget providing application.
[0181] S114. The lifecycle management unit obtains a rule list from the rule execution management unit.
[0182] It is understandable that the rule list can be stored in the cloud server or in the Widget lifecycle control module, and the embodiment of the present application does not limit this.
[0183] The rule execution management unit can be used to obtain a rule list, for example, from a cloud server, or from a Widget lifecycle control module, which is not limited in this embodiment of the present application. The following example illustrates the rule execution management unit obtaining a rule list from a cloud server.
[0184] The rule list can include multiple preset conditions. For example, the rule list may include a whitelist of whether the widget component module in the widget host application is allowed to call the onShow() function, the minimum time interval between two onShow() calls, whether the onShow() function is allowed to be called when the electronic device is in low power mode, and whether the onShow() function is allowed to be called when the electronic device is in high temperature mode.
[0185] In one possible scenario, the rule list may be stored in a cloud server, and the rule execution management unit may send a request to the cloud server to obtain the rule list, so that the cloud server responds to the request and returns the rule list to the execution management unit, that is, executing S115 and S116.
[0186] S115. The rule execution management unit requests the cloud server to obtain a rule list.
[0187] S116. The cloud server returns the rule list to the rule execution management unit.
[0188] S117: The rule execution management unit creates a rule execution list based on the rule list.
[0189] The rule execution list is created according to the multiple rules in the rule list. In the rule execution list, the multiple rules in the rule list are arranged in order so that the electronic device can execute the corresponding rules in order.
[0190] S118. The rule execution management unit returns the rule execution list to the lifecycle management unit.
[0191] S119. The lifecycle management unit instructs the rule processing management unit to create a rule processing chain.
[0192] The rule processing chain may indicate an execution chain of a preset rule sequence, and the electronic device may execute each rule in sequence according to the sequence of each rule in the rule processing chain.
[0193] S120: The rule processing management unit returns the rule processing chain to the lifecycle management unit.
[0194] S121. The rule processing management unit instructs the rule execution unit to execute the rule processing chain.
[0195] In one possible scenario, the execution order of the individual rules in the rule processing chain is as follows:
[0196] 1. Determine whether the current Widget component is a Widget component in the whitelist;
[0197] 2. Determine whether the time interval between two consecutive exposures of the Widget component is greater than the above minimum time interval;
[0198] 3. Whether the electronic device is in a low-battery state;
[0199] 4. Check that the electronic equipment is not in high temperature mode.
[0200] The electronic device may determine whether the state of the electronic device matches each rule in the rule list according to the execution order of each rule in the rule processing chain.
[0201] S122: The rule execution unit executes the rule processing chain to determine whether the status of the electronic device matches the i-th rule in the rule list.
[0202] The electronic device can determine whether the state of the electronic device matches the rules in the rule list according to the order of each rule in the rule processing chain. If the state of the electronic device matches the rules in the rule list, the matching result is returned to the rule processing management unit, that is, executing S123. If the state of the electronic device does not match the rules in the rule list, the rule processing chain is returned to determine whether the state of the electronic device matches the i-th rule in the rule list, that is, S122, until all rules in the rule list are executed.
[0203] For example, Figure 5 As shown, the rule execution unit may first determine whether the state of the electronic device matches the first rule in the rule list, that is, whether the current Widget component is a Widget component in the whitelist.
[0204] If the current Widget component is a Widget component in the whitelist, then the process returns to determine whether the state of the electronic device matches the second rule in the rule list, that is, whether the time interval between two consecutive exposures of the current Widget component is greater than the minimum time interval.
[0205] If the current Widget component is not a Widget component in the whitelist, it means that the state of the electronic device matches the rule, and the matching result can be directly returned to the rule processing management unit, that is, S123 is executed. The matching result indicates that the exposure event is not transmitted.
[0206] It should be noted that if the current Widget component is not a Widget component in the whitelist, it means that the user does not care whether the current Widget component is exposed. Therefore, in this case, not transmitting the exposure event can reduce unnecessary resource overhead in the electronic device.
[0207] If it is determined that the time interval between two consecutive exposures of the current Widget component is greater than the minimum time interval, then the process returns to determining whether the state of the electronic device matches the third rule in the rule list, that is, determining whether the electronic device is in a low-battery state.
[0208] If it is determined that the time interval between two consecutive exposures of the current Widget component is less than or equal to the minimum time interval, it means that the state of the electronic device matches the rule, and the matching result can be directly returned to the rule processing management unit, that is, S123 is executed. The matching result indicates that the exposure event is not transmitted.
[0209] It should be noted that if the time interval between two consecutive exposures of the current Widget component is less than or equal to the minimum time interval, it means that the two consecutive exposures of the current Widget component were performed within a short period of time, which may be caused by the screen being swiped quickly. This situation may be caused by user error or other objects rubbing against the screen and does not truly reflect the user's intention. Therefore, if the time interval between two consecutive exposures of the current Widget component is less than or equal to the minimum time interval, the exposure event is not transmitted. This can improve the accuracy of the determined exposure events.
[0210] If it is determined that the electronic device is not in a low power state, the process returns to determining whether the state of the electronic device matches the fourth rule in the rule list, that is, determining whether the electronic device is in a high temperature mode.
[0211] If it is determined that the electronic device is in a low power state, it means that the state of the electronic device matches the rule, and the matching result can be directly returned to the rule processing management unit, that is, S123 is executed. The matching result indicates that the exposure event is not transmitted.
[0212] It should be noted that when an electronic device is in a low-battery state, it typically disables several lower-priority functions to extend its usability. Therefore, not transmitting exposure events when the electronic device is in a low-battery state can extend the remaining battery life and meet user needs.
[0213] If it is determined that the electronic device is not in the high temperature mode, the matching result is returned to the rule processing management unit, that is, S123 is executed. The matching result indicates that the exposure event is transmitted.
[0214] If it is determined that the electronic device is in the high temperature mode, a matching result is returned to the rule processing management unit, that is, S123 is executed. The matching result indicates that the exposure event is not transmitted.
[0215] It should be noted that when the electronic device is in high temperature mode, failures are prone to occur during operation. Therefore, when the electronic device is in high temperature mode, not transmitting exposure events can reduce the probability of failures.
[0216] S123: The rule execution unit returns the matching result to the rule processing management unit.
[0217] S124. The rule processing management unit returns the matching result to the lifecycle management unit.
[0218] S125. The lifecycle management unit determines whether to send an exposure event to the Widget providing application based on the matching result.
[0219] As shown in S123 above, if the state of the electronic device matches all the rules in the rule list, the returned matching result indicates that the exposure event is delivered; if the state of the electronic device does not match any rule in the rule list, the returned matching result indicates that the exposure event is not delivered.
[0220] If the matching result indicates that the exposure event is to be delivered, the lifecycle management unit may send the exposure event to the Widget providing application. If the lifecycle management unit determines to send the exposure event to the Widget providing application based on the matching result, the Framework interface is called to send the exposure event, that is, S126 is executed.
[0221] If the matching result indicates that the exposure event is not to be delivered, the lifecycle management unit does not send the exposure event to the Widget providing application.
[0222] S126. The lifecycle management unit calls the Framework interface through the Widget manager.
[0223] It is understandable that the data transmission between the Widget manager and the Widget providing application is carried out through the Framework interface. Therefore, when the lifecycle management unit transmits the exposure event to the Widget providing application, the Framework interface should be called first.
[0224] S127. The Widget manager returns the interface call result to the lifecycle management unit.
[0225] In one possible case, the Widget manager successfully calls the Framework interface, and the interface call result returned by the Widget manager to the lifecycle management unit indicates that the Framework interface has been successfully called. In this way, the Widget manager can call the Framework interface to send a component exposure broadcast to the Widget providing application without repeatedly calling the Framework interface.
[0226] In one possible scenario, for example, if a communication failure occurs between the lifecycle management unit and the Widget manager, and the Widget manager fails to successfully call the Framework interface, the interface call result returned by the Widget manager to the lifecycle management unit indicates that the Framework interface was not successfully called. In this case, the lifecycle management unit can call the Framework interface again to ensure that the Framework interface can be successfully called, and further ensure that the component exposure broadcast is sent to the Widget application through the Framework interface.
[0227] S128. The Widget manager calls the Framework interface to send a component exposure broadcast to the Widget-providing application.
[0228] The component exposure broadcast, also known as the App Widget Update broadcast, can be used to indicate that the current widget component is visible, effectively exposing the current widget component to the user. The App Widget Update broadcast can carry parameters such as the widget ID, the widget host application identifier, and the OnShow() function.
[0229] S129: Provide the Widget application with a component exposure broadcast to determine whether the Widget component is exposed.
[0230] After receiving the component exposure broadcast, the Widget provider application can parse the component exposure broadcast to determine whether it indicates exposure of the Widget component. For example, the Widget provider application can override the OnReceive() function of the App Widget Provider base class and, during the process of overriding the OnReceive() function of the App Widget Provider base class, parse the "intent" in the "ACTION_APPWIDGET_UPDATA" to obtain parameters such as the Widget ID, the Widget host application identifier, and the Onshow() function. If the "intent" contains the Onshow() function, the Widget provider application can determine that the Widget component is visible, that is, exposed to the user.
[0231] The above embodiment focuses on the specific process of how the Widget application provided in the electronic device determines whether the Widget component is exposed. In one possible case, when the Widget component switches from the visible state to the hidden state, the Widget application provided in the electronic device can also determine whether the Widget component is hidden by parsing the "intent" in "ACTION_APPWIDGET_UPDATA". Figure 6 The illustrated embodiment is described in detail.
[0232] Figure 6 A flow chart of another method for determining a display state provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the method includes:
[0233] S201 : In response to a user operation of hiding a Widget component, the Widget host application transmits a second event to an event dispatching unit in a Widget lifecycle control module.
[0234] The Widget lifecycle control module may include an event distribution unit. When determining that the current event is a hidden event, the event distribution unit may transmit the hidden event to other units in the Widget lifecycle control module, for example, to the lifecycle management unit.
[0235] The Widget component on the Widget host application can include two states, a visible state and a hidden state. The Widget component on the Widget host application is not always in a visible state. For example, the desktop application is displayed through multiple interfaces, namely the first screen interface, the second screen interface and the third screen interface, and the weather component is displayed on the second screen interface. When the user slides the display interface of the mobile phone to the second screen interface, the weather component is displayed on the second screen interface, and the weather component is in a visible state. When the user slides the display interface of the mobile phone to the first screen interface, or the third screen interface, the weather component is not displayed thereon, and the weather component is in a hidden state. When the Widget component switches from a visible state to a hidden state, it is equivalent to hiding the Widget component once.
[0236] After a user performs any operation in the widget host application, the widget host application transmits a second event to the event dispatch unit in the widget lifecycle control module. This second event may indicate the current user operation in the widget host application. The widget host application may include an exposure processing module. When a widget component switches from a hidden state to a visible state, or vice versa, the exposure processing module may record the operation and send a second event indicating the user operation to the event dispatch unit in the widget lifecycle control module.
[0237] S202: The event distribution unit identifies whether the second event is an exposure event.
[0238] If the second event is the user switching the Widget component from a hidden state to a visible state, the second event is an exposure event; if the first event is the user switching the Widget component from a visible state to a hidden state, the second event is a hiding event.
[0239] If the second event is a hiding event, the event dispatching unit transmits the hiding event to the lifecycle management unit in the Widget lifecycle control module, that is, executing S203 .
[0240] S203: The event distribution unit transmits the hidden event to the lifecycle management unit.
[0241] The lifecycle management unit is the core unit in the Widget Lifecycle Control Module, responsible for receiving external events such as exposure events, hiding events, and removal events. It also schedules the rule processing management unit, rule execution management unit, and rule execution unit in the Widget Lifecycle Control Module to process external events and, based on the processing results, determine whether to send a component hiding broadcast.
[0242] S204: The lifecycle management unit determines whether to send a hiding event to the Widget providing application.
[0243] After receiving the hidden event delivered by the event distribution unit, the lifecycle management unit may first determine whether to allow the hidden event to be delivered to the Widget providing application.
[0244] It is understandable that the specific process of determining whether to allow the hidden event to be delivered to the Widget providing application is similar to the steps S114 to S124 above, and will not be repeated here.
[0245] If it is determined to send a hiding event to the Widget providing application, the framework interface is called to send a component hiding broadcast to the Widget providing application, that is, executing S205.
[0246] S205. The lifecycle management unit calls the Framework interface through the Widget manager.
[0247] It is understandable that the data transmission between the Widget manager and the Widget providing application is performed through the Framework interface. Therefore, when the lifecycle management unit transmits the hide event to the Widget providing application, the Framework interface should be called first.
[0248] S206: The Widget manager returns the interface call result to the lifecycle management unit.
[0249] In one possible case, the Widget manager successfully calls the Framework interface, and the interface call result returned by the Widget manager to the lifecycle management unit indicates that the Framework interface has been successfully called. In this way, the Widget manager can call the Framework interface to send a hidden exposure broadcast to the Widget providing application without repeatedly calling the Framework interface.
[0250] In one possible scenario, for example, if a communication failure occurs between the lifecycle management unit and the Widget manager, and the Widget manager fails to successfully call the Framework interface, the interface call result returned by the Widget manager to the lifecycle management unit indicates that the Framework interface was not successfully called. In this case, the lifecycle management unit can call the Framework interface again to ensure that the Framework interface can be successfully called, and further ensure that the component hiding broadcast is sent to the Widget providing application through the Framework interface.
[0251] S207: The Widget manager calls the Framework interface to send a component hiding broadcast to the application providing the Widget.
[0252] The component hiding broadcast, also known as the App Widget Update broadcast, indicates that the current widget is hidden, meaning it is hidden from the user. The App Widget Update broadcast can carry parameters such as the widget ID, the widget host application identifier, and the Onhide() function.
[0253] S208: Provide the Widget application with a component hiding broadcast to determine whether the Widget component is hidden.
[0254] After receiving the component hiding broadcast, the Widget provider can parse the broadcast to determine whether it indicates hiding the Widget component. For example, the Widget provider can override the OnReceive() function of the App Widget Provider base class and, during the process of overriding the OnReceive() function of the App Widget Provider base class, parse the "intent" of "ACTION_APPWIDGET_UPDATA" to obtain the Widget ID, Widget host application identifier, Onhide() function parameters, and so on. If the "intent" carries the Onhide() function, the Widget provider can determine that the Widget component is in a hidden state, that is, hidden from the user.
[0255] It should be noted that both component hiding broadcasts and component exposure broadcasts are App Widget Update broadcasts. After receiving an App Widget Update broadcast, the Widget application can determine the event type based on whether the function carried in the broadcast is Onhide() or Onshow().
[0256] For example, providing a Widget application can be based on Figure 7 The illustrated embodiment determines whether the event delivered by the App Widget Updata broadcast is an exposure event or a hiding event.
[0257] like Figure 7 As shown, including:
[0258] S21. Determine whether a first parameter carried by the "intent" parsed from the broadcast includes a first key value, where the first parameter is used to indicate whether a parameter indicating a current event type is carried.
[0259] For example, the Widget provider application can overwrite the OnReceive() function of the App Widget Provider base class, parse the intent, and then determine whether the extras parameter (equivalent to the first parameter) in the intent contains the key value "WIDGET_LIFECYCLE".
[0260] If the first parameter includes the key value (equivalent to the first key value) "WIDGET_LIFECYCLE", it is further determined whether the value in "WIDGET_LIFECYCLE" is "Onshow", that is, S22 is executed.
[0261] If the first parameter does not include the key value "WIDGET_LIFECYCLE", the super.onReceive() function is called, that is, S23 is executed.
[0262] S22. Determine whether the value in "WIDGET_LIFECYCLE" is "Onshow".
[0263] If the value of “WIDGET_LIFECYCLE” is “Onshow”, it is determined that the event transmitted by the broadcast is an exposure event, that is, S24 is executed.
[0264] If the value in “WIDGET_LIFECYCLE” is not “Onshow”, it is further determined that the value in “WIDGET_LIFECYCLE” is not “OnHide”, that is, S25 is executed.
[0265] S23. Call the super.onReceive() function.
[0266] Among them, the super.onReceive() function can be used to create the function of receiving broadcasts, which is a native function in the App WidgetProvider base class.
[0267] S24: Determine that the event transmitted by the broadcast is an exposure event.
[0268] S25. Determine whether the value in “WIDGET_LIFECYCLE” is “OnHide”.
[0269] If the value of "WIDGET_LIFECYCLE" is "OnHide", the event delivered by the broadcast is determined to be a hide event.
[0270] If the value in "WIDGET_LIFECYCLE" is not "OnHide", the super.onReceive() function is called, that is, S23 is executed.
[0271] In this way, the Widget application only needs to parse the values of parameters carried in the same type of broadcast to determine whether the currently transmitted event type is a hidden event or an exposed event, which reduces the complexity of the electronic device in determining hidden events and exposed events.
[0272] In some possible cases, Figures 4 to 7 Based on the embodiment shown, the electronic device can also realize the function of modifying the size of the Widget component. Figure 8 The illustrated embodiment is described in detail.
[0273] Figure 8 A flow chart of another method for determining a display state provided in an embodiment of the present application is shown as follows: Figure 8 As shown, the method includes:
[0274] S301 : In response to a user's operation of modifying the size of a Widget component, the Widget host application obtains a remoteViews request from the Widget manager.
[0275] Among them, remoteViews can be used to indicate the size, shape and other information of the Widget component.
[0276] It is understandable that the Widget component may change with the state of the electronic device, or may change based on user operations, and the embodiments of the present application do not limit this.
[0277] For example, the electronic device is a foldable electronic device. When the electronic device is in the folded state, the Widget component can be displayed in a first size. When the electronic device is in the unfolded state, the Widget component can be displayed in a second size. The first size and the second size can be pre-stored in the Widget application. When the electronic device is in the folded state, the first size is sent to the Widget host application so that the Widget host application displays the Widget component based on the first size. For example, when the electronic device is in the folded state, the weather component 10A1 is displayed in the first size. Figure 9 When the electronic device is in the expanded state, the second size is sent to the Widget host application so that the Widget host application displays the Widget component based on the second size. For example, when the electronic device is in the expanded state, the weather component 10A1 is displayed in the second size, as shown in FIG. Figure 9 As shown in (b) in .
[0278] For another example, a user presses a widget component with two fingers and then slides it outward. As the user slides, the size of the widget component gradually increases according to a preset step; or, a user presses a widget component with two fingers and then slides it inward. As the user slides, the size of the widget component gradually decreases according to a preset step.
[0279] It is understandable that the Widget host application needs to change the size of the Widget component based on remoteViews. The specific process of the Widget host application obtaining remoteViews can be seen in the following S302 to S305.
[0280] S302: The Widget manager sends a size modification broadcast to the application providing the Widget.
[0281] The Widget manager may send a size modification broadcast to the Widget providing application in response to the GetRemoteViews request sent by the Widget manager.
[0282] The broadcast of size modification may carry the onAppWidgetOptionsChanged() function. After receiving the broadcast of size modification, the Widget application parses the onAppWidgetOptionsChanged() function from the broadcast of size modification and obtains remoteViews, that is, executing S303.
[0283] S303: Provide a Widget application to obtain remoteViews.
[0284] After the Widget application obtains the pre-stored remoteViews, the remoteViews may be returned to the Widget manager, ie, S304 is executed.
[0285] S304: Provide the Widget application to return remoteViews to the Widget manager.
[0286] After receiving remoteViews, the Widget manager may generate a size modification notification, carry remoteViews in the size modification notification, and send the size modification notification to the Widget host application, that is, execute S305.
[0287] S305: The Widget manager sends a size modification notification to the Widget host application.
[0288] S306 : The Widget host application modifies the size of the Widget component based on the size modification notification.
[0289] After the Widget host application receives the size modification notification, it can obtain remoteViews from the size modification notification and then modify the size of the Widget component based on remoteViews.
[0290] In this way, the electronic device can realize the function of modifying the size of the Widget component.
[0291] It is understandable that users can also delete Widget components.
[0292] In one possible case, multiple Widget components are generated based on the same Widget providing application, for example, Figure 10 As shown in (a) of FIG, two weather components are displayed on the desktop, namely weather component 10A1 and weather component 10B1. Both weather components 10A1 and weather component 10B1 are components generated based on weather applications. The user long presses the weather component 10B1, as shown in FIG. Figure 10 In response to the user long pressing the weather component 10B1, a close control 10B11 is displayed in the upper right corner of the weather component 10B1, as shown in (b) in FIG. Figure 10 As shown in (c) in . If the user clicks the close control 10B11, Figure 10 In response to the user clicking the close control 10B11, the weather component 10B1 is closed, as shown in (d) in FIG. Figure 10 This is equivalent to deleting only one component generated by the weather application, and the desktop application still displays a weather component.
[0293] In one possible case, the Widget host application only displays one Widget component generated based on the same Widget providing application, for example, Figure 11 As shown in (a) of FIG, a weather component 10A1 is displayed on the desktop. The user long presses the weather component 10A1, as shown in FIG. Figure 11 In response to the user long pressing the weather component 10A1, a close control 10A11 is displayed in the upper right corner of the weather component 10B1, as shown in (b). Figure 11 If the user clicks on the close control 10A11, as shown in (c) in FIG. Figure 11 In response to the user clicking the close control 10A11, the weather component 10A1 is closed, as shown in (d) in FIG. Figure 11 This is equivalent to deleting all components generated by the weather application, and no weather components are displayed on the desktop.
[0294] Below through Figure 12 The embodiment shown is used to explain in detail how to implement the function of deleting a Widget component.
[0295] Figure 12 A flow chart of another method for determining a display state provided in an embodiment of the present application is shown as follows: Figure 12 As shown, the method includes:
[0296] S401 : In response to a user's operation of deleting a Widget component, the Widget host application sends a request to the Widget manager to delete the Widget ID.
[0297] S402: The Widget manager determines whether the currently deleted Widget component is the last Widget component based on the Widget ID.
[0298] For example, Figure 10 As shown in (c), the weather component 10B1 to be deleted is not the last weather component on the desktop. The weather component 10A1 is still displayed on the desktop.
[0299] For example, Figure 11 As shown in (c), the antenna component 10A1 to be deleted is the last weather component on the desktop.
[0300] It's understood that the widget component displayed by the widget host application is generated by the widget manager. Therefore, when a widget component is displayed in the widget host application, the widget manager stores the widget ID corresponding to that widget component. If the widget manager only has one widget ID corresponding to that widget component, then that widget component is the last component generated based on the same widget application that was displayed in the widget host application. If the widget manager has multiple widget IDs corresponding to that widget component, then that widget component is not the last component generated based on the same widget application that was displayed in the widget host application.
[0301] If the currently deleted Widget component is the last Widget component, the Widget manager sends a deletion broadcast to the Widget providing application, that is, executing S403.
[0302] If the currently deleted Widget component is not the last Widget component, the Widget manager sends a broadcast of disabling the enablement to the application providing the Widget, that is, executing S404 .
[0303] S403: The Widget manager sends a deletion broadcast to the application providing the Widget.
[0304] The deleted broadcast may carry an onDeleted() function. After receiving the deleted broadcast, the Widget application parses the onDeleted() function from the deleted broadcast and performs a first cleanup operation, that is, executing S405.
[0305] S404: The Widget manager sends a broadcast of disabling the Widget to the application providing the Widget.
[0306] The broadcast of disabling the enablement may carry an onDisable() function. After receiving the broadcast of disabling the enablement, the Widget application parses the broadcast of disabling the enablement to extract the onDisable() function and performs a second cleanup operation, that is, executing S406.
[0307] S405: Provide the Widget application to perform a first cleaning operation.
[0308] Since the deletion broadcast indicates that the Widget component to be deleted is not the last component displayed on the Widget host application and is generated based on the same Widget providing application, the first cleanup operation may refer to an operation of releasing resources or stopping background services to clean up system resources, rather than an operation of releasing all Widget component resources.
[0309] S406: Provide the Widget application to perform a second cleaning operation.
[0310] Since the broadcast enabling disablement indicates that the Widget component to be deleted is the last component generated based on the same providing Widget application and displayed on the Widget host application, the second cleanup operation, unlike the first cleanup operation, may refer to an operation of releasing all Widget component resources.
[0311] In this way, the electronic device can realize the function of deleting the Widget component.
[0312] It should be understood that, although the various steps in the flow chart in the above-described embodiment are shown in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless clearly stated herein, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0313] It is understandable that in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of this application.
[0314] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one module. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. It should be noted that the names of the modules in the embodiment of the present application are schematic and are not limited to the names of the modules in actual implementation.
[0315] The method for determining the display state provided in the embodiments of the present application can be applied to electronic devices. Optionally, the electronic device includes a terminal device, which can also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the terminal device.
[0316] For example, Figure 13: The figure shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0317] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0318] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0319] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0320] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0321] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0322] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0323] Display screen 194 is used to display images, videos, and the like. Display screen 194 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, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0324] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0325] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0326] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.
[0327] It should be noted that any electronic device mentioned in the embodiments of the present application may include more or fewer modules in the electronic device 100.
[0328] The present application also provides a computer program product, which, when executed by a processor, implements the method for determining the display state described in any method embodiment of the present application.
[0329] The computer program product may be stored in a memory, for example, a program, which is finally converted into an executable target file that can be processed and executed after undergoing processes such as preprocessing, compiling, assembling and linking.
[0330] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, implements the method for determining the display state described in any method embodiment of the present application. The computer program can be a high-level language program or an executable target program.
[0331] The computer-readable storage medium is, for example, a memory. The memory may be a volatile memory or a non-volatile memory, or the memory may include both volatile memory and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0332] In this application, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0333] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0334] 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.
[0335] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0336] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for example, the division of the units is merely a logical function division, and there may be other division methods in actual implementation; for example, 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 an indirect coupling or communication connection of some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0337] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0338] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0339] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for determining a display state, characterized in that: The method is applied to an electronic device, and includes: In response to a first operation, a first application sends a first parameter to a second application, where the first parameter is used to indicate a display state of a first component, where the display state includes a hidden state and a visible state. The first application is an application that displays the first component, and the second application is an application that provides display data for the first component. The first operation is used to modify the display state of the first component, and the first component is a component generated based on a widget. The second application determines a display state of the first component based on the first parameter.
2. The method according to claim 1, wherein the electronic device includes a first module, the first module includes a first unit, and the first application sends a first parameter to the second application, comprising: The first application sends the first parameter to the first unit in the first module; The first unit of the first module receives the first parameter and sends the first parameter to the second application.
3. The method according to claim 2, characterized in that The first module further includes a second unit, and the first unit of the first module receives the first parameter and sends the first parameter to the second application, including: The first unit receives the first parameter and instructs the second unit to determine whether the state of the electronic device meets a preset condition; If the state of the electronic device meets the preset condition, the second unit instructs the first unit to send the first parameter to the second application.
4. The method according to claim 3, characterized in that The preset conditions include: The first component is a component in a preset list; The time interval between two consecutive displays of the first component is shorter than a preset time interval; The power level of the electronic device is higher than a preset power threshold; The temperature of the electronic device is lower than a preset temperature threshold.
5. The method according to claim 3 or 4, characterized in that The preset condition is stored in the cloud server, and the second unit determines whether the state of the electronic device meets the preset condition, including: The second unit requests the cloud server to obtain the preset condition; The cloud server sends the preset condition to the second unit; The second unit determines whether a state of the electronic device satisfies a preset condition.
6. The method according to claim 3 or 4, characterized in that The preset condition is stored in the second unit, and the second unit determines whether the state of the electronic device meets the preset condition, including: The second unit reads the pre-stored preset condition; The second unit determines whether a state of the electronic device satisfies a preset condition.
7. The method according to any one of claims 1 to 6, characterized in that The value of the first parameter includes a first value, and the first value is used to indicate that the first component is in a visible state. The second application determines the display state of the first component based on the first parameter, including: The second application parses the first parameter to obtain a value of the first parameter; If the value of the first parameter is the first value, it is determined that the display state of the first component is a visible state.
8. The method according to claim 7, characterized in that The value of the first parameter further includes a second value, and the second value is used to indicate that the first component is in a hidden state. The method further includes: If the value of the first parameter is the second value, it is determined that the display state of the first component is the hidden state.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: If the display state of the first component is visible, updating the first component according to a preset period; If the display state of the first component is the hidden state, stop updating the first component according to the preset period.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: Based on the display state of the first component, the number of times the first component is displayed is determined.
11. The method according to claim 10, characterized in that The method further comprises: The second application determines the number of times the first component is displayed based on the display state of the first component.
12. The method according to any one of claims 1 to 11, characterized in that The first component is a widget component, the first application is a widget host application, and the second application is an application that provides display data for the widget component.
13. The method according to any one of claims 1 to 12, characterized in that The method further comprises: In response to a second operation, the first application sends a second parameter to the second application, where the second parameter is used to indicate adding the first component; The second application sends first data to the first application based on the second parameter, where the first data is data for adding the first component; The first application adds the first component based on the first data.
14. The method according to claim 13, characterized in that The step of sending, in response to the second operation, the first application sending the second parameter to the second application includes: In response to the second operation, the first application sends the second parameter and a third parameter to the second application, where the third parameter is used to instruct to update the first component; The method further comprises: The second application sends second data to the first application based on the third parameter, where the second data is data for updating the first component; The first application updates the first component based on the second data.
15. The method according to any one of claims 1 to 14, characterized in that The method further comprises: The first application sends a third parameter to the second application according to a preset period, where the third parameter is used to instruct to update the first component; The second application sends second data to the first application based on the third parameter, where the second data is data for updating the first component; The first application updates the first component based on the second data.
16. The method according to any one of claims 1 to 15, characterized in that The method further comprises: In response to a third operation, the first application sends a third parameter to the second application, where the third parameter is used to instruct to delete the first component; The second application clears the operating data of the first component based on the third parameter.
17. An electronic device, characterized in that: include: one or more processors; Memory; and one or more computer programs, wherein the one or more computer programs are stored on the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the method according to any one of claims 1 to 16.
18. A chip system, characterized in that: The chip system includes a processor for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes the method according to any one of claims 1 to 16.
19. A computer-readable storage medium comprising a computer program, characterized in that When the computer program is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Method, device and system for calling widget
CN102073507A
Method and mobile terminal for displaying applications through widget
CN104461233A
Control assembly display method and system for application
CN104699364A
Method and apparatus for setting display state of mouse in an application thin client
CN106383705A
Component display method and display equipment
CN114510170A