mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
User operation shortcuts
Update dependencies
This commit is contained in:
@@ -3,6 +3,8 @@ package com.bintianqi.owndroid
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.bintianqi.owndroid.dpm.UserOperationType
|
||||
import com.bintianqi.owndroid.dpm.doUserOperationWithContext
|
||||
|
||||
class ShortcutsReceiverActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -11,7 +13,7 @@ class ShortcutsReceiverActivity : Activity() {
|
||||
val action = intent.action?.removePrefix("com.bintianqi.owndroid.action.")
|
||||
val key = SP.shortcutKey
|
||||
val requestKey = intent?.getStringExtra("key")
|
||||
if (action != null && SP.shortcuts && key != null && requestKey == key) {
|
||||
if (action != null && key != null && requestKey == key) {
|
||||
when (action) {
|
||||
"LOCK" -> Privilege.DPM.lockNow()
|
||||
"DISABLE_CAMERA" -> {
|
||||
@@ -35,12 +37,21 @@ class ShortcutsReceiverActivity : Activity() {
|
||||
}
|
||||
ShortcutUtils.updateUserRestrictionShortcut(this, id, !state, false)
|
||||
}
|
||||
"USER_OPERATION" -> {
|
||||
val typeName = intent.getStringExtra("operation") ?: return
|
||||
val type = UserOperationType.valueOf(typeName)
|
||||
val serial = intent.getIntExtra("serial", -1)
|
||||
if (serial == -1) return
|
||||
doUserOperationWithContext(this, type, serial, false)
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "Received intent: $action")
|
||||
showOperationResultToast(true)
|
||||
} else {
|
||||
showOperationResultToast(false)
|
||||
}
|
||||
} catch(e: Exception) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
finish()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user