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 {
|
LogUtils.getConfig().apply {
|
||||||
isLog2FileSwitch = true
|
isLog2FileSwitch = true
|
||||||
setConsoleSwitch(BuildConfig.DEBUG)
|
setConsoleSwitch(BuildConfig.DEBUG)
|
||||||
saveDays = 3
|
saveDays = 7
|
||||||
}
|
}
|
||||||
ShizukuProvider.enableMultiProcessSupport(isMainProcess)
|
ShizukuProvider.enableMultiProcessSupport(isMainProcess)
|
||||||
if (!isMainProcess) {
|
ShizukuProvider.requestBinderForNonProviderProcess(this)
|
||||||
ShizukuProvider.requestBinderForNonProviderProcess(this)
|
|
||||||
}
|
|
||||||
if (isMainProcess) {
|
if (isMainProcess) {
|
||||||
appScope.launchTry(Dispatchers.IO) {
|
appScope.launchTry(Dispatchers.IO) {
|
||||||
initChannel()
|
initChannel()
|
||||||
|
|
|
@ -4,6 +4,7 @@ package li.songe.gkd.shizuku
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
import android.app.IActivityTaskManager
|
import android.app.IActivityTaskManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.view.Display
|
||||||
import com.blankj.utilcode.util.LogUtils
|
import com.blankj.utilcode.util.LogUtils
|
||||||
import com.blankj.utilcode.util.RomUtils
|
import com.blankj.utilcode.util.RomUtils
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
|
@ -42,6 +43,7 @@ fun newActivityTaskManager(): IActivityTaskManager? {
|
||||||
* -1: invalid fc
|
* -1: invalid fc
|
||||||
* 1: (int) -> List<Task>
|
* 1: (int) -> List<Task>
|
||||||
* 3: (int, boolean, boolean) -> List<Task>
|
* 3: (int, boolean, boolean) -> List<Task>
|
||||||
|
* 4: (int, boolean, boolean, int) -> List<Task>
|
||||||
*/
|
*/
|
||||||
private var getTasksFcType: Int? = null
|
private var getTasksFcType: Int? = null
|
||||||
|
|
||||||
|
@ -50,7 +52,9 @@ fun IActivityTaskManager.safeGetTasks(): List<ActivityManager.RunningTaskInfo>?
|
||||||
val fcs = this::class.declaredMemberFunctions
|
val fcs = this::class.declaredMemberFunctions
|
||||||
val parameters = fcs.find { d -> d.name == "getTasks" }?.parameters
|
val parameters = fcs.find { d -> d.name == "getTasks" }?.parameters
|
||||||
if (parameters != null) {
|
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
|
getTasksFcType = 3
|
||||||
} else if (parameters.size == 2 && parameters[1].type == typeOf<Int>()) {
|
} else if (parameters.size == 2 && parameters[1].type == typeOf<Int>()) {
|
||||||
getTasksFcType = 1
|
getTasksFcType = 1
|
||||||
|
@ -62,12 +66,12 @@ fun IActivityTaskManager.safeGetTasks(): List<ActivityManager.RunningTaskInfo>?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getTasksFcType == 1) {
|
return when (getTasksFcType) {
|
||||||
return this.getTasks(1)
|
1 -> this.getTasks(1)
|
||||||
} else if (getTasksFcType == 3) {
|
3 -> this.getTasks(1, false, true)
|
||||||
return 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")
|
@SuppressWarnings("unused")
|
||||||
public interface IActivityTaskManager extends IInterface {
|
public interface IActivityTaskManager extends IInterface {
|
||||||
// miui
|
// XIAOMI
|
||||||
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, boolean filterOnlyVisibleRecents, boolean keepIntentExtra);
|
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
|
// https://github.com/gkd-kit/gkd/issues/58#issuecomment-1732245703
|
||||||
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
|
List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user