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

Commit 2d4304ca authored by Roman Birg's avatar Roman Birg Committed by Steve Kondik
Browse files

Settings: properly remove voicewakeup preference



Change-Id: I0f4720ae22d782b10c85617df9b4649eaf75f324
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 873677ed
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private static final String KEY_STYLUS_ICON_ENABLED = "stylus_icon_enabled";
    private static final String KEY_VOICE_WAKEUP = "voice_wakeup";

    private static final String VOICE_CATEGORY_KEY = "voice_category";
    private static final String VOICE_WAKEUP_PACKAGE = "com.cyanogenmod.voicewakeup";

    // false: on ICS or later
@@ -250,10 +251,14 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
            showKeyboardLayoutDialog(identifier);
        }

        if (!Utils.isPackageInstalled(getActivity(), KEY_VOICE_WAKEUP, false)) {
            Preference wakeup = findPreference(KEY_VOICE_WAKEUP);
        if (!Utils.isPackageInstalled(getActivity(), VOICE_WAKEUP_PACKAGE, false)) {
            PreferenceCategory voiceCategory = (PreferenceCategory)
                    findPreference(VOICE_CATEGORY_KEY);
            if (voiceCategory != null) {
                Preference wakeup = voiceCategory.findPreference(KEY_VOICE_WAKEUP);
                if (wakeup != null) {
                getPreferenceScreen().removePreference(wakeup);
                    voiceCategory.removePreference(wakeup);
                }
            }
        }
    }