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

Commit 85ead7e3 authored by Rashed Abdel-Tawab's avatar Rashed Abdel-Tawab Committed by Tipz Team
Browse files

Settings: Only show gesture navigation if device has a software nav bar

Change-Id: Ic90c8a194a736807c2e101ffd5f7e90c86a55381
parent e5c24588
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.view.Display;
import android.view.IWindowManager;
import android.view.WindowManagerGlobal;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -53,9 +57,19 @@ public class SystemNavigationPreferenceController extends BasePreferenceControll
    }

    static boolean isGestureAvailable(Context context) {
        boolean hasNavigationBar = false;
        final boolean configEnabled = context.getResources().getBoolean(
                com.android.internal.R.bool.config_swipe_up_gesture_setting_available);

        try {
            IWindowManager windowManager = WindowManagerGlobal.getWindowManagerService();
            hasNavigationBar = windowManager.hasNavigationBar(Display.DEFAULT_DISPLAY);
        } catch (RemoteException ex) {
            // no window manager? good luck with that
        }
        // Skip if the swipe up settings are not available
        if (!context.getResources().getBoolean(
                com.android.internal.R.bool.config_swipe_up_gesture_setting_available)) {
        // or if on-screen navbar is disabled (for devices with hardware keys)
        if (!configEnabled || !hasNavigationBar) {
            return false;
        }