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

Commit f244554d authored by MingWei Liao's avatar MingWei Liao
Browse files

Revert "Validate the VoiceInteractionService before rebind"

This reverts commit aa1b3725.

Reason for revert: Side-effect: b/343854218

Change-Id: If67f2bc32097c37f66695416005baaffee8059f3
parent 66199e32
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -794,8 +794,9 @@ public class VoiceInteractionManagerService extends SystemService {
                if (curService != null && !curService.isEmpty()) {
                    try {
                        serviceComponent = ComponentName.unflattenFromString(curService);
                        serviceInfo = getValidVoiceInteractionServiceInfo(serviceComponent);
                    } catch (RuntimeException e) {
                        serviceInfo = AppGlobals.getPackageManager()
                                .getServiceInfo(serviceComponent, 0, mCurUser);
                    } catch (RuntimeException | RemoteException e) {
                        Slog.wtf(TAG, "Bad voice interaction service name " + curService, e);
                        serviceComponent = null;
                        serviceInfo = null;
@@ -833,27 +834,6 @@ public class VoiceInteractionManagerService extends SystemService {
            }
        }

        @Nullable
        private ServiceInfo getValidVoiceInteractionServiceInfo(
                @Nullable ComponentName serviceComponent) {
            if (serviceComponent == null) {
                return null;
            }
            List<ResolveInfo> services = queryInteractorServices(
                    mCurUser, serviceComponent.getPackageName());
            for (int i = 0; i < services.size(); i++) {
                ResolveInfo service = services.get(i);
                VoiceInteractionServiceInfo info = new VoiceInteractionServiceInfo(
                        mContext.getPackageManager(), service.serviceInfo);
                ServiceInfo candidateInfo = info.getServiceInfo();
                if (candidateInfo != null
                        && candidateInfo.getComponentName().equals(serviceComponent)) {
                    return candidateInfo;
                }
            }
            return null;
        }

        private List<ResolveInfo> queryInteractorServices(
                @UserIdInt int user,
                @Nullable String packageName) {