Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bfa35e3 authored by Evan Severson's avatar Evan Severson
Browse files

Add aidl method for removing individual sensor privacy listener

Since a single listener can be registered for multiple sensors they
should be able to be removed individually.

Test: Build
Bug: 181681375
Change-Id: I6055e89fefe93e0f67c86becccde0259c4d4ea1b
parent d01b8e9a
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -100,6 +100,15 @@ void SensorPrivacyManager::removeSensorPrivacyListener(
    }
    }
}
}


void SensorPrivacyManager::removeIndividualSensorPrivacyListener(int sensor,
        const sp<hardware::ISensorPrivacyListener>& listener)
{
    sp<hardware::ISensorPrivacyManager> service = getService();
    if (service != nullptr) {
        service->removeIndividualSensorPrivacyListener(sensor, listener);
    }
}

bool SensorPrivacyManager::isSensorPrivacyEnabled()
bool SensorPrivacyManager::isSensorPrivacyEnabled()
{
{
    sp<hardware::ISensorPrivacyManager> service = getService();
    sp<hardware::ISensorPrivacyManager> service = getService();
+2 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,8 @@ interface ISensorPrivacyManager {


    void removeSensorPrivacyListener(in ISensorPrivacyListener listener);
    void removeSensorPrivacyListener(in ISensorPrivacyListener listener);


    void removeIndividualSensorPrivacyListener(int sensor, in ISensorPrivacyListener listener);

    boolean isSensorPrivacyEnabled();
    boolean isSensorPrivacyEnabled();


    boolean isIndividualSensorPrivacyEnabled(int userId, int sensor);
    boolean isIndividualSensorPrivacyEnabled(int userId, int sensor);
+2 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,8 @@ public:
    status_t addIndividualSensorPrivacyListener(int userId, int sensor,
    status_t addIndividualSensorPrivacyListener(int userId, int sensor,
            const sp<hardware::ISensorPrivacyListener>& listener);
            const sp<hardware::ISensorPrivacyListener>& listener);
    void removeSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    void removeSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener);
    void removeIndividualSensorPrivacyListener(int sensor,
            const sp<hardware::ISensorPrivacyListener>& listener);
    bool isSensorPrivacyEnabled();
    bool isSensorPrivacyEnabled();
    bool isIndividualSensorPrivacyEnabled(int userId, int sensor);
    bool isIndividualSensorPrivacyEnabled(int userId, int sensor);
    status_t isIndividualSensorPrivacyEnabled(int userId, int sensor, bool &result);
    status_t isIndividualSensorPrivacyEnabled(int userId, int sensor, bool &result);
+6 −1
Original line number Original line Diff line number Diff line
@@ -2138,8 +2138,13 @@ void SensorService::SensorPrivacyPolicy::registerSelf() {
void SensorService::SensorPrivacyPolicy::unregisterSelf() {
void SensorService::SensorPrivacyPolicy::unregisterSelf() {
    AutoCallerClear acc;
    AutoCallerClear acc;
    SensorPrivacyManager spm;
    SensorPrivacyManager spm;
    if (mIsIndividualMic) {
        spm.removeIndividualSensorPrivacyListener(
                SensorPrivacyManager::INDIVIDUAL_SENSOR_MICROPHONE, this);
    } else {
        spm.removeSensorPrivacyListener(this);
        spm.removeSensorPrivacyListener(this);
    }
    }
}


bool SensorService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {
bool SensorService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {
    return mSensorPrivacyEnabled;
    return mSensorPrivacyEnabled;