Method, apparatus, electronic device and storage medium for application state synchronization
View Patent ↗The disclosure provides methods, apparatus, electronic devices, storage media, computer program products and computer programs for application state synchronization, which are applied to electronic devices. The electronic device runs a first operating system and a second operating system running in the first operating system in a containerized manner. One of the methods includes, in response to a target operation on a target application by a user, controlling the first operating system to send a target operation request to the second operating system. The target application is an application program of the second operating system included in the first operating system. The target operation is performed in the second operating system and the second operating system is controlled to send a target operation success message to the first operating system. A proxy object of the target application is updated in the first operating system. operation.
1 . A method for application state synchronization, comprising:
establishing, at an electronic device running a first operating system and a second operating system, a connection between the first operating system and the second operating system, the second operating system running in the first operating system in a containerized manner, wherein the first operating system comprises a first application manager, and the second operating system comprises a second application manager, and the establishing the connection between the first operating system and the second operating system comprises establishing a connection between the first application manager and the second application manager;
in response to a startup operation on a target application by a user, controlling the first application manager to send a startup operation request to the target application through the second application manager, wherein the target application is an application program of the second operating system included in the first operating system;
performing the startup operation in the second operating system and controlling the target application to send a startup success message to the first application manager through the second application manager; and
updating, in the first operating system, a proxy object of the target application, based on the startup success message, wherein the proxy object comprises a current state of the target application, and the updating the proxy object of the target application comprises controlling the first application manager to set the current state of the target application to a foreground running state.
2 . The method of claim 1 , wherein if the startup operation is a startup operation of the target application triggered by the user on a desktop of the first operating system, the controlling the first application manager to send a startup operation request to the target application through the second application manager comprises:
controlling the desktop of the first operating system to send the startup operation request to the target application through the first application manager and the second application manager; and
if the startup operation is a startup operation of the target application triggered by the user on a current application of the first operating system, the controlling the first application manager to send a startup operation request to the target application through the second application manager comprising:
controlling the current application to send the startup operation request to the target application through the first application manager and the second application manager.
3 . The method of claim 1 , wherein the first operating system further comprises a window manager;
if a target operation comprises a background switching operation, the controlling the first operating system to send a target operation request to the second operating system comprising:
controlling a desktop of the first operating system to send a background switching request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a background switching success message to the first application manager through the second application manager;
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to set the current state of the target application to a background freeze state;
before controlling a desktop of the first operating system to send a background switching request to the target application through the first application manager and the second application manager, the method further comprising:
controlling the desktop of the first operating system to send the background switching operation request to the window manager; and
controlling the window manager to switch a window of the target application to a background.
4 . The method of claim 3 , wherein the first operating system further comprises a task manager;
if the target operation comprises a foreground switching operation, the controlling the first operating system to send a target operation request to the second operating system comprising:
controlling the task manager to send a foreground switching request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a foreground switching success message to the first application manager through the second application manager;
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to set the current state of the target application to the foreground running state; and
before controlling the task manager to send a foreground switching request to the target application through the first application manager and the second application manager, the method further comprising:
controlling the task manager to send the foreground switching operation request to the window manager; and
controlling the window manager to switch the window of the target application to a foreground.
5 . The method of claim 4 , wherein if the target operation comprises a closing operation, the controlling the first operating system to send a target operation request to the second operating system comprises:
controlling the task manager to send a closing operation request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a closing success message to the first application manager through the second application manager; and
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to delete the proxy object of the target application.
6 . The method of claim 1 , wherein after performing the startup operation in the second operating system, the method further comprises:
controlling the second application manager to update the current state of the target application based on the startup operation.
7 . The method of claim 1 , wherein the proxy object further comprises name information of the target application, and the name information of the target application corresponds to the current state one by one.
8 . The method of claim 1 , wherein the connection between the first operating system and the second operating system is a socket connection.
9 . The method of claim 1 , wherein the application program comprises at least one of: an instant messaging software, a shopping software, a music player or a video player.
10 . An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the computer program, the processor performs operations comprising:
establishing a connection between a first operating system and a second operating system, wherein the first operating system comprises a first application manager, and the second operating system comprises a second application manager, and the establishing the connection between the first operating system and the second operating system comprises establishing a connection between the first application manager and the second application manager;
in response to a startup operation on a target application by a user, controlling the first application manager to send a startup operation request to the target application through the second application manager, wherein the target application is an application program of the second operating system included in the first operating system;
performing the startup operation in the second operating system and controlling the target application to send a startup success message to the first application manager through the second application manager; and
updating, in the first operating system, a proxy object of the target application, based on the startup success message, wherein the proxy object comprises a current state of the target application, and the updating the proxy object of the target application comprises controlling the first application manager to set the current state of the target application to a foreground running state.
11 . The electronic device of claim 10 , wherein if the startup operation is a startup operation of the target application triggered by the user on a desktop of the first operating system, the controlling the first application manager to send a startup operation request to the target application through the second application manager comprises:
controlling the desktop of the first operating system to send the startup operation request to the target application through the first application manager and the second application manager; and
if the startup operation is a startup operation of the target application triggered by the user on a current application of the first operating system, the controlling the first application manager to send a startup operation request to the target application through the second application manager comprising:
controlling the current application to send the startup operation request to the target application through the first application manager and the second application manager.
12 . The electronic device of claim 10 , wherein the first operating system further comprises a window manager;
if a target operation comprises a background switching operation, the controlling the first operating system to send a target operation request to the second operating system comprising:
controlling a desktop of the first operating system to send a background switching request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a background switching success message to the first application manager through the second application manager;
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to set the current state of the target application to a background freeze state; and
before controlling a desktop of the first operating system to send a background switching request to the target application through the first application manager and the second application manager:
controlling the desktop of the first operating system to send the background switching request to the window manager; and
controlling the window manager to switch a window of the target application to a background.
13 . The electronic device of claim 12 , wherein the first operating system further comprises a task manager;
if the target operation comprises a foreground switching operation, the controlling the first operating system to send a target operation request to the second operating system comprising:
controlling the task manager to send a foreground switching request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a foreground switching success message to the first application manager through the second application manager;
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to set the current state of the target application to the foreground running state; and
before controlling the task manager to send a foreground switching request to the target application through the first application manager and the second application manager:
controlling the task manager to send the foreground switching request to the window manager; and
controlling the window manager to switch the window of the target application to a foreground.
14 . The electronic device of claim 13 , wherein if the target operation comprises a closing operation, the controlling the first operating system to send a target operation request to the second operating system comprises:
controlling the task manager to send a closing operation request to the target application through the first application manager and the second application manager;
the controlling the second operating system to send a target operation success message to the first operating system comprising:
controlling the target application to send a closing success message to the first application manager through the second application manager; and
the updating a proxy object of the target application in the first operating system based on the target operation success message comprising:
controlling the first application manager to delete the proxy object of the target application.
15 . The electronic device of claim 10 , wherein after performing the startup operation in the second operating system:
controlling the second application manager to update the current state of the target application based on the target operation.
16 . The electronic device of claim 10 , wherein the proxy object further comprises name information of the target application, and the name information of the target application corresponds to the current state one by one.
17 . The electronic device of claim 10 , wherein the connection between the first operating system and the second operating system is a socket connection.
18 . A non-transitory computer-readable storage medium having a computer program stored thereon which, when executed by a processor, performs operations comprising:
establishing a connection between a first operating system and a second operating system, wherein the first operating system comprises a first application manager, and the second operating system comprises a second application manager, and the establishing the connection between the first operating system and the second operating system comprises establishing a connection between the first application manager and the second application manager;
in response to a startup operation on a target application by a user, controlling the first application manager to send a startup operation request to the target application through the second application manager, wherein the target application is an application program of the second operating system included in the first operating system;
performing the startup operation in the second operating system and controlling the target application to send a startup success message to the first application manager through the second application manager; and
updating, in the first operating system, a proxy object of the target application, based on the startup success message, wherein the proxy object comprises a current state of the target application, and the updating the proxy object of the target application comprises controlling the first application manager to set the current state of the target application to a foreground running state.