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
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user