mirror of
https://github.com/wesaphzt/privatelock.git
synced 2025-06-29 04:19:50 +00:00
check for admin
This commit is contained in:
parent
1cc68f0fff
commit
18018360d3
1 changed files with 9 additions and 2 deletions
|
@ -229,13 +229,20 @@ public class LockService extends JobIntentService {
|
||||||
|
|
||||||
if (total > SENSITIVITY) {
|
if (total > SENSITIVITY) {
|
||||||
try {
|
try {
|
||||||
|
if (isActiveAdmin()) {
|
||||||
mDPM.lockNow();
|
mDPM.lockNow();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, "Device admin not enabled", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(context, "Error locking, does app have device admin permissions?", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Unknown locking error", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private boolean isActiveAdmin() {
|
||||||
|
return mDPM.isAdminActive(mDeviceAdmin);
|
||||||
|
}
|
||||||
|
|
||||||
private void setNotification() {
|
private void setNotification() {
|
||||||
//notification
|
//notification
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue