diff options
author | Scott Lobdell <slobdell@google.com> | 2021-04-25 19:53:06 +0000 |
---|---|---|
committer | Rob Seymour <rseymour@google.com> | 2021-05-06 22:32:25 +0000 |
commit | afbe732519a96ff0a42a1c98bd59fd04080b4a96 (patch) | |
tree | 9ca836d438ca47756e4761ee4b844b85bd7e8857 /libs/sensorprivacy/SensorPrivacyManager.cpp | |
parent | 7a303d6e8135bbd0a32075986c9f7083e0fbef23 (diff) | |
parent | 7132116dfd8bdb9c5b505db8d8a27526a4e889d8 (diff) |
Merge SP1A.210425.001
Change-Id: I219cc0af128876534b77a72c36979fa1fe08ba13
Diffstat (limited to 'libs/sensorprivacy/SensorPrivacyManager.cpp')
-rw-r--r-- | libs/sensorprivacy/SensorPrivacyManager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/sensorprivacy/SensorPrivacyManager.cpp b/libs/sensorprivacy/SensorPrivacyManager.cpp index 47144696f2..b3537ce444 100644 --- a/libs/sensorprivacy/SensorPrivacyManager.cpp +++ b/libs/sensorprivacy/SensorPrivacyManager.cpp @@ -55,6 +55,22 @@ sp<hardware::ISensorPrivacyManager> SensorPrivacyManager::getService() return service; } +bool SensorPrivacyManager::supportsSensorToggle(int sensor) { + if (mSupportedCache.find(sensor) == mSupportedCache.end()) { + sp<hardware::ISensorPrivacyManager> service = getService(); + if (service != nullptr) { + bool result; + service->supportsSensorToggle(sensor, &result); + mSupportedCache[sensor] = result; + return result; + } + // if the SensorPrivacyManager is not available then assume sensor privacy feature isn't + // supported + return false; + } + return mSupportedCache[sensor]; +} + void SensorPrivacyManager::addSensorPrivacyListener( const sp<hardware::ISensorPrivacyListener>& listener) { |