diff options
author | Martin Hibdon <mhibdon@google.com> | 2014-09-15 13:26:36 -0700 |
---|---|---|
committer | Martin Hibdon <mhibdon@google.com> | 2014-09-25 13:48:11 -0700 |
commit | ce6916b32a98a568ceafb734d050801f4459a532 (patch) | |
tree | 34c3458627e4a765cec25c34634ae053b4a675d4 /emailcommon | |
parent | 809313bda69d429b72a11c1d030907405533ec08 (diff) | |
download | android_packages_apps_Email-ce6916b32a98a568ceafb734d050801f4459a532.tar.gz android_packages_apps_Email-ce6916b32a98a568ceafb734d050801f4459a532.tar.bz2 android_packages_apps_Email-ce6916b32a98a568ceafb734d050801f4459a532.zip |
Don't allow disabling of the camera with managed profiles
Change-Id: I2e6085084682b04ef7973bc433214b5b3ab2da79
Diffstat (limited to 'emailcommon')
-rwxr-xr-x | emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl | 1 | ||||
-rwxr-xr-x | emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl b/emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl index c284292e0..2c2c9903a 100755 --- a/emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl +++ b/emailcommon/src/com/android/emailcommon/service/IPolicyService.aidl @@ -25,4 +25,5 @@ interface IPolicyService { // New version void setAccountPolicy2(long accountId, in Policy policy, String securityKey, boolean notify); oneway void remoteWipe(); + boolean canDisableCamera(); }
\ No newline at end of file diff --git a/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java index fcd916f25..c5dd6c180 100755 --- a/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java +++ b/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java @@ -85,6 +85,24 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService { waitForCompletion(); } + public boolean canDisableCamera() throws RemoteException { + setTask(new ProxyTask() { + @Override + public void run() throws RemoteException { + mReturn = mService.canDisableCamera(); + } + }, "canDisableCamera"); + waitForCompletion(); + if (mReturn == null) { + // This is not a great situation, but it's better to act like the policy isn't enforced + // rather than crash. + LogUtils.e(TAG, "PolicyService unavailable in canDisableCamera; assuming false"); + return false; + } else { + return (Boolean)mReturn; + } + } + @Override public void remoteWipe() throws RemoteException { setTask(new ProxyTask() { @@ -145,5 +163,13 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService { } throw new IllegalStateException("PolicyService transaction failed"); } + + public static boolean canDisableCamera(Context context) { + try { + return new PolicyServiceProxy(context).canDisableCamera(); + } catch (RemoteException e) { + } + return false; + } } |