VIMS: Decouple recognizer from interactor in initForUser().
When initializing settings for a user, set the recognizer independently of the interactor. This will allow the default recognizer to be provided by 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: I2da8f72c768b27df21534e265a3d1fb6919c7140
This commit is contained in:
@@ -430,25 +430,17 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
// Eventually it will be an error to not specify this.
|
||||
setCurInteractor(new ComponentName(curInteractorInfo.getServiceInfo().packageName,
|
||||
curInteractorInfo.getServiceInfo().name), userHandle);
|
||||
if (curInteractorInfo.getRecognitionService() != null) {
|
||||
setCurRecognizer(
|
||||
new ComponentName(curInteractorInfo.getServiceInfo().packageName,
|
||||
curInteractorInfo.getRecognitionService()), userHandle);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// No voice interactor, so clear the setting.
|
||||
setCurInteractor(null, userHandle);
|
||||
}
|
||||
|
||||
// No voice interactor, we'll just set up a simple recognizer.
|
||||
initSimpleRecognizer(curInteractorInfo, userHandle);
|
||||
initRecognizer(userHandle);
|
||||
}
|
||||
|
||||
public void initSimpleRecognizer(VoiceInteractionServiceInfo curInteractorInfo,
|
||||
int userHandle) {
|
||||
public void initRecognizer(int userHandle) {
|
||||
ComponentName curRecognizer = findAvailRecognizer(null, userHandle);
|
||||
if (curRecognizer != null) {
|
||||
if (curInteractorInfo == null) {
|
||||
setCurInteractor(null, userHandle);
|
||||
}
|
||||
setCurRecognizer(curRecognizer, userHandle);
|
||||
}
|
||||
}
|
||||
@@ -1772,7 +1764,9 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
synchronized (VoiceInteractionManagerServiceStub.this) {
|
||||
Slog.i(TAG, "Force stopping current voice recognizer: "
|
||||
+ getCurRecognizer(userHandle));
|
||||
initSimpleRecognizer(null, userHandle);
|
||||
// TODO: Figure out why the interactor was being cleared and document it.
|
||||
setCurInteractor(null, userHandle);
|
||||
initRecognizer(userHandle);
|
||||
}
|
||||
}
|
||||
return hitInt || hitRec;
|
||||
@@ -1843,10 +1837,7 @@ public class VoiceInteractionManagerService extends SystemService {
|
||||
if (curRecognizer == null) {
|
||||
// Could a new recognizer appear when we don't have one pre-installed?
|
||||
if (anyPackagesAppearing()) {
|
||||
curRecognizer = findAvailRecognizer(null, userHandle);
|
||||
if (curRecognizer != null) {
|
||||
setCurRecognizer(curRecognizer, userHandle);
|
||||
}
|
||||
initRecognizer(userHandle);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user