Interface switching method and electronic equipment
Patent Information
- Application Number
- CN202480047551.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2026-02-27
AI Technical Summary
When an electronic device returns to the desktop from other applications, the prior art needs to wait for the desktop layer to be drawn, resulting in slow response and poor user experience.
When the user returns to the desktop, the electronic device does not wait for the desktop layer to be drawn, but directly displays the undestroyed desktop layer. By judging that the layer has not been destroyed and the window state remains unchanged, the return animation is directly displayed to reduce the waiting time.
The operation response speed of users returning to the desktop has been improved, the user operation tracking and display stability have been enhanced, and the user experience has been optimized.
Smart Images

Figure CN121586884A_ABST
Abstract
Description
Interface switching method and electronic device TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal, and in particular to an interface switching method and an electronic device. BACKGROUND
[0002] When the electronic device opens a desktop, a layer of the desktop application needs to be drawn for display. After the user enters another application from the desktop, a layer of the other application needs to be drawn for continued display. If the user operates the electronic device to switch from the other application back to the desktop application, the electronic device needs to wait for the layer of the desktop application to be drawn in response to the user's operation of returning to the desktop, and the desktop interface can be displayed only after the drawing is completed. In the above process, the desktop layer drawing process takes a long time, and the time required from the user's operation to the display of the desktop interface is long, so the response speed of the user's operation of returning to the desktop is slow.
[0003] SUMMARY
[0004] Embodiments of the present application provide an interface switching method and an electronic device, which can accelerate the response of the user's operation of returning to the desktop, improve the follow-up speed of the user's operation, and thus improve the user experience.
[0005] In a first aspect, embodiments of the present application provide an interface switching method and an electronic device. The method is applied to an electronic device and includes: the electronic device displays a first interface, the first interface being an interface of a desktop application, and the first interface including an icon of a first application; in response to a first operation on the icon of the first application in the first interface, a second interface of the first application is displayed, and after the second interface is displayed, a layer of the first interface is not destroyed; in response to a second operation of returning to the first interface, a first animation of returning to the first interface is displayed, and the first animation starts to be displayed before a notification of completed drawing is acquired; in response to a third operation on the icon of the first application in the first interface, the second interface of the first application is displayed, and after the second interface is displayed, the layer of the first interface is not destroyed; after the second interface is displayed, a display configuration of the desktop application is changed; after the display configuration of the desktop application is changed, in response to a fourth operation of returning to the first interface, a second animation of returning to the first interface is displayed, and the second animation starts to be displayed after the notification of completed drawing is acquired.
[0006] The second operation and the fourth operation are operations of returning to the desktop in the present application, for example, the three cases in FIGS. 3A-3C (the first operation), and the present application is not limited. The finish draw notification is a FinishDraw notification. The above execution process can immediately be that no FinishDraw notification is acquired from responding to the second operation to displaying the first animation. The FinishDraw notification is acquired from responding to the fourth operation to displaying the second animation.
[0007] Optionally, the display configuration of the desktop application can include a display mode, a desktop layout, a desktop wallpaper, and the like. The display mode of the desktop application can be a display mode of the electronic device, the display mode can include a dark mode and a light mode, the third operation can be an operation of starting the first application by the pull-down notification bar or an operation of clicking the icon of the first application, and the first application has a function of adjusting the display mode of the desktop. For example, the first application is a settings application, and the settings application includes different setting functions for the desktop. Of course, the above is an operation of adjusting the display configuration, and different operations such as adjusting the desktop layout, the desktop wallpaper, and the like can also be performed.
[0008] In a possible implementation manner, after the second interface is displayed, the method further includes: in response to a user operation of setting a display mode, setting the display mode of the electronic device to a dark mode, and before the user operation of setting the display mode, the display mode of the electronic device is a light mode. The desktop displayed after the second animation ends is in the dark mode, and before the third operation on the icon of the first application in the first interface, the desktop of the first interface is in the light mode.
[0009] In the embodiment of the present application, in response to the operation of returning to the desktop, the electronic device can directly display the return animation without waiting for the finish draw notification when the desktop layer is not destroyed. The waiting time is reduced, and the response operation is improved. If the desktop window needs to be adjusted in the operation of setting the display mode, even if the desktop layer is not destroyed, the finish draw notification is still needed to wait for the desktop window to be drawn, and then the display can be performed, so that the display of the desktop layer in the light mode is avoided to cause the screen flashing, and the stability and timeliness of the display are improved.
[0010] In a possible implementation, the method further includes: in response to a fifth operation on the icon of the first application in the first interface, displaying a second interface of the first application, after displaying the second interface, the layer of the first interface is not destroyed; in response to an operation of rotating the screen, displaying a third interface, the third interface being a landscape interface of the second interface; in response to a sixth operation of returning to the first interface, displaying a third animation of returning to the first interface, after obtaining the notification of completing the drawing, the second animation starts to be displayed. In this way, in the operation of rotating, when the desktop window needs to be adjusted, even if the desktop layer is not destroyed, the notification of completing the drawing needs to be waited for, and the desktop window that needs to be adjusted is displayed, so that the case that the vertical desktop layer of the desktop layer is displayed on the landscape interface causes a flash screen is avoided, and the stability and timeliness of display are improved.
[0011] In the third animation, the displayed desktop interface is a landscape interface, and the layer of the first interface that is not destroyed is a portrait interface.
[0012] In a possible implementation, the displaying the first animation of returning to the first interface in response to the second operation of returning to the first interface includes: in response to the second operation of returning to the first interface, the electronic device displays the first animation of returning to the first interface before obtaining the notification of completing the drawing, based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged. In this way, the window state of the desktop application being unchanged indicates that the current desktop window does not need to be adjusted, and the layer of the first interface that is not destroyed is the latest desktop layer that needs to be displayed, so that the electronic device can directly display the animation effect of returning to the desktop under the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged, the time of waiting for drawing is reduced, the responsiveness is improved, and the user experience is optimized.
[0013] In a possible implementation, the second animation of returning to the first interface in response to the fourth operation of returning to the first interface includes: in response to the fourth operation of returning to the first interface, the electronic device displays the second animation of returning to the first interface after obtaining the notification of the completion of drawing, based on the condition that the first interface layer is not destroyed and the window state of the desktop application does not change being not met. In this way, during the process of displaying the third interface in response to the operation of rotating the screen by the user, the electronic device determines that the window state of the desktop application changes, and the electronic device determines that the condition that the first interface layer is not destroyed and the window state of the desktop application does not change is not met, and needs to wait until the desktop window that needs to be adjusted after the window state changes after drawing is completed, that is, after the FinishDraw notification, the animation effect can be displayed. The situation that the portrait desktop layer is displayed on the landscape interface and causes a flash screen of the desktop layer can be avoided, and the stability and timeliness of display are improved.
[0014] In a possible implementation, the first animation of returning to the first interface in response to the second operation of returning to the first interface includes: in response to the second operation of returning to the first interface, the electronic device starts to execute returning to the desktop; the electronic device determines whether the first interface layer is not destroyed and the window state of the desktop application does not change; and in a case where the condition that the first interface layer is not destroyed and the window state of the desktop application does not change is met, the electronic device performs animation effect preparation processing, and then displays the second animation of returning to the first interface.
[0015] In a possible implementation, the first animation of returning to the first interface in response to the second operation of returning to the first interface includes: in response to the second operation of returning to the first interface, the electronic device starts to execute returning to the desktop; the electronic device determines whether the first interface layer is not destroyed and the window state of the desktop application does not change; and in a case where the condition that the first interface layer is not destroyed and the window state of the desktop application does not change is met, the electronic device performs animation effect preparation processing, and then displays the second animation of returning to the first interface.
[0016] In the embodiment of the present application, the electronic device can determine the condition that the first interface layer is not destroyed and the window state of the desktop application does not change during the process of executing the startExitingRecents function, and the condition is met to execute onTransactionReady, and directly display the animation effect of returning to the desktop, thereby reducing the waiting time for drawing, improving the responsiveness, and optimizing the user experience.
[0017] In a possible implementation, in response to the fourth operation of returning to the first interface, the electronic device displays a second animation of returning to the first interface after obtaining the notification of completing drawing based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is not changed, including: in response to the fourth operation of returning to the first interface, the electronic device starts to exit the desktop; the electronic device determines whether the layer of the first interface is not destroyed and the window state of the desktop application is not changed; in the case that the layer of the first interface is not destroyed and the window state of the desktop application is not changed, the electronic device performs layer placement after obtaining the notification of completing drawing, performs animation ready processing by using the animation processing thread in the case that all window pictures of the desktop application have been drawn; and then displays the second animation of returning to the first interface.
[0018] In the process of performing layer placement, the process of performing startExitingRecents in FIG. 5 is started, and the process of onTransactionReady in FIG. 5 is performed.
[0019] In the process of displaying the third interface in response to the operation of rotating the screen by the user, the electronic device determines that the window state of the desktop application changes, and the electronic device determines that the condition that the layer of the first interface is not destroyed and the window state of the desktop application is not changed is not met, and needs to wait until the window state of the desktop application changes after drawing is completed and the desktop window that needs to be adjusted, that is, after the notification of FinishDraw is obtained, the animation is displayed. This can avoid the case that the portrait desktop layer of the desktop layer is displayed on the horizontal interface, causing a flash screen, and improve the stability and timeliness of display.
[0020] In a possible implementation, the method further includes: in the case that the layer of the first interface is not destroyed and the window state of the desktop application is not changed, the electronic device determines whether all window pictures of the desktop application have been drawn; if all window pictures have been drawn, the electronic device displays the animation of returning to the first interface by using the layer of the first interface; if not all window pictures have been drawn, the electronic device re-obtains the notification of completing drawing, and re-determines whether all window pictures have been drawn until it is determined that all window pictures have been drawn, and displays the animation of returning to the first interface by using the layer of the first interface. In this way, the case that the portrait desktop layer of the desktop layer is displayed on the horizontal interface, causing a flash screen, can be avoided, and the stability and timeliness of display are improved.
[0021] In a possible implementation, the method further includes: in response to a fourth operation of returning the first interface, the electronic device sets a scene state to a return desktop scene; the electronic device determines whether the scene state is the return desktop scene; in a case where the scene state is the return desktop scene, the electronic device determines whether a condition that a layer of the first interface is not destroyed and a window state of the desktop application is unchanged is met; after the determination of whether the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged is met, the electronic device sets the scene state to a non-return desktop scene; and the electronic device re-determines whether all window pictures have been drawn, including: the electronic device determines again whether the scene state is the return desktop scene; and in a case where the scene state is not the return desktop scene, the electronic device re-determines whether the all window pictures have been drawn. In this way, according to the above sequence of determining, in sequence, whether the scene state is the return desktop scene, whether the layer of the first interface is not destroyed, and whether the window state of the desktop application is unchanged, if the user performs a rotation operation, waits for a FinishDraw notification, and then determines again whether the scene state is the return desktop scene, whether the layer of the first interface is not destroyed, and whether the window state of the desktop application is unchanged, in a case where the scene state is not the return desktop scene, the all window pictures can be directly determined to have been drawn, and the process of determining whether the layer of the first interface is not destroyed and whether the window state of the desktop application is unchanged can be simplified, thereby improving processing efficiency.
[0022] In a possible implementation, the second operation and the fourth operation are both operations of swiping up to return to a desktop application interface, and the first animation and the second animation are both animations of displaying a user interface of the first application to displaying an interface of a desktop application. In this way, during the process of swiping up to return to the desktop by the user, the electronic device responds in advance based on the desktop layer that is not destroyed, thereby improving operation responsiveness.
[0023] In a possible implementation, the second operation and the fourth operation can refer to the description of case 1 in FIGS. 3A-3C, which is not repeated here.
[0024] In a possible implementation, in a case where the change flag bit is the first flag, the window state of the desktop application is unchanged; and in a case where the change flag bit is the second flag, the window state of the desktop application is changed. In this way, the electronic device can determine whether the window state of the desktop application is unchanged by using the flag bit, thereby ensuring the accuracy and simplicity of the determination.
[0025] In a possible implementation, when the scene state flag bit is the first flag, the scene state is returning to the desktop; and when the scene state flag bit is the second flag, the scene state is not returning to the desktop. In this way, the electronic device can determine whether the scene state is returning to the desktop through the flag bit, and the accuracy of triggering the dynamic effect scene in advance is ensured.
[0026] In a possible implementation, when the target information is preset information, the desktop layer is not destroyed; and when the target information is not preset information, the desktop layer is destroyed.
[0027] The target information can be a desktop package name to be displayed, or a window name of a desktop window to be displayed, or a destruction flag bit of a desktop layer. The preset information can be a package name of a desktop that is not destroyed, or a window name of a desktop window that is not destroyed, or a flag that is not destroyed. For details, refer to related content in S506, which is not described herein.
[0028] In a second aspect, an electronic device is provided, which includes one or more processors, a display screen, and a memory. The memory is coupled to the one or more processors, and is configured to store computer program code including computer instructions. The one or more processors invoke the computer instructions to enable the electronic device to perform the method for interface switching according to any possible implementation of the first aspect or the second aspect.
[0029] In a third aspect, a chip system is provided, which is applied to an electronic device. The chip system includes one or more processors. The processor is configured to invoke computer instructions to enable the electronic device to perform the method for interface switching according to any possible implementation of the first aspect or the second aspect.
[0030] In a fourth aspect, a computer program product including instructions is provided. When the computer program product is run on an electronic device, the electronic device is enabled to perform the method for interface switching according to any possible implementation of the first aspect or the second aspect.
[0031] In a fifth aspect, a computer readable storage medium is provided, which includes instructions. When the instructions are run on an electronic device, the electronic device is enabled to perform the method for interface switching according to any possible implementation of the first aspect or the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0032] FIG. 1 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application;
[0033] FIG. 2 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application;
[0034] FIGS. 3A-3C are a set of schematic diagrams of user interfaces according to an embodiment of the present application;
[0035] FIG. 4 is a schematic diagram of a method of switching interfaces according to an embodiment of the present application;
[0036] FIG. 5 is a schematic diagram of another method of switching interfaces according to an embodiment of the present application;
[0037] FIG. 6 is a schematic diagram of yet another method of switching interfaces according to an embodiment of the present application;
[0038] FIGS. 7A and 7B are a set of schematic diagrams of display processes of switching interfaces according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. In this document, the phrase "embodiments" means that the specific features, structures or characteristics described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appears at various places in the specification does not necessarily all refer to the same embodiments, nor does it necessarily refer to prior or alternative embodiments. It is obvious to those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0040] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a series of steps or units are included, or optionally, other steps or units not listed are also included, or optionally, other steps or units inherent to the processes, methods, products or devices are also included.
[0041] Only portions of the drawings related to the present application are shown in the drawings. Before discussing example embodiments in more detail, it is noted that some example embodiments are described as processes depicted as flow diagrams. Although the processes are described in a particular sequential order, many of the processes can be performed concurrently, in parallel, or simultaneously. In addition, the order of the processes can be re-arranged. The processes terminate when their functions are completed, but can also terminate in the middle without completing their functions.
[0042] The embodiment of the present application discloses a method for interface switching. When the electronic device switches from the foreground to the background by means of the desktop application, the desktop layer is not destroyed. When the electronic device switches back to the desktop from other application interfaces, it can be determined whether the desktop layer that is not destroyed can be directly displayed. In the case that the desktop layer that is not destroyed can be directly displayed, the electronic device does not need to wait for the desktop layer to be drawn, but directly displays the desktop layer that is not destroyed. In this way, the operation response of the user returning to the desktop can be accelerated, the follow-up speed of the user operation is improved, and the user experience is improved.
[0043] Therefore, the premise of the present application is that the desktop layer is not destroyed when the desktop application switches from the foreground to the background. The following describes the related technical introduction of the desktop layer that is not destroyed:
[0044] When the desktop application switches from the foreground to the background, the visible state of the root layout of the desktop application is kept as visible, and the process of destroying the desktop layer is intercepted, so that the desktop layer is retained when the desktop switches to the background, that is, the desktop layer is not destroyed. When the desktop application switches from the background to the foreground, since the visible state of the root layout of the desktop application is visible, the desktop application can directly display based on the desktop layer that is not destroyed.
[0045] The electronic device in the embodiment of the present application can be a notebook computer, a desktop computer, a mobile phone, a tablet computer, a desktop computer, a handheld computer, a smart bracelet, an ultra-mobile personal computer, a netbook, a personal phone, a personal data assistant, an augmented reality (AR) / virtual reality (VR) device with a touch screen, and the like. The specific form of the electronic device is not limited in the present application.
[0046] The device related to the embodiment of the present application is introduced below.
[0047] FIG. 1 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application.
[0048] The electronic device can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyro sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0049] The processor 110 can include one or more processing units. For example, the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors.
[0050] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0051] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are saved in the external memory card.
[0052] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area.
[0053] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device. In some other embodiments of the present application, the electronic device can also use different interface connection modes or a combination of multiple interface connection modes in the above embodiments.
[0054] The electronic device implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0055] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 can include 1 or N display screens 194, and N is a positive integer greater than 1.
[0056] Touch sensor 180K, also called "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 "touch panel". The touch sensor 180K is used to detect a touch operation acting on or near the touch sensor 180K.
[0057] In the embodiment of the present application, the electronic device 100 can detect a user operation through the touch sensor 180K. The user operation can include a touch event of the user touching the display screen 194. For example, the user performs a sliding operation on an application (non-desktop) interface, and in response to the touch event of the sliding operation, the electronic device displays a desktop interface. The touch operation corresponding to the touch event involved in the present application can refer to the related content in FIGS. 3A-3C, and will not be described herein.
[0058] Optionally, the above-mentioned operation mode is only an example of a touch operation, and the operation of the present application can also be a gesture operation, or voice control, etc., and is not limited.
[0059] FIG. 2 is a schematic diagram of a software structure of an electronic device according to an embodiment of the present application.
[0060] As shown in FIG. 2, the software framework of the electronic device involved in the present application can include an application layer (Application), an application framework layer (FWK), and a kernel layer (kernel).
[0061] The application layer can include a series of application packages. For example, a desktop (Launcher), a system user interface module (System UI), a memo, a calendar, and other applications (which can also be referred to as applications, and some of the above-mentioned applications are not shown). In the embodiment of the present application, the first application can be any one of the application programs of the application layer, and the user can open or exit the first application (the first application is a non-desktop application), or when the first application is displayed, the user's sliding operation can exit the first application and display a desktop (in combination with the related description of FIGS. 3A-3C).
[0062] The desktop (Launcher) is one of the main program components in the Android system. The electronic device starts the application of the Android desktop through the Launcher, or exits the application and displays the desktop.
[0063] The system user interface module (System UI) is a system interface of the Android system. The system user interface module can include a status bar (Status bar) on the user interface of the electronic device, a navigation bar (Navigation Bar) below, a lock screen interface (Keyguard), a power interface (Power UI), and the like.
[0064] The application framework layer provides an application programming interface (API) and a programming framework for applications of the application layer. The application framework layer includes some pre-defined functions.
[0065] As shown in FIG. 2, the application framework layer can include a window manager service (WMS), an activity manager service (AMS), a view system, a content provider, an input management service, and the like.
[0066] The window manager service is used to manage window programs. The window manager can acquire a display screen size, determine whether there is a status bar, lock a screen, and capture a screen, and the like.
[0067] The window can be understood as a region on a screen, and a user interface (UI) is displayed in the window for interaction with a user. From the perspective of the system, the window is a surface. A screen can have multiple windows, and the layout and order of the multiple windows and window animations are managed by the window manager service WMS. For example, the desktop application in FIG. 3A can include a negative one screen, an icon, a wallpaper, and a status bar, and the like.
[0068] The activity manager service is used to manage the life cycle of an application, start or kill a process of the application, schedule a task, and the like.
[0069] The view system includes visual controls, such as a control for displaying text, a control for displaying an image, and the like. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying an image.
[0070] The content provider is used to store and acquire data, and make the data accessible to an application. The data can include a video, an image, an audio, a dialed and received call, a browsing history and a bookmark, a phone book, and the like.
[0071] The input management service can receive operation event information from a touch driver. The input management service can acquire a description parameter of the operation event. After receiving the operation event information, the input management service can report operation event related information to a corresponding application of the application layer. Exemplarily, in combination with the first operation shown in FIGS. 3A-3C, the input management service can acquire the first operation and report event information of the first operation to the desktop.
[0072] The kernel layer is the foundation of the Android operating system, and the final functions of the Android operating system are completed through the kernel layer. The kernel layer at least includes display drivers and touch control drivers. The display driver can control the display to display. The touch control driver can obtain an operation event (for example, the first operation in FIGS. 3A-3C) of the touch sensor 180K (in FIG. 1) and upload related information (for example, a touch position and the like) of the operation event to the input management service.
[0073] It should be noted that the software structure diagram of the electronic device shown in FIG. 2 provided in the present application is only an example, and does not limit the specific module division in different layers of the Android operating system. For specific details, refer to the introduction of the software structure of the Android operating system in the conventional technology. In addition, the display method provided in the present application can also be implemented based on other operating systems, which will not be exemplified one by one.
[0074] The scenario faced by the embodiment of the present application is the case of switching from the user interface of a non-desktop application to the user interface of a desktop application. FIGS. 3A-3C illustrate the process of displaying the user interface of the desktop application from the user interface of the non-desktop application. The user interface of the desktop application can include a desktop interface or a multi-tasking interface.
[0075] FIGS. 3A-3C are a set of user interface schematic diagrams exemplarily disclosed by the embodiment of the present application. The user interface of the non-desktop application (the first application) starts, and there can be the following several cases when displaying the user interface of the desktop application:
[0076] Case 1. The user interface of the first application is exited to display the desktop interface of the desktop application.
[0077] The user opens the electronic device, and the electronic device can display the desktop interface. FIG. 3A is a schematic diagram of the desktop interface of the electronic device. As shown in FIG. 3A, the electronic device can display icons of applications such as clock, calendar, gallery, memo 311, file management, email, music, and calculator. The user can click the application icon of the memo 311, and in response to the above-mentioned operation of clicking the icon of the memo 311, the electronic device can display the user interface of the memo, as shown in FIG. 3B. The above-mentioned first application is exemplified by the memo.
[0078] The user performs a first upward sliding operation (first operation) in the user interface of the memo, and the electronic device displays the desktop interface. As shown in FIG. 3A, in response to the first upward sliding operation of the user, the electronic device can display an animation of returning to the desktop from the user interface of the memo. After the display animation ends, the desktop interface shown in FIG. 3A is displayed.
[0079] Optionally, the first upswipe operation of the user interface of the first application (memo) can also be a left swipe or a right swipe, and the like. The first upswipe operation can also be returning to the desktop through a home key or a three-key navigation, and the like. The embodiments of the present application are not limited thereto.
[0080] Case 2. The upswipe operation of the user interface of the first application exits the first application and displays the multitasking interface of the desktop application.
[0081] The second upswipe operation (the first operation) of the user interface of the memo is performed by the user, and the electronic device displays the multitasking interface. As shown in FIG. 3C, in response to the second upswipe operation, the electronic device can display an animation of returning to the multitasking interface from the user interface of the memo. When the animation ends, the multitasking interface shown in FIG. 3C is displayed.
[0082] Optionally, the second upswipe operation of the user interface of the first application (memo) can also be a three-key navigation to return to the multitasking interface, and the like. The embodiments of the present application are not limited thereto.
[0083] It should be noted that the upswipe operations in case 1 and case 2 belong to different types, and thus the electronic device responds differently. In case 1, the upswipe process of the first upswipe operation does not stop, and the electronic device can display the desktop interface shown in FIG. 3A. In case 2, the upswipe process of the second upswipe operation stops, and the electronic device can display the multitasking interface shown in FIG. 3C.
[0084] Case 3. The unlocking operation of the lock screen interface displays the desktop interface of the desktop application.
[0085] Optionally, in addition to the processes of case 1 and case 2, when the electronic device displays the lock screen interface, the user can perform a touch unlocking operation (the first operation). In response to the unlocking operation of the user, an animation of entering the desktop interface can be displayed.
[0086] Optionally, the first operation described above is an example of a touch operation. The operation type can also be a gesture operation, voice control, and the like. The embodiments of the present application are not limited thereto.
[0087] In the scenarios of returning to the desktop interface from the user interface of the current application shown in FIGS. 3A to 3C, the desktop switches from the background application to the foreground application. The display of the desktop interface needs to draw a desktop layer first. After the desktop layer is drawn, the electronic device can display the desktop interface. The time from the user operation to the display is long, the response speed of the user from the first application interface to the desktop interface is slow, and the user experience is poor.
[0088] Furthermore, in combination with the software structure of Figure 2 above, the wmshell in the system user interface module (System UI) is upgraded in version 14 of the Android operating system. In the process of an electronic device displaying a desktop application interface from other application interfaces, the system user interface module needs to call the wmshell.main thread during the interaction between the desktop application and the system service. In the related threads of wmshell, it is necessary to interact by calling the binder thread. The increase in the number of calls results in a slower response speed for the first operation in the scenes in Figures 3A to 3C. For example, the user swipes up to exit the memo application interface, and the electronic device responds to the swipe up operation and displays the dynamic effect of returning to the desktop application. The addition of the system user interface module wmshell processing process in the above process results in a longer response time for the swipe up operation. After testing, when the desktop application and the system service do not need to call the wmshell.main thread in the system user interface module (System UI), the electronic device needs to perform the swipe up operation for about 120ms; when the desktop application and the system service need to call the wmshell.main thread in the system user interface module (System UI), the electronic device needs to perform the swipe up operation for about 160ms. In comparison, the response time has increased by about 40ms. Therefore, the upgrade of the system version exacerbated the slow response speed.
[0089] In order to further illustrate the above-mentioned problem of long response processing flow and slow response time when the electronic device responds to user operations from other application interfaces and displays the desktop interface, the embodiment of Figure 4 is specifically described.
[0090] FIG4 is a flow chart of a method for switching interfaces disclosed in an exemplary embodiment of the present application. As shown in FIG4 , the method for switching interfaces may include the following steps:
[0091] Among them, the electronic device may include a desktop application, a system user interface module and a WMS. For specific instructions, please refer to the relevant content in Figure 2 and will not be repeated here.
[0092] S401: When a user performs a first operation, the desktop application obtains a first input event.
[0093] The first operation is an operation of returning to a desktop. In response to the first operation, the electronic device switches from displaying a user interface of the first application to displaying a user interface of a desktop application. The first operation can refer to the operation in FIGS. 3A-3C, and thus a detailed description thereof will not be provided. Further in combination with the touch driver and the input management service in FIG. 2, when the touch driver obtains the first operation, the touch driver can report a first input event of the first operation to the input management service. The input management service can report the first input event of the first operation to the desktop application. Thus, the desktop application obtains the first input event.
[0094] S402: In response to the first operation, the desktop application performs a start scene transition animation.
[0095] The start scene transition animation startRecentsTransition can start a new animation. The start scene transition animation is a process of exiting a current application interface and displaying a desktop application interface in response to the first operation.
[0096] Optionally, in response to the first operation, the desktop application performs the start scene transition animation startRecentsAnimation, and executes startRecentsTransition, i.e., the start scene transition animation.
[0097] S403: The desktop application sends a first call request to a system user interface module.
[0098] The desktop application sends the first call request to the system user interface module through an asynchronous binder thread. The system user interface module receives the first call request from the desktop application through the asynchronous binder thread. The first call request can include first operation information.
[0099] The callback of the asynchronous binder thread is a process of executing IRecentTasks. The first call request is used to request the wmshell.main thread to execute a start new transition animation startNewTransition.
[0100] S404: The system user interface module executes the start new transition animation.
[0101] The system user interface module can execute the start new transition animation startNewTransition function. The startNewTransition is used to start a new transition animation, i.e., a return-to-desktop animation.
[0102] Optionally, after the system user interface module receives the first call request, the system user interface module switches to the wmshell.main thread. Then, the system user interface module can execute startNewTransition through the wmshell.main thread.
[0103] S405: The system user interface module sends a second call request to the WMS.
[0104] After the system user interface module executes startNewTransition, the system user interface module can send the second call request to the WMS through the synchronous binder thread. Correspondingly, the WMS can receive the second call request from the system user interface module through the synchronous binder thread.
[0105] The second call request can be used for a system server (system service) process call to request start of execution of the return desktop startExitingRecents function.
[0106] S406: The WMS starts execution of the return desktop.
[0107] After the WMS receives the second call request, the WMS can start execution of the return desktop startExitingRecents. Optionally, the WMS can execute startExitingRecents through the binder thread of the system_server process. The startExitingRecents is used to start the return desktop. The second call request can include event information of the first operation, and the WMS executes startExitingRecents in response to the first operation of switching from other application interfaces to the desktop.
[0108] S407: The WMS executes layer placement.
[0109] After the WMS executes startExitingRecents, the WMS can execute the layer placement function performSurfacePlacement. Optionally, after the WMS executes startExitingRecents, the WMS switches to the android.anim thread, and can execute performSurfacePlacement through the android.anim thread.
[0110] performSurfacePlacement is a core function in the WMS and can be responsible for the position level placement of the surface of all windows. When the window size calculation and window drawing state update of all existing windows are performed (i.e., the window state changes), performSurfacePlacement needs to be executed to update the surface in the window. That is, it can be understood that, in the case of a change in the window state, the WMS can trigger the execution of performSurfacePlacement.
[0111] In the process of performing performSurfacePlacement, the electronic device can traverse all windows of the desktop application, determine whether the window obtains the FinishDraw completion drawing notification, and only after obtaining the FinishDraw notification, perform the animation ready processing onTransactionReady and display the animation to return to the desktop interface; otherwise, in the case where the FinishDraw notification has not been obtained, onTransactionReady is not performed, and the animation is not displayed. onTransactionReady is used to trigger the display of the animation. That is, onTransactionReady can indicate that the desktop window drawing has been completed, the processing is ready, and the animation can be started to be displayed.
[0112] S408: The WMS sends a third call request to the system user interface module.
[0113] After the WMS executes onTransactionReady, the WMS can send a third call request to the system user interface module through an asynchronous binder thread. Correspondingly, the system user interface module receives the third call request from the WMS through the asynchronous binder thread.
[0114] The third call request is used to request to play the animation.
[0115] S409: The system user interface module executes the play transition animation.
[0116] Optionally, the system user interface module can execute the play transition animation playTransition function through the wmshell.main thread.
[0117] The playTransition is used to execute the transition animation of the first operation.
[0118] S410: The system user interface module sends a fourth call request to the desktop application.
[0119] After the system user interface module executes the playTransition, the system user interface module sends a fourth call request to the desktop application through an asynchronous binder thread. Correspondingly, the desktop application receives the fourth call request from the system user interface module through the asynchronous binder thread.
[0120] The fourth call request is used to request to call the start display animation onAnimationStart function.
[0121] S411: The desktop application displays the first animation.
[0122] After the desktop application receives the fourth call request, the desktop application can switch to the desktop main thread. The desktop application can execute the start display animation onAnimationStart through the desktop main thread. The desktop application displays the first animation.
[0123] The first animation can be the animation of switching from the interface of the other application to the interface of the desktop in FIGS. 3A-3C. The specific display manner of the animation is not limited in the present application.
[0124] In the embodiment of FIG. 4, since the startExitingRecents and the performSurfacePlacement need to wait for the FinishDraw completion drawing notification to be acquired before the first animation is displayed, the waiting time is long, and the response time is long. Further, the interaction between the desktop application and the WMS needs to be executed through the wmshell.main thread of the system user interface module, which increases the calling process of the binder thread multiple times, the processing flow is long, the interaction times are many, and the corresponding response time is longer. Therefore, the response time of the electronic device to the first operation is long, and the animation is not good in hand.
[0125] To solve the above problems, the embodiment of the present application discloses a method for switching interfaces and an electronic device. The electronic device can display a first interface, the first interface being an interface of a desktop application, the first interface including an icon of a first application; in response to a first operation on the icon of the first application in the first interface, a second interface of the first application is displayed, and after the second interface is displayed, the layer of the first interface is not destroyed; in response to a second operation for returning to the first interface, a first animation for returning to the first interface is displayed, and before a notification that the drawing is completed is acquired, the first animation starts to be displayed; in response to the first operation on the icon of the first application in the first interface, the second interface of the first application is displayed, and after the second interface is displayed, the layer of the first interface is not destroyed; in response to an operation of rotating the screen, a third interface is displayed, the third interface being a horizontal screen interface of the second interface; in response to the second operation for returning to the first interface, a second animation for returning to the first interface is displayed, and after the notification that the drawing is completed is acquired, the second animation starts to be displayed. In this way, the waiting response time of the first operation can be reduced and the follow-up performance of the user operation can be improved with the help of the fact that the desktop layer is not destroyed.
[0126] To solve the above problems of slow response to the upslide operation for exiting the application interface, in combination with the user scenarios in FIGS. 3A-3C and the software structure of the electronic device in FIG. 2, FIG. 5 illustrates a method for switching interfaces, in which the electronic device, upon receiving the first operation, judges whether the conditions that the scenario state flag is true, the desktop layer is not destroyed, and the waiting change flag bit is false are met. In the case where the above conditions are met, the first operation can be responded to in advance without waiting for the animation to be drawn, and the animation for returning to the desktop application is displayed. In this way, the waiting response time of the first operation can be reduced and the follow-up performance of the user operation can be improved with the help of the fact that the desktop layer is not destroyed.
[0127] FIG. 5 is a flowchart of a method for switching interfaces, according to an example of the present application. As shown in FIG. 5, the method for switching interfaces can include, but is not limited to, the following steps:
[0128] The electronic device can include a desktop application, a system user interface module, and a WMS. Details thereof can be referred to the related content of FIG. 2, and will not be described herein.
[0129] S501: When the user performs a first operation, the desktop application acquires a first input event.
[0130] The first operation is an operation of the electronic device for exiting the user interface of the first application and displaying the user interface of the desktop application. The first operation can be specifically referred to the related operations in the three cases in FIGS. 3A-3C, and will not be described herein. The user interface of the desktop application can include the multitasking interface in FIG. 3C and the desktop interface in FIG. 3A.
[0131] S502: In response to the first operation, the desktop application executes a start scene transition animation.
[0132] S503: The desktop application sends a first call request to the system user interface module.
[0133] S504: The desktop application executes a start new transition animation.
[0134] S505: The system user interface module sends a second call request to the WMS.
[0135] Wherein, S501-S505 can correspond to the related content in the reference S401-S405 in turn, not to repeat.
[0136] After the system user interface module obtains the second call request, startExitingRecents can be executed. In the case that the result of executing startExitingRecents is not to display the animation effect, continue to wait for the complete drawing FinishDraw notification to execute performSurfacePlacement. Wherein, startExitingRecents and performSurfacePlacement both call the tryFinish function. Wherein, the tryFinish function includes the isSyncFinished function. In the case that isSyncFinished=true or all desktop windows have been drawn HasDraw, the loop process of calling tryFinish is exited, and onTransactionReady is executed. In the case that isSyncFinished=false and not all windows have HasDraw, wait for the FinishDraw notification to trigger the execution of performSurfacePlacement, that is, execute tryFinish again (enter the loop). tryFinish is used to judge whether to execute onTransactionReady. Next, the process of executing tryFinish is specifically explained by S506-S508.
[0137] S506: Judge whether to return to the desktop, whether the desktop layer is not destroyed, and whether the window state is not changed. In the case that it is not to return to the desktop, or the desktop layer has been destroyed, or the window state is changed, execute S507.
[0138] S506 is the process of WMS executing the synchronization completion judgment isSyncFinished. isSyncFinished includes three judgment conditions of judging whether the scene state is returning to the desktop, whether the desktop layer is not destroyed, and whether the window state is not changed. In the case where the three judgment conditions are all met, the electronic device sets isSyncFinished to true and executes S509. In the case where one of the judgment conditions is not met, the electronic device sets isSyncFinished to false and executes S507.
[0139] Firstly, whether it is returning to the desktop is judged by judging whether the scene state flag mStartExitingRecents is true.
[0140] The scene state flag mStartExitingRecents can indicate the user scene corresponding to the first operation. When the first operation is an operation of switching from other application interfaces to the desktop interface, the electronic device can execute StartExitingRecents to set mStartExitingRecents to true. After the execution of StartExitingRecents is completed, mStartExitingRecents is set to false. In this way, the judgment of the scene state flag can ensure that the operation scene is the operation scene of returning to the desktop, ensure the necessity of the subsequent two judgments, and ensure the feasibility of executing S509 in advance, and further ensure the effectiveness of triggering the effect in advance and the accuracy of the scene.
[0141] Secondly, the process of judging whether the desktop layer is not destroyed.
[0142] Among them, the way of judging whether the desktop layer is not destroyed is not limited, and the following describes several possible ways:
[0143] Method 1: WMS judges whether the package name information of the desktop is a preset package name. In the case where the package name information of the desktop is the preset package name, the WMS can determine that the desktop layer is not destroyed. In the case where the package name information of the desktop is not the preset package name, the WMS can determine that the desktop layer has been destroyed.
[0144] Method 2: WMS judges whether the target window name is a preset window name. In the case where the target window name is the preset window name, the WMS can determine that the desktop layer is not destroyed. The target window name is the window name of the desktop application that the electronic device needs to display in response to the first operation; the preset window name is the window of which the desktop execution layer is not destroyed. In the case where the target window name is not the preset window name, the WMS can determine that the desktop layer has been destroyed.
[0145] Optionally, the electronic device can first determine whether the device attribute supports the desktop layer not being destroyed, and in the case that the device attribute does not support the desktop layer not being destroyed, the electronic device can determine that the desktop layer has been destroyed. In the case that the device attribute supports the desktop layer not being destroyed, it is continuously determined whether the target window name is the preset window name. In the case that the target window name is the preset window name, the WMS can determine that the desktop layer has not been destroyed, and in the case that the target window name is not the preset window name, the WMS can determine that the desktop layer has been destroyed.
[0146] Method 3: The WMS determines whether the mDestroying state is the not destroyed state. In the case that mDestroying=false, it can be determined that the desktop layer has not been destroyed, that is, mDestroying=false indicates that the desktop layer has not been destroyed. In the case that mDestroying=true, it can be determined that the current desktop layer is destroyed.
[0147] The above several methods of determining whether the desktop layer has not been destroyed are only exemplary and are not limited. The above determination that the desktop layer has not been destroyed can ensure that there is an existing desktop layer available for display when display is started without waiting for drawing to be completed, thereby ensuring the premise and reliability of stable display.
[0148] Thirdly, it is determined whether the window state is not changed by determining whether the waiting change flag bit mWaitingConfigchange is false.
[0149] mWaitingConfigchange represents a flag of a change in the window state during a waiting process. mWaitingConfigchange=false represents that the window state does not change; and mWaitingConfigchange=true represents that the window state changes. In the case of the window state change, that is, mWaitingConfigchange=true, the electronic device needs to perform S507, and continue to determine whether the changed window obtains the finishDraw notification; in the case of no change in the window state, the electronic device performs processing in combination with the determination of the other two conditions, that is, does not perform processing. In this way, in the case of no change in the window state, mWaitingConfigchange=false, S507 and S508 do not need to be performed, and S509 can be directly performed, so that the response waiting time of the first operation can be reduced, and the operation follow-up property can be improved. In the case of the window state change, mWaitingConfigchange=true, S507 and S508 need to be performed, and it is determined whether the current desktop is drawn according to the latest configuration parameter. S509 is performed only when the drawing is completed, so that the display interface of the returned desktop scene can be the latest adjusted desktop interface, and the timeliness and stability of the display can be ensured.
[0150] The window state can mark the position of a figure, the size of an image, a shape, and the like in the window. In the case of the window state change, it can be determined that the window drawing is completed. If the window state changes, further drawing and display are needed, and therefore performSurfacePlacement needs to be performed.
[0151] The electronic device displays the interface of the first application, and the desktop application is in a background running process, and the desktop layer is not destroyed. However, the user operation of the first application interface can change the desktop window state, for example, the user sets the display mode to another mode different from the current display mode of the desktop (such as from a light color mode to a dark color mode), changes the desktop wallpaper, changes the desktop layout (the desktop layout is the arrangement of the desktop icons), and the like. In response to the above operations, the electronic device can obtain a window state change event, and the desktop needs to draw the window and then send the FinishDraw notification to the WMS. Therefore, the determination of the waiting change flag can ensure the display stability, prevent the process of redrawing the display immediately after the display effect, and avoid the screen flashing.
[0152] In the case of mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=true, S509 is performed.
[0153] Wherein, the first execution of S506 is to execute the StartExitingRecents process in response to the first operation, and the second execution of S506 is to execute the process of performSurfacePlacement.
[0154] Optionally, isSyncFinished can be at least the condition that the desktop layer is not destroyed, and the remaining mWaitingConfigchange = false and mStartExitingRecents = true conditions can be selectively included.
[0155] S507: WMS determines whether all windows of the desktop are Has Draw.
[0156] The electronic device can traverse all windows of the desktop application to determine whether all windows of the desktop application are Has Draw, and in the case that all windows are Has Draw, S509 can be executed. In the case that there are windows that have not yet Has Draw (there are windows in a non-Has Draw state), S508 is continued to be executed.
[0157] Wherein, the windows of the desktop application can include: negative one screen, (application) icon, wallpaper and status bar, etc. Window drawing marks can include Has Draw (drawn), No surface, Draw pending (pending drawing), commit Draw pending, ready to show, etc. Wherein, Has Draw indicates that the window has been drawn. After the main window of the desktop application is drawn, the FinishDraw notification is sent to the WMS, and the drawing state of the window is marked as Has Draw.
[0158] S508: WMS waits to obtain the complete drawing notification.
[0159] The WMS executes the process of performSurfacePlacement, and in the case that the WMS waits for the desktop to obtain the complete drawing FinishDraw notification (i.e., the window state changes), S506 is executed; in the case that the desktop FinishDraw notification has not been obtained (the window state does not change), no processing is performed, and waiting is performed. The process of S506 is continued to be executed, and the next cycle is entered.
[0160] Wherein, after the complete drawing notification is obtained in S508, S509 is executed, i.e., the onTransactionReady animation ready processing is executed.
[0161] Optionally, the WMS sets mWaitingConfigchange to false in the case of obtaining the FinishDraw notification from the desktop. It is ensured that the execution of isSyncFinished in S506 after obtaining the first operation can determine the case of isSyncFinished=true, and it is ensured that the three judgments in S506 of StartExitingRecents can be executed in advance to display the stability of the return desktop animation effect.
[0162] Optionally, in the case of executing S508, the window state changes, and the WMS obtains the FinishDraw notification from the desktop, the electronic device can execute the steps of S507, and thus the process of performSurfacePlacement can include S507-S508 and exclude the judgment process of S506.
[0163] In the case of isSyncFinished=false in S506, the electronic device does not execute S509, waits until the drawing notification is obtained, re-executes performSurfacePlacement, and displays only when it is determined that the window state change causes the window to be redrawn, thereby ensuring that the displayed content can adapt to the latest adjustment needs and ensuring the stability and reliability of the display.
[0164] S509: The WMS executes animation preparation.
[0165] In S506, if the electronic device determines that mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=false, the electronic device can execute S509; or in S507, if all windows are in the Has Draw state, S509 is executed.
[0166] onTransactionReady indicates that the animation is ready, and the electronic device can start displaying the animation (S511-S513 are executed).
[0167] In the execution process of S506-S509, the electronic device can determine that the desktop layer is not destroyed, display based on the non-destroyed desktop layer, save the time consumed by creating a desktop window, display the desktop faster, and improve the follow-up response performance speed of returning to the desktop.
[0168] In combination with FIG. 4, it can be obtained that the electronic device can execute startExitingRecents through a binder thread of a system server (system service) process; and performSurfacePlacement through an android.anim thread.
[0169] S510: The WMS sends a third adjustment request to the system user interface module.
[0170] S511: The system user interface module executes a playing transition animation.
[0171] S512: The system user interface module sends a fourth adjustment request to the desktop application.
[0172] S513: The desktop application displays a first animation.
[0173] The processing procedures of S511-S513 can refer to the related content of S408-S411 in sequence, and details are not described herein.
[0174] In the embodiments of the present application, in the case that the first operation triggers the execution of StartExitingRecents, if mStartExitingRecents=false, or the desktop layer has been destroyed, or mWaitingConfigchange=false, the electronic device can directly display the desktop layer that has not been destroyed without waiting for the desktop layer to perform a drawing process, thereby reducing the waiting time, speeding up the response, improving the follow-up performance of the first operation response, and improving the user experience.
[0175] In combination with S506-S509 in FIG. 5, FIG. 6 discloses a specific implementation of executing startExitingRecents and performSurfacePlacement, which will be described in detail in combination with FIG. 5 as follows.
[0176] FIG. 6 is a flowchart of a method for executing a switching interface according to an embodiment of the present application. As shown in FIG. 6, the method can include but is not limited to the following steps:
[0177] In the embodiments of the present application, the WMS of the electronic device can call a plurality of classes of the WMS to implement the processing procedures of S506-S509, such as an activity start controller (activitystartcontroller), a task module (task), a window container (windowcontainer), a window state module (windowstate), an activity task management service (activitytaskmanagerservice), and the like, which will be described in detail in combination with the following steps.
[0178] S601: The activity start controller obtains first operation information.
[0179] The process of S601 obtaining the first operation information can refer to the content of the second call request in S505 and S405. The second call request can represent that the first operation information is currently obtained.
[0180] S602: The activity start controller starts to execute the return desktop.
[0181] The activity start controller receives the first operation information, and triggers start to execute the return desktop startExitingRecents.
[0182] S603: The activity task management service sends start to return desktop information to the task module.
[0183] The start to return desktop startExitingRecents information requests to execute startExitingRecents.
[0184] S604: The task module sends a notification of setting a start to return desktop state to the activity task management service.
[0185] S605: The activity task management service sets a scene state flag bit to true.
[0186] The activity task management service sets the scene state flag bit mStartExitingRecents to true based on the notification of setting the start to return desktop state startExitingRecentsState. It can be determined that the current scene state is the scene state of returning to the desktop; and the scene state flag bit mStartExitingRecents can be set to true. The mStartExitingRecents can indicate whether the scene state is the return desktop; mStartExitingRecents=true indicates that the scene state is the return desktop (i.e., the scene of returning to the desktop interface from other application interfaces corresponding to the first operation); and mStartExitingRecents=false indicates that it is not the return desktop scene, or the scene processing execution is ended.
[0187] S606: The activity task management service executes a continue window layout.
[0188] In the process of executing startExitingRecents by the active task management service, the continueWindowLayout is executed. The continueWindowLayout is used to initiate the performSurfacePlacement, and the performSurfacePlacement starts the tryFinish and executes the isSyncFinished.
[0189] In the case that the window container executes startExitingRecents, that is, the process of judging whether mStartExitingRecents is true (S607-S609), judging whether the desktop layer is destroyed (S610-S612), and judging whether mWaitingConfigchange is true (S613-S615) in the execution of S506, the process of FIG. 6 is specifically explained in combination with FIG. 5:
[0190] S607: The window container sends a scene state judgment request to the active task management service.
[0191] The window container can call the isStartExitingRecents function to the active task management service. The scene state judgment request, that is, the isStartExitingRecents function, is used to request to judge whether mStartExitingRecents is true.
[0192] S608: The active task management service judges whether the scene state flag bit is true.
[0193] The content of S608 can refer to the related process of judging whether mStartExitingRecents is true in S506, and is not described herein.
[0194] S609: The active task management service sends a scene state judgment result to the window container.
[0195] The scene state judgment result can include two results of mStartExitingRecents=true or mStartExitingRecents=false. In the case of mStartExitingRecents=false, S618 is directly executed; in the case of mStartExitingRecents=true, S610 is continuously executed.
[0196] S610: The window container sends a desktop layer undestroyed judgment request to the window state module.
[0197] The window container calls the isPermanentLauncher function to the window state module. The desktop layer is not destroyed judgment request, that is, the isPermanentLauncher function, is used to request to judge whether the desktop layer is not destroyed.
[0198] S611: The window state module judges whether the desktop layer is not destroyed.
[0199] The method for judging whether the desktop layer is not destroyed can refer to the specific method for judging whether the desktop layer is not destroyed in S506. Specifically, the window state module can judge whether the package name information of the desktop is a preset package name, whether the window name of the desktop is a preset window name, and whether the mDestroying destruction flag bit is false, and the like. In the case that the layer destruction information is preset information (preset package name, preset window name, and preset flag bit false), it can be determined that the desktop layer is not destroyed; otherwise, the desktop layer is destroyed.
[0200] S612: The window state module sends the desktop layer not destroyed judgment result to the window container.
[0201] The desktop layer not destroyed judgment result includes two results: not destroyed and destroyed. In the case that the desktop layer is not destroyed, S613 is continued to be executed; in the case that the desktop layer is destroyed, S618 is directly executed.
[0202] S613: The window container sends the waiting change flag bit judgment request to the window state module.
[0203] The window container calls the isWaitingConfigchange function to the window state module. The waiting change flag bit judgment request, that is, the isWaitingConfigchange function, is used to request to judge whether mWaitingConfigchange is false.
[0204] S614: The window state module judges whether the waiting change flag bit is false.
[0205] The related description of S614 can refer to the process of judging whether mWaitingConfigchange is false in S506, which is not described herein.
[0206] In a possible case, mWaitingConfigchange is set to true by executing the configchangeupdateResizingWindowlfNeeded function if it is needed to adjust the window size configuration. For example, in the process of screen rotation of a foldable device, the configchangeupdateResizingWindowlfNeeded function is executed, and mWaitingConfigchange is set to true. In this case, the result of the determination in S614 is true, and the desktop needs to be waited for drawing instead of being directly displayed, which can ensure that the display is displayed after the adjustment of the desktop window size is completed after rotation, avoid the screen flashing problem caused by direct display, and ensure the stability and reliability of the display.
[0207] For example, if the electronic device is a foldable device, the electronic device displays the desktop application in a first direction (for example, a portrait display interface), and the user clicks the first application. The electronic device displays the application interface of the first application, and the electronic device can or can not destroy the desktop layer in the background. In the application interface of the first application, the user rotates the electronic device or automatically adjusts the display direction. The electronic device can display the application interface of the first application in a second direction (for example, a landscape display interface), and the electronic device can set mWaitingConfigchange to true. In the case where the user performs a first operation on the first application interface in the second direction, StartExitingRecents is executed, and when S614 is executed, it is determined that the waiting change flag is true, S619 cannot be executed in advance, and the desktop window needs to be waited for drawing. It can be ensured that the display is displayed after the adjustment of the desktop window size is completed after rotation, to avoid the screen flashing problem caused by direct display.
[0208] S615: The window state module sends the waiting change flag determination result to the window container.
[0209] The waiting change flag determination result includes mWaitingConfigchange=true or mWaitingConfigchange=false. In the case of mWaitingConfigchange=false, S618 is executed; otherwise, S619 is further executed based on the results of the three determinations.
[0210] In the judgment process of S613-S615, the mWaitingConfigchange flag indicates whether the window state changes. If the window state changes, mWaitingConfigchange=true, the desktop window needs to be further waited for drawing, which is suitable for the latest changed window picture, and it is further needed to judge whether all the windows of the desktop are in the Has Draw state; if all the windows of the desktop are in the Has Draw state, mWaitingConfigchange=false, the desktop window does not need to be waited for drawing, and the timeliness of the desktop window display can be ensured.
[0211] In the above S607-S615, the three judgment processes of whether mStartExitingRecents is true (S607-S609), whether the desktop layer is destroyed (S610-S612), and whether mWaitingConfigchange is true (S613-S615) are not limited in order by the present application. When the three conditions of mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=false are all met, S619 is executed; otherwise, if any condition is not met, S618 is executed.
[0212] S616: The window container sends a notification of resetting the scene state flag to the active task management service.
[0213] The notification of resetting the scene state flag can be understood as that the StartExitingRecents process has been completed this time.
[0214] S617: The active task management service sets the scene state flag to false.
[0215] In S602-S606, startExitingRecents starts to execute, and sets the scene state flag mStartExitingRecents to true. After the judgment of S607-S615 is completed, StartExitingRecents is executed, and WMS executes S616 and S617 to set StartExitingRecents to false, indicating that the execution of StartExitingRecents triggered by the first operation is completed, and in the subsequent process of performSurfacePlacement, there is no need to execute the process of S616 and S617, that is, mStartExitingRecents is not set.
[0216] S618: The window container determines whether all windows of the desktop are in the drawn state. If all windows are in the drawn state, S619 is executed; if there are desktop windows that are not in the drawn state, no processing is performed, and the process of S607 is re-executed after the window state changes (S620).
[0217] The determination process of S618 can refer to the related description of S507 for determining whether all windows of the desktop are in the Has Draw state, and will not be repeated here.
[0218] S619: The window container performs animation ready processing.
[0219] S619 can refer to the related description of S509 for executing onTransactionReady, and will not be repeated here.
[0220] S620: The window state module sets the waiting change flag to false in response to a window state change event.
[0221] The window state change event means that the WMS receives a FinishDraw notification from the desktop application, and the FinishDraw notification triggers the execution of S620-S622. S602 can refer to the related description of S508.
[0222] After S619 is executed, S620 is executed, which states that onTransactionReady, WaitingConfigchange has been processed, and therefore mWaitingConfigchange can be set to false. In this way, in the case of the next time the first operation is obtained, the process of StartExitingRecents can be effectively executed, S614 is true, and the stability of triggering the animation in advance is ensured.
[0223] After the window state module obtains the window state change event, mWaitingConfigchange can be set to false. There are many cases of window state change events, which can be triggered in the case of window state change, for example, the window state change event is a relayoutWindow call event. RelayoutWindow refers to the re-layout of the window. The desktop receives the relayoutWindow call event, and the desktop can send a FinishDraw notification to the WMS. The window state module responds to the window state change event of the FinishDraw notification, and can execute S620.
[0224] S621: The window state module sends a drawing completion notification to the window container.
[0225] Wherein, the FinishDraw notification triggers the start of performing the performSurfacePlacement.
[0226] Wherein, the process of S620-S622 can refer to the process of S508, and details are not described herein.
[0227] S622: The window container performs S607-S609.
[0228] In S622, when the FinishDraw notification is obtained, the window container can be triggered to perform the judgment process of S607-S609, and isSyncFinished is re-executed. After the judgment, the logic of S607-S609 and S618 is executed.
[0229] Optionally, S622: re-executes S618 without executing S607-S609. The judgment process of S607-S609 is reduced, the judgment process is simplified, and the processing efficiency is improved. Further optionally, S604-S609, S616 and S617 in FIG. 6 can not be executed, isSyncFinished judgment includes two judgment logics of S610-S615, and S618 is executed in S622. In this way, the processing logic can be simplified, and the processing efficiency is improved.
[0230] Optionally, the step of S608 can be executed after S618 is judged as no. S617 has set mStartExitingRecents to false before S618 is judged, the result of S608 is false, and S618 is re-executed. The execution order of S607-S609 and S620-S622 in the loop can not be limited. The present application executes S620-S622 first and then executes S607-S609. S607-S609 can also be executed first and then S620-S622 is executed.
[0231] In combination with FIG. 5 and FIG. 6, it is to be noted that, in the process of executing StartExitingRecents, since mStartExitingRecents is set to true in S605, the result of the judgment in S608 is true, and the judgment in the subsequent process of performing SurfacePlacement is the main judgment. For the case where the result of isSyncFinished in StartExitingRecents is false, for example, after the desktop layer is not destroyed (the desktop layer is a display layer in the portrait orientation), the user rotates the screen, and the electronic device displays the screen interface after rotation (landscape orientation). If the user slides back to the desktop on the landscape interface, the result of isSyncFinished is false. The electronic device sets mStartExitingRecents to false. After waiting for the process of performing SurfacePlacement to be executed. In the process of executing S607 again, the result is that mStartExitingRecents is false, and the two judgment processes in S610-S615 can be skipped, and S618 is directly executed, so that after the user rotates the screen after the desktop layer is not destroyed, the user returns to the desktop. Since the execution order of the isSyncFinished judgment process is executed first in S607-S609 and then in S610-S615, the judgment processes of the other two conditions can be reduced, thus simplifying the processing process and improving the processing efficiency. Alternatively, in the process of triggering the execution of performSurfacePlacement in S620, it can be directly executed from S618 without the need to judge the above-mentioned isSyncFinished condition, thus simplifying the judgment process and improving the processing efficiency.
[0232] In the above-mentioned embodiments, when the electronic device switches from the foreground to the background with the help of the desktop application, the desktop layer is not destroyed, and when the desktop is switched back from other application interfaces, it can be judged whether the desktop window that is not destroyed can be directly displayed. In the case where the desktop that is not destroyed can be directly displayed, the electronic device does not need to wait for the desktop layer to be drawn, but directly displays the desktop layer that is not destroyed. Therefore, the response speed of switching from other applications to the desktop application can be improved, the time of waiting for the desktop layer to be drawn can be reduced, and the response followability can be improved.
[0233] In combination with the embodiments of FIG. 5 and FIG. 6, it is illustrated in FIG. 7A that, under the condition that mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=false, the desktop window does not need to be waited to be drawn, and the desktop layer that is not destroyed is directly displayed. It is illustrated in FIG. 7B that, under the condition that mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=false, the desktop window needs to be waited to be drawn, and the desktop window that is drawn is displayed.
[0234] FIG. 7A and FIG. 7B are schematic diagrams of display processes of a group of switching interfaces according to an embodiment of the present application.
[0235] As shown in FIG. 7A, before T1, in the case that the user displays the desktop, the first application interface is displayed in response to the operation of starting the first application. At T1, the electronic device receives the first operation of the user returning to the desktop, and at T2, the startExitingRecents is executed in response to the first operation. After the judgment, it is determined that mStartExitingRecents=true, the desktop layer is not destroyed, and mWaitingConfigchange=false, the electronic device does not need to wait for the desktop application to be drawn, and at T3, the onTransactionReady is executed, and the first animation is displayed based on the desktop layer that is not destroyed.
[0236] As shown in FIG. 7B, before the T4 moment, the user displays the second application interface in response to an operation of starting the second application while the display desktop is displayed. At the T4 moment, the electronic device receives a second operation of the user returning to the desktop, and at the T5 moment, the electronic device performs startExitingRecents in response to the second operation. After the determination, mStartExitingRecents = false, or the desktop layer has been destroyed, or mWaitingConfigchange = true. The startExitingRecents is executed. Based on the above result, the electronic device performs S618, and the determination result is that not all windows have HasDraw, so that the performSurfacePlacement is triggered by the window state change event. At the T6 moment, the electronic device obtains the window state change event 1, performs the performSurfacePlacement, and after the determination, mStartExitingRecents = false, and the S618 result is also that not all windows have HasDraw. After the S618 result is not all windows have HasDraw for multiple times, at the T8 moment, the electronic device obtains the window state change event M (M is an integer greater than 1). At the T9 moment, the performSurfacePlacement is performed, and the S618 result is also that all windows have HasDraw, and it is determined that the desktop window drawing is completed. After all windows have HasDraw, at the T10 moment, the electronic device performs onTransactionReady, and displays the second animation based on the drawn desktop window.
[0237] The first application and the second application can be the same application or different applications, and are not limited.
[0238] It is found through the comparison of FIG. 7A and FIG. 7B that when the desktop is in the background and the desktop layer is not destroyed, the electronic device does not need to wait for the process of the desktop layer drawing to be completed, and directly displays the animation, which obviously shortens the desktop display time and improves the response follow-up performance.
[0239] It should be noted that, for the above method embodiments, in order to simply describe, the above method embodiments are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited by the action sequence described. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily necessary for the present application. The embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0240] In the above embodiments, all or part of the processes can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the processes can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes described in the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk), etc.
[0241] Those of ordinary skill in the art can understand that all or part of the processes in the above embodiments can be instructed by a computer program to complete the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes ROM or random access memory (RAM), magnetic disk or optical disk, and various media that can store program codes.
[0242] In summary, the above only describes the embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present application shall be included in the protection scope of the present application.
Claims
1. An interface switching method characterized by comprising: The method is applied to an electronic device, and the method comprises: The electronic device displays a first interface, the first interface being an interface of a desktop application, and the first interface comprising an icon of a first application; In response to a first operation on the icon of the first application in the first interface, a second interface of the first application is displayed, and the layer of the first interface is not destroyed after the second interface is displayed; In response to a second operation of returning to the first interface, a first animation of returning to the first interface is displayed, and the first animation starts to be displayed before a notification of completing drawing is obtained; In response to a third operation on the icon of the first application in the first interface, a second interface of the first application is displayed, and the layer of the first interface is not destroyed after the second interface is displayed, and the display configuration of the desktop application is changed after the second interface is displayed; After the display configuration of the desktop application is changed, in response to a fourth operation of returning to the first interface, a second animation of returning to the first interface is displayed, and the second animation starts to be displayed after the notification of completing drawing is obtained.
2. The method of claim 1, wherein, The method comprises: In response to the second operation of returning to the first interface, the electronic device displays the first animation of returning to the first interface based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged before the notification of completing drawing is obtained.
3. The method of claim 2, wherein, The method comprises: In response to the fourth operation of returning to the first interface, the electronic device displays the second animation of returning to the first interface based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged after the notification of completing drawing is obtained.
4. The method of claim 2, wherein, The method comprises: In response to the second operation of returning to the first interface, the electronic device starts to execute a return to the desktop based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged before the notification of completing drawing is obtained. The electronic device determines whether the layer of the first interface is not destroyed and whether the window state of the desktop application is unchanged. In a case where the layer of the first interface is not destroyed and the window state of the desktop application is unchanged, the electronic device performs an animation ready process, and then displays the second animation of returning to the first interface.
5. The method of claim 3, wherein, The method comprises: In response to the fourth operation of returning to the first interface, the electronic device starts to execute a return to the desktop based on the condition that the layer of the first interface is not destroyed and the window state of the desktop application is unchanged after the notification of completing drawing is obtained. The electronic device determines whether the first interface layer is not destroyed and whether the window state of the desktop application is unchanged; In a case where the first interface layer is not destroyed and the window state of the desktop application is unchanged, after the electronic device obtains the notification of completion of drawing, the electronic device performs layer placement, and in a case where all window pictures have been drawn, the electronic device performs animation preparation through the animation processing thread; and then displays a second animation of returning to the first interface.
6. The method according to any one of claims 2-5, characterized in that, The method further comprises: In a case where the first interface layer is not destroyed and the window state of the desktop application is unchanged, the electronic device determines whether all window pictures of the desktop application have been drawn; If all window pictures have been drawn, the electronic device displays an animation of returning to the first interface through the first interface layer; If not all window pictures have been drawn, the electronic device re-obtains the notification of completion of drawing, and re-determines whether all window pictures have been drawn until it is determined that all window pictures have been drawn and an animation of returning to the first interface is displayed through the first interface layer.
7. The method of claim 6, wherein, The method further comprises: In response to a fourth operation of returning to the first interface, the electronic device sets a scene state to a return-to-desktop scene; The electronic device determines whether the scene state is a return-to-desktop scene; In a case where the scene state is a return-to-desktop scene, the electronic device determines that the condition that the first interface layer is not destroyed and the window state of the desktop application is unchanged is met; and then the electronic device sets the scene state to a non-return-to-desktop scene; The electronic device re-determines whether all window pictures have been drawn, comprising: The electronic device re-determines whether the scene state is a return-to-desktop scene; In a case where the scene state is not a return-to-desktop scene, the electronic device re-determines whether all window pictures have been drawn.
8. The method of claim 2, wherein, The second operation and the fourth operation are both operations of returning to a desktop application interface by swiping up, and the first animation and the second animation are both animations of displaying a user interface of the first application to displaying an interface of a desktop application.
9. An electronic device, comprising: Comprise: A display screen, one or more processors, and one or more memories; the one or more memories are configured to store computer program codes, the computer program codes comprise computer instructions, when the one or more processors execute the computer instructions, the electronic device performs the method according to any one of claims 1-8.
10. A computer-readable storage medium comprising instructions, characterized in that, The computer readable storage medium stores a computer program, when the computer program is executed by a processor, the method according to any one of claims 1-8 is implemented.