当前位置:网站首页>Code open source design and implementation ideas
Code open source design and implementation ideas
2022-07-30 04:31:00 【Nimrod__】
I. Background
Some customers have secondary development requirements for the project, and need to customize the function extension development of the existing APK.
In order to meet the needs of its secondary development, it is necessary to partially open the source code.
The principle for open source is mainly the principle of least known.
Mainly need to complete several goals:
1. Only open source relevant codes related to UI, and not open source other parts of the code.
2. For files that are not open sourced, document descriptions should be provided to explain related functions and related interfaces.
3. Finally, a source code file package that can be compiled and modified by the customer is formed and sent to the customer for use.
Second, design goals
1. Open source the project code to customers and provide a source code file.
2. The open source files only involve UI, not specific logic.
3. The source files that are open-sourced to customers must be compilable and run normally.
4. It is required to modify the code as little as possible in this open source process.
Three, detailed implementation plan and implementation ideas
Because the corresponding modular decoupling process has been done in the early stage of the project, this project is completed on the basis of the decoupling of the modular coupling relationship.
The basic solution is:
1. Open source the code that involves the UI lib and needs to be open sourced to the user for secondary development. This part of the code is retained according to the original file structure.
2. For the lib package not related to UI packaged into arr package and imported, keep the source code of this part, and obfuscate the logic code to avoid security problems at the code level.
3. Finally, a package of compliable and modifiable source code files that the user hides without revealing the part is formed and sent to the customer for use.
Basic ideas and steps
Current project block diagram:
Step 1: Determine the parts that need open source and those that don't (about 0.5 days)
Open source divides the components into two parts:
1. No need for open source parts:
- The processing of the data logic of the basic components and the gate-lib part, as well as some underlying hardware control logic, has nothing to do with the UI, so there is no need to open source it.
- Back-end interaction related lib: related to back-end interaction, this part is recommended to be reserved, exposure may have certain security problems, no need to open source.
2. Open source parts are required:
- Registration-related lib: It involves the UI interface related to user registration. When the customer needs to modify some face acquisition logic, the user can modify it, and it needs to be open sourced to the customer.
- Setting related modules lib: All scenarios involving apk system settings are easily involved in secondary development by customers, related to UI, and need to be open sourced to customers.
- Collection-related lib: related to face collection. If users have scene requirements for face collection and need to use it, they need to open source to customers.
- Platform UI-related lib: The main interface UI is related, and the key scenarios for customers to modify need to be open sourced to customers.
- app-lib: where the overall entrance of the app is located and needs to be open sourced to customers.
In general, according to the principle of least knowledge, this open source will only open source the part related to UI and open source modified by customers to customers.The rest are selected as arr packages for import.
Step 2: Package the parts that do not need open source into arr packages
1. Use the gradlecompiler plugin that comes with Android Studio to generate aar files, and at the same time obfuscate the aar package to avoid code-level security issues.
2. Import the arr package into the app directory, and reference the related functions in the app directory.
3. Repeat this step continuously to complete all libs that need to be packaged into aar packages.
Step 3: Form a new code project file with the packaged arr package and the code that needs to be open sourced.
Combine the packaged aar file and the open source code file, delete the packaged aar file lib, and form a new, runnable code file project.
Step 4: Self-test whether the package can be compiled and run normally.
Compile the project and check if it is normal.
After the compilation is completed, run the APK to test whether the main process is normal, simulate the customer's secondary development scenario, and whether it can meet the customer's needs.
Step 5: Write the necessary interface documents and explanation documents.
The related interfaces of the open source part to the non-open source part need to be supplemented with an interface document. The secondary development of the open source part requires a secondary development document
Step 6: Combine code source files and related documents and send to customer
边栏推荐
猜你喜欢

Arrays and Structures

Charles replaces the interface response information
![Reverse Theory Knowledge 3 [UI Modification]](/img/f3/33db96f3dd149658859be58041ab43.png)
Reverse Theory Knowledge 3 [UI Modification]

MySQL String Concatenation - Various String Concatenation Practical Cases

VUX Datetime 组件compute-days-function动态设置日期列表

Atomic Guarantees of Redis Distributed Locks

DAY17:弱口令的探测与测试

图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别

MYSQL unique constraint
![[Awards every week] The](/img/78/4b510b190475d603490614d2c8199f.png)
[Awards every week] The "Edge Containers" track of the Cloud Native Programming Challenge invites you to fight!
随机推荐
RRU, BBU, AAU
SSM框架简单介绍
2.6基数排序(桶排序)
sql statement - how to query data in another table based on the data in one table
DAY17: weak password detection and test
[SQL] at a certain correlation with a table of data update another table
DAY17:弱口令的探测与测试
How does MySql find out the latest data row that meets the conditions?
Mini Program wx.miniProgram.navigateTo jump address cannot be tabbar address
[Awards every week] The "Edge Containers" track of the Cloud Native Programming Challenge invites you to fight!
Become a qualified cybersecurity, do you know this?
The 2nd Shanxi Province Network Security Skills Competition (Enterprise Group) Part of the WP (9)
@ WebServlet annotations (Servlet annotations)
MySQL operation statement Daquan (detailed)
labelme的使用技巧
golang中如何比较struct,slice,map是否相等以及几种对比方法的区别
Shanxi group (enterprises) in the second network security skills competition part problem WP (7)
图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别
VUX Datetime 组件compute-days-function动态设置日期列表
Android Studio implements login registration - source code (connecting to MySql database)