mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 20:01:17 +08:00
Compare commits
158 Commits
Download
...
1af01b391b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1af01b391b | ||
|
|
6108f9c4ba | ||
|
|
d709dd87e9 | ||
|
|
c0ae491954 | ||
|
|
a9c8528671 | ||
|
|
2761c288f8 | ||
|
|
a9cf0bcca0 | ||
|
|
9f92186e5f | ||
|
|
5197f11ecb | ||
|
|
396e9bf453 | ||
|
|
8e6485cd0f | ||
|
|
afb3316595 | ||
|
|
432ec13c05 | ||
|
|
f2f133c5b9 | ||
|
|
320a393a7c | ||
|
|
117c18b45e | ||
|
|
1ad1b75eff | ||
|
|
201d9550d2 | ||
|
|
1f0f2d31f2 | ||
|
|
0d34d3a4bb | ||
|
|
93f6eaf74d | ||
|
|
61b6dc448e | ||
|
|
cad773ec99 | ||
|
|
bfda4f0df3 | ||
|
|
e32718eedf | ||
|
|
b2e465ba3d | ||
|
|
919694fce7 | ||
|
|
f5ff3e78c4 | ||
|
|
3619fbf4d3 | ||
|
|
7acd0aaff8 | ||
|
|
785208c1ab | ||
|
|
d108f46a19 | ||
|
|
a44a29b7b7 | ||
|
|
29e9bb34ab | ||
|
|
1a15df5822 | ||
|
|
dad17170ff | ||
|
|
3aca588693 | ||
|
|
cd731f7a21 | ||
|
|
5e35cfb3e3 | ||
|
|
daa3c02d1a | ||
|
|
f83d439374 | ||
|
|
176682fa38 | ||
|
|
c02d9e1874 | ||
|
|
d8baadae59 | ||
|
|
d2035121ce | ||
|
|
b29bfb45f9 | ||
|
|
657c65164f | ||
|
|
5c3ca4caa4 | ||
|
|
08b4abf08c | ||
|
|
acdbd23248 | ||
|
|
2bed96532f | ||
|
|
314fc7b46f | ||
|
|
ff94fce5d0 | ||
|
|
d56d291e51 | ||
|
|
fc1800932b | ||
|
|
181869687e | ||
|
|
5ee5dd71b1 | ||
|
|
b6d8529624 | ||
|
|
243bc39dd6 | ||
|
|
4332ac6ed8 | ||
|
|
8309c9a69a | ||
|
|
62561d4c34 | ||
|
|
4c13ad4152 | ||
|
|
6f91cab9b8 | ||
|
|
ca2ffa4c3f | ||
|
|
f44f095c65 | ||
|
|
68c67d139b | ||
|
|
2b1eaf6634 | ||
|
|
c91a46cabb | ||
|
|
a7947d5a2f | ||
|
|
bb8150583c | ||
|
|
a4fe68c141 | ||
|
|
61f64ba7bb | ||
|
|
bfff5cc446 | ||
|
|
509fef5e06 | ||
|
|
f88ff6db15 | ||
|
|
2b352738f5 | ||
|
|
085b375dc6 | ||
|
|
7c13214e2d | ||
|
|
469f004baa | ||
|
|
eec755d642 | ||
|
|
14ca833ec1 | ||
|
|
8bcb89b04d | ||
|
|
f2df033393 | ||
|
|
ab41dea173 | ||
|
|
7d9f45b92f | ||
|
|
8c08466ed6 | ||
|
|
801ade5859 | ||
|
|
984b909197 | ||
|
|
0a6b114354 | ||
|
|
f6653aef78 | ||
|
|
1f7dbba6a8 | ||
|
|
87a2f04b65 | ||
|
|
25dba39daf | ||
|
|
7ad1bcb763 | ||
|
|
1aee169089 | ||
|
|
8eb42fdf38 | ||
|
|
fddf3ffb76 | ||
|
|
6e4e8ed97b | ||
|
|
e5e64821a8 | ||
|
|
8ab8330c94 | ||
|
|
7c8f061c30 | ||
|
|
406b1a740b | ||
|
|
54e3b0ab29 | ||
|
|
5fcb39bb58 | ||
|
|
bc9469a9b6 | ||
|
|
61b24111f1 | ||
|
|
a87bf7318b | ||
|
|
9bd6aee5e9 | ||
|
|
dfa47653f0 | ||
|
|
92b345af77 | ||
|
|
dfd1c660f5 | ||
|
|
d431798808 | ||
|
|
ff95c6d782 | ||
|
|
2f23263333 | ||
|
|
788e46cb39 | ||
|
|
fcfd29a86b | ||
|
|
3d4720fc42 | ||
|
|
2f26cedb2b | ||
|
|
6f30dcdac5 | ||
|
|
8488332cec | ||
|
|
157e087c99 | ||
|
|
ffdf296357 | ||
|
|
987f33b584 | ||
|
|
7cc2819307 | ||
|
|
a6df8ff014 | ||
|
|
8c13c702e9 | ||
|
|
fcf57c3796 | ||
|
|
830397a590 | ||
|
|
3fd32b4ec8 | ||
|
|
7a5c39620b | ||
|
|
05493d35d4 | ||
|
|
2f1930f704 | ||
|
|
1e6eb58dab | ||
|
|
11908a7381 | ||
|
|
117acc99f7 | ||
|
|
e3909c5996 | ||
|
|
da80efc8ba | ||
|
|
fabbd19929 | ||
|
|
e608c504fe | ||
|
|
b483ce52c8 | ||
|
|
2421b5d285 | ||
|
|
63e360cc62 | ||
|
|
d4d6605c7b | ||
|
|
dc7e45e4ad | ||
|
|
df72a5f363 | ||
|
|
cd0aaef385 | ||
|
|
b71fa8a15e | ||
|
|
323cb2bffa | ||
|
|
029ad43508 | ||
|
|
8c6deb16cf | ||
|
|
93bdeaba0b | ||
|
|
d2ff9d61e7 | ||
|
|
780db8dfa5 | ||
|
|
dcc26b0e43 | ||
|
|
eaaa802054 | ||
|
|
99f47443eb | ||
|
|
0433cbe5ab |
23
.github/workflows/android.yml
vendored
23
.github/workflows/android.yml
vendored
@@ -13,10 +13,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: set up JDK 11
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
- name: set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
@@ -32,24 +34,9 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.gradle/caches/build-cache-*
|
~/.gradle/caches/build-cache-*
|
||||||
key: gradle-builds-${{ github.sha }}
|
key: gradle-builds-${{ github.sha }}
|
||||||
|
|
||||||
- name: Init Submodule
|
- name: Init Submodule
|
||||||
run: |
|
run: |
|
||||||
git submodule init
|
git submodule init
|
||||||
git submodule update
|
git submodule update
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: bash ./gradlew assemble
|
run: bash ./gradlew :app:packageDebug
|
||||||
|
|
||||||
- name: Upload Release APK
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: SimplicityTools_Release
|
|
||||||
path: "app/build/outputs/apk/release/*.apk"
|
|
||||||
|
|
||||||
- name: Upload Debug APK
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: Simplicity Tools_Debug
|
|
||||||
path: "app/build/outputs/apk/debug/*.apk"
|
|
||||||
|
|
||||||
|
|||||||
98
README.md
98
README.md
@@ -1,6 +1,6 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
|
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
|
||||||
<h1>Simplicity Tools</h1>
|
<h1>WooBox For MIUI</h1>
|
||||||
<p>
|
<p>
|
||||||
<b><a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README_EN.md">English</a> 丨 简体中文</b>
|
<b><a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README_EN.md">English</a> 丨 简体中文</b>
|
||||||
</p>
|
</p>
|
||||||
@@ -15,100 +15,12 @@
|
|||||||
|
|
||||||
### 模块说明
|
### 模块说明
|
||||||
|
|
||||||
仅支持MIUI13(Android12)。其余版本可能无效,请不要安装使用。
|
仅支持MIUI13(Android12),其余版本无法使用。
|
||||||
目前处于开发初期阶段,功能较少,后续将逐步完善。
|
|
||||||
|
|
||||||
开发者:[酷安@乌堆小透明](http://www.coolapk.com/u/883441)
|
开发者:[酷安@乌堆小透明](http://www.coolapk.com/u/883441)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 已实现功能
|
|
||||||
<details>
|
|
||||||
<summary>点击展开详情</summary>
|
|
||||||
|
|
||||||
- 状态栏
|
|
||||||
- 状态栏网速秒刷新
|
|
||||||
- 隐藏状态栏电量(%)
|
|
||||||
- 隐藏状态栏网速(/s)单位
|
|
||||||
- 解除通知图标个数上限
|
|
||||||
- 状态栏布局
|
|
||||||
- 时间居中
|
|
||||||
- 兼容模式
|
|
||||||
- 左边距自定义
|
|
||||||
- 右边距自定义
|
|
||||||
- 状态栏时钟格式
|
|
||||||
- 显示年份开关
|
|
||||||
- 显示月份开关
|
|
||||||
- 显示日期开关
|
|
||||||
- 显示星期开关
|
|
||||||
- 显示时辰开关
|
|
||||||
- 显示时段开关
|
|
||||||
- 显示秒数开关
|
|
||||||
- 隐藏间隔开关
|
|
||||||
- 双行显示开关
|
|
||||||
- 时钟大小自定义
|
|
||||||
- 双排时钟大小自定义
|
|
||||||
- 状态栏图标
|
|
||||||
- 隐藏电池图标开关
|
|
||||||
- 隐藏充电图标开关
|
|
||||||
- 隐藏GPS图标开关
|
|
||||||
- 隐藏蓝牙图标开关
|
|
||||||
- 隐藏蓝牙电量图标开关
|
|
||||||
- 隐藏小HD图标开关
|
|
||||||
- 隐藏大HD图标开关
|
|
||||||
- 隐藏HD无服务开关
|
|
||||||
- 隐藏SIM卡一图标开关
|
|
||||||
- 隐藏SIM卡二图标开关
|
|
||||||
- 隐藏无SIM卡图标开关
|
|
||||||
- 隐藏移动类型图标开关
|
|
||||||
- 隐藏移动箭头图标开关
|
|
||||||
- 隐藏WIFI图标开关
|
|
||||||
- 隐藏WIFI箭头开关
|
|
||||||
- 隐藏WIFI标准开关
|
|
||||||
- 隐藏WiFi辅助图标开关
|
|
||||||
- 隐藏WIFI热点图标开关
|
|
||||||
- 隐藏VPN图标开关
|
|
||||||
- 隐藏飞行模式图标开关
|
|
||||||
- 隐藏闹钟图标开关
|
|
||||||
- 隐藏耳机图标开关
|
|
||||||
- 隐藏声音、勿扰图标开关
|
|
||||||
- 隐藏网速分隔符
|
|
||||||
- 通知面板
|
|
||||||
- 显示天气开关
|
|
||||||
- 显示天气地区开关
|
|
||||||
- 控制中心
|
|
||||||
- 显示天气开关
|
|
||||||
- 显示天气地区开关
|
|
||||||
- 锁屏
|
|
||||||
- 移除锁屏侧边功能
|
|
||||||
- 移除锁屏相机功能
|
|
||||||
- 桌面
|
|
||||||
- 始终显示桌面时钟
|
|
||||||
- 系统框架
|
|
||||||
- 移除上层显示通知
|
|
||||||
- 允许截图(支持磁贴)
|
|
||||||
- 解除安装限制(支持降级、不同签名、无签名安装)
|
|
||||||
- 解除不支持小窗应用限制
|
|
||||||
- 性能
|
|
||||||
- 锁定当前刷新率上限(支持磁贴)
|
|
||||||
- 防止恢复电池优化白名单
|
|
||||||
- 手机管家
|
|
||||||
- 跳过5/10秒警告时间
|
|
||||||
- 锁定 100 分
|
|
||||||
- 去除游戏自动连招黑名单
|
|
||||||
- 相册编辑
|
|
||||||
- 解锁无限裁切图片/截图功能
|
|
||||||
- 系统更新
|
|
||||||
- 移除OTA验证
|
|
||||||
- 设置
|
|
||||||
- 显示通知重要程度
|
|
||||||
- 去广告
|
|
||||||
- 移除主题壁纸广告
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 模块截图
|
### 模块截图
|
||||||

|

|
||||||
|
|
||||||
@@ -128,10 +40,16 @@ Xposed仓库下载:[点击此处下载最新发行版](https://github.com/Xpos
|
|||||||
---
|
---
|
||||||
|
|
||||||
### 第三方开源引用
|
### 第三方开源引用
|
||||||
|
##### GNU General Public License v3.0
|
||||||
|
[qqlittleice/MiuiHome](https://github.com/qqlittleice/MiuiHome)
|
||||||
|
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
|
||||||
|
[Mikanoshi/CustoMIUIzer](https://code.highspec.ru/Mikanoshi/CustoMIUIzer)
|
||||||
##### GNU General Public License v2.0
|
##### GNU General Public License v2.0
|
||||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||||
##### GNU Lesser General Public License v2.1
|
##### GNU Lesser General Public License v2.1
|
||||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||||
|
##### Apache License 2.0
|
||||||
|
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
100
README_EN.md
100
README_EN.md
@@ -1,6 +1,6 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
|
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
|
||||||
<h1>Simplicity Tools</h1>
|
<h1>WooBox For MIUI</h1>
|
||||||
<p>
|
<p>
|
||||||
<b>English 丨 <a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README.md">简体中文</a></b>
|
<b>English 丨 <a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README.md">简体中文</a></b>
|
||||||
</p>
|
</p>
|
||||||
@@ -15,95 +15,7 @@
|
|||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
Only MIUI13 (Android12) is supported. The rest of the versions may not be valid, please do not install and use.
|
Only MIUI13 (Android12) is supported. The rest of the versions not be valid.
|
||||||
It is in the early stage of development, with fewer functions, and will be improved gradually.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Features
|
|
||||||
<details>
|
|
||||||
<summary>Click to expand details</summary>
|
|
||||||
|
|
||||||
- Status Bar
|
|
||||||
- Status bar web speed second refresh
|
|
||||||
- Hide status bar power (%)
|
|
||||||
- Hide status bar speed (/) unit
|
|
||||||
- Unlock the maximum number of notification icons
|
|
||||||
- Status bar layout
|
|
||||||
- Time centered
|
|
||||||
- Compatible mode
|
|
||||||
- Left margin customization
|
|
||||||
- Right margin customization
|
|
||||||
- Status bar clock format
|
|
||||||
- Show year switch
|
|
||||||
- Show month switch
|
|
||||||
- Show date switch
|
|
||||||
- Show day switch
|
|
||||||
- Show chinese twelve hour switch
|
|
||||||
- Display AM/PM switch
|
|
||||||
- Display seconds switch
|
|
||||||
- Hide space switch
|
|
||||||
- Double line display switch
|
|
||||||
- Clock size customization
|
|
||||||
- Double row clock size customization
|
|
||||||
- Status bar icons
|
|
||||||
- Hide battery icon switch
|
|
||||||
- Hide charging icon switch
|
|
||||||
- Hide GPS icon switch
|
|
||||||
- Hide Bluetooth icon switch
|
|
||||||
- Hide Bluetooth power icon switch
|
|
||||||
- Hide small HD icon switch
|
|
||||||
- Hide large HD icon switch
|
|
||||||
- Hide HD no service switch
|
|
||||||
- Hide SIM card one icon switch
|
|
||||||
- Hide SIM card two icon switch
|
|
||||||
- Hide SIM-less icon switch
|
|
||||||
- Hide mobile type icon switch
|
|
||||||
- Hide mobile arrow icon switch
|
|
||||||
- Hide WIFI icon switch
|
|
||||||
- Hide WIFI arrow switch
|
|
||||||
- Hide WIFI standard switch
|
|
||||||
- Hide WiFi auxiliary icon switch
|
|
||||||
- Hide WIFI hotspot icon switch
|
|
||||||
- Hide VPN icon switch
|
|
||||||
- Hide Airplane Mode icon switch
|
|
||||||
- Hide alarm clock icon switch
|
|
||||||
- Hide headset icon switch
|
|
||||||
- Hide sound, do not disturb icon switch
|
|
||||||
- Hide internet speed separator
|
|
||||||
- Notification panel
|
|
||||||
- Show weather switch
|
|
||||||
- Show weather area switch
|
|
||||||
- Control Center
|
|
||||||
- Show weather switch
|
|
||||||
- Show weather area switch
|
|
||||||
- Lock Screen
|
|
||||||
- Remove lock screen side function
|
|
||||||
- Remove lock screen camera function
|
|
||||||
- Home
|
|
||||||
- Always show desktop clock
|
|
||||||
- System Framework
|
|
||||||
- Remove upper display notifications
|
|
||||||
- Allow screenshots (tile support)
|
|
||||||
- CorePatch (support downgrade, different signature, unsigned installation)
|
|
||||||
- Unlock unsupported small windows applications
|
|
||||||
- Nature
|
|
||||||
- Lock current refresh rate cap (tile support)
|
|
||||||
- Prevent recovery of battery optimization whitelist
|
|
||||||
- Phone Manager
|
|
||||||
- Skip 5/10 seconds warning time
|
|
||||||
- Lock 100 points
|
|
||||||
- Remove game macro blacklist
|
|
||||||
- Album editing
|
|
||||||
- Unlock unlimited crop image/screenshot function
|
|
||||||
- System Update
|
|
||||||
- Remove OTA authentication
|
|
||||||
- Settings
|
|
||||||
- Show notification importance
|
|
||||||
- Remove Ads
|
|
||||||
- Remove theme manager ads
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -119,16 +31,22 @@ Xposed Repo:[Click here to download the latest release](https://github.com/Xpo
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 改进翻译
|
### Participate in translation
|
||||||
[](https://crowdin.com/project/simplicitytools)[Click here to Crowdin](https://crowdin.com/project/simplicitytools)
|
[](https://crowdin.com/project/simplicitytools)[Click here to Crowdin](https://crowdin.com/project/simplicitytools)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Third party open source references
|
## Third party open source references
|
||||||
|
##### GNU General Public License v3.0
|
||||||
|
[qqlittleice/MiuiHome](https://github.com/qqlittleice/MiuiHome)
|
||||||
|
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
|
||||||
|
[Mikanoshi/CustoMIUIzer](https://code.highspec.ru/Mikanoshi/CustoMIUIzer)
|
||||||
##### GNU General Public License v2.0
|
##### GNU General Public License v2.0
|
||||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||||
##### GNU Lesser General Public License v2.1
|
##### GNU Lesser General Public License v2.1
|
||||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||||
|
##### Apache License 2.0
|
||||||
|
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId = "com.lt2333.simplicitytools"
|
applicationId = "com.lt2333.simplicitytools"
|
||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 32
|
targetSdk = 32
|
||||||
versionCode = 42
|
versionCode = 65
|
||||||
versionName = "1.4.1"
|
versionName = "1.6.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@@ -45,7 +45,7 @@ android {
|
|||||||
applicationVariants.all {
|
applicationVariants.all {
|
||||||
outputs.all {
|
outputs.all {
|
||||||
(this as BaseVariantOutputImpl).outputFileName =
|
(this as BaseVariantOutputImpl).outputFileName =
|
||||||
"Simplicity_Tools_Xposed-$versionName-$name.apk"
|
"WooBoxForMIUI-$versionName-$name.apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@@ -23,6 +23,12 @@
|
|||||||
public void *(de.robv.android.xposed.callbacks.XC_LoadPackage$LoadPackageParam);
|
public void *(de.robv.android.xposed.callbacks.XC_LoadPackage$LoadPackageParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-keep class * implements de.robv.android.xposed.IXposedHookZygoteInit {
|
||||||
|
public void *(de.robv.android.xposed.IXposedHookZygoteInit$StartupParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class * extends com.lt2333.simplicitytools.util.xposed.EasyXposedInit
|
||||||
|
|
||||||
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
||||||
public static void check*(...);
|
public static void check*(...);
|
||||||
public static void throw*(...);
|
public static void throw*(...);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
android:label="WooBox"
|
||||||
android:name=".launcher"
|
android:name=".launcher"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
com.lt2333.simplicitytools.hook.MainHook
|
com.lt2333.simplicitytools.hook.XposedEntry
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 45 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,38 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook
|
|
||||||
|
|
||||||
import com.github.kyuubiran.ezxhelper.init.EzXHelperInit
|
|
||||||
import com.lt2333.simplicitytools.BuildConfig
|
|
||||||
import com.lt2333.simplicitytools.hook.app.*
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.XSharedPreferences
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
|
||||||
|
|
||||||
class MainHook : IXposedHookLoadPackage {
|
|
||||||
private var prefs = XSharedPreferences(BuildConfig.APPLICATION_ID, "config")
|
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
|
||||||
if (prefs.getBoolean("main_switch", true)) {
|
|
||||||
EzXHelperInit.initHandleLoadPackage(lpparam)
|
|
||||||
EzXHelperInit.setEzClassLoader(lpparam.classLoader)
|
|
||||||
when (lpparam.packageName) {
|
|
||||||
//Android
|
|
||||||
"android" -> Android().handleLoadPackage(lpparam)
|
|
||||||
//系统界面
|
|
||||||
"com.android.systemui" -> SystemUI().handleLoadPackage(lpparam)
|
|
||||||
//电量与性能
|
|
||||||
"com.miui.powerkeeper" -> PowerKeeper().handleLoadPackage(lpparam)
|
|
||||||
//桌面
|
|
||||||
"com.miui.home" -> MiuiHome().handleLoadPackage(lpparam)
|
|
||||||
//手机管家
|
|
||||||
"com.miui.securitycenter" -> SecurityCenter().handleLoadPackage(lpparam)
|
|
||||||
//相册编辑
|
|
||||||
"com.miui.mediaeditor" -> MediaEditor().handleLoadPackage(lpparam)
|
|
||||||
//系统更新
|
|
||||||
"com.android.updater" -> Updater().handleLoadPackage(lpparam)
|
|
||||||
//设置
|
|
||||||
"com.android.settings" -> Settings().handleLoadPackage(lpparam)
|
|
||||||
//主题壁纸
|
|
||||||
"com.android.thememanager" -> ThemeManager().handleLoadPackage(lpparam)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.BuildConfig
|
||||||
|
import com.lt2333.simplicitytools.hook.app.*
|
||||||
|
import com.lt2333.simplicitytools.hook.app.android.corepatch.CorePatch
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.EasyXposedInit
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
|
import de.robv.android.xposed.IXposedHookZygoteInit
|
||||||
|
import de.robv.android.xposed.XSharedPreferences
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
class XposedEntry : EasyXposedInit() {
|
||||||
|
private var prefs = XSharedPreferences(BuildConfig.APPLICATION_ID, "config")
|
||||||
|
|
||||||
|
override val registeredApp: List<AppRegister> = listOf(
|
||||||
|
Android, // Android
|
||||||
|
SystemUI, // 系统界面
|
||||||
|
PowerKeeper, // 电量与性能
|
||||||
|
MiuiHome, // 桌面
|
||||||
|
SecurityCenter, // 手机管家
|
||||||
|
MediaEditor, // 相册编辑
|
||||||
|
Updater, // 系统更新
|
||||||
|
Settings, // 设置
|
||||||
|
ThemeManager, // 主题壁纸
|
||||||
|
ScreenShot, // 截屏
|
||||||
|
Cast, //投屏
|
||||||
|
RearDisplay, //背屏
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
|
||||||
|
if (prefs.getBoolean("main_switch", true)) {
|
||||||
|
super.handleLoadPackage(lpparam)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initZygote(startupParam: IXposedHookZygoteInit.StartupParam?) {
|
||||||
|
super.initZygote(startupParam)
|
||||||
|
CorePatch().initZygote(startupParam)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,26 +1,30 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.android.DeleteOnPostNotification
|
import com.lt2333.simplicitytools.hook.app.android.*
|
||||||
import com.lt2333.simplicitytools.hook.app.android.DisableFlagSecure
|
|
||||||
import com.lt2333.simplicitytools.hook.app.android.MaxWallpaperScale
|
|
||||||
import com.lt2333.simplicitytools.hook.app.android.RemoveSmallWindowRestrictions
|
|
||||||
import com.lt2333.simplicitytools.hook.app.android.corepatch.CorePatch
|
import com.lt2333.simplicitytools.hook.app.android.corepatch.CorePatch
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class Android : IXposedHookLoadPackage {
|
object Android : AppRegister() {
|
||||||
|
override val packageName: String = "android"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||||
//核心破解
|
//核心破解
|
||||||
CorePatch().handleLoadPackage(lpparam)
|
CorePatch().handleLoadPackage(lpparam)
|
||||||
//允许截图
|
|
||||||
DisableFlagSecure().handleLoadPackage(lpparam)
|
autoInitHooks(
|
||||||
//上层显示
|
lpparam,
|
||||||
DeleteOnPostNotification().handleLoadPackage(lpparam)
|
DisableFlagSecure, //允许截图
|
||||||
//解除小窗限制
|
DeleteOnPostNotification, //上层显示
|
||||||
RemoveSmallWindowRestrictions().handleLoadPackage(lpparam)
|
RemoveSmallWindowRestrictions, //解除小窗限制
|
||||||
//壁纸缩放比例
|
MaxWallpaperScale, //壁纸缩放比例
|
||||||
MaxWallpaperScale().handleLoadPackage(lpparam)
|
SystemPropertiesHook, //SystemPropertiesHook
|
||||||
|
AllowUntrustedTouches, //允许不受信任的触摸
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.hook.app.cast.ForceSupportSendApp
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
|
import de.robv.android.xposed.XposedBridge
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
object Cast: AppRegister() {
|
||||||
|
override val packageName: String = "com.milink.service"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
ForceSupportSendApp, //强制允许所有应用接力
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.mediaeditor.UnlockUnlimitedCropping
|
import com.lt2333.simplicitytools.hook.app.mediaeditor.UnlockUnlimitedCropping
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class MediaEditor : IXposedHookLoadPackage {
|
object MediaEditor: AppRegister() {
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override val packageName: String = "com.miui.mediaeditor"
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
override val processName: List<String> = emptyList()
|
||||||
//解锁裁切最小值
|
override val logTag: String = "WooBox"
|
||||||
UnlockUnlimitedCropping().handleLoadPackage(lpparam)
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
UnlockUnlimitedCropping, //解锁裁切最小值
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.miuihome.AlwaysDisplayTime
|
import com.lt2333.simplicitytools.hook.app.miuihome.AlwaysDisplayTime
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.hook.app.miuihome.DoubleTapToSleep
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class MiuiHome : IXposedHookLoadPackage {
|
object MiuiHome: AppRegister() {
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override val packageName: String = "com.miui.home"
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
override val processName: List<String> = emptyList()
|
||||||
//时钟显示时钟
|
override val logTag: String = "WooBox"
|
||||||
AlwaysDisplayTime().handleLoadPackage(lpparam)
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
AlwaysDisplayTime, //时钟显示时钟
|
||||||
|
DoubleTapToSleep, //双击锁屏
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,18 +2,20 @@ package com.lt2333.simplicitytools.hook.app
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.powerkeeper.LockMaxFps
|
import com.lt2333.simplicitytools.hook.app.powerkeeper.LockMaxFps
|
||||||
import com.lt2333.simplicitytools.hook.app.powerkeeper.PreventRecoveryOfBatteryOptimizationWhitelist
|
import com.lt2333.simplicitytools.hook.app.powerkeeper.PreventRecoveryOfBatteryOptimizationWhitelist
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class PowerKeeper : IXposedHookLoadPackage {
|
object PowerKeeper: AppRegister() {
|
||||||
|
override val packageName: String = "com.miui.powerkeeper"
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override val processName: List<String> = emptyList()
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
override val logTag: String = "WooBox"
|
||||||
//锁定最高刷新率
|
|
||||||
LockMaxFps().handleLoadPackage(lpparam)
|
|
||||||
//防止恢复电池优化白名单
|
|
||||||
PreventRecoveryOfBatteryOptimizationWhitelist().handleLoadPackage(lpparam)
|
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
LockMaxFps, //锁定最高刷新率
|
||||||
|
PreventRecoveryOfBatteryOptimizationWhitelist, //防止恢复电池优化白名单
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.hook.app.cast.RearDisplayWeather
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
|
import de.robv.android.xposed.XposedBridge
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
object RearDisplay: AppRegister() {
|
||||||
|
override val packageName: String = "com.xiaomi.misubscreenui"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
RearDisplayWeather, //背屏显示天气
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.hook.app.screenshot.UnlockUnlimitedCropping
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
|
import de.robv.android.xposed.XposedBridge
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
object ScreenShot: AppRegister() {
|
||||||
|
override val packageName: String = "com.miui.screenshot"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
UnlockUnlimitedCropping, //锁定最高刷新率
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.securitycenter.LockOneHundred
|
import com.lt2333.simplicitytools.hook.app.securitycenter.*
|
||||||
import com.lt2333.simplicitytools.hook.app.securitycenter.RemoveMacroBlacklist
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import com.lt2333.simplicitytools.hook.app.securitycenter.ShowBatteryTemperature
|
|
||||||
import com.lt2333.simplicitytools.hook.app.securitycenter.SkipWaitingTime
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class SecurityCenter : IXposedHookLoadPackage {
|
object SecurityCenter: AppRegister() {
|
||||||
|
override val packageName: String = "com.miui.securitycenter"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||||
//跳过 5/10秒等待时间
|
autoInitHooks(lpparam,
|
||||||
SkipWaitingTime().handleLoadPackage(lpparam)
|
SkipWaitingTime, //跳过 5/10秒等待时间
|
||||||
//锁定 100分
|
LockOneHundred, //锁定 100分
|
||||||
LockOneHundred().handleLoadPackage(lpparam)
|
RemoveMacroBlacklist, //去除自动连招黑名单
|
||||||
//去除自动连招黑名单
|
ShowBatteryTemperature, //显示电池温度
|
||||||
RemoveMacroBlacklist().handleLoadPackage(lpparam)
|
RemoveOpenAppConfirmationPopup, //去除打开应用弹窗
|
||||||
//显示电池温度
|
)
|
||||||
ShowBatteryTemperature().handleLoadPackage(lpparam)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.settings.ShowNotificationImportance
|
import com.lt2333.simplicitytools.hook.app.settings.ShowNotificationImportance
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class Settings: IXposedHookLoadPackage {
|
object Settings: AppRegister() {
|
||||||
|
override val packageName: String = "com.android.settings"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
ShowNotificationImportance().handleLoadPackage(lpparam)
|
autoInitHooks(lpparam,
|
||||||
|
ShowNotificationImportance, //显示通知重要程度
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,75 +1,47 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.systemui.*
|
import com.lt2333.simplicitytools.hook.app.systemui.*
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class SystemUI : IXposedHookLoadPackage {
|
object SystemUI: AppRegister() {
|
||||||
|
override val packageName: String = "com.android.systemui"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
//隐藏飞行模式图标
|
autoInitHooks(lpparam,
|
||||||
HideAirplaneIcon().handleLoadPackage(lpparam)
|
HideStatusBarIcon, //隐藏状态栏图标
|
||||||
//隐藏闹钟图标
|
HideBatteryIcon, //隐藏电池
|
||||||
HideAlarmIcon().handleLoadPackage(lpparam)
|
HideHDIcon, //隐藏HD图标
|
||||||
//隐藏电池
|
HideSimIcon, //隐藏SIM卡图标
|
||||||
HideBatteryIcon().handleLoadPackage(lpparam)
|
HideMobileActivityIcon, //隐藏移动箭头图标
|
||||||
//隐藏蓝牙电量
|
HideMobileTypeIcon, //隐藏移动类型图标
|
||||||
HideBluetoothHandsfreeBatteryIcon().handleLoadPackage(lpparam)
|
HideStatusBarNetworkSpeedSecond, //隐藏状态栏网速/s
|
||||||
//隐藏蓝牙图标
|
HideWifiActivityIcon, //隐藏WIFI活动箭头图标
|
||||||
HideBluetoothIcon().handleLoadPackage(lpparam)
|
MaximumNumberOfNotificationIcons, //通知图标上限
|
||||||
//隐藏GPS图标
|
StatusBarNetworkSpeedRefreshSpeed, //状态栏网速秒刷新
|
||||||
HideGPSIcon().handleLoadPackage(lpparam)
|
StatusBarTimeCustomization, //状态栏时钟自定义
|
||||||
//隐藏HD图标
|
RemoveTheLeftSideOfTheLockScreen, //移除锁屏负一屏功能
|
||||||
HideHDIcon().handleLoadPackage(lpparam)
|
RemoveLockScreenCamera, //移除锁屏相机功能
|
||||||
//隐藏耳机图标
|
NotificationWeather, //通知面板天气
|
||||||
HideHeadsetIcon().handleLoadPackage(lpparam)
|
OldNotificationWeather,
|
||||||
//隐藏热点图标
|
ControlCenterWeather, //控制中心天气
|
||||||
HideHotspotIcon().handleLoadPackage(lpparam)
|
//StatusBarCurrent, //TODO:状态栏电流
|
||||||
//隐藏无SIM卡图标
|
StatusBarLayout, //状态栏布局
|
||||||
HideNoSimIcon().handleLoadPackage(lpparam)
|
HideNetworkSpeedSplitter, //隐藏时钟与实时网速之间的分隔符
|
||||||
//隐藏SIM卡图标
|
WaveCharge, //Alpha充电动画
|
||||||
HideSimIcon().handleLoadPackage(lpparam)
|
LockScreenCurrent, //锁屏电流
|
||||||
//隐藏移动箭头图标
|
LockScreenDoubleTapToSleep, //锁屏下双击锁屏
|
||||||
HideMobileActivityIcon().handleLoadPackage(lpparam)
|
StatusBarDoubleTapToSleep, //双击状态栏锁屏
|
||||||
//隐藏移动类型图标
|
OldQSCustom, //旧版快速设置自定义
|
||||||
HideMobileTypeIcon().handleLoadPackage(lpparam)
|
DoubleLineNetworkSpeed, //双排网速
|
||||||
//隐藏辅助WIFI图标
|
StatusBarBigMobileTypeIcon, //大移动类型
|
||||||
HideSlaveWifiIcon().handleLoadPackage(lpparam)
|
BatteryPercentage, //电量百分比
|
||||||
//隐藏状态栏网速/s
|
CustomMobileTypeText, //自定义移动类型文本
|
||||||
HideStatusBarNetworkSpeedSecond().handleLoadPackage(lpparam)
|
LockScreenClockDisplaySeconds, // 锁屏时钟显示秒
|
||||||
//隐藏音量勿扰图标
|
)
|
||||||
HideVolumeZenIcon().handleLoadPackage(lpparam)
|
|
||||||
//隐藏VPN图标
|
|
||||||
HideVpnIcon().handleLoadPackage(lpparam)
|
|
||||||
//隐藏WIFI图标
|
|
||||||
HideWifiIcon().handleLoadPackage(lpparam)
|
|
||||||
//隐藏WIFI活动箭头图标
|
|
||||||
HideWifiActivityIcon().handleLoadPackage(lpparam)
|
|
||||||
//移除通知图标上限
|
|
||||||
RemoveTheMaximumNumberOfNotificationIcons().handleLoadPackage(lpparam)
|
|
||||||
//状态栏网速秒刷新
|
|
||||||
StatusBarNetworkSpeedRefreshSpeed().handleLoadPackage(lpparam)
|
|
||||||
//状态栏时钟自定义
|
|
||||||
StatusBarTimeCustomization().handleLoadPackage(lpparam)
|
|
||||||
//移除锁屏负一屏功能
|
|
||||||
RemoveTheLeftSideOfTheLockScreen().handleLoadPackage(lpparam)
|
|
||||||
//移除锁屏相机功能
|
|
||||||
RemoveLockScreenCamera().handleLoadPackage(lpparam)
|
|
||||||
//通知面板天气
|
|
||||||
NotificationWeather().handleLoadPackage(lpparam)
|
|
||||||
OldNotificationWeather().handleLoadPackage(lpparam)
|
|
||||||
//控制中心天气
|
|
||||||
ControlCenterWeather().handleLoadPackage(lpparam)
|
|
||||||
//TODO:状态栏电流
|
|
||||||
//StatusBarCurrent().handleLoadPackage(lpparam)
|
|
||||||
//状态栏布局
|
|
||||||
StatusBarLayout().handleLoadPackage(lpparam)
|
|
||||||
//隐藏时钟与实时网速之间的分隔符
|
|
||||||
HideNetworkSpeedSplitter().handleLoadPackage(lpparam)
|
|
||||||
//Alpha充电动画
|
|
||||||
WaveCharge().handleLoadPackage(lpparam)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.thememanager.RemoveAds
|
import com.lt2333.simplicitytools.hook.app.thememanager.RemoveAds
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class ThemeManager : IXposedHookLoadPackage {
|
object ThemeManager: AppRegister() {
|
||||||
override fun handleLoadPackage(lpparam: LoadPackageParam) {
|
override val packageName: String = "com.android.thememanager"
|
||||||
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
|
override val processName: List<String> = emptyList()
|
||||||
//移除主题壁纸的广告
|
override val logTag: String = "WooBox"
|
||||||
RemoveAds().handleLoadPackage(lpparam)
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||||
|
autoInitHooks(lpparam,
|
||||||
|
RemoveAds, //移除主题壁纸的广告
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,15 @@ package com.lt2333.simplicitytools.hook.app
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
class Updater : IXposedHookLoadPackage {
|
object Updater: AppRegister() {
|
||||||
|
override val packageName: String = "com.android.updater"
|
||||||
|
override val processName: List<String> = emptyList()
|
||||||
|
override val logTag: String = "WooBox"
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
if (XSPUtils.getBoolean("remove_ota_validate", false)) {
|
if (XSPUtils.getBoolean("remove_ota_validate", false)) {
|
||||||
var letter = 'a'
|
var letter = 'a'
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.android
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object AllowUntrustedTouches : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("allow_untrusted_touches") {
|
||||||
|
"android.hardware.input.InputManager".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"getBlockUntrustedTouchesMode",
|
||||||
|
Context::class.java
|
||||||
|
) {
|
||||||
|
it.result = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,15 +2,16 @@ package com.lt2333.simplicitytools.hook.app.android
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class DeleteOnPostNotification : IXposedHookLoadPackage {
|
object DeleteOnPostNotification : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.server.wm.AlertWindowNotification".hookBeforeMethod(lpparam.classLoader, "onPostNotification") {
|
override fun init() {
|
||||||
|
"com.android.server.wm.AlertWindowNotification".hookBeforeMethod(getDefaultClassLoader(), "onPostNotification") {
|
||||||
hasEnable("delete_on_post_notification") {
|
hasEnable("delete_on_post_notification") {
|
||||||
it.result = null
|
it.result = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,16 @@ package com.lt2333.simplicitytools.hook.app.android
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class DisableFlagSecure : IXposedHookLoadPackage {
|
object DisableFlagSecure : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.server.wm.WindowState".hookBeforeMethod(lpparam.classLoader, "isSecureLocked") {
|
override fun init() {
|
||||||
|
"com.android.server.wm.WindowState".hookBeforeMethod(getDefaultClassLoader(), "isSecureLocked") {
|
||||||
hasEnable("disable_flag_secure") {
|
hasEnable("disable_flag_secure") {
|
||||||
it.result = false
|
it.result = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,17 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.android
|
package com.lt2333.simplicitytools.hook.app.android
|
||||||
|
|
||||||
import android.app.Service
|
|
||||||
import android.icu.text.DisplayContext
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import com.lt2333.simplicitytools.util.setFloatField
|
import com.lt2333.simplicitytools.util.setFloatField
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class MaxWallpaperScale : IXposedHookLoadPackage {
|
object MaxWallpaperScale : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.server.wm.WallpaperController".hookAfterMethod(lpparam.classLoader, "WallpaperController", Service::class.java, DisplayContext::class.java
|
override fun init() {
|
||||||
) {
|
"com.android.server.wm.WallpaperController".hookBeforeMethod(getDefaultClassLoader(), "zoomOutToScale", Float::class.java) {
|
||||||
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.1f)
|
|
||||||
it.thisObject.setFloatField("mMaxWallpaperScale", value)
|
|
||||||
}
|
|
||||||
"com.android.server.wm.WallpaperController".hookBeforeMethod(lpparam.classLoader, "zoomOutToScale", Float::class.java) {
|
|
||||||
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.1f)
|
val value = XSPUtils.getFloat("max_wallpaper_scale", 1.1f)
|
||||||
it.thisObject.setFloatField("mMaxWallpaperScale", value)
|
it.thisObject.setFloatField("mMaxWallpaperScale", value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,36 +4,35 @@ import android.content.Context
|
|||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveSmallWindowRestrictions : IXposedHookLoadPackage {
|
object RemoveSmallWindowRestrictions : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
// 强制所有活动设为可以调整大小
|
// 强制所有活动设为可以调整大小
|
||||||
"com.android.server.wm.Task".hookBeforeMethod(lpparam.classLoader, "isResizeable") {
|
"com.android.server.wm.Task".hookBeforeMethod(getDefaultClassLoader(), "isResizeable") {
|
||||||
hasEnable("remove_small_window_restrictions") {
|
hasEnable("remove_small_window_restrictions") {
|
||||||
it.result = true
|
it.result = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"android.util.MiuiMultiWindowAdapter".hookAfterMethod(lpparam.classLoader, "getFreeformBlackList") {
|
"android.util.MiuiMultiWindowAdapter".hookAfterMethod(getDefaultClassLoader(), "getFreeformBlackList") {
|
||||||
hasEnable("remove_small_window_restrictions") {
|
hasEnable("remove_small_window_restrictions") {
|
||||||
it.result = (it.result as MutableList<*>).apply { clear() }
|
it.result = (it.result as MutableList<*>).apply { clear() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"android.util.MiuiMultiWindowAdapter".hookAfterMethod(lpparam.classLoader, "getFreeformBlackListFromCloud", Context::class.java) {
|
"android.util.MiuiMultiWindowAdapter".hookAfterMethod(getDefaultClassLoader(), "getFreeformBlackListFromCloud", Context::class.java) {
|
||||||
hasEnable("remove_small_window_restrictions") {
|
hasEnable("remove_small_window_restrictions") {
|
||||||
it.result = (it.result as MutableList<*>).apply { clear() }
|
it.result = (it.result as MutableList<*>).apply { clear() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"android.util.MiuiMultiWindowUtils".hookAfterMethod(lpparam.classLoader, "supportFreeform") {
|
"android.util.MiuiMultiWindowUtils".hookAfterMethod(getDefaultClassLoader(), "supportFreeform") {
|
||||||
hasEnable("remove_small_window_restrictions") {
|
hasEnable("remove_small_window_restrictions") {
|
||||||
it.result = true
|
it.result = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.android
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object SystemPropertiesHook : HookRegister() {
|
||||||
|
override fun init() {
|
||||||
|
val mediaStepsSwitch = XSPUtils.getBoolean("media_volume_steps_switch", false)
|
||||||
|
val mediaSteps = XSPUtils.getInt("media_volume_steps", 15)
|
||||||
|
|
||||||
|
"android.os.SystemProperties".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"getInt",
|
||||||
|
String::class.java,
|
||||||
|
Int::class.java
|
||||||
|
) {
|
||||||
|
when (it.args[0] as String) {
|
||||||
|
"ro.config.media_vol_steps" -> if (mediaStepsSwitch) it.result = mediaSteps
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
package com.lt2333.simplicitytools.hook.app.android.corepatch;
|
package com.lt2333.simplicitytools.hook.app.android.corepatch;
|
||||||
|
|
||||||
|
import android.app.AndroidAppHelper;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.Signature;
|
import android.content.pm.Signature;
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.BuildConfig;
|
import com.lt2333.simplicitytools.BuildConfig;
|
||||||
@@ -14,18 +17,22 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage;
|
import de.robv.android.xposed.IXposedHookLoadPackage;
|
||||||
|
import de.robv.android.xposed.IXposedHookZygoteInit;
|
||||||
import de.robv.android.xposed.XC_MethodHook;
|
import de.robv.android.xposed.XC_MethodHook;
|
||||||
|
import de.robv.android.xposed.XC_MethodReplacement;
|
||||||
import de.robv.android.xposed.XSharedPreferences;
|
import de.robv.android.xposed.XSharedPreferences;
|
||||||
|
import de.robv.android.xposed.XposedBridge;
|
||||||
import de.robv.android.xposed.XposedHelpers;
|
import de.robv.android.xposed.XposedHelpers;
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
import de.robv.android.xposed.callbacks.XC_LoadPackage;
|
||||||
|
|
||||||
public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
public class CorePatch extends XposedHelper implements IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||||
XSharedPreferences prefs = new XSharedPreferences(BuildConfig.APPLICATION_ID, "config");
|
XSharedPreferences prefs = new XSharedPreferences(BuildConfig.APPLICATION_ID, "config");
|
||||||
String TAG = "ST-CorePatch";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws IllegalAccessException, InvocationTargetException, InstantiationException {
|
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws IllegalAccessException, InvocationTargetException, InstantiationException {
|
||||||
@@ -35,27 +42,37 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
"checkDowngrade",
|
"checkDowngrade",
|
||||||
"com.android.server.pm.parsing.pkg.AndroidPackage",
|
"com.android.server.pm.parsing.pkg.AndroidPackage",
|
||||||
"android.content.pm.PackageInfoLite",
|
"android.content.pm.PackageInfoLite",
|
||||||
new ReturnConstant(prefs, "corepatch", null));
|
new ReturnConstant(prefs, "downgrade", null));
|
||||||
|
|
||||||
|
// exists on flyme 9(Android 11) only
|
||||||
|
findAndHookMethod("com.android.server.pm.PackageManagerService", loadPackageParam.classLoader,
|
||||||
|
"checkDowngrade",
|
||||||
|
"android.content.pm.PackageInfoLite",
|
||||||
|
"android.content.pm.PackageInfoLite",
|
||||||
|
new ReturnConstant(prefs, "downgrade", true));
|
||||||
|
|
||||||
|
|
||||||
// apk内文件修改后 digest校验会失败
|
// apk内文件修改后 digest校验会失败
|
||||||
hookAllMethods("android.util.jar.StrictJarVerifier", loadPackageParam.classLoader, "verifyMessageDigest",
|
hookAllMethods("android.util.jar.StrictJarVerifier", loadPackageParam.classLoader, "verifyMessageDigest",
|
||||||
new ReturnConstant(prefs, "corepatch", true));
|
new ReturnConstant(prefs, "authcreak", true));
|
||||||
hookAllMethods("android.util.jar.StrictJarVerifier", loadPackageParam.classLoader, "verify",
|
hookAllMethods("android.util.jar.StrictJarVerifier", loadPackageParam.classLoader, "verify",
|
||||||
new ReturnConstant(prefs, "corepatch", true));
|
new ReturnConstant(prefs, "authcreak", true));
|
||||||
hookAllMethods("java.security.MessageDigest", loadPackageParam.classLoader, "isEqual",
|
hookAllMethods("java.security.MessageDigest", loadPackageParam.classLoader, "isEqual",
|
||||||
new ReturnConstant(prefs, "corepatch", true));
|
new ReturnConstant(prefs, "authcreak", true));
|
||||||
|
|
||||||
// Targeting R+ (version " + Build.VERSION_CODES.R + " and above) requires"
|
// Targeting R+ (version " + Build.VERSION_CODES.R + " and above) requires"
|
||||||
// + " the resources.arsc of installed APKs to be stored uncompressed"
|
// + " the resources.arsc of installed APKs to be stored uncompressed"
|
||||||
// + " and aligned on a 4-byte boundary
|
// + " and aligned on a 4-byte boundary
|
||||||
// target >=30 的情况下 resources.arsc 必须是未压缩的且4K对齐
|
// target >=30 的情况下 resources.arsc 必须是未压缩的且4K对齐
|
||||||
hookAllMethods("android.content.res.AssetManager", loadPackageParam.classLoader, "containsAllocatedTable",
|
hookAllMethods("android.content.res.AssetManager", loadPackageParam.classLoader, "containsAllocatedTable",
|
||||||
new ReturnConstant(prefs, "corepatch", false));
|
new ReturnConstant(prefs, "authcreak", false));
|
||||||
|
|
||||||
// No signature found in package of version " + minSignatureSchemeVersion
|
// No signature found in package of version " + minSignatureSchemeVersion
|
||||||
// + " or newer for package " + apkPath
|
// + " or newer for package " + apkPath
|
||||||
findAndHookMethod("android.util.apk.ApkSignatureVerifier", loadPackageParam.classLoader, "getMinimumSignatureSchemeVersionForTargetSdk", int.class,
|
findAndHookMethod("android.util.apk.ApkSignatureVerifier", loadPackageParam.classLoader, "getMinimumSignatureSchemeVersionForTargetSdk", int.class,
|
||||||
new ReturnConstant(prefs, "corepatch", 0));
|
new ReturnConstant(prefs, "authcreak", 0));
|
||||||
|
findAndHookMethod("com.android.apksig.ApkVerifier", loadPackageParam.classLoader, "getMinimumSignatureSchemeVersionForTargetSdk", int.class,
|
||||||
|
new ReturnConstant(prefs, "authcreak", 0));
|
||||||
|
|
||||||
// Package " + packageName + " signatures do not match previously installed version; ignoring!"
|
// Package " + packageName + " signatures do not match previously installed version; ignoring!"
|
||||||
// public boolean checkCapability(String sha256String, @CertCapabilities int flags) {
|
// public boolean checkCapability(String sha256String, @CertCapabilities int flags) {
|
||||||
@@ -66,7 +83,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
|
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
|
||||||
// Or applications will have all privileged permissions
|
// Or applications will have all privileged permissions
|
||||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
|
||||||
if (prefs.getBoolean("corepatch", true)) {
|
if (prefs.getBoolean("authcreak", true)) {
|
||||||
if ((Integer) param.args[1] != 4) {
|
if ((Integer) param.args[1] != 4) {
|
||||||
param.setResult(true);
|
param.setResult(true);
|
||||||
}
|
}
|
||||||
@@ -91,20 +108,45 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
error.setAccessible(true);
|
error.setAccessible(true);
|
||||||
Object[] signingDetailsArgs = new Object[2];
|
Object[] signingDetailsArgs = new Object[2];
|
||||||
signingDetailsArgs[1] = 1;
|
signingDetailsArgs[1] = 1;
|
||||||
|
hookAllMethods("android.util.jar.StrictJarVerifier", loadPackageParam.classLoader, "verifyBytes", new XC_MethodHook() {
|
||||||
|
public void afterHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
|
super.afterHookedMethod(param);
|
||||||
|
if (prefs.getBoolean("digestCreak", true)) {
|
||||||
|
if(!prefs.getBoolean("UsePreSig", false)) {
|
||||||
|
final Object block = constructor.newInstance(param.args[0]);
|
||||||
|
Object[] infos = (Object[]) XposedHelpers.callMethod(block, "getSignerInfos");
|
||||||
|
Object info = infos[0];
|
||||||
|
List<X509Certificate> verifiedSignerCertChain = (List<X509Certificate>) XposedHelpers.callMethod(info, "getCertificateChain", block);
|
||||||
|
param.setResult(verifiedSignerCertChain.toArray(
|
||||||
|
new X509Certificate[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
hookAllMethods("android.util.apk.ApkSignatureVerifier", loadPackageParam.classLoader, "verifyV1Signature", new XC_MethodHook() {
|
hookAllMethods("android.util.apk.ApkSignatureVerifier", loadPackageParam.classLoader, "verifyV1Signature", new XC_MethodHook() {
|
||||||
public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable {
|
public void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable {
|
||||||
super.afterHookedMethod(methodHookParam);
|
super.afterHookedMethod(methodHookParam);
|
||||||
if (prefs.getBoolean("corepatch", true)) {
|
if (prefs.getBoolean("authcreak", true)) {
|
||||||
Throwable throwable = methodHookParam.getThrowable();
|
Throwable throwable = methodHookParam.getThrowable();
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
Signature[] lastSigs = null;
|
Signature[] lastSigs = null;
|
||||||
if (prefs.getBoolean("corepatch", true)) {
|
if(prefs.getBoolean("UsePreSig", false)) {
|
||||||
|
PackageManager PM = AndroidAppHelper.currentApplication().getPackageManager();
|
||||||
|
if(PM == null){
|
||||||
|
XposedBridge.log("E: " + BuildConfig.APPLICATION_ID + " Cannot get the Package Manager... Are you using MiUI?");
|
||||||
|
}else {
|
||||||
|
PackageInfo pI = PM.getPackageArchiveInfo((String) methodHookParam.args[0], 0);
|
||||||
|
PackageInfo InstpI = PM.getPackageInfo(pI.packageName, PackageManager.GET_SIGNATURES);
|
||||||
|
lastSigs = InstpI.signatures;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(prefs.getBoolean("digestCreak", true)) {
|
||||||
final Object origJarFile = constructorExact.newInstance(methodHookParam.args[0], true, false);
|
final Object origJarFile = constructorExact.newInstance(methodHookParam.args[0], true, false);
|
||||||
final ZipEntry manifestEntry = (ZipEntry) XposedHelpers.callMethod(origJarFile, "findEntry", "AndroidManifest.xml");
|
final ZipEntry manifestEntry = (ZipEntry) XposedHelpers.callMethod(origJarFile, "findEntry", "AndroidManifest.xml");
|
||||||
final Certificate[][] lastCerts = (Certificate[][]) XposedHelpers.callStaticMethod(ASV, "loadCertificates", origJarFile, manifestEntry);
|
final Certificate[][] lastCerts = (Certificate[][]) XposedHelpers.callStaticMethod(ASV, "loadCertificates", origJarFile, manifestEntry);
|
||||||
lastSigs = (Signature[]) XposedHelpers.callStaticMethod(ASV, "convertToSignatures", (Object) lastCerts);
|
lastSigs = (Signature[]) XposedHelpers.callStaticMethod(ASV, "convertToSignatures", (Object) lastCerts);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (lastSigs != null) {
|
if (lastSigs != null) {
|
||||||
signingDetailsArgs[0] = lastSigs;
|
signingDetailsArgs[0] = lastSigs;
|
||||||
} else {
|
} else {
|
||||||
@@ -117,7 +159,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
if (signingDetailsWithDigests != null) {
|
if (signingDetailsWithDigests != null) {
|
||||||
Constructor<?> signingDetailsWithDigestsConstructorExact = XposedHelpers.findConstructorExact(signingDetailsWithDigests, signingDetails, Map.class);
|
Constructor<?> signingDetailsWithDigestsConstructorExact = XposedHelpers.findConstructorExact(signingDetailsWithDigests, signingDetails, Map.class);
|
||||||
signingDetailsWithDigestsConstructorExact.setAccessible(true);
|
signingDetailsWithDigestsConstructorExact.setAccessible(true);
|
||||||
newInstance = signingDetailsWithDigestsConstructorExact.newInstance(newInstance, null);
|
newInstance = signingDetailsWithDigestsConstructorExact.newInstance(new Object[]{newInstance, null});
|
||||||
}
|
}
|
||||||
|
|
||||||
Throwable cause = throwable.getCause();
|
Throwable cause = throwable.getCause();
|
||||||
@@ -145,7 +187,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
|
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
|
||||||
// Or applications will have all privileged permissions
|
// Or applications will have all privileged permissions
|
||||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
|
||||||
if (((Integer) param.args[1] != 4) && prefs.getBoolean("corepatch", true)) {
|
if (((Integer) param.args[1] != 4) && prefs.getBoolean("digestCreak", true)) {
|
||||||
param.setResult(true);
|
param.setResult(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +197,7 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
@Override
|
@Override
|
||||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
super.beforeHookedMethod(param);
|
super.beforeHookedMethod(param);
|
||||||
if (prefs.getBoolean("corepatch", true)) {
|
if (prefs.getBoolean("digestCreak", true)) {
|
||||||
ApplicationInfo info = (ApplicationInfo) param.thisObject;
|
ApplicationInfo info = (ApplicationInfo) param.thisObject;
|
||||||
if ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
if ((info.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
||||||
|| (info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
|| (info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||||
@@ -164,6 +206,36 @@ public class CorePatch extends XposedHelper implements IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (prefs.getBoolean("digestCreak", true) && prefs.getBoolean("UsePreSig", false)) {
|
||||||
|
Class<?> pmClass = findClass("com.android.server.pm.PackageManagerService", loadPackageParam.classLoader);
|
||||||
|
Class<?> pPClass = findClass("com.android.server.pm.parsing.pkg.ParsedPackage", loadPackageParam.classLoader);
|
||||||
|
XposedHelpers.findAndHookMethod(pmClass, "doesSignatureMatchForPermissions", String.class, pPClass, int.class, new XC_MethodHook() {
|
||||||
|
@Override
|
||||||
|
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
|
//If we decide to crack this then at least make sure they are same apks, avoid another one that tries to impersonate.
|
||||||
|
if (param.getResult().equals(false)) {
|
||||||
|
String pPname = (String) XposedHelpers.callMethod(param.args[1], "getPackageName");
|
||||||
|
if (pPname.contentEquals((String) param.args[0])) {
|
||||||
|
param.setResult(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initZygote(StartupParam startupParam) {
|
||||||
|
|
||||||
|
hookAllMethods("android.content.pm.PackageParser", null, "getApkSigningVersion", XC_MethodReplacement.returnConstant(1));
|
||||||
|
hookAllConstructors("android.util.jar.StrictJarVerifier", new XC_MethodHook() {
|
||||||
|
@Override
|
||||||
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
|
if (prefs.getBoolean("enhancedMode", false)) {
|
||||||
|
super.beforeHookedMethod(param);
|
||||||
|
param.args[3] = Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ public class ReturnConstant extends XC_MethodHook {
|
|||||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||||
super.beforeHookedMethod(param);
|
super.beforeHookedMethod(param);
|
||||||
prefs.reload();
|
prefs.reload();
|
||||||
if (prefs.getBoolean(prefsKey, true)) {
|
if (prefs.getBoolean(prefsKey, false)) {
|
||||||
param.setResult(value);
|
param.setResult(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.cast
|
||||||
|
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object ForceSupportSendApp : HookRegister() {
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("force_support_send_app") {
|
||||||
|
findMethod("com.xiaomi.mirror.synergy.MiuiSynergySdk") {
|
||||||
|
name == "isSupportSendApp"
|
||||||
|
}.hookMethod {
|
||||||
|
after { param ->
|
||||||
|
param.result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.mediaeditor
|
package com.lt2333.simplicitytools.hook.app.mediaeditor
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class UnlockUnlimitedCropping :IXposedHookLoadPackage {
|
object UnlockUnlimitedCropping : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
//解锁图库裁切最小值
|
//解锁图库裁切最小值
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector",
|
"com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector",
|
||||||
lpparam.classLoader
|
getDefaultClassLoader()
|
||||||
)
|
)
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
classIfExists,
|
classIfExists,
|
||||||
@@ -26,7 +26,7 @@ class UnlockUnlimitedCropping :IXposedHookLoadPackage {
|
|||||||
//截图无限裁切
|
//截图无限裁切
|
||||||
val classIfExists2 = XposedHelpers.findClassIfExists(
|
val classIfExists2 = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector",
|
"com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector",
|
||||||
lpparam.classLoader
|
getDefaultClassLoader()
|
||||||
)
|
)
|
||||||
|
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
@@ -40,4 +40,5 @@ class UnlockUnlimitedCropping :IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.miuihome
|
package com.lt2333.simplicitytools.hook.app.miuihome
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class AlwaysDisplayTime : IXposedHookLoadPackage {
|
object AlwaysDisplayTime : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.home.launcher.Workspace",
|
"com.miui.home.launcher.Workspace",
|
||||||
lpparam.classLoader
|
getDefaultClassLoader()
|
||||||
)
|
)
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
classIfExists,
|
classIfExists,
|
||||||
@@ -23,4 +23,5 @@ class AlwaysDisplayTime : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.yuk.miuihome.module
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.SystemClock
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import android.view.ViewConfiguration
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
class DoubleTapController internal constructor(mContext: Context) {
|
||||||
|
|
||||||
|
private val maxDuration: Long = 500
|
||||||
|
private var mActionDownRawX: Float = 0f
|
||||||
|
private var mActionDownRawY: Float = 0f
|
||||||
|
private var mClickCount: Int = 0
|
||||||
|
private var mFirstClickRawX: Float = 0f
|
||||||
|
private var mFirstClickRawY: Float = 0f
|
||||||
|
private var mLastClickTime: Long = 0
|
||||||
|
private val mTouchSlop: Int = ViewConfiguration.get(mContext).scaledTouchSlop * 2
|
||||||
|
fun isDoubleTapEvent(motionEvent: MotionEvent): Boolean {
|
||||||
|
val action = motionEvent.actionMasked
|
||||||
|
return when {
|
||||||
|
action == MotionEvent.ACTION_DOWN -> {
|
||||||
|
mActionDownRawX = motionEvent.rawX
|
||||||
|
mActionDownRawY = motionEvent.rawY
|
||||||
|
false
|
||||||
|
}
|
||||||
|
action != MotionEvent.ACTION_UP -> false
|
||||||
|
else -> {
|
||||||
|
val rawX = motionEvent.rawX
|
||||||
|
val rawY = motionEvent.rawY
|
||||||
|
if (abs(rawX - mActionDownRawX) <= mTouchSlop.toFloat() && abs(rawY - mActionDownRawY) <= mTouchSlop.toFloat()) {
|
||||||
|
if (SystemClock.elapsedRealtime() - mLastClickTime > maxDuration || rawY - mFirstClickRawY > mTouchSlop.toFloat() || rawX - mFirstClickRawX > mTouchSlop.toFloat()) mClickCount =
|
||||||
|
0
|
||||||
|
mClickCount++
|
||||||
|
if (mClickCount == 1) {
|
||||||
|
mFirstClickRawX = rawX
|
||||||
|
mFirstClickRawY = rawY
|
||||||
|
mLastClickTime = SystemClock.elapsedRealtime()
|
||||||
|
return false
|
||||||
|
} else if (abs(rawY - mFirstClickRawY) <= mTouchSlop.toFloat() && abs(rawX - mFirstClickRawX) <= mTouchSlop.toFloat() && SystemClock.elapsedRealtime() - mLastClickTime <= maxDuration
|
||||||
|
) {
|
||||||
|
mClickCount = 0
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mClickCount = 0
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.miuihome
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import com.yuk.miuihome.module.DoubleTapController
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
object DoubleTapToSleep : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("double_tap_to_sleep") {
|
||||||
|
"com.miui.home.launcher.Workspace".findClass(getDefaultClassLoader())
|
||||||
|
.hookAfterAllConstructors {
|
||||||
|
var mDoubleTapControllerEx =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(
|
||||||
|
it.thisObject,
|
||||||
|
"mDoubleTapControllerEx"
|
||||||
|
)
|
||||||
|
if (mDoubleTapControllerEx != null) return@hookAfterAllConstructors
|
||||||
|
mDoubleTapControllerEx = DoubleTapController((it.args[0] as Context))
|
||||||
|
XposedHelpers.setAdditionalInstanceField(
|
||||||
|
it.thisObject,
|
||||||
|
"mDoubleTapControllerEx",
|
||||||
|
mDoubleTapControllerEx
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.miui.home.launcher.Workspace".findClass(getDefaultClassLoader()).hookBeforeMethod(
|
||||||
|
"dispatchTouchEvent", MotionEvent::class.java
|
||||||
|
) {
|
||||||
|
val mDoubleTapControllerEx = XposedHelpers.getAdditionalInstanceField(
|
||||||
|
it.thisObject,
|
||||||
|
"mDoubleTapControllerEx"
|
||||||
|
) as DoubleTapController
|
||||||
|
if (!mDoubleTapControllerEx.isDoubleTapEvent(it.args[0] as MotionEvent)) return@hookBeforeMethod
|
||||||
|
val mCurrentScreenIndex = it.thisObject.getIntField("mCurrentScreenIndex")
|
||||||
|
val cellLayout = it.thisObject.callMethod("getCellLayout", mCurrentScreenIndex)
|
||||||
|
if (cellLayout != null) if (cellLayout.callMethod("lastDownOnOccupiedCell") as Boolean) return@hookBeforeMethod
|
||||||
|
if (it.thisObject.callMethod("isInNormalEditingMode") as Boolean) return@hookBeforeMethod
|
||||||
|
val context = it.thisObject.callMethod("getContext") as Context
|
||||||
|
context.sendBroadcast(
|
||||||
|
Intent("com.miui.app.ExtraStatusBarManager.action_TRIGGER_TOGGLE").putExtra(
|
||||||
|
"com.miui.app.ExtraStatusBarManager.extra_TOGGLE_ID",
|
||||||
|
10
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class LockMaxFps : IXposedHookLoadPackage {
|
object LockMaxFps : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.powerkeeper.statemachine.DisplayFrameSetting",
|
"com.miui.powerkeeper.statemachine.DisplayFrameSetting",
|
||||||
lpparam.classLoader
|
getDefaultClassLoader()
|
||||||
)
|
)
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
classIfExists,
|
classIfExists,
|
||||||
@@ -25,4 +25,5 @@ class LockMaxFps : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class PreventRecoveryOfBatteryOptimizationWhitelist : IXposedHookLoadPackage {
|
object PreventRecoveryOfBatteryOptimizationWhitelist : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.powerkeeper.statemachine.ForceDozeController",
|
"com.miui.powerkeeper.statemachine.ForceDozeController",
|
||||||
lpparam.classLoader
|
getDefaultClassLoader()
|
||||||
)
|
)
|
||||||
XposedHelpers.findAndHookMethod(
|
XposedHelpers.findAndHookMethod(
|
||||||
classIfExists,
|
classIfExists,
|
||||||
@@ -28,4 +28,5 @@ class PreventRecoveryOfBatteryOptimizationWhitelist : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.cast
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import cn.fkj233.ui.activity.dp2px
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
|
|
||||||
|
object RearDisplayWeather : HookRegister() {
|
||||||
|
@SuppressLint("ResourceType")
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("rear_show_weather") {
|
||||||
|
findMethod("com.xiaomi.misubscreenui.light.aod.view.VerticalClockView") {
|
||||||
|
name == "onFinishInflate"
|
||||||
|
}.hookMethod {
|
||||||
|
after {
|
||||||
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
|
val context = viewGroup.context
|
||||||
|
|
||||||
|
//获取原组件
|
||||||
|
val gradientLayoutID =
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"gradient_layout",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
val gradientLayout: ViewGroup = viewGroup.findViewById(gradientLayoutID)
|
||||||
|
|
||||||
|
val dateID =
|
||||||
|
context.resources.getIdentifier("date", "id", context.packageName)
|
||||||
|
val date: TextView = viewGroup.findViewById(dateID)
|
||||||
|
|
||||||
|
|
||||||
|
//创建天气组件
|
||||||
|
val mWeatherView = WeatherView(context, false).apply {
|
||||||
|
gravity = Gravity.END
|
||||||
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"Sub_Screen_Aod_date_s",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
typeface = Typeface.create("mipro-medium", Typeface.NORMAL)
|
||||||
|
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12f)
|
||||||
|
|
||||||
|
}
|
||||||
|
gradientLayout.addView(mWeatherView, (gradientLayout.indexOfChild(date) + 1))
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
findMethod("com.xiaomi.misubscreenui.light.aod.view.HorizontalClockView") {
|
||||||
|
name == "onFinishInflate"
|
||||||
|
}.hookMethod {
|
||||||
|
before {
|
||||||
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
|
val context = viewGroup.context
|
||||||
|
|
||||||
|
//获取原组件
|
||||||
|
val gradientLayoutID =
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"gradient_layout",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
val gradientLayout: RelativeLayout = viewGroup.findViewById(gradientLayoutID)
|
||||||
|
|
||||||
|
val dateID =
|
||||||
|
context.resources.getIdentifier("date", "id", context.packageName)
|
||||||
|
val date: TextView = viewGroup.findViewById(dateID)
|
||||||
|
|
||||||
|
val dateParentLayout: ViewGroup = date.parent as ViewGroup
|
||||||
|
|
||||||
|
|
||||||
|
//创建天气组件
|
||||||
|
val mWeatherView = WeatherView(context, false).apply {
|
||||||
|
id = View.generateViewId()
|
||||||
|
gravity = Gravity.CENTER
|
||||||
|
maxLines = 1
|
||||||
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"Sub_Screen_Aod_date_s_horizontal",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
typeface = Typeface.create("mipro-medium", 0)
|
||||||
|
|
||||||
|
layoutParams = RelativeLayout.LayoutParams(
|
||||||
|
RelativeLayout.LayoutParams.WRAP_CONTENT, dp2px(context, 30f)
|
||||||
|
).also {
|
||||||
|
it.addRule(RelativeLayout.END_OF, dateID)
|
||||||
|
it.marginStart = dp2px(context, 3f)
|
||||||
|
it.marginEnd = dp2px(context, 3f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dateParentLayout.addView(
|
||||||
|
mWeatherView,
|
||||||
|
(dateParentLayout.indexOfChild(date) + 1)
|
||||||
|
)
|
||||||
|
|
||||||
|
//电池位置
|
||||||
|
val batteryID =
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"battery_container",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
val battery: ViewGroup = viewGroup.findViewById(batteryID)
|
||||||
|
|
||||||
|
battery.layoutParams = RelativeLayout.LayoutParams(
|
||||||
|
RelativeLayout.LayoutParams.WRAP_CONTENT, dp2px(context, 30f)
|
||||||
|
).also {
|
||||||
|
it.addRule(RelativeLayout.END_OF, mWeatherView.id)
|
||||||
|
}
|
||||||
|
gradientLayout.setPadding(0, dp2px(context,5f),0,0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.screenshot
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
object UnlockUnlimitedCropping : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
//截图无限裁切
|
||||||
|
val classIfExists2 = XposedHelpers.findClassIfExists(
|
||||||
|
"com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$b",
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
|
XposedHelpers.findAndHookMethod(
|
||||||
|
classIfExists2,
|
||||||
|
"a",
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||||
|
if (XSPUtils.getBoolean("unlock_unlimited_cropping",false)) {
|
||||||
|
param.result = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,14 +4,13 @@ import android.view.View
|
|||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class LockOneHundred : IXposedHookLoadPackage {
|
object LockOneHundred : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
//防止点击重新检测
|
//防止点击重新检测
|
||||||
val mainContentFrameClass = "com.miui.securityscan.ui.main.MainContentFrame".findClass(lpparam.classLoader)
|
val mainContentFrameClass = "com.miui.securityscan.ui.main.MainContentFrame".findClass(getDefaultClassLoader())
|
||||||
mainContentFrameClass.hookBeforeMethod("onClick", View::class.java) {
|
mainContentFrameClass.hookBeforeMethod("onClick", View::class.java) {
|
||||||
if (XSPUtils.getBoolean("lock_one_hundred", false)) {
|
if (XSPUtils.getBoolean("lock_one_hundred", false)) {
|
||||||
it.result = null
|
it.result = null
|
||||||
@@ -19,11 +18,12 @@ class LockOneHundred : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//锁定100分
|
//锁定100分
|
||||||
var scoreManagerClass = "com.miui.securityscan.scanner.ScoreManager".findClass(lpparam.classLoader)
|
val scoreManagerClass = "com.miui.securityscan.scanner.ScoreManager".findClass(getDefaultClassLoader())
|
||||||
scoreManagerClass.hookBeforeMethod("B") {
|
scoreManagerClass.hookBeforeMethod("B") {
|
||||||
if (XSPUtils.getBoolean("lock_one_hundred", false)) {
|
if (XSPUtils.getBoolean("lock_one_hundred", false)) {
|
||||||
it.result = 0
|
it.result = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.securitycenter
|
package com.lt2333.simplicitytools.hook.app.securitycenter
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveMacroBlacklist : IXposedHookLoadPackage {
|
object RemoveMacroBlacklist : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
if (XSPUtils.getBoolean("remove_macro_blacklist", false)) {
|
if (XSPUtils.getBoolean("remove_macro_blacklist", false)) {
|
||||||
var letter = 'a'
|
var letter = 'a'
|
||||||
for (i in 0..25) {
|
for (i in 0..25) {
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
"com.miui.gamebooster.v.$letter" + "0", lpparam.classLoader
|
"com.miui.gamebooster.v.$letter" + "0", getDefaultClassLoader()
|
||||||
) ?: continue
|
) ?: continue
|
||||||
if (classIfExists.declaredMethods.size in 6..12 && classIfExists.fields.isEmpty() && classIfExists.declaredFields.size >= 2) {
|
if (classIfExists.declaredMethods.size in 6..12 && classIfExists.fields.isEmpty() && classIfExists.declaredFields.size >= 2) {
|
||||||
XposedHelpers.findAndHookMethod(classIfExists, "c", String::class.java,
|
XposedHelpers.findAndHookMethod(classIfExists, "c", String::class.java,
|
||||||
@@ -27,4 +27,5 @@ class RemoveMacroBlacklist : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.securitycenter
|
||||||
|
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
object RemoveOpenAppConfirmationPopup : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
val textViewClass = "android.widget.TextView".findClass(getDefaultClassLoader())
|
||||||
|
textViewClass.hookAfterMethod(
|
||||||
|
"setText",
|
||||||
|
CharSequence::class.java
|
||||||
|
) {
|
||||||
|
if (XSPUtils.getBoolean("remove_open_app_confirmation_popup", false)) {
|
||||||
|
val textView = it.thisObject as TextView
|
||||||
|
if (it.args.isNotEmpty() && it.args[0]?.toString().equals(
|
||||||
|
textView.context.resources.getString(
|
||||||
|
textView.context.resources.getIdentifier(
|
||||||
|
"button_text_accept",
|
||||||
|
"string",
|
||||||
|
textView.context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
textView.performClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,16 +17,22 @@ import com.lt2333.simplicitytools.util.XSPUtils
|
|||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
import java.lang.reflect.Field
|
import java.lang.reflect.Field
|
||||||
|
|
||||||
class ShowBatteryTemperature: IXposedHookLoadPackage {
|
object ShowBatteryTemperature: HookRegister() {
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
private fun getBatteryTemperature(context: Context): Int {
|
||||||
|
return context.registerReceiver(
|
||||||
|
null as BroadcastReceiver?,
|
||||||
|
IntentFilter("android.intent.action.BATTERY_CHANGED")
|
||||||
|
)!!.getIntExtra("temperature", 0) / 10
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
if (!XSPUtils.getBoolean("battery_life_function", false)) return
|
if (!XSPUtils.getBoolean("battery_life_function", false)) return
|
||||||
val a = "com.miui.powercenter.a\$a".findClass(lpparam.classLoader)
|
val a = "com.miui.powercenter.a\$a".findClass(getDefaultClassLoader())
|
||||||
"com.miui.powercenter.a".hookBeforeMethod(lpparam.classLoader, "b", Context::class.java) {
|
"com.miui.powercenter.a".hookBeforeMethod(getDefaultClassLoader(), "b", Context::class.java) {
|
||||||
it.result = getBatteryTemperature(it.args[0] as Context).toString()
|
it.result = getBatteryTemperature(it.args[0] as Context).toString()
|
||||||
}
|
}
|
||||||
a.hookAfterMethod("run") {
|
a.hookAfterMethod("run") {
|
||||||
@@ -59,10 +65,5 @@ class ShowBatteryTemperature: IXposedHookLoadPackage {
|
|||||||
linearLayout.addView(tempView)
|
linearLayout.addView(tempView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private fun getBatteryTemperature(context: Context): Int {
|
|
||||||
return context.registerReceiver(
|
|
||||||
null as BroadcastReceiver?,
|
|
||||||
IntentFilter("android.intent.action.BATTERY_CHANGED")
|
|
||||||
)!!.getIntExtra("temperature", 0) / 10
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,12 @@ import android.widget.TextView
|
|||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class SkipWaitingTime : IXposedHookLoadPackage {
|
object SkipWaitingTime : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
|
||||||
val textViewClass = "android.widget.TextView".findClass(lpparam.classLoader)
|
override fun init() {
|
||||||
|
val textViewClass = "android.widget.TextView".findClass(getDefaultClassLoader())
|
||||||
textViewClass.hookBeforeMethod(
|
textViewClass.hookBeforeMethod(
|
||||||
"setText",
|
"setText",
|
||||||
CharSequence::class.java,
|
CharSequence::class.java,
|
||||||
@@ -35,4 +34,5 @@ class SkipWaitingTime : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,13 +2,13 @@ package com.lt2333.simplicitytools.hook.app.settings
|
|||||||
|
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.*
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class ShowNotificationImportance : IXposedHookLoadPackage {
|
object ShowNotificationImportance : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val channelNotificationSettingsClass = "com.android.settings.notification.ChannelNotificationSettings".findClass(lpparam.classLoader)
|
override fun init() {
|
||||||
|
val channelNotificationSettingsClass = "com.android.settings.notification.ChannelNotificationSettings".findClass(getDefaultClassLoader())
|
||||||
channelNotificationSettingsClass.hookBeforeMethod("removeDefaultPrefs") {
|
channelNotificationSettingsClass.hookBeforeMethod("removeDefaultPrefs") {
|
||||||
if (!XSPUtils.getBoolean("show_notification_importance", false)) return@hookBeforeMethod
|
if (!XSPUtils.getBoolean("show_notification_importance", false)) return@hookBeforeMethod
|
||||||
val importance = it.thisObject.callMethod("findPreference", "importance") ?: return@hookBeforeMethod
|
val importance = it.thisObject.callMethod("findPreference", "importance") ?: return@hookBeforeMethod
|
||||||
@@ -20,7 +20,7 @@ class ShowNotificationImportance : IXposedHookLoadPackage {
|
|||||||
it.result = null
|
it.result = null
|
||||||
}
|
}
|
||||||
|
|
||||||
val dropDownPreferenceClass = XposedHelpers.findClass("androidx.preference.Preference", lpparam.classLoader)
|
val dropDownPreferenceClass = XposedHelpers.findClass("androidx.preference.Preference", getDefaultClassLoader())
|
||||||
dropDownPreferenceClass.hookAfterMethod("callChangeListener", Any::class.java) {
|
dropDownPreferenceClass.hookAfterMethod("callChangeListener", Any::class.java) {
|
||||||
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(it.thisObject, "channelNotificationSettings") ?: return@hookAfterMethod
|
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(it.thisObject, "channelNotificationSettings") ?: return@hookAfterMethod
|
||||||
val mChannel = channelNotificationSettings.getObjectField("mChannel") as NotificationChannel
|
val mChannel = channelNotificationSettings.getObjectField("mChannel") as NotificationChannel
|
||||||
@@ -31,4 +31,5 @@ class ShowNotificationImportance : IXposedHookLoadPackage {
|
|||||||
mBackend.callMethod("updateChannel", mPkg, mUid, mChannel)
|
mBackend.callMethod("updateChannel", mPkg, mUid, mChannel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object BatteryPercentage: HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
val size = XSPUtils.getFloat("battery_percentage_font_size", 0f)
|
||||||
|
if (size == 0f) return
|
||||||
|
"com.android.systemui.statusbar.views.MiuiBatteryMeterView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateResources"
|
||||||
|
) {
|
||||||
|
(it.thisObject.getObjectField("mBatteryPercentView") as TextView).setTextSize(
|
||||||
|
TypedValue.COMPLEX_UNIT_DIP, size
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,28 +4,138 @@ import android.content.ComponentName
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import cn.fkj233.ui.activity.dp2px
|
||||||
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class ControlCenterWeather : IXposedHookLoadPackage {
|
object ControlCenterWeather: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
hasEnable("control_center_weather") {
|
hasEnable("control_center_weather") {
|
||||||
var mWeatherView: TextView? = null
|
var mWeatherView: TextView? = null
|
||||||
|
var mConstraintLayout: ConstraintLayout? = null
|
||||||
val isDisplayCity = XSPUtils.getBoolean("control_center_weather_city", false)
|
val isDisplayCity = XSPUtils.getBoolean("control_center_weather_city", false)
|
||||||
"com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView".hookAfterMethod(
|
"com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView".hookAfterMethod(
|
||||||
lpparam.classLoader,
|
getDefaultClassLoader(),
|
||||||
"onFinishInflate"
|
"onFinishInflate"
|
||||||
) {
|
) {
|
||||||
val viewGroup = it.thisObject as ViewGroup
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
val context = viewGroup.context
|
val context = viewGroup.context
|
||||||
|
|
||||||
|
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||||
|
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||||
|
.toInt() >= 1647014400 &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("DEV") &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("XM")
|
||||||
|
) {
|
||||||
|
//获取原组件
|
||||||
|
val big_time_ID =
|
||||||
|
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||||
|
val big_time: TextView = viewGroup.findViewById(big_time_ID)
|
||||||
|
|
||||||
|
val date_time_ID =
|
||||||
|
context.resources.getIdentifier("date_time", "id", context.packageName)
|
||||||
|
val date_time: TextView = viewGroup.findViewById(date_time_ID)
|
||||||
|
|
||||||
|
//创建新布局
|
||||||
|
val mConstraintLayoutLp = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.topMargin = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"qs_control_header_tiles_margin_top",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mConstraintLayout =
|
||||||
|
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
|
||||||
|
|
||||||
|
(big_time.parent as ViewGroup).addView(mConstraintLayout, 0)
|
||||||
|
|
||||||
|
|
||||||
|
//从原布局中删除组件
|
||||||
|
(big_time.parent as ViewGroup).removeView(big_time)
|
||||||
|
(date_time.parent as ViewGroup).removeView(date_time)
|
||||||
|
|
||||||
|
|
||||||
|
//添加组件至新布局
|
||||||
|
mConstraintLayout!!.addView(big_time)
|
||||||
|
mConstraintLayout!!.addView(date_time)
|
||||||
|
|
||||||
|
//组件属性
|
||||||
|
|
||||||
|
val date_time_LP = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.startToEnd = big_time_ID
|
||||||
|
it.bottomToBottom = 0
|
||||||
|
it.marginStart = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_panel_time_date_space",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
it.bottomMargin = dp2px(context, 5f)
|
||||||
|
}
|
||||||
|
date_time.layoutParams = date_time_LP
|
||||||
|
|
||||||
|
|
||||||
|
//创建天气组件
|
||||||
|
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
||||||
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"TextAppearance.QSControl.Date",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
mConstraintLayout!!.addView(mWeatherView)
|
||||||
|
|
||||||
|
val mWeatherView_LP = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.startToEnd = big_time_ID
|
||||||
|
it.bottomToTop = date_time_ID
|
||||||
|
it.marginStart = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_panel_time_date_space",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
(mWeatherView as WeatherView).layoutParams = mWeatherView_LP
|
||||||
|
|
||||||
|
} else {
|
||||||
val layoutParam =
|
val layoutParam =
|
||||||
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams")
|
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams").getConstructor(
|
||||||
.getConstructor(Int::class.java, Int::class.java).newInstance(
|
Int::class.java,
|
||||||
|
Int::class.java
|
||||||
|
).newInstance(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
) as ViewGroup.MarginLayoutParams
|
) as ViewGroup.MarginLayoutParams
|
||||||
@@ -37,7 +147,6 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
"startToEnd",
|
"startToEnd",
|
||||||
context.resources.getIdentifier("big_time", "id", context.packageName)
|
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||||
)
|
)
|
||||||
|
|
||||||
layoutParam.marginStart = context.resources.getDimensionPixelSize(
|
layoutParam.marginStart = context.resources.getDimensionPixelSize(
|
||||||
context.resources.getIdentifier(
|
context.resources.getIdentifier(
|
||||||
"notification_panel_time_date_space",
|
"notification_panel_time_date_space",
|
||||||
@@ -45,7 +154,6 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
context.packageName
|
context.packageName
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
||||||
setTextAppearance(
|
setTextAppearance(
|
||||||
context.resources.getIdentifier(
|
context.resources.getIdentifier(
|
||||||
@@ -57,6 +165,7 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
layoutParams = layoutParam
|
layoutParams = layoutParam
|
||||||
}
|
}
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
|
}
|
||||||
|
|
||||||
(mWeatherView as WeatherView).setOnClickListener {
|
(mWeatherView as WeatherView).setOnClickListener {
|
||||||
try {
|
try {
|
||||||
@@ -72,13 +181,36 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
|
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
"com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView".hookAfterMethod(
|
"com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView".hookAfterMethod(
|
||||||
lpparam.classLoader,
|
getDefaultClassLoader(),
|
||||||
"updateLayout"
|
"updateLayout"
|
||||||
) {
|
) {
|
||||||
val mOrientation = it.thisObject.getObjectField("mOrientation") as Int
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
|
val context = viewGroup.context
|
||||||
|
val mOrientation = viewGroup.getObjectField("mOrientation") as Int
|
||||||
|
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||||
|
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||||
|
.toInt() >= 1647014400 &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("DEV") &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("XM")
|
||||||
|
) {
|
||||||
|
if (mOrientation == 1) {
|
||||||
|
mConstraintLayout!!.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
mConstraintLayout!!.visibility = View.GONE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (mOrientation == 1) {
|
if (mOrientation == 1) {
|
||||||
mWeatherView!!.visibility = View.VISIBLE
|
mWeatherView!!.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
@@ -87,4 +219,6 @@ class ControlCenterWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object CustomMobileTypeText : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("custom_mobile_type_text_switch") {
|
||||||
|
"com.android.systemui.statusbar.policy.MobileSignalController".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"getMobileTypeName",
|
||||||
|
Int::class.java
|
||||||
|
) {
|
||||||
|
it.result = XSPUtils.getString("custom_mobile_type_text","5G")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.net.TrafficStats
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.github.kyuubiran.ezxhelper.init.InitFields
|
||||||
|
import com.lt2333.simplicitytools.R
|
||||||
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
|
object DoubleLineNetworkSpeed: HookRegister() {
|
||||||
|
|
||||||
|
private var mLastTotalUp: Long = 0
|
||||||
|
private var mLastTotalDown: Long = 0
|
||||||
|
|
||||||
|
private var lastTimeStampTotalUp: Long = 0
|
||||||
|
private var lastTimeStampTotalDown: Long = 0
|
||||||
|
|
||||||
|
private var upIcon = ""
|
||||||
|
private var downIcon = ""
|
||||||
|
|
||||||
|
private val getDualSize = XSPUtils.getInt("status_bar_network_speed_dual_row_size", 0)
|
||||||
|
private val getDualAlign = XSPUtils.getInt("status_bar_network_speed_dual_row_gravity", 0)
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
val none = InitFields.moduleRes.getString(R.string.none)
|
||||||
|
|
||||||
|
if (XSPUtils.getString("status_bar_network_speed_dual_row_icon", none) != none) {
|
||||||
|
upIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)
|
||||||
|
?.firstOrNull().toString()
|
||||||
|
downIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)
|
||||||
|
?.lastOrNull().toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
hasEnable("status_bar_dual_row_network_speed") {
|
||||||
|
"com.android.systemui.statusbar.views.NetworkSpeedView".findClass(getDefaultClassLoader())
|
||||||
|
.hookAfterConstructor(Context::class.java, AttributeSet::class.java) {
|
||||||
|
val mView = it.thisObject as TextView
|
||||||
|
mView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 7f)
|
||||||
|
if (getDualSize != 0) {
|
||||||
|
mView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getDualSize.toFloat())
|
||||||
|
}
|
||||||
|
mView.isSingleLine = false
|
||||||
|
mView.setLineSpacing(0F, 0.8F)
|
||||||
|
if (getDualAlign == 0) {
|
||||||
|
mView.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
||||||
|
} else {
|
||||||
|
mView.gravity = Gravity.RIGHT or Gravity.CENTER_VERTICAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.android.systemui.statusbar.policy.NetworkSpeedController".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"formatSpeed",
|
||||||
|
Context::class.java,
|
||||||
|
Long::class.java
|
||||||
|
) {
|
||||||
|
if (getDualAlign == 0) {
|
||||||
|
it.result =
|
||||||
|
"$upIcon ${getTotalUpSpeed(it.args[0]as Context)}\n${downIcon} ${getTotalDownloadSpeed(it.args[0]as Context)}"
|
||||||
|
} else {
|
||||||
|
it.result =
|
||||||
|
"${getTotalUpSpeed(it.args[0]as Context)} ${upIcon}\n${getTotalDownloadSpeed(it.args[0]as Context)} $downIcon"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取总的上行速度
|
||||||
|
private fun getTotalUpSpeed(context: Context): String {
|
||||||
|
var totalUpSpeed = 0F
|
||||||
|
|
||||||
|
val currentTotalTxBytes = TrafficStats.getTotalTxBytes()
|
||||||
|
val nowTimeStampTotalUp = System.currentTimeMillis()
|
||||||
|
|
||||||
|
//计算上传速度
|
||||||
|
val bytes =
|
||||||
|
(currentTotalTxBytes - mLastTotalUp) * 1000 / (nowTimeStampTotalUp - lastTimeStampTotalUp).toFloat()
|
||||||
|
var unit = ""
|
||||||
|
|
||||||
|
if (bytes >= 1048576) {
|
||||||
|
totalUpSpeed =
|
||||||
|
DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||||
|
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second","string",context.packageName))
|
||||||
|
} else {
|
||||||
|
totalUpSpeed =
|
||||||
|
DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||||
|
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second","string",context.packageName))
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存当前的流量总和和上次的时间戳
|
||||||
|
mLastTotalUp = currentTotalTxBytes
|
||||||
|
lastTimeStampTotalUp = nowTimeStampTotalUp
|
||||||
|
|
||||||
|
return if (totalUpSpeed >= 100) {
|
||||||
|
"" + totalUpSpeed.toInt() + unit
|
||||||
|
} else {
|
||||||
|
"" + totalUpSpeed + unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取总的下行速度
|
||||||
|
private fun getTotalDownloadSpeed(context: Context): String {
|
||||||
|
var totalDownSpeed = 0F
|
||||||
|
val currentTotalRxBytes = TrafficStats.getTotalRxBytes()
|
||||||
|
val nowTimeStampTotalDown = System.currentTimeMillis()
|
||||||
|
|
||||||
|
//计算下行速度
|
||||||
|
val bytes =
|
||||||
|
(currentTotalRxBytes - mLastTotalDown) * 1000 / (nowTimeStampTotalDown - lastTimeStampTotalDown).toFloat()
|
||||||
|
|
||||||
|
var unit = ""
|
||||||
|
|
||||||
|
if (bytes >= 1048576) {
|
||||||
|
totalDownSpeed =
|
||||||
|
DecimalFormat("0.0").format(bytes / 1048576).toFloat()
|
||||||
|
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second","string",context.packageName))
|
||||||
|
} else {
|
||||||
|
totalDownSpeed =
|
||||||
|
DecimalFormat("0.0").format(bytes / 1024).toFloat()
|
||||||
|
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second","string",context.packageName))
|
||||||
|
}
|
||||||
|
//保存当前的流量总和和上次的时间戳
|
||||||
|
mLastTotalDown = currentTotalRxBytes
|
||||||
|
lastTimeStampTotalDown = nowTimeStampTotalDown
|
||||||
|
|
||||||
|
return if (totalDownSpeed >= 100) {
|
||||||
|
"" + totalDownSpeed.toInt() + unit
|
||||||
|
} else {
|
||||||
|
"" + totalDownSpeed + unit
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideAirplaneIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val iconState = "com.android.systemui.statusbar.policy.NetworkController\$IconState"
|
|
||||||
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy".hookBeforeMethod(lpparam.classLoader, "setIsAirplaneMode", iconState) {
|
|
||||||
hasEnable("hide_airplane_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideAlarmIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "onMiuiAlarmChanged") {
|
|
||||||
hasEnable("hide_alarm_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,12 @@ import android.widget.TextView
|
|||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideBatteryIcon : IXposedHookLoadPackage {
|
object HideBatteryIcon : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.views.MiuiBatteryMeterView".hookAfterMethod(lpparam.classLoader, "updateResources") {
|
override fun init() {
|
||||||
|
"com.android.systemui.statusbar.views.MiuiBatteryMeterView".hookAfterMethod(getDefaultClassLoader(), "updateResources") {
|
||||||
|
|
||||||
//隐藏电池图标
|
//隐藏电池图标
|
||||||
hasEnable("hide_battery_icon") {
|
hasEnable("hide_battery_icon") {
|
||||||
@@ -32,7 +32,7 @@ class HideBatteryIcon : IXposedHookLoadPackage {
|
|||||||
(it.thisObject.getObjectField("mBatteryPercentMarkView") as TextView).textSize = 0F
|
(it.thisObject.getObjectField("mBatteryPercentMarkView") as TextView).textSize = 0F
|
||||||
}
|
}
|
||||||
|
|
||||||
"com.android.systemui.statusbar.views.MiuiBatteryMeterView".hookAfterMethod(lpparam.classLoader, "updateChargeAndText") {
|
"com.android.systemui.statusbar.views.MiuiBatteryMeterView".hookAfterMethod(getDefaultClassLoader(), "updateChargeAndText") {
|
||||||
//隐藏电池充电图标
|
//隐藏电池充电图标
|
||||||
hasEnable("hide_battery_charging_icon") {
|
hasEnable("hide_battery_charging_icon") {
|
||||||
(it.thisObject.getObjectField("mBatteryChargingInView") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mBatteryChargingInView") as ImageView).visibility = View.GONE
|
||||||
@@ -41,4 +41,5 @@ class HideBatteryIcon : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideBluetoothHandsfreeBatteryIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "updateBluetoothHandsfreeBattery", Intent::class.java) {
|
|
||||||
hasEnable("hide_bluetooth_battery_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideBluetoothIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "updateBluetooth", String::class.java) {
|
|
||||||
hasEnable("hide_bluetooth_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideGPSIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.PhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "updateLocationFromController") {
|
|
||||||
hasEnable("hide_gps_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,13 +5,13 @@ import android.widget.ImageView
|
|||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideHDIcon :IXposedHookLoadPackage {
|
object HideHDIcon: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "initViewState", iconState) {
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(getDefaultClassLoader(), "initViewState", iconState) {
|
||||||
hasEnable("hide_big_hd_icon") {
|
hasEnable("hide_big_hd_icon") {
|
||||||
(it.thisObject.getObjectField("mVolte") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mVolte") as ImageView).visibility = View.GONE
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ class HideHDIcon :IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "updateState", iconState) {
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(getDefaultClassLoader(), "updateState", iconState) {
|
||||||
hasEnable("hide_big_hd_icon") {
|
hasEnable("hide_big_hd_icon") {
|
||||||
(it.thisObject.getObjectField("mVolte") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mVolte") as ImageView).visibility = View.GONE
|
||||||
}
|
}
|
||||||
@@ -35,4 +35,5 @@ class HideHDIcon :IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideHeadsetIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "updateHeadsetPlug", Intent::class.java) {
|
|
||||||
hasEnable("hide_headset_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideHotspotIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.PhoneStatusBarPolicy\$2".hookBeforeMethod(lpparam.classLoader, "onHotspotChanged", Boolean::class.java, Int::class.java) {
|
|
||||||
hasEnable("hide_hotspot_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,24 +5,25 @@ import android.widget.ImageView
|
|||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideMobileActivityIcon : IXposedHookLoadPackage {
|
object HideMobileActivityIcon: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "initViewState", iconState) {
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(getDefaultClassLoader(), "initViewState", iconState) {
|
||||||
hasEnable("hide_mobile_activity_icon") {
|
hasEnable("hide_mobile_activity_icon") {
|
||||||
(it.thisObject.getObjectField("mLeftInOut") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mLeftInOut") as ImageView).visibility = View.GONE
|
||||||
(it.thisObject.getObjectField("mRightInOut") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mRightInOut") as ImageView).visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "updateState", iconState) {
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(getDefaultClassLoader(), "updateState", iconState) {
|
||||||
hasEnable("hide_mobile_activity_icon") {
|
hasEnable("hide_mobile_activity_icon") {
|
||||||
(it.thisObject.getObjectField("mLeftInOut") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mLeftInOut") as ImageView).visibility = View.GONE
|
||||||
(it.thisObject.getObjectField("mRightInOut") as ImageView).visibility = View.GONE
|
(it.thisObject.getObjectField("mRightInOut") as ImageView).visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,29 +3,54 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
|
|
||||||
class HideMobileTypeIcon : IXposedHookLoadPackage {
|
object HideMobileTypeIcon: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
private val isBigType = XSPUtils.getBoolean("big_mobile_type_icon", false)
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$MobileIconState"
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "initViewState", iconState) {
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(
|
||||||
hasEnable("hide_mobile_type_icon") {
|
getDefaultClassLoader(),
|
||||||
(it.thisObject.getObjectField("mMobileType") as TextView).visibility = View.INVISIBLE
|
"initViewState",
|
||||||
(it.thisObject.getObjectField("mMobileTypeImage") as ImageView).visibility = View.INVISIBLE
|
iconState
|
||||||
(it.thisObject.getObjectField("mMobileTypeSingle") as TextView).visibility = View.INVISIBLE
|
) {
|
||||||
|
hideMobileTypeIcon(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateState",
|
||||||
|
iconState
|
||||||
|
) {
|
||||||
|
hideMobileTypeIcon(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(lpparam.classLoader, "updateState", iconState) {
|
private fun hideMobileTypeIcon(it: XC_MethodHook.MethodHookParam) {
|
||||||
hasEnable("hide_mobile_type_icon") {
|
hasEnable("hide_mobile_type_icon") {
|
||||||
(it.thisObject.getObjectField("mMobileType") as TextView).visibility = View.INVISIBLE
|
if (isBigType) {
|
||||||
(it.thisObject.getObjectField("mMobileTypeImage") as ImageView).visibility = View.INVISIBLE
|
(it.thisObject.getObjectField("mMobileType") as TextView).visibility =
|
||||||
(it.thisObject.getObjectField("mMobileTypeSingle") as TextView).visibility = View.INVISIBLE
|
View.GONE
|
||||||
|
(it.thisObject.getObjectField("mMobileTypeImage") as ImageView).visibility =
|
||||||
|
View.GONE
|
||||||
|
(it.thisObject.getObjectField("mMobileTypeSingle") as TextView).visibility =
|
||||||
|
View.GONE
|
||||||
|
} else {
|
||||||
|
(it.thisObject.getObjectField("mMobileType") as TextView).visibility =
|
||||||
|
View.INVISIBLE
|
||||||
|
(it.thisObject.getObjectField("mMobileTypeImage") as ImageView).visibility =
|
||||||
|
View.INVISIBLE
|
||||||
|
(it.thisObject.getObjectField("mMobileTypeSingle") as TextView).visibility =
|
||||||
|
View.INVISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@ import android.widget.TextView
|
|||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideNetworkSpeedSplitter : IXposedHookLoadPackage {
|
object HideNetworkSpeedSplitter: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val networkSpeedSplitterClass = "com.android.systemui.statusbar.views.NetworkSpeedSplitter".findClass(lpparam.classLoader)
|
override fun init() {
|
||||||
|
val networkSpeedSplitterClass = "com.android.systemui.statusbar.views.NetworkSpeedSplitter".findClass(getDefaultClassLoader())
|
||||||
networkSpeedSplitterClass.hookAfterMethod("init") {
|
networkSpeedSplitterClass.hookAfterMethod("init") {
|
||||||
if (XSPUtils.getBoolean("hide_network_speed_splitter", false)) {
|
if (XSPUtils.getBoolean("hide_network_speed_splitter", false)) {
|
||||||
val textView = it.thisObject as TextView
|
val textView = it.thisObject as TextView
|
||||||
@@ -17,4 +17,5 @@ class HideNetworkSpeedSplitter : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideNoSimIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiStatusBarSignalPolicy".hookBeforeMethod(lpparam.classLoader, "setNoSims", Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType) {
|
|
||||||
hasEnable("hide_no_sim_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,12 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideSimIcon :IXposedHookLoadPackage {
|
object HideSimIcon: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy".hookBeforeMethod(lpparam.classLoader, "hasCorrectSubs", MutableList::class.java) {
|
override fun init() {
|
||||||
|
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy".hookBeforeMethod(getDefaultClassLoader(), "hasCorrectSubs", MutableList::class.java) {
|
||||||
val list = it.args[0] as MutableList<*>
|
val list = it.args[0] as MutableList<*>
|
||||||
val size = list.size
|
val size = list.size
|
||||||
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
|
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
|
||||||
@@ -18,4 +18,5 @@ class HideSimIcon :IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideSlaveWifiIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.policy.SlaveWifiSignalController".hookBeforeMethod(lpparam.classLoader, "updateIconState") {
|
|
||||||
hasEnable("hide_slave_wifi_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
|
|
||||||
|
object HideStatusBarIcon: HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
"com.android.systemui.statusbar.phone.StatusBarIconControllerImpl".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"setIconVisibility",
|
||||||
|
String::class.java,
|
||||||
|
Boolean::class.java
|
||||||
|
) { hideIcon(it) }
|
||||||
|
|
||||||
|
"com.android.systemui.statusbar.phone.MiuiDripLeftStatusBarIconControllerImpl".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"setIconVisibility",
|
||||||
|
String::class.java,
|
||||||
|
Boolean::class.java
|
||||||
|
) { hideIcon(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun hideIcon(it: XC_MethodHook.MethodHookParam) {
|
||||||
|
//Log.d("图标名字", "handleLoadPackage: " + it.args[0])
|
||||||
|
when (it.args[0] as String) {
|
||||||
|
//隐藏蓝牙
|
||||||
|
"bluetooth" -> hasEnable("hide_bluetooth_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏蓝牙电量
|
||||||
|
"bluetooth_handsfree_battery" -> hasEnable("hide_bluetooth_battery_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏勿扰
|
||||||
|
"zen" -> hasEnable("hide_zen_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏声音
|
||||||
|
"volume" -> hasEnable("hide_volume_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏WIFI
|
||||||
|
"wifi" -> hasEnable("hide_wifi_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏WIFI辅助
|
||||||
|
"slave_wifi" -> hasEnable("hide_slave_wifi_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏飞行模式
|
||||||
|
"airplane" -> hasEnable("hide_airplane_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏闹钟
|
||||||
|
"alarm_clock" -> hasEnable("hide_alarm_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏定位
|
||||||
|
"location" -> hasEnable("hide_gps_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏热点
|
||||||
|
"hotspot" -> hasEnable("hide_hotspot_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏耳机
|
||||||
|
"headset" -> hasEnable("hide_headset_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏VPN
|
||||||
|
"vpn" -> hasEnable("hide_vpn_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
//隐藏无SIM卡
|
||||||
|
"no_sim" -> hasEnable("hide_no_sim_icon") {
|
||||||
|
it.args[1] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,20 +3,22 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import com.lt2333.simplicitytools.util.isNonNull
|
import com.lt2333.simplicitytools.util.isNonNull
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideStatusBarNetworkSpeedSecond :IXposedHookLoadPackage {
|
object HideStatusBarNetworkSpeedSecond: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.views.NetworkSpeedView".hookBeforeMethod(lpparam.classLoader, "setNetworkSpeed", String::class.java) {
|
override fun init() {
|
||||||
|
"com.android.systemui.statusbar.views.NetworkSpeedView".hookBeforeMethod(getDefaultClassLoader(), "setNetworkSpeed", String::class.java) {
|
||||||
hasEnable("hide_status_bar_network_speed_second") {
|
hasEnable("hide_status_bar_network_speed_second") {
|
||||||
it.args[0].isNonNull { s ->
|
it.args[0].isNonNull { s ->
|
||||||
it.args[0] = (s as String)
|
it.args[0] = (s as String)
|
||||||
.replace("/", "")
|
.replace("/", "")
|
||||||
.replace("s", "")
|
.replace("s", "")
|
||||||
.replace("'", "")
|
.replace("'", "")
|
||||||
|
.replace("วิ", "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideVolumeZenIcon :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarPolicy".hookBeforeMethod(lpparam.classLoader, "updateVolumeZen") {
|
|
||||||
hasEnable("hide_volume_zen_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideVpnIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.phone.StatusBarSignalPolicy".hookBeforeMethod(lpparam.classLoader, "updateVpn") {
|
|
||||||
hasEnable("hide_vpn_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,13 +6,13 @@ import android.widget.TextView
|
|||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideWifiActivityIcon : IXposedHookLoadPackage {
|
object HideWifiActivityIcon: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState"
|
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState"
|
||||||
"com.android.systemui.statusbar.StatusBarWifiView".hookAfterMethod(lpparam.classLoader, "initViewState", iconState) {
|
"com.android.systemui.statusbar.StatusBarWifiView".hookAfterMethod(getDefaultClassLoader(), "initViewState", iconState) {
|
||||||
//隐藏WIFI箭头
|
//隐藏WIFI箭头
|
||||||
hasEnable("hide_wifi_activity_icon") {
|
hasEnable("hide_wifi_activity_icon") {
|
||||||
(it.thisObject.getObjectField("mWifiActivityView") as ImageView).visibility = View.INVISIBLE
|
(it.thisObject.getObjectField("mWifiActivityView") as ImageView).visibility = View.INVISIBLE
|
||||||
@@ -23,7 +23,7 @@ class HideWifiActivityIcon : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"com.android.systemui.statusbar.StatusBarWifiView".hookAfterMethod(lpparam.classLoader, "updateState", iconState) {
|
"com.android.systemui.statusbar.StatusBarWifiView".hookAfterMethod(getDefaultClassLoader(), "updateState", iconState) {
|
||||||
//隐藏WIFI箭头
|
//隐藏WIFI箭头
|
||||||
hasEnable("hide_wifi_activity_icon") {
|
hasEnable("hide_wifi_activity_icon") {
|
||||||
(it.thisObject.getObjectField("mWifiActivityView") as ImageView).visibility = View.INVISIBLE
|
(it.thisObject.getObjectField("mWifiActivityView") as ImageView).visibility = View.INVISIBLE
|
||||||
@@ -34,4 +34,5 @@ class HideWifiActivityIcon : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class HideWifiIcon : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val iconState = "com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState"
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiStatusBarSignalPolicy".hookBeforeMethod(lpparam.classLoader, "updateWifiIconWithState", iconState) {
|
|
||||||
hasEnable("hide_wifi_icon") {
|
|
||||||
it.result = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Handler
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
|
import java.lang.reflect.Method
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
object LockScreenClockDisplaySeconds : HookRegister() {
|
||||||
|
|
||||||
|
private var nowTime: Date = Calendar.getInstance().time
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("lock_screen_clock_display_seconds") {
|
||||||
|
"com.miui.clock.MiuiBaseClock".findClass(getDefaultClassLoader())
|
||||||
|
.hookAfterConstructor(
|
||||||
|
Context::class.java,
|
||||||
|
AttributeSet::class.java
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
val viewGroup = it.thisObject as LinearLayout
|
||||||
|
|
||||||
|
val d: Method = viewGroup.javaClass.getDeclaredMethod("updateTime")
|
||||||
|
val r = Runnable {
|
||||||
|
d.isAccessible = true
|
||||||
|
d.invoke(viewGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
class T : TimerTask() {
|
||||||
|
override fun run() {
|
||||||
|
Handler(viewGroup.context.mainLooper).post(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Timer().scheduleAtFixedRate(
|
||||||
|
T(),
|
||||||
|
1000 - System.currentTimeMillis() % 1000,
|
||||||
|
1000
|
||||||
|
)
|
||||||
|
} catch (e: java.lang.Exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"com.miui.clock.MiuiLeftTopClock".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateTime"
|
||||||
|
) {
|
||||||
|
updateTime(it, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.miui.clock.MiuiLeftTopLargeClock".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateTime"
|
||||||
|
) {
|
||||||
|
updateTime(it, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.miui.clock.MiuiCenterHorizontalClock".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateTime"
|
||||||
|
) {
|
||||||
|
updateTime(it, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.miui.clock.MiuiVerticalClock".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateTime"
|
||||||
|
) {
|
||||||
|
updateTime(it, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateTime(it: XC_MethodHook.MethodHookParam, isVertical: Boolean) {
|
||||||
|
val textV = it.thisObject.getObjectField("mTimeText") as TextView
|
||||||
|
val c: Context = textV.context
|
||||||
|
|
||||||
|
Log.d(
|
||||||
|
"lock_screen_clock_display_seconds",
|
||||||
|
"updateTime: " + it.thisObject.javaClass.simpleName
|
||||||
|
)
|
||||||
|
val is24 = Settings.System.getString(
|
||||||
|
c.contentResolver,
|
||||||
|
Settings.System.TIME_12_24
|
||||||
|
) == "24"
|
||||||
|
|
||||||
|
nowTime = Calendar.getInstance().time
|
||||||
|
|
||||||
|
textV.text = getTime(is24, isVertical)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
private fun getTime(is24: Boolean, isVertical: Boolean): String {
|
||||||
|
var timePattern = ""
|
||||||
|
if (isVertical) { //垂直
|
||||||
|
timePattern += if (is24) "HH\nmm\nss" else "hh\nmm\nss"
|
||||||
|
} else { //水平
|
||||||
|
timePattern += if (is24) "HH:mm:ss" else "h:mm:ss"
|
||||||
|
}
|
||||||
|
timePattern = SimpleDateFormat(timePattern).format(nowTime)
|
||||||
|
return timePattern
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.github.kyuubiran.ezxhelper.init.InitFields
|
||||||
|
import com.lt2333.simplicitytools.R
|
||||||
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
import java.io.BufferedReader
|
||||||
|
import java.io.FileReader
|
||||||
|
import java.lang.reflect.Method
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
object LockScreenCurrent : HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("lock_screen_charging_current") {
|
||||||
|
"com.android.keyguard.charge.ChargeUtils".findClass(getDefaultClassLoader())
|
||||||
|
.hookAfterMethod(
|
||||||
|
"getChargingHintText",
|
||||||
|
Context::class.java,
|
||||||
|
Boolean::class.java,
|
||||||
|
Int::class.java
|
||||||
|
) {
|
||||||
|
it.result = getCurrent() + "\n" + it.result
|
||||||
|
}
|
||||||
|
"com.android.systemui.statusbar.phone.KeyguardBottomAreaView".findClass(getDefaultClassLoader())
|
||||||
|
.hookAfterMethod(
|
||||||
|
"onFinishInflate"
|
||||||
|
) {
|
||||||
|
(XposedHelpers.getObjectField(
|
||||||
|
it.thisObject,
|
||||||
|
"mIndicationText"
|
||||||
|
) as TextView).isSingleLine = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原始代码来自 CSDN
|
||||||
|
* https://blog.csdn.net/zhangyongfeiyong/article/details/53641809
|
||||||
|
*/
|
||||||
|
@SuppressLint("PrivateApi")
|
||||||
|
private fun getCurrent(): String {
|
||||||
|
var result = ""
|
||||||
|
try {
|
||||||
|
val systemProperties = Class.forName("android.os.SystemProperties")
|
||||||
|
val get = systemProperties.getDeclaredMethod("get", String::class.java) as Method
|
||||||
|
val platName = get.invoke(null, "ro.hardware") as String
|
||||||
|
if (platName.startsWith("mt") || platName.startsWith("MT")) {
|
||||||
|
val filePath =
|
||||||
|
"/sys/class/power_supply/battery/device/FG_Battery_CurrentConsumption"
|
||||||
|
val current = (-getMeanCurrentVal(filePath, 5, 0) / 1000.0f).roundToInt()
|
||||||
|
result = "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
|
||||||
|
} else if (platName.startsWith("qcom")) {
|
||||||
|
val filePath = "/sys/class/power_supply/battery/current_now"
|
||||||
|
val current = (-getMeanCurrentVal(filePath, 5, 0) / 1000.0f).roundToInt()
|
||||||
|
result = "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平均电流值
|
||||||
|
* 获取 filePath 文件 totalCount 次数的平均值,每次采样间隔 intervalMs 时间
|
||||||
|
*/
|
||||||
|
private fun getMeanCurrentVal(filePath: String, totalCount: Int, intervalMs: Int): Float {
|
||||||
|
var meanVal = 0.0f
|
||||||
|
if (totalCount <= 0) {
|
||||||
|
return 0.0f
|
||||||
|
}
|
||||||
|
for (i in 0 until totalCount) {
|
||||||
|
try {
|
||||||
|
val f: Float = readFile(filePath, 0).toFloat()
|
||||||
|
meanVal += f / totalCount
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
if (intervalMs <= 0) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(intervalMs.toLong())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return meanVal
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun readFile(path: String, defaultValue: Int): Int {
|
||||||
|
try {
|
||||||
|
val bufferedReader = BufferedReader(FileReader(path))
|
||||||
|
val i: Int = bufferedReader.readLine().toInt(10)
|
||||||
|
bufferedReader.close()
|
||||||
|
return i
|
||||||
|
} catch (localException: java.lang.Exception) {
|
||||||
|
}
|
||||||
|
return defaultValue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.KeyguardManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.SystemClock
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import android.view.View
|
||||||
|
import android.view.View.OnTouchListener
|
||||||
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
object LockScreenDoubleTapToSleep: HookRegister() {
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("lock_screen_double_tap_to_sleep") {
|
||||||
|
"com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
).hookBeforeMethod("onFinishInflate") {
|
||||||
|
val view = it.thisObject as View
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchTime", 0L)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", 0f)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", 0f)
|
||||||
|
view.setOnTouchListener(OnTouchListener { v, event ->
|
||||||
|
if (event.action != MotionEvent.ACTION_DOWN) return@OnTouchListener false
|
||||||
|
var currentTouchTime =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchTime") as Long
|
||||||
|
var currentTouchX =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchX") as Float
|
||||||
|
var currentTouchY =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchY") as Float
|
||||||
|
val lastTouchTime = currentTouchTime
|
||||||
|
val lastTouchX = currentTouchX
|
||||||
|
val lastTouchY = currentTouchY
|
||||||
|
currentTouchTime = System.currentTimeMillis()
|
||||||
|
currentTouchX = event.x
|
||||||
|
currentTouchY = event.y
|
||||||
|
if (currentTouchTime - lastTouchTime < 250L && Math.abs(currentTouchX - lastTouchX) < 100f && Math.abs(
|
||||||
|
currentTouchY - lastTouchY
|
||||||
|
) < 100f
|
||||||
|
) {
|
||||||
|
val keyguardMgr =
|
||||||
|
v.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
|
if (keyguardMgr.isKeyguardLocked) {
|
||||||
|
XposedHelpers.callMethod(
|
||||||
|
v.context.getSystemService(Context.POWER_SERVICE),
|
||||||
|
"goToSleep",
|
||||||
|
SystemClock.uptimeMillis()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
currentTouchTime = 0L
|
||||||
|
currentTouchX = 0f
|
||||||
|
currentTouchY = 0f
|
||||||
|
}
|
||||||
|
XposedHelpers.setAdditionalInstanceField(
|
||||||
|
view,
|
||||||
|
"currentTouchTime",
|
||||||
|
currentTouchTime
|
||||||
|
)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", currentTouchX)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", currentTouchY)
|
||||||
|
false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object MaximumNumberOfNotificationIcons: HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
val icons = XSPUtils.getInt("maximum_number_of_notification_icons",3)
|
||||||
|
val dots = XSPUtils.getInt("maximum_number_of_notification_dots",3)
|
||||||
|
"com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(getDefaultClassLoader(), "miuiShowNotificationIcons", Boolean::class.java) {
|
||||||
|
if (it.args[0] as Boolean) {
|
||||||
|
it.thisObject.setIntField("MAX_DOTS", dots)
|
||||||
|
it.thisObject.setIntField("MAX_STATIC_ICONS", icons)
|
||||||
|
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", icons)
|
||||||
|
} else {
|
||||||
|
it.thisObject.setIntField("MAX_DOTS", 0)
|
||||||
|
it.thisObject.setIntField("MAX_STATIC_ICONS", 0)
|
||||||
|
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", 0)
|
||||||
|
}
|
||||||
|
it.thisObject.callMethod("updateState")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,46 +4,213 @@ import android.content.ComponentName
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import cn.fkj233.ui.activity.dp2px
|
||||||
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class NotificationWeather : IXposedHookLoadPackage {
|
object NotificationWeather: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
hasEnable("notification_weather") {
|
hasEnable("notification_weather") {
|
||||||
var mWeatherView: TextView? = null
|
var mWeatherView: TextView? = null
|
||||||
|
var mConstraintLayout: ConstraintLayout? = null
|
||||||
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
||||||
"com.android.systemui.qs.MiuiNotificationHeaderView".hookAfterMethod(lpparam.classLoader, "onFinishInflate") {
|
"com.android.systemui.qs.MiuiNotificationHeaderView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"onFinishInflate"
|
||||||
|
) {
|
||||||
val viewGroup = it.thisObject as ViewGroup
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
val context = viewGroup.context
|
val context = viewGroup.context
|
||||||
val layoutParam = loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams").getConstructor(Int::class.java, Int::class.java).newInstance(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) as ViewGroup.MarginLayoutParams
|
|
||||||
layoutParam.setObjectField("bottomToTop", context.resources.getIdentifier("date_time", "id", context.packageName))
|
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||||
layoutParam.setObjectField("startToEnd", context.resources.getIdentifier("big_time", "id", context.packageName))
|
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||||
layoutParam.marginStart = context.resources.getDimensionPixelSize(context.resources.getIdentifier("notification_panel_time_date_space", "dimen", context.packageName))
|
.toInt() >= 1647014400 &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("DEV") &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("XM")
|
||||||
|
) {
|
||||||
|
//获取原组件
|
||||||
|
val big_time_ID =
|
||||||
|
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||||
|
val big_time: TextView = viewGroup.findViewById(big_time_ID)
|
||||||
|
|
||||||
|
val date_time_ID =
|
||||||
|
context.resources.getIdentifier("date_time", "id", context.packageName)
|
||||||
|
val date_time: TextView = viewGroup.findViewById(date_time_ID)
|
||||||
|
|
||||||
|
//创建新布局
|
||||||
|
val mConstraintLayoutLp = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.topMargin = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"qs_control_header_tiles_margin_top",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mConstraintLayout =
|
||||||
|
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
|
||||||
|
|
||||||
|
(big_time.parent as ViewGroup).addView(mConstraintLayout, 0)
|
||||||
|
|
||||||
|
|
||||||
|
//从原布局中删除组件
|
||||||
|
(big_time.parent as ViewGroup).removeView(big_time)
|
||||||
|
(date_time.parent as ViewGroup).removeView(date_time)
|
||||||
|
|
||||||
|
|
||||||
|
//添加组件至新布局
|
||||||
|
mConstraintLayout!!.addView(big_time)
|
||||||
|
mConstraintLayout!!.addView(date_time)
|
||||||
|
|
||||||
|
//组件属性
|
||||||
|
|
||||||
|
val date_time_LP = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.startToEnd = big_time_ID
|
||||||
|
it.bottomToBottom = 0
|
||||||
|
it.marginStart = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_panel_time_date_space",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
it.bottomMargin = dp2px(context, 5f)
|
||||||
|
}
|
||||||
|
date_time.layoutParams = date_time_LP
|
||||||
|
|
||||||
|
|
||||||
|
//创建天气组件
|
||||||
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
||||||
setTextAppearance(context.resources.getIdentifier("TextAppearance.QSControl.Date", "style", context.packageName))
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"TextAppearance.QSControl.Date",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
mConstraintLayout!!.addView(mWeatherView)
|
||||||
|
|
||||||
|
val mWeatherView_LP = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.startToEnd = big_time_ID
|
||||||
|
it.bottomToTop = date_time_ID
|
||||||
|
it.marginStart = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_panel_time_date_space",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
(mWeatherView as WeatherView).layoutParams = mWeatherView_LP
|
||||||
|
|
||||||
|
} else {
|
||||||
|
val layoutParam =
|
||||||
|
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams").getConstructor(
|
||||||
|
Int::class.java,
|
||||||
|
Int::class.java
|
||||||
|
).newInstance(
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
) as ViewGroup.MarginLayoutParams
|
||||||
|
layoutParam.setObjectField(
|
||||||
|
"bottomToTop",
|
||||||
|
context.resources.getIdentifier("date_time", "id", context.packageName)
|
||||||
|
)
|
||||||
|
layoutParam.setObjectField(
|
||||||
|
"startToEnd",
|
||||||
|
context.resources.getIdentifier("big_time", "id", context.packageName)
|
||||||
|
)
|
||||||
|
layoutParam.marginStart = context.resources.getDimensionPixelSize(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_panel_time_date_space",
|
||||||
|
"dimen",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
||||||
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"TextAppearance.QSControl.Date",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
layoutParams = layoutParam
|
layoutParams = layoutParam
|
||||||
}
|
}
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
|
}
|
||||||
|
|
||||||
(mWeatherView as WeatherView).setOnClickListener {
|
(mWeatherView as WeatherView).setOnClickListener {
|
||||||
try {
|
try {
|
||||||
val intent = Intent().apply {
|
val intent = Intent().apply {
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
component = ComponentName("com.miui.weather2", "com.miui.weather2.ActivityWeatherMain")
|
component = ComponentName(
|
||||||
|
"com.miui.weather2",
|
||||||
|
"com.miui.weather2.ActivityWeatherMain"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
|
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
"com.android.systemui.qs.MiuiNotificationHeaderView".hookAfterMethod(lpparam.classLoader, "updateLayout") {
|
"com.android.systemui.qs.MiuiNotificationHeaderView".hookAfterMethod(
|
||||||
val mOrientation = it.thisObject.getObjectField("mOrientation") as Int
|
getDefaultClassLoader(),
|
||||||
|
"updateLayout"
|
||||||
|
) {
|
||||||
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
|
val context = viewGroup.context
|
||||||
|
val mOrientation = viewGroup.getObjectField("mOrientation") as Int
|
||||||
|
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||||
|
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||||
|
.toInt() >= 1647014400 &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("DEV") &&
|
||||||
|
|
||||||
|
!SystemProperties.get(
|
||||||
|
context,
|
||||||
|
"ro.build.version.incremental"
|
||||||
|
)!!.endsWith("XM")
|
||||||
|
) {
|
||||||
|
if (mOrientation == 1) {
|
||||||
|
mConstraintLayout!!.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
mConstraintLayout!!.visibility = View.GONE
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (mOrientation == 1) {
|
if (mOrientation == 1) {
|
||||||
mWeatherView!!.visibility = View.VISIBLE
|
mWeatherView!!.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
@@ -52,4 +219,6 @@ class NotificationWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,28 +8,62 @@ import android.widget.TextView
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.*
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import com.lt2333.simplicitytools.view.WeatherView
|
import com.lt2333.simplicitytools.view.WeatherView
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class OldNotificationWeather : IXposedHookLoadPackage {
|
object OldNotificationWeather: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
override fun init() {
|
||||||
hasEnable("notification_weather") {
|
hasEnable("notification_weather") {
|
||||||
var mWeatherView: TextView? = null
|
var mWeatherView: TextView? = null
|
||||||
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
||||||
"com.android.systemui.qs.MiuiQSHeaderView".hookAfterMethod(lpparam.classLoader, "onFinishInflate") {
|
"com.android.systemui.qs.MiuiQSHeaderView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"onFinishInflate"
|
||||||
|
) {
|
||||||
val viewGroup = it.thisObject as ViewGroup
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
val context = viewGroup.context
|
val context = viewGroup.context
|
||||||
val layoutParam = loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams")
|
val layoutParam =
|
||||||
|
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams")
|
||||||
.getConstructor(Int::class.java, Int::class.java)
|
.getConstructor(Int::class.java, Int::class.java)
|
||||||
.newInstance(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) as ViewGroup.MarginLayoutParams
|
.newInstance(
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
) as ViewGroup.MarginLayoutParams
|
||||||
|
|
||||||
layoutParam.setObjectField("engToStart", context.resources.getIdentifier("notification_shade_shortcut", "id", context.packageName))
|
layoutParam.setObjectField(
|
||||||
layoutParam.setObjectField("topToTop", context.resources.getIdentifier("notification_shade_shortcut", "id", context.packageName))
|
"endToStart",
|
||||||
layoutParam.setObjectField("bottomToBottom", context.resources.getIdentifier("notification_shade_shortcut", "id", context.packageName))
|
context.resources.getIdentifier(
|
||||||
|
"notification_shade_shortcut",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
layoutParam.setObjectField(
|
||||||
|
"topToTop",
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_shade_shortcut",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
layoutParam.setObjectField(
|
||||||
|
"bottomToBottom",
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"notification_shade_shortcut",
|
||||||
|
"id",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
mWeatherView = WeatherView(context, isDisplayCity).apply {
|
||||||
setTextAppearance(context.resources.getIdentifier("TextAppearance.StatusBar.Expanded.Clock.QuickSettingDate", "style", context.packageName))
|
setTextAppearance(
|
||||||
|
context.resources.getIdentifier(
|
||||||
|
"TextAppearance.StatusBar.Expanded.Clock.QuickSettingDate",
|
||||||
|
"style",
|
||||||
|
context.packageName
|
||||||
|
)
|
||||||
|
)
|
||||||
layoutParams = layoutParam
|
layoutParams = layoutParam
|
||||||
}
|
}
|
||||||
viewGroup.addView(mWeatherView)
|
viewGroup.addView(mWeatherView)
|
||||||
@@ -37,7 +71,10 @@ class OldNotificationWeather : IXposedHookLoadPackage {
|
|||||||
try {
|
try {
|
||||||
val intent = Intent().apply {
|
val intent = Intent().apply {
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
component = ComponentName("com.miui.weather2", "com.miui.weather2.ActivityWeatherMain")
|
component = ComponentName(
|
||||||
|
"com.miui.weather2",
|
||||||
|
"com.miui.weather2.ActivityWeatherMain"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -46,7 +83,10 @@ class OldNotificationWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//解决横屏重叠
|
//解决横屏重叠
|
||||||
"com.android.systemui.qs.MiuiQSHeaderView".hookAfterMethod(lpparam.classLoader, "updateLayout") {
|
"com.android.systemui.qs.MiuiQSHeaderView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateLayout"
|
||||||
|
) {
|
||||||
val mOritation = it.thisObject.getObjectField("mOrientation") as Int
|
val mOritation = it.thisObject.getObjectField("mOrientation") as Int
|
||||||
if (mOritation == 1) {
|
if (mOritation == 1) {
|
||||||
mWeatherView!!.visibility = View.VISIBLE
|
mWeatherView!!.visibility = View.VISIBLE
|
||||||
@@ -56,5 +96,6 @@ class OldNotificationWeather : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
object OldQSCustom: HookRegister() {
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("old_qs_custom_switch") {
|
||||||
|
val mRows = XSPUtils.getInt("qs_custom_rows", 3)
|
||||||
|
val mRowsHorizontal = XSPUtils.getInt("qs_custom_rows_horizontal", 2)
|
||||||
|
val mColumns = XSPUtils.getInt("qs_custom_columns", 4)
|
||||||
|
val mColumnsUnexpanded = XSPUtils.getInt("qs_custom_columns_unexpanded", 5)
|
||||||
|
|
||||||
|
"com.android.systemui.qs.MiuiQuickQSPanel".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"setMaxTiles", Int::class.java
|
||||||
|
) {
|
||||||
|
//未展开时的列数
|
||||||
|
it.args[0] = mColumnsUnexpanded
|
||||||
|
}
|
||||||
|
|
||||||
|
"com.android.systemui.qs.MiuiTileLayout".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateColumns"
|
||||||
|
) {
|
||||||
|
//展开时的列数
|
||||||
|
XposedHelpers.setObjectField(it.thisObject, "mColumns", mColumns)
|
||||||
|
}
|
||||||
|
"com.android.systemui.qs.MiuiTileLayout".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateResources"
|
||||||
|
) {
|
||||||
|
//展开时的行数
|
||||||
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
|
val mConfiguration: Configuration = viewGroup.context.resources.configuration
|
||||||
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
|
XposedHelpers.setObjectField(viewGroup, "mMaxAllowedRows", mRows)
|
||||||
|
} else {
|
||||||
|
XposedHelpers.setObjectField(viewGroup, "mMaxAllowedRows", mRowsHorizontal)
|
||||||
|
}
|
||||||
|
viewGroup.requestLayout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,30 +6,30 @@ import com.lt2333.simplicitytools.util.getObjectField
|
|||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveLockScreenCamera : IXposedHookLoadPackage {
|
object RemoveLockScreenCamera: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
//屏蔽右下角组件显示
|
//屏蔽右下角组件显示
|
||||||
"com.android.systemui.statusbar.phone.KeyguardBottomAreaView".hookAfterMethod(lpparam.classLoader, "onFinishInflate") {
|
"com.android.systemui.statusbar.phone.KeyguardBottomAreaView".hookAfterMethod(getDefaultClassLoader(), "onFinishInflate") {
|
||||||
hasEnable("remove_lock_screen_camera") {
|
hasEnable("remove_lock_screen_camera") {
|
||||||
(it.thisObject.getObjectField("mRightAffordanceViewLayout") as LinearLayout).visibility = View.GONE
|
(it.thisObject.getObjectField("mRightAffordanceViewLayout") as LinearLayout).visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//屏蔽滑动撞墙动画
|
//屏蔽滑动撞墙动画
|
||||||
"com.android.keyguard.KeyguardMoveRightController".hookBeforeMethod(lpparam.classLoader, "onTouchMove", Float::class.java, Float::class.java) {
|
"com.android.keyguard.KeyguardMoveRightController".hookBeforeMethod(getDefaultClassLoader(), "onTouchMove", Float::class.java, Float::class.java) {
|
||||||
hasEnable("remove_lock_screen_camera") {
|
hasEnable("remove_lock_screen_camera") {
|
||||||
it.result = false
|
it.result = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"com.android.keyguard.KeyguardMoveRightController".hookBeforeMethod(lpparam.classLoader, "reset") {
|
"com.android.keyguard.KeyguardMoveRightController".hookBeforeMethod(getDefaultClassLoader(), "reset") {
|
||||||
hasEnable("remove_lock_screen_camera") {
|
hasEnable("remove_lock_screen_camera") {
|
||||||
it.result = null
|
it.result = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveTheLeftSideOfTheLockScreen : IXposedHookLoadPackage {
|
object RemoveTheLeftSideOfTheLockScreen: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.keyguard.negative.MiuiKeyguardMoveLeftViewContainer".hookBeforeMethod(lpparam.classLoader, "inflateLeftView") {
|
override fun init() {
|
||||||
|
"com.android.keyguard.negative.MiuiKeyguardMoveLeftViewContainer".hookBeforeMethod(getDefaultClassLoader(), "inflateLeftView") {
|
||||||
hasEnable("remove_the_left_side_of_the_lock_screen") {
|
hasEnable("remove_the_left_side_of_the_lock_screen") {
|
||||||
it.result = null
|
it.result = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.callMethod
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
|
||||||
import com.lt2333.simplicitytools.util.replaceMethod
|
|
||||||
import com.lt2333.simplicitytools.util.setIntField
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveTheMaximumNumberOfNotificationIcons : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
hasEnable("remove_the_maximum_number_of_notification_icons") {
|
|
||||||
"com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(lpparam.classLoader, "miuiShowNotificationIcons", Boolean::class.java) {
|
|
||||||
if (it.args[0] as Boolean) {
|
|
||||||
it.thisObject.setIntField("MAX_DOTS", 30)
|
|
||||||
it.thisObject.setIntField("MAX_STATIC_ICONS", 30)
|
|
||||||
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", 30)
|
|
||||||
} else {
|
|
||||||
it.thisObject.setIntField("MAX_DOTS", 0)
|
|
||||||
it.thisObject.setIntField("MAX_STATIC_ICONS", 0)
|
|
||||||
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", 0)
|
|
||||||
}
|
|
||||||
it.thisObject.callMethod("updateState")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
|
||||||
|
object StatusBarBigMobileTypeIcon: HookRegister() {
|
||||||
|
|
||||||
|
private val upAndDownPosition = XSPUtils.getInt("big_mobile_type_icon_up_and_down_position", 0)
|
||||||
|
private val leftAndRightMargin = XSPUtils.getInt("big_mobile_type_icon_left_and_right_margins", 0)
|
||||||
|
private val isBold = XSPUtils.getBoolean("big_mobile_type_icon_bold", true)
|
||||||
|
private val size = XSPUtils.getFloat("big_mobile_type_icon_size", 12.5f)
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("big_mobile_type_icon") {
|
||||||
|
"com.android.systemui.statusbar.StatusBarMobileView".hookAfterMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"init"
|
||||||
|
) {
|
||||||
|
val statusBarMobileView = it.thisObject as ViewGroup
|
||||||
|
val context: Context = statusBarMobileView.context
|
||||||
|
val res: Resources = context.resources
|
||||||
|
|
||||||
|
//获取组件
|
||||||
|
val mobileContainerLeftId: Int =
|
||||||
|
res.getIdentifier("mobile_container_left", "id", "com.android.systemui")
|
||||||
|
val mobileContainerLeft =
|
||||||
|
statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId)
|
||||||
|
|
||||||
|
val mobileTypeId: Int =
|
||||||
|
res.getIdentifier("mobile_type", "id", "com.android.systemui")
|
||||||
|
val mobileType = statusBarMobileView.findViewById<TextView>(mobileTypeId)
|
||||||
|
|
||||||
|
val mobileLeftMobileInoutId: Int = res.getIdentifier(
|
||||||
|
"mobile_left_mobile_inout",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val mobileLeftMobileInout =
|
||||||
|
statusBarMobileView.findViewById<ImageView>(mobileLeftMobileInoutId)
|
||||||
|
|
||||||
|
|
||||||
|
//获取插入位置
|
||||||
|
val mobileContainerRightId: Int = res.getIdentifier(
|
||||||
|
"mobile_container_right",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val mobileContainerRight =
|
||||||
|
statusBarMobileView.findViewById<ViewGroup>(mobileContainerRightId)
|
||||||
|
val rightParentLayout = mobileContainerRight.parent as ViewGroup
|
||||||
|
val mobileContainerRightIndex =
|
||||||
|
rightParentLayout.indexOfChild(mobileContainerRight)
|
||||||
|
|
||||||
|
//创建新布局
|
||||||
|
val newLinearLayoutLP = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
).also {
|
||||||
|
|
||||||
|
}
|
||||||
|
val newLinearlayout = LinearLayout(context).also {
|
||||||
|
it.layoutParams = newLinearLayoutLP
|
||||||
|
it.id = mobileContainerLeftId
|
||||||
|
it.setPadding(leftAndRightMargin, 0, leftAndRightMargin, 0)
|
||||||
|
}
|
||||||
|
XposedHelpers.setObjectField(it.thisObject, "mMobileLeftContainer", newLinearlayout)
|
||||||
|
rightParentLayout.addView(
|
||||||
|
newLinearlayout,
|
||||||
|
mobileContainerRightIndex
|
||||||
|
)
|
||||||
|
|
||||||
|
//将组件插入新的布局
|
||||||
|
(mobileType.parent as ViewGroup).removeView(mobileType)
|
||||||
|
(mobileLeftMobileInout.parent as ViewGroup).removeView(mobileLeftMobileInout)
|
||||||
|
(mobileContainerLeft.parent as ViewGroup).removeView(mobileContainerLeft)
|
||||||
|
|
||||||
|
|
||||||
|
newLinearlayout.addView(mobileType) //类型
|
||||||
|
val mobileTypeLp = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
).also {
|
||||||
|
it.gravity = Gravity.CENTER_VERTICAL
|
||||||
|
it.topMargin = upAndDownPosition
|
||||||
|
}
|
||||||
|
mobileType.also {
|
||||||
|
it.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size)
|
||||||
|
if (isBold) {
|
||||||
|
it.typeface = Typeface.DEFAULT_BOLD
|
||||||
|
}
|
||||||
|
it.layoutParams = mobileTypeLp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
newLinearlayout.addView(mobileLeftMobileInout) //箭头
|
||||||
|
val mobileLeftMobileInoutLp = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
mobileLeftMobileInout.also {
|
||||||
|
it.layoutParams = mobileLeftMobileInoutLp
|
||||||
|
}
|
||||||
|
|
||||||
|
//屏蔽更新布局
|
||||||
|
"com.android.systemui.statusbar.StatusBarMobileView".hookBeforeMethod(
|
||||||
|
getDefaultClassLoader(),
|
||||||
|
"updateMobileTypeLayout", String::class.java
|
||||||
|
) {
|
||||||
|
it.result = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
|
||||||
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.TextView
|
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class StatusBarCurrent :IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val miuiPhoneStatusBarViewClass =
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView".findClass(lpparam.classLoader)
|
|
||||||
miuiPhoneStatusBarViewClass.hookAfterMethod("onFinishInflate") { param ->
|
|
||||||
val viewGroup = param.thisObject as ViewGroup
|
|
||||||
val textView = TextView(viewGroup.context).also {
|
|
||||||
it.text = "Text"
|
|
||||||
it.textSize = 14F
|
|
||||||
}
|
|
||||||
viewGroup.addView(textView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.SystemClock
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import android.view.View.OnTouchListener
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
|
object StatusBarDoubleTapToSleep: HookRegister() {
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
override fun init() {
|
||||||
|
hasEnable("status_bar_double_tap_to_sleep") {
|
||||||
|
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
).hookBeforeMethod(
|
||||||
|
"onFinishInflate"
|
||||||
|
) {
|
||||||
|
val view = it.thisObject as ViewGroup
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchTime", 0L)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", 0f)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", 0f)
|
||||||
|
view.setOnTouchListener(OnTouchListener { v, event ->
|
||||||
|
if (event.action != MotionEvent.ACTION_DOWN) return@OnTouchListener false
|
||||||
|
var currentTouchTime =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchTime") as Long
|
||||||
|
var currentTouchX =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchX") as Float
|
||||||
|
var currentTouchY =
|
||||||
|
XposedHelpers.getAdditionalInstanceField(view, "currentTouchY") as Float
|
||||||
|
val lastTouchTime = currentTouchTime
|
||||||
|
val lastTouchX = currentTouchX
|
||||||
|
val lastTouchY = currentTouchY
|
||||||
|
currentTouchTime = System.currentTimeMillis()
|
||||||
|
currentTouchX = event.x
|
||||||
|
currentTouchY = event.y
|
||||||
|
if (currentTouchTime - lastTouchTime < 250L && Math.abs(currentTouchX - lastTouchX) < 100f && Math.abs(
|
||||||
|
currentTouchY - lastTouchY
|
||||||
|
) < 100f
|
||||||
|
) {
|
||||||
|
XposedHelpers.callMethod(
|
||||||
|
v.context.getSystemService(Context.POWER_SERVICE),
|
||||||
|
"goToSleep",
|
||||||
|
SystemClock.uptimeMillis()
|
||||||
|
)
|
||||||
|
currentTouchTime = 0L
|
||||||
|
currentTouchX = 0f
|
||||||
|
currentTouchY = 0f
|
||||||
|
}
|
||||||
|
XposedHelpers.setAdditionalInstanceField(
|
||||||
|
view,
|
||||||
|
"currentTouchTime",
|
||||||
|
currentTouchTime
|
||||||
|
)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", currentTouchX)
|
||||||
|
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", currentTouchY)
|
||||||
|
false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.KeyguardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
@@ -7,33 +9,41 @@ import android.os.Bundle
|
|||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import cn.fkj233.ui.activity.dp2px
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
|
||||||
class StatusBarLayout : IXposedHookLoadPackage {
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
object StatusBarLayout : HookRegister() {
|
||||||
|
|
||||||
private var mLeftLayout: LinearLayout? = null
|
private var mLeftLayout: LinearLayout? = null
|
||||||
private var mRightLayout: LinearLayout? = null
|
private var mRightLayout: LinearLayout? = null
|
||||||
private var mCenterLayout: LinearLayout? = null
|
private var mCenterLayout: LinearLayout? = null
|
||||||
private var status_bar: ViewGroup? = null
|
private var statusBar: ViewGroup? = null
|
||||||
|
|
||||||
private var status_bar_left = 0
|
private var statusBarLeft = 0
|
||||||
private var status_bar_top = 0
|
private var statusBarTop = 0
|
||||||
private var status_bar_right = 0
|
private var statusBarRight = 0
|
||||||
private var status_bar_bottom = 0
|
private var statusBarBottom = 0
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
if (!XSPUtils.getBoolean("status_bar_time_center", false)) return
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
when (XSPUtils.getInt("status_bar_layout_mode", 0)) {
|
||||||
|
//默认
|
||||||
|
0 -> return
|
||||||
|
//时钟居中
|
||||||
|
1 -> {
|
||||||
val collapsedStatusBarFragmentClass =
|
val collapsedStatusBarFragmentClass =
|
||||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(lpparam.classLoader)
|
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
collapsedStatusBarFragmentClass.hookAfterMethod(
|
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
"onViewCreated",
|
"onViewCreated",
|
||||||
@@ -44,53 +54,62 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
||||||
val context: Context = MiuiPhoneStatusBarView.context
|
val context: Context = MiuiPhoneStatusBarView.context
|
||||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||||
val status_bar_ID: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
val statusBarId: Int =
|
||||||
val status_bar_contents_ID: Int =
|
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
val statusBarContentsId: Int =
|
||||||
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
||||||
val system_icon_area_ID: Int =
|
val systemIconAreaId: Int =
|
||||||
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
||||||
val clock_ID: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
val phone_status_bar_left_container_ID: Int =
|
val phoneStatusBarLeftContainerId: Int =
|
||||||
res.getIdentifier("phone_status_bar_left_container", "id", "com.android.systemui")
|
res.getIdentifier(
|
||||||
val fullscreen_notification_icon_area_ID: Int =
|
"phone_status_bar_left_container",
|
||||||
res.getIdentifier("fullscreen_notification_icon_area", "id", "com.android.systemui")
|
"id",
|
||||||
status_bar = MiuiPhoneStatusBarView.findViewById(status_bar_ID)
|
"com.android.systemui"
|
||||||
val status_bar_contents: ViewGroup =
|
)
|
||||||
MiuiPhoneStatusBarView.findViewById(status_bar_contents_ID)
|
val notificationIconAreaInnerId: Int =
|
||||||
if (status_bar == null) return@hookAfterMethod
|
res.getIdentifier(
|
||||||
val Clock: View = MiuiPhoneStatusBarView.findViewById(clock_ID)
|
"notification_icon_area_inner",
|
||||||
val phone_status_bar_left_container: ViewGroup =
|
"id",
|
||||||
MiuiPhoneStatusBarView.findViewById(phone_status_bar_left_container_ID)
|
"com.android.systemui"
|
||||||
val fullscreen_notification_icon_area: ViewGroup =
|
)
|
||||||
MiuiPhoneStatusBarView.findViewById(fullscreen_notification_icon_area_ID)
|
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
val system_icon_area: ViewGroup =
|
val statusBarContents: ViewGroup =
|
||||||
MiuiPhoneStatusBarView.findViewById(system_icon_area_ID)
|
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||||
|
if (statusBar == null) return@hookAfterMethod
|
||||||
|
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||||
|
val phoneStatusBarLeftContainer: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||||
|
val notificationIconAreaInner: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
||||||
|
val systemIconArea: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||||
|
|
||||||
(Clock.parent as ViewGroup).removeView(Clock)
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
(phone_status_bar_left_container.parent as ViewGroup).removeView(
|
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||||
phone_status_bar_left_container
|
phoneStatusBarLeftContainer
|
||||||
)
|
)
|
||||||
(fullscreen_notification_icon_area.parent as ViewGroup).removeView(
|
(notificationIconAreaInner.parent as ViewGroup).removeView(
|
||||||
fullscreen_notification_icon_area
|
notificationIconAreaInner
|
||||||
)
|
|
||||||
(system_icon_area.parent as ViewGroup).removeView(system_icon_area)
|
|
||||||
|
|
||||||
val mConstraintLayoutLp = ConstraintLayout.LayoutParams(
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
|
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
||||||
|
|
||||||
val mConstraintLayout =
|
val mConstraintLayout =
|
||||||
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
|
ConstraintLayout(context).also {
|
||||||
|
it.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
mConstraintLayout.addView(fullscreen_notification_icon_area)
|
mConstraintLayout.addView(notificationIconAreaInner)
|
||||||
|
|
||||||
val fullscreen_notification_icon_area_lp = FrameLayout.LayoutParams(
|
val fullscreen_notification_icon_area_lp = LinearLayout.LayoutParams(
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
)
|
)
|
||||||
|
|
||||||
fullscreen_notification_icon_area.layoutParams = fullscreen_notification_icon_area_lp
|
notificationIconAreaInner.layoutParams = fullscreen_notification_icon_area_lp
|
||||||
|
|
||||||
//增加一个左对齐布局
|
//增加一个左对齐布局
|
||||||
mLeftLayout = LinearLayout(context)
|
mLeftLayout = LinearLayout(context)
|
||||||
@@ -112,38 +131,38 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||||
mRightLayout!!.layoutParams = RightLp
|
mRightLayout!!.layoutParams = RightLp
|
||||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||||
mLeftLayout!!.addView(phone_status_bar_left_container)
|
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
||||||
mLeftLayout!!.addView(mConstraintLayout)
|
mLeftLayout!!.addView(mConstraintLayout)
|
||||||
|
|
||||||
mCenterLayout!!.addView(Clock)
|
mCenterLayout!!.addView(clock)
|
||||||
mRightLayout!!.addView(system_icon_area)
|
mRightLayout!!.addView(systemIconArea)
|
||||||
status_bar_contents.addView(mLeftLayout, 0)
|
statusBarContents.addView(mLeftLayout, 0)
|
||||||
status_bar_contents.addView(mCenterLayout)
|
statusBarContents.addView(mCenterLayout)
|
||||||
status_bar_contents.addView(mRightLayout)
|
statusBarContents.addView(mRightLayout)
|
||||||
|
|
||||||
status_bar_left = status_bar!!.paddingLeft
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
status_bar_top = status_bar!!.paddingTop
|
statusBarTop = statusBar!!.paddingTop
|
||||||
status_bar_right = status_bar!!.paddingRight
|
statusBarRight = statusBar!!.paddingRight
|
||||||
status_bar_bottom = status_bar!!.paddingBottom
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
val custom_left_margin = XSPUtils.getInt("status_bar_left_margin", 0)
|
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
||||||
if (custom_left_margin != 0) {
|
if (customLeftMargin != 0) {
|
||||||
status_bar_left = custom_left_margin
|
statusBarLeft = customLeftMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
val custom_right_margin = XSPUtils.getInt("status_bar_right_margin", 0)
|
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
|
||||||
if (custom_right_margin != 0) {
|
if (customRightMargin != 0) {
|
||||||
status_bar_right = custom_right_margin
|
statusBarRight = customRightMargin
|
||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val phoneStatusBarViewClass =
|
val phoneStatusBarViewClass =
|
||||||
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(lpparam.classLoader)
|
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
@@ -152,20 +171,285 @@ class StatusBarLayout : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//时钟居右
|
||||||
|
2 -> {
|
||||||
|
val collapsedStatusBarFragmentClass =
|
||||||
|
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
|
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
|
"onViewCreated",
|
||||||
|
View::class.java,
|
||||||
|
Bundle::class.java
|
||||||
|
) { param ->
|
||||||
|
val MiuiPhoneStatusBarView: ViewGroup =
|
||||||
|
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
||||||
|
val context: Context = MiuiPhoneStatusBarView.context
|
||||||
|
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||||
|
|
||||||
|
//组件ID
|
||||||
|
val statusBarId: Int =
|
||||||
|
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
|
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
|
||||||
|
|
||||||
|
//查找组件
|
||||||
|
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
|
if (statusBar == null) return@hookAfterMethod
|
||||||
|
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||||
|
val battery: ViewGroup = MiuiPhoneStatusBarView.findViewById(batteryId)
|
||||||
|
|
||||||
|
//新建布局
|
||||||
|
val RightLp = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
).also {
|
||||||
|
it.marginStart = dp2px(context, 5f)
|
||||||
|
}
|
||||||
|
mRightLayout = LinearLayout(context).also {
|
||||||
|
it.layoutParams = RightLp
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加布局与组件
|
||||||
|
battery.addView(mRightLayout)
|
||||||
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
|
mRightLayout!!.addView(clock)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//时钟居中+图标居左
|
||||||
|
3 -> {
|
||||||
|
val collapsedStatusBarFragmentClass =
|
||||||
|
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
|
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
|
"onViewCreated",
|
||||||
|
View::class.java,
|
||||||
|
Bundle::class.java
|
||||||
|
) { param ->
|
||||||
|
val MiuiPhoneStatusBarView: ViewGroup =
|
||||||
|
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
||||||
|
val context: Context = MiuiPhoneStatusBarView.context
|
||||||
|
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||||
|
val statusBarId: Int =
|
||||||
|
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
val statusBarContentsId: Int =
|
||||||
|
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
||||||
|
val systemIconAreaId: Int =
|
||||||
|
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
||||||
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
|
val phoneStatusBarLeftContainerId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"phone_status_bar_left_container",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val fullscreenNotificationIconAreaId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"fullscreen_notification_icon_area",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val statusIconsId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"statusIcons",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val systemIconsId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"system_icons",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val batteryId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"battery",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
val notificationIconAreaInnerId: Int =
|
||||||
|
res.getIdentifier(
|
||||||
|
"notification_icon_area_inner",
|
||||||
|
"id",
|
||||||
|
"com.android.systemui"
|
||||||
|
)
|
||||||
|
|
||||||
|
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
|
val statusBarContents: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||||
|
if (statusBar == null) return@hookAfterMethod
|
||||||
|
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||||
|
val phoneStatusBarLeftContainer: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||||
|
val fullscreenNotificationIconArea: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
|
||||||
|
val systemIconArea: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||||
|
val statusIcons: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(statusIconsId)
|
||||||
|
val systemIcons: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(systemIconsId)
|
||||||
|
val battery: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(batteryId)
|
||||||
|
val notificationIconAreaInner: ViewGroup =
|
||||||
|
MiuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
||||||
|
|
||||||
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
|
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||||
|
phoneStatusBarLeftContainer
|
||||||
|
)
|
||||||
|
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
||||||
|
(statusIcons.parent as ViewGroup).removeView(statusIcons)
|
||||||
|
(systemIcons.parent as ViewGroup).removeView(systemIcons)
|
||||||
|
(battery.parent as ViewGroup).removeView(battery)
|
||||||
|
(fullscreenNotificationIconArea.parent as ViewGroup).removeView(
|
||||||
|
fullscreenNotificationIconArea
|
||||||
|
)
|
||||||
|
|
||||||
|
val mConstraintLayout =
|
||||||
|
ConstraintLayout(context).also {
|
||||||
|
it.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mConstraintLayout.addView(fullscreenNotificationIconArea)
|
||||||
|
mConstraintLayout.addView(battery)
|
||||||
|
|
||||||
|
|
||||||
fun updateLayout(context: Context) {
|
battery.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
).also {
|
||||||
|
it.endToEnd = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fullscreenNotificationIconArea.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
|
0,
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
).also {
|
||||||
|
it.startToEnd = batteryId
|
||||||
|
it.endToEnd = 0
|
||||||
|
}
|
||||||
|
fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
||||||
|
|
||||||
|
|
||||||
|
//增加一个左对齐布局
|
||||||
|
mLeftLayout = LinearLayout(context)
|
||||||
|
val LeftLp: LinearLayout.LayoutParams =
|
||||||
|
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||||
|
mLeftLayout!!.layoutParams = LeftLp
|
||||||
|
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
|
//增加一个居中布局
|
||||||
|
mCenterLayout = LinearLayout(context)
|
||||||
|
val CenterLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
mCenterLayout!!.layoutParams = CenterLp
|
||||||
|
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
|
//增加一个右布局
|
||||||
|
mRightLayout = LinearLayout(context)
|
||||||
|
val RightLp: LinearLayout.LayoutParams =
|
||||||
|
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||||
|
mRightLayout!!.layoutParams = RightLp
|
||||||
|
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
|
|
||||||
|
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
||||||
|
mLeftLayout!!.addView(statusIcons)
|
||||||
|
statusIcons.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
||||||
|
|
||||||
|
mCenterLayout!!.addView(clock)
|
||||||
|
|
||||||
|
mRightLayout!!.addView(mConstraintLayout)
|
||||||
|
fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
||||||
|
|
||||||
|
|
||||||
|
statusBarContents.addView(mLeftLayout, 0)
|
||||||
|
statusBarContents.addView(mCenterLayout)
|
||||||
|
statusBarContents.addView(mRightLayout)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
|
statusBarTop = statusBar!!.paddingTop
|
||||||
|
statusBarRight = statusBar!!.paddingRight
|
||||||
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
|
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
||||||
|
if (customLeftMargin != 0) {
|
||||||
|
statusBarLeft = customLeftMargin
|
||||||
|
}
|
||||||
|
|
||||||
|
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
|
||||||
|
if (customRightMargin != 0) {
|
||||||
|
statusBarRight = customRightMargin
|
||||||
|
}
|
||||||
|
updateLayout(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//兼容模式
|
||||||
|
val phoneStatusBarViewClass =
|
||||||
|
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
||||||
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
|
val context = (it.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//解决重叠
|
||||||
|
val miuiCollapsedStatusBarFragmentClass =
|
||||||
|
"com.android.systemui.statusbar.phone.MiuiCollapsedStatusBarFragment".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
|
||||||
|
miuiCollapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
|
"showClock",
|
||||||
|
Boolean::class.java
|
||||||
|
) {
|
||||||
|
val MiuiPhoneStatusBarView =
|
||||||
|
XposedHelpers.getObjectField(it.thisObject, "mStatusBar") as ViewGroup
|
||||||
|
val res = MiuiPhoneStatusBarView.resources
|
||||||
|
val status_bar_ID =
|
||||||
|
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
val status_bar = MiuiPhoneStatusBarView.findViewById<ViewGroup>(status_bar_ID)
|
||||||
|
//非锁屏下整个状态栏布局
|
||||||
|
val keyguardMgr =
|
||||||
|
status_bar.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
|
if (keyguardMgr.isKeyguardLocked) {
|
||||||
|
status_bar!!.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
status_bar!!.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateLayout(context: Context) {
|
||||||
//判断屏幕方向
|
//判断屏幕方向
|
||||||
val mConfiguration: Configuration = context.resources.configuration
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
mLeftLayout!!.setPadding(status_bar_left, 0, 0, 0)
|
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
|
||||||
mRightLayout!!.setPadding(0, 0, status_bar_right, 0)
|
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
|
||||||
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
||||||
} else {
|
} else {
|
||||||
//横屏状态
|
//横屏状态
|
||||||
mLeftLayout!!.setPadding(175, 0, 0, 0)
|
mLeftLayout!!.setPadding(175, 0, 0, 0)
|
||||||
mRightLayout!!.setPadding(0, 0, 175, 0)
|
mRightLayout!!.setPadding(0, 0, 175, 0)
|
||||||
status_bar!!.setPadding(0, status_bar_top, 0, status_bar_bottom)
|
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class StatusBarNetworkSpeedRefreshSpeed :IXposedHookLoadPackage {
|
object StatusBarNetworkSpeedRefreshSpeed: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.systemui.statusbar.policy.NetworkSpeedController".hookBeforeMethod(lpparam.classLoader, "postUpdateNetworkSpeedDelay", Long::class.java) {
|
override fun init() {
|
||||||
|
"com.android.systemui.statusbar.policy.NetworkSpeedController".hookBeforeMethod(getDefaultClassLoader(), "postUpdateNetworkSpeedDelay", Long::class.java) {
|
||||||
hasEnable("status_bar_network_speed_refresh_speed") {
|
hasEnable("status_bar_network_speed_refresh_speed") {
|
||||||
it.args[0] = 1000L
|
it.args[0] = 1000L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,22 +2,23 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.*
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import com.lt2333.simplicitytools.util.hookAfterConstructor
|
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
object StatusBarTimeCustomization : HookRegister() {
|
||||||
|
|
||||||
private val isYear = XSPUtils.getBoolean("status_bar_time_year", false)
|
private val isYear = XSPUtils.getBoolean("status_bar_time_year", false)
|
||||||
private val isMonth = XSPUtils.getBoolean("status_bar_time_month", false)
|
private val isMonth = XSPUtils.getBoolean("status_bar_time_month", false)
|
||||||
@@ -30,31 +31,40 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
|
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
|
||||||
private val getClockSize = XSPUtils.getInt("status_bar_clock_size", 0)
|
private val getClockSize = XSPUtils.getInt("status_bar_clock_size", 0)
|
||||||
private val isOpen = XSPUtils.getBoolean("custom_clock_switch", false)
|
private val isOpen = XSPUtils.getBoolean("custom_clock_switch", false)
|
||||||
|
private val isCenterAlign =
|
||||||
|
XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
|
||||||
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
|
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
|
||||||
private var now_time: Date? = null
|
private var nowTime: Date? = null
|
||||||
private var str = ""
|
private var str = ""
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
override fun init() {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
var c: Context? = null
|
var c: Context? = null
|
||||||
val miuiClockClass = "com.android.systemui.statusbar.views.MiuiClock".findClass(lpparam.classLoader)
|
val miuiClockClass =
|
||||||
miuiClockClass.hookAfterConstructor(Context::class.java, AttributeSet::class.java, Integer.TYPE) {
|
"com.android.systemui.statusbar.views.MiuiClock".findClass(getDefaultClassLoader())
|
||||||
|
miuiClockClass.hookAfterConstructor(
|
||||||
|
Context::class.java,
|
||||||
|
AttributeSet::class.java,
|
||||||
|
Integer.TYPE
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
c = it.args[0] as Context
|
c = it.args[0] as Context
|
||||||
val textV = it.thisObject as TextView
|
val textV = it.thisObject as TextView
|
||||||
|
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfterConstructor
|
||||||
textV.isSingleLine = false
|
textV.isSingleLine = false
|
||||||
if (isDoubleLine) {
|
if (isDoubleLine) {
|
||||||
str = "\n"
|
str = "\n"
|
||||||
var clock_double_line_size = 7F
|
var clockDoubleLineSize = 7F
|
||||||
if (getClockDoubleSize != 0) {
|
if (getClockDoubleSize != 0) {
|
||||||
clock_double_line_size = getClockDoubleSize.toFloat()
|
clockDoubleLineSize = getClockDoubleSize.toFloat()
|
||||||
}
|
}
|
||||||
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clock_double_line_size)
|
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockDoubleLineSize)
|
||||||
|
textV.setLineSpacing(0F, 0.8F)
|
||||||
} else {
|
} else {
|
||||||
if (getClockSize != 0) {
|
if (getClockSize != 0) {
|
||||||
val clock_size = getClockSize.toFloat()
|
val clockSize = getClockSize.toFloat()
|
||||||
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clock_size)
|
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
|
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
|
||||||
@@ -62,12 +72,12 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
d.isAccessible = true
|
d.isAccessible = true
|
||||||
d.invoke(textV)
|
d.invoke(textV)
|
||||||
}
|
}
|
||||||
|
|
||||||
class T : TimerTask() {
|
class T : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Handler(textV.context.mainLooper).post(r)
|
Handler(textV.context.mainLooper).post(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock")
|
|
||||||
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
|
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
}
|
}
|
||||||
@@ -76,19 +86,40 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
try {
|
try {
|
||||||
val textV = it.thisObject as TextView
|
val textV = it.thisObject as TextView
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
val t = Settings.System.getString(c!!.contentResolver, Settings.System.TIME_12_24)
|
val t = Settings.System.getString(
|
||||||
now_time = Calendar.getInstance().time
|
c!!.contentResolver,
|
||||||
textV.text = getDate(c!!, t) + str + getTime(c!!, t)
|
Settings.System.TIME_12_24
|
||||||
|
)
|
||||||
|
val is24 = t == "24"
|
||||||
|
nowTime = Calendar.getInstance().time
|
||||||
|
textV.text = getDate(c!!) + str + getTime(c!!, is24)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isCenterAlign) {
|
||||||
|
val collapsedStatusBarFragmentClass =
|
||||||
|
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
||||||
|
getDefaultClassLoader()
|
||||||
|
)
|
||||||
|
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
|
"onViewCreated",
|
||||||
|
View::class.java,
|
||||||
|
Bundle::class.java
|
||||||
|
) {
|
||||||
|
val MiuiPhoneStatusBarView: ViewGroup =
|
||||||
|
it.thisObject.getObjectField("mStatusBar") as ViewGroup
|
||||||
|
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||||
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
|
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||||
|
clock.gravity = Gravity.CENTER
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
private fun getDate(context: Context, t: String): String {
|
private fun getDate(context: Context): String {
|
||||||
var datePattern = ""
|
var datePattern = ""
|
||||||
val isZh = isZh(context)
|
val isZh = isZh(context)
|
||||||
|
|
||||||
@@ -124,17 +155,17 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
if (!isHideSpace) datePattern = "$datePattern "
|
if (!isHideSpace) datePattern = "$datePattern "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
datePattern = SimpleDateFormat(datePattern).format(now_time)
|
datePattern = SimpleDateFormat(datePattern).format(nowTime)
|
||||||
return datePattern
|
return datePattern
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
private fun getTime(context: Context, t: String): String {
|
private fun getTime(context: Context, t: Boolean): String {
|
||||||
var timePattern = ""
|
var timePattern = ""
|
||||||
val isZh = isZh(context)
|
val isZh = isZh(context)
|
||||||
timePattern += if (t == "24") "HH:mm" else "h:mm"
|
timePattern += if (t) "HH:mm" else "h:mm"
|
||||||
if (isSecond) timePattern += ":ss"
|
if (isSecond) timePattern += ":ss"
|
||||||
timePattern = SimpleDateFormat(timePattern).format(now_time)
|
timePattern = SimpleDateFormat(timePattern).format(nowTime)
|
||||||
if (isZh) timePattern = getPeriod(isZh) + timePattern else timePattern += getPeriod(isZh)
|
if (isZh) timePattern = getPeriod(isZh) + timePattern else timePattern += getPeriod(isZh)
|
||||||
timePattern = getDoubleHour() + timePattern
|
timePattern = getDoubleHour() + timePattern
|
||||||
return timePattern
|
return timePattern
|
||||||
@@ -145,7 +176,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
var period = ""
|
var period = ""
|
||||||
if (isPeriod) {
|
if (isPeriod) {
|
||||||
if (isZh) {
|
if (isZh) {
|
||||||
when (SimpleDateFormat("HH").format(now_time)) {
|
when (SimpleDateFormat("HH").format(nowTime)) {
|
||||||
"00", "01", "02", "03", "04", "05" -> {
|
"00", "01", "02", "03", "04", "05" -> {
|
||||||
period = "凌晨"
|
period = "凌晨"
|
||||||
}
|
}
|
||||||
@@ -166,7 +197,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
period = SimpleDateFormat("a").format(now_time)
|
period = SimpleDateFormat("a").format(nowTime)
|
||||||
if (!isHideSpace) {
|
if (!isHideSpace) {
|
||||||
period = " $period"
|
period = " $period"
|
||||||
}
|
}
|
||||||
@@ -180,7 +211,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
|
|||||||
private fun getDoubleHour(): String {
|
private fun getDoubleHour(): String {
|
||||||
var doubleHour = ""
|
var doubleHour = ""
|
||||||
if (isDoubleHour) {
|
if (isDoubleHour) {
|
||||||
when (SimpleDateFormat("HH").format(now_time)) {
|
when (SimpleDateFormat("HH").format(nowTime)) {
|
||||||
"23", "00" -> {
|
"23", "00" -> {
|
||||||
doubleHour = "子时"
|
doubleHour = "子时"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
|||||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||||
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XposedHelpers
|
import de.robv.android.xposed.XposedHelpers
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class WaveCharge : IXposedHookLoadPackage {
|
object WaveCharge: HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
|
|
||||||
|
override fun init() {
|
||||||
hasEnable("enable_wave_charge_animation") {
|
hasEnable("enable_wave_charge_animation") {
|
||||||
findMethod("com.android.keyguard.charge.ChargeUtils") {
|
findMethod("com.android.keyguard.charge.ChargeUtils") {
|
||||||
name == "supportWaveChargeAnimation"
|
name == "supportWaveChargeAnimation"
|
||||||
@@ -41,4 +41,5 @@ class WaveCharge : IXposedHookLoadPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ package com.lt2333.simplicitytools.hook.app.thememanager
|
|||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
import com.lt2333.simplicitytools.util.hookBeforeMethod
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
|
|
||||||
class RemoveAds : IXposedHookLoadPackage {
|
object RemoveAds : HookRegister() {
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
"com.android.thememanager.basemodule.ad.model.AdInfoResponse".hookBeforeMethod(lpparam.classLoader, "isAdValid", "com.android.thememanager.basemodule.ad.model.AdInfo".findClass(lpparam.classLoader)) {
|
override fun init() {
|
||||||
|
"com.android.thememanager.basemodule.ad.model.AdInfoResponse".hookBeforeMethod(getDefaultClassLoader(), "isAdValid", "com.android.thememanager.basemodule.ad.model.AdInfo".findClass(getDefaultClassLoader())) {
|
||||||
hasEnable("remove_thememanager_ads") {
|
hasEnable("remove_thememanager_ads") {
|
||||||
it.result = false
|
it.result = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@ package com.lt2333.simplicitytools.tile
|
|||||||
import android.service.quicksettings.Tile
|
import android.service.quicksettings.Tile
|
||||||
import android.service.quicksettings.TileService
|
import android.service.quicksettings.TileService
|
||||||
|
|
||||||
class AllowScreenshots : TileService(){
|
class AllowScreenshots : TileService() {
|
||||||
val key = "disable_flag_secure"
|
val key = "disable_flag_secure"
|
||||||
|
|
||||||
override fun onClick() {
|
override fun onClick() {
|
||||||
super.onClick()
|
super.onClick()
|
||||||
|
try {
|
||||||
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
||||||
val prefEditor = pref.edit()
|
val prefEditor = pref.edit()
|
||||||
if (pref.getBoolean(key, false)) {
|
if (pref.getBoolean(key, false)) {
|
||||||
@@ -19,10 +20,13 @@ class AllowScreenshots : TileService(){
|
|||||||
}
|
}
|
||||||
prefEditor.commit()
|
prefEditor.commit()
|
||||||
qsTile.updateTile()
|
qsTile.updateTile()
|
||||||
|
} catch (e: SecurityException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartListening() {
|
override fun onStartListening() {
|
||||||
super.onStartListening()
|
super.onStartListening()
|
||||||
|
try {
|
||||||
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
||||||
if (pref.getBoolean(key, false)) {
|
if (pref.getBoolean(key, false)) {
|
||||||
qsTile.state = Tile.STATE_ACTIVE
|
qsTile.state = Tile.STATE_ACTIVE
|
||||||
@@ -30,5 +34,7 @@ class AllowScreenshots : TileService(){
|
|||||||
qsTile.state = Tile.STATE_INACTIVE
|
qsTile.state = Tile.STATE_INACTIVE
|
||||||
}
|
}
|
||||||
qsTile.updateTile()
|
qsTile.updateTile()
|
||||||
|
} catch (e: SecurityException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ class LockMaxFpsTile : TileService() {
|
|||||||
|
|
||||||
override fun onClick() {
|
override fun onClick() {
|
||||||
super.onClick()
|
super.onClick()
|
||||||
|
try {
|
||||||
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
||||||
val prefEditor = pref.edit()
|
val prefEditor = pref.edit()
|
||||||
if (pref.getBoolean(key, false)) {
|
if (pref.getBoolean(key, false)) {
|
||||||
@@ -20,10 +21,13 @@ class LockMaxFpsTile : TileService() {
|
|||||||
}
|
}
|
||||||
prefEditor.commit()
|
prefEditor.commit()
|
||||||
qsTile.updateTile()
|
qsTile.updateTile()
|
||||||
|
} catch (e: SecurityException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartListening() {
|
override fun onStartListening() {
|
||||||
super.onStartListening()
|
super.onStartListening()
|
||||||
|
try {
|
||||||
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
val pref = getSharedPreferences("config", MODE_WORLD_READABLE)
|
||||||
if (pref.getBoolean(key, false)) {
|
if (pref.getBoolean(key, false)) {
|
||||||
qsTile.state = Tile.STATE_ACTIVE
|
qsTile.state = Tile.STATE_ACTIVE
|
||||||
@@ -31,6 +35,7 @@ class LockMaxFpsTile : TileService() {
|
|||||||
qsTile.state = Tile.STATE_INACTIVE
|
qsTile.state = Tile.STATE_INACTIVE
|
||||||
}
|
}
|
||||||
qsTile.updateTile()
|
qsTile.updateTile()
|
||||||
|
} catch (e: SecurityException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.lt2333.simplicitytools.util
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
object SystemProperties {
|
||||||
|
operator fun get(context: Context, key: String?): String? {
|
||||||
|
var ret = ""
|
||||||
|
try {
|
||||||
|
val cl = context.classLoader
|
||||||
|
val SystemProperties = cl.loadClass("android.os.SystemProperties")
|
||||||
|
//参数类型
|
||||||
|
val paramTypes: Array<Class<*>?> = arrayOfNulls(1)
|
||||||
|
paramTypes[0] = String::class.java
|
||||||
|
val get = SystemProperties.getMethod("get", *paramTypes)
|
||||||
|
//参数
|
||||||
|
val params = arrayOfNulls<Any>(1)
|
||||||
|
params[0] = key
|
||||||
|
ret = get.invoke(SystemProperties, *params) as String
|
||||||
|
} catch (iAE: IllegalArgumentException) {
|
||||||
|
throw iAE
|
||||||
|
} catch (e: Exception) {
|
||||||
|
ret = ""
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,13 @@ object XSPUtils {
|
|||||||
}
|
}
|
||||||
return prefs.getFloat(key, defValue)
|
return prefs.getFloat(key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getString(key: String, defValue: String): String? {
|
||||||
|
if (prefs.hasFileChanged()) {
|
||||||
|
prefs.reload()
|
||||||
|
}
|
||||||
|
return prefs.getString(key, defValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun hasEnable(key: String, default: Boolean = false, noinline extraCondition: (() -> Boolean)? = null, crossinline block: () -> Unit) {
|
inline fun hasEnable(key: String, default: Boolean = false, noinline extraCondition: (() -> Boolean)? = null, crossinline block: () -> Unit) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.lt2333.simplicitytools.util.xposed
|
||||||
|
|
||||||
|
import com.github.kyuubiran.ezxhelper.init.EzXHelperInit
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.Log.logexIfThrow
|
||||||
|
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||||
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
|
import de.robv.android.xposed.IXposedHookZygoteInit
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
abstract class EasyXposedInit: IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||||
|
|
||||||
|
private lateinit var packageParam: XC_LoadPackage.LoadPackageParam
|
||||||
|
abstract val registeredApp: List<AppRegister>
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
|
||||||
|
packageParam = lpparam!!
|
||||||
|
registeredApp.forEach { app ->
|
||||||
|
if (app.packageName == lpparam.packageName && (lpparam.processName in app.processName || app.processName.isEmpty())) {
|
||||||
|
EzXHelperInit.initHandleLoadPackage(lpparam)
|
||||||
|
EzXHelperInit.setLogTag(app.logTag)
|
||||||
|
EzXHelperInit.setToastTag(app.logTag)
|
||||||
|
runCatching { app.handleLoadPackage(lpparam) }.logexIfThrow("Failed call handleLoadPackage, package: ${app.packageName}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initZygote(startupParam: IXposedHookZygoteInit.StartupParam?) {
|
||||||
|
EzXHelperInit.initZygote(startupParam!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.lt2333.simplicitytools.util.xposed.base
|
||||||
|
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.Log
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.Log.logexIfThrow
|
||||||
|
import de.robv.android.xposed.IXposedHookInitPackageResources
|
||||||
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
|
import de.robv.android.xposed.callbacks.XC_InitPackageResources
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
abstract class AppRegister: IXposedHookLoadPackage {
|
||||||
|
|
||||||
|
abstract val packageName: String
|
||||||
|
abstract val processName: List<String>
|
||||||
|
abstract val logTag: String
|
||||||
|
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {}
|
||||||
|
|
||||||
|
protected fun autoInitHooks(lpparam: XC_LoadPackage.LoadPackageParam, vararg hook: HookRegister) {
|
||||||
|
hook.forEach {
|
||||||
|
runCatching {
|
||||||
|
if (it.isInit) return@forEach
|
||||||
|
it.setLoadPackageParam(lpparam)
|
||||||
|
it.init()
|
||||||
|
it.isInit = true
|
||||||
|
Log.i("Inited hook: ${it.javaClass.simpleName}")
|
||||||
|
}.logexIfThrow("Failed init hook: ${it.javaClass.simpleName}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.lt2333.simplicitytools.util.xposed.base
|
||||||
|
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
abstract class HookRegister {
|
||||||
|
private lateinit var lpparam: XC_LoadPackage.LoadPackageParam
|
||||||
|
var isInit: Boolean = false
|
||||||
|
abstract fun init()
|
||||||
|
|
||||||
|
fun setLoadPackageParam(loadPackageParam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
lpparam = loadPackageParam
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun getLoadPackageParam(): XC_LoadPackage.LoadPackageParam {
|
||||||
|
if (!this::lpparam.isInitialized) {
|
||||||
|
throw RuntimeException("lpparam should be initialized")
|
||||||
|
}
|
||||||
|
return lpparam
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun getDefaultClassLoader(): ClassLoader {
|
||||||
|
return getLoadPackageParam().classLoader
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB |
BIN
app/src/main/res/drawable/app_icon.png
Normal file
BIN
app/src/main/res/drawable/app_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
24
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
24
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<group android:scaleX="0.5625"
|
||||||
|
android:scaleY="0.5625">
|
||||||
|
<path
|
||||||
|
android:pathData="M0,0h192v192h-192z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startY="192"
|
||||||
|
android:startX="0"
|
||||||
|
android:endY="0"
|
||||||
|
android:endX="192"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0" android:color="#FFF76B1C"/>
|
||||||
|
<item android:offset="1" android:color="#FFFAD961"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
23
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
23
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<group android:scaleX="0.37125"
|
||||||
|
android:scaleY="0.37125"
|
||||||
|
android:translateX="18.36"
|
||||||
|
android:translateY="18.36">
|
||||||
|
<path
|
||||||
|
android:pathData="M57.71,64.27 L51.6,40.71A3.48,3.48 0,0 1,55 36.35H55A3.49,3.49 0,0 1,58.41 39l4.12,17.58h0.22l4.81,-17.7a3.48,3.48 0,0 1,3.35 -2.57h2.26a3.5,3.5 0,0 1,3.35 2.51l5.15,17.76h0.22L86,39a3.49,3.49 0,0 1,3.39 -2.69h0a3.47,3.47 0,0 1,3.35 4.39L86.36,64.3A3.49,3.49 0,0 1,83 66.87h-2a3.48,3.48 0,0 1,-3.32 -2.42l-5.6,-17.62h-0.22l-5.6,17.62A3.48,3.48 0,0 1,63 66.87H61.07A3.47,3.47 0,0 1,57.71 64.27Z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M99,66a9.67,9.67 0,0 1,-3.85 -4.15,14.11 14.11,0 0,1 -1.33,-6.34 14,14 0,0 1,1.33 -6.31A9.67,9.67 0,0 1,99 45a12.71,12.71 0,0 1,11.79 0,9.59 9.59,0 0,1 3.84,4.15A14,14 0,0 1,116 55.46a14.11,14.11 0,0 1,-1.34 6.34A9.59,9.59 0,0 1,110.77 66,12.71 12.71,0 0,1 99,66ZM107.93,59.56a6.66,6.66 0,0 0,1.11 -4,6.52 6.52,0 0,0 -1.11,-4 3.85,3.85 0,0 0,-6.07 0,6.52 6.52,0 0,0 -1.11,4 6.66,6.66 0,0 0,1.11 4,3.85 3.85,0 0,0 6.07,0Z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M123.54,66a9.59,9.59 0,0 1,-3.84 -4.15,14.11 14.11,0 0,1 -1.34,-6.34 14,14 0,0 1,1.34 -6.31A9.59,9.59 0,0 1,123.54 45a12.73,12.73 0,0 1,11.8 0,9.59 9.59,0 0,1 3.84,4.15 14,14 0,0 1,1.34 6.31,14.11 14.11,0 0,1 -1.34,6.34A9.59,9.59 0,0 1,135.34 66a12.73,12.73 0,0 1,-11.8 0ZM132.47,59.56a6.66,6.66 0,0 0,1.11 -4,6.52 6.52,0 0,0 -1.11,-4 3.84,3.84 0,0 0,-6.06 0,6.46 6.46,0 0,0 -1.12,4 6.6,6.6 0,0 0,1.12 4,3.84 3.84,0 0,0 6.06,0Z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M129.08,95.23 L97.56,77a3.23,3.23 0,0 0,-3.12 0L62.92,95.23a3.21,3.21 0,0 0,-1.57 2.71v36.4a3.2,3.2 0,0 0,1.57 2.7l31.52,18.2a3.18,3.18 0,0 0,3.12 0L129.08,137a3.22,3.22 0,0 0,1.14 -1.15,3.25 3.25,0 0,0 0.43,-1.55L130.65,97.94A3.22,3.22 0,0 0,129.08 95.23ZM96,83.35l9.51,5.49L80.24,103.43l-9.51,-5.49ZM92.88,147.12L67.6,132.53L67.6,103.35l9.51,5.49L77.11,125a3.13,3.13 0,1 0,6.25 0L83.36,112.45l9.52,5.49ZM96,112.53 L86.49,107l25.27,-14.59 9.51,5.49ZM124.4,132.53L99.13,147.12L99.13,117.94l25.27,-14.59Z"
|
||||||
|
android:fillColor="#fff"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user