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

Commit 632fd439 authored by Wilson Wu's avatar Wilson Wu
Browse files

Fix show/hide virtual keyboard delay

The default observer delay is 10s for background
service. When a device connected to a hardware
keyboard, the delay makes soft keyboard visibility
is unsync after user switch the configuration.

Notify the SHOW_IME_WITH_HARD_KEYBOARD change
without delay.

Bug: 240210005
Test: Manual with bug steps
Change-Id: I7f8cb0df514fdea4ed0e092cd4466931ec200969
parent 812c7d79
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Activity;
import android.app.settings.SettingsEnums;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
@@ -211,8 +212,10 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment

    private final OnPreferenceChangeListener mShowVirtualKeyboardSwitchPreferenceChangeListener =
            (preference, newValue) -> {
                Secure.putInt(getContentResolver(), Secure.SHOW_IME_WITH_HARD_KEYBOARD,
                        ((Boolean) newValue) ? 1 : 0);
                final ContentResolver cr = getContentResolver();
                Secure.putInt(cr, Secure.SHOW_IME_WITH_HARD_KEYBOARD, ((Boolean) newValue) ? 1 : 0);
                cr.notifyChange(Secure.getUriFor(Secure.SHOW_IME_WITH_HARD_KEYBOARD),
                        null /* observer */, ContentResolver.NOTIFY_NO_DELAY);
                return true;
            };