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

Commit 35cd793f authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix sensor privacy listener

Current way of registering to the sensor privacy listener works
only when disabling sensors from the developer settings.
This CL also registers a listener for when the mic privacy toggle
is used.
This change is temporary until problems around app ops start/stop
notifications from audio framework are sorted out and we can rely
on app ops to silence audio when the mic privacy toggle is used.

Test: make
Change-Id: I1178a15583596cd025d5cb1e424f9fe3bf7854b4
parent 6aa0ae32
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1816,12 +1816,14 @@ void AudioPolicyService::UidPolicy::dumpInternals(int fd) {
void AudioPolicyService::SensorPrivacyPolicy::registerSelf() {
    SensorPrivacyManager spm;
    mSensorPrivacyEnabled = spm.isSensorPrivacyEnabled();
    (void)spm.addToggleSensorPrivacyListener(this);
    spm.addSensorPrivacyListener(this);
}

void AudioPolicyService::SensorPrivacyPolicy::unregisterSelf() {
    SensorPrivacyManager spm;
    spm.removeSensorPrivacyListener(this);
    spm.removeToggleSensorPrivacyListener(this);
}

bool AudioPolicyService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {