mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 03:32:38 +08:00
fix(shizuku): 适配不同机型的隐藏api
This commit is contained in:
parent
c93fa87cb5
commit
45ce8ffa74
|
@ -45,12 +45,11 @@ class App : Application() {
|
|||
LogUtils.getConfig().apply {
|
||||
isLog2FileSwitch = true
|
||||
setConsoleSwitch(BuildConfig.DEBUG)
|
||||
saveDays = 3
|
||||
saveDays = 7
|
||||
}
|
||||
ShizukuProvider.enableMultiProcessSupport(isMainProcess)
|
||||
if (!isMainProcess) {
|
||||
ShizukuProvider.requestBinderForNonProviderProcess(this)
|
||||
}
|
||||
ShizukuProvider.requestBinderForNonProviderProcess(this)
|
||||
|
||||
if (isMainProcess) {
|
||||
appScope.launchTry(Dispatchers.IO) {
|
||||
initChannel()
|
||||
|
|
|
@ -4,6 +4,7 @@ package li.songe.gkd.shizuku
|
|||
import android.app.ActivityManager
|
||||
import android.app.IActivityTaskManager
|
||||
import android.os.Build
|
||||
import android.view.Display
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.blankj.utilcode.util.RomUtils
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
|
@ -42,6 +43,7 @@ fun newActivityTaskManager(): IActivityTaskManager? {
|
|||
* -1: invalid fc
|
||||
* 1: (int) -> List<Task>
|
||||
* 3: (int, boolean, boolean) -> List<Task>
|
||||
* 4: (int, boolean, boolean, int) -> List<Task>
|
||||
*/
|
||||
private var getTasksFcType: Int? = null
|
||||
|
||||
|
@ -50,7 +52,9 @@ fun IActivityTaskManager.safeGetTasks(): List<ActivityManager.RunningTaskInfo>?
|
|||
val fcs = this::class.declaredMemberFunctions
|
||||
val parameters = fcs.find { d -> d.name == "getTasks" }?.parameters
|
||||
if (parameters != null) {
|
||||
if (parameters.size == 4 && parameters[1].type == typeOf<Int>() && parameters[2].type == typeOf<Boolean>() && parameters[3].type == typeOf<Boolean>()) {
|
||||
if (parameters.size == 5 && parameters[1].type == typeOf<Int>() && parameters[2].type == typeOf<Boolean>() && parameters[3].type == typeOf<Boolean>() && parameters[4].type == typeOf<Int>()) {
|
||||
getTasksFcType = 4
|
||||
} else if (parameters.size == 4 && parameters[1].type == typeOf<Int>() && parameters[2].type == typeOf<Boolean>() && parameters[3].type == typeOf<Boolean>()) {
|
||||
getTasksFcType = 3
|
||||
} else if (parameters.size == 2 && parameters[1].type == typeOf<Int>()) {
|
||||
getTasksFcType = 1
|
||||
|
@ -62,12 +66,12 @@ fun IActivityTaskManager.safeGetTasks(): List<ActivityManager.RunningTaskInfo>?
|
|||
}
|
||||
}
|
||||
}
|
||||
if (getTasksFcType == 1) {
|
||||
return this.getTasks(1)
|
||||
} else if (getTasksFcType == 3) {
|
||||
return this.getTasks(1, false, true)
|
||||
return when (getTasksFcType) {
|
||||
1 -> this.getTasks(1)
|
||||
3 -> this.getTasks(1, false, true)
|
||||
4 -> this.getTasks(1, false, true, Display.DEFAULT_DISPLAY)
|
||||
else -> null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,9 +8,12 @@ import java.util.List;
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
public interface IActivityTaskManager extends IInterface {
|
||||
// miui
|
||||
// XIAOMI
|
||||
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, boolean filterOnlyVisibleRecents, boolean keepIntentExtra);
|
||||
|
||||
// https://github.com/gkd-kit/gkd/issues/58#issuecomment-1736843795
|
||||
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, boolean filterOnlyVisibleRecents, boolean keepIntentExtra, int displayId);
|
||||
|
||||
// https://github.com/gkd-kit/gkd/issues/58#issuecomment-1732245703
|
||||
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user