Skip to content

Commit 1c475a4

Browse files
committed
Don't change the voice interactor setting if it's explicitly unset.
Test: manual Test: atest CtsAssistTestCases CtsVoiceInteractionTestCases CtsVoiceSettingsTestCases Fix: 167261484 Change-Id: Ibc2c1675f8b026f2915c3faf55e8ff3c52e1ee32 Merged-In: Ibc2c1675f8b026f2915c3faf55e8ff3c52e1ee32
1 parent 5c2d5cd commit 1c475a4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,9 @@ private void initForUserNoTracing(@UserIdInt int userHandle) {
395395
+ interactorInfo + ")");
396396
}
397397

398-
// Initializing settings, look for an interactor first (but only on non-svelte).
399-
if (curInteractorInfo == null && mEnableService) {
398+
// Initializing settings. Look for an interactor first, but only on non-svelte and only
399+
// if the user hasn't explicitly unset it.
400+
if (curInteractorInfo == null && mEnableService && !"".equals(curInteractorStr)) {
400401
curInteractorInfo = findAvailInteractor(userHandle, null);
401402
}
402403

@@ -1692,8 +1693,13 @@ public void onPackageModified(String pkgName) {
16921693
if (isPackageAppearing(pkgName) != PACKAGE_UNCHANGED) {
16931694
return;
16941695
}
1696+
final String curInteractorStr = Settings.Secure.getStringForUser(
1697+
mContext.getContentResolver(),
1698+
Settings.Secure.VOICE_INTERACTION_SERVICE, mCurUser);
16951699
final ComponentName curInteractor = getCurInteractor(mCurUser);
1696-
if (curInteractor == null) {
1700+
// If there's no interactor and the user hasn't explicitly unset it, check if the
1701+
// modified package offers one.
1702+
if (curInteractor == null && !"".equals(curInteractorStr)) {
16971703
final VoiceInteractionServiceInfo availInteractorInfo
16981704
= findAvailInteractor(mCurUser, pkgName);
16991705
if (availInteractorInfo != null) {

0 commit comments

Comments
 (0)