Update mic/camera toggles api
Also remove the caching since it is done in the manager class now.
Test: Use the camera toggle
Bug: 181681375
Change-Id: Ice579e083c10e4a4cadc7e603c1b6ac4145c4805
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 6efb90b..93c3656 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -29,7 +29,6 @@
#include <inttypes.h>
#include <pthread.h>
-#include <android/content/pm/IPackageManagerNative.h>
#include <android/hardware/ICamera.h>
#include <android/hardware/ICameraClient.h>
@@ -3372,28 +3371,7 @@
}
bool CameraService::SensorPrivacyPolicy::hasCameraPrivacyFeature() {
- if (!mNeedToCheckCameraPrivacyFeature) {
- return mHasCameraPrivacyFeature;
- }
- bool hasCameraPrivacyFeature = false;
- sp<IBinder> binder = defaultServiceManager()->getService(String16("package_native"));
- if (binder != nullptr) {
- sp<content::pm::IPackageManagerNative> packageManager =
- interface_cast<content::pm::IPackageManagerNative>(binder);
- if (packageManager != nullptr) {
- binder::Status status = packageManager->hasSystemFeature(
- String16("android.hardware.camera.toggle"), 0, &hasCameraPrivacyFeature);
-
- if (status.isOk()) {
- mNeedToCheckCameraPrivacyFeature = false;
- mHasCameraPrivacyFeature = hasCameraPrivacyFeature;
- } else {
- ALOGE("Unable to check if camera privacy feature is supported");
- }
- }
- }
-
- return hasCameraPrivacyFeature;
+ return mSpm.supportsSensorToggle(SensorPrivacyManager::INDIVIDUAL_SENSOR_CAMERA);
}
// ----------------------------------------------------------------------------