Harden LSPosed bridge startup
This commit is contained in:
+16
-6
@@ -1,5 +1,7 @@
|
|||||||
package se.ajpanton.notificationsmaster.module
|
package se.ajpanton.notificationsmaster.module
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import io.github.libxposed.api.XposedModule
|
import io.github.libxposed.api.XposedModule
|
||||||
import io.github.libxposed.api.XposedModuleInterface
|
import io.github.libxposed.api.XposedModuleInterface
|
||||||
@@ -10,12 +12,20 @@ import io.github.libxposed.api.XposedModuleInterface
|
|||||||
*/
|
*/
|
||||||
class NotificationsMasterModule : XposedModule() {
|
class NotificationsMasterModule : XposedModule() {
|
||||||
override fun onSystemServerStarting(param: XposedModuleInterface.SystemServerStartingParam) {
|
override fun onSystemServerStarting(param: XposedModuleInterface.SystemServerStartingParam) {
|
||||||
runCatching {
|
SystemAlertPolicyCache.installWhenReady()
|
||||||
SystemAlertPolicyCache.installWhenReady()
|
Handler(Looper.getMainLooper()).post {
|
||||||
NotificationAttentionBridge(this, ::diagnoseAttentionHelperEvent).install(param.classLoader)
|
installBridge("notification attention") {
|
||||||
SystemNotificationBridge(this, ::diagnoseHelperEvent).install(param.classLoader)
|
NotificationAttentionBridge(this, ::diagnoseAttentionHelperEvent).install(param.classLoader)
|
||||||
}.onFailure { error ->
|
}
|
||||||
Log.e(TAG, "Notification bridge was not installed; leaving Android unchanged", error)
|
installBridge("notification enqueue") {
|
||||||
|
SystemNotificationBridge(this, ::diagnoseHelperEvent).install(param.classLoader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun installBridge(name: String, install: () -> Unit) {
|
||||||
|
runCatching(install).onFailure { error ->
|
||||||
|
Log.e(TAG, "$name bridge was not installed; leaving Android unchanged", error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user