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

Commit 4b945427 authored by Aleksandar Kiridzic's avatar Aleksandar Kiridzic Committed by Aleksandar Kiridžić
Browse files

speech: Mask client identity when running the package manager call

Allow speech recognizers to list all the recognition services.

Bug: 210471821
Test: manual by reproducing the corresponding bug
Change-Id: If2dc9b81e26ca531cadd0ca25e207db036df9cdc
parent 71e2f74d
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -268,9 +268,17 @@ final class SpeechRecognitionManagerServiceImpl extends
    }

    private boolean componentMapsToRecognitionService(@NonNull ComponentName serviceComponent) {
        List<ResolveInfo> resolveInfos =
        List<ResolveInfo> resolveInfos;

        final long identityToken = Binder.clearCallingIdentity();
        try {
            resolveInfos =
                    getContext().getPackageManager().queryIntentServicesAsUser(
                            new Intent(RecognitionService.SERVICE_INTERFACE), 0, getUserId());
        } finally {
            Binder.restoreCallingIdentity(identityToken);
        }

        if (resolveInfos == null) {
            return false;
        }