diff options
author | Amith Yamasani <yamasani@google.com> | 2015-02-13 13:25:39 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2015-02-13 17:26:55 -0800 |
commit | 228711d4d25ab434c273c92fc01662c0a6b3adbf (patch) | |
tree | 8458d0394718aa2f11363fb4a8aba6f3282e7e47 /services | |
parent | c9f122d8f32ba6928ac9087448025fa3bed1553d (diff) | |
download | frameworks_av-228711d4d25ab434c273c92fc01662c0a6b3adbf.zip frameworks_av-228711d4d25ab434c273c92fc01662c0a6b3adbf.tar.gz frameworks_av-228711d4d25ab434c273c92fc01662c0a6b3adbf.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.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 485b979..c1b7806 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> @@ -597,7 +598,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); |