Application orientation updating method and apparatus, electronic device, medium and program product
By determining the actual orientation of the application based on sensor and orientation switch information on the terminal device, and updating the application's display configuration when the device supports it, the layout disorder problem of multiple application windows when the screen orientation changes is solved, achieving seamless switching and smooth application display.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- VIVO MOBILE COMM CO LTD
- Filing Date
- 2025-12-19
- Publication Date
- 2026-07-02
AI Technical Summary
When multiple applications are running simultaneously on a terminal device, application windows that are not adapted to the system orientation can cause layout errors, especially when the screen orientation changes. In such cases, the unadapted application windows will recalculate their layout based on the incorrect orientation, resulting in display errors.
When the configuration of the target application changes, the actual direction of the target application is determined based on information such as the direction detected by the sensor, the direction switch indication, and the direction requested by the application. If the device status supports it, a direction update process is performed to generate and notify the window client of the application component of the new configuration to ensure that the application is displayed in the correct direction.
It avoids application layout disorder, ensures seamless switching and smoothness of applications when the screen orientation changes, and improves the stability and user experience of displaying multiple application windows at the same time.
Smart Images

Figure CN2025143709_02072026_PF_FP_ABST
Abstract
Description
Application areas include updating methods, devices, electronic equipment, media, and program products.
[0001] Cross-reference to related applications
[0002] This application claims priority to Chinese Patent Application No. 202411931191.3, filed in China on December 26, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application belongs to the field of electronic equipment technology, and specifically relates to an application direction update method, apparatus, electronic equipment, medium and program product. Background Technology
[0004] On a terminal, multiple applications (including background applications, desktop applications, etc.) are usually open at the same time. These application windows have their own request directions, but under the current direction management mechanism, they will be re-laid out according to the system direction.
[0005] If an application is not adapted to the system's orientation, and the window is visible, the user will see a layout error. For example, if the current device has a portrait application A and a landscape application B open in sequence, and the user is on application B, the system orientation is generally landscape. Application A will also recalculate its layout based on the landscape orientation. If application A is not adapted to the landscape layout and application B is transparent, making application A's window visible, then the layout of application A will appear disordered. Summary of the Invention
[0006] This application provides an application orientation update method, apparatus, electronic device, medium, and program product to avoid application layout disorder.
[0007] In a first aspect, embodiments of this application provide an application direction update method, including:
[0008] In the event of a first configuration change in the target application, a first direction of the target application is determined based on first information, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch;
[0009] If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to perform a direction update, then the direction update process of the target application is executed.
[0010] Optionally, the direction update process for the target application includes:
[0011] Based on the first direction, generate a second configuration of the application components of the target application;
[0012] According to the second configuration, perform the first operation;
[0013] The first operation includes at least one of the following:
[0014] Execution direction update;
[0015] The second configuration is notified to the window client of the application component.
[0016] Optionally, if the application component is the highest-level component in the process where the target application resides, the first operation further includes:
[0017] The second configuration is sent to the process where the target application resides.
[0018] Optionally, the method further includes:
[0019] If the current state of the electronic device does not support the target application to perform orientation updates, determine whether the application components of the target application are in the process of switching.
[0020] If the handover process is in progress, wait for the handover process to complete.
[0021] If the system is not in a switching process and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component in the current system is inconsistent with the system direction and the system is in a switching process, then wait for the switching process to complete; otherwise, determine that the system global configuration has changed.
[0022] Optionally, the method further includes:
[0023] If the target conditions are met, determine the first configuration change for the target application;
[0024] The target conditions include at least one of the following:
[0025] System global configuration changes;
[0026] The sensor detects changes in direction;
[0027] The screen orientation switch status changes;
[0028] The direction of the target application's request changes;
[0029] Changes in the direction of the target application's related parties;
[0030] Switching complete.
[0031] Secondly, embodiments of this application also provide an application direction updating device, comprising:
[0032] The determining module is configured to determine a first direction of the target application based on first information in the event of a first configuration change of the target application, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch;
[0033] An execution module is configured to, if the current state of the electronic device supports the target application to perform a direction update process when the first direction is inconsistent with the current direction of the target application, perform a direction update process for the target application.
[0034] Optionally, the execution module includes:
[0035] The generation unit is configured to generate a second configuration of the application components of the target application based on the first direction.
[0036] An execution unit is configured to perform a first operation according to the second configuration;
[0037] The first operation includes at least one of the following:
[0038] Execution direction update;
[0039] The second configuration is notified to the window client of the application component.
[0040] Optionally, if the application component is the highest-level component in the process where the target application resides, the execution unit is further configured to:
[0041] The second configuration is sent to the process where the target application resides.
[0042] Optionally, the device further includes:
[0043] The determination module is used to determine whether the application components of the target application are in the process of switching when the current state of the electronic device does not support the target application to perform orientation updates.
[0044] The first processing module is used to wait for the switching process to complete if it is in the process of switching.
[0045] The second processing module is used to wait for the switching process to complete if the system direction is not in the process of switching and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component of the current system is inconsistent with the system direction and the system is in the process of switching, then the module determines that the global system configuration has changed.
[0046] Optionally, the device further includes:
[0047] The triggering module is used to determine the first configuration change of the target application when the target conditions are met;
[0048] The target conditions include at least one of the following:
[0049] System global configuration changes;
[0050] The sensor detects changes in direction;
[0051] The screen orientation switch status changes;
[0052] The direction of the target application's request changes;
[0053] Changes in the direction of the target application's related parties;
[0054] Switching complete.
[0055] Thirdly, embodiments of this application also provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps described in the first aspect.
[0056] Fourthly, embodiments of this application also provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps described in the first aspect.
[0057] Fifthly, embodiments of this application also provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps described in the first aspect.
[0058] In a sixth aspect, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0059] In this embodiment of the application, in the event of a first configuration change in the target application, a first direction of the target application is determined based on first information. If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to update its direction, the direction update process of the target application is executed. This can avoid the problem of application layout disorder. Attached Figure Description
[0060] Figure 1 is a flowchart illustrating the application direction update method according to an embodiment of this application;
[0061] Figure 2 is a schematic diagram comparing the principles of the original direction update mechanism and the direction update mechanism of the embodiment of this application;
[0062] Figure 3 is a schematic diagram comparing the effects of the original direction update mechanism and the direction update mechanism of the embodiment of this application.
[0063] Figure 4 is a schematic diagram comparing the application configuration of the direction update mechanism in the embodiments of this application;
[0064] Figure 5 is a detailed flowchart of an embodiment of this application;
[0065] Figure 6 is a schematic diagram of the application direction update device according to an embodiment of this application;
[0066] Figure 7 is a schematic diagram of the structure of an electronic device according to an embodiment of this application;
[0067] Figure 8 is a second schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0068] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0069] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0070] The application direction update method, apparatus, electronic device, medium, and program product provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0071] As shown in Figure 1, this application embodiment provides an application direction update method applied to an electronic device. The method includes:
[0072] Step S101: In the event of a first configuration change in the target application, a first direction of the target application is determined based on first information, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch;
[0073] Step S102: If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to perform a direction update, then the direction update process of the target application is executed.
[0074] It should be noted that in this embodiment of the application, in the event of a first configuration change in the target application, the first direction of the target application is determined based on the first information. If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to update its direction, then the direction update process of the target application is executed. This can avoid the problem of application layout disorder. For example, if a newly opened application affects the system direction, and the previously opened application is not compatible with the system direction, then the previously opened application will not be adjusted in direction, thus preventing the layout disorder of the previously opened application.
[0075] Optionally, the direction mentioned in the embodiments of this application can be understood as the display direction of the application, that is, the layout direction of the application when it is displayed on the desktop. This direction usually includes: landscape orientation (referred to as landscape) and portrait orientation (referred to as portrait).
[0076] Optionally, in one implementation, the method further includes:
[0077] If the target conditions are met, determine the first configuration change for the target application;
[0078] The target conditions include at least one of A11-A16:
[0079] A11. Changes to system-wide configuration;
[0080] This situation can be understood as a change in the system orientation. For example, the previous system orientation was landscape, while the changed system orientation is portrait. In this case, the orientation of the target application follows the system orientation, meaning that a change in the system orientation will affect the orientation of the target application.
[0081] A12. Changes in direction detected by the sensor;
[0082] It should be noted that the sensor in question refers to the sensor in an electronic device that detects the orientation of the electronic device, such as a gyroscope or orientation sensor. This can be understood as follows: if the orientation detected by the sensor changes, the orientation of the target application may also change accordingly. For example, if the electronic device is in portrait mode, the orientation of the target application is also in portrait mode. If the electronic device is changed to landscape mode, the orientation of the target application should also change to landscape mode.
[0083] A13. Changes in the screen orientation switch status;
[0084] It's important to clarify that this situation can be understood as the electronic device having a screen orientation switch, such as a switch to enable or disable portrait mode. If the switch is on, the electronic device must remain in portrait mode, even if the target application needs to switch from portrait to landscape. In this case, the target application's orientation will not change. For example, if the user disables the portrait mode switch, and the electronic device is in landscape mode, and application A was in portrait mode before the switch was disabled, then application A should switch to landscape mode after the switch is disabled.
[0085] A14. Change in the direction of the target application's request;
[0086] In this case, it can be understood that the orientation of the target application is affected by the orientation of its request. If the target application requests landscape mode at time 1 and portrait mode at time 2, the orientation should be changed based on the target application's request.
[0087] A15. Changes in the direction of the target application's related parties;
[0088] It should be noted that the related party can be understood as other applications or components that affect the orientation of the target application. For example, the orientation of application A changes with the orientation of application B (i.e., the orientation of application A is consistent with the orientation of application B). When application B changes from portrait to landscape, the orientation of application A should also change from portrait to landscape.
[0089] A16. Switching complete;
[0090] This situation can be understood as follows: if the target application is switched to the application currently being used by the user, the orientation of the target application may change after the switch is completed. For example, if the target application was displayed in portrait mode in the background before the switch, and the user switched the target application in landscape mode, that is, switched the target application running in the background to the foreground, then the target application should be displayed in landscape mode in the foreground after the switch.
[0091] Optionally, the first direction mentioned in the embodiments of this application refers to the actual display direction of the target application, that is, the actual direction of the target application.
[0092] Optionally, in one implementation, the specific implementation of determining the first direction of the target application based on the first information includes at least one of the following:
[0093] B11. If the direction indicated by the direction switch does not support the second direction, then the first direction applied to the determined target should be the same as the direction indicated by the direction switch.
[0094] For example, if the second direction is landscape, and the direction switch indicates portrait (for example, if an electronic device has a switch to enable or disable portrait mode, and the switch is enabled, it means that the electronic device needs to be in portrait mode at all times), the electronic device does not support the direction requested by the target application. In other words, the first direction of the target application should be portrait, and the actual direction of the target application should be portrait.
[0095] B12. If the direction indicated by the direction switch supports the second direction, then the first direction applied to the determined target is the second direction.
[0096] For example, the second direction is landscape mode. The direction indicated by the direction switch can be either landscape or portrait mode (for example, electronic devices have a switch to turn portrait mode on or off. If the switch is off, it means that the electronic device can be in either portrait or portrait mode). At this time, the electronic device supports the direction requested by the target application. That is, the first direction of the target application should be landscape mode, and the actual direction of the target application determined at this time should be landscape mode.
[0097] B13. If the direction detected by the sensor is the same as the second direction, then the first direction of the determined target application should be the same as the direction detected by the sensor.
[0098] For example, if the second direction is landscape mode and the direction detected by the sensor is landscape mode, then the electronic device supports the direction requested by the target application. In other words, the first direction of the target application should be landscape mode, and the actual direction of the target application determined at this time should be landscape mode.
[0099] B14. If the direction detected by the sensor is different from the second direction, and if the direction switch indicates the direction that supports the second direction, then the first direction for the target application is the second direction.
[0100] For example, if the second direction is landscape, and the direction detected by the sensor is portrait, the direction indicated by the direction switch can be either landscape or portrait (for example, the electronic device has a switch to turn portrait on or off; if the switch is off, it means that the electronic device can be in either portrait or portrait display mode). At this time, the electronic device supports the direction requested by the target application, that is, the first direction of the target application should be landscape, that is, the actual direction of the target application determined at this time should be landscape.
[0101] B15. If the direction detected by the sensor is different from the second direction, or if the direction switch indicates a direction that does not support the second direction, then the first direction of the target application should be the same as the direction detected by the sensor.
[0102] For example, if the second direction is landscape, the direction detected by the sensor is portrait, and the direction indicated by the direction switch is portrait (for example, the electronic device has a switch to enable or disable portrait mode; if the switch is enabled, it means that the electronic device needs to be in portrait mode at all times), the electronic device does not support the direction requested by the target application. In other words, the first direction of the target application should be portrait, and the actual direction of the target application determined at this time should be portrait.
[0103] It should be noted that B11-B15 above are merely illustrative examples of determining the first direction of the target application and do not constitute a limitation on the embodiments of this application. Any implementation that can determine the first direction of the target application falls within the protection scope of the embodiments of this application.
[0104] Optionally, in one implementation, the specific implementation of the direction update process of the target application includes:
[0105] Step S11: Generate a second configuration of the application components of the target application according to the first direction;
[0106] Optionally, the second configuration includes a first direction.
[0107] Step S12: Perform the first operation according to the second configuration;
[0108] The first operation includes at least one of the following:
[0109] A11. Execution direction update;
[0110] In this case, the direction is updated directly according to the direction indicated by the second configuration.
[0111] A12. Notify the window client of the application component of the second configuration;
[0112] It should be noted that by sending the second configuration to the window client of the application component, the window client can redraw the layout according to the direction indicated by the second configuration to ensure that the window layout adapts to the direction indicated by the second configuration.
[0113] Optionally, in one implementation, if the application component is the highest-level component in the process where the target application resides, the first operation further includes:
[0114] The second configuration is sent to the process where the target application resides.
[0115] It should be noted that since the direction of a process is consistent with the direction of the highest-level component in the process, if the application component of the target application is not the highest-level component in the process of the target application, it will not affect the direction of the process. If it is the highest-level component, the direction of the process needs to be adjusted. In this case, the second configuration needs to be sent to the process to achieve the direction adjustment of the process.
[0116] Optionally, in one implementation, the method further includes:
[0117] S21, if the current state of the electronic device does not support the target application to perform orientation update, determine whether the application component of the target application is in the process of switching.
[0118] Optionally, the switching mentioned in this application embodiment refers to a change in the state of the electronic device (e.g., screen state in one case), such as application switching, i.e., switching from one application to another; orientation switching, i.e., switching from one orientation to another (e.g., switching from landscape to portrait); unlocking the electronic device; switching the electronic device from a screen-off state to a screen-on state; switching the electronic device from a screen-on state to a screen-off state, etc.
[0119] S22, If in the process of switching, wait for the switching process to complete;
[0120] It should be noted that if the application is in the process of switching, it is not advisable to update the direction of the target application. In this case, you need to wait for the application to switch to complete before you can continue the subsequent direction update process.
[0121] S23. If the system is not in a switching process and the direction of the application component of the target application determines the system direction, if the direction of the highest-level component of the current system is inconsistent with the system direction and the system is in a switching process, then wait for the switching process to complete; otherwise, determine that the system global configuration has changed.
[0122] It should be noted that the direction of the application component determines the direction of the system, which can be understood as the system direction being influenced by the direction of the application component. That is, the system direction is the same as the direction of the application component, and the application component can also be called the source of the system direction.
[0123] It should be noted that if the application is not in a switching process and the target application's application component is not a system direction source, the direction update process can be executed. However, if the target application's application component is a system direction source, it is necessary to determine whether the system direction has changed. If there is no change, the direction update process can be executed. If there is a change and the direction of the highest-level component in the current system is inconsistent with the system direction, but the application is not in a switching process, then it is determined that the system global configuration has changed. If there is a change and the direction of the highest-level component in the current system is inconsistent with the system direction, and the application is in a switching process, then it is necessary to wait for the switching to complete before continuing the subsequent application direction update process.
[0124] It should be noted that, under the Android mechanism, orientation and configuration are bound. When the system orientation is updated, the system-wide configuration is updated, and then the new configuration is distributed to all window containers and to each application process. The application client then lays out according to the new configuration. However, the embodiments of this application aim to ensure that the orientation-related information in the application window and the process configuration remains in the orientation requested by the application itself, so that the application can lay out according to the requested orientation. When the application orientation has not changed, a change in the system orientation will not trigger the application client to re-layout and redraw.
[0125] Figure 2 illustrates the relationship between the application request direction, the system direction, and the application's actual direction. As shown in Figure 2, in the original direction update mechanism, the application request direction affects the system direction, and then the system direction update affects the application window direction (in non-special modes such as split-screen windows, it directly determines the application window direction). Since the application window and the application client are bound, this determines the application client's content layout and drawing direction. However, using the direction update mechanism of this embodiment, the application request direction affects both the system direction and the application's actual direction, but the system direction and the application's actual direction are not strongly correlated.
[0126] It should be noted that when the native orientation update mechanism continuously switches between applications in different orientations, stuttering or display abnormalities generally occur because the system orientation is updated during application switching. Since the application orientation and system orientation are consistent, the native orientation update mechanism has some limitations, which necessitates screen freeze and rotation animations in many scenarios, as illustrated in Figure 3. For example, when the opened application window has attributes such as semi-transparent or non-full-screen that may allow the view of other application interfaces below, seamless switching is not allowed because it would expose the sudden change in the content of the application interface below, resulting in abnormalities such as half-screen display. For instance, if a portrait application A opens a transparent landscape application B, and a seamless switch is used, after opening B, the system orientation is immediately switched to landscape, and the portrait application A below will also instantly switch to landscape. Furthermore, due to the asynchrony between the client and server, screen flickering and other phenomena may occur. The orientation update mechanism in this application embodiment is independent for each application orientation. For example, in the scenario described above, vertical screen application A still maintains vertical screen display, and the animation will not be interrupted. The application configuration comparison is shown in Figure 4. The system window management service (WMS) sends different orientation configurations to the clients of application A and application B respectively, maintaining their different orientation displays. Therefore, there is no need to worry about sudden screen flickering issues, and seamless switching can be performed directly. The system orientation is performed after the application switching is completed, ensuring a smooth animation transition. The switching process can be seen in Figure 3, which shows the switching effect under the orientation update mechanism of this application embodiment.
[0127] It should also be noted that under the original orientation update mechanism, when returning from a landscape application to a portrait desktop, in some scenarios, such as when a pip window (i.e., a minimized window) is present, the desktop may undergo repeated configuration changes, i.e., orientation changes, leading to repeated desktop re-layout rendering, which can easily cause time-consuming and laggy performance. After returning to the desktop, the system orientation becomes portrait, and the landscape application receives the portrait configuration. The application's internal logic may modify the layout information according to the portrait orientation, and when the landscape application is reopened, it will update the layout again according to the landscape orientation. However, in the orientation update mechanism of this application embodiment, in the above pip scenario, the desktop does not receive repeated orientation changes and will independently maintain its own portrait layout, eliminating the time-consuming and laggy problem. After the landscape application is exited, it will not receive the portrait configuration, and when it is reopened, there is no need to re-layout render, thus ensuring the smoothness of application switching.
[0128] It's important to note that Android has the concept of processes. Each application runs within a process, and multiple applications, components, services, and floating windows can run within the same process. Each component has a different orientation, and the process also has configuration information. In the original orientation update mechanism, the process configuration retrieves the configuration of the highest-level component. Except during switching processes, the component configuration orientation generally aligns with the system orientation. Applications within a process also use the process configuration for layout processing on the client side. The orientation update mechanism in this application embodiment incorporates compatibility measures, ensuring that the process configuration orientation matches the orientation of the top-displayed components. If no components are visible and there is a foreground service or floating window, then the orientation must align with the system orientation.
[0129] The implementation process of the embodiments of this application will be described in detail below.
[0130] As shown in Figure 5, the main process includes:
[0131] Step 501: Determine the first configuration change for the target application;
[0132] For example, it may include at least one of the following processes:
[0133] Process A: When the system's global configuration changes, i.e., when the system config is updated, the first configuration change of the target application will be triggered.
[0134] It should be noted that the system's global configuration includes not only orientation information but also dark mode switching, so a forced orientation update is also required.
[0135] Process B: Changes in orientation detected by the sensor, and / or changes in the screen orientation switch state, may trigger the first configuration change of the target application;
[0136] It should be noted that this process may not trigger configuration changes, but components that depend on these directions will be updated in a timely manner, actively triggering configuration changes.
[0137] C process: The direction of the target application's request changes, that is, the change in the direction of the application's own request will trigger the first configuration change of the target application;
[0138] D process: The direction of the target application's dependents changes. In other words, if the direction of the target application's dependents changes, it will trigger the first configuration change of the target application.
[0139] For example, when component A's orientation follows that of component B below it, a change in component B's orientation will notify component A of an update to its configuration.
[0140] E process: The switchover ends. In other words, after the switchover ends, the participating components trigger a direction update, which will trigger the first configuration change of the target application.
[0141] It should be noted that the direction change cannot be triggered during the switching process, otherwise it will cause random flashing. You need to try to trigger the configuration change after the switching is completed.
[0142] It should be noted that if any of the above processes exist, step 502 will be triggered.
[0143] Step 502: Determine the first direction of the target application based on the first information;
[0144] Specifically, the first information includes, but is not limited to, at least one of the following: the second direction requested in the modified first configuration, the direction detected by the sensor, and the direction indicated by the direction switch.
[0145] Optionally, if it is determined that the obtained first direction is inconsistent with the current direction of the application, step 503 is executed.
[0146] Step 503: Determine whether the current state of the electronic device supports the application to update the orientation;
[0147] For example, if the application component is the container that ultimately determines the system direction, or if the application component is in the process of switching, the direction cannot be updated immediately, proceed to step 510; otherwise, proceed to step 504.
[0148] Step 504: Generate a second configuration of the application components of the target application according to the first direction;
[0149] Step 505: Perform direction update;
[0150] It should be noted that if the current system does not have a switching process being prepared (which can be represented by a switching animation), a switching process with a change in direction will be automatically triggered. If the current system already has a switching process, the direction update will be directly added to the already executed switching process.
[0151] Step 506: Determine if the application component is the highest-level component in the process where the target application resides; if it is the highest-level component, proceed to step 507.
[0152] Step 507: Send the second configuration to the process where the target application resides;
[0153] This step involves passing the new configuration to the application process via a cross-process (binder) method.
[0154] It should be noted that steps 506 and 507 are optional.
[0155] Step 508: Notify the window client of the application component of the second configuration;
[0156] It should be noted that this step involves passing the new configuration to the application's window client via a cross-process approach.
[0157] Step 509: The window client redraws the application layout;
[0158] It should be noted that after receiving these callbacks, the application's window client will rearrange and redraw the layout based on the received information to adapt to the current orientation.
[0159] Step 510: Determine whether the application component of the target application is in the process of switching. If it is in the process of switching, proceed to step 511; otherwise, proceed to step 512.
[0160] Step 511: Wait for the switching process to complete, then trigger the E process in step 501;
[0161] Step 512: Determine whether the application component is a system direction source. If it is a system direction source, proceed to step 513.
[0162] Step 513, update the system orientation;
[0163] It should be noted that step 513 can also be triggered by other trigger points in the system process (the original direction update mechanism itself triggers the process, which will not be described in detail here). This means calculating and attempting to update the system direction. If the direction has indeed changed, proceed to step 514.
[0164] Step 514: Determine whether the direction of the highest-level component in the current system is inconsistent with the system direction and whether it is in the process of switching. If so, execute step 511; otherwise, trigger process A in step 501.
[0165] It should be noted that, through the above process in the embodiments of this application, the strong correlation between the system direction and the actual direction of the application window is removed, and the actual direction of the application will be determined by the application's own requested direction combined with factors such as the current system sensor direction and direction switch.
[0166] The embodiments of this application can achieve the following beneficial effects:
[0167] 1. When application windows in different directions are displayed simultaneously, they can each be displayed according to their respective directions, avoiding layout confusion, and providing strong support for needs such as the Atomic Workbench (which can display multiple application windows at the same time) that require multiple applications in different directions to be displayed in their respective directions at the same time.
[0168] 2. When the system orientation changes, other application windows do not need to constantly switch their layouts and draw accordingly, avoiding unnecessary waiting time;
[0169] 3. Seamless application switching is a prerequisite for the high-speed engine to quickly switch applications (application opening and exit operations cannot continue when the screen is frozen and rotated). The embodiments of this application also ensure the smoothness when switching between multiple applications.
[0170] It should be noted that the application direction update method provided in this application embodiment can be executed by an application direction update device or a control module within that device for executing the application direction update method. This application embodiment uses the execution of the application direction update method by an application direction update device as an example to illustrate the application direction update method provided in this application embodiment.
[0171] As shown in Figure 6, at least one embodiment of this application also provides an application direction update device 600, applied to an electronic device, the device comprising:
[0172] The determining module 601 is configured to determine a first direction of the target application based on first information in the event of a first configuration change of the target application, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch;
[0173] The execution module 602 is configured to execute the direction update process of the target application if the current state of the electronic device supports the target application to update its direction when the first direction is inconsistent with the current direction of the target application.
[0174] Optionally, the execution module 602 includes:
[0175] The generation unit is configured to generate a second configuration of the application components of the target application based on the first direction.
[0176] An execution unit is configured to perform a first operation according to the second configuration;
[0177] The first operation includes at least one of the following:
[0178] Execution direction update;
[0179] The second configuration is notified to the window client of the application component.
[0180] Optionally, if the application component is the highest-level component in the process where the target application resides, the execution unit is further configured to:
[0181] The second configuration is sent to the process where the target application resides.
[0182] Optionally, the device further includes:
[0183] The determination module is used to determine whether the application components of the target application are in the process of switching when the current state of the electronic device does not support the target application to perform orientation updates.
[0184] The first processing module is used to wait for the switching process to complete if it is in the process of switching.
[0185] The second processing module is used to wait for the switching process to complete if the system direction is not in the process of switching and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component of the current system is inconsistent with the system direction and the system is in the process of switching, then the module determines that the global system configuration has changed.
[0186] Optionally, the device further includes:
[0187] The triggering module is used to determine the first configuration change of the target application when the target conditions are met;
[0188] The target conditions include at least one of the following:
[0189] System global configuration changes;
[0190] The sensor detects changes in direction;
[0191] The screen orientation switch status changes;
[0192] The direction of the target application's request changes;
[0193] Changes in the direction of the target application's related parties;
[0194] Switching complete.
[0195] It should be noted that this device embodiment corresponds to the above method, and all implementation methods in the above method embodiment are applicable to this device embodiment and can achieve the same technical effect.
[0196] The application direction update device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0197] The application direction update device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0198] The application direction update device provided in this application embodiment can implement the various processes implemented in the method embodiment of FIG1. To avoid repetition, it will not be described again here.
[0199] The apparatus of this application embodiment can achieve the following beneficial effects:
[0200] 1. When application windows in different directions are displayed simultaneously, they can each be displayed according to their respective directions, avoiding layout confusion, and providing strong support for needs such as the Atomic Workbench (which can display multiple application windows at the same time) that require multiple applications in different directions to be displayed in their respective directions at the same time.
[0201] 2. When the system orientation changes, other application windows do not need to constantly switch their layouts and draw accordingly, avoiding unnecessary waiting time;
[0202] 3. Seamless application switching is a prerequisite for the high-speed engine to quickly switch applications (application opening and exit operations cannot continue when the screen is frozen and rotated). The embodiments of this application also ensure the smoothness when switching between multiple applications.
[0203] Optionally, as shown in FIG7, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a program or instructions stored in the memory 702 and executable on the processor 701. When the program or instructions are executed by the processor 701, they implement the various processes of the above-described application direction update method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0204] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0205] Figure 8 is a schematic diagram of the hardware structure of an electronic device that implements an embodiment of this application.
[0206] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.
[0207] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for powering various components. The power supply can be logically connected to the processor 810 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The electronic device structure shown in Figure 8 does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0208] The processor 810 is used for:
[0209] In the event of a first configuration change in the target application, a first direction of the target application is determined based on first information, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch;
[0210] If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to perform a direction update, then the direction update process of the target application is executed.
[0211] It should be noted that, in the event of a first configuration change in the target application, a first direction of the target application is determined based on the first information. If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to update its direction, then the direction update process of the target application is executed. This can avoid the problem of application layout disorder.
[0212] Optionally, the processor 810 is used for:
[0213] Based on the first direction, generate a second configuration of the application components of the target application;
[0214] According to the second configuration, perform the first operation;
[0215] The first operation includes at least one of the following:
[0216] Execution direction update;
[0217] The second configuration is notified to the window client of the application component.
[0218] Optionally, if the application component is the highest-level component in the process where the target application resides, the first operation further includes:
[0219] The second configuration is sent to the process where the target application resides.
[0220] Optionally, the processor 810 is further configured to:
[0221] If the current state of the electronic device does not support the target application to perform orientation updates, determine whether the application components of the target application are in the process of switching.
[0222] If the handover process is in progress, wait for the handover process to complete.
[0223] If the system is not in a switching process and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component in the current system is inconsistent with the system direction and the system is in a switching process, then wait for the switching process to complete; otherwise, determine that the system global configuration has changed.
[0224] Optionally, the processor 810 is further configured to:
[0225] If the target conditions are met, determine the first configuration change for the target application;
[0226] The target conditions include at least one of the following:
[0227] System global configuration changes;
[0228] The sensor detects changes in direction;
[0229] The screen orientation switch status changes;
[0230] The direction of the target application's request changes;
[0231] Changes in the direction of the target application's related parties;
[0232] Switching complete.
[0233] It should be noted that the electronic device in this application embodiment can achieve the following beneficial effects:
[0234] 1. When application windows in different directions are displayed simultaneously, they can each be displayed according to their respective directions, avoiding layout confusion, and providing strong support for needs such as the Atomic Workbench (which can display multiple application windows at the same time) that require multiple applications in different directions to be displayed in their respective directions at the same time.
[0235] 2. When the system orientation changes, other application windows do not need to constantly switch their layouts and draw accordingly, avoiding unnecessary waiting time;
[0236] 3. Seamless application switching is a prerequisite for the high-speed engine to quickly switch applications (application opening and exit operations cannot continue when the screen is frozen and rotated). The embodiments of this application also ensure the smoothness when switching between multiple applications.
[0237] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 807 includes a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here. The memory 809 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 810 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understandable that the aforementioned modem processor may not be integrated into the processor 810.
[0238] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described application direction update method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0239] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0240] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above application direction update method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0241] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0242] This application also provides a computer program / program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described application direction update method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0243] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0244] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0245] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An application direction update method, comprising: In the event of a first configuration change in the target application, a first direction of the target application is determined based on first information, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch; If the first direction is inconsistent with the current direction of the target application, and the current state of the electronic device supports the target application to perform a direction update, then the direction update process of the target application is executed.
2. The method according to claim 1, wherein, The direction update process for the target application includes: Based on the first direction, generate a second configuration of the application components of the target application; According to the second configuration, perform the first operation; The first operation includes at least one of the following: Execution direction update; The second configuration is notified to the window client of the application component.
3. The method according to claim 2, wherein, When the application component is the highest-level component in the process where the target application resides, the first operation further includes: The second configuration is sent to the process where the target application resides.
4. The method according to claim 1, further comprising: If the current state of the electronic device does not support the target application to perform orientation updates, determine whether the application components of the target application are in the process of switching. If the handover process is in progress, wait for the handover process to complete. If the system is not in a switching process and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component in the current system is inconsistent with the system direction and the system is in a switching process, then wait for the switching process to complete; otherwise, determine that the system global configuration has changed.
5. The method according to any one of claims 1-4, further comprising: If the target conditions are met, determine the first configuration change for the target application; The target conditions include at least one of the following: System global configuration changes; The sensor detects changes in direction; The screen orientation switch status changes; The direction of the target application's request changes; Changes in the direction of the target application's related parties; Switching complete.
6. An application direction updating device, comprising: The determining module is configured to determine a first direction of the target application based on first information in the event of a first configuration change of the target application, wherein the first information includes at least one of the following: a second direction requested in the changed first configuration, a direction detected by a sensor, and a direction indicated by a direction switch; An execution module is configured to, if the current state of the electronic device supports the target application to perform a direction update process when the first direction is inconsistent with the current direction of the target application, perform a direction update process for the target application.
7. The apparatus according to claim 6, wherein, The execution module includes: The generation unit is configured to generate a second configuration of the application components of the target application based on the first direction. An execution unit is configured to perform a first operation according to the second configuration; The first operation includes at least one of the following: Execution direction update; The second configuration is notified to the window client of the application component.
8. The apparatus according to claim 7, wherein, When the application component is the highest-level component in the process where the target application resides, the execution unit is further configured to: The second configuration is sent to the process where the target application resides.
9. The apparatus according to claim 6, further comprising: The determination module is used to determine whether the application components of the target application are in the process of switching when the current state of the electronic device does not support the target application to perform orientation updates. The first processing module is used to wait for the switching process to complete if it is in the process of switching. The second processing module is used to wait for the switching process to complete if the system direction is not in the process of switching and the direction of the application component of the target application determines the system direction, and if the direction of the highest-level component of the current system is inconsistent with the system direction and the system is in the process of switching, then the module determines that the global system configuration has changed.
10. The apparatus according to any one of claims 6-9, further comprising: The triggering module is used to determine the first configuration change of the target application when the target conditions are met; The target conditions include at least one of the following: System global configuration changes; The sensor detects changes in direction; The screen orientation switch status changes; The direction of the target application's request changes; Changes in the direction of the target application's related parties; Switching complete.
11. An electronic device comprising a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the application direction update method as described in any one of claims 1-5.
12. A readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the application direction update method as described in any one of claims 1-5.
13. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the application direction update method as described in any one of claims 1-5.
14. A chip comprising a processor and a communication interface, wherein, The communication interface is coupled to the processor, which is used to run programs or instructions to implement the steps of the application direction update method as described in any one of claims 1-5.
15. An electronic device configured to perform the steps of the application direction update method as described in any one of claims 1-5.