Screen rotation control method and device and electronic equipment
By detecting the grip direction of the electronic device, differentiated management of screen rotation status between applications is achieved, and the problem of poor application switching experience in the existing technology is solved and the user experience is improved.
Patent Information
- Application Number
- CN202510126715.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-05
- Publication Date
- 2025-06-27
AI Technical Summary
The prior art is difficult to implement differentiated management of screen switching status between applications on terminal devices, resulting in poor user experience when switching applications.
By detecting the grip direction of the electronic device, differentiated management of the screen rotation status of the front-end display application and the back-end application is realized to ensure that when the top-level application returns, the next application to be displayed is the final display status.
It improves the experience of switching between applications, so that when the user closes the top-level window, the next window to be displayed is already in the final display state, avoiding unnecessary screen rotation effects.
Smart Images

Figure CN120215783A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202110758909.3, and the application date of the original application is July 5, 2021. The entire content of the original application is incorporated herein by reference. Technical Field
[0002] The present invention relates to the field of communication technologies, and in particular, to a screen rotation control method, apparatus, and electronic device. Background Art
[0003] The application of display technology is becoming more and more widespread on terminal devices. The display directions on a terminal device can be divided into four directions: landscape, portrait, reverse landscape, and reverse portrait. Not all windows of all applications can support all direction displays. For example, some applications only support portrait display. Even if the device is rotated to landscape, the application still displays in portrait. Summary of the Invention
[0004] Embodiments of the present application provide a screen rotation control method, apparatus, and electronic device, which can implement differential management of the screen rotation states of foreground display applications and background applications according to the physical holding state of the current device, so that when the top-level application returns, the next application to be displayed is already in the final display state, improving the experience of switching scenarios.
[0005] In a first aspect, embodiments of the present application provide a screen rotation control method applicable to an electronic device with a display screen. The method includes: displaying a first interface of a first application, where the window direction of the first interface is the same as the holding direction of the electronic device; when detecting an operation of opening a second interface of a second application through the first interface and determining that the preset window direction of the second interface is different from the holding direction of the electronic device, displaying the interface of a first target application in the preset window direction of the second interface and keeping the window direction of a second target application unchanged; where the first target application includes the second application, and the second target application includes the first application.
[0006] That is to say, the screen rotation method provided by the embodiments of the present application mainly aims at the switching of display interfaces between different applications. When performing a screen rotation operation, only the application that needs to be rotated currently is rotated, and other applications are not rotated, so that when the top-level window is closed, the next window to be displayed is already in the final display state, ensuring the experience effect during window switching.
[0007] In a possible implementation, after the interface of the first target application is displayed in the preset window direction of the second interface and the window direction of the second target application remains unchanged, the method further includes: when it is detected that the holding direction of the electronic device changes, determining whether the window display direction of the first target application is the same as the current holding direction of the electronic device; based on the window display direction of the first target application being the same as the current holding direction of the electronic device, updating the window directions of other applications on the electronic device except the first target application, so that the window directions of other applications except the first target application are the same as the current holding direction of the electronic device; based on the window display direction of the first target application being different from the current holding direction of the electronic device, updating the window directions of each application on the electronic device, so that the window directions of each application on the electronic device are the same as the current holding direction of the electronic device.
[0008] That is to say, after the user changes the holding direction of the electronic device, it is determined whether the window direction of the foreground display application is the same as the current holding direction of the electronic device. When the window direction of the foreground display application is the same as the current holding direction of the electronic device, only the screen rotation operation needs to be performed on the applications other than the foreground display application.
[0009] In a possible implementation, when it is detected that an operation to open the second interface of the second application is performed through the first interface and it is determined that the preset window direction of the second interface is different from the holding direction of the electronic device, displaying the interface of the first target application in the preset window direction of the second interface and keeping the window direction of the second target application unchanged includes: obtaining the preset window direction of the second interface of the second application through the activity manager. When the preset window direction is different from the holding direction of the electronic device, the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application.
[0010] Further, the activity manager triggering the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application includes: adjusting the width information, height information, and the direction information of the display content of the display window corresponding to the first target application according to the preset window direction of the second interface, so that the window direction of the display window corresponding to the first target application is the same as the preset window direction of the second interface.
[0011] In a possible implementation, after the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application, the method further includes: the activity manager sending a resource update event to the first target application to trigger the first target application to refresh the window layout corresponding to the first target application according to the resource update event.
[0012] In a possible implementation, the first target application further includes a background application that allows a prompt window to pop up.
[0013] In a possible implementation, the first application is a desktop application.
[0014] In a possible implementation, after the interface of the first target application is displayed in the preset window direction of the second interface while keeping the window direction of the second target application unchanged, the method further includes: when an operation to close the second application is detected, displaying the first interface of the first application; wherein, the window display direction of the first interface of the first application is the same as the holding direction of the electronic device.
[0015] In a second aspect, an embodiment of the present application provides a screen rotation control method, which can be applied to an electronic device with a display screen. The method includes: displaying a first interface of a first application, wherein the window direction of the first interface is the same as the holding direction of the electronic device; when an operation to open a second interface of the first application through the first interface of the first application is detected and it is determined that the preset window direction of the second interface is different from the holding direction of the electronic device, displaying the second interface in the preset window direction of the second interface; when an operation by the user to close the second interface is detected, obtaining the window direction of the first interface and displaying the first interface in the window direction of the first interface.
[0016] That is to say, the screen rotation control method provided by the embodiment of the present application mainly focuses on the switching of display interfaces between the same application. When closing the second interface of the first application, it is necessary to find the next display window to be shown, that is, the display window of the first interface of the first application, and ensure that the first interface of the first application is the final display state after the second interface of the first application is closed, improving the user experience.
[0017] In a possible implementation, when an operation by the user to close the second interface is detected, obtaining the window direction of the first interface and displaying the first interface in the window direction of the first interface includes: when the activity manager detects an operation by the user to close the second interface, the activity manager obtains the window direction of the first interface and determines whether the window direction of the first interface is the same as the holding direction of the electronic device; based on the window direction of the first interface being different from the holding direction of the electronic device, the activity manager notifies the screen rotation module to perform a screen rotation operation on the display window of the first application and does not display a screen rotation animation effect.
[0018] Further, the activity manager notifying the screen rotation module to perform a screen rotation operation on the display window of the first application includes: adjusting the width information, height information, and the direction information of the display content of the display window corresponding to the first application according to the window direction of the first interface, so that the window direction of the display window corresponding to the first application is the same as the preset window direction of the first interface.
[0019] That is to say, before closing the second interface of the first application, it is necessary to determine the window direction of the next interface to be displayed (i.e., the first interface of the first application) to determine whether a screen rotation operation needs to be performed on it. When a screen rotation operation needs to be performed, a screen rotation operation is performed on the display window of the first application, but the screen rotation animation is not displayed, making the user unaware of the screen rotation process and improving the user's operation experience.
[0020] In a possible implementation manner, after the screen rotation module performs a screen rotation operation on the display window of the first application, the activity manager closes the display window of the second interface and displays a closing animation, displays the display window of the first interface, and displays a startup animation.
[0021] That is to say, the screen rotation decision process for the next window to be displayed and the closing animation of the current window are executed simultaneously to ensure that the first interface of the first application has been updated to the final state after the second interface of the first application is closed, improving the user experience.
[0022] In a third aspect, an embodiment of the present application provides a screen rotation control device, including: a display unit for displaying a first interface of a first application, where the window direction of the first interface is the same as the holding direction of the electronic device;
[0023] A processing unit, configured to, when detecting an operation of opening a second interface of a second application through the first interface and determining that the preset window direction of the second interface is different from the holding direction of the electronic device, trigger the display unit to display the interface of a first target application in the preset window direction of the second interface and keep the window direction of a second target application unchanged, where the first target application includes the second application and the second target application includes the first application.
[0024] In a possible implementation, the processing unit is further configured to: when detecting that the holding direction of the electronic device changes, determine whether the window display direction of the first target application is the same as the current holding direction of the electronic device; based on the window display direction of the first target application being the same as the current holding direction of the electronic device, update the window directions of other applications on the electronic device except the first target application, so that the window directions of other applications except the first target application are the same as the current holding direction of the electronic device; based on the window display direction of the first target application being different from the current holding direction of the electronic device, set the window direction of each application on the electronic device, so that the window direction of each application on the electronic device is the same as the current holding direction of the electronic device.
[0025] In a possible implementation, when detecting an operation of opening the second interface of the second application through the first interface and determining that the preset window direction of the second interface is different from the holding direction of the electronic device, displaying the interface of the first target application in the preset window direction of the second interface and keeping the window direction of the second target application unchanged includes: obtaining the preset window direction of the second interface of the second application through the activity manager, and when the preset window direction is different from the holding direction of the electronic device, the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application.
[0026] Further, the activity manager triggering the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application includes: adjusting the width information, height information, and the direction information of the display content of the display window corresponding to the first target application according to the preset window direction of the second interface, so that the window direction of the display window corresponding to the first target application is the same as the preset window direction of the second interface.
[0027] In a possible implementation, after the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application, it further includes: the activity manager sending a resource update event to the first target application to trigger the first target application to refresh the window layout corresponding to the first target application according to the resource update event.
[0028] In a possible implementation, the first target application further includes a background application that allows a prompt window to pop up.
[0029] In a possible implementation, the first application is a desktop application.
[0030] In a possible implementation, after the display unit displays the interface of the first target application in the preset window direction of the second interface and keeps the window direction of the second target application unchanged, the processing unit is further configured to: when detecting an operation to close the second application, trigger the display unit to display the first interface of the first application, where the window display direction of the first interface of the first application is the same as the holding direction of the electronic device.
[0031] Fourthly, an embodiment of the present application provides a screen rotation control device, including: a display unit, configured to display the first interface of the first application, where the window direction of the first interface is the same as the holding direction of the electronic device;
[0032] a processing unit, configured to: when detecting an operation to open the second interface of the first application through the first interface of the first application and determining that the preset window direction of the second interface is different from the holding direction of the electronic device, trigger the display unit to display the second interface in the preset window direction of the second interface; when detecting an operation for the user to close the second interface, obtain the window direction of the first interface, and trigger the display unit to display the first interface in the window direction of the first interface.
[0033] In a possible implementation, when detecting an operation for the user to close the second interface, obtaining the window direction of the first interface and displaying the first interface in the window direction of the first interface includes: when the activity manager detects an operation for the user to close the second interface, the activity manager obtains the window direction of the first interface and determines whether the window direction of the first interface is the same as the holding direction of the electronic device; based on the window direction of the first interface being different from the holding direction of the electronic device, the activity manager notifies the screen rotation module to perform a screen rotation operation on the display window of the first application, and does not display a screen rotation animation effect.
[0034] Further, the activity manager notifying the screen rotation module to perform a screen rotation operation on the display window of the first application includes: according to the window direction of the first interface, adjusting the width information, height information, and display content direction information of the display window corresponding to the first application, so that the window direction of the display window corresponding to the first application is the same as the preset window direction of the first interface.
[0035] In a possible implementation, after the screen rotation module performs a screen rotation operation on the display window of the first application, the activity manager closes the display window of the second interface and displays a closing animation effect, displays the display window of the first interface, and displays a startup animation effect.
[0036] Fifthly, an embodiment of the present application provides an electronic device, including the device provided in the third aspect or the fourth aspect.
[0037] Sixth aspect, an embodiment of the present application provides a computer storage medium, in which instructions are stored. When the instructions run on a computer, the computer is caused to execute the method provided in the first aspect or the method provided in the second aspect.
[0038] Seventh aspect, an embodiment of the present application provides a computer product containing instructions. When the instructions run on a computer, the computer is caused to execute the method provided in the first aspect or the method provided in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0041] Figure 2 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;
[0042] Figure 3 It is a schematic diagram of the architecture of an operating system in an electronic device provided by an embodiment of the present application;
[0043] Figure 4a It is a schematic diagram of a display interface on an electronic device provided by an embodiment of the present application;
[0044] Figure 4b It is another schematic diagram of a display interface on an electronic device provided by an embodiment of the present application;
[0045] Figure 4c It is another schematic diagram of a display interface on an electronic device provided by an embodiment of the present application;
[0046] Figure 5 It is a schematic diagram of the flow of a screen rotation control method provided by an embodiment of the present application;
[0047] Figure 6a It is a schematic diagram of a display interface on an electronic device provided by an embodiment of the present application;
[0048] Figure 6b It is another schematic diagram of a display interface on an electronic device provided by an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the flow of a screen rotation control method provided by an embodiment of the present application;
[0050] Figure 8 A structural schematic diagram of a screen rotation device provided by an embodiment of the present application;
[0051] Figure 9 Another structural schematic diagram of a screen rotation device provided by an embodiment of the present application. Detailed implementation manners
[0052] In order to make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0053] In the description of the embodiments of the present application, any embodiment or design solution with "exemplary", "for example", or "for instance" should not be understood as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary", "for example", or "for instance" is intended to present related concepts in a specific manner.
[0054] In the description of the embodiments of the present application, the term "and / or" is merely an association relationship describing associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, B exists alone, and both A and B exist simultaneously. In addition, unless otherwise specified, the meaning of the term "plural" refers to two or more. For example, a plurality of systems refers to two or more systems, and a plurality of screen terminals refers to two or more screen terminals.
[0055] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0056] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application, as Figure 1As shown, when an application that does not support landscape screen display is opened from the desktop (the desktop supports both landscape and portrait screen displays) while the electronic device 100 is held horizontally, the screen display content on the electronic device will switch to portrait. At this time, if the back key is pressed to return to the desktop, the desktop will be first displayed in portrait on the display screen of the electronic device and then switched to landscape display, resulting in a poor user experience. In the embodiment of the present application, according to the physical holding state of the current electronic device, differential management of the screen rotation states of the foreground display application and the background application is realized, so that when the top-level application returns, the next application to be displayed is already in the final display state, improving the experience of the switching scenario.
[0057] It can be understood that in the embodiment of the present application, the electronic device can be a mobile phone, a tablet computer, a digital camera, a personal digital assistant (PDA), a wearable device, etc. Exemplary embodiments of the electronic device include, but are not limited to, electronic devices equipped with iOS, android, Windows, HarmonyOS or other operating systems. The above-mentioned electronic device can also be other electronic devices, such as a laptop with a touch-sensitive surface (such as a touch panel). The embodiment of the present application does not specifically limit the type of the electronic device.
[0058] Figure 2 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application. As Figure 2 shown, the electronic device 100 may include a processor 110, a memory 120, a display screen 130, and a sensor 140. It can be understood that the structure schematically shown in the embodiment of the present solution does not constitute a specific limitation on the electronic device 100. In other embodiments of the present solution, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware.
[0059] Among them, the processor 110 may be a general-purpose processor or a dedicated processor. For example, the processor 110 may include a central processing unit (CPU) and / or a baseband processor. Among them, the baseband processor can be used to process communication data, and the CPU can be used to implement corresponding control and processing functions, execute software programs, and process data of software programs.
[0060] A program (which can also be instructions or code) can be stored on the memory 120, and the program can be run by the processor 110, enabling the processor 110 to execute the methods described in this solution. Optionally, the memory 120 can store the 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 directly call them from the memory 120, avoiding repeated access, reducing the waiting time of the processor 110, and improving the efficiency of the system.
[0061] The display screen 130 is used to display images, videos, etc. The display screen 130 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some examples, the electronic device 100 can include one or more display screens 130. In one example, the display screen 130 can be used to display the interface of an application program.
[0062] The sensor 140 can include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, an ambient light sensor, a bone conduction sensor, etc.
[0063] In this solution, the sensor 140 can also include a gravity sensor and a touch sensor. The gravity sensor can be used to detect whether the holding direction of the electronic device has changed. Specifically, by the gravity sensor, the change in acceleration caused by gravity can be measured, the tilt angle of the electronic device relative to the horizontal plane can be calculated, and then it can be determined whether the holding direction of the electronic device has changed.
[0064] A touch sensor can be used to detect touch operations acting on or near it. Among them, the touch sensor can collect touch events of the user on or near it (such as the operations of the user using a finger, a stylus, or any suitable object on the surface of the touch sensor), and send the collected touch information to other devices, such as the processor 110, etc. In a possible example, the touch sensor sends the touch events collected from the display screen of the electronic device 100 to the processor 110, so that the processor 110 can determine whether the display interface on the display screen of the electronic device 100 has switched according to the touch event.
[0065] Exemplarily, the touch sensor can be implemented in multiple ways such as resistive, capacitive, infrared, and surface acoustic wave. The touch sensor can be disposed on the display screen 130, and the touch sensor and the display screen 130 form a touch screen, also known as a "touch control screen"; alternatively, the touch sensor and the display screen 130 can be implemented as two independent components to realize the input and output functions of the electronic device 100.
[0066] It can be understood that the software system of the above-mentioned electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In this solution, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device 100.
[0067] Figure 3 It is the software structure block diagram of the electronic device 100 in the embodiment of the present application.
[0068] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Android runtime and the system library, and the kernel layer. Among them, Huawei's self-developed mobile terminal operating system can also refer to this structure.
[0069] 1. Application layer
[0070] The application layer can include a series of application packages. As Figure 3 shown, the application packages can include applications (application, APP) such as life, video, map, shopping, gallery, calendar, call, navigation, music, etc.
[0071] 2. Application framework layer
[0072] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0073] As Figure 3 shown, the application framework layer may include an Activity manager, a Window display manager, an application resource manager, a screen rotation module, etc.
[0074] The Activity manager is responsible for the management of Activity components. Its main tasks include Activity startup management, status management, lifecycle management, etc.
[0075] The Window display manager is responsible for the display management of windows. Its main tasks include window display hierarchy, window display coordinates, window display animation effects, etc.
[0076] The application resource manager is responsible for the management of application resources, manages the resources loaded by the application, updates resources such as the screen width, height, and density for the application, and sends a callback for resource updates to the application when the window of the application changes, enabling the application to refresh the layout in a timely manner according to the new window information.
[0077] The screen rotation module is responsible for the screen rotation management of the system, responsible for listening to sensor events, implementing screen rotation decision management, screen rotation animation execution, screen rotation notifications, etc.
[0078] 3. Android Runtime and System Libraries
[0079] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0080] The core libraries contain two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core libraries of Android.
[0081] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0082] The system libraries may include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing libraries (such as: OpenGL ES), 2D graphics engines (such as: SGL), etc.
[0083] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media library supports the playback and recording of various common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is the drawing engine for 2D drawing.
[0084] 4. Kernel layer
[0085] The kernel layer is the layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0086] The technical solutions involved in the following embodiments can all be implemented in the electronic device 100 with the above-mentioned hardware architecture and software architecture.
[0087] Taking the electronic device 100 as a tablet as an example, the technical solutions provided by this application will be described in detail below with reference to the accompanying drawings.
[0088] As shown in 4a, the desktop application is displayed in a landscape orientation on a tablet held in landscape orientation, so that icons of multiple applications can be displayed on the display screen of the tablet. The user can open the display interface of an application by triggering the icon of a certain application. For example, when the user clicks on the video application icon on the desktop with a finger, the tablet responds to the user's click operation and determines whether the preset window orientation of the initial interface of the video application is the same as the current holding orientation of the tablet. When the window orientation of the initial interface of the video application is not the same as the current holding orientation of the tablet, such as the preset window orientation of the initial interface of the video application is in portrait orientation while the current holding orientation of the tablet is in landscape orientation, the interface as shown in Figure 4b is displayed, but at the same time, the preset window orientation of the desktop application needs to be kept unchanged.
[0089] In Figure 4b the interface shown in the tablet display, the holding orientation of the tablet is in landscape orientation, and the window display orientation of the initial interface of the video application displayed on the display screen of the tablet is in portrait orientation. When the user inputs a preset operation instruction to exit the current interface in the tablet display interface as shown in Figure 4b , for example, clicks the return button on the screen or swipes in a certain direction on the screen, the tablet responds to the detected instruction input by the user and directly returns to the desktop application display interface as shown in Figure 4a .
[0090] Furthermore, for Figure 4bThe shown flat display interface. When the user converts the flat panel held horizontally into the vertical holding mode as shown in Figure 4c Since the initial interface of the video application displayed in the display interface of the flat panel shown in Figure 4b is already in the vertical screen display, when the flat panel is converted from the horizontal holding state to the vertical holding state, the window direction of the initial interface of the video application displayed on the flat display screen does not change. Further, in the flat display interface as shown in Figure 4b When the initial interface of the video application is displayed in the window display direction of the vertical screen, the preset window directions of other applications (including the desktop application) except this video application do not change. That is, in the flat display interface as shown in Figure 4b The preset window directions of other applications except the video application are still in the horizontal screen display. Therefore, when the flat panel is converted from the horizontal holding state as shown in Figure 4b to the vertical holding state as shown in Figure 4c it is necessary to update the preset window directions of other applications except the video application to the horizontal screen direction.
[0091] Next, in combination with Figure 5 Taking the horizontal holding scenario as an example, the screen rotation control method provided by the embodiments of the present application will be described, including:
[0092] Step S501. In response to the operation instruction of the user to open the initial interface of Huawei Video in the desktop application displayed horizontally, the activity manager obtains the preset window direction of the initial interface of Huawei Video. When the obtained preset window direction is different from the holding direction of the flat panel, the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application including Huawei Video.
[0093] In the embodiments of the present application, the holding directions of the flat panel include: vertical screen direction, reverse vertical screen direction, horizontal screen direction, and reverse horizontal screen direction. When determining the current holding direction of the flat panel, the current holding direction of the flat panel can be obtained according to the gravity sensor installed in the flat panel.
[0094] The preset window direction refers to the desired display direction of the window to be opened. Specifically, each display window corresponds to a default display direction and a dynamic display direction. Among them, the priority of the dynamic display direction is higher than that of the default display direction. That is, when the user opens a new display window, if the window is set with a dynamic display direction, the currently required dynamic display direction is used as the preset window direction. If the window is not set with a dynamic display direction, the default display direction of the window is used as the preset window direction.
[0095] The first target application refers to an application that has a display layer on the display interface of the current tablet, such as a status bar, other floating windows, other split-screen applications, etc. Further, the first target application can also be configured by the system side. Specifically, it can be a whitelist preset by the system side.
[0096] Step S502, the screen rotation module performs a screen rotation operation on the display window of the first target application and sends a screen rotation notification to the activity manager.
[0097] In one example, the first target application can be determined by the activity manager. When the activity manager triggers the screen rotation module to perform a screen rotation operation, it can synchronously send the information of the first target application that needs to perform a screen rotation operation to the screen rotation module. It can also be that the screen rotation module determines the first target application that needs to perform a screen rotation operation by itself before performing the screen rotation operation.
[0098] Before the screen rotation module performs a screen rotation operation on the display window of the first target application, it first needs to obtain the size information, i.e., the length information and the width information, of the display windows corresponding to each application in the first target application, as well as the direction information of the display content within each display window. Then, it swaps the length information and the width information of each display window, and adjusts the direction of the display content within each application's display window to be the same as the preset direction of each application's display window.
[0099] When the screen rotation module finishes performing the screen rotation operation, it sends a screen rotation notification to the activity manager, and this screen rotation notification is used to trigger the activity manager to perform subsequent screen rotation operations.
[0100] Further, after receiving the screen rotation notification from the screen rotation module, the activity manager only sends a screen rotation broadcast to the first target application that needs to perform a screen rotation operation.
[0101] Step S503, the activity manager sends a screen rotation instruction to the window information manager, so that the display window corresponding to the first target application is displayed in portrait orientation.
[0102] After sending a screen rotation broadcast to the first target application, the Activity manager also needs to send a screen rotation instruction to the Window display manager, so that the display interface of the newly opened application can be displayed in portrait orientation.
[0103] Step S504, the activity manager sends an update instruction to the application resource manager, so that the application resource manager updates the resource information of the first target application, and sends a resource update callback instruction to the first target application after the update is completed.
[0104] The update instruction sent by the Activity Manager to the Application Resource Manager includes the resource update event of the first target application, so that the Application Resource Manager only updates the resource information of the first target application.
[0105] Among them, each application in the first target application corresponds to a resource update event. Each resource update event includes the width information, height information, orientation information of the application to be updated, and relevant information of the display. If the Application Resource Manager cannot receive these events, it will not actively trigger the layout refresh on the display window of the application to be updated.
[0106] It should be noted that there is no sequence between step S503 and step S504. They can be executed simultaneously, or step S503 can be executed first, or step S504 can be executed first.
[0107] In the embodiment of the present application, for the switching of windows between applications. When the preset window orientation of the newly opened application is different from the holding orientation of the current electronic device, only the newly opened application and the applications with display layers on the display interface of the current electronic device need to be rotated. And the window display orientations of other applications continue to be the same as the holding orientation of the current electronic device, that is, other applications except the newly opened application and the applications with display layers on the display interface of the current electronic device are unaware of the screen rotation event.
[0108] Further, when the gravity sensor installed in the electronic device monitors that the holding orientation of the electronic device has changed, it triggers the screen rotation module to perform a screen rotation operation. The specific operation process includes:
[0109] Step S505, the screen rotation module obtains the holding orientation of the current electronic device and the display window orientation of the application displayed on the current electronic device. According to the holding orientation of the current electronic device and the display window orientation of the application displayed on the current electronic device, it performs a screen rotation operation and sends a screen rotation notification to the Activity Manager. This screen rotation notification is used to trigger the Activity Manager to perform subsequent screen rotation operations.
[0110] The screen rotation module compares the obtained holding direction of the current electronic device with the display window direction of the application displayed on the current electronic device. When the display window direction of the application displayed on the current electronic device is the same as the holding direction of the electronic device, a screen rotation operation is performed on other applications except the application displayed on the current electronic device and the applications having display layers on the display interface of the current electronic device. Among them, the screen rotation operation performed by the screen rotation module includes: swapping the length information and width information of the display window of the application that needs to be rotated, and adjusting the direction of the display content within the display window so that the direction of the display content within the display window is the same as the holding direction of the current electronic device.
[0111] When the display window direction of the application displayed on the current electronic device is different from the holding direction of the electronic device, the screen rotation module needs to perform a screen rotation operation on all applications on the current electronic device.
[0112] Among them, there is no sequence between the two actions of the screen rotation module performing the screen rotation operation and sending a screen rotation notification to the activity manager, and they can be performed simultaneously.
[0113] Step S506: After receiving the screen rotation notification, the activity manager determines the applications that need to be rotated on the current electronic device according to the received screen rotation notification, and sends a screen rotation notification to the applications that need to be rotated.
[0114] Further, after receiving the screen rotation notification, the activity manager judges the display windows of the applications on the current electronic device to determine the applications that need to be rotated, and sends a screen rotation broadcast to the applications that need to be rotated. Or, after receiving the screen rotation notification, the activity manager obtains the application information that needs to be rotated on the current electronic device from the screen rotation notification, and sends a screen rotation notification to the applications that need to be rotated according to the application information carried in the screen rotation notification.
[0115] Step S507: The Activity manager sends an update instruction to the application resource manager, so that the application resource manager updates the resource information of other applications except the current display application and the system interface display applications related to the current display application, and sends a resource update callback instruction to the corresponding applications.
[0116] It should be noted that the embodiments of the present application take the landscape holding scenario as an example, but are not limited to the landscape holding scenario, and are equally applicable to the portrait holding scenario.
[0117] In a possible embodiment, a video application is opened in the display interface of a tablet held in portrait, and the first interface of the opened video application is as Figure 6a shown. As shown inFigure 6a On the flat interface shown, the first episode of the selected media file is opened for playback, and at this time, the video application jumps to the second interface as shown in Figure 6b .
[0118] In Figure 6b the display interface of the tablet shown, the holding direction of the tablet is the portrait direction, and the window direction of the opened second interface is the landscape direction. When the user inputs an operation instruction to exit the current interface in the tablet display interface as shown in Figure 6b , for example, clicks the return button on the screen or swipes in a certain direction on the screen, the tablet responds to the detected instruction input by the user and directly returns to the first interface of the video application as shown in Figure 6a .
[0119] Among them, the process of opening the second interface of the video application through the first interface of the video application includes: determining whether the window display direction of the second interface of the video application is the same as the holding direction of the current tablet. When the window display direction of the second interface is different from the holding direction of the current tablet, a screen rotation operation is performed on all applications on the current tablet.
[0120] Next, in combination with Figure 7 , taking the portrait holding scenario as an example, the process of closing the second display interface of the video application in the embodiments of the present application will be described, including:
[0121] Step S701, in response to the user's operation instruction to close the second interface, the activity manager obtains the window direction corresponding to the first interface. When the obtained window direction is different from the holding direction of the current electronic device, it triggers the screen rotation module to perform a screen rotation operation on the display window of the video application and sends a screen rotation notification to the activity manager.
[0122] Since the second interface of the video application is opened through the first interface, that is, when closing the display window of the second interface, the next window to be displayed is the display window of the first interface.
[0123] When the screen rotation module performs the screen rotation operation, it first needs to obtain the preset window direction information of the window corresponding to the first interface, and according to the direction information of the preset window, swap the width information and height information of the display window of the first interface, and adjust the direction of the content in the display window of the first interface so that the direction of the next content to be displayed is the same as the direction of the preset window.
[0124] Furthermore, when the screen rotation module performs a screen rotation operation on the next window to be displayed, it does not need to perform a screen rotation animation effect, so that the user is unaware of the screen rotation operation.
[0125] Step S702: The activity manager responds to the received screen rotation notification and sends an update instruction to the application resource manager, causing the application resource manager to update the resource information of all applications on the electronic device.
[0126] Step S703: The activity manager triggers the window display manager to execute the operation instruction to close the second interface, executes the closing animation effect, and simultaneously displays the display window of the first interface.
[0127] In the embodiment of the present application, for the switching between different windows within the same application, before the activity manager closes the window, the activity manager will look for the next window to be displayed, and go through the screen rotation decision-making and execution processes. The resources and status of the next window to be displayed have been updated to the final orientation before the current window is closed. Since it generally takes several hundred milliseconds for the window to be closed, when the window is closed, the next window to be displayed that the user sees is already in the display state of the final orientation. Executing the screen rotation decision-making process and the window closing and animation effect simultaneously ensures that the state of the next window to be displayed has been updated to the final state after the top-level window is closed. The experience is relatively smooth.
[0128] It should be noted that the embodiment of the present application takes the vertical screen holding scenario as an example, but is not limited to the vertical screen holding scenario, and is equally applicable to the horizontal screen holding scenario.
[0129] Based on the method in the above embodiment, the embodiment of the present application further provides a screen rotation device, where the screen rotation device is deployed on an electronic device with a display screen. Figure 8 The structural schematic diagram of a screen rotation device provided by the embodiment of the present application is as Figure 8 shown. The screen rotation device 200 includes: a display unit 801 and a processing unit 802.
[0130] The display unit 801 is used to display the first interface of the first application, and the window orientation of the first interface is the same as the holding orientation of the electronic device.
[0131] The processing unit 802 is configured to, when detecting an operation of opening the second interface of the second application through the first interface and determining that the preset window orientation of the second interface is different from the holding orientation of the electronic device, trigger the display unit 801 to display the interface of the first target application in the preset window orientation of the second interface and keep the window orientation of the second target application unchanged. Among them, the first target application includes the second application, and the second target application includes the first application.
[0132] In a possible embodiment, the preset window orientation of the second interface of the second application can be obtained through the activity manager. When the obtained preset window orientation is different from the holding orientation of the electronic device, the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application. Specifically, it includes: adjusting the width information, height information, and the orientation information of the display content of the display window corresponding to the first target application according to the preset window orientation of the second interface, so that the window orientation of the display window corresponding to the first target application is the same as the preset window orientation of the second interface.
[0133] Further, after the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the first target application, the activity manager also needs to send a resource update event to the first target application to trigger the first target application to refresh the window layout corresponding to the first target application according to this resource update event.
[0134] In a possible example, the first target application includes a background application that allows a prompt window to pop up.
[0135] In a possible example, the first application is a desktop application.
[0136] In a possible embodiment, after the display unit displays the interface of the first target application in the preset window orientation of the second interface and keeps the window orientation of the second target application unchanged. When the processing unit 802 detects that the holding orientation of the electronic device has changed, it determines whether the window display orientation of the first target application is the same as the current holding orientation of the current electronic device.
[0137] Based on the window display orientation of the first target application being the same as the current holding orientation of the current electronic device, update the window orientations of other applications on the electronic device except the first target application, so that the window orientations of other applications except the first target application are the same as the current holding orientation of the electronic device.
[0138] Based on the window display orientation of the first target application being different from the current holding orientation of the electronic device, update the window orientations of each application on the current electronic device, so that the window orientations of each application on the current electronic device are the same as the current holding orientation of the electronic device.
[0139] In a possible embodiment, when it is detected that the user closes the second application, the processing unit 802 triggers the display unit 801 to display the first interface of the first application, where the window display orientation of the first interface of the first application is the same as the holding orientation of the electronic device.
[0140] In the embodiments of the present application, when the display direction of an application is inconsistent with the holding direction of the current electronic device, only the foreground application including the application currently displayed on the device is rotated. Other applications continue to maintain the landscape state and are unaware of the screen rotation event. When the holding direction of the current electronic device changes, such as when the holding direction of the current electronic device changes from landscape holding to portrait holding, the window display direction of other applications in the landscape state is updated to portrait display. In the embodiments of the present application, the foreground display application and other applications are independently controlled for screen rotation, so that the window display direction of other applications is always consistent with the holding direction of the corresponding electronic device.
[0141] Based on the method in the above embodiments, the embodiments of the present application further provide a screen rotation device. Figure 9 The following is a schematic structural diagram of a screen rotation device provided by an embodiment of the present application. As Figure 9 shown, the screen rotation device 300 includes: a display unit 901 and a processing unit 902.
[0142] The display unit 901 is used to display a first interface of a first application, where the window direction of the first interface is the same as the holding direction of the current electronic device.
[0143] The processing unit 902 is configured to, when detecting an operation of opening a second interface of the first application through the first interface of the first application and determining that the preset window direction of the second interface is different from the holding direction of the current electronic device, trigger the display unit 901 to display the second interface in the preset window direction of the second interface. Further, the processing unit 902 is further configured to, when detecting an operation of the user closing the second interface, obtain the window direction of the first interface and trigger the display unit 901 to display the first interface in the window direction of the first interface.
[0144] In a possible embodiment, when detecting an operation of the user closing the second interface through the activity manager, the next interface to be displayed is obtained as the first interface, and the window direction of the first interface is determined by obtaining the window direction of the first interface through the activity manager to determine whether the window direction of the first interface is the same as the holding direction of the current electronic device. Based on the window direction of the first interface being different from the holding direction of the current electronic device, the activity manager notifies the screen rotation module to perform a screen rotation operation on the display window of the first application and does not display the screen rotation animation effect.
[0145] Among them, the screen rotation module performing a screen rotation operation on the display window of the first application includes: adjusting the width information, height information, and display content direction information of the display window of the first application according to the window direction of the first interface, so that the window direction of the display window corresponding to the first application is the same as the preset window direction of the first interface.
[0146] After the screen rotation module completes the screen rotation operation on the display window of the first application, the Activity manager closes the display window of the second interface, displays the closing animation effect, and displays the display window of the first interface, and displays the startup animation effect.
[0147] In the embodiment of the present application, before the system performs the operation of closing the top-level window, it is necessary to find in advance the next window to be displayed, and perform a screen rotation decision according to the preset window direction of the next window to be displayed. For example, when the preset window direction of the next window to be displayed is different from the holding direction of the current electronic device, a screen rotation operation is required. Specifically, when performing the screen rotation operation, it is not necessary to execute the screen rotation animation effect. Only update the screen rotation notification, update resources, etc. to all applications. At the same time, for the top-level window that is being closed, no processing is performed, including the screen rotation animation effect, screen rotation notification, resource refresh, etc. actions, because the top-level window has not been closed yet, so there is no need to process it. After the screen rotation operation is completed, then remove the top-level window to be closed and display the closing animation effect. While removing the top-level window to be closed, display the startup special effect of the new window. At this time, the display state of the new window is already the final display state.
[0148] Based on the device in the above embodiment, the embodiment of the present application further provides an electronic device, which includes any one of the screen rotation devices provided in the above embodiment.
[0149] The method steps in the embodiment of the present application can be implemented in a hardware manner or by a processor executing software instructions. The software instructions can be composed of corresponding software modules. The software modules can be stored in a random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), register, hard disk, removable hard disk, CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a part of the processor. The processor and the storage medium can be located in an ASIC.
[0150] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the processes or functions described in the embodiments of the present application are generated in whole or in part. 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 transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). 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 or a data center that includes one or more integrated available media. The available medium 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 (SSD)), etc.
[0151] It can be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application.
Claims
1. A screen rotation control method, characterized in that, Applied to an electronic device with a display screen, the method includes: Displaying a first interface of a first application, where the window direction of the first interface is the same as the holding direction of the electronic device; In response to detecting an operation of opening a second interface of a second application through the first interface, displaying the interface of the second application in a preset window direction of the second interface and keeping the window direction of the first application unchanged, where the preset window direction of the second interface is different from the holding direction of the electronic device.
2. The method according to claim 1, wherein After displaying the interface of the second application in the preset window direction of the second interface and keeping the window direction of the first application unchanged, the method further includes: When detecting a change in the holding direction of the electronic device, updating the window direction of the first application so that the window direction of the first application is the same as the current holding direction of the electronic device.
3. The method according to claim 1, characterized in that, The displaying the interface of the second application in the preset window direction of the second interface and keeping the window direction of the first application unchanged includes: Obtaining the preset window direction of the second interface through an activity manager. When the preset window direction is different from the holding direction of the electronic device, the activity manager triggers a screen rotation module to perform a screen rotation operation on the display window corresponding to the second application.
4. The method according to claim 3, wherein The activity manager triggering the screen rotation module to perform a screen rotation operation on the display window corresponding to the second application includes: Adjusting the width information, height information, and the direction information of the displayed content of the display window corresponding to the second application according to the preset window direction of the second interface, so that the window direction of the display window corresponding to the second application is the same as the preset window direction of the second interface.
5. The method according to claim 3, characterized in that, After the activity manager triggers the screen rotation module to perform a screen rotation operation on the display window corresponding to the second application, the method further includes: The activity manager sending a resource update event to the second application to trigger the second application to refresh the window layout corresponding to the second application according to the resource update event.
6. The method according to claim 1, wherein The first application is a desktop application.
7. The method according to claim 1 or 2, characterized in that, After displaying the interface of the second application in the preset window direction of the second interface and keeping the window direction of the first application unchanged, the method further includes: When detecting an operation of closing the second application, displaying the first interface of the first application, where the window display direction of the first interface of the first application is the same as the holding direction of the electronic device.
8. A screen rotation control method, characterized in that, Applied to an electronic device with a display screen, the method includes: Displaying a first interface of a first application, where the window direction of the first interface is the same as the holding direction of the electronic device; In response to detecting an operation of opening a second interface of the first application through the first interface of the first application, displaying the second interface in a preset window direction of the second interface, where the preset window direction of the second interface is different from the holding direction of the electronic device; When detecting an operation of the user closing the second interface, displaying the first interface, where the display direction of the first interface is the same as the current holding direction of the electronic device.
9. The method according to claim 8, wherein When it is detected that the user closes the second interface, the display of the first interface includes: If the window orientation of the first interface is different from the holding orientation of the electronic device, perform a screen rotation operation on the display window of the first application without displaying a screen rotation animation effect.
10. The method according to claim 8 or 9, characterized in that When it is detected that the user closes the second interface, the display of the first interface includes: When the activity manager detects that the user closes the second interface, the activity manager obtains the window orientation of the first interface and determines whether the window orientation of the first interface is the same as the holding orientation of the electronic device; Based on the fact that the window orientation of the first interface is different from the holding orientation of the electronic device, the activity manager notifies the screen rotation module to perform a screen rotation operation on the display window of the first application without displaying a screen rotation animation effect.
11. The method according to claim 10, characterized in that, The activity manager notifying the screen rotation module to perform a screen rotation operation on the display window of the first application includes: According to the window orientation of the first interface, adjust the width information, height information, and the direction information of the display content of the display window corresponding to the first application, so that the window orientation of the display window corresponding to the first application is the same as the preset window orientation of the first interface.
12. The method according to claim 10, wherein After the screen rotation module performs a screen rotation operation on the display window of the first application, the activity manager closes the display window of the second interface and displays a closing animation effect, displays the display window of the first interface, and displays a startup animation effect.
13. An electronic device, characterized in that, Comprising a processor and a memory, instructions are stored in the memory, and when the instructions are executed by the processor, the electronic device is caused to execute the method according to any one of claims 1-12.
14. A computer storage medium, instructions are stored in the computer storage medium, and when the instructions run on a computer, the computer is caused to execute the method according to any one of claims 1-12.
15. A computer product containing instructions, when the instructions run on a computer, the computer is caused to execute the method according to any one of claims 1-12.
Citation Information
Patent Citations
Display apparatus, display control method, and program
CN103370681A
Screen rotation method and screen rotation device
CN105915705A
An application display method and electronic equipment
CN109814766A
Display interface parameter configuration method and device, computer equipment and storage medium
CN110134475A
Application display direction control method, system and device and readable storage medium
CN112948037A