diff options
author | Jason Monk <jmonk@google.com> | 2014-06-18 19:21:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-17 21:07:42 +0000 |
commit | fbe6be4f653d73d5c51ee0a2fb40d2a34c2366fd (patch) | |
tree | 09c4b07f4a05152e6ad69411a0b489ab7bab7939 /services/devicepolicy/java | |
parent | f90f2f8dc36e7243b85e0b6a7fd5a590893c827e (diff) | |
parent | 35c62a4668a85aa4318c9ec564f2e06e8a2d2a30 (diff) | |
download | frameworks_base-fbe6be4f653d73d5c51ee0a2fb40d2a34c2366fd.zip frameworks_base-fbe6be4f653d73d5c51ee0a2fb40d2a34c2366fd.tar.gz frameworks_base-fbe6be4f653d73d5c51ee0a2fb40d2a34c2366fd.tar.bz2 |
Merge "Notify any profile/device owners of lock task"
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 765a33d..5cf5713 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3796,6 +3796,28 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } @Override + public void notifyLockTaskModeChanged(boolean isEnabled, String pkg, int userHandle) { + if (Binder.getCallingUid() != Process.SYSTEM_UID) { + throw new SecurityException("notifyLockTaskModeChanged can only be called by system"); + } + synchronized (this) { + final DevicePolicyData policy = getUserData(userHandle); + Bundle adminExtras = new Bundle(); + adminExtras.putBoolean(DeviceAdminReceiver.EXTRA_LOCK_TASK_ENTERING, isEnabled); + adminExtras.putString(DeviceAdminReceiver.EXTRA_LOCK_TASK_PACKAGE, pkg); + for (ActiveAdmin admin : policy.mAdminList) { + boolean ownsDevice = isDeviceOwner(admin.info.getPackageName()); + boolean ownsProfile = (getProfileOwner(userHandle) != null + && getProfileOwner(userHandle).equals(admin.info.getPackageName())); + if (ownsDevice || ownsProfile) { + sendAdminCommandLocked(admin, DeviceAdminReceiver.ACTION_LOCK_TASK_CHANGED, + adminExtras, null); + } + } + } + } + + @Override public void setGlobalSetting(ComponentName who, String setting, String value) { final ContentResolver contentResolver = mContext.getContentResolver(); |