summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2015-02-13 13:25:39 -0800
committerZhijun He <zhijunhe@google.com>2015-03-17 19:24:05 -0700
commit4f2a5eb6a861f09a458ab2530e7a64b1b9411bb1 (patch)
tree35ab9863e5fdf2379b626ea720383d5e9254c978 /services
parent736a7f7b39637e67becef203bb552010ba071467 (diff)
downloadframeworks_av-4f2a5eb6a861f09a458ab2530e7a64b1b9411bb1.zip
frameworks_av-4f2a5eb6a861f09a458ab2530e7a64b1b9411bb1.tar.gz
frameworks_av-4f2a5eb6a861f09a458ab2530e7a64b1b9411bb1.tar.bz2
Look up user-specific device policy for disabling camera
Camera can be disabled on a per-user basis by device admins. Changed the system property format to be per-user so that the policy can be applied based on calling user. TODO: Ideally this policy information should be pulled from the DevicePolicyManager rather than relying on system properties. Property changes will not be applied immediately either, if there's no listener. Bug: 19345698 Change-Id: Ia00034726260bc9ff28ac592f20a27b5c9a77d58
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/CameraService.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f35f7f0..e2747ad 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -29,6 +29,7 @@
#include <binder/MemoryHeapBase.h>
#include <cutils/atomic.h>
#include <cutils/properties.h>
+#include <cutils/multiuser.h>
#include <gui/Surface.h>
#include <hardware/hardware.h>
#include <media/AudioSystem.h>
@@ -670,7 +671,10 @@ status_t CameraService::validateConnect(int cameraId,
}
char value[PROPERTY_VALUE_MAX];
- property_get("sys.secpolicy.camera.disabled", value, "0");
+ char key[PROPERTY_KEY_MAX];
+ int clientUserId = multiuser_get_user_id(clientUid);
+ snprintf(key, PROPERTY_KEY_MAX, "sys.secpolicy.camera.off_%d", clientUserId);
+ property_get(key, value, "0");
if (strcmp(value, "1") == 0) {
// Camera is disabled by DevicePolicyManager.
ALOGI("Camera is disabled. connect X (pid %d) rejected", callingPid);