VIMS: Decouple recognizer init from interactor in PackageMonitor.

On package modification, set the recognizer independently of the
interactor.
This will allow keeping the default recognizer provider a different
package from the interactor.
There should be no change to how the interactor is set.

Bug: 167597525
Test: manual
Test: atest CtsVoiceInteractionTestCases
Change-Id: Ib24f077365cbb0850c61196c2825737db1c1c090
This commit is contained in:
Ahaan Ugale
2021-02-08 21:21:29 -08:00
parent 50cabe923d
commit de203c37c3

View File

@@ -1787,6 +1787,9 @@ public class VoiceInteractionManagerService extends SystemService {
if (isPackageAppearing(pkgName) != PACKAGE_UNCHANGED) {
return;
}
if (getCurRecognizer(mCurUser) == null) {
initRecognizer(mCurUser);
}
final String curInteractorStr = Settings.Secure.getStringForUser(
mContext.getContentResolver(),
Settings.Secure.VOICE_INTERACTION_SERVICE, mCurUser);
@@ -1801,12 +1804,6 @@ public class VoiceInteractionManagerService extends SystemService {
availInteractorInfo.getServiceInfo().packageName,
availInteractorInfo.getServiceInfo().name);
setCurInteractor(availInteractor, mCurUser);
if (getCurRecognizer(mCurUser) == null &&
availInteractorInfo.getRecognitionService() != null) {
setCurRecognizer(new ComponentName(
availInteractorInfo.getServiceInfo().packageName,
availInteractorInfo.getRecognitionService()), mCurUser);
}
}
} else {
if (didSomePackagesChange()) {