CN115599475A - Method and electronic device for refreshing user interface - Google Patents

Method and electronic device for refreshing user interface Download PDF

Info

Publication number
CN115599475A
CN115599475A CN202110775502.1A CN202110775502A CN115599475A CN 115599475 A CN115599475 A CN 115599475A CN 202110775502 A CN202110775502 A CN 202110775502A CN 115599475 A CN115599475 A CN 115599475A
Authority
CN
China
Prior art keywords
application
interface
change request
electronic device
change
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110775502.1A
Other languages
Chinese (zh)
Inventor
贾德祥
鲁波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110775502.1A priority Critical patent/CN115599475A/en
Priority to PCT/CN2022/103812 priority patent/WO2023280141A1/en
Publication of CN115599475A publication Critical patent/CN115599475A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application provides a method for refreshing a user interface and an electronic device, wherein the method can be applied to the electronic device and comprises the following steps: the electronic equipment detects a first user interface change request of a first application, wherein the first application runs in a background of the electronic equipment; the electronic equipment caches the first user interface change request; and when the electronic equipment detects that the first application is switched to foreground operation, updating the user interface change corresponding to the first user interface change request into the user interface of the first application. According to the technical scheme, the change requests corresponding to the user interface changes of the application running in the background can be cached, and the user interface changes are applied to the user interface when the background application is visible, so that the problem of conflict caused by concurrent access of a plurality of applications can be avoided.

Description

Method and electronic device for refreshing user interface
Technical Field
The present application relates to the field of electronic technology, and more particularly, to a method of refreshing a user interface and an electronic device.
Background
In some internet of things (IOT) devices with screens, due to design limitations of a Central Processing Unit (CPU), a chip of the IOT device does not support memory mapping of a Memory Management Unit (MMU), and the whole IOT device can only run one process, and if multiple applications are to be run simultaneously, the multiple applications are generally run concurrently in a multi-thread or multi-task manner, and in this case, the threads of the multiple applications may access the same shared resource at the same time, so that a conflict may occur.
Disclosure of Invention
According to the technical scheme, a user interface change request generated by an application running in a background can be cached, and the user interface change is applied to the user interface when the background application is visible, so that the conflict problem caused by concurrent access of multiple applications can be avoided.
In a first aspect, a method for refreshing a user interface is provided, and the method is applied to an electronic device, and includes: the electronic equipment detects a first User Interface (UI) change request of a first application, wherein the first application runs in a background of the electronic equipment; the electronic equipment caches the first UI change request; and when the electronic equipment detects that the first application is switched to foreground operation, updating the UI change corresponding to the first UI change request into the UI of the first application.
Based on the embodiment of the application, when the UI of the first application running in the background changes, the electronic device can detect the UI change request, cache the UI change request, and apply the UI change to the UI of the first application when the first application is switched to the foreground. According to the technical scheme, the conflict problem caused by concurrent access of a plurality of applications when the electronic equipment runs the plurality of applications simultaneously can be avoided.
With reference to the first aspect, in some implementation manners of the first aspect, the generating, by the electronic device, the first UI change request according to first information changed by a first UI, and the caching the first UI change request includes: and the electronic equipment adds the first UI change request into a cached data structure.
The first information may be changed UI components, properties of the UI components, values of the changed properties, and the like, and the properties of the UI components may include, but are not limited to, characteristics or styles of the components such as length, width, color, and the like.
In this embodiment of the present application, the cached data structure may include a linked list, a queue, an array, and the like, which is not limited in this embodiment of the present application.
Based on the embodiment of the application, the UI change request is cached in the cached data structure, so that the UI change of the background application can not be executed immediately.
With reference to the first aspect, in certain implementations of the first aspect, the method further includes: the electronic equipment detects a second UI change request of the first application, wherein the second UI change request is generated according to second information of second UI change; when a first UI component corresponding to the first UI change request is different from a second UI component corresponding to the second UI change request, or the first UI component is the same as the second UI component but the attribute of the first UI component is different from that of the second UI component, the electronic equipment adds the second UI change request to the cached data structure; and when the electronic equipment detects that the first application is switched to foreground operation, updating the UI change corresponding to the second UI change request into the UI of the first application.
The second information may include the changed second UI component, the property of the component, the value of the changed property, and the like, and the property of the UI component may include, but is not limited to, the property or style of the component, such as length, width, color, and the like.
In this embodiment of the present application, the UI component may include a native view UI component that can be directly drawn, or may also include a Document Object Model (DOM) component structure in global wide area network (web) development, and the like, which is not limited in this embodiment of the present application.
Based on the embodiment of the application, when the UI component corresponding to the second UI change request is different from the UI component corresponding to the first UI change request or the attributes of the components are different, the first UI component may be added to the cached data structure, and when the application is switched from the background to the foreground, the second UI change is updated to the UI of the application. According to the technical scheme, when the application is changed by a plurality of UIs, different UI change requests can be cached in the data structure, so that when the application is switched to the foreground, the UI changes are executed in sequence.
With reference to the first aspect, in certain implementations of the first aspect, the method further includes: the electronic equipment detects a third UI change request of the first application, wherein the third UI change request is generated according to third information changed by a third UI; and when the third UI component corresponding to the third UI change request is the same as the first UI component corresponding to the first UI change request and the attribute of the third UI component is the same as the attribute of the first UI component, the electronic equipment updates the value of the attribute of the first UI component in the cached data structure according to the value of the attribute of the third UI component.
The third information may include the changed third UI component, the property of the component, and the value of the changed property. The properties of the UI component may include characteristics or styles, such as length, width, color, etc., of the component.
For example, the attribute of the first UI component corresponding to the first UI change request is a color, the value of the attribute is a specific color, such as red, the third UI component corresponding to the third UI change request is the same as the first UI component, and the attribute of the third UI component is also a color, and if the value of the attribute of the third UI component is yellow, the electronic device may update the value (yellow) of the attribute of the third UI component with the value of the attribute of the first UI component corresponding to the first UI change request, that is, at this time, the cached value of the attribute of the first UI component is updated to yellow, so that the third UI change request may not need to be cached.
Based on the embodiment of the application, when the UI component corresponding to the third UI change request is the same as the UI component corresponding to the first UI change request and the attributes of the components are the same, the value of the attribute of the UI component corresponding to the first UI change request is updated with the value of the attribute of the UI component corresponding to the third UI change request. Therefore, the third UI change request can be prevented from being added into the cached data structure, new cache nodes are prevented from being added, and further the consumption of the memory of the electronic equipment is reduced.
In other embodiments, the electronic device may also cache the third UI change request.
With reference to the first aspect, in some implementation manners of the first aspect, the updating the UI change corresponding to the first UI change request to the UI of the first application includes: and the electronic equipment calls a system interface to update the UI change corresponding to the first UI change request to the UI component of the first application.
With reference to the first aspect, in certain implementations of the first aspect, before the electronic device caches the first UI change request, the method further includes: the electronic device determines that the first UI change request needs to be cached.
Based on the embodiment of the application, before the electronic device caches the first UI change request, whether the first UI change request needs to be cached or not can be judged in advance, so that caching of all UI change requests can be avoided, and power consumption of the electronic device is saved.
In other embodiments, the electronic device may determine whether the first UI change request needs to be cached, may not be cached for some UI change requests, and may update directly into the UI of the application.
With reference to the first aspect, in certain implementations of the first aspect, the method further includes: when the electronic equipment determines that the first UI change request does not need to be cached, directly updating the UI change corresponding to the first UI change request into the UI of the first application.
With reference to the first aspect, in some implementations of the first aspect, the caching, by the electronic device, the first UI change request includes: the electronic equipment sends the first UI change request to a UI service thread; the UI service thread caches the first UI change request.
In this embodiment, the UI service thread may be configured to manage UI changes of all applications, and when there are multiple UI change requests, the UI service thread may cache the multiple UI changes in a time sequence and execute the multiple UI changes sequentially.
In other embodiments, the UI service thread may directly update the UI change corresponding to the UI change request to the UI of the application, which is not limited in this embodiment of the present application.
With reference to the first aspect, in some implementations of the first aspect, the updating the first UI change to the UI of the first application includes: and the UI service thread updates the UI component corresponding to the first UI change request to the UI component of the first application.
In a second aspect, a method for refreshing a user interface is provided, and the method is applied to an electronic device, and includes: the electronic equipment displays a first interface, wherein the first interface is a first User Interface (UI) of a first application; the electronic equipment responds to a first operation of a user and displays a first interface and a second interface positioned above the first interface, wherein the second interface is a second UI of the second application; when the electronic equipment detects a first UI change request of a first application, continuously displaying the first interface and the second interface; and the electronic equipment responds to a second operation of the user and displays a third interface, wherein the third interface is an interface after the first UI of the first application is changed.
Based on the embodiment of the application, when the first application in the foreground of the electronic device is switched to the background operation, the first interface of the first application is still visible to the user, and when the electronic device detects a UI change request of the first application, the UI of the first application may not be updated immediately, but when the first application is switched back to the foreground, the UI is changed and updated into the UI of the first application. According to the technical scheme, the conflict problem caused by concurrent access of a plurality of applications when the electronic equipment runs the plurality of applications simultaneously can be avoided.
With reference to the second aspect, in certain implementations of the second aspect, the second interface is translucent; or the second interface is displayed in a non-full screen mode.
In a third aspect, an electronic device is provided, including: one or more processors; one or more memories; the one or more memories store one or more computer programs comprising instructions that, when executed by the one or more processors, cause performance of a method of refreshing a user interface as described in the first aspect and any possible implementation thereof.
With reference to the third aspect, in some implementation manners of the third aspect, the electronic device is an electronic device with a display screen that does not support memory management unit isolation.
In the embodiment of the present application, the memory management unit isolation means that the memory management unit can partition and protect an actual physical memory, so that each software task can only access the allocated memory space.
Exemplarily, the electronic device may be a wearable device such as a smart watch, augmented Reality (AR) glasses, a bracelet, or other electronic devices having a display screen.
In a fourth aspect, an electronic device is provided, comprising: one or more processors; one or more memories; the one or more memories store one or more computer programs comprising instructions that, when executed by the one or more processors, cause performance of the method of refreshing a user interface as described in the second aspect and any of its possible implementations.
In a fifth aspect, a chip is provided, wherein the chip comprises a processor and a communication interface, wherein the communication interface is configured to receive a signal and transmit the signal to the processor, and wherein the processor processes the signal, such that the method of refreshing a user interface as described in the first aspect and any possible implementation manner thereof is performed.
A sixth aspect provides a chip comprising a processor and a communication interface for receiving signals and transmitting the signals to the processor, wherein the processor processes the signals such that the method of refreshing a user interface as described in the second aspect and any possible implementation thereof is performed.
In a seventh aspect, a computer-readable storage medium is provided, in which computer instructions are stored, which, when executed on a computer, cause a method of refreshing a user interface as described in the first aspect and any one of its possible implementations to be performed.
In an eighth aspect, a computer-readable storage medium is provided, having stored thereon computer instructions, which, when run on a computer, cause the method of refreshing a user interface as described in the second aspect and any one of its possible implementations to be performed.
A ninth aspect provides a computer program product comprising computer instructions which, when run on an electronic device, cause the method of refreshing a user interface as described in the first aspect and any one of its possible implementations to be performed.
A tenth aspect provides a computer program product comprising computer instructions which, when run on an electronic device, cause the method of refreshing a user interface as described in the second aspect and any one of its possible implementations to be performed.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Fig. 2 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application.
Fig. 3 is a schematic diagram of an electronic device that starts multiple applications according to an embodiment of the present application.
Fig. 4 is a schematic diagram of another electronic device provided in an embodiment of the present application to start multiple applications.
Fig. 5 is a schematic flow chart of the electronic device in fig. 4 launching multiple applications.
Fig. 6 is a schematic diagram illustrating that a foreground application and a background application jointly access a shared resource according to an embodiment of the present application.
Fig. 7 is a schematic diagram illustrating installation of a three-party application into an electronic device according to an embodiment of the present application.
FIG. 8 is a schematic diagram of a set of GUIs provided by an embodiment of the present application.
Fig. 9 is a schematic frame diagram of a method for updating a user interface according to an embodiment of the present application.
Fig. 10 is a schematic flowchart of a method for refreshing an interface according to an embodiment of the present application.
Fig. 11 is a schematic flow chart diagram of another method for refreshing an interface according to an embodiment of the present application.
Fig. 12 is a schematic flowchart of a method for refreshing an interface according to an embodiment of the present application.
Fig. 13 is a schematic flow chart of another method for refreshing an interface according to an embodiment of the present application.
Detailed Description
The technical solution in the present application will be described below with reference to the accompanying drawings.
The electronic device in this embodiment may refer to a wearable device, such as a bracelet, a sports watch, and the like, and the electronic device may also refer to other devices with a display screen, and the electronic device may also be a user equipment, a remote terminal, a mobile device, a user terminal, a handheld device with a wireless communication function, a terminal device in a future 5G network, or a terminal device in a future evolved Public Land Mobile Network (PLMN), and the like, which is not limited in this embodiment of the present application.
Fig. 1 shows a schematic structural diagram of an 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 screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. 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, and the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: 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), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bidirectional synchronous serial bus comprising a serial data line (SDA) and a Serial Clock Line (SCL).
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 through an I2S bus, enabling communication between the processor 110 and the audio module 170.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, audio module 170 and wireless communication module 160 may be coupled by a PCM bus interface.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.
It should be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive a charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques.
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may be a Liquid Crystal Display (LCD), or a display panel made of one of organic light-emitting diodes (OLEDs), active matrix organic light-emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), miniature, micro-led, micro-oeld or quantum dot light-emitting diodes (QLEDs). In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. The camera 193 is used to capture still images or video.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capability of the electronic device 100.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into analog audio signals for output, and also used to convert analog audio inputs into digital audio signals.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into a sound signal.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals.
The earphone interface 170D is used to connect a wired earphone.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194.
The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C to assist in positioning and navigation.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes).
A distance sensor 180F for measuring a distance.
The fingerprint sensor 180H is used to collect a fingerprint.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen".
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the human vocal part vibrating the bone mass. The bone conduction sensor 180M may also contact the human pulse to receive the blood pressure pulsation signal.
The keys 190 include a power-on key, a volume key, and the like.
The motor 191 may generate a vibration cue.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card.
The software system of the electronic device 100 may employ a hierarchical architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes an Android system with a hierarchical architecture as an example, and exemplarily illustrates a software structure of the electronic device 100.
Fig. 2 is a block diagram of a software structure of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom. The application layer may include a series of application packages.
As shown in fig. 2, the application package may include camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc. applications.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 2, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
Content providers are used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and answered, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide communication functions for the electronic device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to notify download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The Android runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media libraries (media libraries), three-dimensional graphics processing libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
Before describing the technical solutions of the present application, some terms of art that may be referred to in the following solutions of the present application will be briefly described.
Process (process): the method is a running activity of a program in a computer on a certain data set, is a basic unit for resource allocation and scheduling of a system, and is the basis of an operating system structure.
Thread (thread): is the smallest unit that the operating system can perform operation scheduling. It is included in the process and is the actual unit of operation in the process. A thread refers to a single sequential control flow in a process, multiple threads can be concurrently executed in a process, and each thread executes different tasks in parallel. Multiple threads in the same process will share all system resources in the process, such as virtual address space, file descriptors, signal processing, etc.
MMU isolation: the memory management unit can segment and protect the actual physical memory, so that each software task can only access the allocated memory space.
User Interface (UI): is a medium for interaction and information exchange between the system and the user, which realizes the conversion between the internal form of the information and the human acceptable form. At present, a graphical user interface is commonly used, which displays direct images and is simple and convenient to operate, and is also called a human-computer interface, namely an interface for short.
Fig. 3 is a schematic diagram of an electronic device that starts multiple applications according to an embodiment of the present application.
Referring to fig. 3, the chip of the electronic device 1 supports MMU isolation, that is, each time an application (App) is started by the system, an independent process is created for the App to run the App, and the process is a minimum resource scheduling resource and can be isolated from other processes.
As shown in fig. 3, when App1 is started by the electronic device 1, a process 1 is created for App1, the process 1 may include a UI thread 1, the UI thread 1 is used to uniformly process updates of the App1 on a UI, and the UI thread 1 may access a resource 1 allocated by the system for the process 1.
When the electronic device 1 starts App2, a process 2 may be created for App2, the process 2 may include a UI thread 2, the UI thread 2 is used to uniformly process updates of the UI by App2, and the UI thread 2 may access a resource 2 allocated by the system to the process 2.
Since resource 1 and resource 2 are isolated from each other, the resources accessed by App1 and App2 are different even if they run concurrently.
However, not all electronic devices support MMU isolation, for example, in some IOT lightweight devices, their chips do not support MMU isolation.
Fig. 4 is a schematic diagram of another electronic device provided in an embodiment of the present application to start multiple applications.
Referring to fig. 4, the electronic device 2 does not support MMU isolation, that is, the electronic device can only run one process globally, and each application is executed by one UI thread, that is, when the system runs multiple applications simultaneously, the UI threads corresponding to the multiple applications will access the resources allocated to the process 1 by the system together.
As shown in fig. 4, when the electronic device starts App1, process 1 is created, UI thread 1 of App1 may be included in process 1, UI thread 1 is used to process update of App1 on the UI, and UI thread 1 may access resource 1 allocated by the system for process 1.
When the electronic device starts App2, a UI thread 2 of App2 is continuously created in process 1, the UI thread 2 is used for processing update of the UI by App2, and the UI thread 2 can also access resource 1.
Therefore, when App1 and App2 run concurrently, the same resource may be called together, for example, when UI thread 1 and UI thread 2 both call the same system function, an access conflict occurs, thereby causing a problem of functional abnormality.
The problem of access conflicts is described in detail below in conjunction with fig. 5-6.
Fig. 5 is a schematic flow chart of the electronic device in fig. 4 for launching a plurality of applications. The scheme may include steps 101 to 113.
101, starting the system.
For example, a user presses a power key of the electronic device for a long time, so that the electronic device is powered on and started.
102, starting a management module and creating a system graph display thread.
The thread is responsible for processing graphic displays of the system, such as boot animation, desktop display, and the like.
103, the graph drawing module creates a system graph root node.
The system graph root node is a root container for hooking the graph component trees of all the applications, and the component tree of each application can be a sub component tree of the graph root node.
And 104, rendering the system graph by the image drawing module.
In this step, the rendering of the system graph by the image drawing module may be understood as that the image drawing module traverses all the sub-component trees from the root node of the system, draws components in the sub-component trees in sequence, and outputs the components to a unified graph buffer (buffer).
And 105, sending the rendered system graphics to a screen for display.
In this step, the system interface may be called to send the rendered system graphics (i.e., components in the graphics buffer) to the screen driver for output display. At this time, a system desktop may be displayed in the screen of the electronic device.
It should be understood that the steps 101 to 105 are optional steps, and in some embodiments, the technical solution may be executed from the electronic device already in the power-on starting state, that is, may be executed from the step 106.
App1 is started 106.
For example, the user clicks an application icon of App1 in the desktop of the electronic device to start App1.
And 107, starting the management module to create a main thread of App1.
108, the starting management module sends the information of App1 to the application running management module.
The information of App1 may include information such as a packet name and a User Identification (UID) of App1.
109, the application running management module loads and runs the code of App1.
The application run management module creates component tree 1 for App1 110.
The application run management module sets UI properties on the component tree 1 111.
For example, UI attributes such as length, width, color, transparency, etc. of the display component are set.
And 112, the application operation management module hooks the root node of the component tree 1 to the root node of the system.
The application operation management module links the root node of the component tree 1 with the set UI attribute to the root node of the system, so that the graph drawing module draws the UI of App1.
113, UI is changed.
It should be understood that the above steps 106 to 113 show the process of starting App1, and for the starting of App2, the above steps may be referred to, and are not described again for brevity.
According to the steps, each App has a thread and a component tree, UI change is carried out on a main thread of the App, and the thread is the unit with the minimum CPU execution scheduling, so that concurrent execution of the same function may occur on the execution of program code statements, access conflicts may occur, and the problem of functional abnormity is caused.
Illustratively, the caller will enter the glyph size and literal string of the gesture to be set through the SetText interface in the UI function library, assuming that the SetText interface uses a global variable g _ fontsize to record the size of the literal to be displayed.
When the UI thread 1 of App1 and the UI thread 2 of App2 both call the SetText interface at the same time, access conflicts may occur, causing phenomena such as text screen splash.
Referring to fig. 6, fig. 6 is a schematic diagram illustrating that a foreground application and a background application jointly access a shared resource according to an embodiment of the present application.
App1 is foreground application, app2 and App3 are background application, namely the interface displayed in the current interface of the electronic equipment is the display interface of App1, app2 and App3 run concurrently with App1, but the display interfaces of App2 and App3 are invisible to the user.
Wherein, the component tree of App1 is the component tree 1, the component tree of App2 is the component tree 2, and the component tree of App3 is the component tree 3.
Illustratively, node 1 of App1 calls SetText ("AA", font size: 30), and node 2 of App2 calls SetText ("AA", font size: 38), so that it can be seen that the phenomenon of text screen-blooming is likely to be caused when two applications access the common resource of the font library at the same time.
In view of this, an embodiment of the present application provides an interface refreshing method, and in the technical scheme, a UI change request corresponding to a UI change that occurs to an application running in a background may be cached, and when the background application is visible, the UI change is applied to a user interface, so that a conflict problem caused by concurrent access of multiple applications may be avoided.
Fig. 7 is a schematic diagram illustrating installation of a three-party application into an electronic device according to an embodiment of the present application.
Referring to fig. 7, the electronic device 200a may be a cell phone and the electronic device 200b may be a wearable device, such as a sports watch. The sports watch can be connected with the mobile phone in a Bluetooth mode, a wireless mode or a wired mode and the like.
The sports watch may install the third-party application with the assistance of the mobile phone, for example, the mobile phone downloads an installation package of the third-party application in an application market in the cloud and installs the third-party application in the sports watch.
As shown in fig. 7, the third-party application may be "weather", "music", app2, or the like, and when the application is installed in the sports watch, application icons, application names, and the like of the installed applications may be displayed in a display interface of the sports watch by an operation of a user.
When a user clicks the icon or the text of the music, the sports watch can display the display interface of the music, the music is applied to the foreground of the sports watch, at the moment, the sports watch can still receive an application starting instruction of the mobile phone, for example, when the user pulls up App2 in the mobile phone, the sports watch can switch the music from the foreground to the background and display the interface of the App2 on the foreground, and at the moment, the music and the App2 are both in running states. The foreground App2 can change the UI directly in response to an operation event such as a user touch, and for the background application "music", the UI change may still be triggered by its own processing logic.
Fig. 8 is a schematic diagram of a set of Graphical User Interfaces (GUIs) provided in an embodiment of the present application. Fig. 8 (a) to (h) show the operation process of the sports watch by the user in the mobile phone and the sports watch.
Referring to fig. 8 (a), the GUI is a display interface 310 of a sports watch 300b, the display interface 310 may include a plurality of applications installed by the sports watch, and may include applications "weather", "music", "App2", and the like, and when the sports watch detects that a user clicks an application icon 311 of App2 or an application name or an area where the application name is located, the GUI as shown in fig. 8 (b) may be displayed.
It should be understood that other applications installed by the sports watch may be displayed in a scrolling fashion as the user's finger slides up or down the screen of the sports watch.
Referring to (b) in fig. 8, the GUI is a display interface 320 of App2. The display interface 320 may include an image 321 and other graphics, etc.
Referring to (c) of fig. 8, the GUI is a display desktop 350 of the mobile phone 300a, and the display desktop 350 may include a plurality of applications installed in the mobile phone. When the mobile phone detects an operation of the user clicking the sports health application icon 351, a GUI as shown in (d) of fig. 8 may be displayed.
Referring to (d) of fig. 8, the GUI is an athletic health first display interface 360. The display interface 360 may include a plurality of function cards and a plurality of function controls, and each function control may correspond to one display interface. When the mobile phone detects an operation of clicking the function control 361 by the user, a GUI as shown in (e) of fig. 8 may be displayed.
Referring to (e) of fig. 8, the GUI is a display interface 370 corresponding to the function control 361. The display interface 370 may include a function card 371, and the function card 371 may include a name HUAWEI WATCH GT2 PRO of a sports WATCH currently connected to the mobile phone, an icon of the HUAWEI WATCH GT2 PRO, and the like. The display interface 370 may further include other intelligent devices connected to the mobile phone, such as hua zhi jian, hua zhi yin box, etc. When the mobile phone detects an operation of clicking the function card 371 by the user, a GUI as shown in (f) in fig. 8 may be displayed.
Referring to (f) in fig. 8, the GUI is a display interface 380 corresponding to the function card 371. The display interface 380 may include a status card 382 of the WATCH GT2 PRO, where the status card 382 may include a connection status, an electric quantity, and the like of the sports WATCH; the display interface 380 may also include a watch dial market of a sports watch, in which a user may download a corresponding watch dial and install it into the sports watch; some applications may also be included in the display interface 380, which may include "weather," "health monitoring," "cardiac health research experience," and "App1," among others. After the user clicks the operation of the card 381 of "App1", the sports watch may display a GUI as shown in (g) of fig. 8.
Referring to (g) in fig. 8, the GUI is a display interface 330 of App1, wherein the display interface 330 may be in a semi-transparent state, that is, the upper layer of the display interface 330 displays the display interface of App1, but the user can still see the display interface 320 of App2 located in the background through the display interface.
When the sports watch detects an operation of the user sliding up or down in the screen 330, a GUI of the person as shown in (h) in fig. 8 may be displayed.
In some examples, the display interface 330 may not be in a semi-transparent state, that is, only the display interface of App1 is displayed in the display interface 330, and the display interface of App2 running in the background is not visible to the user.
In other examples, the display interface 330 may also be in a non-full screen state, for example, the display interface 330 may be displayed in half screen, and the other half screen may be used to display a display interface of the background application App2, and the like.
Referring to (h) in fig. 8, the GUI is a display interface 340 of App2, and the color of a graphic 341 in the display interface 340 is changed from that of the image 321 in (b) in fig. 8.
It should be understood that when App2 is running in the background, a UI change occurs, and the UI change is not executed immediately, but is displayed in the display interface after App2 switches to the foreground.
The technical scheme can avoid the problem of access conflict caused when the foreground and the background concurrently run applications access the same resource.
Fig. 9 is a schematic frame diagram of a method for updating a user interface according to an embodiment of the present application. The components of the component tree in the embodiments of the present application may also be referred to as nodes.
Referring to fig. 9, app1 is an application in the foreground of the electronic device, i.e., app1 is an application currently displayed in the screen of the electronic device, and its UI is visible to the user. When a component 1 of the component tree 1 of App1 is changed, the change can be directly applied to the component 1, that is, the UI change can be directly displayed in a display interface of the electronic device.
App2 is a background application on the electronic device, i.e. App2, although running, has its UI invisible to the user. When a change occurs in a component 2 of the component tree 2 of App2, the change is not directly applied to the component 2, but the UI change may be buffered, and when App2 is switched to the foreground display, the UI change is applied to the component 2 before the electronic device draws the first frame screen of App2, that is, when the electronic device displays the UI of App2, the UI is an interface including the UI change.
It should be understood that, when multiple UI components of App2 in the component tree 2 are changed, the multiple UI changes may be sequentially cached, and when App2 is switched to the foreground display, the multiple UI changes are sequentially applied to corresponding components in the component tree before the electronic device draws the first frame of App2, that is, when the electronic device displays the UI of App2, the UI is an interface including the multiple UI changes.
In the embodiment of the application, the electronic device may generate a UI change request from the UI change according to the change details of the UI change applied in the background, and add the UI change request to a cached data structure, where the data structure may be an array, a queue, a linked list, or the like. For example, the data structure is a queue, the electronic device may add the UI change request to the buffer queue, or when there are multiple UI change requests, sequentially add the multiple UI change requests to the buffer queue according to a time sequence of the multiple UI change requests.
It should be understood that the UI change requests in the buffer queue may be executed in sequence according to a first-in-first-out principle.
The change details may include, but are not limited to, a UI component corresponding to the UI change, and a property of the UI component, and a value of the property after the change, and the like, and the property of the UI component may include, but is not limited to, a characteristic or style of the component, such as a length, a width, a color, and the like.
In some embodiments, the background triggers the multiple UI changes in sequence, the electronic device generates a UI change request for each UI change in the multiple UI changes, and when the attributes of the UI components of the UI changes corresponding to the multiple UI change requests are the same, the UI change request corresponding to the UI change detected after caching may be cached, and the UI change request that is cached before and has the same attribute as the UI component corresponding to the UI change request may be deleted. For example, the attribute of the UI component 1 corresponding to the UI change request 1 is a color, such as red, the attribute of the UI component 1 corresponding to the UI change request 2 is also a color, such as yellow, and the UI change request 1 is before and the UI change request 2 is after, the electronic device first buffers the UI change request 1, deletes the buffered UI change request 1 and buffers the UI change request 2 after the UI change request 2 is generated, so as to avoid additional buffer nodes, reduce memory overhead, and extra UI refresh overhead.
In other embodiments, a background triggers a plurality of UI changes in sequence, the electronic device generates a UI change request for each UI change in the plurality of UI changes, and when the UI component attributes of the UI change corresponding to the plurality of UI change requests are the same, the cached UI component attribute value corresponding to the UI change request may be updated with the UI component attribute value corresponding to the subsequent UI change request, so that a new cache node may not be added. For example, the UI change request 1 is cached in the cache queue, the attribute of the corresponding UI component 1 is a color, such as red, at the latter time, the cache queue receives the UI change request 2, and the attribute of the corresponding UI component 1 is also a color, such as yellow, only the color of the corresponding UI component 1 in the cached UI change request 1 needs to be changed into yellow, and the UI change request 2 does not need to be cached, so that an additional cache node is avoided, and memory overhead and redundant UI refresh overhead are reduced.
Fig. 10 is a schematic flow chart of a method for refreshing a user interface according to an embodiment of the present application. As shown in fig. 10, the method may be applied to an electronic device, and the method may include steps 501 to 514.
501, an application running in the background triggers a UI change.
It should be appreciated that the application runs in the background, which may run concurrently with the foreground application. For example, a UI change may be triggered when the application is in the background and receives a distributed message from the system.
In some embodiments, the distributed message may be communication information that is pushed by the mobile phone to a background application of the watch, for example, a riding navigation application is run on the watch, and the application continuously receives navigation direction prompt information sent by a corresponding riding navigation application on the mobile phone during running and displays the navigation direction prompt information on a display screen of the watch; after the riding navigation application in the watch is switched to the background, although the UI information of the riding navigation application is not displayed in the display screen of the watch, the application can still continuously receive messages sent by the mobile phone.
In other embodiments, an application is launched in the watch, which changes the UI at intervals, but during the intervals, the user switches the application to the background, which triggers a UI change after the intervals have been reached.
502, the electronic device detects a UI change.
In some embodiments, this step 502 may be performed by an application framework (application framework) in the electronic device. The application framework may provide an Application Programming Interface (API) and a programming framework for the application, for example, some predefined functions may be included in the application framework. An application may access system capabilities of an electronic device by calling a system API. When the UI of an application is changed, the application calls the corresponding API, so that the application framework can detect the UI change.
In some optional embodiments, the electronic device may determine whether the UI change needs to be cached, which may include steps 503-505.
503, the application framework queries the change management module whether the UI changes need to be cached.
The change management module is used for processing all caching actions and updating application flows of the cache.
The change management module determines 504 whether the UI change belongs to the background.
When the change management module determines that the UI change belongs to the background, step 505 may be performed; step 514 may be performed when the change management module determines that the UI change does not belong to the background, i.e., the UI change belongs to the foreground.
505, when the change management module determines that the UI change belongs to the background, a confirmation result that the change is needed is returned to the application framework.
Illustratively, when the change management module determines that the UI change belongs to the background, a "yes" confirmation is returned to the application framework.
It should be appreciated that in some embodiments, the electronic device may also generate a UI change request based on the change details of the UI change without determining whether the UI change needs to be cached.
Illustratively, the process of the electronic device generating a UI change request according to the change details of the UI may include steps 506 to 507.
The application framework submits the UI change details to the change generation module 506.
Illustratively, the application framework may submit the UI change details to the change generation module through a system interface.
Wherein the UI change details may include: the UI component that changed, what property changed, the changed value, etc., which properties may include, but are not limited to, the width, height, color, transparency, etc. of the component.
For example, if the UI component originally corresponds to a function card in the interface and the background color thereof is yellow, the UI change details may be to change the background color to red.
The change generation module generates a UI change request based on the UI change details 507.
The change generation module generates the UI change request according to the UI change details, namely, the change generation module sets the received UI change details into a data structure of the UI change request.
After the electronic device generates the UI change request, the UI change request may be cached, wherein the process of caching the UI change request by the electronic device may include steps 508 to 509.
The change generation module submits the UI change request to a change cache module 508.
Illustratively, the change generation module submits the UI change request to a change cache module through a system interface.
509, the change caching module adds the UI change request to the cached data structure.
The cached data structure may include, but is not limited to, a linked list, an array, or a queue.
Illustratively, the data structure of the buffer memory adopts a queue structure, and the change buffer module adds the UI change request into a buffer queue, and when there are multiple UI change requests, sequentially adds the multiple UI change requests into the buffer queue, where the buffer queue may adopt a first-in first-out manner, that is, the UI change request that first enters the buffer queue is processed first.
It should be appreciated that when the application switches back to the foreground display, the electronic device may update the UI change corresponding to the UI change request into the UI of the application, which may include steps 510-513.
The application switches back to the foreground display 510.
Illustratively, referring to (g), (h) in fig. 8, in response to an operation of the user sliding in the screen of the sports watch, the application App2 is switched from the background to the foreground display.
Alternatively, after the foreground application exits, the application is scheduled from the background to the foreground.
511, the application notifies the change management module of the status that has been switched back to foreground display.
Illustratively, the application notifies the change management module of the state by calling the system interface to switch the application back to the foreground display.
512, the change management module traverses the UI change requests cached in the cache list and determines the UI change requests that need to be executed.
Exemplarily, if the cache list is a cache queue, the change management module sequentially traverses UI change requests cached in the cache queue to determine UI change requests that need to be executed.
513, the UI changes are applied to the UI components.
In this step, the UI change may be applied to the corresponding UI component by calling the corresponding system interface, so that the display interface corresponding to the UI component changes or a part of the display interface changes.
It should be appreciated that when there are multiple UI changes, the multiple UI changes may be applied to the corresponding UI components in sequence before the first frame of drawing when the application switches back to the foreground display, i.e., the interface where the application switches back to the foreground display is already the interface after the multiple UI changes.
514, the cache list is cleared.
And when the UI change request cached in the cache list is executed, emptying the cache list.
It should be appreciated that this step 514 is an optional step.
It should also be understood that the above steps are merely illustrative, and the embodiment of the present application does not limit the implementation order of the above steps. In some embodiments, other modules in the electronic device may also be used to implement the above functions or steps, which is not limited in this application.
Based on the embodiment of the application, the UI change messages of the application in the background can be cached in the list, and when the application is switched back to the foreground for display, the cached UI changes are sequentially applied to the UI components, so that the problem of functional abnormity possibly caused by a plurality of concurrently running applications can be solved.
FIG. 11 is a schematic flow chart diagram of another method for refreshing a user interface provided in an embodiment of the present application. As shown in fig. 11, the method may include steps 601 to 617.
601, starting the system.
For example, a user may press a power key of the electronic device for a long time to turn on the electronic device.
It should be understood that this step 601 is an optional step, and in some embodiments, this technical solution may also be implemented in an electronic device that is already powered on.
The system UI service thread is started 602.
603, start App1.
For example, the user clicks an application icon of App1 in the desktop of the electronic device to start App1.
In some embodiments, step 602 may also be located after step 603, and the present application does not limit the execution order of step 602 and step 603.
604, the start management module starts thread 1 of App1.
Thread 1 loads and runs the code of App1 605.
606, thread 1 loads App 1's user interface.
Thread 1 sets 607 the properties of the UI component of App1.
For example, the properties of the corresponding UI component are set on the component tree.
Specifically, the UI service thread invokes the system interface, setting the change into the UI component.
At 608, app2 is started.
For example, the user clicks an application icon of App2 within the desktop of the electronic device to launch App2. Alternatively, app2 may be started by another electronic device, for example, see (f), (g) in fig. 8, and an application in a sports watch may be started by a mobile phone terminal.
609, the start management module starts thread 2 of App2.
Thread 2 loads and runs the code of App2 610.
611, thread 2 loads App 2's user interface.
Thread 2 sets 612 the properties of the UI component of App2.
613, when the first UI of App1 changes, thread 1 sends a message of the UI change to the UI service thread.
In other embodiments, when the UI service thread receives multiple UI change messages, the multiple UI change messages may be queued and executed in sequence.
614, the UI service thread applies the first UI change to the UI component.
In some embodiments, the UI service thread applies the first UI changed information to the corresponding UI component, and hangs the component tree of App1 into the system root node of the electronic device, and the graphics drawing module of the electronic device may traverse all the sub-component trees from the system root node, draw the components of the sub-component trees in sequence, and send the drawn components to the screen driver for display, so that the changed UI of App2 may be displayed in the screen of the electronic device.
Illustratively, the UI service thread may sequentially apply the plurality of UI changes to the UI component according to a chronological order of the received plurality of UI changes.
615, when the second UI of App2 changes, thread 2 sends a message of the second UI change to the UI service thread.
The UI service thread applies the second UI change to the UI component 616.
This step 616 may refer to the related description of step 614, and is not repeated herein for brevity.
It should be understood that when a UI service thread receives multiple UI change messages, the UI changes may be performed sequentially in the chronological order of their receipt, and when multiple UI change messages are received simultaneously, the UI change messages may be randomly queued and then performed sequentially.
The above steps are merely exemplary, and the implementation order of the above steps is not limited in the embodiments of the present application. In some embodiments, other modules in the electronic device may also be used to implement the functions or steps described above, which is not limited in this embodiment of the present application.
Based on the embodiment of the application, one UI service thread can be introduced to uniformly manage the UI changes of all the applications, and the UI service thread can sequentially execute all the UI changes according to the time sequence of receiving the UI changes, so that the problem of functional abnormity possibly caused by the UI changes of a plurality of concurrently-running applications can be solved.
Fig. 12 is a schematic flow chart of a method for refreshing a user interface according to an embodiment of the present application. As shown in fig. 12, the method may be applied to an electronic device, and the method may include steps 710 to 730.
710, the electronic device detects a first user interface, UI, change request of a first application, the first application running in a background of the electronic device.
In step 710, the first application runs in the background of the electronic device, and when the first UI of the first application is changed, the electronic device may detect a UI change request corresponding to the UI change.
720, the electronic device caches the first UI change request.
In step 720, after detecting the first UI change request, the electronic device may cache the UI change request.
In some embodiments, the first UI change request is generated based on first information of a UI change, the electronic device adding the first UI change request to the cached data structure.
The first information may include a UI component corresponding to the first UI change request, and an attribute, a value of the attribute, and the like of the component. The data structure of the buffer can be a linked list, a queue, an array and the like.
Exemplarily, if the attribute of the UI component 1 is a color, such as red, the first information corresponding to the first UI change may be to change the color of the attribute of the UI component 1 to yellow.
730, when the electronic device detects that the first application is switched to foreground operation, updating the UI change corresponding to the first UI change request to the UI of the first application.
In this step 730, the first application is switched from the background to the foreground, which may be that the user has closed the foreground application, so that the first application becomes the foreground, or that the user switches the original foreground application to the background, or that the user switches the first application to the foreground for operation, etc.
When the first application is switched to foreground operation, the electronic device may update the UI change corresponding to the UI change request to the UI of the first application before displaying the first frame of the first application, so that the user may directly view the updated UI of the first application.
According to the embodiment of the application, when the UI of the first application running in the background is changed, the electronic device can detect the UI change request, cache the UI change request instead of immediately execute the UI change request, and when the first application is switched to the foreground, apply the UI change to the UI of the first application. According to the technical scheme, the conflict problem caused by concurrent access of a plurality of applications when the electronic equipment runs the plurality of applications simultaneously can be avoided.
Optionally, the method further comprises: the electronic equipment detects a second UI change request of the first application, wherein the second UI change request is generated according to second information changed by a second UI; when a first UI component corresponding to the first UI change request is different from a second UI component corresponding to the second UI change request, or the first UI component is the same as the second UI component but the attribute of the first UI component is different from the attribute of the second UI component, the electronic equipment adds the second UI change request to the cached data structure list; and when the electronic equipment detects that the first application is switched to foreground operation, updating the UI change corresponding to the second UI change request into the UI of the first application.
The second information may include a UI component corresponding to the second UI change, and an attribute, a value of the attribute, and the like of the component.
The UI component may include a local UI component that can be directly rendered, or may include a document object model DOM component structure in global wide area network (web) development, and the like, which is not limited in this embodiment of the present application.
Based on the embodiment of the application, when the UI component corresponding to the second UI change request is different from the UI component corresponding to the first UI change request or the attributes of the components are different, the first UI component may be added to the cached data structure, and when the application is switched from the background to the foreground, the second UI change is updated to the UI of the application. According to the technical scheme, when the application is changed by a plurality of UIs, different UI change requests can be cached in the data structure, so that when the application is switched to the foreground, the UI changes are executed in sequence.
Optionally, the method further comprises: the electronic equipment detects a third UI change request of the first application, wherein the third UI change request is generated according to third information changed by a third UI; and when the third UI component corresponding to the third UI change request is the same as the first UI component corresponding to the first UI change request, and the attribute of the third UI component is the same as the attribute of the first UI component, the electronic equipment updates the value of the attribute of the first UI component in the cached data structure according to the value of the attribute of the third UI component.
The third information may include the changed third UI component, the property of the component, and the value of the changed property. The properties of the UI component may include the characteristics or style of the component's length, width, color, etc.
For example, the attribute of the first UI component corresponding to the first UI change request is a color, the value of the attribute is a specific color, such as red, the third UI component corresponding to the third UI change request is the same as the first UI component, and the attribute of the third UI component is also a color, and if the value of the attribute of the third UI component is yellow, the electronic device may update the value (yellow) of the attribute of the third UI component with the value of the attribute of the first UI component corresponding to the first UI change request, that is, at this time, the cached value of the attribute of the first UI component is updated to yellow, so that the third UI change request may not need to be cached.
Based on the embodiment of the application, when the UI component corresponding to the third UI change request is the same as the UI component corresponding to the first UI change request and the attributes of the components are the same, the value of the attribute of the UI component corresponding to the first UI change request is updated by the value of the attribute of the UI component corresponding to the third UI change request. Therefore, the third UI change request can be prevented from being added into the cached data structure, new cache nodes are prevented from being added, and further the consumption of the memory of the electronic equipment is reduced.
In some embodiments, the electronic device may also cache the third UI change request, that is, the value of the attribute of the UI component corresponding to the first UI change request does not need to be updated by using the value of the attribute of the UI component corresponding to the third UI change request, which is not limited in this embodiment of the present application.
Optionally, the updating the UI change corresponding to the first UI change request to the UI of the first application includes: and the electronic equipment calls a system interface to update the UI change corresponding to the first UI change request to the UI component of the first application.
Optionally, before the electronic device caches the first UI change request, the method further includes: the electronic device determines that the first UI change request needs to be cached.
Optionally, the method further comprises: when the electronic equipment determines that the first UI change request does not need to be cached, directly updating the UI change corresponding to the first UI change request into the UI of the first application.
In some embodiments, when the first application runs in the foreground and the first UI change request does not generally need to be cached, the UI change corresponding to the first UI change request may be directly updated into the UI of the first application.
In other embodiments, when the first application runs in the background, the UI change corresponding to the first UI change request may not need to be cached, and the UI change corresponding to the first UI change request may be directly updated to the UI of the first application.
Optionally, the caching, by the electronic device, the first UI change request includes: the electronic equipment sends the first UI change request to a UI service thread; the UI service thread caches the first UI change request.
In this embodiment, the UI service thread may be configured to manage UI changes of all applications, and when there are a plurality of UI change requests, the UI service thread may cache the plurality of UI changes in time order and execute the UI changes in sequence.
Illustratively, referring to fig. 11, the UI service thread may cache the received UI change requests of App1 and App2 and execute them in sequence.
In other embodiments, the UI service thread may directly update the UI change to the UI of the application, which is not limited in this embodiment.
Optionally, the updating the UI change corresponding to the first UI change request to the UI of the first application includes: and the UI service thread updates the component corresponding to the first UI change to the UI component of the first application.
FIG. 13 is a schematic flow chart diagram of another method for refreshing a user interface provided by an embodiment of the present application. The method may be applied to an electronic device, and as shown in fig. 13, the method may include steps 810 to 840.
And 810, the electronic equipment displays a first interface, and the first interface is a first User Interface (UI) of a first application.
Illustratively, as shown in fig. 8 (b), the electronic device may be a smart watch, the first application may be App2, and the first user interface may be display interface 320 of App2.
820, responding to a first operation of a user, the electronic equipment displays a first interface and a second interface positioned on the first interface, wherein the second interface is a second UI of the second application.
Illustratively, as shown in (f), (g) in fig. 8, the first operation may be that the user clicks a card 381 of App1 in the mobile phone, and the second interface may be a display interface of App1.
830, when the electronic device detects a first UI change request of a first application, the electronic device continues to display the first interface and the second interface.
Exemplarily, when the electronic device detects a first UI change request of the background application App2, the smart watch continues to display the interface of App2 and the interface of App1 without change, as shown in (g) of fig. 8.
Optionally, the second interface is translucent; or the second interface is displayed in a non-full screen mode.
When the second interface is displayed in a semi-transparent state or a non-full screen state, a user can see the first interface below the second interface.
840, the electronic device responds to a second operation of the user and displays a third interface, where the third interface is an interface after the first UI of the first application is changed.
Illustratively, as shown in (g), (h) of fig. 8, the second operation may be that the user slides up in the display interface of the smart watch, the third interface may be the display interface 340 of App2, and the display interface 340 is the interface after the first UI is changed.
Based on the embodiment of the application, when the first application in the foreground of the electronic device is switched to the background operation, the first interface of the first application is still visible to the user, and when the electronic device detects the first UI change request of the first application, the UI of the first application may not be updated immediately, but when the first application is switched back to the foreground, the UI is changed and updated into the UI of the first application. According to the technical scheme, the conflict problem caused by concurrent access of a plurality of applications when the electronic equipment runs the plurality of applications simultaneously can be avoided.
An embodiment of the present application further provides an electronic device, including one or more processors; one or more memories; the one or more memories store one or more computer programs comprising instructions that, when executed by the one or more processors, cause performance of a method of refreshing a user interface as described in any one of the preceding possible implementations.
Optionally, the electronic device is an electronic device with a display screen that does not support memory management unit isolation.
Exemplarily, the electronic device may be a wearable device such as a smart watch, AR glasses, a bracelet, or other electronic devices with a display screen.
An embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, where the communication interface is configured to receive a signal and transmit the signal to the processor, and the processor processes the signal, so that the method for refreshing a user interface as described in any one of the foregoing possible implementations is performed.
The present embodiment also provides a computer-readable storage medium, in which computer instructions are stored, and when the computer instructions are executed on an electronic device, the electronic device is caused to execute the relevant method steps to implement the method for refreshing a user interface in the foregoing embodiment.
The present embodiment also provides a computer program product, which when running on a computer, causes the computer to execute the relevant steps described above, so as to implement the method for refreshing a user interface in the above embodiment.
In addition, an apparatus, which may be specifically a chip, a component or a module, may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the window display method in the above method embodiments.
The electronic device, the computer-readable storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, and therefore, the beneficial effects that can be achieved by the electronic device, the computer-readable storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A method for refreshing a user interface, the method being applied to an electronic device, the method comprising:
the electronic equipment detects a first User Interface (UI) change request of a first application, wherein the first application runs in a background of the electronic equipment;
the electronic equipment caches the first UI change request;
and when the electronic equipment detects that the first application is switched to foreground operation, updating the UI change corresponding to the first UI change request into the UI of the first application.
2. The method of claim 1, wherein the first UI change request is generated from first information of a first UI change, and wherein the electronic device caches the first UI change request, comprising:
and the electronic equipment adds the first UI change request into a cached data structure.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
the electronic equipment detects a second UI change request of the first application, wherein the second UI change request is generated according to second information changed by a second UI;
when a first UI component corresponding to the first UI change request is different from a second UI component corresponding to the second UI change request, or the first UI component is the same as the second UI component but the attribute of the first UI component is different from that of the second UI component, the electronic equipment adds the second UI change request into the cached data structure;
and when the electronic equipment detects that the first application is switched to foreground operation, updating the UI change corresponding to the second UI change request into the UI of the first application.
4. The method according to any one of claims 1-3, further comprising:
the electronic equipment detects a third UI change request of the first application, wherein the third UI change request is generated according to third information of third UI change;
and when the third UI component corresponding to the third UI change request is the same as the first UI component corresponding to the first UI change request and the attribute of the third UI component is the same as the attribute of the first UI component, the electronic equipment updates the value of the attribute of the first UI component in the cached data structure according to the value of the attribute of the third UI component.
5. The method of claim 1, wherein the electronic device caching the first UI change request comprises:
the electronic equipment sends the first UI change request to a UI service thread;
the UI service thread caches the first UI change request.
6. A method for refreshing a user interface, the method being applied to an electronic device, the method comprising:
the electronic equipment displays a first interface, wherein the first interface is a first User Interface (UI) of a first application;
the electronic equipment responds to a first operation of a user and displays a first interface and a second interface positioned above the first interface, wherein the second interface is a second UI of the second application;
when the electronic equipment detects a first UI change request of a first application, continuously displaying the first interface and the second interface;
and the electronic equipment responds to a second operation of the user and displays a third interface, wherein the third interface is an interface after the first UI of the first application is changed.
7. The method of claim 6, wherein the second interface is translucent; or the second interface is displayed in a non-full screen mode.
8. An electronic device, comprising: one or more processors; one or more memories; the one or more memories store one or more computer programs comprising instructions that, when executed by the one or more processors, cause performance of the method of refreshing a user interface of any of claims 1-5, or 6-7.
9. The electronic device of claim 8, wherein the electronic device is an electronic device with a display screen that does not support memory management unit isolation.
10. A chip comprising a processor and a communication interface for receiving a signal and transmitting the signal to the processor, the processor processing the signal such that the method of refreshing a user interface as claimed in any of claims 1-5, or 6-7 is performed.
11. A computer-readable storage medium having stored thereon computer instructions which, when run on a computer, cause a method of refreshing a user interface according to any one of claims 1-5, or 6-7 to be performed.
CN202110775502.1A 2021-07-09 2021-07-09 Method and electronic device for refreshing user interface Pending CN115599475A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110775502.1A CN115599475A (en) 2021-07-09 2021-07-09 Method and electronic device for refreshing user interface
PCT/CN2022/103812 WO2023280141A1 (en) 2021-07-09 2022-07-05 Method for refreshing user interface, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110775502.1A CN115599475A (en) 2021-07-09 2021-07-09 Method and electronic device for refreshing user interface

Publications (1)

Publication Number Publication Date
CN115599475A true CN115599475A (en) 2023-01-13

Family

ID=84801241

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110775502.1A Pending CN115599475A (en) 2021-07-09 2021-07-09 Method and electronic device for refreshing user interface

Country Status (2)

Country Link
CN (1) CN115599475A (en)
WO (1) WO2023280141A1 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8738031B2 (en) * 2012-05-25 2014-05-27 Apple Inc. Operating geographic location systems
CN111813536B (en) * 2019-04-11 2024-06-11 华为技术有限公司 Task processing method, device, terminal and computer readable storage medium
CN111079555A (en) * 2019-11-25 2020-04-28 Oppo广东移动通信有限公司 User preference degree determining method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
WO2023280141A1 (en) 2023-01-12

Similar Documents

Publication Publication Date Title
CN110597512B (en) Method for displaying user interface and electronic equipment
WO2021057868A1 (en) Interface switching method and electronic device
WO2020253758A1 (en) User interface layout method and electronic device
WO2022199509A1 (en) Method for application performing drawing operation, and electronic device
EP3115912A2 (en) Method for displaying web content and electronic device supporting the same
CN113761427A (en) Method for generating card in self-adaptive mode, terminal device and server
CN115629884B (en) Thread scheduling method, electronic equipment and storage medium
CN112241932A (en) Picture processing method and device
CN115794361A (en) Method for managing memory and electronic equipment
WO2021185352A1 (en) Version upgrade method and related apparatus
WO2022121445A1 (en) Widget adding method, apparatus, and computer-readable storage medium
WO2023005751A1 (en) Rendering method and electronic device
CN117632400A (en) Task scheduling method, electronic device and computer readable storage medium
WO2023280141A1 (en) Method for refreshing user interface, and electronic device
CN112783418B (en) Method for storing application program data and mobile terminal
CN114281440A (en) Display method of user interface in dual system and electronic equipment
WO2024114285A1 (en) Display method, display apparatus and wearable device
WO2024067599A1 (en) Application display method and electronic device
WO2023051036A1 (en) Method and apparatus for loading shader
WO2023202444A1 (en) Input method and apparatus
WO2024131486A1 (en) Performance analysis method, readable storage medium, program product and electronic device
CN116743908B (en) Wallpaper display method and related device
WO2024066976A1 (en) Control display method and electronic device
CN117097883B (en) Frame loss fault cause determining method, electronic equipment and storage medium
WO2024093431A1 (en) Image drawing method and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination