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

Commit c4d2f9c2 authored by Danny Baumann's avatar Danny Baumann
Browse files

Fix exception being thrown if CMHW is not installed.

Happens during debugging when mmp'ing the app.

Change-Id: Ief84a812696ef3f2515701790f96649cbde0f7d9
parent 16a34860
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
        // Only visible on devices that does not have a navigation bar already,
        // and don't even try unless the existing keys can be disabled
        boolean needsNavigationBar = false;
        if (KeyDisabler.isSupported()) {
        if (isKeyDisablerSupported()) {
            try {
                IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
                needsNavigationBar = wm.needsNavigationBar();
@@ -500,7 +500,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
    }

    public static void restoreKeyDisabler(Context context) {
        if (!KeyDisabler.isSupported()) {
        if (!isKeyDisablerSupported()) {
            return;
        }

@@ -543,6 +543,15 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    }

    private static boolean isKeyDisablerSupported() {
        try {
            return KeyDisabler.isSupported();
        } catch (NoClassDefFoundError e) {
            // Hardware abstraction framework not installed
            return false;
        }
    }

    private void handleTogglePowerButtonEndsCallPreferenceClick() {
        Settings.Secure.putInt(getContentResolver(),
                Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR, (mPowerEndCall.isChecked()