Disable voice input if assist is voice service
Bug: 22358252 Change-Id: Id4a9de8c5287c5e025d0ccc7f98edd8855db519c
This commit is contained in:
@@ -104,6 +104,7 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private void updateUi() {
|
private void updateUi() {
|
||||||
mDefaultAssitPref.refreshAssistApps();
|
mDefaultAssitPref.refreshAssistApps();
|
||||||
|
mVoiceInputPref.refreshVoiceInputs();
|
||||||
|
|
||||||
final ComponentName currentAssist = mDefaultAssitPref.getCurrentAssist();
|
final ComponentName currentAssist = mDefaultAssitPref.getCurrentAssist();
|
||||||
final boolean hasAssistant = currentAssist != null;
|
final boolean hasAssistant = currentAssist != null;
|
||||||
@@ -115,8 +116,19 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
getPreferenceScreen().removePreference(mScreenshotPref);
|
getPreferenceScreen().removePreference(mScreenshotPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCurrentAssistVoiceService()) {
|
||||||
|
getPreferenceScreen().removePreference(mVoiceInputPref);
|
||||||
|
} else {
|
||||||
|
getPreferenceScreen().addPreference(mVoiceInputPref);
|
||||||
mVoiceInputPref.setAssistRestrict(currentAssist);
|
mVoiceInputPref.setAssistRestrict(currentAssist);
|
||||||
mVoiceInputPref.refreshVoiceInputs();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCurrentAssistVoiceService() {
|
||||||
|
ComponentName currentAssist = mDefaultAssitPref.getCurrentAssist();
|
||||||
|
ComponentName activeService = mVoiceInputPref.getCurrentService();
|
||||||
|
return currentAssist == null && activeService == null ||
|
||||||
|
currentAssist != null && currentAssist.equals(activeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void confirmNewAssist(final String newAssitPackage) {
|
private void confirmNewAssist(final String newAssitPackage) {
|
||||||
|
@@ -121,6 +121,16 @@ public class VoiceInputListPreference extends AppListPreferenceWithSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ComponentName getCurrentService() {
|
||||||
|
if (mHelper.mCurrentVoiceInteraction != null) {
|
||||||
|
return mHelper.mCurrentVoiceInteraction;
|
||||||
|
} else if (mHelper.mCurrentRecognizer != null) {
|
||||||
|
return mHelper.mCurrentRecognizer;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class CustomAdapter extends ArrayAdapter<CharSequence> {
|
private class CustomAdapter extends ArrayAdapter<CharSequence> {
|
||||||
|
|
||||||
public CustomAdapter(Context context, CharSequence[] objects) {
|
public CustomAdapter(Context context, CharSequence[] objects) {
|
||||||
|
Reference in New Issue
Block a user