Android system construction method, Android system starting method and electronic equipment
By creating a custom partition and modifying the data storage location during the Android system build process, the problem of long boot times after a factory reset was solved, achieving fast boot and efficient initialization.
Patent Information
- Application Number
- CN202510890292.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-11-21
AI Technical Summary
In existing technologies, restoring factory settings results in long boot times and low efficiency for Android systems, mainly because important data loss necessitates reloading manufacturer applications and configuration data, increasing initialization time.
A custom partition is created during the Android system build process to save initialization data. The location for saving application and configuration data is changed to the custom partition. After the image file is burned, the applications and data in the custom partition are automatically installed and configured during the boot process.
By protecting application and configuration data in custom partitions and preventing loss during factory reset, initialization steps are reduced, improving boot speed and user experience.
Smart Images

Figure CN120994265A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of system development, in particular to an Android system construction method, a starting method and an electronic device. BACKGROUND
[0002] In order to prevent the device from being stuck or being misoperated by the user, the device is usually provided with a factory reset function, but the factory reset will reset all data in the device, resulting in loss of important data, and long boot time and low efficiency during initialization of the device. SUMMARY
[0003] The present application solves the technical problem of providing an Android system construction method, a starting method and an electronic device, and improving the boot efficiency after factory reset.
[0004] In order to solve the above technical problem, one technical solution adopted by the present application is: An Android system construction method applied to an electronic device, the method comprising: establishing a custom partition when constructing an Android system code, the custom partition being a partition for saving initialization data established outside the system default partition; compiling an application and configuration data to be protected into the custom partition when compiling the Android system code; modifying the saving location of the cache data of the application to the custom partition.
[0005] In order to solve the above technical problem, another technical solution adopted by the present application is: An Android system starting method, comprising: burning an image file to obtain a custom partition, the image file being obtained according to the above-mentioned Android system construction method; scanning the custom partition to obtain the application in the custom partition and installing the application when starting the application package management service of the Android system during the starting process of the Android system; scanning the custom partition to obtain the configuration data in the custom partition and executing the configuration data during the starting process of the Android system.
[0006] In order to solve the above technical problem, another technical solution adopted by the present application is: An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, the processor implementing each step of the above-mentioned Android system construction method when executing the computer program.
[0007] The application has the beneficial effects that: the application places the application and configuration data to be protected in a new custom directory by constructing the new custom directory when constructing the Android system code, the custom directory is a directory for saving initialization data constructed in addition to the original system directory, and after the custom directory is burned as a custom partition, a custom partition different from the system partition is constructed in the device, and since the factory reset only resets the system partition by default, the application and configuration data in the custom partition are not deleted in the process of factory reset, thereby protecting the application and configuration data to be protected in the process of factory reset; and the saving position of the cache data of the application is also modified in the custom directory, so that after the factory reset, not only the application itself can be protected, but also the data in the use process of the application can be preserved, without the need to initialize the application again, so that the boot time is short, the efficiency is high, and the use experience of the user is improved. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 A step flow chart of an Android system construction method provided for the embodiment of the application is shown in the figure. Figure 2 A step flow chart of an Android system starting method provided for the embodiment of the application is shown in the figure. Figure 3 A structural schematic diagram of an electronic device provided for the embodiment of the application is shown in the figure. DETAILED DESCRIPTION
[0009] In order to make the technical problems, technical solutions and beneficial effects of the application clearer, the application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
[0010] In the following description, specific details are set forth in order to provide a thorough understanding of the embodiments of the application, such as specific system structures, techniques, etc. However, it should be apparent to those skilled in the art that the application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application with unnecessary details.
[0011] It should be understood that when used in the specification and the appended claims of the application, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or sets thereof.
[0012] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified descriptions are not necessarily all referring to the same embodiment, however, but can refer to one or more but not all embodiments. The terms "including," "comprising," "carrying," "having," "containing," and variations thereof are meant to encompass the item listed thereafter but do not exclude additional, unrecited items. The terms "a" or "an," as used herein in the specification, mean "one or more."
[0013] In the related art, for a device that exists secondary development for a system, such as a POS device, a cash register device, and the like, in addition to the configuration of the system itself, there is also a vendor initialization configuration. That is, in addition to the original Android system on the device, there is also pre-installed vendor application and configuration data, and after the first burning, the vendor application and configuration data are run and take effect, indicating that the device has completed the factory vendor initialization work.
[0014] In order to ensure the normal use of the terminal, the terminal is usually allowed to perform a factory reset operation, and the factory reset operation resets the configuration data in the system partition of the Android system and data, so that data loss inevitably occurs. And the factory reset will only retain the initial configuration of the system itself, and the configuration of the vendor initialization in the system partition will be deleted, so that during the boot process after the factory reset, the vendor application and configuration data need to be reloaded, that is, the user needs to contact the vendor to re-perform the vendor initialization work after the factory reset operation, thereby increasing the initialization time after booting and slowing down the boot process.
[0015] If the data marked manner is used to judge whether the data needs to be deleted during the factory reset process, the time required for the factory reset operation will be prolonged, and the efficiency will be reduced. And the original factory reset process needs to be changed, which increases the development workload. Therefore, the electronic device in the related art has the problems of long boot time and low efficiency after factory reset.
[0016] In order to solve the above problems, the application provides an Android system construction method, an Android system startup method and an electronic device. The following will introduce an Android system construction method of the application.
[0017] The Android system construction method in the application can be used in a device using an Android system and configured with an initialization function, especially in a device developed on the basis of a native Android system. The electronic device in the application can be an electronic device with an Android system, such as a mobile phone, a POS terminal, a cash register terminal, a tablet terminal, and the like.
[0018] The Android system construction method in the application is specifically described below, and the accompanying drawings are referred to Figure 1 , including steps 110-130.
[0019] Step 110, establishing a custom directory when constructing an Android system code, the custom directory being a directory established outside a system default directory for saving initialization data.
[0020] In an embodiment of the application, establishing a custom directory when constructing an Android system code includes: configuring the permission of the custom directory as accessible to a vendor with corresponding permission. In this way, by setting the permission of the custom directory, it is ensured that only the vendor can add, delete or modify the content in the custom directory, so that the data in the custom partition has the security close to the system partition, and the initialization content is prevented from being changed at will.
[0021] In an embodiment of the application, configuring the permission of the custom directory as accessible to a vendor with corresponding permission includes: configuring the permission of the custom directory as accessible, and configuring the group of the custom directory as a group including the vendor with corresponding permission. In a Linux system, the permission and the group of a directory can be configured, the permission including three kinds of browsable, modifiable directory content and enterable, different users can be added to different groups, and the permission is configured directly according to the group, the group being a collection of users, and all users in the group having corresponding permission if the group has corresponding permission. In this way, the management mode of the directory permission is simplified, and it is not necessary to configure the permission for each vendor separately, but the vendors needing to access the custom directory can be added to a group, and the permission of the vendors is configured directly by configuring the permission of the group.
[0022] Step 120, compiling the protected application and configuration data into the custom directory, and modifying the saving location of the cache data of the application to the custom directory.
[0023] In an embodiment of the application, compiling the protected application and configuration data into the custom directory includes steps 121-122.
[0024] Step 121, establishing an application directory and a file directory in the custom directory.
[0025] Step 122, compile the application installation package of the application to be protected into the application directory, and compile the configuration data to be protected into the file directory.
[0026] In an optional embodiment, the configuration data includes the certificate and the activation code. In this way, the certificate and the activation code of the device are saved as the configuration data in the file directory, and after the factory reset, the device that needs to be configured in secret does not need to be reconfigured with the certificate and the activation code, and the user can perform the factory reset by himself without the assistance of the manufacturer to perform the initialization process after the factory reset.
[0027] In this way, the application directory and the file directory are respectively created in the partition directory, the application installation package of the application to be protected and the configuration data to be protected are saved separately, which facilitates searching, and the application installation package is compiled in an application directory, which is distinguished from the file directory where the configuration data is located, facilitating direct traversal of the application directory to complete installation of the application installation package and direct traversal of the file directory to complete configuration according to the configuration data during the booting process of the Android system, and reducing the amount of data to be judged during the application installation process.
[0028] In an embodiment of the present application, step b of establishing a data directory in the custom directory is further included. Modifying the storage location of the cache data of the application to the custom partition includes: modifying the storage location of the cache data of the application to the data directory. In this way, in addition to configuring the application installation package of the application in the custom partition, the storage location of the cache data of the application is also configured in the custom partition, so that during the process of performing the factory reset, not only the application is not uninstalled, but also the data generated by the application during use is not deleted, and the user does not need to re-cache the data, further improving the booting efficiency after the factory reset.
[0029] Step 130, compile the image file according to the custom directory, and configure the properties of the image file, so that after the device burns the image file, a custom partition corresponding to the custom directory is generated.
[0030] In an embodiment of the present application, configuring the properties of the image file includes: configuring the partition space corresponding to the image file, and allocating the partition size corresponding to the partition space. In this way, after the image file is created, the corresponding partition space and partition size are allocated, so that the device can normally burn the image file and obtain the custom directory therein for use in the booting process of the Android system.
[0031] The present application also provides an Android system booting method, comprising: Step 210, burn the image file to obtain the custom partition, and the image file is obtained according to the above-mentioned Android system building method.
[0032] Step 220, in the process of starting the Android system, the application package management service of the Android system is started to scan the custom partition, obtain the application in the custom partition, and install the application.
[0033] Step 230, in the process of starting the Android system, the custom partition is scanned, the configuration data in the custom partition is obtained, and the configuration data is executed.
[0034] In some embodiments, before the custom partition is scanned when the application package management service of the Android system is started, step c is included: configuring the access path of the application directory in the custom partition in the system application path list of the application package management service. Scanning the custom partition when the application package management service of the Android system is started includes: when the application package management service of the Android system is started, the system application path list is scanned, so that the application package management service loads and installs the application in the application directory.
[0035] In some embodiments, before the custom partition is scanned in the process of starting the Android system, the configuration data in the custom partition is obtained, and the configuration data is executed, step d is included: configuring the system configuration path of the configuration item to be modified in the process of starting the Android system. In the process of starting the Android system, the custom partition is scanned, the configuration data in the custom partition is obtained, and the configuration data is executed.
[0036] In this way, the access path of the application directory in the custom partition is directly configured in the system application path list of the application package management service, and the application package management service will automatically scan the access path of the application directory as a system application path at startup and install the application installation package therein, so that the application installation package in the application directory is installed as a system application in the startup process, and in the process of restoring the factory settings, because the application installation package is actually saved in the custom partition instead of the system partition, the application installation package will not be deleted in the process of restoring the factory settings, and can be read and installed again in the startup process. The manufacturer does not need to perform an additional initialization process after restoring the factory settings.
[0037] The application embodiments of the present application will be specifically introduced below. The present application can apply the above-mentioned scheme in the construction process of the Android system to avoid deleting the data to be protected in the process of restoring the factory settings, including: (1) Add a privdata1 directory, and configure the permission of the privdata1 directory as accessible by internal vendors. For example, the permission of the privdata1 directory can be configured as being able to modify the contents of the directory, and the corresponding group is a vendor set, so the vendors in the vendor set can modify the contents in the privdata1 directory. The privdata1 directory is equivalent to the custom directory in step 110 described above, which is different from the default system directory, and therefore will not be formatted in the process of restoring the factory settings. Further, the permission of the custom directory can be set to have the security of the system directory, so as to avoid tampering with the contents in the custom directory. In the process of building an Android system burning file, the permission can be directly set in the form of a group by using a corresponding tool. Users having the permission to access the privdata1 directory can be placed in a group, and the workload of configuring the permission is reduced by uniformly configuring the permission of the group.
[0038] (2) Create an application directory apps, a file directory files, and a data directory data in the privdata1 directory. Save the application installation package of the preset application to the data directory apps, and save the configuration data to the data directory data. The configuration data includes characteristic data such as a certificate and an activation code. The application cache path can be directly written in the application installation package as the data directory. This is equivalent to step 120 described above, in which the apps directory and the files directory are established in the established privdata1 directory. The application installation package is compiled to the apps directory, and the configuration data to be protected is compiled to the files directory. Different types of data are classified and saved to different subdirectories in the privdata1 directory, so that the corresponding data can be directly obtained from the subdirectories when needed in the booting process, the access to non-required data is reduced, and the booting speed of the device after the process of restoring the factory settings is further improved. The data directory data is further established in the privdata1 directory to store the application cache generated by the application. After the process of restoring the factory settings, the related data of the application does not need to be downloaded and cached again, and the user can normally use the application as before.
[0039] (3) Convert the privdata1 directory into an image file privdata1.img, and configure the partition space privdata corresponding to the image file and the partition size of the partition space. In this way, the image file can be burned into the device to generate the corresponding privdata1 directory in the device. This is equivalent to step 130 described above, in which the image file is compiled according to the custom directory and the attributes of the image file are configured.
[0040] The following specifically introduces another application embodiment of the present application. The present application can apply the above scheme in the starting process of an Android system to complete the automatic installation of applications in a custom directory in the starting process, and to complete the setting of related data in the custom directory again after the factory reset.
[0041] (4) Burning the image file privdata1.img to obtain the custom partition. This is equivalent to burning the image file in the device to obtain the custom partition in step 210 above, wherein the image file is obtained according to the above Android system construction method.
[0042] In an optional embodiment, the image file is obtained according to steps (1)-(3) above.
[0043] (5) Adding the path privdata1 / apps of the apps directory to the system partition path list in the PackageManagerService (application package management service). This is equivalent to configuring the access path of the application directory in the custom partition in the system application path list of the application package management service in step c above. The PackageManagerService will automatically scan the system application path list to install system applications in the system starting process. The system applications are the application programs that are self-contained after the device is shipped. The path privdata1 / apps is added to the path after that. The PackageManagerService service will automatically read the application installation package in the path privdata1 / apps to complete the application installation process in the starting process after the factory reset, thereby realizing the preservation of the protected applications in the privdata1 directory after the factory reset.
[0044] In some embodiments, the system partition path list includes the system partition paths system / app, system / privapp, vendor / app, etc. by default. The PackageManagerService will automatically scan the system partition paths to complete the installation of the application installation package in the system partition paths in the Android system starting process, thereby meeting the basic requirements of the Android system after starting, such as SMS, browser, keyboard, etc.
[0045] In the system, the system path corresponding to the configuration item in the files directory is modified to the path of the files directory. For example, if the customer customizes the boot animation in the files directory, the system configuration path corresponding to the configuration item boot animation is modified to privdata1 / files. Thus, when the boot animation is loaded, the system default boot animation is not acquired, the customer customized boot animation can be loaded, and after the configuration of the factory reset is performed, the privdata1 directory is not formatted, so the requirement of playing the user customized boot animation can be met, and the user customized boot animation does not need to be reimported. The configuration item can also include a customized apk (application installation package) and a boot logo, and the configuration manner is the same.
[0046] (6) After the PackageManagerService is started, the system partition path list is scanned, and the application installation package in the list is loaded. Thus, after the path privdata1 / apps of the apps directory is configured in advance, the application installation package in the apps directory can be loaded and installed, and the installation process of the preset application is completed. In the Android system startup process, when the PackageManagerService scans the system partition path, the privdata1 / apps is scanned and the application installation package therein is installed, and the installation of the application in the custom partition is completed.
[0047] After the Android system is started, the system configuration path corresponding to each configuration item is read, and the configuration content therein is loaded to configure the Android system. For example, the system configuration path corresponding to the configuration item boot logo is privdata / files, and after the Android system is started, the boot logo configured in privdata / files is automatically read and displayed.
[0048] (7) After the device receives the instruction of the factory reset, the device performs the configuration of the factory reset, and formats the system, data, vendor, system, ext and other system partitions. Since the custom partition privdata1 is not in the range of the system partition, when the system performs the factory reset, the privdata1 partition does not lose the data after the data is deleted. After the instruction of the factory reset is executed, in the restart process, the application installation package and the configuration data in the privdata partition are re-read according to the above steps (4)-(6) to complete the initialization, and the initialization data does not need to be issued by the manufacturer, so that the efficiency of the startup after the factory reset is improved.
[0049] Please refer to Figure 3The application further provides an electronic device 300, comprising a memory 302, a processor 301, and a computer program stored in the memory 302 and running on the processor 301, wherein the processor 301 implements each step of the Android system construction method as described above when executing the computer program.
[0050] The electronic device of the application has the advantages of the method as described above, which will not be repeated here.
[0051] The above is only an embodiment of the application, and does not limit the patent scope of the application, and any equivalent transformation or direct or indirect application in the related technical field by using the content of the specification and drawings of the application is also included in the patent protection scope of the application.
Claims
1. An Android system construction method, applied to electronic devices, characterized in that, The method includes: When building Android system code, a custom directory is created. This custom directory is a directory created outside the system default directory to store initialization data. The application and configuration data to be protected are compiled into the custom directory, and the storage location of the application's cache data is modified to the custom directory; Compile the image file according to the custom directory and configure the attributes of the image file so that after the device burns the image file, a custom partition corresponding to the custom directory is generated.
2. The Android system construction method according to claim 1, characterized in that, The creation of a custom directory when building Android system code includes: Configure the permissions of the custom directory so that only vendors with the corresponding permissions can access it.
3. The Android system construction method according to claim 1, characterized in that, The step of compiling the application and configuration data to be protected into the custom directory includes: Create an application directory and a file directory in the custom directory; The application installation package of the application to be protected is compiled into the application directory, and the configuration data to be protected is compiled into the file directory.
4. The Android system construction method according to claim 1, characterized in that, Also includes: Create a data directory in the custom directory; Modifying the storage location of the application's cache data to the custom partition includes: Modify the storage location of the application's cached data to the data directory.
5. The Android system construction method according to claim 2, characterized in that, The configuration of permissions for the custom directory, allowing access only to vendors with the corresponding permissions, includes: Configure the permissions of the custom directory to be accessible, and configure the group of the custom directory to include the groups of manufacturers with corresponding permissions.
6. The Android system construction method according to claim 1, characterized in that, The attributes configured for the image file include: Configure the partition space corresponding to the image file, and allocate the partition size corresponding to the partition space.
7. The Android system construction method according to claim 1, characterized in that, The configuration data includes the certificate and activation code.
8. An Android system startup method, characterized in that, include: A custom partition is obtained by burning the image file, wherein the image file is obtained by any one of the Android system building methods according to claims 1-7; During the Android system startup process, when the Android system's application package management service is enabled, the custom partition is scanned to obtain the applications in the custom partition and the applications are installed. During the Android system startup process, the custom partition is scanned to obtain the configuration data in the custom partition and the configuration data is executed.
9. The Android system startup method according to claim 8, characterized in that, Before scanning the custom partition when enabling the Android system's application package management service, the following steps are included: Configure the access path of the application directory in the custom partition in the system application path list of the application package management service; The scanning of custom partitions when enabling the Android system's application package management service includes: When the Android system's application package management service is enabled, the system application path list is scanned so that the application package management service can load and install applications in the application directory.
10. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor executes the computer program to implement the various steps of the Android system construction method according to any one of claims 1-7.
Citation Information
Patent Citations
Mobile terminal and data saving method based on Android system
CN103246617A
Method for separating Android mirror image burning process
CN104731602A
Storage restore system, storage restore method, and storage medium
US20220382653A1