Method and device for fast switching user backup data without restarting
By utilizing Android's multi-user mechanism in cloud mobile phones, the backup data is mounted to the directory of non-default system users and the uid logo is adjusted, and the application and system service can be quickly switched in cloud mobile phones without restarting containers and system services. System data solves the problem that switching takes time or cannot be switched in the prior art.
Patent Information
- Application Number
- CN202411069927.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-06
AI Technical Summary
In the cloud mobile scenario, the prior art cannot realize the switching of storage resources between application data and system data without restarting the container and system services, resulting in the switching taking a long time or the system data being unable to switch.
By utilizing Android's multi-user mechanism, the backup data in the storage server is mounted to the corresponding directory of non-default system users and the apk_data data is installed to ensure that the uid identifier assigned by the system during the installation process is the same as the uid identifier in the backup data, thus Achieve rapid switching of user backup data.
It realizes rapid switching of storage resources including application data and system data without restarting containers and system services, which is short-term and is suitable for cloud mobile scenarios.
Smart Images

Figure CN118612214B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing, and in particular to a method and device for fast switching of user backup data without restarting. Background Art
[0002] With the rapid development of cloud technology, cloud phones, as an emerging cloud service, provide users with a mobile device usage environment that is not restricted by hardware. Cloud phones are usually based on virtualization technology, allowing users to remotely access Android deployed on cloud servers. Each cloud phone instance can be configured with independent storage space for storing applications, data, and user files. In the cloud phone scenario, users may need to switch between different storage resources to meet the needs of data isolation, resource management, or performance optimization.
[0003] There are two main solutions for switching storage resources, including container-based solutions and application-free decompression installation solutions. The container-based solution usually includes the following steps:
[0004] (1) Close all Android system services and applications of the container;
[0005] (2) Close the container;
[0006] (3) Reload user storage resources (including system data and application data);
[0007] (4) Restart the container;
[0008] (5) Restart all Android system services and applications of the container.
[0009] In this solution, it takes a long time because the container and system services need to be restarted.
[0010] The application-based decompression-free installation solution usually includes the following steps:
[0011] (1) Close the application;
[0012] (2) Reload application data;
[0013] (3) Restart the application.
[0014] In this solution, although there is no need to restart the container and system services and it takes less time, it is impossible to switch system data, such as user browser download records, user photo data, etc.
[0015] Therefore, how to provide a storage resource switching solution suitable for cloud phone scenarios, which can realize the switching of storage resources including application data and system data without restarting containers and system services, has become a technical problem that needs to be solved urgently. Summary of the invention
[0016] In view of the technical problems existing in the prior art, the embodiments of the present application provide a method and device for quickly switching user backup data without restarting.
[0017] In a first aspect, an embodiment of the present application provides a method for quickly switching user backup data without restarting, which is applied to a cloud server, comprising:
[0018] Mounting the first backup data stored in the storage server to a corresponding directory under the first system user, wherein the first backup data includes apk_data data, user_data data, and sdcard_data data, and the first system user is a non-default system user;
[0019] Install the apk_data data to the first system user, and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
[0020] In a second aspect, an embodiment of the present application further provides a device for quickly switching user backup data without restarting, which is applied to a cloud server, including:
[0021] A mounting unit, configured to mount first backup data stored in the storage server to a corresponding directory under a first system user, wherein the first backup data includes apk_data data, user_data data, and sdcard_data data, and the first system user is a non-default system user;
[0022] A switching unit is used to install the apk_data data to the first system user and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
[0023] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for quickly switching user backup data without restarting as described in the first aspect are executed.
[0024] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for quickly switching user backup data without restarting as described in the first aspect.
[0025] In summary, the method and device, electronic device and storage medium for quickly switching user backup data without restarting provided in the embodiments of the present application, with the help of Android's multi-user mechanism, mount the first backup data including application data and system data to the corresponding directory under the first system user to be switched, and then install the apk_data data in the first backup data to the first system user, and switch the current system user to the first system user. This solution is suitable for cloud phone scenarios, does not require restarting containers and system services, takes a short time, and can realize the switching of storage resources including application data and system data. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A flowchart of an embodiment of a method for fast switching of user backup data without restart provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of a structure of an embodiment of a device for quickly switching user backup data without restarting provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0030] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0031] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0032] Reference Figure 1 As shown, it is a flowchart of a method for quickly switching user backup data without restarting provided by an embodiment of the present application. The method for quickly switching user backup data without restarting is applied to a cloud server, and includes:
[0033] S10, mounting the first backup data stored in the storage server to a corresponding directory under the first system user, wherein the first backup data includes apk_data data, user_data data, and sdcard_data data, and the first system user is a non-default system user;
[0034] In this embodiment, it should be noted that the first backup data stored in the storage server can be copied from other cloud servers in advance. Specifically, the application can be installed under the first system user of other cloud servers, and then the apk_data data (installation package data), user_data data (user data) and sdcard_data data (external storage data) of other cloud servers are copied to the storage server, that is, the storage resources including application data and system data in the storage server, and the first backup data can be part or all of the data selected by the user from the storage resources. The first system user is not the default system user user0. Assuming that the first system user is user10, the apk_data data can be mounted to the / data / app directory, the user_data data can be mounted to the / data / user / 10 directory, and the sdcard_data data can be mounted to the / data / media / 10 directory.
[0035] S11. Install the apk_data data to the first system user, and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
[0036] In this embodiment, it should be noted that in order to manage application permissions, the Android system will assign a unique uid identifier to each installed app (application). Even if the same application is uninstalled and installed multiple times, the uid identifier of the application will be different after each installation; at the same time, the uid identifier range of each system user's application in the Android multi-user scenario is also inconsistent, which will cause the application file with the uid identifier in the first backup data to be different from the uid assigned by the system to the application when the application is installed, resulting in the application being unable to be installed normally / smoothly or having problems after installation. In order to solve this problem, it is necessary to make the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data the same as the uid identifier of the file with the uid identifier of the corresponding application in the mount directory of the first backup data. After step S11 is executed, the user can see the desktop of the first system user and can then perform desktop operations.
[0037] The method for quickly switching user backup data without restarting provided in the embodiment of the present application, with the help of Android's multi-user mechanism, mounts the first backup data including application data and system data to the corresponding directory under the first system user to be switched, then installs the apk_data data in the first backup data to the first system user, and switches the current system user to the first system user. This solution is suitable for cloud phone scenarios, does not require restarting containers and system services, takes a short time, and can realize the switching of storage resources including application data and system data.
[0038] Based on the foregoing method embodiment, the method may further include:
[0039] During the installation of apk_data data, the offset parameter of the first backup data mount is modified according to the uid identifier assigned by the system to the corresponding application, so that the uid identifier assigned by the system to the corresponding application during the installation of apk_data data is the same as the uid identifier of the file with the existing uid identifier of the corresponding application in the directory.
[0040] In this embodiment, it should be noted that when the first backup data is stored in the storage server, the uid identifier of the file with the uid identifier of the application in the first backup data can be modified to the corresponding uid baseline value, and then the first backup data is mounted to the cloud server. When the apk_data data of the first backup data is installed to the first system user, the offset parameter of the first backup data mount can be modified according to the first system user, so that the uid identifier of the corresponding file in the mount directory of the first backup data is the same as the uid identifier assigned to the corresponding application by the system during the installation of the apk_data data. For example, assuming that the first backup data is generated under the system user user10, and the uid of file m of application A in the user_data data of the first backup data is 100100, then the uid of file m can be modified to 100 (that is, 100100-the starting value of the application uid range of system user user10 100000), and then file m is mounted to the cloud server. When application A is installed later, assuming that the uid assigned by the system to application A is 100200, the offset parameter of the mount of file m can be adjusted to 100100. In this way, the uid of the file under the mount directory of file m is 100200 (that is, 100+the offset parameter of the mount 100100), which is the same as the uid assigned by the system to application A. To give another example, assuming that the first backup data is generated under the system user user13, and the uid of file n of application B in the user_data data of the first backup data is 130112, then the uid of file n can be modified to 10112 (that is, 130112-the starting value of the application uid range of system user user12, 120000), and then file n is mounted to the cloud server. When application B is installed later, assuming that the uid assigned by the system to application B is 100222, the offset parameter of the mount of file n can be adjusted to 90110, so that the uid of the file under the mount directory of file n is 100222 (that is, 10112 + the offset parameter of the mount 90110), which is the same as the uid assigned by the system to application B.
[0041] It should be noted that in addition to the solution of this embodiment which can ensure that the uid identifier of the application files in the mounted directory is the same as the uid identifier assigned by the system to the application, the system can also be modified to limit the uid of the same application under the same system user to a specified value to ensure that the uid identifier of the application files in the mounted directory is the same as the uid identifier assigned by the system to the application. In this case, the system user when generating the first backup data must be the same as the first system user.
[0042] Based on the aforementioned method embodiment, when the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, the current system user may be a default system user, and other system users except the default system user are in a stopped state.
[0043] In this embodiment, it should be noted that when the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, if the first system user is not in a stopped state, it is necessary to ensure that the current system user is the default system user, and that other system users except the default system user are in a stopped state, that is, if the current system user is not the default system user, it is necessary to switch the system user to the default system user (that is, the default system user is in an active visible state), and stop other system users running in the background (that is, stop all processes belonging to other system users).
[0044] On the basis of the foregoing method embodiment, when the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, the current system user may be a second system user, wherein the second system user is a non-default system user, and the second system user is different from the first system user;
[0045] The method may further include:
[0046] Stop the second system user, uninstall the application under the second system user, and disconnect the backup data mount under the second system user, wherein the corresponding backup data stored in the storage server is retained when uninstalling the application.
[0047] In this embodiment, it should be noted that when the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, if the current system user (i.e., the system user currently in the active visible state) is a second system user that is not the first system user and not the default system user, then steps S10 and S11 can be performed under the second system user, and then the second system user will be stopped, that is, all processes belonging to the second system user will be stopped, and correspondingly all references to the backup data mounting directory under the second system user will be released. After that, the application under the second system user will be uninstalled, and the backup data mounting under the second system user will be disconnected. It should be noted that when uninstalling the application, the corresponding backup data stored in the storage server will be retained for next use.
[0048] Based on the foregoing method embodiment, the method may further include:
[0049] Switch the system user to the default system user, stop the third system user, uninstall the application under the third system user, and disconnect the backup data mount under the third system user, where the third system user is the system user before switching the system user, and retain the corresponding backup data stored in the storage server when uninstalling the application.
[0050] In this embodiment, it should be noted that if the user requests to stop the operation (for example, when the user exits the use of the cloud phone) or requests to switch to other cloud servers, the system user can be switched to the default system user, the system user before the switch can be stopped, the application under the system user before the switch can be uninstalled, and the backup data mount under the system user before the switch can be disconnected.
[0051] Reference Figure 2 As shown, it is a structural schematic diagram of a device for quickly switching user backup data without restarting provided by an embodiment of the present application, which is applied to a cloud server and includes:
[0052] The mounting unit 20 is used to mount the first backup data stored in the storage server to a corresponding directory under the first system user, wherein the first backup data includes apk_data data, user_data data and sdcard_data data, and the first system user is a non-default system user;
[0053] The switching unit 21 is used to install the apk_data data to the first system user and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
[0054] The device for quickly switching user backup data without restarting provided in the embodiment of the present application, with the help of Android's multi-user mechanism, mounts the first backup data including application data and system data to the corresponding directory under the first system user to be switched, then installs the apk_data data in the first backup data to the first system user, and switches the current system user to the first system user. This solution is suitable for cloud phone scenarios, does not require restarting containers and system services, takes a short time, and can realize the switching of storage resources including application data and system data.
[0055] Based on the above device embodiment, the switching unit may also be used for:
[0056] During the installation of apk_data data, the offset parameter of the first backup data mount is modified according to the uid identifier assigned by the system to the corresponding application, so that the uid identifier assigned by the system to the corresponding application during the installation of apk_data data is the same as the uid identifier of the file with the existing uid identifier of the corresponding application in the directory.
[0057] Based on the aforementioned device embodiment, when the mounting unit mounts the first backup data stored in the storage server to the corresponding directory under the first system user, the current system user may be a default system user, and other system users except the default system user are in a stopped state.
[0058] On the basis of the aforementioned device embodiment, when the mounting unit mounts the first backup data stored in the storage server to the corresponding directory under the first system user, the current system user may be a second system user, wherein the second system user is a non-default system user, and the second system user is different from the first system user;
[0059] The device may further include:
[0060] The first stopping unit is used to stop the second system user, uninstall the application under the second system user, and disconnect the backup data mounting under the second system user, wherein the corresponding backup data stored in the storage server is retained when the application is uninstalled.
[0061] Based on the above device embodiment, the device may further include:
[0062] The second stopping unit is used to switch the system user to the default system user, stop the third system user, uninstall the application under the third system user, and disconnect the backup data mounting under the third system user, wherein the third system user is the system user before switching the system user, and the corresponding backup data stored in the storage server is retained when uninstalling the application.
[0063] The device for quickly switching user backup data without restarting provided in the embodiment of the present application has an implementation process that is consistent with the method for quickly switching user backup data without restarting provided in the embodiment of the present application, and the effect that can be achieved is also the same as the method for quickly switching user backup data without restarting provided in the embodiment of the present application, and will not be repeated here.
[0064] like Figure 3 As shown, an electronic device provided by an embodiment of the present application includes: a processor 30, a memory 31 and a bus 32, wherein the memory 31 stores machine-readable instructions executable by the processor 30, and when the electronic device is running, the processor 30 communicates with the memory 31 through the bus 32, and the processor 30 executes the machine-readable instructions to perform the steps of the method for quickly switching user backup data without restarting as described above.
[0065] Specifically, the above-mentioned memory 31 and processor 30 can be general-purpose memories and processors, which are not specifically limited here. When the processor 30 runs the computer program stored in the memory 31, the above-mentioned method of quickly switching user backup data without restarting can be executed.
[0066] Corresponding to the above-mentioned method for quickly switching user backup data without restarting, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for quickly switching user backup data without restarting are executed.
[0067] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for fast switching user backup data without restarting, applied to a cloud server, characterized in that: include: Mounting the first backup data stored in the storage server to a corresponding directory under the first system user, wherein the first backup data includes apk_data data, user_data data, and sdcard_data data, and the first system user is a non-default system user; Install the apk_data data to the first system user, and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
2. The method according to claim 1, characterized in that Also includes: During the installation of apk_data data, the offset parameter of the first backup data mount is modified according to the uid identifier assigned by the system to the corresponding application, so that the uid identifier assigned by the system to the corresponding application during the installation of apk_data data is the same as the uid identifier of the file with the existing uid identifier of the corresponding application in the directory.
3. The method according to claim 1 or 2, characterized in that When the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, the current system user is a default system user, and other system users except the default system user are in a stopped state.
4. The method according to claim 1 or 2, characterized in that: When the first backup data stored in the storage server is mounted to the corresponding directory under the first system user, the current system user is the second system user, wherein the second system user is a non-default system user, and the second system user is different from the first system user; The method further comprises: Stop the second system user, uninstall the application under the second system user, and disconnect the backup data mount under the second system user, wherein the corresponding backup data stored in the storage server is retained when uninstalling the application.
5. The method according to claim 1, characterized in that The method further comprises: Switch the system user to the default system user, stop the third system user, uninstall the application under the third system user, and disconnect the backup data mount under the third system user, where the third system user is the system user before switching the system user, and retain the corresponding backup data stored in the storage server when uninstalling the application.
6. A device for fast switching user backup data without restarting, applied to a cloud server, characterized in that: include: A mounting unit, configured to mount first backup data stored in the storage server to a corresponding directory under a first system user, wherein the first backup data includes apk_data data, user_data data, and sdcard_data data, and the first system user is a non-default system user; A switching unit is used to install the apk_data data to the first system user and switch the system user to the first system user, wherein the uid identifier assigned by the system to the corresponding application during the installation of the apk_data data is the same as the uid identifier of the file with the uid identifier of the corresponding application in the directory.
7. The device according to claim 6, characterized in that The switching unit is further used for: During the installation of apk_data data, the offset parameter of the first backup data mount is modified according to the uid identifier assigned by the system to the corresponding application, so that the uid identifier assigned by the system to the corresponding application during the installation of apk_data data is the same as the uid identifier of the file with the existing uid identifier of the corresponding application in the directory.
8. The device according to claim 6 or 7, characterized in that When the mounting unit mounts the first backup data stored in the storage server to the corresponding directory under the first system user, the current system user is a default system user, and other system users except the default system user are in a stopped state.
9. The device according to claim 6 or 7, characterized in that When the mounting unit mounts the first backup data stored in the storage server to the corresponding directory under the first system user, the current system user is the second system user, wherein the second system user is a non-default system user, and the second system user is different from the first system user; The device further comprises: The first stopping unit is used to stop the second system user, uninstall the application under the second system user, and disconnect the backup data mounting under the second system user, wherein the corresponding backup data stored in the storage server is retained when the application is uninstalled.
10. The device according to claim 6, characterized in that The device also includes: The second stopping unit is used to switch the system user to the default system user, stop the third system user, uninstall the application under the third system user, and disconnect the backup data mounting under the third system user, wherein the third system user is the system user before switching the system user, and the corresponding backup data stored in the storage server is retained when uninstalling the application.
Citation Information
Patent Citations
Method for creating multiple user spaces for APP (Application) on intelligent equipment
CN104391685A
Remote file mounting method and apparatus for instance system
CN108509435A
Multi-tenant data persistence method and device, storage medium and computer equipment
CN114168156A
Operation method and device of cloud mobile phone system directory, electronic equipment and storage medium
CN114579511A
System and method for backup and recovery of services in a cloud computing environment
US20190095289A1
