Loading services/audiopolicy/service/AudioPolicyService.cpp +26 −41 Original line number Diff line number Diff line Loading @@ -537,9 +537,7 @@ void AudioPolicyService::updateUidStates_l() { // Go over all active clients and allow capture (does not force silence) in the // following cases: // The client source is virtual (remote submix, call audio TX or RX...) // OR The user the client is running in has microphone sensor privacy disabled // AND The client is the assistant // The client is the assistant // AND an accessibility service is on TOP or a RTT call is active // AND the source is VOICE_RECOGNITION or HOTWORD // OR uses VOICE_RECOGNITION AND is on TOP Loading @@ -554,6 +552,7 @@ void AudioPolicyService::updateUidStates_l() // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // AND is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR the client source is virtual (remote submix, call audio TX or RX...) // OR the client source is HOTWORD // AND is on TOP // OR all active clients are using HOTWORD source Loading Loading @@ -596,8 +595,7 @@ void AudioPolicyService::updateUidStates_l() for (size_t i =0; i < mAudioRecordClients.size(); i++) { sp<AudioRecordClient> current = mAudioRecordClients[i]; uid_t currentUid = VALUE_OR_FATAL(aidl2legacy_int32_t_uid_t(current->identity.uid)); if (!current->active || (!isVirtualSource(current->attributes.source) && isUserSensorPrivacyEnabledForUid(currentUid))) { if (!current->active) { continue; } Loading Loading @@ -734,9 +732,6 @@ void AudioPolicyService::updateUidStates_l() if (isVirtualSource(source)) { // Allow capture for virtual (remote submix, call audio TX or RX...) sources allowCapture = true; } else if (isUserSensorPrivacyEnabledForUid(currentUid)) { // If sensor privacy is enabled, don't allow capture allowCapture = false; } else if (mUidPolicy->isAssistantUid(currentUid)) { // For assistant allow capture if: // An accessibility service is on TOP or a RTT call is active Loading Loading @@ -1145,16 +1140,6 @@ status_t AudioPolicyService::handleGetUidState(Vector<String16>& args, int out, return NO_INIT; } bool AudioPolicyService::isUserSensorPrivacyEnabledForUid(uid_t uid) { userid_t userId = multiuser_get_user_id(uid); if (mMicrophoneSensorPrivacyPolicies.find(userId) == mMicrophoneSensorPrivacyPolicies.end()) { sp<SensorPrivacyPolicy> userPolicy = new SensorPrivacyPolicy(this); userPolicy->registerSelfForMicrophoneOnly(userId); mMicrophoneSensorPrivacyPolicies[userId] = userPolicy; } return mMicrophoneSensorPrivacyPolicies[userId]->isSensorPrivacyEnabled(); } status_t AudioPolicyService::printHelp(int out) { return dprintf(out, "Audio policy service commands:\n" " get-uid-state <PACKAGE> [--user USER_ID] gets the uid state\n" Loading services/audiopolicy/service/AudioPolicyService.h +0 −4 Original line number Diff line number Diff line Loading @@ -346,8 +346,6 @@ private: status_t validateUsage(audio_usage_t usage); status_t validateUsage(audio_usage_t usage, const media::permission::Identity& identity); bool isUserSensorPrivacyEnabledForUid(uid_t uid); void updateUidStates(); void updateUidStates_l() REQUIRES(mLock); Loading Loading @@ -908,8 +906,6 @@ private: void *mLibraryHandle = nullptr; CreateAudioPolicyManagerInstance mCreateAudioPolicyManager; DestroyAudioPolicyManagerInstance mDestroyAudioPolicyManager; std::map<userid_t, sp<SensorPrivacyPolicy>> mMicrophoneSensorPrivacyPolicies; }; } // namespace android Loading Loading
services/audiopolicy/service/AudioPolicyService.cpp +26 −41 Original line number Diff line number Diff line Loading @@ -537,9 +537,7 @@ void AudioPolicyService::updateUidStates_l() { // Go over all active clients and allow capture (does not force silence) in the // following cases: // The client source is virtual (remote submix, call audio TX or RX...) // OR The user the client is running in has microphone sensor privacy disabled // AND The client is the assistant // The client is the assistant // AND an accessibility service is on TOP or a RTT call is active // AND the source is VOICE_RECOGNITION or HOTWORD // OR uses VOICE_RECOGNITION AND is on TOP Loading @@ -554,6 +552,7 @@ void AudioPolicyService::updateUidStates_l() // OR client has CAPTURE_AUDIO_OUTPUT privileged permission // AND is on TOP // AND the source is VOICE_RECOGNITION or HOTWORD // OR the client source is virtual (remote submix, call audio TX or RX...) // OR the client source is HOTWORD // AND is on TOP // OR all active clients are using HOTWORD source Loading Loading @@ -596,8 +595,7 @@ void AudioPolicyService::updateUidStates_l() for (size_t i =0; i < mAudioRecordClients.size(); i++) { sp<AudioRecordClient> current = mAudioRecordClients[i]; uid_t currentUid = VALUE_OR_FATAL(aidl2legacy_int32_t_uid_t(current->identity.uid)); if (!current->active || (!isVirtualSource(current->attributes.source) && isUserSensorPrivacyEnabledForUid(currentUid))) { if (!current->active) { continue; } Loading Loading @@ -734,9 +732,6 @@ void AudioPolicyService::updateUidStates_l() if (isVirtualSource(source)) { // Allow capture for virtual (remote submix, call audio TX or RX...) sources allowCapture = true; } else if (isUserSensorPrivacyEnabledForUid(currentUid)) { // If sensor privacy is enabled, don't allow capture allowCapture = false; } else if (mUidPolicy->isAssistantUid(currentUid)) { // For assistant allow capture if: // An accessibility service is on TOP or a RTT call is active Loading Loading @@ -1145,16 +1140,6 @@ status_t AudioPolicyService::handleGetUidState(Vector<String16>& args, int out, return NO_INIT; } bool AudioPolicyService::isUserSensorPrivacyEnabledForUid(uid_t uid) { userid_t userId = multiuser_get_user_id(uid); if (mMicrophoneSensorPrivacyPolicies.find(userId) == mMicrophoneSensorPrivacyPolicies.end()) { sp<SensorPrivacyPolicy> userPolicy = new SensorPrivacyPolicy(this); userPolicy->registerSelfForMicrophoneOnly(userId); mMicrophoneSensorPrivacyPolicies[userId] = userPolicy; } return mMicrophoneSensorPrivacyPolicies[userId]->isSensorPrivacyEnabled(); } status_t AudioPolicyService::printHelp(int out) { return dprintf(out, "Audio policy service commands:\n" " get-uid-state <PACKAGE> [--user USER_ID] gets the uid state\n" Loading
services/audiopolicy/service/AudioPolicyService.h +0 −4 Original line number Diff line number Diff line Loading @@ -346,8 +346,6 @@ private: status_t validateUsage(audio_usage_t usage); status_t validateUsage(audio_usage_t usage, const media::permission::Identity& identity); bool isUserSensorPrivacyEnabledForUid(uid_t uid); void updateUidStates(); void updateUidStates_l() REQUIRES(mLock); Loading Loading @@ -908,8 +906,6 @@ private: void *mLibraryHandle = nullptr; CreateAudioPolicyManagerInstance mCreateAudioPolicyManager; DestroyAudioPolicyManagerInstance mDestroyAudioPolicyManager; std::map<userid_t, sp<SensorPrivacyPolicy>> mMicrophoneSensorPrivacyPolicies; }; } // namespace android Loading