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

Commit eac0de97 authored by Chen Bai's avatar Chen Bai Committed by Android (Google) Code Review
Browse files

Merge "clobber wom: implement onKeyUp for StemPrimaryKeyRule" into main

parents a81e906a 2d1a1415
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1256,6 +1256,11 @@
    -->
    <bool name="config_shortPressEarlyOnPower">false</bool>

    <!-- Whether a single short press on STEM_PRIMARY should be launched without multi-press delay.
        This works similarly as config_shortPressEarlyOnPower but for STEM_PRIMARY.
    -->
    <bool name="config_shortPressEarlyOnStemPrimary">false</bool>

    <!-- Control the behavior of the search key.
            0 - Launch default search activity
            1 - Launch target activity defined by config_searchKeyTargetActivity
+1 −0
Original line number Diff line number Diff line
@@ -473,6 +473,7 @@
  <java-symbol type="integer" name="config_doublePressOnStemPrimaryBehavior" />
  <java-symbol type="integer" name="config_triplePressOnStemPrimaryBehavior" />
  <java-symbol type="bool" name="config_shortPressEarlyOnPower" />
  <java-symbol type="bool" name="config_shortPressEarlyOnStemPrimary" />
  <java-symbol type="string" name="config_doublePressOnPowerTargetActivity" />
  <java-symbol type="integer" name="config_searchKeyBehavior" />
  <java-symbol type="string" name="config_searchKeyTargetActivity" />
+13 −0
Original line number Diff line number Diff line
@@ -549,6 +549,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mLidNavigationAccessibility;
    int mShortPressOnPowerBehavior;
    private boolean mShouldEarlyShortPressOnPower;
    private boolean mShouldEarlyShortPressOnStemPrimary;
    int mLongPressOnPowerBehavior;
    long mLongPressOnPowerAssistantTimeoutMs;
    int mVeryLongPressOnPowerBehavior;
@@ -2748,6 +2749,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        @Override
        void onPress(long downTime) {
            if (mShouldEarlyShortPressOnStemPrimary) {
                return;
            }
            stemPrimaryPress(1 /*count*/);
        }

@@ -2760,6 +2764,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        void onMultiPress(long downTime, int count) {
            stemPrimaryPress(count);
        }

        @Override
        void onKeyUp(long eventTime, int count) {
            if (mShouldEarlyShortPressOnStemPrimary && count == 1) {
                stemPrimaryPress(1 /*pressCount*/);
            }
        }
    }

    private void initSingleKeyGestureRules(Looper looper) {
@@ -2929,6 +2940,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            mShouldEarlyShortPressOnPower =
                    mContext.getResources()
                            .getBoolean(com.android.internal.R.bool.config_shortPressEarlyOnPower);
            mShouldEarlyShortPressOnStemPrimary = mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_shortPressEarlyOnStemPrimary);

            mStylusButtonsEnabled = Settings.Secure.getIntForUser(resolver,
                    Secure.STYLUS_BUTTONS_ENABLED, 1, UserHandle.USER_CURRENT) == 1;