summaryrefslogtreecommitdiff
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorJordan Jozwiak <jjoz@google.com>2020-06-12 16:21:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-12 16:21:05 +0000
commit7048655cbe27f612b1462f9f8931f0a730f7aca5 (patch)
treeb739358257039eee7d59b6b5b01e95811595b4b6 /services/devicepolicy
parent8cf7a51d3d8c1fc1b356c8fd5c5706de7f2bc8ad (diff)
parent9ead5a3c056761a54ea068e67134db5f2776bdd3 (diff)
Merge "DO NOT MERGE - Allow locking with feature or permission" into rvc-dev
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 10ad07cff847..7b624cae8141 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -631,7 +631,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
/**
* Whether or not device admin feature is supported. If it isn't return defaults for all
- * public methods.
+ * public methods, unless the caller has the appropriate permission for a particular method.
*/
final boolean mHasFeature;
@@ -6032,7 +6032,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
@Override
public void lockNow(int flags, boolean parent) {
- if (!mHasFeature) {
+ if (!mHasFeature && mContext.checkCallingPermission(android.Manifest.permission.LOCK_DEVICE)
+ != PackageManager.PERMISSION_GRANTED) {
return;
}