Software development kit integration method, device and equipment based on swan application, medium and product
By parsing the software development package of HarmonyOS applications and processing it with a sandbox framework, the problem of low SDK integration efficiency in enterprise office applications is solved, and transparent and efficient integration of security protection SDKs is achieved.
Patent Information
- Application Number
- CN202511691825.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-24
AI Technical Summary
In enterprise office applications developed using the HarmonyOS system, enterprises cannot obtain the source code for secondary development, resulting in low SDK integration efficiency and the risk of information leakage.
By parsing the software development package of HarmonyOS applications, an initial sandbox framework is generated, and the security protection SDK is copied. The configuration module files are updated, the sandbox engine is compiled and decompressed, the resource index and bytecode are merged, and after functional testing, the integrated application is delivered.
It achieves transparent integration of the security protection SDK into HarmonyOS applications, improves integration efficiency, decouples business requirements and security protection requirements, enables independent development, and avoids secondary development.
Smart Images

Figure CN121560342A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of application software development technology, and in particular to a method, apparatus, device, medium and product for integrating a software development toolkit based on HarmonyOS applications. Background Technology
[0002] With the development of the information age, more and more companies are paying attention to the data privacy of employees when using enterprise office software. For example, the leakage of product price lists, raw material procurement prices and technical solutions by taking photos or screenshots can bring obvious economic or reputational losses to enterprises.
[0003] Therefore, in order to solve the information leakage problem during the use of the above-mentioned enterprise office applications, enterprises began to consider integrating the HarmonyOS Sandbox SDK (Software Development Kit), which is developed based on the HarmonyOS system and is used for security protection during application operation, into enterprise office applications that are also developed based on the HarmonyOS system.
[0004] However, during SDK integration, enterprises often lack access to the source code of their office applications and the capability for secondary development. Furthermore, with hundreds of daily office applications, integrating SDKs one by one results in extremely low integration efficiency. Therefore, there is an urgent need to propose an SDK integration method based on HarmonyOS applications. This method would integrate a security protection SDK into existing HarmonyOS application development kits, thereby enabling security control over applications and improving SDK integration efficiency. Summary of the Invention
[0005] This invention provides a method, apparatus, device, medium, and product for integrating software development kits based on HarmonyOS applications, so as to realize the integration of security protection SDKs into HarmonyOS applications developed based on the HarmonyOS system, thereby achieving security control over HarmonyOS applications and improving SDK integration efficiency.
[0006] According to one aspect of the present invention, a method for integrating a software development kit (SDK) based on HarmonyOS applications is provided, the method comprising:
[0007] In response to an integration request for a pre-developed security protection software development kit (SDK), the software development kit of the application to be integrated, developed based on the HarmonyOS system framework, is obtained, and the software development kit is parsed to obtain configuration module files, executable code files, and resource index files.
[0008] An initial sandbox framework is generated, and the security protection SDK is copied to the corresponding directory of the initial sandbox framework. In addition, the configuration module file corresponding to the initial sandbox framework is updated according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework.
[0009] The target sandbox framework is compiled, and after compilation, the HarmonyOS application HAP package is obtained from the corresponding directory of the target sandbox framework to obtain the sandbox engine;
[0010] The sandbox engine is decompressed to obtain the sandbox resource index, sandbox bytecode, and So library directory;
[0011] Based on the sandbox resource index, sandbox bytecode, and So library directory of the sandbox engine, update the software development source package of the application to be integrated to obtain the target merged development package;
[0012] Based on the target merged development package, the application to be integrated is tested for application functionality. After the test is passed, the tested target integrated application is delivered to the party that initiated the integration request.
[0013] According to another aspect of the present invention, a software development kit integration device based on HarmonyOS is provided, the device comprising:
[0014] The integration request and response module is used to respond to integration requests for pre-developed security protection software development kits (SDKs), obtain the software development kit of the application to be integrated based on the HarmonyOS system framework, and perform package parsing on the software development kit to obtain configuration module files, executable code files, and resource index files.
[0015] An initial framework generation module is used to generate an initial sandbox framework, copy the security protection SDK to the corresponding directory of the initial sandbox framework, and update the configuration module file corresponding to the initial sandbox framework according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework.
[0016] The compilation module is used to compile the target sandbox framework and, after compilation, obtain the HarmonyOS application HAP package from the corresponding directory of the target sandbox framework to obtain the sandbox engine.
[0017] The decompression module is used to decompress the sandbox engine and obtain the sandbox resource index, sandbox bytecode, and So library directory;
[0018] The resource merging module is used to update the software development kit of the application to be integrated based on the sandbox resource index, sandbox bytecode and So library directory of the sandbox engine, so as to obtain the target merged development kit;
[0019] The functional testing module is used to perform application functional testing on the application to be integrated based on the target merged development package, and deliver the tested target integrated application to the initiator of the integration request after the test is passed.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the software development kit integration method based on HarmonyOS as described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the software development kit integration method based on HarmonyOS application as described in any embodiment of the present invention.
[0025] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the software development kit integration method based on HarmonyOS application as described in any embodiment of the present invention.
[0026] The technical solution of this invention involves parsing the original software development package to obtain configuration module files, executable code files, and resource index files, generating an initial sandbox framework, copying the security protection SDK to the corresponding directory of the initial sandbox framework, and updating the configuration module files corresponding to the initial sandbox framework according to the configuration module files of the application to be integrated, thus obtaining the target sandbox framework. The target sandbox framework is then compiled, and after compilation, the HarmonyOS application HAP package is obtained from the corresponding directory of the target sandbox framework to obtain the sandbox engine. The sandbox engine is decompressed to obtain the sandbox resource index, sandbox bytecode, and SO library directory. Based on the sandbox engine's sandbox resource index, sandbox bytecode, and SO library directory, the original software development package of the application to be integrated is updated to obtain the target merged development package. Based on the target merged development package, application function testing is performed on the application to be integrated, and after passing the test, the tested target integrated application is delivered to the initiator of the integration request. The above technical solution enables the integration of security protection SDKs into HarmonyOS applications developed based on the HarmonyOS system, as well as the security management and control of HarmonyOS applications, improving SDK integration efficiency. Furthermore, it decouples the business requirements and security protection requirements of applications during the integration of security protection SDKs into HarmonyOS applications, allowing for independent development of the two application SDKs. Security functions do not require secondary development and integration on the original HarmonyOS applications, achieving transparent deployment.
[0027] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a software development kit integration method based on HarmonyOS applications according to Embodiment 1 of the present invention;
[0030] Figure 2 This is a flowchart of a software development kit integration method based on HarmonyOS applications according to Embodiment 2 of the present invention;
[0031] Figure 3 This is a schematic diagram of the structure of a software development kit integration device based on HarmonyOS applications according to Embodiment 3 of the present invention;
[0032] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the software development kit integration method based on HarmonyOS applications according to embodiments of the present invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] Example 1
[0036] Figure 1 This is a flowchart illustrating a method for integrating a software development kit (SDK) based on HarmonyOS applications, as provided in Embodiment 1 of the present invention. This embodiment is applicable to the integration of a security protection SSD into HarmonyOS applications developed based on the HarmonyOS system. This method can be executed by a HarmonyOS application-based SSD integration device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0037] S110. In response to the integration request for the pre-developed security protection software development kit (SDK), obtain the software development kit of the application to be integrated based on the HarmonyOS system framework, and perform package parsing on the software development kit to obtain configuration module files, executable code files, and resource index files.
[0038] S120. Generate the initial sandbox framework, copy the security protection SDK to the corresponding directory of the initial sandbox framework, and update the configuration module file corresponding to the initial sandbox framework according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework.
[0039] S130. Compile the target sandbox framework, and after compilation, obtain the HarmonyOS application HAP package from the corresponding directory of the target sandbox framework to obtain the sandbox engine.
[0040] S140. Decompress the sandbox engine to obtain the sandbox resource index, sandbox bytecode, and So library directory.
[0041] S150, based on the sandbox engine, the sandbox resource index, sandbox bytecode, and So library directory, updates the software development source package of the application to be integrated, and obtains the target merged development package.
[0042] S160. Based on the target merged development package, perform application function testing on the application to be integrated, and after the test is passed, deliver the tested target integrated application to the party that initiated the integration request.
[0043] Among those requesting integration of the security protection SDK are enterprises or companies with security protection needs for HarmonyOS applications. For example, a company might have developed its own enterprise office application based on the HarmonyOS system framework. However, this application has a data leakage security risk during use, and since data security was not considered during the application's development, it lacks security protection functionality. To prevent data leakage during subsequent use, the company might request the integration of a developed security protection SDK into the application, thereby preventing data leakage and avoiding unnecessary security risks.
[0044] Among them, the security protection software SDK is a software development kit developed based on the open-source HarmonyOS system framework, which can protect applications. It can restrict functions such as forwarding, copying, screenshotting, and taking pictures during the use of applications with security protection needs, thereby playing a role in protecting applications.
[0045] Specifically, when receiving an integration request for the security protection SDK from a company or enterprise, the system retrieves the software development kit (SDK) of the application to be integrated, which is developed based on the HarmonyOS system framework. The application to be integrated is the HarmonyOS application that already has the security protection SDK integrated. The SSDK of the application to be integrated is a HarmonyOS application installation package in its original, un-sandboxed state after development. Its core format is the HarmonyOS Application Package (HAP) standard package format, which is the basic processing object for security protection SDK integration and contains the application's complete business logic, resource files, and configuration information.
[0046] The obtained HAP-formatted software development package is decompressed to obtain the configuration module file (module.json), executable code file (modules.abc), and resource index file (resources.index). An initial sandbox framework is then generated. This initial sandbox framework is a source code framework for the HarmonyOS application project without any actual functionality; it serves as the carrier for the security protection SDK.
[0047] Specifically, you can create a new HarmonyOS application project, delete the business logic code, and keep only the project skeleton as the initial sandbox framework. Confirm the basic structure of the initial sandbox framework, including resource directories, code directories, and configuration files. Copy the security protection SDK to the corresponding directory of the initial sandbox framework, and update the corresponding configuration module file of the initial sandbox framework according to the configuration module file of the application to be integrated, thus obtaining the target sandbox framework.
[0048] In an optional embodiment, the security protection SDK is copied to the corresponding directory of the initial sandbox framework, and the configuration module file corresponding to the initial sandbox framework is updated according to the configuration module file of the application to be integrated, to obtain the target sandbox framework, including:
[0049] Step a1: Determine the basic framework structure of the initial sandbox framework; the basic framework structure should include at least a resource directory, a code directory, and configuration files.
[0050] Step a2: Copy the security SDK to the libs directory of the initial sandbox framework and configure the security SDK dependency in the Gradle build script used to build and manage the application.
[0051] Step a3: Obtain the resource list under the resource directory corresponding to the security protection SDK; the resource list includes the resource type and resource name of at least one resource.
[0052] Step a4: Based on the preset starting value of the custom identifier, generate the corresponding resource identifier for each resource in the resource list, and generate the identifier definition file of the security protection SDK based on the resource identifier, resource type and resource name of each resource, and copy the identifier definition file of the security protection SDK to the corresponding directory of the initial sandbox framework.
[0053] Step a5: Synchronize the key configuration items in the configuration module file of the application to be integrated to the configuration module file of the initial sandbox framework to obtain the target sandbox framework; the key configuration items include the application identifier and the application type.
[0054] The initial sandbox framework's basic structure includes a resources directory, a code directory, and configuration files. The code directory under the initial sandbox framework is empty, and the configuration files have the initial default values.
[0055] Specifically, copy the security SDK to the libs directory of the initial sandbox framework, and configure the security SDK dependency in the Gradle build script (build.gradle) used to build and manage the application, ensuring that the security SDK can be referenced by the framework. Scan the security SDK's resource directory according to the pre-compiled scanning script, extract all resources in the resource directory, including strings, images, and colors, and generate a resource list. The resource list includes at least one resource's resource type and resource name. For example, if the resource type is color, the resource name would be black.
[0056] It's important to note that in the executable code files of the source code package of the application to be integrated, resource references are implemented using resource IDs (Identification). For example, the text on a button in the application to be integrated is represented by the ID of this file string in the executable code. When the application runs, it retrieves this text from the resource index file and then selects which language text to load based on the device's multilingual configuration. Resource IDs for HarmonyOS applications developed based on the HarmonyOS system framework default to integer variables starting with 0x01000000 (decimal 16777216) and incrementing sequentially. When two HAP packages are merged, resource ID conflicts will inevitably occur. Since the subsequently obtained sandbox engine is also an HAP package, its resource IDs also start from the same number. Forcibly merging resource files will cause resource IDs to be overwritten, leading to resource reference errors between the resource IDs and the executable files of the application to be integrated.
[0057] Therefore, to address the aforementioned issues, HarmonyOS provides a mechanism for custom resource IDs, which can be used to circumvent the resource merging errors. Specifically, based on a preset starting value for the custom identifier, a corresponding resource identifier is generated for each resource in the resource list. The starting value for the custom identifier can be preset by relevant technical personnel; for example, it can be set to 0x06000001 to ensure sufficient space for resource growth in the software development kit of the application to be integrated. An identifier definition file (id_defined.json) is generated, including resource identifiers, resource types, and resource names for each resource. The identifier definition file of the security protection SDK is copied to the corresponding directory (src / main / resources / base / element / ) in the initial sandbox framework, and this file will be automatically read during the subsequent HarmonyOS compilation process.
[0058] The key configuration items are read from the configuration module file (module.json) of the application to be integrated. These key configuration items include parameter configuration information such as application name, application identifier, application type, and application version. The key configuration items from the configuration module file of the application to be integrated are synchronized to the configuration module file (module.json) of the initial sandbox framework to obtain the target sandbox framework. Specifically, the configuration module file (module.json) of the initial sandbox framework is edited, replacing the configuration items corresponding to the key configuration items in the configuration module file with the values corresponding to the key configuration items in the original software development package's configuration module file, while retaining the framework's own capability declarations. The consistency of the configuration items is checked to ensure that the key configuration items of the obtained target sandbox framework are completely consistent with the key configuration items of the original software development package, so that the HarmonyOS system can identify the uniqueness of the application through the field values corresponding to the key configuration items.
[0059] The target sandbox framework is compiled. Specifically, this can be done by executing the compilation command in the root directory of the target sandbox framework. After compilation, the output HAP package is obtained in the corresponding directory of the target sandbox framework (entry / build / outputs / hap / debug), and named the sandbox engine. The sandbox engine is then decompressed to obtain the sandbox resource index (resources.index), sandbox bytecode (modules.abc), and SO library directory (libs). Based on the sandbox engine's sandbox resource index, sandbox bytecode, and SO library directory, the software development source package of the application to be integrated is updated to obtain the target merged development package.
[0060] In one optional embodiment, based on the sandbox engine's sandbox resource index, sandbox bytecode, and SO library directory, the software development kit (SDK) of the application to be integrated is updated to obtain the target merged development kit, including:
[0061] Step b1: Copy the files under the sandbox resource index to the directory of the software development source package of the application to be integrated, and perform resource merging to obtain the merged resource index.
[0062] Step b2: Merge the Ark bytecode in the original software development package and the sandbox bytecode of the sandbox engine to obtain the merged bytecode data.
[0063] Step b3: Integrate the SO library directory of the sandbox engine into the software development package of the application to be integrated, and merge the files according to the configuration module files of the sandbox engine and the configuration module files of the software development package to obtain the target merged development package.
[0064] It should be noted that the new version of the HarmonyOS resource processing tool (restool) imposes constraints on resource naming rules during version iterations. The core of this constraint is to standardize the naming format of resource files or resource identifiers to avoid resource parsing errors caused by special characters. However, this restriction directly affects the resource file merging process of the aforementioned technical solution. Therefore, it is necessary to modify the resource names of the HAP package before merging resources and then restore the modified names after merging the resources.
[0065] Optionally, before copying the files under the sandbox resource index to the directory of the software development kit of the application to be integrated and performing resource merging to obtain the merged resource index, the following steps are also included: modifying the fields in the resource directory of the software development kit of the application to be integrated by hyphens and recording the modification content to a preset mapping table; adding the application name of the application to be integrated to a preset field in the configuration module file of the software development kit of the application to be integrated, thereby obtaining the preprocessed software development kit of the application to be integrated.
[0066] The resource directory of the source code package for the application to be integrated is traversed. Resource filenames containing hyphens "-" are modified to use underscores "_", e.g., "dt-icon-logo.png" is changed to "dt_icon_logo.png". This modification is recorded in the mapping table. The application name "moduleName" is added to the preset field "module.distro" in the configuration module file of the source code package for the application to be integrated, resulting in the preprocessed source code package for the application to be integrated.
[0067] Copy all files, including strings and images, from the resource directory of the unzipped sandbox engine to the resource directory of the original software development package, and execute the resource merging command. Specifically, you can enter the restool command in the command execution line to merge the resource index and obtain the merged resource index.
[0068] Based on the modified mapping table, resource filenames in the original software development package's resource directory (resources) that had been changed to underscores "_" were changed back to hyphens "-", and the corresponding resource paths in the merged resource index file (resources.index) were updated synchronously. The Ark bytecode (modules.abc) from the original software development package and the sandbox bytecode (modules.abc) from the sandbox engine were merged to obtain merged bytecode data. The merged bytecode data contains the original package's business logic and the security business logic of the security SDK.
[0069] The sandbox engine's SO library directory is integrated into the software development kit (SDK) of the application to be integrated. Based on the sandbox engine's configuration module files and the SSD's configuration module files, files are merged to obtain the target merged development kit. During the SO library directory merging process, if the libs directory under the SSD does not exist, a libs directory is created under the SSD directory, and subdirectories are created. All SO library directories under the unzipped libs directory of the sandbox engine are copied to the libs subdirectory of the corresponding architecture in the SSD. The nativeLibs field is confirmed to be configured in the module.json configuration file of the SSD to ensure that the SO libraries can be loaded, resulting in the SSD's libs directory containing the sandbox SO libraries.
[0070] In an optional embodiment, the configuration module files of the sandbox engine and the configuration module files of the original software development package are merged to obtain a target merged development package. This includes: extracting the implementation class path of the application module life manager from the configuration module file of the sandbox engine; replacing the value of the core configuration field in the original software development package that specifies the full path of the implementation class of the application module life manager with the implementation class path of the application module life manager of the sandbox engine to obtain an updated original software development package; and merging other configuration files of the sandbox engine into the configuration module file in the updated original software development package to obtain the target merged development package.
[0071] Specifically, extract the implementation class path of the application module lifecycle manager `abilityStage` from the sandbox engine's configuration module file `module.json`. Edit the configuration module file `module.json` of the original software development package, replacing the value of the `module.abilityStage` field with the implementation class path of the sandbox engine. This ensures that the sandbox engine calls the logic of the original package's `AbilityStage` after initializing security protection functions, such as calling the original package class via reflection. Extract the sandbox permission file `module.permissions`, the sandbox's UIAbility declaration file `module.abilities`, and other configuration files such as sandbox metadata `module.metaData` from the sandbox engine's configuration module file `module.json`. Add the configuration items of the above other configuration files in batches to the corresponding fields of the original software development package's configuration module file `module.json` to avoid duplicate configurations. For example, existing permissions are not added again. Use the merged original package as the target merged development package. Perform file compression on the target merged development package to obtain the HAP package.
[0072] It should be noted that before the final development package interaction, the development package also needs to be signed and the application function tested to ensure that the original function of the application to be integrated is not affected while integrating security protection functions.
[0073] In one optional embodiment, application function testing is performed on the application to be integrated based on the target merged development package, and after the test is passed, the target integrated application that has passed the test is delivered to the initiator of the integration request. This includes: obtaining the application debug signature and the application official signature from the initiator of the integration request; performing a package signing operation on the target merged development package based on the application debug signature and the application official signature to obtain a signed sandbox package; performing application function testing on the application to be integrated based on the signed sandbox package to obtain the function test results; if the function test results are passed, the target integrated application is determined and delivered to the initiator of the integration request.
[0074] If it's a debug signature, the debug signature command is executed to perform a debug signature operation on the target merged development package; if it's a formal signature, the formal signature command is executed to perform a formal signature operation on the target merged development package, resulting in a signed sandbox package. Functional testing is performed on the signed sandbox package, specifically testing whether the application can implement security protection functions, generating functional test results. If the functional test results are passed, the application to be integrated that passed the test is identified as the target integration application and delivered to the party that initiated the integration request; if the functional test results are failed, relevant technical personnel will investigate the integration process, find the cause of the integration failure, and fix it.
[0075] The technical solution of this invention involves parsing the original software development package to obtain configuration module files, executable code files, and resource index files, generating an initial sandbox framework, copying the security protection SDK to the corresponding directory of the initial sandbox framework, and updating the configuration module files corresponding to the initial sandbox framework according to the configuration module files of the application to be integrated, thus obtaining the target sandbox framework. The target sandbox framework is then compiled, and after compilation, the HarmonyOS application HAP package is obtained from the corresponding directory of the target sandbox framework to obtain the sandbox engine. The sandbox engine is decompressed to obtain the sandbox resource index, sandbox bytecode, and SO library directory. Based on the sandbox engine's sandbox resource index, sandbox bytecode, and SO library directory, the original software development package of the application to be integrated is updated to obtain the target merged development package. Based on the target merged development package, application function testing is performed on the application to be integrated, and after passing the test, the tested target integrated application is delivered to the initiator of the integration request. The above technical solution enables the integration of security protection SDKs into HarmonyOS applications developed based on the HarmonyOS system, as well as the security management and control of HarmonyOS applications, improving SDK integration efficiency. Furthermore, it decouples the business requirements and security protection requirements of applications during the integration of security protection SDKs into HarmonyOS applications, allowing for independent development of the two application SDKs. Security functions do not require secondary development and integration on the original HarmonyOS applications, achieving transparent deployment.
[0076] Example 2
[0077] Figure 2 This is a schematic diagram of the process structure of a software development kit integration method based on HarmonyOS applications provided in Embodiment 2 of the present invention. This embodiment provides a preferred example based on the above embodiments.
[0078] like Figure 2 As shown, the method includes the following steps:
[0079] S21. Obtain the original HAP software development package for HarmonyOS applications, and get the configuration module file, executable code file and resource index file.
[0080] In response to an integration request for a pre-developed security protection software development kit (SDK), the software development kit (SDK) of the HarmonyOS application developed based on the HarmonyOS system framework is obtained. The SSD is parsed to obtain configuration module files, executable code files, and resource index files.
[0081] S22. Determine the basic framework structure of the pre-generated initial sandbox framework.
[0082] The basic framework structure includes at least a resource directory, a code directory, and configuration files. The security protection SDK is copied to the libs directory of the initial sandbox framework, and the security protection SDK dependency is configured in the Gradle build script used to build and manage the application.
[0083] S23. Obtain the resource list under the resource directory corresponding to the security protection SDK, and update the directory of the initial sandbox framework based on the resource list.
[0084] The resource list includes at least one resource type and resource name; based on the preset starting value of the custom identifier, a corresponding resource identifier is generated for each resource in the resource list, and based on the resource identifier, resource type and resource name of each resource, an identifier definition file of the security protection SDK is generated, and the identifier definition file of the security protection SDK is copied to the corresponding directory of the initial sandbox framework.
[0085] S24. Synchronize the key configuration items in the configuration module file of the HarmonyOS application to the configuration module file of the initial sandbox framework to obtain the target sandbox framework.
[0086] Key configuration items include application identifier and application type.
[0087] S25. Compile the target sandbox framework, and after compilation, obtain the HarmonyOS application HAP package from the corresponding directory of the target sandbox framework to obtain the sandbox engine.
[0088] S26. Modify the fields in the resource directory of the HarmonyOS application's software development package by adding hyphens, and record the modified content to the preset mapping table.
[0089] Add the application name of the application to be integrated to the preset fields in the configuration module file of the software development kit of the application to be integrated to obtain the preprocessed software development kit of the application to be integrated.
[0090] S27. Decompress the sandbox engine to obtain the sandbox resource index, sandbox bytecode, and So library directory.
[0091] S28. Merge the resource indexes to obtain the updated software development kit for HarmonyOS applications.
[0092] Copy the files under the sandbox resource index to the directory of the software development kit of the application to be integrated, and perform resource merging to obtain the merged resource index; merge the Ark bytecode in the software development kit and the sandbox bytecode of the sandbox engine to obtain the merged bytecode data; integrate the So library directory of the sandbox engine into the software development kit of the application to be integrated, and replace the value of the core configuration field in the software development kit that specifies the full path of the implementation class of the application module life manager with the implementation class path of the application module life manager of the sandbox engine to obtain the updated software development kit;
[0093] S29. Merge the other configuration files of the sandbox engine into the configuration module file in the updated software development package to obtain the target merged development package.
[0094] S210. Obtain the application debug signature and application official signature from the initiator of the integration request, and perform package signing operation on the target merged development package based on the application debug signature and application official signature to obtain the signed sandbox package.
[0095] S211. Based on the signed sandbox package, perform application function testing on the application to be integrated, obtain the function test results, and if the function test results are passed, determine the target integrated application and deliver the target integrated application to the initiator of the integration request.
[0096] Example 3
[0097] Figure 3 This is a schematic diagram of a software development kit (SDK) integration device based on HarmonyOS applications provided in Embodiment 3 of the present invention. The software development kit integration device based on HarmonyOS applications provided in this embodiment of the present invention is applicable to the integration of security protection SSDs into HarmonyOS applications developed based on the HarmonyOS system. This software development kit integration device based on HarmonyOS applications can be implemented in hardware and / or software, such as... Figure 3 As shown, the device includes: an integrated request and response module 301, an initial framework generation module 302, a compilation module 303, a decompression module 304, a resource merging module 305, and a functional testing module 306. Among them,
[0098] The integration request and response module 301 is used to respond to the integration request for the pre-developed security protection software development kit (SDK), obtain the software development kit of the application to be integrated based on the HarmonyOS system framework, and perform package parsing on the software development kit to obtain configuration module files, executable code files, and resource index files.
[0099] The initial framework generation module 302 is used to generate an initial sandbox framework, copy the security protection SDK to the corresponding directory of the initial sandbox framework, and update the configuration module file corresponding to the initial sandbox framework according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework.
[0100] The compilation module 303 is used to compile the target sandbox framework and, after compilation, obtain the HarmonyOS application HAP package from the corresponding directory of the target sandbox framework to obtain the sandbox engine.
[0101] The decompression module 304 is used to decompress the sandbox engine and obtain the sandbox resource index, sandbox bytecode and So library directory;
[0102] The resource merging module 305 is used to update the software development kit of the application to be integrated based on the sandbox resource index, sandbox bytecode and So library directory of the sandbox engine, so as to obtain the target merged development kit;
[0103] The functional testing module 306 is used to perform application functional testing on the application to be integrated based on the target merged development package, and deliver the tested target integrated application to the initiator of the integration request after the test is passed.
[0104] The technical solution of this invention involves parsing the original software development package to obtain configuration module files, executable code files, and resource index files, generating an initial sandbox framework, copying the security protection SDK to the corresponding directory of the initial sandbox framework, and updating the configuration module files corresponding to the initial sandbox framework according to the configuration module files of the application to be integrated, thus obtaining the target sandbox framework. The target sandbox framework is then compiled, and after compilation, the HarmonyOS application HAP package is obtained from the corresponding directory of the target sandbox framework to obtain the sandbox engine. The sandbox engine is decompressed to obtain the sandbox resource index, sandbox bytecode, and SO library directory. Based on the sandbox engine's sandbox resource index, sandbox bytecode, and SO library directory, the original software development package of the application to be integrated is updated to obtain the target merged development package. Based on the target merged development package, application function testing is performed on the application to be integrated, and after passing the test, the tested target integrated application is delivered to the initiator of the integration request. The above technical solution enables the integration of security protection SDKs into HarmonyOS applications developed based on the HarmonyOS system, as well as the security management and control of HarmonyOS applications, improving SDK integration efficiency. Furthermore, it decouples the business requirements and security protection requirements of applications during the integration of security protection SDKs into HarmonyOS applications, allowing for independent development of the two application SDKs. Security functions do not require secondary development and integration on the original HarmonyOS applications, achieving transparent deployment.
[0105] Optionally, the initial framework generation module 302 is specifically used for:
[0106] Determine the basic framework structure of the initial sandbox framework; the basic framework structure includes at least a resource directory, a code directory, and configuration files;
[0107] Copy the security protection SDK to the libs directory of the initial sandbox framework, and configure the security protection SDK dependency in the Gradle build script used to build and manage the application;
[0108] Obtain the resource list under the resource directory corresponding to the security protection SDK; the resource list includes the resource type and resource name of at least one resource;
[0109] Based on the preset starting value of the custom identifier, a corresponding resource identifier is generated for each resource in the resource list. Based on the resource identifier, resource type and resource name of each resource, an identifier definition file of the security protection SDK is generated and copied to the corresponding directory of the initial sandbox framework.
[0110] The key configuration items in the configuration module file of the application to be integrated are synchronized to the configuration module file of the initial sandbox framework to obtain the target sandbox framework; the key configuration items include application identifier and application type.
[0111] Optional, resource merging module 305 includes:
[0112] The resource merging unit is used to copy the files under the sandbox resource index to the directory of the software development source package of the application to be integrated, and perform resource merging to obtain the merged resource index.
[0113] The bytecode merging unit is used to merge the Ark bytecode in the software development kit and the sandbox bytecode of the sandbox engine to obtain merged bytecode data.
[0114] The target development package generation unit is used to integrate the SO library directory of the sandbox engine into the software development package of the application to be integrated, and to merge the files according to the configuration module file of the sandbox engine and the configuration module file of the software development package to obtain the target merged development package.
[0115] Optionally, the resource merging module 305 also includes:
[0116] The hyphen modification unit is used to modify the fields in the resource directory of the software development kit of the application to be integrated before copying the files under the sandbox resource index to the directory of the software development kit of the application to be integrated and performing resource merging to obtain the merged resource index. The modified content is recorded to a preset mapping relationship table. The application name of the application to be integrated is added to a preset field in the configuration module file of the software development kit of the application to be integrated to obtain the preprocessed software development kit of the application to be integrated.
[0117] Optional, the target development package generation unit is specifically used for:
[0118] The implementation class path of the application module life manager is extracted from the configuration module file of the sandbox engine. The value of the core configuration field in the software development kit that specifies the full path of the implementation class of the application module life manager is replaced with the implementation class path of the application module life manager of the sandbox engine to obtain the updated software development kit.
[0119] The other configuration files of the sandbox engine are merged into the configuration module files in the updated software development package to obtain the target merged development package.
[0120] Optional, functional test module 306, specifically used for:
[0121] Obtain the application debug signature and the application official signature from the initiator of the integration request;
[0122] Based on the application debug signature and the application official signature, perform a package signing operation on the target merged development package to obtain a signed sandbox package;
[0123] Based on the signed sandbox package, the application to be integrated is tested for functionality, and the functionality test results are obtained.
[0124] If the functional test result is passed, the target integrated application is determined and delivered to the party that initiated the integration request.
[0125] The software development kit integration device based on HarmonyOS provided in this embodiment of the invention can execute the software development kit integration method based on HarmonyOS provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0126] Example 4
[0127] Figure 4A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0128] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded from storage unit 48 into the RAM 43. The RAM 43 may also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0129] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0130] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as the software development kit integration method based on HarmonyOS applications.
[0131] In some embodiments, the HarmonyOS-based software development kit integration method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the HarmonyOS-based software development kit integration method described above can be performed. Alternatively, in other embodiments, processor 41 can be configured to execute the HarmonyOS-based software development kit integration method by any other suitable means (e.g., by means of firmware).
[0132] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0133] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0134] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0135] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0136] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0137] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0138] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0139] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for integrating a software development kit (SDK) based on HarmonyOS applications, characterized in that, include: In response to an integration request for a pre-developed security protection software development kit (SDK), the software development kit of the application to be integrated, developed based on the HarmonyOS system framework, is obtained, and the software development kit is parsed to obtain configuration module files, executable code files, and resource index files. An initial sandbox framework is generated, and the security protection SDK is copied to the corresponding directory of the initial sandbox framework. In addition, the configuration module file corresponding to the initial sandbox framework is updated according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework. The target sandbox framework is compiled, and after compilation, the HarmonyOS application HAP package is obtained from the corresponding directory of the target sandbox framework to obtain the sandbox engine; The sandbox engine is decompressed to obtain the sandbox resource index, sandbox bytecode, and So library directory; Based on the sandbox resource index, sandbox bytecode, and So library directory of the sandbox engine, update the software development source package of the application to be integrated to obtain the target merged development package; Based on the target merged development package, the application to be integrated is tested for application functionality. After the test is passed, the tested target integrated application is delivered to the party that initiated the integration request.
2. The method according to claim 1, characterized in that, The steps of copying the security protection SDK to the corresponding directory of the initial sandbox framework and updating the configuration module file corresponding to the initial sandbox framework according to the configuration module file of the application to be integrated, to obtain the target sandbox framework, include: Determine the basic framework structure of the initial sandbox framework; the basic framework structure includes at least a resource directory, a code directory, and configuration files; Copy the security protection SDK to the libs directory of the initial sandbox framework, and configure the security protection SDK dependency in the Gradle build script used to build and manage the application; Obtain the resource list under the resource directory corresponding to the security protection SDK; the resource list includes the resource type and resource name of at least one resource; Based on the preset starting value of the custom identifier, a corresponding resource identifier is generated for each resource in the resource list. Based on the resource identifier, resource type and resource name of each resource, an identifier definition file of the security protection SDK is generated and copied to the corresponding directory of the initial sandbox framework. The key configuration items in the configuration module file of the application to be integrated are synchronized to the configuration module file of the initial sandbox framework to obtain the target sandbox framework; the key configuration items include application identifier and application type.
3. The method according to claim 1, characterized in that, The sandbox resource index, sandbox bytecode, and SO library directory based on the sandbox engine are used to update the software development kit of the application to be integrated, resulting in the target merged development kit, including: Copy the files under the sandbox resource index to the directory of the software development kit of the application to be integrated, and perform resource merging to obtain the merged resource index; The Ark bytecode in the software development kit and the sandbox bytecode of the sandbox engine are merged to obtain merged bytecode data; The SO library directory of the sandbox engine is integrated into the software development package of the application to be integrated, and the files are merged according to the configuration module files of the sandbox engine and the configuration module files of the software development package to obtain the target merged development package.
4. The method according to claim 3, characterized in that, Before copying the files under the sandbox resource index to the directory of the software development kit of the application to be integrated, and performing resource merging to obtain the merged resource index, the process further includes: The fields in the resource directory of the software development kit of the application to be integrated are modified by hyphens, and the modified content is recorded in the preset mapping table. The application name of the application to be integrated is added to the preset field in the configuration module file of the software development kit of the application to be integrated, so as to obtain the preprocessed software development kit of the application to be integrated.
5. The method according to claim 3, characterized in that, The step of merging the configuration module files of the sandbox engine and the original software development package to obtain the target merged development package includes: The implementation class path of the application module life manager is extracted from the configuration module file of the sandbox engine. The value of the core configuration field in the software development kit that specifies the full path of the implementation class of the application module life manager is replaced with the implementation class path of the application module life manager of the sandbox engine to obtain the updated software development kit. The other configuration files of the sandbox engine are merged into the configuration module files in the updated software development package to obtain the target merged development package.
6. The method according to claim 1, characterized in that, The step of performing application function testing on the application to be integrated based on the target merged development package, and delivering the tested target integrated application to the initiator of the integration request after the test is passed, includes: Obtain the application debug signature and the application official signature from the initiator of the integration request; Based on the application debug signature and the application official signature, perform a package signing operation on the target merged development package to obtain a signed sandbox package; Based on the signed sandbox package, the application to be integrated is tested for functionality, and the functionality test results are obtained. If the functional test result is passed, the target integrated application is determined and delivered to the party that initiated the integration request.
7. A software development kit integration device based on HarmonyOS applications, characterized in that, include: The integration request and response module is used to respond to integration requests for pre-developed security protection software development kits (SDKs), obtain the software development kit of the application to be integrated based on the HarmonyOS system framework, and perform package parsing on the software development kit to obtain configuration module files, executable code files, and resource index files. An initial framework generation module is used to generate an initial sandbox framework, copy the security protection SDK to the corresponding directory of the initial sandbox framework, and update the configuration module file corresponding to the initial sandbox framework according to the configuration module file of the application to be integrated, so as to obtain the target sandbox framework. The compilation module is used to compile the target sandbox framework and, after compilation, obtain the HarmonyOS application HAP package from the corresponding directory of the target sandbox framework to obtain the sandbox engine. The decompression module is used to decompress the sandbox engine and obtain the sandbox resource index, sandbox bytecode, and So library directory; The resource merging module is used to update the software development kit of the application to be integrated based on the sandbox resource index, sandbox bytecode and So library directory of the sandbox engine, so as to obtain the target merged development kit; The functional testing module is used to perform application functional testing on the application to be integrated based on the target merged development package, and deliver the tested target integrated application to the initiator of the integration request after the test is passed.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the software development kit integration method based on HarmonyOS application as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the software development kit integration method based on HarmonyOS application as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the software development kit integration method based on HarmonyOS applications according to any one of claims 1-6.