Skip preflight RECORD_AUDIO in RecognitionService if FD provided

If a file descriptor is provided to a recognitionService using the
EXTRA_AUDIO_SOURCE option, then do not make a preflight RECORD_AUDIO
check

Test: manual
Bug: 226969470
Change-Id: Ibc9fa378f5375a38922f1791c13600a3a5ab55f1
This commit is contained in:
Nate Myren
2022-05-10 16:25:06 -07:00
parent 4220511d7e
commit ddd89a86e2

View File

@@ -129,8 +129,9 @@ public abstract class RecognitionService extends Service {
@NonNull AttributionSource attributionSource) {
try {
if (mCurrentCallback == null) {
boolean preflightPermissionCheckPassed = checkPermissionForPreflightNotHardDenied(
attributionSource);
boolean preflightPermissionCheckPassed =
intent.hasExtra(RecognizerIntent.EXTRA_AUDIO_SOURCE)
|| checkPermissionForPreflightNotHardDenied(attributionSource);
if (preflightPermissionCheckPassed) {
if (DBG) {
Log.d(TAG, "created new mCurrentCallback, listener = "