Port some of upstream changes
This commit is contained in:
parent
6350583d9b
commit
4cf35f5d48
2 changed files with 25 additions and 19 deletions
|
|
@ -6,6 +6,8 @@ import android.os.Build
|
|||
import icu.nullptr.hidemyapplist.common.*
|
||||
import icu.nullptr.hidemyapplist.xposed.hook.*
|
||||
import java.io.File
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class HMAService(val pms: IPackageManager) : IHMAService.Stub() {
|
||||
|
||||
|
|
@ -26,6 +28,7 @@ class HMAService(val pms: IPackageManager) : IHMAService.Stub() {
|
|||
private val loggerLock = Any()
|
||||
private val systemApps = mutableSetOf<String>()
|
||||
private val frameworkHooks = mutableSetOf<IFrameworkHook>()
|
||||
val executor: ExecutorService = Executors.newSingleThreadExecutor()
|
||||
|
||||
var config = JsonConfig().apply { detailLog = true }
|
||||
private set
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ package icu.nullptr.hidemyapplist.xposed
|
|||
import android.util.Log
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
private fun parseLog(level: Int, tag: String, msg: String, cause: Throwable? = null) = buildString {
|
||||
val levelStr = when (level) {
|
||||
|
|
@ -22,9 +23,11 @@ private fun parseLog(level: Int, tag: String, msg: String, cause: Throwable? = n
|
|||
|
||||
private fun log(level: Int, tag: String, msg: String, cause: Throwable? = null) {
|
||||
if (level <= Log.DEBUG && HMAService.instance?.config?.detailLog == false) return
|
||||
val parsedLog = parseLog(level, tag, msg, cause)
|
||||
HMAService.instance?.addLog(parsedLog)
|
||||
XposedBridge.log(parsedLog)
|
||||
HMAService.instance?.executor?.execute {
|
||||
val parsedLog = parseLog(level, tag, msg, cause)
|
||||
HMAService.instance?.addLog(parsedLog)
|
||||
XposedBridge.log(parsedLog)
|
||||
}
|
||||
}
|
||||
|
||||
fun logD(tag: String, msg: String, cause: Throwable? = null) = log(Log.DEBUG, tag, msg, cause)
|
||||
|
|
|
|||
Loading…
Reference in a new issue