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

Commit d8dc6834 authored by Evan Severson's avatar Evan Severson
Browse files

Update audiopolicy service to use new sensor privacy api

The new calls no longer require user ids since that is managed
internally in the sensor privacy service and calling services will
receive updates when the state is changed or user is changed who has a
different setting. Calling services should treat the state as a global
setting.

AudioPolicyService doesn't read the state of the microphone toggle
directly so this change shouldn't have any affect.

Test: Build
Bug: 191745272
Change-Id: Ied82f1e91da76706c6522424b7ff273c9a23754f
parent e35fc6dd
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -1481,14 +1481,6 @@ void AudioPolicyService::SensorPrivacyPolicy::registerSelf() {
    spm.addSensorPrivacyListener(this);
}

void AudioPolicyService::SensorPrivacyPolicy::registerSelfForMicrophoneOnly(int userId) {
    SensorPrivacyManager spm;
    mSensorPrivacyEnabled = spm.isIndividualSensorPrivacyEnabled(userId,
            SensorPrivacyManager::INDIVIDUAL_SENSOR_MICROPHONE);
    spm.addIndividualSensorPrivacyListener(userId,
            SensorPrivacyManager::INDIVIDUAL_SENSOR_MICROPHONE, this);
}

void AudioPolicyService::SensorPrivacyPolicy::unregisterSelf() {
    SensorPrivacyManager spm;
    spm.removeSensorPrivacyListener(this);
@@ -1498,7 +1490,8 @@ bool AudioPolicyService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {
    return mSensorPrivacyEnabled;
}

binder::Status AudioPolicyService::SensorPrivacyPolicy::onSensorPrivacyChanged(bool enabled) {
binder::Status AudioPolicyService::SensorPrivacyPolicy::onSensorPrivacyChanged(
    int toggleType __unused, int sensor __unused, bool enabled) {
    mSensorPrivacyEnabled = enabled;
    sp<AudioPolicyService> service = mService.promote();
    if (service != nullptr) {
+2 −2
Original line number Diff line number Diff line
@@ -489,12 +489,12 @@ private:
                    : mService(service) {}

            void registerSelf();
            void registerSelfForMicrophoneOnly(int userId);
            void unregisterSelf();

            bool isSensorPrivacyEnabled();

            binder::Status onSensorPrivacyChanged(bool enabled);
            binder::Status onSensorPrivacyChanged(int toggleType, int sensor,
                                                  bool enabled);

        private:
            wp<AudioPolicyService> mService;