mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
Merge pull request #41 from ztc1997/main
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -39,6 +39,10 @@ class MainHook : IXposedHookLoadPackage {
|
|||||||
"com.android.updater" -> {
|
"com.android.updater" -> {
|
||||||
Updater().handleLoadPackage(lpparam)
|
Updater().handleLoadPackage(lpparam)
|
||||||
}
|
}
|
||||||
|
//设置
|
||||||
|
"com.android.settings" -> {
|
||||||
|
Settings().handleLoadPackage(lpparam)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app
|
||||||
|
|
||||||
|
import com.lt2333.simplicitytools.hook.app.settings.ShowNotificationImportance
|
||||||
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
class Settings: IXposedHookLoadPackage {
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
ShowNotificationImportance().handleLoadPackage(lpparam)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.settings
|
||||||
|
|
||||||
|
import android.app.NotificationChannel
|
||||||
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
|
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
|
import de.robv.android.xposed.XC_MethodHook
|
||||||
|
import de.robv.android.xposed.XposedHelpers
|
||||||
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
|
class ShowNotificationImportance: IXposedHookLoadPackage {
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
if (!XSPUtils.getBoolean("show_notification_importance", false)) return
|
||||||
|
|
||||||
|
val channelNotificationSettingsClass = XposedHelpers.findClass(
|
||||||
|
"com.android.settings.notification.ChannelNotificationSettings",
|
||||||
|
lpparam.classLoader
|
||||||
|
)
|
||||||
|
|
||||||
|
XposedHelpers.findAndHookMethod(channelNotificationSettingsClass, "removeDefaultPrefs",
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||||
|
val importance =
|
||||||
|
XposedHelpers.callMethod(param.thisObject, "findPreference", "importance")
|
||||||
|
val mChannel =
|
||||||
|
XposedHelpers.getObjectField(param.thisObject, "mChannel") as NotificationChannel
|
||||||
|
val index = XposedHelpers.callMethod(
|
||||||
|
importance,
|
||||||
|
"findSpinnerIndexOfValue",
|
||||||
|
mChannel.importance.toString()
|
||||||
|
) as Int
|
||||||
|
if (index < 0) return@beforeHookedMethod
|
||||||
|
|
||||||
|
XposedHelpers.callMethod(importance, "setValueIndex", index)
|
||||||
|
|
||||||
|
XposedHelpers.setAdditionalInstanceField(
|
||||||
|
importance,
|
||||||
|
"channelNotificationSettings",
|
||||||
|
param.thisObject
|
||||||
|
)
|
||||||
|
|
||||||
|
param.result = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
val dropDownPreferenceClass = XposedHelpers.findClass(
|
||||||
|
"androidx.preference.Preference",
|
||||||
|
lpparam.classLoader
|
||||||
|
)
|
||||||
|
|
||||||
|
XposedHelpers.findAndHookMethod(dropDownPreferenceClass, "callChangeListener",
|
||||||
|
Any::class.java, object : XC_MethodHook() {
|
||||||
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
|
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(
|
||||||
|
param.thisObject,
|
||||||
|
"channelNotificationSettings"
|
||||||
|
)
|
||||||
|
?: return@afterHookedMethod
|
||||||
|
|
||||||
|
val mChannel = XposedHelpers.getObjectField(
|
||||||
|
channelNotificationSettings,
|
||||||
|
"mChannel"
|
||||||
|
) as NotificationChannel
|
||||||
|
XposedHelpers.callMethod(mChannel, "setImportance", (param.args[0] as String).toInt())
|
||||||
|
|
||||||
|
val mBackend = XposedHelpers.getObjectField(channelNotificationSettings, "mBackend")
|
||||||
|
val mPkg =
|
||||||
|
XposedHelpers.getObjectField(channelNotificationSettings, "mPkg") as String
|
||||||
|
val mUid = XposedHelpers.getObjectField(channelNotificationSettings, "mUid") as Int
|
||||||
|
XposedHelpers.callMethod(mBackend, "updateChannel", mPkg, mUid, mChannel)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -144,4 +144,7 @@
|
|||||||
<string name="updater">系统更新</string>
|
<string name="updater">系统更新</string>
|
||||||
<string name="remove_ota_validate">*移除OTA验证 [实验性]</string>
|
<string name="remove_ota_validate">*移除OTA验证 [实验性]</string>
|
||||||
<string name="remove_ota_validate_summary">- 仅支持VAB系列使用,其余系列请不要开启。\n- 无需内测试资格即可刷入完整内测包。\n- 拥有内测权限的用户将无法接收内测更新\n可用于屏蔽系统更新。\n- 跨版本类型升级后,建议清空数据。\n- 不支持非官方ROM使用。</string>
|
<string name="remove_ota_validate_summary">- 仅支持VAB系列使用,其余系列请不要开启。\n- 无需内测试资格即可刷入完整内测包。\n- 拥有内测权限的用户将无法接收内测更新\n可用于屏蔽系统更新。\n- 跨版本类型升级后,建议清空数据。\n- 不支持非官方ROM使用。</string>
|
||||||
|
<string name="settings">设置</string>
|
||||||
|
<string name="show_notification_importance_summary">显示 MIUI12 及之后版本被隐藏的通知重要程度设置</string>
|
||||||
|
<string name="show_notification_importance">显示通知重要程度</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -144,4 +144,7 @@
|
|||||||
<string name="updater">系統更新</string>
|
<string name="updater">系統更新</string>
|
||||||
<string name="remove_ota_validate">*移除OTA驗證 [實驗性]</string>
|
<string name="remove_ota_validate">*移除OTA驗證 [實驗性]</string>
|
||||||
<string name="remove_ota_validate_summary">- 僅支持VAB系列使用,其餘系列請不要開啟。\n- 無需內測試資格即可刷入完整內測包。\n- 擁有內測權限的用戶將無法接收內測更新\n可用於屏蔽系統更新。\n- 跨版本類型升級後,建議清空數據。\n- 不支持非官方ROM使用。</string>
|
<string name="remove_ota_validate_summary">- 僅支持VAB系列使用,其餘系列請不要開啟。\n- 無需內測試資格即可刷入完整內測包。\n- 擁有內測權限的用戶將無法接收內測更新\n可用於屏蔽系統更新。\n- 跨版本類型升級後,建議清空數據。\n- 不支持非官方ROM使用。</string>
|
||||||
|
<string name="show_notification_importance_summary">顯示 MIUI12 及之後版本被隱藏的通知重要程度設定</string>
|
||||||
|
<string name="show_notification_importance">顯示通知重要程度</string>
|
||||||
|
<string name="settings">設定</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -144,4 +144,7 @@
|
|||||||
<string name="updater">系統更新</string>
|
<string name="updater">系統更新</string>
|
||||||
<string name="remove_ota_validate">*移除OTA驗證 [實驗性]</string>
|
<string name="remove_ota_validate">*移除OTA驗證 [實驗性]</string>
|
||||||
<string name="remove_ota_validate_summary">- 僅支持VAB系列使用,其餘系列請不要開啟。\n- 無需內測試資格即可刷入完整內測包。\n- 擁有內測權限的用戶將無法接收內測更新\n可用於屏蔽系統更新。\n- 跨版本類型升級後,建議清空數據。\n- 不支持非官方ROM使用。</string>
|
<string name="remove_ota_validate_summary">- 僅支持VAB系列使用,其餘系列請不要開啟。\n- 無需內測試資格即可刷入完整內測包。\n- 擁有內測權限的用戶將無法接收內測更新\n可用於屏蔽系統更新。\n- 跨版本類型升級後,建議清空數據。\n- 不支持非官方ROM使用。</string>
|
||||||
|
<string name="show_notification_importance">顯示通知重要程度</string>
|
||||||
|
<string name="show_notification_importance_summary">顯示 MIUI12 及之後版本被隱藏的通知重要程度設定</string>
|
||||||
|
<string name="settings">設定</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -8,5 +8,6 @@
|
|||||||
<item>com.miui.home</item>
|
<item>com.miui.home</item>
|
||||||
<item>com.miui.mediaeditor</item>
|
<item>com.miui.mediaeditor</item>
|
||||||
<item>com.android.updater</item>
|
<item>com.android.updater</item>
|
||||||
|
<item>com.android.settings</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -144,4 +144,7 @@
|
|||||||
<string name="updater">Updater</string>
|
<string name="updater">Updater</string>
|
||||||
<string name="remove_ota_validate">*Remove OTA validate [LAB]</string>
|
<string name="remove_ota_validate">*Remove OTA validate [LAB]</string>
|
||||||
<string name="remove_ota_validate_summary">- Only support VAB series use, please do not open other series.\n- No need for internal testing qualification to flash into the full internal testing package.\n- Those who have internal testing permission will not be able to receive internal testing updates, and can be used to block system updates.\n- After cross-version type upgrade, it is recommended to clear data.\n- Unofficial ROM usage is not supported.</string>
|
<string name="remove_ota_validate_summary">- Only support VAB series use, please do not open other series.\n- No need for internal testing qualification to flash into the full internal testing package.\n- Those who have internal testing permission will not be able to receive internal testing updates, and can be used to block system updates.\n- After cross-version type upgrade, it is recommended to clear data.\n- Unofficial ROM usage is not supported.</string>
|
||||||
|
<string name="settings">Settings</string>
|
||||||
|
<string name="show_notification_importance">Show notification importance</string>
|
||||||
|
<string name="show_notification_importance_summary">Show notification importance settings which are hidden in MIUI 12 and later versions</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user