Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8505d4a5 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Disable voice input if assist is voice service" into mnc-dev

parents 7713fe26 0798ef05
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public class ManageAssist extends SettingsPreferenceFragment

    private void updateUi() {
        mDefaultAssitPref.refreshAssistApps();
        mVoiceInputPref.refreshVoiceInputs();

        final ComponentName currentAssist = mDefaultAssitPref.getCurrentAssist();
        final boolean hasAssistant = currentAssist != null;
@@ -115,8 +116,19 @@ public class ManageAssist extends SettingsPreferenceFragment
            getPreferenceScreen().removePreference(mScreenshotPref);
        }

        if (isCurrentAssistVoiceService()) {
            getPreferenceScreen().removePreference(mVoiceInputPref);
        } else {
            getPreferenceScreen().addPreference(mVoiceInputPref);
            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) {
+10 −0
Original line number Diff line number Diff line
@@ -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> {

        public CustomAdapter(Context context, CharSequence[] objects) {