Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Fix ServiceManagerCompat
Browse files Browse the repository at this point in the history
  • Loading branch information
SanmerDev committed May 23, 2024
1 parent d904ec9 commit ec7a02b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/src/main/kotlin/com/sanmer/mrepo/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.sanmer.mrepo.network.NetworkUtils
import com.sanmer.mrepo.utils.timber.DebugTree
import com.sanmer.mrepo.utils.timber.ReleaseTree
import dagger.hilt.android.HiltAndroidApp
import dev.sanmer.mrepo.compat.ServiceManagerCompat
import timber.log.Timber

@HiltAndroidApp
Expand All @@ -21,6 +22,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()

ServiceManagerCompat.setHiddenApiExemptions()
NotificationUtils.init(this)
NetworkUtils.setCacheDir(cacheDir)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ object ServiceManagerCompat {

private val context by lazy { ContextDelegate.getContext() }

init {
if (BuildCompat.atLeastP) {
HiddenApiBypass.addHiddenApiExemptions("")
}
fun setHiddenApiExemptions() = when {
BuildCompat.atLeastP -> HiddenApiBypass.addHiddenApiExemptions("")
else -> true
}

interface IProvider {
Expand Down

0 comments on commit ec7a02b

Please sign in to comment.