Add individual sensor privacay states to sensor privacy api
Test: Compile
Bug: 162549680
Change-Id: Ie564b5370cc99727709d523b00634c60766d4187
diff --git a/libs/sensorprivacy/SensorPrivacyManager.cpp b/libs/sensorprivacy/SensorPrivacyManager.cpp
index f973cba..7bddee6 100644
--- a/libs/sensorprivacy/SensorPrivacyManager.cpp
+++ b/libs/sensorprivacy/SensorPrivacyManager.cpp
@@ -64,6 +64,15 @@
}
}
+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 @@
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();