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

Commit decd9d5b authored by Vania Januar's avatar Vania Januar Committed by Android (Google) Code Review
Browse files

Merge "Toggle for disabling stylus buttons."

parents 9269db5c a132f03d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -7223,6 +7223,15 @@ public final class Settings {
        @SuppressLint("NoSettingsProvider")
        public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
        /**
         * Whether stylus button presses are disabled. This is a boolean that
         * determines if stylus buttons are ignored.
         *
         * @hide
         */
        @SuppressLint("NoSettingsProvider")
        public static final String STYLUS_BUTTONS_DISABLED = "stylus_buttons_disabled";
        /**
         * Host name and port for global http proxy. Uses ':' seperator for
         * between host and port.
+1 −0
Original line number Diff line number Diff line
@@ -772,6 +772,7 @@ public class SettingsBackupTest {
                 Settings.Secure.SLEEP_TIMEOUT,
                 Settings.Secure.SMS_DEFAULT_APPLICATION,
                 Settings.Secure.SPELL_CHECKER_ENABLED,  // Intentionally removed in Q
                 Settings.Secure.STYLUS_BUTTONS_DISABLED,
                 Settings.Secure.TRUST_AGENTS_INITIALIZED,
                 Settings.Secure.KNOWN_TRUST_AGENTS_INITIALIZED,
                 Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS,
+11 −1
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ import android.os.Vibrator;
import android.provider.DeviceConfig;
import android.provider.MediaStore;
import android.provider.Settings;
import android.provider.Settings.Secure;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
@@ -516,6 +517,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mDoublePressOnStemPrimaryBehavior;
    int mTriplePressOnStemPrimaryBehavior;
    int mLongPressOnStemPrimaryBehavior;
    boolean mStylusButtonsDisabled = false;
    boolean mHasSoftInput = false;
    boolean mHapticTextHandleEnabled;
    boolean mUseTvRouting;
@@ -771,6 +773,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.Global.getUriFor(
                    Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    Settings.Secure.STYLUS_BUTTONS_DISABLED), false, this,
                    UserHandle.USER_ALL);
            updateSettings();
        }

@@ -2560,6 +2565,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.Global.KEY_CHORD_POWER_VOLUME_UP,
                    mContext.getResources().getInteger(
                            com.android.internal.R.integer.config_keyChordPowerVolumeUp));

            mStylusButtonsDisabled = Settings.Secure.getIntForUser(resolver,
                    Secure.STYLUS_BUTTONS_DISABLED, 0, UserHandle.USER_CURRENT) == 1;
        }
        if (updateRotation) {
            updateRotation(true);
@@ -4183,7 +4191,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case KeyEvent.KEYCODE_DEMO_APP_3:
            case KeyEvent.KEYCODE_DEMO_APP_4: {
                // TODO(b/254604589): Dispatch KeyEvent to System UI.
                if (!mStylusButtonsDisabled) {
                    sendSystemKeyToStatusBarAsync(keyCode);
                }

                // Just drop if keys are not intercepted for direct key.
                result &= ~ACTION_PASS_TO_USER;