mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-12-02 16:07:25 +00:00
Replace remaining shared preference edits with service configuration setters
Change-Id: I518f54653791ce02cb0e82662802474c5e8852d5
This commit is contained in:
parent
8dceaad8ea
commit
63d09df2fc
1 changed files with 6 additions and 5 deletions
|
@ -12,11 +12,12 @@ import android.util.Log
|
|||
import androidx.lifecycle.LifecycleService
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import kotlinx.coroutines.delay
|
||||
import org.microg.gms.checkin.CheckinPrefs
|
||||
import org.microg.gms.gcm.GcmPrefs
|
||||
import org.microg.gms.checkin.getCheckinServiceInfo
|
||||
import org.microg.gms.checkin.setCheckinServiceConfiguration
|
||||
import org.microg.gms.gcm.getGcmServiceInfo
|
||||
import org.microg.gms.gcm.setGcmServiceConfiguration
|
||||
import org.microg.gms.snet.SafetyNetPrefs
|
||||
import org.microg.gms.snet.getSafetyNetServiceInfo
|
||||
import org.microg.gms.snet.setSafetyNetServiceConfiguration
|
||||
|
||||
class ProvisionService : LifecycleService() {
|
||||
private fun Bundle.getBooleanOrNull(key: String): Boolean? {
|
||||
|
@ -31,9 +32,9 @@ class ProvisionService : LifecycleService() {
|
|||
Log.d(TAG, "Provisioning: $s")
|
||||
}
|
||||
|
||||
intent?.extras?.getBooleanOrNull("checkin_enabled")?.let { CheckinPrefs.setEnabled(this@ProvisionService, it) }
|
||||
intent?.extras?.getBooleanOrNull("checkin_enabled")?.let { setCheckinServiceConfiguration(this@ProvisionService, getCheckinServiceInfo(this@ProvisionService).configuration.copy(enabled = it)) }
|
||||
intent?.extras?.getBooleanOrNull("gcm_enabled")?.let { setGcmServiceConfiguration(this@ProvisionService, getGcmServiceInfo(this@ProvisionService).configuration.copy(enabled = it)) }
|
||||
intent?.extras?.getBooleanOrNull("safetynet_enabled")?.let { SafetyNetPrefs.get(this@ProvisionService).isEnabled = it }
|
||||
intent?.extras?.getBooleanOrNull("safetynet_enabled")?.let { setSafetyNetServiceConfiguration(this@ProvisionService, getSafetyNetServiceInfo(this@ProvisionService).configuration.copy(enabled = it)) }
|
||||
// What else?
|
||||
|
||||
delay(2 * 1000) // Wait 2 seconds to give provisioning some extra time
|
||||
|
|
Loading…
Reference in a new issue