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
|
private var manager: NotificationManager? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
manager = ctx.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?
|
manager = ctx.getSystemService(NotificationManager::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createNotificationChannels() {
|
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) }
|
private val prefs by lazy { Preferences(ctx) }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
dpm = ctx.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager?
|
dpm = ctx.getSystemService(DevicePolicyManager::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun remove() = dpm?.removeActiveAdmin(deviceAdmin)
|
fun remove() = dpm?.removeActiveAdmin(deviceAdmin)
|
||||||
|
|
|
@ -21,9 +21,7 @@ class UnlockService : Service() {
|
||||||
private class UnlockReceiver : BroadcastReceiver() {
|
private class UnlockReceiver : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
if (context == null) return
|
if (context == null) return
|
||||||
val keyguardManager = context
|
if (context.getSystemService(KeyguardManager::class.java)?.isDeviceSecure != true) return
|
||||||
.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager?
|
|
||||||
if (keyguardManager?.isDeviceSecure != true) return
|
|
||||||
val manager = WipeJobManager(context)
|
val manager = WipeJobManager(context)
|
||||||
var delay = 1000L
|
var delay = 1000L
|
||||||
while (manager.schedule() != JobScheduler.RESULT_SUCCESS) {
|
while (manager.schedule() != JobScheduler.RESULT_SUCCESS) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class WipeJobManager(private val ctx: Context) {
|
||||||
private var scheduler: JobScheduler? = null
|
private var scheduler: JobScheduler? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
scheduler = ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler?
|
scheduler = ctx.getSystemService(JobScheduler::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun schedule(): Int {
|
fun schedule(): Int {
|
||||||
|
|
Loading…
Reference in New Issue