mirror of https://github.com/x13a/Wasted.git
ref
This commit is contained in:
parent
44a45e77f4
commit
255bed2760
|
@ -13,7 +13,7 @@ class AppNotificationManager(private val ctx: Context) {
|
|||
private var manager: NotificationManager? = null
|
||||
|
||||
init {
|
||||
manager = ctx.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?
|
||||
manager = ctx.getSystemService(NotificationManager::class.java)
|
||||
}
|
||||
|
||||
fun createNotificationChannels() {
|
||||
|
@ -26,4 +26,4 @@ class AppNotificationManager(private val ctx: Context) {
|
|||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class DeviceAdminManager(private val ctx: Context) {
|
|||
private val prefs by lazy { Preferences(ctx) }
|
||||
|
||||
init {
|
||||
dpm = ctx.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager?
|
||||
dpm = ctx.getSystemService(DevicePolicyManager::class.java)
|
||||
}
|
||||
|
||||
fun remove() = dpm?.removeActiveAdmin(deviceAdmin)
|
||||
|
|
|
@ -21,9 +21,7 @@ class UnlockService : Service() {
|
|||
private class UnlockReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
if (context == null) return
|
||||
val keyguardManager = context
|
||||
.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager?
|
||||
if (keyguardManager?.isDeviceSecure != true) return
|
||||
if (context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true) return
|
||||
val manager = WipeJobManager(context)
|
||||
var delay = 1000L
|
||||
while (manager.schedule() != JobScheduler.RESULT_SUCCESS) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class WipeJobManager(private val ctx: Context) {
|
|||
private var scheduler: JobScheduler? = null
|
||||
|
||||
init {
|
||||
scheduler = ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler?
|
||||
scheduler = ctx.getSystemService(JobScheduler::class.java)
|
||||
}
|
||||
|
||||
fun schedule(): Int {
|
||||
|
|
Loading…
Reference in New Issue