Android device factory application deployment method and apparatus based on private data partitioning

By dividing the installation source sub-region within the private data partition of the Android device, and storing and managing the installation packages temporarily and permanently retained by the production line respectively, the problems of storage space management and extended boot time are solved, and efficient application package deployment and startup performance optimization are achieved.

CN123137673APending Publication Date: 2026-11-20GUANGDONG TELEPOWER TELECOM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610647585.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

During the production line burning and factory configuration of Android devices, existing technologies cannot simultaneously meet the two requirements of "one-time package delivery requires the reclamation of storage space" and "pre-installed packages need to be retained for long-term reinstallation or traceability". Furthermore, repeated scanning of installation requests increases the load on the package manager and prolongs the boot time.

Method used

Within the private data partition of the Android device, a first installation source sub-region and a second installation source sub-region are divided to store installation packages temporarily issued by the production line and those that need to be retained long-term, respectively. When the system service is triggered, these packages are scanned, cleaned up, and then merged into an installation task set for silent installation. After installation, files are either deleted or retained according to the policy.

Benefits of technology

It enables application package deployment within a controlled storage area that isolates device and user data, balancing storage reclamation and pre-installation retention, and reducing the impact of repeated installations on startup performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137673A_ABST
    Figure CN123137673A_ABST
Patent Text Reader

Abstract

The application provides an Android device factory application deployment method and device based on private data partition. In the private data partition isolated from the device and user data, a first and a second installation source sub-area are divided to store the line temporary package and the preset package to be reserved for a long time respectively. When the system service is triggered, the installation package files in the two sub-areas are scanned to obtain file sets and the processing strategies of deleting or retaining after installation are bound respectively; the installation package files are installed in turn; and after the installation is completed, the file deletion or retention is completed according to the bound strategy. The application enables the application package deployment in the controlled storage area isolated from the conventional user data in the factory or line scene; through dividing the first and second installation source sub-areas and binding the deletion or retention strategies after installation respectively, the storage recovery and preset retention are considered; and through the persistent flag, only one round of full installation evaluation and execution is controlled in the starting process, so that the influence of repeated installation on the starting performance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile terminal software deployment technology, and in particular to a method and apparatus for deploying Android devices' factory applications based on private data partitions. Background Technology

[0002] During the production line flashing, factory configuration, or channel pre-installation of Android devices, it is often necessary to automatically and silently install application packages during the device's first boot or a specific boot phase. If the packages to be installed are placed in the same path as regular user data, they are easily deleted accidentally, mixed with user files, and this is detrimental to production line permissions and image management. If a single directory is used to store all installation packages, it is often difficult to simultaneously meet the requirements of "reclaiming storage space after a one-time package distribution" and "retaining pre-installed packages long-term for reinstallation or traceability." Furthermore, repeatedly scanning the entire directory and submitting installation requests every time the service starts will increase the load on the package manager and prolong boot time. Summary of the Invention

[0003] In view of the above problems, the present invention is proposed to provide an Android device factory application deployment method and a corresponding Android device factory application deployment apparatus based on a private data partition, which overcomes or at least partially solves the above problems.

[0004] This invention discloses a method for deploying Android devices at the factory based on a private data partition. The method is applied to Android devices with a private data partition for factory configuration, wherein the private data partition is distinct from the regular user-writable partition of the Android device. The method includes: Within the private data partition, a first installation source sub-area and a second installation source sub-area are divided. The paths of the first installation source sub-area and the second installation source sub-area are different. The first installation source sub-area is used to store installation packages temporarily issued by the production line, while the second installation source sub-area is used to store pre-installed installation packages that need to be retained for a long time. When the system service is triggered to execute, the system scans the installation package files in the first installation source sub-area that match the preset file extension to obtain a first file set, and scans the installation package files in the second installation source sub-area that match the preset file extension to obtain a second file set. A first cleanup policy identifier is bound to each installation package file in the first file set, the first cleanup policy identifier indicating that the corresponding installation package file will be deleted after a successful silent installation; a second cleanup policy identifier is bound to each installation package file in the second file set, the second cleanup policy identifier indicating that the corresponding installation package file will be retained after a successful silent installation; Merge the first file set and the second file set into a set of tasks to be installed; Silent installation is performed sequentially on each installation package file in the set of tasks to be installed; For installation package files that have been successfully installed silently, delete or retain the installation package files according to the cleanup policy flag bound to the installation package files.

[0005] Optionally, before performing the scan, the following may also be included: Read the persistent flag used to mark whether the current device startup process has completed the factory installation cycle; When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention are executed, and the persistent flag is updated to the executed state. When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, skip the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention.

[0006] Optionally, silent installation is performed sequentially on each installation package file in the set of tasks to be installed, including: Create an installation session using the package installation session interface; Write the installation package file data to the output stream corresponding to the installation session as a data stream and submit the installation session; The success of the installation is determined based on the session submission results.

[0007] Optionally, before the step of creating an installation session via the package installation session interface, the following may also be included: Parse the package name and version information of the installation package file to be installed; If the package name belongs to the preset package name set, the date is extracted from the version name and compared with the date in the version name of the installed application with the same package name. If the date of the package file to be installed is later than the date of the installed version, an installation session is created. If the package name does not belong to the preset package name set, the version numbers are compared. If the version number of the package file to be installed is greater than the version number of the installed version, an installation session is created.

[0008] Optionally, the root path of the private data partition is obtained by resolving the system read-only attribute; the path of the first installation source sub-region is obtained by concatenating the root path and the first relative sub-path; and the path of the second installation source sub-region is obtained by concatenating the root path and the second relative sub-path.

[0009] This invention also discloses an Android device factory application deployment apparatus based on a private data partition, applicable to Android devices having a private data partition for factory configuration, wherein the private data partition is distinct from the regular user-writable partition of the Android device; the apparatus includes: The installation source sub-area configuration module is used to divide the private data partition into a first installation source sub-area and a second installation source sub-area. The first installation source sub-area and the second installation source sub-area have different paths. The first installation source sub-area is used to store installation packages temporarily issued by the production line, and the second installation source sub-area is used to store pre-installed installation packages that need to be retained for a long time. The scanning module is used to scan the first installation source sub-area for installation package files with a preset extension to obtain a first file set when the system service is triggered to execute, and to scan the second installation source sub-area for installation package files with the preset extension to obtain a second file set. The strategy binding module is used to bind a first cleanup strategy identifier to each installation package file in the first file set, the first cleanup strategy identifier indicating that the corresponding installation package file will be deleted after a successful silent installation; and to bind a second cleanup strategy identifier to each installation package file in the second file set, the second cleanup strategy identifier indicating that the corresponding installation package file will be retained after a successful silent installation. The installation execution module is used to merge the first file set and the second file set into a set of tasks to be installed, and to perform silent installation on each installation package file in the set of tasks to be installed in sequence. The cleanup module is used to delete or retain installation package files that have been silently installed, based on the cleanup policy flag bound to the installation package file.

[0010] This invention has the following advantages: This invention divides a private data partition, isolated from device and user data, into a first installation source sub-region and a second installation source sub-region. These sub-regions store temporary production line packages and pre-installed packages requiring long-term retention, respectively. When a system service is triggered, the installation package files in both sub-regions are scanned to obtain file sets, and post-installation deletion or retention policies are bound to each set. These are then merged into a task set and silently installed sequentially. After installation, file deletion or retention is performed according to the bound policies. This invention enables application package deployment in a controlled storage area isolated from regular user data in factory or production line scenarios. By dividing the first and second installation source sub-regions and binding post-installation deletion or retention policies to each, it balances storage reclamation and pre-installation retention. Furthermore, persistent flags can control the execution of only one full installation evaluation and execution round during the current startup process, reducing the impact of repeated installations on startup performance. Attached Figure Description

[0011] Figure 1 This is a flowchart of the Android device application deployment method based on private data partitioning provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the private data partition directory structure provided in an embodiment of the present invention; Figure 3This is a structural block diagram of an Android device application deployment device based on a private data partition, provided in an embodiment of the present invention. Detailed Implementation

[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0013] Reference Figure 1 The flowchart illustrates the Android device application deployment method based on private data partitioning according to the present invention. The specific process is as follows: 1. Private data partitioning and dual-sub-region division In this invention, the device is equipped with a private data area or equivalent controlled storage area for factory or production line configuration. The private data partition is represented as a directory tree on the file system, distinct from regular user-writable partitions; an example logical path is " / privdata". Within this area, a first installation source sub-region is set up, for example, " / privdata / apk", to store installation packages temporarily distributed by the production line; a second installation source sub-region is set up, for example, " / privdata / preinstall", to store pre-installed packages that need to be retained long-term. The first and second installation source sub-regions have different paths and are semantically distinct; both sub-regions are located under the same private data partition namespace, facilitating image creation and unified management of permission policies.

[0014] 2. Service Triggering and Directory Traversal When the onStartCommand or equivalent lifecycle callback of an Android system service (such as a factory service inherited from android.app.Service) is invoked, a recursive directory traversal is performed on the first and second installation source sub-regions, filtering for files with the ".apk" extension to form the first file set and the second file set, respectively. If both sets are empty, a log can be logged and the current process can be terminated.

[0015] 3. Silent Installation and Session Submission For each file to be installed, a PackageInstaller instance is obtained via Context.getPackageManager().getPackageInstaller(), PackageInstaller.SessionParams is constructed, and createSession is called to create a session. The output stream is obtained using openWrite and copied from the local file in a block buffer manner, allowing for synchronous updates to the session progress. Commit is called, and the status code in the installation result Intent is awaited using IntentSender and a synchronization queue to determine success or failure. Session parameters can include flags such as replacing installed applications, allowing downgrades, and allowing test signatures to adapt to the factory environment. If installation fails, the session can be abandoned and logged.

[0016] 4. Post-installation cleanup and status coordination For files originating from the first installation source sub-region, the corresponding APK file is deleted after successful installation; for files originating from the second installation source sub-region, they are not deleted after successful installation. A status flag file, such as " / privdata / finish", can be maintained in the private data partition. After the set of tasks to be installed is processed, based on the persistent attributes related to the system's factory configuration (such as Settings or factory configuration items in system properties) and whether the status flag file already exists in the private data partition, it is decided to write to the status flag file or launch a pre-defined configuration interface (such as a pre-defined Activity) to complete the coordination with the boot wizard or automated test entry.

[0017] 5. Activate the gate control In an optional embodiment, a system property is used as a persistent flag, such as the key name "telpo.sys.finishinstall", where a value of "0" indicates that the factory installation round has not yet been executed in the current boot process, and "1" indicates that it has been executed. The background worker thread is started to process the queue sequentially only when the set of tasks to be installed is not empty and the flag is "0", and the flag is set to "1" after processing begins, thereby avoiding duplicate full installations on the same boot.

[0018] 6. Application-specific version control In one optional embodiment, before creating an installation session, the package name and version information of the uninstalled APK are parsed using PackageManager.getPackageArchiveInfo. If the package name is a predefined value (e.g., a package name related to automated testing), the date is parsed from versionName in a predefined format (e.g., "yyyy.MM.dd" and optional suffixes) and compared with the versionName date of an application with the same package name that is already installed. Session creation continues only if the new date is later than the already installed date. For other package names, versionCode is compared, and installation continues only if the version number to be installed is greater than the already installed version number; otherwise, installation is skipped.

[0019] 7. Root path is configurable Figure 2 This is a diagram of the private data partition directory structure. (For reference) Figure 2 In an optional embodiment, a read-only system attribute such as "ro.sys.overlay.privdata.path" is defined to represent the root path of the private data partition. The paths of the first installation source sub-region, the second installation source sub-region, and the status marker file are represented as the concatenation of this root path and the relative directory name, so that the same logic can be deployed to different mount points on different products, adapting to different product partition tables or vendor-customized mount points.

[0020] It should be noted that the path names, attribute key names, stability, and version formats mentioned above are merely examples; in actual products, they can be replaced with equivalent naming and rules. Any application deployment on Android devices that employs a combination of "dual-sub-region scanning within a private data partition, differentiated post-installation cleanup, optional startup gating, and silent installation via package installation session" should be considered an equivalent implementation of this invention.

[0021] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0022] Reference Figure 3 This diagram illustrates a structural block diagram of an Android device factory application deployment apparatus based on a private data partition, provided in an embodiment of the present invention. This apparatus is applied to an Android device having a private data partition for factory configuration, wherein the private data partition is distinct from the regular user-writable partition of the Android device; specifically, it may include: The installation source sub-area configuration module is used to divide the private data partition into a first installation source sub-area and a second installation source sub-area. The first installation source sub-area and the second installation source sub-area have different paths. The first installation source sub-area is used to store installation packages temporarily issued by the production line, and the second installation source sub-area is used to store pre-installed installation packages that need to be retained for a long time. The scanning module is used to scan the first installation source sub-area for installation package files with a preset extension to obtain a first file set when the system service is triggered to execute, and to scan the second installation source sub-area for installation package files with the preset extension to obtain a second file set. The strategy binding module is used to bind a first cleanup strategy identifier to each installation package file in the first file set, the first cleanup strategy identifier indicating that the corresponding installation package file will be deleted after a successful silent installation; and to bind a second cleanup strategy identifier to each installation package file in the second file set, the second cleanup strategy identifier indicating that the corresponding installation package file will be retained after a successful silent installation. The installation execution module is used to merge the first file set and the second file set into a set of tasks to be installed, and to perform silent installation on each installation package file in the set of tasks to be installed in sequence. The cleanup module is used to delete or retain installation package files that have been silently installed, based on the cleanup policy flag bound to the installation package file.

[0023] In an optional embodiment of the present invention, the device further includes a start-up gating module, which is used to: Read the persistent flag used to mark whether the current device startup process has completed the factory installation cycle; When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention are executed, and the persistent flag is updated to the executed state. When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, skip the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention.

[0024] In an optional embodiment of the present invention, the installation execution module is further configured to: Create an installation session using the package installation session interface; Write the installation package file data to the output stream corresponding to the installation session as a data stream and submit the installation session; The success of the installation is determined based on the session submission results.

[0025] In an optional embodiment of the present invention, the installation execution module is further configured to: Parse the package name and version information of the installation package file to be installed; If the package name belongs to the preset package name set, the date is extracted from the version name and compared with the date in the version name of the installed application with the same package name. If the date of the package file to be installed is later than the date of the installed version, an installation session is created. If the package name does not belong to the preset package name set, the version numbers are compared. If the version number of the package file to be installed is greater than the version number of the installed version, an installation session is created.

[0026] In an optional embodiment of the present invention, the root path of the private data partition is obtained by resolving the system read-only attribute; the path of the first installation source sub-region is obtained by concatenating the root path and the first relative sub-path; and the path of the second installation source sub-region is obtained by concatenating the root path and the second relative sub-path.

[0027] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0028] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 said element.

[0029] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0030] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A method for deploying Android device applications at the factory based on private data partitions, characterized in that, Applied to Android devices having a private data partition for factory configuration, the private data partition being distinct from the regular user-writable partition of the Android device; the method includes: Within the private data partition, a first installation source sub-area and a second installation source sub-area are divided. The paths of the first installation source sub-area and the second installation source sub-area are different. The first installation source sub-area is used to store installation packages temporarily issued by the production line, while the second installation source sub-area is used to store pre-installed installation packages that need to be retained for a long time. When the system service is triggered to execute, the system scans the installation package files in the first installation source sub-area that match the preset file extension to obtain a first file set, and scans the installation package files in the second installation source sub-area that match the preset file extension to obtain a second file set. A first cleanup policy identifier is bound to each installation package file in the first file set, the first cleanup policy identifier indicating that the corresponding installation package file will be deleted after a successful silent installation; a second cleanup policy identifier is bound to each installation package file in the second file set, the second cleanup policy identifier indicating that the corresponding installation package file will be retained after a successful silent installation; Merge the first file set and the second file set into a set of tasks to be installed; Silent installation is performed sequentially on each installation package file in the set of tasks to be installed; For installation package files that have been successfully installed silently, delete or retain the installation package files according to the cleanup policy flag bound to the installation package files.

2. The method according to claim 1, characterized in that, Before performing the scan, the following is also included: Read the persistent flag used to mark whether the current device startup process has completed the factory installation cycle; When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention are executed, and the persistent flag is updated to the executed state. When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, skip the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention.

3. The method according to claim 1, characterized in that, Silent installation is performed sequentially on each installation package file in the set of tasks to be installed, including: Create an installation session using the package installation session interface; Write the installation package file data to the output stream corresponding to the installation session as a data stream and submit the installation session; The success of the installation is determined based on the session submission results.

4. The method according to claim 3, characterized in that, Before the steps of creating an installation session via the package installation session interface, the following are also included: Parse the package name and version information of the installation package file to be installed; If the package name belongs to the preset package name set, the date is extracted from the version name and compared with the date in the version name of the installed application with the same package name. If the date of the package file to be installed is later than the date of the installed version, an installation session is created. If the package name does not belong to the preset package name set, the version numbers are compared. If the version number of the package file to be installed is greater than the version number of the installed version, an installation session is created.

5. The method according to claim 1, characterized in that, The root path of the private data partition is obtained by resolving the system's read-only attribute; the path of the first installation source sub-region is obtained by concatenating the root path with the first relative sub-path; the path of the second installation source sub-region is obtained by concatenating the root path with the second relative sub-path.

6. An Android device application deployment device based on a private data partition, characterized in that, An apparatus for use with an Android device having a private data partition for factory configuration, the private data partition being distinct from the regular user-writable partition of the Android device; the apparatus includes: The installation source sub-area configuration module is used to divide the private data partition into a first installation source sub-area and a second installation source sub-area. The first installation source sub-area and the second installation source sub-area have different paths. The first installation source sub-area is used to store installation packages temporarily issued by the production line, and the second installation source sub-area is used to store pre-installed installation packages that need to be retained for a long time. The scanning module is used to scan the first installation source sub-area for installation package files with a preset extension to obtain a first file set when the system service is triggered to execute, and to scan the second installation source sub-area for installation package files with the preset extension to obtain a second file set. The strategy binding module is used to bind a first cleanup strategy identifier to each installation package file in the first file set, the first cleanup strategy identifier indicating that the corresponding installation package file will be deleted after a successful silent installation; and to bind a second cleanup strategy identifier to each installation package file in the second file set, the second cleanup strategy identifier indicating that the corresponding installation package file will be retained after a successful silent installation. The installation execution module is used to merge the first file set and the second file set into a set of tasks to be installed, and to perform silent installation on each installation package file in the set of tasks to be installed in sequence. The cleanup module is used to delete or retain installation package files that have been silently installed, based on the cleanup policy flag bound to the installation package file.

7. The apparatus according to claim 6, characterized in that, The device further includes a start-up gating module, which is used for: Read the persistent flag used to mark whether the current device startup process has completed the factory installation cycle; When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention are executed, and the persistent flag is updated to the executed state. When the persistent flag indicates that the current device startup process has not yet executed the factory installation round, skip the steps of scanning, policy binding, merging, silent installation, and installation package deletion or retention.

8. The apparatus according to claim 6, characterized in that, The installation and execution module is also used for: Create an installation session using the package installation session interface; Write the installation package file data to the output stream corresponding to the installation session as a data stream and submit the installation session; The success of the installation is determined based on the session submission results.

9. The apparatus according to claim 8, characterized in that, The installation and execution module is also used for: Parse the package name and version information of the installation package file to be installed; If the package name belongs to the preset package name set, the date is extracted from the version name and compared with the date in the version name of the installed application with the same package name. If the date of the package file to be installed is later than the date of the installed version, an installation session is created. If the package name does not belong to the preset package name set, the version numbers are compared. If the version number of the package file to be installed is greater than the version number of the installed version, an installation session is created.

10. The apparatus according to claim 6, characterized in that, The root path of the private data partition is obtained by resolving the system's read-only attribute; the path of the first installation source sub-region is obtained by concatenating the root path with the first relative sub-path; the path of the second installation source sub-region is obtained by concatenating the root path with the second relative sub-path.