From 6c2dd2f452e43e3bfde7204a7ba56eafa4d4d4e2 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Fri, 18 Jan 2019 21:51:54 +0000 Subject: [PATCH] FinishActivity: Do not write the currently set FORCE_SHOW_NAVBAR value * Check if the value for the setting is already applied and do not attempt to write it again. During the testing of SuW it was found out that there can be an edgecase where softkeys don't show up neither hardware keys work, even though the setting is applied (judging by the status of the KeyDisabler switch). Change-Id: I902f26fe131e508974116f7607fd0b88921395d9 --- src/org/lineageos/setupwizard/FinishActivity.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/org/lineageos/setupwizard/FinishActivity.java b/src/org/lineageos/setupwizard/FinishActivity.java index c02ed0a1..34558685 100644 --- a/src/org/lineageos/setupwizard/FinishActivity.java +++ b/src/org/lineageos/setupwizard/FinishActivity.java @@ -210,8 +210,14 @@ public class FinishActivity extends BaseSetupWizardActivity { private static void writeDisableNavkeysOption(Context context, boolean enabled) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - LineageSettings.System.putIntForUser(context.getContentResolver(), - LineageSettings.System.FORCE_SHOW_NAVBAR, enabled ? 1 : 0, UserHandle.USER_CURRENT); + final boolean virtualKeysEnabled = LineageSettings.System.getIntForUser( + context.getContentResolver(), LineageSettings.System.FORCE_SHOW_NAVBAR, 0, + UserHandle.USER_CURRENT) != 0; + if (enabled != virtualKeysEnabled) { + LineageSettings.System.putIntForUser(context.getContentResolver(), + LineageSettings.System.FORCE_SHOW_NAVBAR, enabled ? 1 : 0, + UserHandle.USER_CURRENT); + } /* Save/restore button timeouts to disable them in softkey mode */ if (enabled) {