summaryrefslogtreecommitdiff
path: root/libs/sensorprivacy/SensorPrivacyManager.cpp
diff options
context:
space:
mode:
authorEvan Severson <evanseverson@google.com>2021-01-06 09:15:18 -0800
committerEvan Severson <evanseverson@google.com>2021-01-07 09:06:15 -0800
commit5b8fe03d1fc2c3cc7a6143c63cd0a4b097fc65aa (patch)
tree50080575c795fa51e4f969f4ffe2345ceee75299 /libs/sensorprivacy/SensorPrivacyManager.cpp
parent542630954b270eadd31af33a8019df588647d9df (diff)
Add individual sensor privacay states to sensor privacy api
Test: Compile Bug: 162549680 Change-Id: Ie564b5370cc99727709d523b00634c60766d4187
Diffstat (limited to 'libs/sensorprivacy/SensorPrivacyManager.cpp')
-rw-r--r--libs/sensorprivacy/SensorPrivacyManager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/sensorprivacy/SensorPrivacyManager.cpp b/libs/sensorprivacy/SensorPrivacyManager.cpp
index f973cbad17..7bddee60a5 100644
--- a/libs/sensorprivacy/SensorPrivacyManager.cpp
+++ b/libs/sensorprivacy/SensorPrivacyManager.cpp
@@ -64,6 +64,15 @@ void SensorPrivacyManager::addSensorPrivacyListener(
}
}
+void SensorPrivacyManager::addIndividualSensorPrivacyListener(int userId, int sensor,
+ const sp<hardware::ISensorPrivacyListener>& listener)
+{
+ sp<hardware::ISensorPrivacyManager> service = getService();
+ if (service != nullptr) {
+ service->addIndividualSensorPrivacyListener(userId, sensor, listener);
+ }
+}
+
void SensorPrivacyManager::removeSensorPrivacyListener(
const sp<hardware::ISensorPrivacyListener>& listener)
{
@@ -85,6 +94,18 @@ bool SensorPrivacyManager::isSensorPrivacyEnabled()
return false;
}
+bool SensorPrivacyManager::isIndividualSensorPrivacyEnabled(int userId, int sensor)
+{
+ sp<hardware::ISensorPrivacyManager> service = getService();
+ if (service != nullptr) {
+ bool result;
+ service->isIndividualSensorPrivacyEnabled(userId, sensor, &result);
+ return result;
+ }
+ // if the SensorPrivacyManager is not available then assume sensor privacy is disabled
+ return false;
+}
+
status_t SensorPrivacyManager::linkToDeath(const sp<IBinder::DeathRecipient>& recipient)
{
sp<hardware::ISensorPrivacyManager> service = getService();