diff options
| author | Jason Monk <jmonk@google.com> | 2014-06-17 10:24:47 -0400 |
|---|---|---|
| committer | Jason Monk <jmonk@google.com> | 2014-06-18 14:56:24 -0400 |
| commit | 35c62a4668a85aa4318c9ec564f2e06e8a2d2a30 (patch) | |
| tree | 247ba7dcb424d2e8a297c50c5d50fb48aba7a535 /services/core | |
| parent | 5d140e4b1b1d43c742a7d67dd5f9d394c846945f (diff) | |
| download | frameworks_base-35c62a4668a85aa4318c9ec564f2e06e8a2d2a30.zip frameworks_base-35c62a4668a85aa4318c9ec564f2e06e8a2d2a30.tar.gz frameworks_base-35c62a4668a85aa4318c9ec564f2e06e8a2d2a30.tar.bz2 | |
Notify any profile/device owners of lock task
Add a method for DeviceAdminReceivers of profile/device owners to
be notified that lock task mode has entered or exited for an app
they have whitelisted.
Change-Id: Id124287d41564bbfccdacccf1977b7acb3ddec3f
Diffstat (limited to 'services/core')
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 66e9eb3..d33d6dc 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -46,6 +46,8 @@ import android.app.ActivityManager.RunningTaskInfo; import android.app.IActivityManager.WaitResult; import android.app.ResultInfo; import android.app.StatusBarManager; +import android.app.admin.DevicePolicyManager; +import android.app.admin.IDevicePolicyManager; import android.content.ComponentName; import android.content.Context; import android.content.IIntentSender; @@ -143,6 +145,7 @@ public final class ActivityStackSupervisor implements DisplayListener { /** Status Bar Service **/ private IBinder mToken = new Binder(); private IStatusBarService mStatusBarService; + private IDevicePolicyManager mDevicePolicyManager; // For debugging to make sure the caller when acquiring/releasing our // wake lock is the system process. @@ -281,6 +284,19 @@ public final class ActivityStackSupervisor implements DisplayListener { } } + private IDevicePolicyManager getDevicePolicyManager() { + synchronized (mService) { + if (mDevicePolicyManager == null) { + mDevicePolicyManager = IDevicePolicyManager.Stub.asInterface( + ServiceManager.checkService(Context.DEVICE_POLICY_SERVICE)); + if (mDevicePolicyManager == null) { + Slog.w(TAG, "warning: no DEVICE_POLICY_SERVICE"); + } + } + return mDevicePolicyManager; + } + } + void setWindowManager(WindowManagerService wm) { synchronized (mService) { mWindowManager = wm; @@ -2988,8 +3004,9 @@ public final class ActivityStackSupervisor implements DisplayListener { final Message lockTaskMsg = Message.obtain(); if (task == null) { // Take out of lock task mode. - mLockTaskModeTask = null; + lockTaskMsg.arg1 = mLockTaskModeTask.userId; lockTaskMsg.what = LOCK_TASK_END_MSG; + mLockTaskModeTask = null; mHandler.sendMessage(lockTaskMsg); return; } @@ -3000,6 +3017,8 @@ public final class ActivityStackSupervisor implements DisplayListener { mLockTaskModeTask = task; findTaskToMoveToFrontLocked(task, 0, null); resumeTopActivitiesLocked(); + lockTaskMsg.obj = mLockTaskModeTask.intent.getComponent().getPackageName(); + lockTaskMsg.arg1 = mLockTaskModeTask.userId; lockTaskMsg.what = LOCK_TASK_START_MSG; mHandler.sendMessage(lockTaskMsg); } @@ -3108,6 +3127,11 @@ public final class ActivityStackSupervisor implements DisplayListener { (StatusBarManager.DISABLE_MASK ^ StatusBarManager.DISABLE_BACK, mToken, mService.mContext.getPackageName()); } + if (getDevicePolicyManager() != null) { + getDevicePolicyManager().notifyLockTaskModeChanged(true, + (String)msg.obj, + msg.arg1); + } } catch (RemoteException ex) { throw new RuntimeException(ex); } @@ -3120,6 +3144,10 @@ public final class ActivityStackSupervisor implements DisplayListener { (StatusBarManager.DISABLE_NONE, mToken, mService.mContext.getPackageName()); } + if (getDevicePolicyManager() != null) { + getDevicePolicyManager().notifyLockTaskModeChanged(false, null, + msg.arg1); + } } catch (RemoteException ex) { throw new RuntimeException(ex); } |
