Expand emulator compatibility coverage

This commit is contained in:
ajp_anton
2026-07-08 14:59:34 +00:00
parent 18f30fce57
commit 3ebebb5218
6 changed files with 85 additions and 43 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ android {
defaultConfig {
applicationId = "se.ajpanton.statusbartweak"
minSdk = 35
minSdk = 34
targetSdk = 36
val buildVersionName = project.findProperty("sbtVersionName")?.toString()
?: fallbackVersionName
@@ -2,6 +2,7 @@ package se.ajpanton.statusbartweak.runtime.hooks;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -34,6 +35,9 @@ public final class XposedHookSupport {
if (!methodName.equals(method.getName())) {
continue;
}
if (Modifier.isAbstract(method.getModifiers())) {
continue;
}
method.setAccessible(true);
handles.add(framework.hook(method).intercept(hooker));
}
@@ -59,6 +63,9 @@ public final class XposedHookSupport {
if (!methodName.equals(method.getName())) {
continue;
}
if (Modifier.isAbstract(method.getModifiers())) {
continue;
}
method.setAccessible(true);
handles.add(framework.hook(method).intercept(hooker));
}
@@ -83,4 +90,20 @@ public final class XposedHookSupport {
}
return handles;
}
public static List<XposedInterface.HookHandle> hookAllConstructorsIfExists(
XposedInterface framework,
Class<?> type,
XposedInterface.Hooker hooker
) {
Objects.requireNonNull(framework, "framework");
Objects.requireNonNull(type, "type");
Objects.requireNonNull(hooker, "hooker");
List<XposedInterface.HookHandle> handles = new ArrayList<>();
for (Constructor<?> constructor : type.getDeclaredConstructors()) {
constructor.setAccessible(true);
handles.add(framework.hook(constructor).intercept(hooker));
}
return handles;
}
}
@@ -33,7 +33,7 @@ final class DarkIconDispatcherGuard {
}
void install(Class<?> darkIconDispatcherClass) {
XposedHookSupport.hookAllConstructors(
XposedHookSupport.hookAllConstructorsIfExists(
runtimeContext.getFramework(),
darkIconDispatcherClass,
chain -> {