Gate Samsung-specific runtime hooks
This commit is contained in:
@@ -2,6 +2,7 @@ package se.ajpanton.statusbartweak.module;
|
||||
|
||||
import io.github.libxposed.api.XposedInterface;
|
||||
import io.github.libxposed.api.XposedModuleInterface;
|
||||
import se.ajpanton.statusbartweak.platform.SystemUiCapabilities;
|
||||
import se.ajpanton.statusbartweak.runtime.features.RuntimeContext;
|
||||
import se.ajpanton.statusbartweak.runtime.features.StandaloneFeatureRegistry;
|
||||
import se.ajpanton.statusbartweak.runtime.mode.ModeStateRepository;
|
||||
@@ -15,11 +16,6 @@ import se.ajpanton.statusbartweak.runtime.mode.ModeStateRepository;
|
||||
*/
|
||||
public final class ModuleCoordinator {
|
||||
|
||||
private static final String PACKAGE_ANDROID = "android";
|
||||
private static final String PACKAGE_SYSTEM = "system";
|
||||
private static final String PACKAGE_SYSTEMUI = "com.android.systemui";
|
||||
private static final String PACKAGE_AODSERVICE = "com.samsung.android.app.aodservice";
|
||||
|
||||
private final RuntimeContext runtimeContext;
|
||||
private final StandaloneFeatureRegistry standaloneFeatureRegistry;
|
||||
|
||||
@@ -33,10 +29,7 @@ public final class ModuleCoordinator {
|
||||
|
||||
public void onModuleLoaded(XposedModuleInterface.ModuleLoadedParam param) {
|
||||
String processName = param.getProcessName();
|
||||
if (!PACKAGE_SYSTEMUI.equals(processName)
|
||||
&& !PACKAGE_ANDROID.equals(processName)
|
||||
&& !PACKAGE_SYSTEM.equals(processName)
|
||||
&& !PACKAGE_AODSERVICE.equals(processName)) {
|
||||
if (!SystemUiCapabilities.isHandledProcessName(processName)) {
|
||||
return;
|
||||
}
|
||||
standaloneFeatureRegistry.onModuleLoaded(param);
|
||||
@@ -54,9 +47,6 @@ public final class ModuleCoordinator {
|
||||
}
|
||||
|
||||
private static boolean shouldHandlePackage(String packageName) {
|
||||
return PACKAGE_SYSTEMUI.equals(packageName)
|
||||
|| PACKAGE_ANDROID.equals(packageName)
|
||||
|| PACKAGE_SYSTEM.equals(packageName)
|
||||
|| PACKAGE_AODSERVICE.equals(packageName);
|
||||
return SystemUiCapabilities.isHandledPackageName(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ import android.os.Build;
|
||||
import se.ajpanton.statusbartweak.shell.settings.SbtSettings;
|
||||
|
||||
public final class SystemUiCapabilities {
|
||||
public static final String PACKAGE_ANDROID = "android";
|
||||
public static final String PACKAGE_SYSTEM = "system";
|
||||
public static final String PACKAGE_SYSTEMUI = "com.android.systemui";
|
||||
public static final String PACKAGE_SAMSUNG_AOD_SERVICE = "com.samsung.android.app.aodservice";
|
||||
|
||||
private SystemUiCapabilities() {
|
||||
}
|
||||
|
||||
@@ -16,6 +21,34 @@ public final class SystemUiCapabilities {
|
||||
return !isSamsungOneUi();
|
||||
}
|
||||
|
||||
public static boolean supportsSamsungAodServiceProcess() {
|
||||
return isSamsungOneUi();
|
||||
}
|
||||
|
||||
public static boolean supportsSamsungAodMiscControllers() {
|
||||
return isSamsungOneUi();
|
||||
}
|
||||
|
||||
public static boolean supportsSamsungStatusChipHooks() {
|
||||
return isSamsungOneUi();
|
||||
}
|
||||
|
||||
public static boolean isSystemUiPackageName(String packageName) {
|
||||
return PACKAGE_SYSTEMUI.equals(packageName);
|
||||
}
|
||||
|
||||
public static boolean isHandledPackageName(String packageName) {
|
||||
return PACKAGE_SYSTEMUI.equals(packageName)
|
||||
|| PACKAGE_ANDROID.equals(packageName)
|
||||
|| PACKAGE_SYSTEM.equals(packageName)
|
||||
|| (supportsSamsungAodServiceProcess()
|
||||
&& PACKAGE_SAMSUNG_AOD_SERVICE.equals(packageName));
|
||||
}
|
||||
|
||||
public static boolean isHandledProcessName(String processName) {
|
||||
return isHandledPackageName(processName);
|
||||
}
|
||||
|
||||
public static boolean supportsExperimentalGenericAodStatusbarRoot(SbtSettings settings) {
|
||||
return !isSamsungOneUi()
|
||||
&& settings != null
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package se.ajpanton.statusbartweak.runtime.features;
|
||||
|
||||
import io.github.libxposed.api.XposedModuleInterface;
|
||||
import se.ajpanton.statusbartweak.shell.settings.SbtSettings;
|
||||
import se.ajpanton.statusbartweak.platform.SystemUiCapabilities;
|
||||
|
||||
/**
|
||||
* Small independent runtime slice.
|
||||
@@ -15,7 +15,8 @@ public interface RuntimeFeature {
|
||||
String getName();
|
||||
|
||||
static boolean isSystemUiPackage(XposedModuleInterface.PackageReadyParam param) {
|
||||
return param != null && SbtSettings.PACKAGE_SYSTEMUI.equals(param.getPackageName());
|
||||
return param != null
|
||||
&& SystemUiCapabilities.isSystemUiPackageName(param.getPackageName());
|
||||
}
|
||||
|
||||
default void onModuleLoaded(
|
||||
|
||||
+4
@@ -1,6 +1,7 @@
|
||||
package se.ajpanton.statusbartweak.runtime.features.chips;
|
||||
|
||||
import io.github.libxposed.api.XposedModuleInterface;
|
||||
import se.ajpanton.statusbartweak.platform.SystemUiCapabilities;
|
||||
import se.ajpanton.statusbartweak.runtime.features.RuntimeContext;
|
||||
import se.ajpanton.statusbartweak.runtime.features.RuntimeFeature;
|
||||
|
||||
@@ -32,6 +33,9 @@ public final class StatusChipsFeature implements RuntimeFeature {
|
||||
}
|
||||
|
||||
private void installController(RuntimeContext context, ClassLoader classLoader) {
|
||||
if (!SystemUiCapabilities.supportsSamsungStatusChipHooks()) {
|
||||
return;
|
||||
}
|
||||
if (statusChipHider == null) {
|
||||
statusChipHider = new StatusChipHider(context);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package se.ajpanton.statusbartweak.runtime.features.misc;
|
||||
|
||||
import io.github.libxposed.api.XposedModuleInterface;
|
||||
import se.ajpanton.statusbartweak.platform.SystemUiCapabilities;
|
||||
import se.ajpanton.statusbartweak.runtime.features.RuntimeContext;
|
||||
import se.ajpanton.statusbartweak.runtime.features.RuntimeFeature;
|
||||
|
||||
@@ -31,6 +32,9 @@ public final class MiscFeature implements RuntimeFeature {
|
||||
}
|
||||
|
||||
private void installControllers(RuntimeContext context, ClassLoader classLoader) {
|
||||
if (!SystemUiCapabilities.supportsSamsungAodMiscControllers()) {
|
||||
return;
|
||||
}
|
||||
if (aodCallVisibilityController == null) {
|
||||
aodCallVisibilityController = new AodCallVisibilityController(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user