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

Commit 3a1cef2e authored by Ahaan Ugale's avatar Ahaan Ugale
Browse files

VIMS: Use the new recognizer config resource for init.

When initializing or resetting the recognizer setting, the configured
package is preferred over other available recognizers.

Bug: 175480455
Test: manual - unset recognizer, reboot, and check the setting
Test: atest CtsAssistTestCases CtsVoiceInteractionTestCases \
  CtsVoiceSettingsTestCases
Change-Id: I2fc225eba56bc787b267262d9917e718035c6047
parent 8252a050
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IHotwordRecognitionStatusCallback;
import com.android.internal.app.IVoiceActionCheckCallback;
@@ -643,6 +644,10 @@ public class VoiceInteractionManagerService extends SystemService {
        }

        ComponentName findAvailRecognizer(String prefPackage, int userHandle) {
            if (prefPackage == null) {
                prefPackage = getDefaultRecognizer();
            }

            List<ResolveInfo> available =
                    mContext.getPackageManager().queryIntentServicesAsUser(
                            new Intent(RecognitionService.SERVICE_INTERFACE),
@@ -670,6 +675,12 @@ public class VoiceInteractionManagerService extends SystemService {
            }
        }

        @Nullable
        public String getDefaultRecognizer() {
            String recognizer = mContext.getString(R.string.config_systemSpeechRecognizer);
            return TextUtils.isEmpty(recognizer) ? null : recognizer;
        }

        ComponentName getCurRecognizer(int userHandle) {
            String curRecognizer = Settings.Secure.getStringForUser(
                    mContext.getContentResolver(),