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

Commit 60aa4d06 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
Bug: 258021433
Change-Id: I1178a15583596cd025d5cb1e424f9fe3bf7854b4
Merged-In: I1178a15583596cd025d5cb1e424f9fe3bf7854b4
parent 606775f0
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1803,12 +1803,14 @@ void AudioPolicyService::UidPolicy::dumpInternals(int fd) {
void AudioPolicyService::SensorPrivacyPolicy::registerSelf() {
void AudioPolicyService::SensorPrivacyPolicy::registerSelf() {
    SensorPrivacyManager spm;
    SensorPrivacyManager spm;
    mSensorPrivacyEnabled = spm.isSensorPrivacyEnabled();
    mSensorPrivacyEnabled = spm.isSensorPrivacyEnabled();
    (void)spm.addToggleSensorPrivacyListener(this);
    spm.addSensorPrivacyListener(this);
    spm.addSensorPrivacyListener(this);
}
}


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


bool AudioPolicyService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {
bool AudioPolicyService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {