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

Commit 33ad7f00 authored by Omar Eissa's avatar Omar Eissa Committed by Android (Google) Code Review
Browse files

Merge "Don't allow 3p apps to become voice recognizer automatically" into main

parents a66700aa 0bc6ced9
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -955,13 +955,21 @@ public class VoiceInteractionManagerService extends SystemService {
                        }
                    }
                }
                if (numAvailable > 1) {
                    Slog.w(TAG, "more than one voice recognition service found, picking first");
                }

                ServiceInfo serviceInfo = available.get(0).getServiceInfo();
                // If prefPackage isn't found then only default to system recognizer.
                // prefPackage could be either the current recognizer or the default recognizer.
                for (int i = 0; i < numAvailable; i++) {
                    ServiceInfo serviceInfo = available.get(i).getServiceInfo();
                    if ((serviceInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                        continue;
                    }
                    return new ComponentName(serviceInfo.packageName, serviceInfo.name);
                }

                Slog.w(TAG, "no auto selectable voice recognition services found for user "
                        + userHandle);
                return null;
            }
        }

        private List<RecognitionServiceInfo> removeNonSelectableAsDefault(