mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
优化 强制使用小窗功能
This commit is contained in:
@@ -2,7 +2,7 @@ package com.lt2333.simplicitytools.hook.app
|
|||||||
|
|
||||||
import com.lt2333.simplicitytools.hook.app.android.DeleteOnPostNotification
|
import com.lt2333.simplicitytools.hook.app.android.DeleteOnPostNotification
|
||||||
import com.lt2333.simplicitytools.hook.app.android.DisableFlagSecure
|
import com.lt2333.simplicitytools.hook.app.android.DisableFlagSecure
|
||||||
import com.lt2333.simplicitytools.hook.app.android.RemoveSmallWindowRestrictions2
|
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 de.robv.android.xposed.IXposedHookLoadPackage
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
@@ -18,6 +18,6 @@ class Android : IXposedHookLoadPackage {
|
|||||||
//上层显示
|
//上层显示
|
||||||
DeleteOnPostNotification().handleLoadPackage(lpparam)
|
DeleteOnPostNotification().handleLoadPackage(lpparam)
|
||||||
//解除小窗限制
|
//解除小窗限制
|
||||||
RemoveSmallWindowRestrictions2().handleLoadPackage(lpparam)
|
RemoveSmallWindowRestrictions().handleLoadPackage(lpparam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
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 com.lt2333.simplicitytools.hook.app.miuihome.RemoveSmallWindowRestrictions
|
|
||||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
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.LoadPackageParam
|
||||||
@@ -11,7 +10,5 @@ class MiuiHome : IXposedHookLoadPackage {
|
|||||||
XposedBridge.log("成功Hook: " + javaClass.simpleName)
|
XposedBridge.log("成功Hook: " + javaClass.simpleName)
|
||||||
//时钟显示时钟
|
//时钟显示时钟
|
||||||
AlwaysDisplayTime().handleLoadPackage(lpparam)
|
AlwaysDisplayTime().handleLoadPackage(lpparam)
|
||||||
//解除小窗限制
|
|
||||||
RemoveSmallWindowRestrictions().handleLoadPackage(lpparam)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.lt2333.simplicitytools.hook.app.android
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
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 RemoveSmallWindowRestrictions : IXposedHookLoadPackage {
|
||||||
|
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||||
|
|
||||||
|
// 强制所有活动设为可以调整大小
|
||||||
|
val classIfExists = XposedHelpers.findClassIfExists(
|
||||||
|
"com.android.server.wm.Task",
|
||||||
|
lpparam.classLoader
|
||||||
|
)
|
||||||
|
XposedHelpers.findAndHookMethod(
|
||||||
|
classIfExists,
|
||||||
|
"isResizeable",
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||||
|
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
||||||
|
param.result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val classIfExists2 = XposedHelpers.findClassIfExists(
|
||||||
|
"android.util.MiuiMultiWindowAdapter",
|
||||||
|
lpparam.classLoader
|
||||||
|
)
|
||||||
|
XposedHelpers.findAndHookMethod(
|
||||||
|
classIfExists2,
|
||||||
|
"getFreeformBlackList",
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
|
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
||||||
|
val blackList = param.result as MutableList<String>
|
||||||
|
blackList.clear()
|
||||||
|
param.result = blackList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
XposedHelpers.findAndHookMethod(
|
||||||
|
classIfExists2,
|
||||||
|
"getFreeformBlackListFromCloud",
|
||||||
|
Context::class.java,
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
|
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
||||||
|
val blackList = param.result as MutableList<String>
|
||||||
|
blackList.clear()
|
||||||
|
param.result = blackList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
val classIfExists3 = XposedHelpers.findClassIfExists(
|
||||||
|
"android.util.MiuiMultiWindowUtils",
|
||||||
|
lpparam.classLoader
|
||||||
|
)
|
||||||
|
|
||||||
|
XposedHelpers.findAndHookMethod(
|
||||||
|
classIfExists3,
|
||||||
|
"supportFreeform",
|
||||||
|
object : XC_MethodHook() {
|
||||||
|
override fun afterHookedMethod(param: MethodHookParam) {
|
||||||
|
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
||||||
|
param.result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.android
|
|
||||||
|
|
||||||
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 RemoveSmallWindowRestrictions2 : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
|
||||||
"com.android.server.wm.Task",
|
|
||||||
lpparam.classLoader
|
|
||||||
)
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
classIfExists,
|
|
||||||
"isResizeable",
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
|
||||||
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
|
||||||
param.result = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
classIfExists,
|
|
||||||
"supportsMultiWindowInDisplayAreaForFreeForm",
|
|
||||||
"com.android.server.wm.TaskDisplayArea",
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
|
||||||
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
|
||||||
param.result = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.miuihome
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
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 RemoveSmallWindowRestrictions : IXposedHookLoadPackage {
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
|
||||||
val classIfExists = XposedHelpers.findClassIfExists(
|
|
||||||
"com.miui.home.launcher.RecentsAndFSGestureUtils",
|
|
||||||
lpparam.classLoader
|
|
||||||
)
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
classIfExists,
|
|
||||||
"isPkgSupportSmallWindow", Context::class.java, String::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
|
||||||
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
|
||||||
param.result = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
classIfExists,
|
|
||||||
"isTaskSupportSmallWindow", Context::class.java, Int::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
|
||||||
if (XSPUtils.getBoolean("remove_small_window_restrictions", false)) {
|
|
||||||
param.result = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user