mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
Optimize code
New Privilege object, which follows Application lifecycle. Add Privilege.DPM and Privilege.DAR variable, instead of creating DPM and DAR instance every time.
This commit is contained in:
@@ -7,7 +7,6 @@ import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build.VERSION
|
||||
import android.os.PersistableBundle
|
||||
import android.os.UserHandle
|
||||
import android.os.UserManager
|
||||
import androidx.core.app.NotificationCompat
|
||||
@@ -35,13 +34,13 @@ class Receiver : DeviceAdminReceiver() {
|
||||
|
||||
override fun onEnabled(context: Context, intent: Intent) {
|
||||
super.onEnabled(context, intent)
|
||||
updatePrivilege(context)
|
||||
Privilege.updateStatus()
|
||||
handlePrivilegeChange(context)
|
||||
}
|
||||
|
||||
override fun onDisabled(context: Context, intent: Intent) {
|
||||
super.onDisabled(context, intent)
|
||||
updatePrivilege(context)
|
||||
Privilege.updateStatus()
|
||||
handlePrivilegeChange(context)
|
||||
}
|
||||
|
||||
@@ -74,11 +73,6 @@ class Receiver : DeviceAdminReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTransferOwnershipComplete(context: Context, bundle: PersistableBundle?) {
|
||||
super.onTransferOwnershipComplete(context, bundle)
|
||||
SharedPrefs(context).dhizuku = false
|
||||
}
|
||||
|
||||
override fun onLockTaskModeEntering(context: Context, intent: Intent, pkg: String) {
|
||||
super.onLockTaskModeEntering(context, intent, pkg)
|
||||
if(!NotificationUtils.checkPermission(context)) return
|
||||
|
||||
Reference in New Issue
Block a user