override fun onReceive()

in core/src/main/java/com/github/shadowsocks/BootReceiver.kt [43:54]


    override fun onReceive(context: Context, intent: Intent) {
        if (!DataStore.persistAcrossReboot) {   // sanity check
            enabled = false
            return
        }
        val doStart = when (intent.action) {
            Intent.ACTION_BOOT_COMPLETED -> !DataStore.directBootAware
            Intent.ACTION_LOCKED_BOOT_COMPLETED -> DataStore.directBootAware
            else -> DataStore.directBootAware || Build.VERSION.SDK_INT >= 24 && Core.user.isUserUnlocked
        }
        if (doStart) Core.startService()
    }