WO2023280141A1 - Method for refreshing user interface, and electronic device - Google Patents

Method for refreshing user interface, and electronic device Download PDF

Info

Publication number
WO2023280141A1
WO2023280141A1 PCT/CN2022/103812 CN2022103812W WO2023280141A1 WO 2023280141 A1 WO2023280141 A1 WO 2023280141A1 CN 2022103812 W CN2022103812 W CN 2022103812W WO 2023280141 A1 WO2023280141 A1 WO 2023280141A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
application
interface
change request
change
Prior art date
Application number
PCT/CN2022/103812
Other languages
French (fr)
Chinese (zh)
Inventor
贾德祥
鲁波
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023280141A1 publication Critical patent/WO2023280141A1/en

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

Provided in the present application are a method for refreshing a user interface, and an electronic device. The method can be applied to an electronic device. The method comprises: an electronic device detecting a first user interface change request of a first application, wherein the first application is run in the background of the electronic device; the electronic device caching the first user interface change request; and when the electronic device has detected that the first application is switched to be run in the foreground, the electronic device updating a user interface change, which corresponds to the first user interface change request, to a user interface of the first application. By means of the technical solution, a change request corresponding to a user interface change occurring in an application, which is run in the background, can be cached, and when the background application is viewable, the user interface change is applied to a user interface, such 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
本申请要求于2021年07月09日提交中国专利局、申请号为202110775502.1、申请名称为“刷新用户界面的方法和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110775502.1 and the application name "Method and Electronic Device for Refreshing User Interface" submitted to the China Patent Office on July 09, 2021, the entire contents of which are incorporated by reference in this application middle.
技术领域technical field
本申请涉及电子技术领域,并且更具体地,涉及一种刷新用户界面的方法和电子设备。The present application relates to the field of electronic technology, and more specifically, to a method for refreshing a user interface and an electronic device.
背景技术Background technique
在一些物联网(internet of things,IOT)带屏设备中,由于中央处理器(central processing unit,CPU)的设计限制,其芯片不支持内存管理单元(memory management unit,MMU)内存映射,全局只能够运行一个进程,如果想要同时运行多个应用的话,一般会通过多线程或多任务的方式并发运行多个应用,在这种情况下,该多个应用的线程可能会出现同时访问同一个共享资源的情况,从而会产生冲突。In some Internet of Things (IOT) devices with screens, due to the design limitations of the central processing unit (CPU), the chip does not support the memory management unit (MMU) memory mapping, and the global only Able to run one process. If you want to run multiple applications at the same time, you usually run multiple applications concurrently through multi-threading or multi-tasking. In this case, the threads of the multiple applications may simultaneously access the same In the case of shared resources, conflicts arise.
发明内容Contents of the invention
本申请提供一种刷新用户界面的方法和电子设备,该技术方案可以缓存后台运行的应用发生的用户界面变更请求,在该后台应用可见时,将该用户界面变更应用到用户界面上,从而可以避免多个应用并发访问带来的冲突问题。The present application provides a method and an electronic device for refreshing a user interface. The technical solution can cache a user interface change request generated by an application running in the background, and apply the user interface change to the user interface when the background application is visible, thereby enabling Avoid conflicts caused by concurrent access by multiple applications.
第一方面,提供了一种刷新用户界面的方法,该方法应用于电子设备,该方法包括:所述电子设备检测第一应用的第一用户界面UI变更请求,所述第一应用运行在所述电子设备的后台;所述电子设备缓存所述第一UI变更请求;当所述电子设备检测到所述第一应用切换至前台运行时,将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中。In a first aspect, a method for refreshing a user interface is provided, the method is applied to an electronic device, and the method includes: the electronic device detects a first user interface UI change request of a first application, and the first application runs on the The background of the electronic device; the electronic device caches the first UI change request; when the electronic device detects that the first application is switched to the foreground, it updates the UI change corresponding to the first UI change request to the UI of the first application.
基于本申请实施例,当处在后台运行的第一应用的UI发生变更时,电子设备可以检测到UI变更请求,并将UI变更请求缓存起来,当该第一应用切换至前台时,将该UI变更应用到该第一应用的UI中。该技术方案可以避免电子设备同时运行多个应用时,该多个应用并发访问带来的冲突问题。Based on the embodiment of the present application, when the UI of the first application running in the background is changed, the electronic device can detect the UI change request and cache the UI change request, and when the first application switches to the foreground, the The UI changes are applied to the UI of the first application. The technical solution can avoid conflict problems caused by concurrent access of multiple applications when the electronic device runs multiple applications at the same time.
结合第一方面,在第一方面的某些实现方式中,所述第一UI变更请求根据第一UI变更的第一信息生成的,所述电子设备缓存所述第一UI变更请求,包括:所述电子设备将所述第一UI变更请求加入缓存的数据结构中。With reference to the first aspect, in some implementation manners of the first aspect, the first UI change request is generated according to the first information of the first UI change, and the electronic device caches the first UI change request, including: The electronic device adds the first UI change request into a cached data structure.
该第一信息可以是变更的UI组件,UI组件的属性,以及改变后的属性的值等,该UI组件的属性可以包括但不限于组件的长、宽、颜色等特性或样式等。The first information may be the changed UI component, the property of the UI component, and the value of the changed property.
本申请实施例中,缓存的数据结构可以包括链表、队列、数组等,本申请实施例对此不予限定。In the embodiment of the present application, the cached data structure may include a linked list, a queue, an array, etc., which is not limited in the embodiment of the present application.
基于本申请实施例,将UI变更请求缓存在缓存的数据结构中,从而可以使得后台应用的UI变更不会立即执行。Based on the embodiment of the present application, the UI change request is cached in the cached data structure, so that the UI change of the background application will not be executed immediately.
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:所述电子设备检测所述第一应用的第二UI变更请求,其中,所述第二UI变更请求是根据第二UI变更的第二信息生成的;当所述第一UI变更请求对应的第一UI组件与所述第二UI变更请求对应的第二UI组件不同,或所述第一UI组件与所述第二UI组件相同但所述第一UI组件的属性与所述第二UI组件的属性不同时,所述电子设备将所述第二UI变更请求加入所述缓存的数据结构中;当所述电子设备检测到所述第一应用切换至前台运行时,将所述第二UI变更请求对应的UI变更更新至所述第一应用的UI中。With reference to the first aspect, in some implementations of the first aspect, the method further includes: the electronic device detecting a second UI change request of the first application, wherein the second UI change request is based on The second information of the second UI change is generated; when the first UI component corresponding to the first UI change request is different from the second UI component corresponding to the second UI change request, or the first UI component is different from the first UI component When the second UI component is the same but the attribute of the first UI component is different from the attribute of the second UI component, the electronic device adds the second UI change request to the cached data structure; when the When the electronic device detects that the first application is switched to the foreground, it updates the UI change corresponding to the second UI change request to the UI of the first application.
该第二信息可以包括变更的第二UI组件,组件的属性,以及改变后的属性的值等,该UI组件的属性可以包括但不限于组件的长、宽、颜色等特性或样式等。The second information may include the changed second UI component, the property of the component, and the value of the changed property, etc. The property of the UI component may include but not limited to the characteristics or styles of the component such as length, width, and color.
本申请实施例中,该UI组件可以包括可直接绘制的本地(native view)UI组件,也可以包括在全球广域网(web)开发中的文档对象模型(document object model,DOM)组件结构等,本申请实施例对此不予限定。In the embodiment of the present application, the UI component may include a directly drawn local (native view) UI component, or may include a document object model (document object model, DOM) component structure in the development of the global wide area network (web). The application examples do not limit this.
基于本申请实施例,当第二UI变更请求对应的UI组件与第一UI变更请求对应的UI组件不同或组件的属性不同时,可以将该第一UI组件加入缓存的数据结构中,在应用从后台切换至前台时,将该第二UI变更更新至该应用的UI中。该技术方案可以在应用发生多个UI变更时,将不同的UI变更请求缓存在数据结构中,从而在应用切换至前台时,依次执行该多个UI变更。Based on the embodiment of this 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 can be added to the cached data structure, and the application When switching from the background to the foreground, the second UI change is updated to the UI of the application. The technical solution can cache different UI change requests in the data structure when multiple UI changes occur in the application, so that the multiple UI changes are executed sequentially when the application is switched to the foreground.
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:所述电子设备检测所述第一应用的第三UI变更请求,其中,所述第三UI变更请求是根据第三UI变更的第三信息生成的;当所述第三UI变更请求对应的第三UI组件与所述第一UI变更请求对应的第一UI组件相同且所述第三UI组件的属性与所述第一UI组件的属性相同时,所述电子设备根据所述第三UI组件的属性的值更新所述缓存的数据结构中的第一UI组件的属性的值。With reference to the first aspect, in some implementations of the first aspect, the method further includes: the electronic device detecting a third UI change request of the first application, wherein the third UI change request is based on The third information of the third UI change is generated; 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 When the attributes of the first UI component are the same, the electronic device 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.
该第三信息可以包括变更的第三UI组件,组件的属性,以及改变后的属性的值。该UI组件的属性可以包括该组件的长、宽、颜色等特性或样式等。The third information may include the changed third UI component, the attribute of the component, and the value of the changed attribute. The attributes of the UI component may include characteristics or styles of the component such as length, width, and color.
示例性地,该第一UI变更请求对应的第一UI组件的属性为颜色,该属性的值为具体的颜色,如红色,该第三UI变更请求对应的第三UI组件与第一UI组件相同,且该第三UI组件的属性同样为颜色,如该第三UI组件的属性的值为黄色,则电子设备可以将第三UI组件的属性的值(黄色)更新第一UI变更请求对应的第一UI组件的属性的值,即此时,缓存的第一UI组件的属性的值更新为黄色,从而可以无需缓存第三UI变更请求。Exemplarily, the attribute of the first UI component corresponding to the first UI change request is color, and the value of the attribute is a specific color, such as red, and the third UI component corresponding to the third UI change request is the same as the first UI component The same, and the attribute of the third UI component is also the color. If the value of the attribute of the third UI component is yellow, the electronic device can update the value (yellow) of the attribute of the third UI component to correspond to the first UI change request. The value of the property of the first UI component, that is, at this time, the cached value of the property of the first UI component is updated to yellow, so that there is no need to cache the third UI change request.
基于本申请实施例,当第三UI变更请求对应的UI组件与第一UI变更请求对应的UI组件相同且组件的属性相同时,以第三UI变更请求对应的UI组件的属性的值更新第一UI变更请求对应UI组件的属性的值。从而可以避免将第三UI变更请求加入缓存的数据结构中,避免了增加新的缓存节点,进而减少了电子设备内存的消耗。Based on the embodiment of the present 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 has the same attributes of the components, update the third UI component with the value of the attribute of the UI component corresponding to the third UI change request. A UI change request corresponds to the value of a property of the UI component. Therefore, it is possible to avoid adding the third UI change request into the data structure of the cache, avoid adding new cache nodes, and thereby reduce memory consumption of the electronic device.
在另一些实施例中,电子设备也可以缓存该第三UI变更请求。In some other embodiments, the electronic device may also cache the third UI change request.
结合第一方面,在第一方面的某些实现方式中,所述将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中,包括:所述电子设备调用系统接口将所述第一UI 变更请求对应的UI变更更新至所述第一应用的UI组件中。With reference to the first aspect, in some implementation manners of the first aspect, updating the UI change corresponding to the first UI change request to the UI of the first application includes: calling a system interface by the electronic device Updating the UI change corresponding to the first UI change request to the UI component of the first application.
结合第一方面,在第一方面的某些实现方式中,在所述电子设备缓存所述第一UI变更请求之前,所述方法还包括:所述电子设备确定需要缓存所述第一UI变更请求。With reference to the first aspect, in some implementation manners 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 ask.
基于本申请实施例,在电子设备缓存第一UI变更请求之前,可以预先判断是否需要缓存该第一UI变更请求,从而可以避免缓存所有的UI变更请求,节省电子设备的功耗。Based on the embodiment of the present application, before the electronic device caches the first UI change request, it may be pre-determined whether the first UI change request needs to be cached, so as to avoid caching all UI change requests and save power consumption of the electronic device.
在另一些实施例中,该电子设备可以确定是否需要缓存该第一UI变更请求,对于一些UI变更请求可以是不缓存的,可以直接更新至应用的UI中。In some other embodiments, the electronic device may determine whether the first UI change request needs to be cached, and some UI change requests may not be cached, and may be directly updated to the UI of the application.
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:当所述电子设备确定不需要缓存所述第一UI变更请求时,直接将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中。With reference to the first aspect, in some implementation manners of the first aspect, the method further includes: when the electronic device determines that the first UI change request does not need to be cached, directly corresponding the first UI change request The UI change of is updated to the UI of the first application.
结合第一方面,在第一方面的某些实现方式中,所述电子设备缓存所述第一UI变更请求,包括:所述电子设备将所述第一UI变更请求发送至UI服务线程;所述UI服务线程缓存所述第一UI变更请求。With reference to the first aspect, in some implementation manners of the first aspect, the electronic device caching the first UI change request includes: the electronic device sending the first UI change request to a UI service thread; The UI service thread caches the first UI change request.
本申请实施例中,该UI服务线程可以用于管理所有应用的UI变更,当有多个UI变更请求时,该UI服务线程可以将按照时间顺序将该多个UI变更缓存起来,并依次执行。In the embodiment of this application, the UI service thread can be used to manage UI changes of all applications. When there are multiple UI change requests, the UI service thread can cache the multiple UI changes in chronological order and execute them sequentially. .
在另一些实施例中,该UI服务线程可以直接将该UI变更请求对应的UI变更更新至应用的UI中,本申请实施例对此不予限定。In some 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.
结合第一方面,在第一方面的某些实现方式中,所述将所述第一UI变更更新至所述第一应用的UI中,包括:所述UI服务线程将所述第一UI变更请求对应的UI组件更新至所述第一应用的UI组件中。With reference to the first aspect, in some implementation manners of the first aspect, the updating the first UI change to the UI of the first application includes: the UI service thread changing the first UI Requesting that the corresponding UI component be updated to the UI component of the first application.
第二方面,提供了一种刷新用户界面的方法,所述方法应用于电子设备,所述方法包括:所述电子设备显示第一界面,所述第一界面为第一应用的第一用户界面UI;所述电子设备响应于用户的第一操作,显示第一界面和位于所述第一界面之上的第二界面,其中,所述第二界面为所述第二应用的第二UI;所述电子设备检测到第一应用的第一UI变更请求时,继续显示所述第一界面和所述第二界面;所述电子设备响应于用户的第二操作,显示第三界面,其中,所述第三界面为所述第一应用的第一UI变更后的界面。In a second aspect, a method for refreshing a user interface is provided, the method is applied to an electronic device, and the method includes: the electronic device displays a first interface, and the first interface is a first user interface of a first application UI: the electronic device displays a first interface and a second interface located above the first interface in response to a first operation of the user, wherein the second interface is a second UI of the second application; When the electronic device detects the first UI change request of the first application, it continues to display the first interface and the second interface; the electronic device displays a third interface in response to a second operation of the user, wherein, The third interface is a changed interface of the first UI of the first application.
基于本申请实施例,当处于电子设备前台的第一应用被切换至后台运行时,其第一界面仍对用户可见,当电子设备检测到该第一应用的UI变更请求时,可以不立即对第一应用的UI进行更新,而是在该第一应用切换回前台时,将该UI变更更新至第一应用的UI中。该技术方案可以避免电子设备同时运行多个应用时,该多个应用并发访问带来的冲突问题。Based on the embodiment of this application, when the first application in the foreground of the electronic device is switched to run in the background, its first interface is still visible to the user, and when the electronic device detects the UI change request of the first application, it may not immediately The UI of the first application is updated, but when the first application is switched back to the foreground, the UI change is updated to the UI of the first application. The technical solution can avoid conflict problems caused by concurrent access of multiple applications when the electronic device runs multiple applications at the same time.
结合第二方面,在第二方面的某些实现方式中,所述第二界面为半透明状;或者,所述第二界面为非全屏显示。With reference to the second aspect, in some implementation manners of the second aspect, the second interface is translucent; or, the second interface is displayed in a non-full screen.
第三方面,提供一种电子设备,包括:一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得如第一方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。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, and the one or more computer programs include instructions, When the instruction is executed by one or more processors, the method for refreshing the user interface described in the first aspect and any possible implementation manner thereof is executed.
结合第三方面,在第三方面的某些实现方式中,所述电子设备为不支持内存管理单元隔离的具有显示屏的电子设备。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 divide and protect the actual physical memory, so that each software task can only access its allocated memory space.
示例性地,该电子设备可以为智能手表、增强现实(augmented reality,AR)眼镜、手环等可穿戴设备,也可以为其他具有显示屏的电子设备等。Exemplarily, the electronic device may be a wearable device such as a smart watch, augmented reality (augmented reality, AR) glasses, a wristband, or other electronic devices with a display screen.
第四方面,提供一种电子设备,包括:一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得如第二方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。In a fourth 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, and the one or more computer programs include instructions, When the instruction is executed by one or more processors, the method for refreshing the user interface described in the second aspect and any possible implementation manner thereof is executed.
第五方面,提供一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如第一方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。According to a fifth aspect, a chip is provided, wherein the chip includes a processor and a communication interface, the communication interface is used to receive a signal, and transmit the signal to the processor, and the processor processes the The above signal, so that the method for refreshing the user interface described in the first aspect and any possible implementation manner thereof is executed.
第六方面,提供一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如第二方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。According to a sixth aspect, a chip is provided, wherein the chip includes a processor and a communication interface, the communication interface is used to receive a signal, and transmit the signal to the processor, and the processor processes the The above signal, so that the method for refreshing the user interface as described in the second aspect and any possible implementation manner thereof is executed.
第七方面,提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得如第一方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。In a seventh aspect, a computer-readable storage medium is provided, wherein computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on a computer, the first aspect and any possible implementation thereof The method of refreshing the user interface described in the method is executed.
第八方面,提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得如第二方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。In an eighth aspect, a computer-readable storage medium is provided. Computer instructions are stored in the computer-readable storage medium. When the computer instructions are run on a computer, the second aspect and any possible implementation thereof The method of refreshing the user interface described in the method is executed.
第九方面,提供一种计算机程序产品,包括计算机指令,当所述计算机指令在电子设备上运行时,使得如第一方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。In the ninth aspect, there is provided a computer program product, including computer instructions. When the computer instructions are run on the electronic device, the method for refreshing the user interface as described in the first aspect and any possible implementation thereof is provided. be executed.
第十方面,提供一种计算机程序产品,包括计算机指令,当所述计算机指令在电子设备上运行时,使得如第二方面及其任一种可能的实现方式中所述的刷新用户界面的方法被执行。In a tenth aspect, a computer program product is provided, including computer instructions, and when the computer instructions are run on an electronic device, the method for refreshing the user interface as described in the second aspect and any possible implementation thereof be executed.
附图说明Description of drawings
图1是本申请实施例提供的电子设备的结构示意图。FIG. 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图2是本申请实施例提供的电子设备的软件结构示意图。FIG. 2 is a schematic diagram of a software structure of an electronic device provided by an embodiment of the present application.
图3是本申请实施例提供的一种电子设备启动多个应用的示意图。Fig. 3 is a schematic diagram of an electronic device starting multiple applications provided by an embodiment of the present application.
图4是本申请实施例提供的另一种电子设备启动多个应用的示意图。FIG. 4 is a schematic diagram of another electronic device starting multiple applications provided by an embodiment of the present application.
图5是图4中的电子设备启动多个应用的示意性流程图。FIG. 5 is a schematic flowchart of the electronic device in FIG. 4 starting multiple applications.
图6是本申请实施例提供的一种前台应用和后台应用共同访问共享资源的示意图。FIG. 6 is a schematic diagram of a foreground application and a background application jointly accessing a shared resource provided by an embodiment of the present application.
图7是本申请实施例提供的一种将三方应用安装至电子设备中的示意图。FIG. 7 is a schematic diagram of installing a three-party application into an electronic device according to an embodiment of the present application.
图8是本申请实施例提供的一组GUI的示意图。Fig. 8 is a schematic diagram of a group of GUI provided by the embodiment of the present application.
图9是本申请实施例提供的一种刷新用户界面的方法的示意性框架图。Fig. 9 is a schematic framework diagram of a method for refreshing a user interface provided by an embodiment of the present application.
图10是本申请实施例提供的一种刷新界面的方法的示意性流程图。FIG. 10 is a schematic flowchart of a method for refreshing an interface provided by an embodiment of the present application.
图11是本申请实施例提供的另一种刷新界面的方法的示意图流程图。FIG. 11 is a schematic flowchart of another method for refreshing an interface provided by an embodiment of the present application.
图12是本申请实施例提供的一种刷新界面的方法的示意性流程图。FIG. 12 is a schematic flowchart of a method for refreshing an interface provided by an embodiment of the present application.
图13是本申请实施例提供的另一种刷新界面的方法的示意性流程图。FIG. 13 is a schematic flowchart of another method for refreshing an interface provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below with reference to the accompanying drawings.
本申请实施例中的电子设备可以指可穿戴设备,如手环、运动手表等,该电子设备还可以指具有显示屏的其他设备等,该电子设备还可以是用户设备、远程终端、移动设备、用户终端、终端、具有无线通信功能的手持设备,未来5G网络中的终端设备或者未来演进的公用陆地移动通信网络(public land mobile network,PLMN)中的终端设备等,本申请实施例对此并不限定。The electronic device in the embodiment of the present application may refer to a wearable device, such as a bracelet, a sports watch, etc. The electronic device may also refer to other devices with a display screen, etc. The electronic device may also be a user device, a remote terminal, a mobile device , user terminals, terminals, handheld devices with wireless communication functions, terminal devices in the future 5G network or terminal devices in the future evolved public land mobile network (PLMN), etc., the embodiments of the present application address Not limited.
图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。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 (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification 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, bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Wherein, the controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry  processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。The I2S interface can 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 to implement communication between the processor 110 and the audio module 170 .
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。The PCM interface can also be used for audio communication, sampling, quantizing and encoding the analog signal. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。The UART interface is a universal serial data bus used for asynchronous communication. The bus can 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接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193 , the display screen 194 , the wireless communication module 160 , the audio module 170 , the sensor module 180 and so on.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。The USB interface 130 is an interface conforming to the USB standard specification, specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100 , and can also be used to transmit data between the electronic device 100 and peripheral devices.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules shown in the embodiment of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is configured to receive a charging input from a charger. Wherein, the charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger through 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 . While the charging management module 140 is charging the battery 142 , it can also provide power for electronic devices through the power management module 141 .
电源管理模块141用于连接电池142,充电管理模块140与处理器110。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized 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.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。The mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 .
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信 模块150或其他功能模块设置在同一个器件中。A modem processor may include a modulator and a demodulator. Wherein, the modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal is passed to the application processor after being processed by the baseband processor. The application processor outputs sound signals through audio equipment (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In some other embodiments, the modem processor may be independent of the processor 110, and be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。The wireless communication module 160 can provide wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wireless Fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite, etc. applied on the electronic device 100. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),也可以采用有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、Miniled、MicroLed、Micro-oLed或量子点发光二极管(quantum dot light emitting diodes,QLED)等材料中的一种所制作的显示面板。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos and the like. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), or an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode, or an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). Matrix organic light emitting diode (AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed or quantum dot light emitting diodes (quantum dot light emitting diodes, QLED) and other materials. Fabricated display panels. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.
ISP用于处理摄像头193反馈的数据。摄像头193用于捕获静态图像或视频。The ISP is used for processing the data fed back by the camera 193 . Camera 193 is used to capture still images or video.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, so as to expand the storage capacity of the electronic device 100.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。The internal memory 121 may be used to store computer-executable program codes including instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 .
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。 Speaker 170A, also referred to as a "horn", is used to convert audio electrical signals into sound signals.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。 Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
耳机接口170D用于连接有线耳机。The earphone interface 170D is used for connecting wired earphones.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, pressure sensor 180A may be disposed on display screen 194 .
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。The gyro sensor 180B can be used to determine the motion posture of the electronic device 100 .
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes).
距离传感器180F,用于测量距离。The distance sensor 180F is used to measure the distance.
指纹传感器180H用于采集指纹。The fingerprint sensor 180H is used to collect fingerprints.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。Touch sensor 180K, also known as "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the human pulse and receive the blood pressure beating signal.
按键190包括开机键,音量键等。The keys 190 include a power key, a volume key and the like.
马达191可以产生振动提示。The motor 191 can generate a vibrating reminder.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
SIM卡接口195用于连接SIM卡。The SIM card interface 195 is used for connecting a SIM card.
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, which are respectively the application program layer, the application program framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer from top to bottom. The application layer can consist of a series of application packages.
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 2, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in Figure 2, the application framework layer can include window managers, content providers, view systems, phone managers, resource managers, notification managers, and so on.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make it accessible to applications. Said data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebook, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂 断等)。The phone manager is used to provide communication functions of the electronic device 100 . For example, the management of call status (including connected, hung up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the download completion, message reminder, etc. The notification manager can also be a notification that appears on the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, issuing a prompt sound, vibrating the electronic device, and flashing the indicator light, etc.
Android runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android runtime includes core library and virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application program layer and the application program framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。A system library can include multiple function modules. For example: surface manager (surface manager), media library (media libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of various commonly used audio and video formats, as well as still image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing, etc.
2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver.
在介绍本申请的技术方案之前,首先简单介绍以下本申请方案可能涉及的一些专业术语。Before introducing the technical solution of the application, some technical terms that may be involved in the solution of the application are briefly introduced below.
进程(process):是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础。Process: It is a running activity of a program in a computer on a certain data set. It is the basic unit for system resource allocation and scheduling, and the basis of the operating system structure.
线程(thread):是操作系统能够进行运算调度的最小单位。它被包含在进程之中,是进程中的实际运作单位。一条线程指的是进程中一个单一顺序的控制流,一个进程中可以并发多个线程,每条线程并行执行不同的任务。同一进程中的多条线程将共享该进程中的全部系统资源,如虚拟地址空间,文件描述符和信号处理等等。Thread: It is the smallest unit that the operating system can perform operation scheduling. It is included in the process and is the actual operating unit in the process. A thread refers to a single sequential flow of control in a process. Multiple threads can run concurrently in a process, and each thread performs 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, and so on.
MMU隔离:内存管理单元可以对实际的物理内存进行分割和保护,使得每个软件任务只能访问其分配到的内存空间。MMU isolation: The memory management unit can divide and protect the actual physical memory, so that each software task can only access the allocated memory space.
用户界面(user interface,UI):是系统和用户之间进行交互和信息交换的媒介,它实现信息的内部形式与人类可以接受形式之间的转换。目前常用的是图形用户界面,显示直接形象,操作简便,也叫人机界面,简称界面。User interface (user interface, UI): It is a medium for interaction and information exchange between the system and users, which realizes the conversion between the internal form of information and the form acceptable to humans. Currently commonly used is the graphical user interface, which displays a direct image and is easy to operate. It is also called a man-machine interface, or interface for short.
图3是本申请实施例提供的一种电子设备启动多个应用的示意图。Fig. 3 is a schematic diagram of an electronic device starting multiple applications provided by an embodiment of the present application.
参见图3,电子设备1的芯片支持MMU隔离,即系统每启动一个应用(application, App),均会为该App创建一个独立的进程来运行该App,而进程作为最小的资源调度资源,可以与其他进程相互隔离。Referring to Fig. 3, the chip of the electronic device 1 supports MMU isolation, that is, every time the system starts an application (application, App), it will create an independent process for the App to run the App, and the process as the smallest resource scheduling resource can be isolated from other processes.
如图3所示,当电子设备1启动App1时,为该App1创建进程1,该进程1中可以包括UI线程1,该UI线程1用来统一处理App1对UI的更新,该UI线程1可以访问系统为该进程1分配的资源1。As shown in FIG. 3 , when the electronic device 1 starts App1, a process 1 is created for the App1, and the process 1 may include a UI thread 1, and the UI thread 1 is used to uniformly process the update of the UI by App1, and the UI thread 1 may Access resource 1 allocated by the system for this process 1.
当该电子设备1启动App2时,可以为该App2创建进程2,该进程2中可以包括UI线程2,该UI线程2用来统一处理App2对UI的更新,该UI线程2可以访问系统为该进程2分配的资源2。When the electronic device 1 starts App2, a process 2 can be created for the App2, and the process 2 can include a UI thread 2. The UI thread 2 is used to uniformly process the update of the UI by App2. The UI thread 2 can access the system for the Resource 2 allocated by process 2.
其中,该资源1与资源2相互隔离,因此,即使App1和App2并发运行,其访问的资源也是不同的。Wherein, the resource 1 and the resource 2 are isolated from each other, therefore, even if App1 and App2 run concurrently, the resources they access are different.
但是,并不是所有的电子设备均支持MMU隔离,例如,在一些IOT轻量级设备中,其芯片是不支持MMU隔离的。However, not all electronic devices support MMU isolation. For example, in some IOT lightweight devices, their chips do not support MMU isolation.
图4是本申请实施例提供的另一种电子设备启动多个应用的示意图。FIG. 4 is a schematic diagram of another electronic device starting multiple applications provided by an embodiment of the present application.
参见图4,该电子设备2并不支持MMU隔离,即该电子设备全局仅能够运行一个进程,而每个应用分别由一个UI线程来执行,也就是说,当系统同时运行多个应用时,该多个应用对应的UI线程会共同访问系统为进程1分配的资源。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 a UI thread, that is, when the system runs multiple applications at the same time, The UI threads corresponding to the multiple applications will jointly access the resources allocated by the system to the process 1 .
如图4所示,当电子设备启动App1时,创建进程1,该进程1中可以包括App1的UI线程1,该UI线程1用来处理App1对UI的更新,该UI线程1可以访问系统为该进程1分配的资源1。As shown in Figure 4, when the electronic device starts App1, a process 1 is created, which may include a UI thread 1 of App1, and the UI thread 1 is used to process the update of the UI by App1, and the UI thread 1 can access the system as Resource 1 allocated by process 1.
当电子设备启动App2时,继续在进程1中创建App2的UI线程2,该UI线程2用来处理App2对UI的更新,该UI线程2也可以访问资源1。When the electronic device starts App2, it continues to create a UI thread 2 of App2 in the process 1, and the UI thread 2 is used to process the update of the UI by App2, and the UI thread 2 can also access the resource 1.
因此,当App1和App2并发运行时,有可能出现共同调用同一个资源的情况,例如,UI线程1和UI线程2均调用了同一个系统函数,则会出现访问冲突,从而引起功能性异常的问题。Therefore, when App1 and App2 run concurrently, it is possible to call the same resource together. For example, if UI thread 1 and UI thread 2 both call the same system function, an access conflict will occur, which will cause a functional exception. question.
下面结合图5-图6详细介绍该访问冲突的问题。The problem of the access conflict will be described in detail below with reference to FIGS. 5-6 .
图5是图4中的电子设备启动多个应用的示意性流程图。该方案可以包括步骤101至步骤113。FIG. 5 is a schematic flowchart of the electronic device in FIG. 4 starting multiple applications. The scheme may include step 101 to step 113 .
101,系统开机启动。101. The system starts up.
例如,用户长按电子设备的电源键,使得电子设备开机启动。For example, the user presses and holds the power button of the electronic device, so that the electronic device is turned on.
102,启动管理模块,创建系统图形送显线程。102. Start the management module, and create a system graphics sending and display thread.
其中,该线程负责处理系统的图形显示,如开机动画,桌面显示等。Among them, the thread is responsible for processing the graphic display of the system, such as boot animation, desktop display and so on.
103,图形绘制模块创建系统图形根节点。103. The graphics drawing module creates a system graphics root node.
其中,系统图形根节点是负责挂接所有应用的图形组件树的根容器,每个应用的组件树可以是该图形根节点的子组件树。Wherein, the system graphic root node is a root container responsible for mounting the graphic component trees of all applications, and the component tree of each application may be a subcomponent tree of the graphic root node.
104,图像绘制模块对系统图形进行渲染。104. The image drawing module renders the system graphics.
该步骤中,图像绘制模块对系统图形进行渲染可以理解为,图像绘制模块从系统根节点开始遍历所有子组件树,并对该子组件树中的组件进行依次绘制并输出到统一的图形缓冲区(buffer)中。In this step, the rendering of the system graphics by the image drawing module can be understood as the image drawing module traversing all sub-component trees starting from the system root node, and sequentially drawing the components in the sub-component tree and outputting them to a unified graphics buffer (buffer).
105,将渲染后的系统图形送至屏幕中显示。105. Send the rendered system graphics to the screen for display.
该步骤中,可以调用系统接口将渲染后的系统图形(即图形缓冲区中的组件)送至屏幕驱动中输出显示。此时,电子设备的屏幕中可以显示系统桌面。In this step, the system interface can be called to send the rendered system graphics (that is, the components in the graphics buffer) to the screen driver for output and display. At this point, the system desktop may be displayed on the screen of the electronic device.
应理解,该步骤101至步骤105为可选步骤,在一些实施例中,该技术方案可以从已经处于开机启动状态的电子设备中执行,即可以从步骤106开始执行。It should be understood that the steps from step 101 to step 105 are optional steps, and in some embodiments, the technical solution can be executed from the electronic device that is already in the power-on state, that is, it can be executed from step 106 .
106,启动App1。106. Start App1.
例如,用户在电子设备的桌面内点击该App1的应用图标,以启动该App1。For example, the user clicks the application icon of the App1 on the desktop of the electronic device to start the App1.
107,启动管理模块创建App1的主线程。107. Start the management module to create the main thread of App1.
108,启动管理模块将该App1的信息发送至应用运行管理模块。108. The startup management module sends the App1 information to the application operation management module.
该App1的信息可以包括该App1的包名、用户身份证明(user identification,UID)等信息。The information of the App1 may include the package name of the App1, user identification (user identification, UID) and other information.
109,应用运行管理模块加载并运行App1的代码。109. The application operation management module loads and runs the code of App1.
110,应用运行管理模块创建App1的组件树1。110. The application operation management module creates a component tree 1 of App1.
111,应用运行管理模块在组件树1上设置UI属性。111. The application operation management module sets UI attributes on the component tree 1.
例如,设置显示组件的长度、宽度、颜色、透明度等UI属性。For example, set UI properties such as length, width, color, and transparency of the display component.
112,应用运行管理模块挂接组件树1根节点到系统根节点。112. The application operation management module connects the component tree 1 root node to the system root node.
其中,应用运行管理模块将设置了UI属性的组件树1根节点挂接到系统根节点,以使得图形绘制模块绘制App1的UI。Wherein, the application operation management module hooks the root node of the component tree 1 with the UI attribute set to the root node of the system, so that the graphic drawing module draws the UI of App1.
113,UI发生变更。113. The UI changes.
应理解,上述步骤106至步骤113示出了启动App1的过程,对于App2的启动可以参见上述步骤,为了简洁,不再赘述。It should be understood that the above steps 106 to 113 show the process of starting App1, and the above steps can be referred to for starting App2, and details are not repeated for brevity.
通过上述步骤可知,每个App都拥有自己的线程和组件树,且UI变更都在自己的主线程上进行,由于线程是CPU执行调度最小的单元,所以在程序代码语句的执行上,对于同一个函数,有可能出现并发执行的情况,从而可能会出现访问冲突,从而引起功能性异常的问题。Through the above steps, we can see that each App has its own thread and component tree, and UI changes are all performed on its own main thread. Since a thread is the smallest unit of CPU execution scheduling, in the execution of program code statements, for the same A function may be executed concurrently, which may cause access violations, which may cause functional exceptions.
示例性地,调用者会通过UI函数库中的SetText(int fontsize,const char*text)接口,传入要设置的姿态的字形大小和文字字串,假设SetText接口在实现上使用了一个全局变量g_fontsize来记录要显示的文字的大小。For example, the caller will pass in the font size and text string of the posture to be set through the SetText(int fontsize, const char*text) interface in the UI function library, assuming that the SetText interface uses a global variable in its implementation g_fontsize to record the size of the text to be displayed.
当App1的UI线程1和App2的UI线程2在同一时刻均调用该SetText接口,则可能会出现访问冲突,造成文字花屏等现象。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, resulting in text blur and other phenomena.
参见图6,图6是本申请实施例提供的一种前台应用和后台应用共同访问共享资源的示意图。Referring to FIG. 6 , FIG. 6 is a schematic diagram of a foreground application and a background application jointly accessing a shared resource provided by an embodiment of the present application.
App1为前台应用,App2和App3为后台应用,即电子设备当前的界面中显示的界面为App1的显示界面,App2和App3与App1并发运行,但该App2和App3的显示界面对于用户不可见。App1 is a foreground application, App2 and App3 are background applications, that is, the interface displayed on the current interface of the electronic device is the display interface of App1, and App2 and App3 run concurrently with App1, but the display interfaces of App2 and App3 are invisible to the user.
其中,App1的组件树为组件树1,App2的组件树为组件树2,App3的组件树为组件树3。Wherein, the component tree of App1 is component tree 1, the component tree of App2 is component tree 2, and the component tree of App3 is component tree 3.
示例性地,App1的节点1调用SetText(“AA”,fontsize:30),App2的节点2调用SetText(“AA”,fontsize:38),可见两个应用同时访问了字体库公共资源,则有可能造成文字花屏的现象。For example, node 1 of App1 calls SetText("AA", fontsize: 30), node 2 of App2 calls SetText("AA", fontsize: 38), it can be seen that the two applications access the font library public resources at the same time, then there is It may cause the phenomenon of text blur.
有鉴于此,本申请实施例提供一种刷新界面的方法,该技术方案可以缓存后台运行的应用发生的UI变更对应的UI变更请求,在该后台应用可见时,将该UI变更应用到用户界面上,从而可以避免多个应用并发访问带来的冲突问题。In view of this, the embodiment of the present application provides a method for refreshing the interface. The technical solution can cache the UI change request corresponding to the UI change of the application running in the background, and apply the UI change to the user interface when the background application is visible. In this way, conflicts caused by concurrent access by multiple applications can be avoided.
图7是本申请实施例提供的一种将三方应用安装至电子设备中的示意图。FIG. 7 is a schematic diagram of installing a three-party application into an electronic device according to an embodiment of the present application.
参见图7,电子设备200a可以是手机,电子设备200b可以是可穿戴设备,如运动手表。其中,运动手表可以通过蓝牙、无线或有线等方式与手机建立连接。Referring to FIG. 7, the electronic device 200a may be a mobile phone, and the electronic device 200b may be a wearable device, such as a sports watch. Among them, the sports watch can establish a connection with the mobile phone through Bluetooth, wireless or wired methods.
运动手表可以在手机的协助下安装第三方应用,例如,手机在云端的应用市场中下载第三方应用的安装包,并安装在运动手表中。The sports watch can install a third-party application with the assistance of the mobile phone. For example, the mobile phone downloads the installation package of the third-party application in the application market in the cloud, and installs it in the sports watch.
如图7所示,该第三方应用可以是“天气”、“音乐”、App2等,当该应用安装至运动手表中时,通过用户的操作,可以在运动手表的显示界面中显示该安装的多个应用的应用图标和应用名称等。As shown in Figure 7, the third-party application can be "Weather", "Music", App2, etc. When the application is installed in the sports watch, through the user's operation, the installed information can be displayed on the display interface of the sports watch. App icon and app name etc. for multiple apps.
当用户点击“音乐”的图标或文字时,运动手表可以显示“音乐”的显示界面,则“音乐”为运动手表的前台应用,此时,该运动手表仍可以接收手机的启动应用的指令,例如,用户在手机中进行了拉起App2的操作,则运动手表会将“音乐”从前台切换至后台,并将App2的界面显示在前台,此时,“音乐”和App2均处于运行状态。前台App2可以直接响应于用户触摸等操作事件而改变UI,而对于后台应用“音乐”,仍可能会因自身的处理逻辑触发UI改变。When the user clicks on the icon or text of "Music", the sports watch can display the display interface of "Music", and "Music" is the foreground application of the sports watch. At this time, the sports watch can still receive the instruction of starting the application from the mobile phone. For example, if the user pulls up App2 on the mobile phone, the sports watch will switch "Music" from the foreground to the background, and display the interface of App2 in the foreground. At this time, both "Music" and App2 are running. The foreground App2 can directly change the UI in response to user touch and other operation events, while the background application "Music" may still trigger UI changes due to its own processing logic.
图8是本申请实施例提供的一组图形用户界面(graphics user interface,GUI)的示意图。其中,从图8中的(a)至(h)示出了用户在手机和运动手表中对运动手表的操作过程。FIG. 8 is a schematic diagram of a group of graphical user interfaces (graphics user interface, GUI) provided by the embodiment of the present application. Among them, (a) to (h) in FIG. 8 show the user's operation process on the sports watch in the mobile phone and the sports watch.
参见图8中的(a),该GUI为运动手表300b的显示界面310,该显示界面310中可以包括该运动手表安装的多个应用,可以包括应用“天气”、“音乐”、“App2”等,当运动手表检测到用户点击App2的应用图标311或应用名称或应用名称所在的区域时,可以显示如图8中的(b)所示的GUI。Referring to (a) in FIG. 8, the GUI is the display interface 310 of the sports watch 300b, and the display interface 310 may include multiple applications installed on the sports watch, including the applications "weather", "music" and "App2" etc., when the sports watch detects that the user clicks on the application icon 311 of App2 or the application name or the area where the application name is located, the GUI as shown in (b) in FIG. 8 may be displayed.
应理解,当用户手指向上或向下滑动运动手表的屏幕时,可以以滚动的形式显示运动手表安装的其他应用。It should be understood that when the user slides the screen of the sports watch up or down with a finger, other applications installed on the sports watch may be displayed in a scrolling manner.
参见图8中的(b),该GUI为App2的显示界面320。该显示界面320中可以包括图像321和其他图形等。Referring to (b) in FIG. 8 , the GUI is the display interface 320 of App2. The display interface 320 may include an image 321 and other graphics and the like.
参见图8中的(c),该GUI为手机300a的显示桌面350,该显示桌面350中可以包括手机中安装的多个应用。当手机检测到用户点击运动健康的应用图标351的操作之后,可以显示如图8中的(d)所示的GUI。Referring to (c) in FIG. 8, the GUI is a display desktop 350 of the mobile phone 300a, and the display desktop 350 may include multiple applications installed in the mobile phone. After the mobile phone detects that the user clicks the application icon 351 of sports and health, the GUI as shown in (d) in FIG. 8 may be displayed.
参见图8中的(d),该GUI为运动健康的首先显示界面360。该显示界面360中可以包括多个功能卡片,以及多个功能控件,每个功能控件可以对应一个显示界面。当手机检测到用户点击功能控件361的操作之后,可以显示如图8中的(e)所示的GUI。Referring to (d) in FIG. 8 , the GUI is the first display interface 360 of sports health. The display interface 360 may include a plurality of function cards and a plurality of function controls, and each function control may correspond to a display interface. After the mobile phone detects that the user clicks on the function control 361, it may display a GUI as shown in (e) in FIG. 8 .
参见图8中的(e),该GUI为功能控件361对应的显示界面370。该显示界面370中可以包括功能卡片371,该功能卡片371中可以包括当前与手机连接的运动手表的名称HUAWEI WATCH GT2 PRO,以及该HUAWEI WATCH GT2 PRO的图标等。该显示界面370中还可以包括与手机连接过的其他智能设备,如华为体脂称、华为音箱等等。当手机检测到用户点击功能卡片371的操作之后,可以显示如图8中的(f)所示的GUI。Referring to (e) in FIG. 8 , the GUI is the 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 the name of the sports watch currently connected to the mobile phone, HUAWEI WATCH GT2 PRO, and the icon of the HUAWEI WATCH GT2 PRO. The display interface 370 may also include other smart devices that have been connected to the mobile phone, such as Huawei body fat scales, Huawei speakers, and the like. After the mobile phone detects that the user clicks on the function card 371, the GUI shown in (f) in FIG. 8 may be displayed.
参见图8中的(f),该GUI为功能卡片371对应的显示界面380。该显示界面380中可以包括HUAWEI WATCH GT2 PRO的状态卡片382,该状态卡片382中可以包括该运动手表的连接状态、电量等;该显示界面380中还可以包括运动手表的表盘市场,用户可以在该表盘市场中下载相应的表盘并安装至运动手表中;该显示界面380中还可以包括一些应用,可以包括“天气”、“健康监测”、“心脏健康研究体验”以及“App1”等。当用户点击“App1”的卡片381的操作之后,运动手表可以显示如图8中的(g)所示的GUI。Referring to (f) in FIG. 8 , the GUI is the display interface 380 corresponding to the function card 371 . The display interface 380 may include a status card 382 of the HUAWEI WATCH GT2 PRO, which may include the connection status, power, etc. of the sports watch; Download the corresponding dial from the watch face market and install it into the sports watch; the display interface 380 may also include some applications, including "weather", "health monitoring", "heart health research experience" and "App1". After the user clicks on the operation of the card 381 of "App1", the sports watch may display a GUI as shown in (g) in FIG. 8 .
参见图8中的(g),该GUI为App1的显示界面330,其中,该显示界面330可以是半透明状态,即该显示界面330的上层显示App1的显示界面,但通过该显示界面用户仍可以看到位于后台的App2的显示界面320。Referring to (g) in FIG. 8 , the GUI is the display interface 330 of App1, wherein the display interface 330 can be in a translucent state, that is, the upper layer of the display interface 330 displays the display interface of App1, but the user can still view the display interface through the display interface. A display interface 320 of App2 located in the background can be seen.
当运动手表检测到用户在屏幕330中上滑或下滑的操作之后,可以显示人如图8中的(h)所示的GUI。After the sports watch detects the user's operation of sliding up or down on the screen 330, a GUI as shown in (h) in FIG. 8 may be displayed.
在一些示例中,该显示界面330也可以不是半透明状态,即该显示界面330中仅显示App1的显示界面,处于后台运行的App2的显示界面对于用户不可见。In some examples, the display interface 330 may not be translucent, that is, only the display interface of App1 is displayed on the display interface 330, and the display interface of App2 running in the background is invisible to the user.
在另一些示例中,该显示界面330也可以处于非全屏状态,例如,该显示界面330可以半屏显示,则另外半屏可以用于显示后台应用App2的显示界面等。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 on a half-screen, and the other half-screen may be used to display the display interface of the background application App2 and the like.
参见图8中的(h),该GUI为App2的显示界面340,且该显示界面340中的图形341的颜色与图8中的(b)中图像321的相比发生了变化。Referring to (h) in FIG. 8 , the GUI is the display interface 340 of App2, and the color of the graphic 341 in the display interface 340 has changed compared with that of the image 321 in (b) in FIG. 8 .
应理解,在App2处在后台运行时,当其发生UI变更时,该UI变更不会立即执行,而是该App2切换至前台后,该UI变更才显示在显示界面中。It should be understood that when App2 is running in the background, when a UI change occurs, the UI change will not be executed immediately, but will be displayed on the display interface only after the App2 is switched to the foreground.
该技术方案可以避免前台与后台并发运行的应用访问同一个资源时引起的访问冲突问题。The technical solution can avoid the problem of access conflict caused when applications running concurrently in the foreground and the background access the same resource.
图9是本申请实施例提供的一种刷新用户界面的方法的示意性框架图。本申请实施例中的组件树的组件也可以称为节点。Fig. 9 is a schematic framework diagram of a method for refreshing a user interface provided by an embodiment of the present application. The components of the component tree in the embodiment of the present application may also be referred to as nodes.
参见图9,App1是处于电子设备的前台应用,即该App1为电子设备的屏幕中当前显示的应用,其UI对用户可见。当App1的组件树1的组件1发生变更时,可以直接将该变更应用到组件1中,即可以直接在电子设备的显示界面中显示该UI变化。Referring to FIG. 9 , App1 is an application in the foreground of the electronic device, that is, App1 is an application currently displayed on the screen of the electronic device, and its UI is visible to the user. When the 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 on the display interface of the electronic device.
App2是处于电子设备的后台应用,即该App2尽管正在运行,但是其UI对用户不可见。当该App2的组件树2的组件2发生变更时,不是直接将该变更应用到组件2中,而是可以将该UI变更进行缓存,当该App2切换至前台显示时,在电子设备绘制App2的第一帧画面之前,将该UI变更应用到组件2中,即当电子设备显示App2的UI时,该UI为包含了上述UI变更的界面。App2 is a background application on the electronic device, that is, although the App2 is running, its UI is not visible to the user. When the component 2 of the component tree 2 of the App2 is changed, instead of directly applying the change to the component 2, the UI change can be cached, and when the App2 is switched to the foreground display, the electronic device draws the App2 Before the first frame, the UI change is applied to component 2, that is, when the electronic device displays the UI of App2, the UI is an interface including the above UI change.
应理解,当该App2的组件树2的多个UI组件发生变更时,可以将该多个UI变更依次缓存起来,当该App2切换至前台显示时,在电子设备绘制App2的第一帧画面之前,将该多个UI变更依次应用到组件树中对应的组件中,即当电子设备显示App2的UI时,该UI为包含了上述多个UI变更的界面。It should be understood that when multiple UI components of the component tree 2 of the App2 are changed, the multiple UI changes can be cached sequentially, and when the App2 is switched to the foreground display, before the electronic device draws the first frame of the App2 , applying the multiple UI changes to corresponding components in the component tree in sequence, that is, when the electronic device displays the UI of App2, the UI is an interface that includes the above multiple UI changes.
本申请实施例中,电子设备可以根据后台应用的UI变更的变更细节,将该UI变更生成UI变更请求,并可以将该UI变更请求加入缓存的数据结构中,该数据结构可以是数组、队列、链表等。示例性地,该数据结构为队列,则电子设备可以将该UI变更请求加入该 缓存队列中,或者当有多个UI变更请求时,可以根据该多个UI变更请求的时间顺序将该多个UI变更请求依次加入该缓存队列中。In the embodiment of the present application, the electronic device can generate a UI change request for the UI change according to the change details of the UI change of the background application, and can add the UI change request to the cached data structure, and the data structure can be an array, a queue , linked list, etc. Exemplarily, the data structure is a queue, and the electronic device can add the UI change request to the cache queue, or when there are multiple UI change requests, it can place the multiple UI change requests according to the time sequence of the multiple UI change requests UI change requests are sequentially added to the cache queue.
应理解,该缓存队列中的UI变更请求可以依据先进先出的原则依次被执行。It should be understood that the UI change requests in the cache queue may be executed sequentially according to the principle of first-in-first-out.
该变更细节可以包括但不限于该UI变更对应的UI组件,以及该UI组件的属性,以及变更后的属性的值等,该UI组件的属性可以包括但不限于该组件的长、宽、颜色等特性或样式等。The change details may include but not limited to the UI component corresponding to the UI change, the properties of the UI component, and the value of the changed property, etc. The properties of the UI component may include but not limited to the length, width, and color of the component etc. features or styles etc.
在一些实施例中,后台先后触发多个UI变更,电子设备将该多个UI变更中的每个UI变更生成UI变更请求,当该多个UI变更请求对应的UI变更的UI组件的属性为同一个时,可以缓存后检测到的UI变更对应的UI变更请求,并删除缓存的前一个与该UI变更请求对应的UI组件的属性相同的UI变更请求。例如,UI变更请求1对应的UI组件1的属性为颜色,如红色,UI变更请求2对应的UI组件1的属性同样为颜色,如黄色,且UI变更请求1在前,UI变更请求2在后,则电子设备首先缓存UI变更请求1,当生成UI变更请求2之后,将缓存的UI变更请求1删除,并缓存该UI变更请求2,从而可以避免额外增加缓存节点,减少了内存开销,以及多余的UI刷新开销。In some embodiments, the background triggers multiple UI changes one after another, and the electronic device generates a UI change request for each UI change in the multiple UI changes. When the attributes of the UI component of the UI change corresponding to the multiple UI change requests are When the same, the UI change request corresponding to the detected UI change may be cached, and the previous cached UI change request with the same property as the UI component corresponding to the UI change request may be deleted. For example, the attribute of UI component 1 corresponding to UI change request 1 is color, such as red, and the attribute of UI component 1 corresponding to UI change request 2 is also the color, such as yellow, and UI change request 1 is in front, and UI change request 2 is in Afterwards, the electronic device first caches the UI change request 1, and after generating the UI change request 2, deletes the cached UI change request 1 and caches the UI change request 2, thereby avoiding additional cache nodes and reducing memory overhead. and redundant UI refresh overhead.
在另一些实施例中,后台先后触发多个UI变更,电子设备将该多个UI变更中的每个UI变更生成UI变更请求,当该多个UI变更请求对应的UI变更的UI组件的属性为同一个时,可以用后一个UI变更请求对应的UI组件的属性的值更新缓存的UI变更请求对应的UI组件的属性的值,从而可以无需增加新的缓存节点。例如,缓存队列中缓存了UI变更请求1,对应的UI组件1的属性为颜色,如红色,后一时刻,缓存队列接收到了UI变更请求2,其对应的UI组件1的属性同样为颜色,如黄色,则只需将缓存的UI变更请求1中对应的UI组件1的颜色变更为黄色,而无需缓存UI变更请求2,从而可以避免额外增加缓存节点,减少了内存开销,以及多余的UI刷新开销。In other embodiments, the background triggers multiple UI changes successively, and the electronic device generates a UI change request for each of the multiple UI changes. When the multiple UI change requests correspond to the properties of the UI component of the UI change When they are the same, the value of the attribute of the UI component corresponding to the latter UI change request can be used to update the value of the attribute of the UI component corresponding to the cached UI change request, so that there is no need to add a new cache node. For example, UI change request 1 is cached in the cache queue, and the corresponding property of UI component 1 is color, such as red. At a later moment, the cache queue receives UI change request 2, and the corresponding property of UI component 1 is also color, If it is yellow, you only need to change the color of the corresponding UI component 1 in the cached UI change request 1 to yellow, without caching the UI change request 2, so as to avoid additional cache nodes, reduce memory overhead, and redundant UI Refresh overhead.
图10是本申请实施例提供的一种刷新用户界面的方法的示意性流程图。如图10所示,该方法可以应用于电子设备中,该方法可以包括步骤501至步骤514。FIG. 10 is a schematic flowchart of a method for refreshing a user interface provided by 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,运行在后台的应用触发UI变更。501. An application running in the background triggers a UI change.
应理解,该应用运行后台,可以与前台应用并发运行。例如,当该应用处在后台,接收到系统的分布式消息时,可以触发UI变更。It should be understood that the application runs in the background and can run concurrently with the foreground application. For example, when the application is in the background and receives a distributed message from the system, a UI change can be triggered.
在一些实施例中,该分布式消息可以是手机推送给手表的后台应用的通讯信息,例如,手表上运行了骑行导航应用,该应用在运行期间会不断接收由手机上的对应骑行导航应用发送来的导航方向提示信息,并显示到手表的显示屏中;当手表中的该骑行导航应用被切换至后台后,虽然手表的显示屏中不再显示该骑行导航应用的UI信息,但是该应用仍会不断接收手机发送的消息。In some embodiments, the distributed message may be the communication information pushed by the mobile phone to the background application of the watch. For example, the cycling navigation application is running on the watch, and the application will continuously receive information from the corresponding cycling navigation application on the mobile phone during operation. The navigation direction prompt information sent by the application is displayed on the display screen of the watch; when the cycling navigation application in the watch is switched to the background, although the UI information of the cycling navigation application is no longer displayed on the display screen of the watch , but the app will continue to receive messages from the phone.
在另一些实施例中,手表中启动了某个应用,该应用每间隔一段时间会改变UI,但在间隔时间段内,用户将该应用切换至后台,则在间隔时间到达之后,仍会触发UI变更。In some other embodiments, a certain application is started on the watch, and the application will change the UI every interval, but during the interval period, the user switches the application to the background, after the interval time is reached, it will still trigger UI changes.
502,电子设备检测到UI变更。502. The electronic device detects a UI change.
在一些实施例中,该步骤502可以由电子设备中的应用框架(application framework)来执行。应用框架可以向应用提供应用编程接口(application programming interface,API)和编程框架,例如,应用框架中可以包括一些预先定义的函数等。应用可以通过调用系统API访问电子设备的系统能力。当应用的UI发生变更时,该应用会调用相应的API,因 此,应用框架可以检测到该UI变更。In some embodiments, step 502 may be performed by an application framework in the electronic device. The application framework may provide the application with an application programming interface (application programming interface, API) and a programming framework. For example, the application framework may include some predefined functions and the like. The application can access the system capability of the electronic device by calling the system API. When the UI of the application changes, the application will call the corresponding API, so the application framework can detect the UI change.
在一些可选地实施例中,电子设备可以确定是否需要缓存该UI变更,该过程可以包括步骤503至步骤505。In some optional embodiments, the electronic device may determine whether the UI change needs to be cached, and the process may include step 503 to step 505 .
503,应用框架向变更管理模块查询是否需要将UI变更进行缓存。503. The application framework queries the change management module whether the UI changes need to be cached.
其中,该变更管理模块用于处理所有的缓存动作,以及缓存的更新应用流程。Wherein, the change management module is used to handle all cache actions and cache update application process.
504,变更管理模块确定该UI变更是否属于后台。504. The change management module determines whether the UI change belongs to the background.
当该变管理模块确定该UI变更属于后台时,可执行步骤505;当该变更管理模块确定该UI变更不属于后台,即该UI变更属于前台时,可执行步骤514。When the change management module determines that the UI change belongs to the background, step 505 can be performed; when the change management module determines that the UI change does not belong to the background, that is, the UI change belongs to the foreground, step 514 can be performed.
505,当变更管理模块确定该UI变更属于后台时,向该应用框架返回需要变更的确认结果。505. When the change management module determines that the UI change belongs to the background, return a confirmation result that the change needs to be made to the application framework.
示例性地,当变更管理模块确定该UI变更属于后台时,向应用框架返回“是”的确认结果。Exemplarily, when the change management module determines that the UI change belongs to the background, a confirmation result of "yes" is returned to the application framework.
应理解,在一些实施例中,电子设备也可以无需确定是否需要缓存该UI变更,而是根据该UI变更的变更细节生成UI变更请求。It should be understood that, in some embodiments, the electronic device may also generate a UI change request according to the change details of the UI change without determining whether the UI change needs to be cached.
示例性地,电子设备根据UI的变更细节生成UI变更请求的过程可以包括步骤506至步骤507。Exemplarily, the process for the electronic device to generate a UI change request according to the change details of the UI may include steps 506 to 507 .
506,该应用框架将UI变更细节提交至变更生成模块。506. The application framework submits the UI change details to the change generating module.
示例性地,该应用框架可以通过系统接口将该UI变更细节提交至变更生成模块中。Exemplarily, the application framework can submit the UI change details to the change generation module through the system interface.
其中,该UI变更细节可以包括:发生变化的UI组件、变更了什么属性,变更后的值等,该属性可以包括但不限于组件的宽、高等,颜色、透明度等等。Wherein, the UI change details may include: the changed UI component, what attribute is changed, the changed value, etc. The attribute may include but not limited to the width, height, etc., color, transparency, etc. of the component.
示例性地,该UI组件原本对应界面中的一个功能卡片,其背景颜色为黄色,则该UI变更细节可以为将背景颜色变为红色。Exemplarily, the UI component originally corresponds to a function card in the interface, and its background color is yellow, so the UI change details may be to change the background color to red.
507,变更生成模块根据UI变更细节生成UI变更请求。507. The change generation module generates a UI change request according to the UI change details.
变更生成模块根据UI变更细节生成UI变更请求,即变更生成模块将接收到的上述UI变更细节设置到UI变更请求的数据结构中。The change generation module generates a UI change request according to the UI change details, that is, the change generation module sets the received UI change details into the data structure of the UI change request.
电子设备生成UI变更请求之后,可以缓存该UI变更请求,其中,电子设备缓存该UI变更请求的过程可以包括步骤508至步骤509。After the electronic device generates the UI change request, it may cache the UI change request, wherein the process for the electronic device to cache the UI change request may include steps 508 to 509 .
508,该变更生成模块将该UI变更请求提交至变更缓存模块。508. The change generation module submits the UI change request to the change cache module.
示例性地,该变更生成模块通过系统接口将该UI变更请求提交至变更缓存模块。Exemplarily, the change generation module submits the UI change request to the change cache module through the system interface.
509,变更缓存模块将该UI变更请求加入缓存的数据结构中。509. The change cache module adds the UI change request into a cached data structure.
其中,该缓存的数据结构可以包括但不限于链表、数组或队列等结构。Wherein, the cached data structure may include but not limited to structures such as linked list, array or queue.
示例性地,该缓存的数据结构采用队列结构,则该变更缓存模块将该UI变更请求加入缓存队列中,当有多个UI变更请求时,将该多个UI变更请求依次加入该缓存队列中,该缓存队列可以采用先进先出的方式,即最先进入该缓存队列中的UI变更请求最先被处理。Exemplarily, the data structure of the cache adopts a queue structure, then the change cache module adds the UI change request to the cache queue, and when there are multiple UI change requests, the multiple UI change requests are sequentially added to the cache queue , the cache queue may adopt a first-in-first-out manner, that is, the UI change request that first enters the cache queue is processed first.
应理解,当该应用切换回前台显示时,电子设备可以将该UI变更请求对应的UI变更更新至应用的UI中,该过程可以包括步骤510至步骤513。It should be understood that when the application is switched back to the foreground display, the electronic device may update the UI change corresponding to the UI change request to the UI of the application, and this process may include steps 510 to 513 .
510,应用切换回前台显示。510. The application switches back to the foreground display.
示例性地,参见图8中的(g)、(h)所示,响应于用户在运动手表屏幕中滑动的操 作,该应用App2从后台切换至前台显示。For example, as shown in (g) and (h) in Figure 8, in response to the user's operation of sliding on the screen of the sports watch, the application App2 is switched from the background to the foreground display.
或者,在前台应用退出后,该应用从后台被调度到前台。Alternatively, after the foreground app exits, the app is scheduled from the background to the foreground.
511,应用将已切换回前台显示的状态通知变更管理模块。511. The application will switch back to the state displayed in the foreground to notify the change management module.
示例性地,应用通过调用系统接口将该应用切换回前台显示的状态通知变更管理模块。Exemplarily, the application notifies the change management module of the status of switching the application back to the foreground display by calling the system interface.
512,变更管理模块遍历缓存列表中缓存的UI变更请求,确定需要被执行的UI变更请求。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.
示例性地,该缓存列表为缓存队列,则该变更管理模块依次遍历该缓存队列中缓存的UI变更请求,确定需要被执行的UI变更请求。Exemplarily, the cache list is a cache queue, and the change management module sequentially traverses the UI change requests cached in the cache queue to determine the UI change requests that need to be executed.
513,将UI变更应用到UI组件中。513. Apply the UI change to the UI component.
该步骤中,可以通过调用对应的系统接口将该UI变更应用到相应的UI组件中,以使得该UI组件对应的显示界面发生变化或部分发生变化。In this step, the UI change can 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 partially changes.
应理解,当有多个UI变更时,可在应用切换回前台显示时的第一帧画面绘制前依次将该多个UI变更应用到对应的UI组件中,即应用切换回前台显示的界面已经是多个UI变更之后的界面了。It should be understood that when there are multiple UI changes, the multiple UI changes can be applied to the corresponding UI components in sequence before the first frame is drawn when the application switches back to the foreground display, that is, the interface that the application switches back to the foreground display has been It is the interface after multiple UI changes.
514,清空缓存列表。514. Clear the cache list.
当该缓存列表中缓存的UI变更请求被执行完成后,清空该缓存列表。After the UI change request cached in the cache list is executed, the cache list is cleared.
应理解,该步骤514为可选步骤。It should be understood that step 514 is an optional step.
还应理解,上述步骤仅仅是示意性的,本申请实施例对于上述步骤的实施顺序不予限定。在一些实施例中,也可以使用电子设备中的其他的模块实现上述功能或步骤,本申请实施例对此不予限定。It should also be understood that the above steps are only illustrative, and the implementation sequence of the above steps is not limited in the embodiment of the present application. 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 embodiment of the present application.
基于本申请实施例,处于后台的应用的UI变更消息会被缓存在列表中,在该应用切换回前台显示时,将缓存的UI变更依次应用到UI组件中,从而可以避免多个并发运行的应用可能带来的功能性异常的问题。Based on the embodiment of this application, the UI change message of the application in the background will be cached in the list, and when the application is switched back to the foreground display, the cached UI changes will be applied to the UI components in sequence, so as to avoid multiple concurrently running Functional abnormalities that may be brought about by the application.
图11是本申请实施例提供的另一种刷新用户界面的方法的示意性流程图。如图11所示,该方法可以包括步骤601至步骤617。FIG. 11 is a schematic flowchart of another method for refreshing a user interface provided by an embodiment of the present application. As shown in FIG. 11 , the method may include steps 601 to 617 .
601,系统开机启动。601. The system starts up.
例如,用户可以长按电子设备的电源键,使得电子设备开机启动。For example, the user may press and hold the power button of the electronic device to start the electronic device.
应理解,该步骤601为可选步骤,在一些实施例中,该技术方案也可以在已经开机启动的电子设备中实现。It should be understood that step 601 is an optional step, and in some embodiments, this technical solution may also be implemented in an electronic device that has already been started.
602,启动系统UI服务线程。602. Start the system UI service thread.
603,启动App1。603. Start App1.
例如,用户在电子设备的桌面内点击该App1的应用图标,以启动该App1。For example, the user clicks the application icon of the App1 on the desktop of the electronic device to start the App1.
在一些实施例中,步骤602也可以位于步骤603之后,本申请对于步骤602、步骤603的执行顺序不予限定。In some embodiments, step 602 may also be located after step 603, and the application does not limit the execution sequence of step 602 and step 603.
604,启动管理模块启动App1的线程1。604. The start management module starts thread 1 of App1.
605,线程1加载并运行App1的代码。605. Thread 1 loads and runs the code of App1.
606,线程1加载App1的用户界面。606. Thread 1 loads the user interface of App1.
607,线程1设置App1的UI组件的属性。607. Thread 1 sets the property of the UI component of App1.
例如,在组件树上设置相应UI组件的属性。For example, setting properties of corresponding UI components on the component tree.
具体地,该UI服务线程调用系统接口,将变更设置到UI组件中。Specifically, the UI service thread invokes the system interface to set the change in the UI component.
608,启动App2。608. Start App2.
例如,用户在电子设备的桌面内点击该App2的应用图标,以启动该App2。或者,该App2可以通过另一电子设备启动,例如,参见图8中的(f)、(g),运动手表中的应用可以通过手机端来启动。For example, the user clicks the application icon of the App2 on the desktop of the electronic device to start the App2. Alternatively, the App2 can be started by another electronic device, for example, referring to (f) and (g) in FIG. 8 , the application in the sports watch can be started by the mobile phone.
609,启动管理模块启动App2的线程2。609. The startup management module starts thread 2 of App2.
610,线程2加载并运行App2的代码。610. Thread 2 loads and runs the code of App2.
611,线程2加载App2的用户界面。611. Thread 2 loads the user interface of App2.
612,线程2设置App2的UI组件的属性。612. Thread 2 sets the property of the UI component of App2.
613,当App1的第一UI变更时,线程1将该UI变更的消息发送至UI服务线程。613. When the first UI of App1 is changed, thread 1 sends the UI change message to the UI service thread.
在另一些实施例中,当该UI服务线程接收到多个UI变更消息时,可以将该多个UI变更的消息放入队列中,并依次执行。In some other embodiments, when the UI service thread receives multiple UI change messages, the multiple UI change messages may be put into a queue and executed sequentially.
614,UI服务线程将第一UI变更应用到UI组件中。614. The UI service thread applies the first UI change to the UI component.
在一些实施例中,UI服务线程将该第一UI变更的信息应用到对应的UI组件中,并将App1的组件树挂接到电子设备的系统根节点中,电子设备的图形绘制模块可以从系统根节点开始遍历所有的子组件树,并依次绘制子组件树的组件,并将绘制的组件送至屏幕驱动中显示,从而可以在电子设备的屏幕中显示变更后的App2的UI。In some embodiments, the UI service thread applies the information of the first UI change to the corresponding UI component, and attaches the component tree of App1 to the system root node of the electronic device, and the graphics drawing module of the electronic device can be accessed from the system The root node starts to traverse all the sub-component trees, draws the components of the sub-component tree in turn, and sends the drawn components to the screen driver for display, so that the changed UI of App2 can be displayed on the screen of the electronic device.
示例性地,UI服务线程可以根据接收到的多个UI变更的时间顺序依次将该多个UI变更应用到UI组件中。Exemplarily, the UI service thread may sequentially apply the multiple received UI changes to the UI component according to the time sequence of the received multiple UI changes.
615,当App2的第二UI变更时,线程2将该第二UI变更的消息发送至UI服务线程。615. When the second UI of App2 is changed, thread 2 sends the second UI change message to the UI service thread.
616,UI服务线程将第二UI变更应用到UI组件中。616. The UI service thread applies the second UI change to the UI component.
该步骤616可以参见步骤614的相关描述,为了简洁,不再赘述。For this step 616, reference may be made to the relevant description of step 614, and for the sake of brevity, details are not repeated here.
应理解,当UI服务线程接收多个UI变更消息时,可以按照其接收的时间顺序依次执行该UI变更,当同时接收到多个UI变更消息时,可以随机将该UI变更消息加入队列中,再依次执行。It should be understood that when the UI service thread receives multiple UI change messages, it can execute the UI changes sequentially according to the order in which they are received, and when receiving multiple UI change messages at the same time, it can randomly add the UI change messages to the queue. Then execute in sequence.
上述步骤仅仅是示意性的,本申请实施例对于上述步骤的实施顺序不予限定。在一些实施例中,也可以使用电子设备中的其他的模块实现上述功能或步骤,本申请实施例对此不予限定。The above steps are only illustrative, and the implementation sequence of the above steps is not limited in the embodiment of the present application. 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 embodiment of the present application.
基于本申请实施例,可以引入一个UI服务线程,用来统一管理所有应用的UI变更,该UI服务线程可以根据接收到UI变更的时间先后顺序依次执行所有的UI变更,从而可以避免多个并发运行的应用同时发生UI变更可能带来的功能性异常的问题。Based on the embodiment of this application, a UI service thread can be introduced to uniformly manage the UI changes of all applications. The UI service thread can execute all UI changes sequentially according to the time sequence of receiving UI changes, thereby avoiding multiple concurrent The problem of functional abnormality that may be caused by UI changes in the running application at the same time.
图12是本申请实施例提供的一种刷新用户界面的方法的示意性流程图。如图12所示,该方法可以应用于电子设备中,该方法可以包括步骤710至步骤730。FIG. 12 is a schematic flowchart of a method for refreshing a user interface provided by 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,所述电子设备检测第一应用的第一用户界面UI变更请求,所述第一应用运行在所述电子设备的后台。710. The electronic device detects a first user interface UI change request of a first application, where the first application runs in the background of the electronic device.
该步骤710中,第一应用运行在电子设备的后台,当该第一应用的第一UI发生变更时,电子设备可以检测到该UI变更对应的UI变更请求。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 can detect a UI change request corresponding to the UI change.
720,所述电子设备缓存所述第一UI变更请求。720. The electronic device caches the first UI change request.
该步骤720中,电子设备检测到第一UI变更请求后,可以将该UI变更请求缓存起来。In step 720, after detecting the first UI change request, the electronic device may cache the UI change request.
在一些实施例中,该第一UI变更请求是根据UI变更的第一信息生成的,电子设备将该第一UI变更请求加入缓存的数据结构中。In some embodiments, the first UI change request is generated according to the first UI change information, and the electronic device adds the first UI change request into a cached data structure.
其中,该第一信息可以包括该第一UI变更请求对应的UI组件,以及该组件的属性、属性的值等。该缓存的数据结构可以是链表、队列和数组等。Wherein, the first information may include the UI component corresponding to the first UI change request, the attribute of the component, the value of the attribute, and the like. The data structure of the cache may be a linked list, a queue, an array, and the like.
示例性地,UI组件1的属性为颜色,如红色,则该第一UI变更对应的第一信息可以是将UI组件1属性的颜色变为黄色。Exemplarily, the attribute of UI component 1 is a color, such as red, and the first information corresponding to the first UI change may be to change the color of the attribute of UI component 1 to yellow.
730,当所述电子设备检测到所述第一应用切换至前台运行时,将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中。730. When the electronic device detects that the first application is switched to run in the foreground, update the UI change corresponding to the first UI change request to the UI of the first application.
该步骤730中,第一应用从后台切换至前台,可以是用户关闭了前台应用,使得该第一应用变为前台,也可以是用户将原来的前台应用切换至后台,或者,用户将该第一应用切换至前台运行等。In step 730, the first application is switched from the background to the foreground. It may be that the user closes the foreground application, so that the first application becomes the foreground, or the user switches the original foreground application to the background, or the user switches the first application to the foreground. An application is switched to the foreground and so on.
当该第一应用切换至前台运行时,电子设备可以在显示第一应用的第一帧画面之前,将该UI变更请求对应的UI变更更新至第一应用的UI中,从而用户可以直接看到更新后的第一应用的UI。When the first application is switched to run in the foreground, the electronic device can 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 can directly see The updated UI of the first app.
基于本申请实施例,当处在后台运行的第一应用的UI发生变更时,电子设备可以检测到UI变更请求,并将UI变更请求缓存起来,而不是立即执行,当该第一应用切换至前台时,将该UI变更应用到该第一应用的UI中。该技术方案可以避免电子设备同时运行多个应用时,该多个应用并发访问带来的冲突问题。Based on the embodiment of the present application, when the UI of the first application running in the background changes, the electronic device can detect the UI change request and cache the UI change request instead of executing it immediately. When the first application switches to When in the foreground, apply the UI change to the UI of the first application. The technical solution can avoid conflict problems caused by concurrent access of multiple applications when the electronic device runs multiple applications at the same time.
可选地,所述方法还包括:所述电子设备检测所述第一应用的第二UI变更请求,其中,所述第二UI变更请求是根据第二UI变更的第二信息生成的;当所述第一UI变更请求对应的第一UI组件与所述第二UI变更请求对应的第二UI组件不同,或所述第一UI组件与所述第二UI组件相同但所述第一UI组件的属性与所述第二UI组件的属性不同时,所述电子设备将所述第二UI变更请求加入所述缓存的数据结构列表中;当所述电子设备检测到所述第一应用切换至前台运行时,将所述第二UI变更请求对应的UI变更更新至所述第一应用的UI中。Optionally, the method further includes: the electronic device detecting a second UI change request of the first application, wherein the second UI change request is generated according to second information of the second UI change; when The first UI component corresponding to the first UI change request is different from the 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 first UI When the attribute of the component is different from the attribute of the second UI component, the electronic device adds the second UI change request to the cached data structure list; when the electronic device detects that the first application is switched When running in the foreground, update the UI change corresponding to the second UI change request to the UI of the first application.
该第二信息可以包括第二UI变更对应的UI组件,以及该组件的属性、属性的值等。The second information may include a UI component corresponding to the second UI change, an attribute of the component, a value of the attribute, and the like.
该UI组件可以包括可直接绘制的本地UI组件,也可以包括在全球广域网(web)开发中的文档对象模型DOM组件结构等,本申请实施例对此不予限定。The UI component may include a local UI component that can be drawn directly, or may include a document object model DOM component structure in global wide area network (web) development, etc., which is not limited in this embodiment of the present application.
基于本申请实施例,当第二UI变更请求对应的UI组件与第一UI变更请求对应的UI组件不同或组件的属性不同时,可以将该第一UI组件加入缓存的数据结构中,在应用从后台切换至前台时,将该第二UI变更更新至该应用的UI中。该技术方案可以在应用发生多个UI变更时,将不同的UI变更请求缓存在数据结构中,从而在应用切换至前台时,依次执行该多个UI变更。Based on the embodiment of this 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 can be added to the cached data structure, and the application When switching from the background to the foreground, the second UI change is updated to the UI of the application. The technical solution can cache different UI change requests in the data structure when multiple UI changes occur in the application, so that the multiple UI changes are executed sequentially when the application is switched to the foreground.
可选地,所述方法还包括:所述电子设备检测所述第一应用的第三UI变更请求,其中,所述第三UI变更请求是根据第三UI变更的第三信息生成的;当所述第三UI变更请求对应的第三UI组件与所述第一UI变更请求对应的第一UI组件相同,且所述第三UI组件的属性与所述第一UI组件的属性相同时,所述电子设备根据所述第三UI组件的属性的值更新所述缓存的数据结构中的第一UI组件的属性的值。Optionally, the method further includes: the electronic device detecting a third UI change request of the first application, wherein the third UI change request is generated according to third information of the third UI change; when 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 attributes of the third UI component are the same as the attributes of the first UI component, The electronic device updates the value of the property of the first UI component in the cached data structure according to the value of the property of the third UI component.
该第三信息可以包括变更的第三UI组件,组件的属性,以及改变后的属性的值。该 UI组件的属性可以包括该组件的长、宽、颜色等特性或样式等。The third information may include the changed third UI component, the attribute of the component, and the value of the changed attribute. The properties of the UI component may include characteristics or styles of the component such as length, width, and color.
示例性地,该第一UI变更请求对应的第一UI组件的属性为颜色,该属性的值为具体的颜色,如红色,该第三UI变更请求对应的第三UI组件与第一UI组件相同,且该第三UI组件的属性同样为颜色,如该第三UI组件的属性的值为黄色,则电子设备可以将第三UI组件的属性的值(黄色)更新第一UI变更请求对应的第一UI组件的属性的值,即此时,缓存的第一UI组件的属性的值更新为黄色,从而可以无需缓存第三UI变更请求。Exemplarily, the attribute of the first UI component corresponding to the first UI change request is color, and the value of the attribute is a specific color, such as red, and the third UI component corresponding to the third UI change request is the same as the first UI component The same, and the attribute of the third UI component is also the color. If the value of the attribute of the third UI component is yellow, the electronic device can update the value (yellow) of the attribute of the third UI component to correspond to the first UI change request. The value of the property of the first UI component, that is, at this time, the cached value of the property of the first UI component is updated to yellow, so that there is no need to cache the third UI change request.
基于本申请实施例,当第三UI变更请求对应的UI组件与第一UI变更请求对应的UI组件相同且组件的属性相同时,以第三UI变更请求对应的UI组件的属性的值更新第一UI变更请求对应UI组件的属性的值。从而可以避免将第三UI变更请求加入缓存的数据结构中,避免了增加新的缓存节点,进而减少了电子设备内存的消耗。Based on the embodiment of the present 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 has the same attributes of the components, update the third UI component with the value of the attribute of the UI component corresponding to the third UI change request. A UI change request corresponds to the value of a property of the UI component. Therefore, it is possible to avoid adding the third UI change request into the data structure of the cache, avoid adding new cache nodes, and thereby reduce memory consumption of the electronic device.
在一些实施例中,电子设备也可以缓存该第三UI变更请求,即无需用第三UI变更请求对应的UI组件的属性的值更新第一UI变更请求对应UI组件的属性的值,本申请实施例对此不予限定。In some embodiments, the electronic device may also cache the third UI change request, that is, there is no need to update the value of the attribute of the UI component corresponding to the first UI change request with the value of the attribute of the UI component corresponding to the third UI change request. The embodiment does not limit this.
可选地,所述将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中,包括:所述电子设备调用系统接口将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI组件中。Optionally, the updating the UI change corresponding to the first UI change request to the UI of the first application includes: the electronic device calling a system interface to change the UI corresponding to the first UI change request Update to the UI component of the first application.
可选地,在所述电子设备缓存所述第一UI变更请求之前,所述方法还包括:所述电子设备确定需要缓存所述第一UI变更请求。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.
可选地,所述方法还包括:当所述电子设备确定不需要缓存所述第一UI变更请求时,直接将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中。Optionally, the method further includes: when the electronic device 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 to the UI of the first application middle.
在一些实施例中,当该第一应用处在前台运行时,该第一UI变更请求一般不需要缓存,则可以直接将该第一UI变更请求对应的UI变更更新至第一应用的UI中。In some embodiments, when the first application is running in the foreground, the first UI change request generally does not need to be cached, and the UI change corresponding to the first UI change request can be directly updated to the UI of the first application .
在另一些实施例中,当该第一应用处在后台运行时,该第一UI变更请求对应的UI变更也可能不需要缓存,则可以直接将该第一UI变更请求对应的UI变更更新至第一应用的UI中。In other embodiments, when the first application is running 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 In the UI of the first application.
可选地,所述电子设备缓存所述第一UI变更请求,包括:所述电子设备将所述第一UI变更请求发送至UI服务线程;所述UI服务线程缓存所述第一UI变更请求。Optionally, the electronic device caching the first UI change request includes: the electronic device sending the first UI change request to a UI service thread; the UI service thread caching the first UI change request .
本申请实施例中,该UI服务线程可以用于管理所有应用的UI变更,当有多个UI变更请求时,该UI服务线程可以将按照时间顺序将该多个UI变更缓存起来,并依次执行。In the embodiment of this application, the UI service thread can be used to manage UI changes of all applications. When there are multiple UI change requests, the UI service thread can cache the multiple UI changes in chronological order and execute them sequentially. .
示例性地,参见图11,该UI服务线程可以对接收到的App1的UI变更请求和App2的UI变更请求进行缓存,并依次执行。For example, referring to FIG. 11 , the UI service thread may cache the received UI change request of App1 and the UI change request of App2, and execute them sequentially.
在另一些实施例中,该UI服务线程可以直接将该UI变更更新至应用的UI中,本申请实施例对此不予限定。In some 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 of the present application.
可选地,所述将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中,包括:所述UI服务线程将所述第一UI变更对应的组件更新至所述第一应用的UI组件中。Optionally, the updating the UI change corresponding to the first UI change request to the UI of the first application includes: the UI service thread updating the component corresponding to the first UI change to the In the UI component of the first application.
图13是本申请实施例提供的另一种刷新用户界面的方法的示意性流程图。该方法可以应用于电子设备,如图13所示,该方法可以包括步骤810至步骤840。FIG. 13 is a schematic flowchart of another method for refreshing a user interface provided by an embodiment of the present application. The method may be applied to electronic devices, and as shown in FIG. 13 , the method may include steps 810 to 840.
810,所述电子设备显示第一界面,所述第一界面为第一应用的第一用户界面UI。810. The electronic device displays a first interface, where the first interface is a first user interface UI of a first application.
示例性地,如图8中的(b)所示,该电子设备可以是智能手表,该第一应用可以是 App2,该第一用户界面可以是App2的显示界面320。Exemplarily, as shown in (b) in FIG. 8 , the electronic device may be a smart watch, the first application may be App2, and the first user interface may be the display interface 320 of App2.
820,所述电子设备响应于用户的第一操作,显示第一界面和位于所述第一界面之上的第二界面,其中,所述第二界面为所述第二应用的第二UI。820. The electronic device displays a first interface and a second interface located above the first interface in response to a first operation of the user, where the second interface is a second UI of the second application.
示例性地,如图8中的(f)、(g)所示,该第一操作可以是用户在手机中点击App1的卡片381,该第二界面可以是App1的显示界面。Exemplarily, as shown in (f) and (g) in FIG. 8 , the first operation may be that the user clicks the card 381 of App1 in the mobile phone, and the second interface may be the display interface of App1.
830,所述电子设备检测到第一应用的第一UI变更请求时,继续显示所述第一界面和所述第二界面。830. When the electronic device detects the first UI change request of the first application, continue to display the first interface and the second interface.
示例性地,如图8中的(g)所示,当电子设备检测到后台应用App2的第一UI变更请求时,智能手表继续显示App2的界面和App1的界面,并未发生变化。Exemplarily, as shown in (g) in FIG. 8, when the electronic device detects the 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 any change.
可选地,所述第二界面为半透明状;或者,所述第二界面为非全屏显示。Optionally, the second interface is translucent; or, the second interface is displayed in a non-full screen.
当该第二界面为半透明状或非全屏显示时,用户可以看到该第二界面之下的第一界面。When the second interface is translucent or displayed in a non-full screen, the user can see the first interface under the second interface.
840,所述电子设备响应于用户的第二操作,显示第三界面,其中,所述第三界面为所述第一应用的第一UI变更后的界面。840. The electronic device displays a third interface in response to the second operation of the user, where the third interface is an interface after changing the first UI of the first application.
示例性地,如图8中的(g)、(h)所示,该第二操作可以是用户在智能手表的显示界面中向上滑动,该第三界面可以是App2的显示界面340,该显示界面340位第一UI变更后的界面。Exemplarily, as shown in (g) and (h) in FIG. Interface 340 is the interface after the change of the first UI.
基于本申请实施例,当处于电子设备前台的第一应用被切换至后台运行时,其第一界面仍对用户可见,当电子设备检测到该第一应用的第一UI变更请求时,可以不立即对第一应用的UI进行更新,而是在该第一应用切换回前台时,将该UI变更更新至第一应用的UI中。该技术方案可以避免电子设备同时运行多个应用时,该多个应用并发访问带来的冲突问题。Based on the embodiment of this application, when the first application in the foreground of the electronic device is switched to run in the background, its first interface is still visible to the user, and when the electronic device detects the first UI change request of the first application, it may not The UI of the first application is updated immediately, but when the first application is switched back to the foreground, the UI change is updated to the UI of the first application. The technical solution can avoid conflict problems caused by concurrent access of multiple applications when the electronic device runs multiple applications at the same time.
本申请实施例还提供一种电子设备,包括一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得如前文中任一种可能的实现方式中所述的刷新用户界面的方法被执行。The embodiment of the present application also provides an electronic device, including one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions, When the instruction is executed by one or more processors, the method for refreshing the user interface described in any possible implementation manner above is executed.
可选地,所述电子设备为不支持内存管理单元隔离的具有显示屏的电子设备。Optionally, the electronic device is an electronic device with a display screen that does not support memory management unit isolation.
示例性地,该电子设备可以为智能手表、AR眼镜、手环等可穿戴设备,也可以为其他具有显示屏的电子设备等。Exemplarily, the electronic device may be wearable devices such as smart watches, AR glasses, and bracelets, or other electronic devices with display screens.
本申请实施例还提供一种芯片,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如前文中任一种可能的实现方式中所述的刷新用户界面的方法被执行。The embodiment of the present application also provides a chip, the chip includes a processor and a communication interface, the communication interface is used to receive a signal, and transmit the signal to the processor, and the processor processes the signal, The method for refreshing the user interface described in any one of the possible implementation manners above is executed.
本实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的刷新用户界面的方法。This embodiment also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the electronic device, the electronic device executes the above-mentioned relevant method steps to realize the steps in the above-mentioned embodiments. Method to refresh the user interface.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的刷新用户界面的方法。This embodiment also provides a computer program product, which, when running on a computer, causes the computer to execute the above related steps, so as to implement the method for refreshing the user interface in the above embodiment.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的窗 口显示的方法。In addition, an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the window display method in the above method embodiments.
其中,本实施例提供的电子设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Wherein, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment is all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the above-mentioned The beneficial effects of the corresponding method will not be repeated here.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (11)

  1. 一种刷新用户界面的方法,其特征在于,所述方法应用于电子设备,所述方法包括:A method for refreshing a user interface, characterized in that the method is applied to an electronic device, and the method includes:
    所述电子设备检测第一应用的第一用户界面UI变更请求,所述第一应用运行在所述电子设备的后台;The electronic device detects a first user interface UI change request of a first application, and the first application runs in the background of the electronic device;
    所述电子设备缓存所述第一UI变更请求;The electronic device caches the first UI change request;
    当所述电子设备检测到所述第一应用切换至前台运行时,将所述第一UI变更请求对应的UI变更更新至所述第一应用的UI中。When the electronic device detects that the first application is switched to run in the foreground, the UI change corresponding to the first UI change request is updated to the UI of the first application.
  2. 根据权利要求1所述的方法,其特征在于,所述第一UI变更请求是根据第一UI变更的第一信息生成的,所述电子设备缓存所述第一UI变更请求,包括:The method according to claim 1, wherein the first UI change request is generated according to the first information of the first UI change, and the electronic device caches the first UI change request, comprising:
    所述电子设备将所述第一UI变更请求加入缓存的数据结构中。The electronic device adds the first UI change request into a cached data structure.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:The method according to claim 1 or 2, characterized in that the method further comprises:
    所述电子设备检测所述第一应用的第二UI变更请求,其中,所述第二UI变更请求是根据第二UI变更的第二信息生成的;The electronic device detects a second UI change request of the first application, wherein the second UI change request is generated according to second information of the second UI change;
    当所述第一UI变更请求对应的第一UI组件与所述第二UI变更请求对应的第二UI组件不同,或所述第一UI组件与所述第二UI组件相同但所述第一UI组件的属性与所述第二UI组件的属性不同时,所述电子设备将所述第二UI变更请求加入所述缓存的数据结构中;When the first UI component corresponding to the first UI change request is different from the 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 first When the attribute of the UI component is different from the attribute of the second UI component, the electronic device adds the second UI change request to the cached data structure;
    当所述电子设备检测到所述第一应用切换至前台运行时,将所述第二UI变更请求对应的UI变更更新至所述第一应用的UI中。When the electronic device detects that the first application is switched to run in the foreground, the UI change corresponding to the second UI change request is updated to the UI of the first application.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-3, further comprising:
    所述电子设备检测所述第一应用的第三UI变更请求,其中,所述第三UI变更请求是根据第三UI变更的第三信息生成的;The electronic device detects a third UI change request of the first application, wherein the third UI change request is generated according to third information of the third UI change;
    当所述第三UI变更请求对应的第三UI组件与所述第一UI变更请求对应的第一UI组件相同且所述第三UI组件的属性与所述第一UI组件的属性相同时,所述电子设备根据所述第三UI组件的属性的值更新所述缓存的数据结构中的第一UI组件的属性的值。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 attributes of the third UI component are the same as the attributes of the first UI component, The electronic device updates the value of the property of the first UI component in the cached data structure according to the value of the property of the third UI component.
  5. 根据权利要求1所述的方法,其特征在于,所述电子设备缓存所述第一UI变更请求,包括:The method according to claim 1, wherein the electronic device caches the first UI change request, comprising:
    所述电子设备将所述第一UI变更请求发送至UI服务线程;The electronic device sends the first UI change request to a UI service thread;
    所述UI服务线程缓存所述第一UI变更请求。The UI service thread caches the first UI change request.
  6. 一种刷新用户界面的方法,其特征在于,所述方法应用于电子设备,所述方法包括:A method for refreshing a user interface, characterized in that the method is applied to an electronic device, and the method includes:
    所述电子设备显示第一界面,所述第一界面为第一应用的第一用户界面UI;The electronic device displays a first interface, and the first interface is a first user interface UI of a first application;
    所述电子设备响应于用户的第一操作,显示第一界面和位于所述第一界面之上的第二界面,其中,所述第二界面为所述第二应用的第二UI;The electronic device displays a first interface and a second interface located above the first interface in response to a user's first operation, where the second interface is a second UI of the second application;
    所述电子设备检测到第一应用的第一UI变更请求时,继续显示所述第一界面和所述第二界面;When the electronic device detects the first UI change request of the first application, it continues to display the first interface and the second interface;
    所述电子设备响应于用户的第二操作,显示第三界面,其中,所述第三界面为所述第一应用的第一UI变更后的界面。The electronic device displays a third interface in response to the second operation of the user, wherein the third interface is an interface after the first UI of the first application is changed.
  7. 根据权利要求6所述的方法,其特征在于,所述第二界面为半透明状;或者,所述第二界面为非全屏显示。The method according to claim 6, wherein the second interface is translucent; or, the second interface is displayed in a non-full screen.
  8. 一种电子设备,其特征在于,包括:一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得如权利要求1-5、或6-7中任一项所述的刷新用户界面的方法被执行。An electronic device, characterized in that it includes: one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions, when When the instruction is executed by one or more processors, the method for refreshing the user interface according to any one of claims 1-5 or 6-7 is executed.
  9. 根据权利要求8所述的电子设备,其特征在于,所述电子设备为不支持内存管理单元隔离的具有显示屏的电子设备。The electronic device according to claim 8, wherein the electronic device is an electronic device with a display screen that does not support memory management unit isolation.
  10. 一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口用于接收信号,并将所述信号传输至所述处理器,所述处理器处理所述信号,使得如权利要求1-5、或6-7中任一项所述的刷新用户界面的方法被执行。A kind of chip, it is characterized in that, described chip comprises processor and communication interface, and described communication interface is used for receiving signal, and described signal is transmitted to described processor, and described processor processes described signal, makes as follows The method for refreshing the user interface described in any one of claims 1-5 or 6-7 is executed.
  11. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得如权利要求1-5、或6-7中任一项所述的刷新用户界面的方法被执行。A computer-readable storage medium, characterized in that computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on a computer, any of claims 1-5 or 6-7 A method for refreshing a user interface is performed.
PCT/CN2022/103812 2021-07-09 2022-07-05 Method for refreshing user interface, and electronic device WO2023280141A1 (en)

Applications Claiming Priority (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
CN202110775502.1 2021-07-09

Publications (1)

Publication Number Publication Date
WO2023280141A1 true WO2023280141A1 (en) 2023-01-12

Family

ID=84801241

Family Applications (1)

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

Country Status (2)

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

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103428362A (en) * 2012-05-25 2013-12-04 苹果公司 Operating geographic location systems
CN111079555A (en) * 2019-11-25 2020-04-28 Oppo广东移动通信有限公司 User preference degree determining method and device, electronic equipment and readable storage medium
CN111813536A (en) * 2019-04-11 2020-10-23 华为技术有限公司 Task processing method, device, terminal and computer readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103428362A (en) * 2012-05-25 2013-12-04 苹果公司 Operating geographic location systems
CN111813536A (en) * 2019-04-11 2020-10-23 华为技术有限公司 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
CN115599475A (en) 2023-01-13

Similar Documents

Publication Publication Date Title
WO2020181988A1 (en) Speech control method and electronic device
WO2021129253A1 (en) Method for displaying multiple windows, and electronic device and system
WO2021013019A1 (en) Picture processing method and apparatus
US10235945B2 (en) Apparatus and method for controlling display in electronic device having processors
WO2022199509A1 (en) Method for application performing drawing operation, and electronic device
WO2022052662A1 (en) Display method and electronic device
CN115629884B (en) Thread scheduling method, electronic equipment and storage medium
CN114816167B (en) Application icon display method, electronic device and readable storage medium
WO2021185352A1 (en) Version upgrade method and related apparatus
WO2023093776A1 (en) Interface generation method and electronic device
WO2022121445A1 (en) Widget adding method, apparatus, and computer-readable storage medium
WO2021169379A1 (en) Permission reuse method, permission reuse-based resource access method, and related device
WO2021052488A1 (en) Information processing method and electronic device
WO2023280141A1 (en) Method for refreshing user interface, and electronic device
EP4184297A1 (en) Method for calculating location information in touch-control screen, and electronic device
WO2022252804A1 (en) Method and apparatus for displaying view control
CN116449936A (en) Information transmission method, device, storage medium and terminal equipment
WO2020147859A1 (en) Decentralized fat lock deflation
WO2023202444A1 (en) Input method and apparatus
WO2022057563A1 (en) Method for displaying user interface in double system, and electronic device
WO2024093431A1 (en) Image drawing method and electronic device
WO2024055875A1 (en) Method for adding service card, and electronic device and computer-readable storage medium
WO2024067599A1 (en) Application display method and electronic device
WO2024046084A1 (en) User interface display method and related apparatus
WO2023284625A1 (en) Cross-platform display method for application, and readable medium and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22836892

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE