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

Commit 31cb01d5 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #65055576: VoiceInteractionManagerService sets...

...VOICE_RECOGNITION_SERVICE that is needed for SearchSpeechServices

System setup was incorrectly completely runing off
VoiceInteractionManagerService if the associated feature is not set,
but the service needs to always be running, and instead rely on
the existing logic of reducing functionality if it should not be
running full voice interaction services.

Test: manually booted and ran
Bug: 65055576

Change-Id: I9a83216d45689440c71d657ba2721faf0662b0ff
parent 61492c85
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -1331,11 +1331,13 @@ public final class SystemServer {
                    traceEnd();
                    traceEnd();
                }
                }


                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS)) {
                // We need to always start this service, regardless of whether the
                // FEATURE_VOICE_RECOGNIZERS feature is set, because it needs to take care
                // of initializing various settings.  It will internally modify its behavior
                // based on that feature.
                traceBeginAndSlog("StartVoiceRecognitionManager");
                traceBeginAndSlog("StartVoiceRecognitionManager");
                mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);
                mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);
                traceEnd();
                traceEnd();
                }


                if (GestureLauncherService.isGestureLauncherEnabled(context.getResources())) {
                if (GestureLauncherService.isGestureLauncherEnabled(context.getResources())) {
                    traceBeginAndSlog("StartGestureLauncher");
                    traceBeginAndSlog("StartGestureLauncher");
+10 −5
Original line number Original line Diff line number Diff line
@@ -183,7 +183,7 @@ public class VoiceInteractionManagerService extends SystemService {
        private final boolean mEnableService;
        private final boolean mEnableService;


        VoiceInteractionManagerServiceStub() {
        VoiceInteractionManagerServiceStub() {
            mEnableService = shouldEnableService(mContext.getResources());
            mEnableService = shouldEnableService(mContext);
        }
        }


        // TODO: VI Make sure the caller is the current user or profile
        // TODO: VI Make sure the caller is the current user or profile
@@ -348,10 +348,15 @@ public class VoiceInteractionManagerService extends SystemService {
            }
            }
        }
        }


        private boolean shouldEnableService(Resources res) {
        private boolean shouldEnableService(Context context) {
            // VoiceInteractionService should not be enabled on low ram devices unless it has the config flag.
            // VoiceInteractionService should not be enabled on any low RAM devices
            return !ActivityManager.isLowRamDeviceStatic() ||
            // or devices that have not declared the recognition feature, unless the
                    getForceVoiceInteractionServicePackage(res) != null;
            // device's configuration has explicitly set the config flag for a fixed
            // voice interaction service.
            return (!ActivityManager.isLowRamDeviceStatic()
                            && context.getPackageManager().hasSystemFeature(
                                    PackageManager.FEATURE_VOICE_RECOGNIZERS)) ||
                    getForceVoiceInteractionServicePackage(context.getResources()) != null;
        }
        }


        private String getForceVoiceInteractionServicePackage(Resources res) {
        private String getForceVoiceInteractionServicePackage(Resources res) {