├── .github
└── workflows
│ ├── dependency-review.yml
│ ├── devskim.yml
│ └── powershell.yml
├── .idea
├── afdian.png
├── download.png
├── homepage.png
└── love.png
├── README.md
├── README_en-US.md
├── changelog.md
├── module
├── common.sh
├── customize.sh
├── module.prop
├── service.sh
├── uninstall.sh
└── 删除编译内容.sh
└── update.json
/.github/workflows/dependency-review.yml:
--------------------------------------------------------------------------------
1 | # Dependency Review Action
2 | #
3 | # This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4 | #
5 | # Source repository: https://github.com/actions/dependency-review-action
6 | # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7 | name: 'Dependency Review'
8 | on: [pull_request]
9 |
10 | permissions:
11 | contents: read
12 |
13 | jobs:
14 | dependency-review:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - name: 'Checkout Repository'
18 | uses: actions/checkout@v3
19 | - name: 'Dependency Review'
20 | uses: actions/dependency-review-action@v2
21 |
--------------------------------------------------------------------------------
/.github/workflows/devskim.yml:
--------------------------------------------------------------------------------
1 | # This workflow uses actions that are not certified by GitHub.
2 | # They are provided by a third-party and are governed by
3 | # separate terms of service, privacy policy, and support
4 | # documentation.
5 |
6 | name: DevSkim
7 |
8 | on:
9 | push:
10 | branches: [ "main" ]
11 | pull_request:
12 | branches: [ "main" ]
13 | schedule:
14 | - cron: '25 17 * * 4'
15 |
16 | jobs:
17 | lint:
18 | name: DevSkim
19 | runs-on: ubuntu-20.04
20 | permissions:
21 | actions: read
22 | contents: read
23 | security-events: write
24 | steps:
25 | - name: Checkout code
26 | uses: actions/checkout@v3
27 |
28 | - name: Run DevSkim scanner
29 | uses: microsoft/DevSkim-Action@v1
30 |
31 | - name: Upload DevSkim scan results to GitHub Security tab
32 | uses: github/codeql-action/upload-sarif@v2
33 | with:
34 | sarif_file: devskim-results.sarif
35 |
--------------------------------------------------------------------------------
/.github/workflows/powershell.yml:
--------------------------------------------------------------------------------
1 | # This workflow uses actions that are not certified by GitHub.
2 | # They are provided by a third-party and are governed by
3 | # separate terms of service, privacy policy, and support
4 | # documentation.
5 | #
6 | # https://github.com/microsoft/action-psscriptanalyzer
7 | # For more information on PSScriptAnalyzer in general, see
8 | # https://github.com/PowerShell/PSScriptAnalyzer
9 |
10 | name: PSScriptAnalyzer
11 |
12 | on:
13 | push:
14 | branches: [ "main" ]
15 | pull_request:
16 | branches: [ "main" ]
17 | schedule:
18 | - cron: '30 23 * * 5'
19 |
20 | permissions:
21 | contents: read
22 |
23 | jobs:
24 | build:
25 | permissions:
26 | contents: read # for actions/checkout to fetch code
27 | security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28 | actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29 | name: PSScriptAnalyzer
30 | runs-on: ubuntu-latest
31 | steps:
32 | - uses: actions/checkout@v3
33 |
34 | - name: Run PSScriptAnalyzer
35 | uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f
36 | with:
37 | # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options.
38 | # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules.
39 | path: .\
40 | recurse: true
41 | # Include your own basic security rules. Removing this option will run all the rules
42 | includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"'
43 | output: results.sarif
44 |
45 | # Upload the SARIF file generated in the previous step
46 | - name: Upload SARIF results file
47 | uses: github/codeql-action/upload-sarif@v2
48 | with:
49 | sarif_file: results.sarif
50 |
--------------------------------------------------------------------------------
/.idea/afdian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anokaii/Dex2oatRUN/f50341c79c29866a8d95eb6a22b079c706156245/.idea/afdian.png
--------------------------------------------------------------------------------
/.idea/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anokaii/Dex2oatRUN/f50341c79c29866a8d95eb6a22b079c706156245/.idea/download.png
--------------------------------------------------------------------------------
/.idea/homepage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anokaii/Dex2oatRUN/f50341c79c29866a8d95eb6a22b079c706156245/.idea/homepage.png
--------------------------------------------------------------------------------
/.idea/love.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anokaii/Dex2oatRUN/f50341c79c29866a8d95eb6a22b079c706156245/.idea/love.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
dex编译(dex2oat)
8 |
9 |
10 | [](https://github.com/topjohnwu/Magisk)
11 | [](https://github.com/six-phase-snow/Dex2oatRUN/releases/latest)
12 | [](https://github.com/six-phase-snow/Dex2oatRUN)
13 | [](https://github.com/six-phase-snow/Dex2oatRUN/releases)
14 |
15 | [](http://www.coolapk.com/u/11696005)
16 | [](https://afdian.net/a/Suxue_SaMa)
17 |
18 | >这是一个magisk模块,它调用了系统中对安卓系统下应用的dex文件进行编译优化的程序。通过合理的dex2oat的编译优化,可以大大提高应用启动的速度和使用手机过程的的流畅度。
19 |
20 | ## 解释
21 |
22 | 模块根据配置在**系统更新**及**安装应用**后*定时或开机*执行dex2oat(第一次安装完模块也会执行)。
23 |
24 | ## 测试环境
25 |
26 | `MIUI 14`
27 | `Android 12`
28 |
29 | ## 配置
30 |
31 | - 配置及日志相关文件都在此文件夹下:
32 |
33 | ```
34 |
35 | /data/adb/Dex2oatRUN
36 |
37 | ```
38 |
39 | ---
40 |
41 | # 下载
42 |
43 | [
点击前往下载页](https://github.com/six-phase-snow/Dex2oatRUN/releases)
44 |
--------------------------------------------------------------------------------
/README_en-US.md:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
dex编译(dex2oat)
8 |
9 |
10 |
11 | [](https://github.com/topjohnwu/Magisk)
12 | [](https://github.com/six-phase-snow/Dex2oatRUN/releases/latest)
13 | [](https://github.com/six-phase-snow/Dex2oatRUN)
14 | [](https://github.com/six-phase-snow/Dex2oatRUN/releases)
15 |
16 | [](http://www.coolapk.com/u/11696005)
17 | [](https://afdian.net/a/Suxue_SaMa)
18 |
19 | >This is a magisk module, which calls the program in the system to compile and optimize the dex file applied under the Android system. Through reasonable compilation and optimization of dex2oat, the speed of application startup and the fluency of using mobile phone can be greatly improved.
20 |
21 | ## explain
22 |
23 | According to the configuration, the module will execute dex2oat *timing or start* after **system update** and **application installation** (it will be executed just after the module is first installed).
24 |
25 | ## testing environment
26 |
27 | `MIUI 13`
28 | `Android 12`
29 |
30 | ## deploy
31 |
32 | - Configuration and log related files are in this folder:
33 |
34 | ```
35 |
36 | /data/adb/Dex2oatRUN
37 |
38 | ```
39 |
40 | ---
41 |
42 | # download
43 |
44 | [
Click to go to the download page](https://github.com/six-phase-snow/Dex2oatRUN/releases)
45 |
46 | ---
47 |
48 | # donate
49 |
50 | [
Click to go to the author's Afdian homepage](https://afdian.net/a/Suxue_SaMa)
51 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | ## 更新日志
2 |
3 | #### 当前版本
4 |
5 | - 更改了配置文件里面的一个字。(37)
6 |
7 | #### 旧版本
8 |
9 |
10 |
11 | - 改了一下判断方法。(36)
12 | - 修了个bug。(35)
13 | - 改个版号。(34)
14 | - 再次尝试修复无法运行。(33)
15 | - 使用AI重构了部分代码。(31)
16 | - 尝试修复无法运行的bug。(31)
17 | - 优化代码。(30)
18 | - 合并代码。(30)
19 | - 去除不需要的日志。(30)
20 | - 优化模块体积。(30)
21 | - 尝试修复无法执行。(23)
22 | - 调整执行方法,日志等。(22)
23 | - 3.0版本测试开始。(22)
24 |
25 |
26 |
27 | ## 关于
28 |
29 | - 作者:[酷安@柊芸芸](http://www.coolapk.com/u/11696005) [GitHub@六相雪](https://github.com/six-phase-snow)
30 |
31 | - 模块地址:[GitHub](https://github.com/six-phase-snow/Dex2oatRUN)
32 |
33 |
--------------------------------------------------------------------------------
/module/common.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | MODDIR=${0%/*}
3 |
4 | export PATH="$(magisk --path)/.magisk/busybox:$PATH"
5 |
6 | DEX2OAT_CONFIG="/data/adb/Dex2oatRUN/基础配置.prop"
7 | OPTIONALAPP_CONFIG="/data/adb/Dex2oatRUN/自选应用列表.prop"
8 |
9 | log_file="/data/adb/Dex2oatRUN/日志.log"
10 |
11 | system_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^系统应用=" | cut -f2 -d '=')
12 | tripartite_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^三方应用=" | cut -f2 -d '=')
13 | optional_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^自选应用=" | cut -f2 -d '=')
14 |
15 | newid=$(getprop ro.system.build.id)
16 | newpkg=$(pm list packages | grep "^package:" | cut -f2 -d ':')
17 | tripartiteapp=$(pm list packages -3 | grep "^package:" | cut -f2 -d ':')
18 | systemapp=$(pm list packages -s | grep "^package:" | cut -f2 -d ':')
19 |
20 | touch "$MODDIR/old.id"
21 | touch "$MODDIR/old.pkg"
22 | > "$MODDIR/sapp.txt"
23 | > "$MODDIR/3app.txt"
24 | > "$MODDIR/new.id"
25 | > "$MODDIR/new.pkg"
26 | echo "$tripartiteapp" > "$MODDIR/3app.txt"
27 | echo "$systemapp" > "$MODDIR/sapp.txt"
28 | echo "$newid" > "$MODDIR/new.id"
29 | echo "$newpkg" > "$MODDIR/new.pkg"
30 |
31 | if [ ! -z "$(cmp "$MODDIR/old.id" "$MODDIR/new.id")" ] || [ ! -z "$(cmp "$MODDIR/old.pkg" "$MODDIR/new.pkg")" ]; then
32 | > "$MODDIR/updated"
33 | echo "$newid" > "$MODDIR/old.id"
34 | echo "$newpkg" > "$MODDIR/old.pkg"
35 | fi
36 |
37 | # 重建日志
38 | > "$log_file"
39 |
40 | log() {
41 | printf "[%s] %s\n" "$(date "+%Y-%m-%d %H:%M:%S")" "$1" >> "$log_file"
42 | }
43 |
44 | compile_package() {
45 | local mode="$1"
46 | local pkg="$2"
47 | cmd package compile -m "$mode" "$pkg"
48 | if [ "$?" = "0" ]; then
49 | log "应用$pkg编译成功!"
50 | echo "$pkg" >> "$done_file"
51 | else
52 | log "应用$pkg编译失败!"
53 | fi
54 | }
55 |
56 | compile_applications() {
57 | local app_type="$1"
58 | local app_mode="$2"
59 | local app_config="$3"
60 |
61 | if [ "$app_mode" != "无" ]; then
62 | log "$app_type应用编译模式:$app_mode"
63 |
64 | while IFS= read -r pkg; do
65 | compile_package "$app_mode" "$pkg"
66 | done < "$app_config"
67 | fi
68 | }
69 |
70 | if [ -e "$MODDIR/updated" ]; then
71 | # 开始执行dex2oat
72 | compile_applications "系统" "$system_app" "$MODDIR/sapp.txt"
73 | compile_applications "三方" "$tripartite_app" "$MODDIR/3app.txt"
74 | compile_applications "自选" "$optional_app" "$OPTIONALAPP_CONFIG"
75 |
76 | # 统计结果
77 | ends=$(grep -o '编译成功' "$log_file" | wc -l)
78 | endf=$(grep -o '编译失败' "$log_file" | wc -l)
79 | log "本次运行结果:成功:$ends;失败:$endf"
80 |
81 | rm -r "$MODDIR/updated"
82 | else
83 | log "没有更新"
84 | fi
85 |
--------------------------------------------------------------------------------
/module/customize.sh:
--------------------------------------------------------------------------------
1 | DEX2OAT_CONFIG="/data/adb/Dex2oatRUN/基础配置.prop"
2 | OPTIONALAPP_CONFIG="/data/adb/Dex2oatRUN/自选应用列表.prop"
3 |
4 | #创建配置文件
5 | mkdir -p /data/adb/Dex2oatRUN
6 | touch "$DEX2OAT_CONFIG"
7 | touch "$OPTIONALAPP_CONFIG"
8 | > "/data/adb/Dex2oatRUN/删除编译内容(会闪退,不影响).sh"
9 |
10 | cp "$MODPATH/删除编译内容.sh" "/data/adb/Dex2oatRUN/删除编译内容(会闪退,不影响).sh"
11 |
12 | #读取旧配置
13 | system_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^系统应用=" | cut -f2 -d '=')
14 | tripartite_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^三方应用=" | cut -f2 -d '=')
15 | optional_app=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^自选应用=" | cut -f2 -d '=')
16 | boot_operation=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^开机运行=" | cut -f2 -d '=')
17 | timing_operation=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^定时运行=" | cut -f2 -d '=')
18 | run_time=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^定时运行时间=" | cut -f2 -d '=')
19 | Optionalapp=$(cat "$OPTIONALAPP_CONFIG" | grep -v '^#')
20 |
21 | system_app="${system_app:-speed}"
22 | tripartite_app="${tripartite_app:-verify}"
23 | optional_app="${optional_app:-无}"
24 | boot_operation="${boot_operation:-是}"
25 | timing_operation="${timing_operation:-是}"
26 | run_time="${run_time:-00 00}"
27 |
28 | #写入配置
29 | echo "#基础配置:
30 | #可填:
31 | #无、verify、quicken、space-profile、space、speed-profile、speed、everything
32 | #越往后性能越好,占用空间越大。
33 | 系统应用=$system_app
34 | 三方应用=$tripartite_app
35 | 自选应用=$optional_app
36 | #运行模式:
37 | #填:是、否
38 | 开机运行=$boot_operation
39 | 定时运行=$timing_operation
40 | #定时服务的运行时间,前面是分,后面是时,例如12点: 00 12 记得空格。
41 | 定时运行时间=$run_time
42 | " > "$DEX2OAT_CONFIG"
43 | echo "#自选列表(填包名,一行一个):
44 | $Optionalapp
45 | " > "$OPTIONALAPP_CONFIG"
46 |
47 | ui_print "- 模块会根据配置自动执行dex2oat。"
48 | ui_print "- 配置及日志文件都在此文件夹下:/data/adb/Dex2oatBOOT"
49 |
--------------------------------------------------------------------------------
/module/module.prop:
--------------------------------------------------------------------------------
1 | id=Dex2oatRUN
2 | name=dex编译(dex2oat)
3 | versionCode=36
4 | author=林芸芸
5 | version=3.0.4_230701
6 | description=调用系统进行dex2oat编译,配置和日志所在文件夹:/data/adb/Dex2oatRUN
7 | updateJson=https://raw.githubusercontent.com/lin-yunyun/Dex2oatRUN/main/update.json
8 |
--------------------------------------------------------------------------------
/module/service.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | MODDIR=${0%/*}
3 |
4 | DEX2OAT_CONFIG="/data/adb/Dex2oatRUN/基础配置.prop"
5 |
6 | export PATH="$(magisk --path)/.magisk/busybox:$PATH"
7 |
8 | boot_operation=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^开机运行=" | cut -f2 -d '=')
9 | timing_operation=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^定时运行=" | cut -f2 -d '=')
10 | run_time=$(sed '/^#/d' "$DEX2OAT_CONFIG" | grep "^定时运行时间=" | cut -f2 -d '=')
11 |
12 | if [ "$boot_operation" = "是" ]; then
13 | sleep 120
14 |
15 | sh "$MODDIR/common.sh"
16 | fi
17 |
18 | if [ "$timing_operation" = "是" ]; then
19 | echo "$run_time * * * sh $MODDIR/common.sh" > "$MODDIR/cron.d/root"
20 |
21 | crond -c "$MODDIR/cron.d"
22 | fi
23 |
--------------------------------------------------------------------------------
/module/uninstall.sh:
--------------------------------------------------------------------------------
1 | rm -rf /data/adb/Dex2oatRUN
2 |
--------------------------------------------------------------------------------
/module/删除编译内容.sh:
--------------------------------------------------------------------------------
1 | log_file="/data/adb/Dex2oatRUN/日志.log"
2 |
3 | export PATH="$(magisk --path)/.magisk/busybox:$PATH"
4 |
5 | log() {
6 | printf "[%s] %s\n" "$(date "+%Y-%m-%d %H:%M:%S")" "$1" >> "$log_file"
7 | }
8 |
9 | cmd package compile --reset -a
10 |
11 | log "编译删除完毕"
12 |
--------------------------------------------------------------------------------
/update.json:
--------------------------------------------------------------------------------
1 | {
2 | "versionCode": 37,
3 | "version": "3.0.5",
4 | "zipUrl": "https://github.com/six-phase-snow/Dex2oatRUN/releases/download/3.0.5/Dex2oat_run.zip",
5 | "changelog": "https://raw.githubusercontent.com/six-phase-snow/Dex2oatRUN/main/changelog.md"
6 | }
7 |
8 |
--------------------------------------------------------------------------------