LineageSettingsActivity: Remove useless check for navbar toggle
* The only condition for "Use on screen navigation keys instead of hardware keys" option to be shown is the availability of KeyDisabler feature. There is really no need to check if the device "needs" a software navbar (because it has no hardware keys). Change-Id: Id716d766927f440292a6d18d8fa77bed76ad90b3
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
* Copyright (C) 2017 The LineageOS Project
|
||||
* Copyright (C) 2017-2018 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,7 +59,7 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
private CheckBox mNavKeys;
|
||||
private CheckBox mPrivacyGuard;
|
||||
|
||||
private boolean mHideNavKeysRow = false;
|
||||
private boolean mSupportsKeyDisabler = false;
|
||||
|
||||
private View.OnClickListener mMetricsClickListener = view -> {
|
||||
boolean checked = !mMetrics.isChecked();
|
||||
@@ -124,18 +124,12 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
View navKeysRow = findViewById(R.id.nav_keys);
|
||||
navKeysRow.setOnClickListener(mNavKeysClickListener);
|
||||
mNavKeys = (CheckBox) findViewById(R.id.nav_keys_checkbox);
|
||||
boolean needsNavBar = true;
|
||||
try {
|
||||
IWindowManager windowManager = WindowManagerGlobal.getWindowManagerService();
|
||||
needsNavBar = windowManager.needsNavigationBar();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mHideNavKeysRow = hideKeyDisabler(this);
|
||||
if (mHideNavKeysRow || needsNavBar) {
|
||||
navKeysRow.setVisibility(View.GONE);
|
||||
} else {
|
||||
mSupportsKeyDisabler = isKeyDisablerSupported(this);
|
||||
if (mSupportsKeyDisabler) {
|
||||
boolean navKeysDisabled = isKeyDisablerActive(this);
|
||||
mNavKeys.setChecked(navKeysDisabled);
|
||||
} else {
|
||||
navKeysRow.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
View privacyGuardRow = findViewById(R.id.privacy_guard);
|
||||
@@ -194,7 +188,7 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
private void updateDisableNavkeysOption() {
|
||||
if (!mHideNavKeysRow) {
|
||||
if (mSupportsKeyDisabler) {
|
||||
final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
|
||||
boolean enabled = LineageSettings.Global.getInt(getContentResolver(),
|
||||
LineageSettings.Global.DEV_FORCE_SHOW_NAVBAR, 0) != 0;
|
||||
@@ -217,9 +211,9 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
bundle.putBoolean(KEY_PRIVACY_GUARD, checked);
|
||||
}
|
||||
|
||||
private static boolean hideKeyDisabler(Context context) {
|
||||
private static boolean isKeyDisablerSupported(Context context) {
|
||||
final LineageHardwareManager hardware = LineageHardwareManager.getInstance(context);
|
||||
return !hardware.isSupported(LineageHardwareManager.FEATURE_KEY_DISABLE);
|
||||
return hardware.isSupported(LineageHardwareManager.FEATURE_KEY_DISABLE);
|
||||
}
|
||||
|
||||
private static boolean isKeyDisablerActive(Context context) {
|
||||
|
Reference in New Issue
Block a user