Harden LSPosed bridge startup

This commit is contained in:
ajp_anton
2026-08-18 06:01:43 +00:00
parent 68771d5836
commit dbe6335978
@@ -1,5 +1,7 @@
package se.ajpanton.notificationsmaster.module
import android.os.Handler
import android.os.Looper
import android.util.Log
import io.github.libxposed.api.XposedModule
import io.github.libxposed.api.XposedModuleInterface
@@ -10,12 +12,20 @@ import io.github.libxposed.api.XposedModuleInterface
*/
class NotificationsMasterModule : XposedModule() {
override fun onSystemServerStarting(param: XposedModuleInterface.SystemServerStartingParam) {
runCatching {
SystemAlertPolicyCache.installWhenReady()
Handler(Looper.getMainLooper()).post {
installBridge("notification attention") {
NotificationAttentionBridge(this, ::diagnoseAttentionHelperEvent).install(param.classLoader)
}
installBridge("notification enqueue") {
SystemNotificationBridge(this, ::diagnoseHelperEvent).install(param.classLoader)
}.onFailure { error ->
Log.e(TAG, "Notification bridge was not installed; leaving Android unchanged", error)
}
}
}
private fun installBridge(name: String, install: () -> Unit) {
runCatching(install).onFailure { error ->
Log.e(TAG, "$name bridge was not installed; leaving Android unchanged", error)
}
}