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

Commit 9bcb70b8 authored by xkonni's avatar xkonni Committed by Danny Baumann
Browse files

Enable custom actions for double-tap home (1/2)

PatchSet1: add custom actions
PatchSet2: set defaults
PatchSet3: try to get defaults from config.xml
PatchSet4:
* do get defaults from config.xml
* store state of HARDWARE_KEY_REBINDING
* removed trailing whitespaces
PatchSet5: merge with 48002
PatchSet6: getting late, forgot to change the title when merging
PatchSet7: remove whitespace trimming, reduce code duplication
PatchSet8: rebase, simplify code

Change-Id: I041e7ab3853b356ddbdab2524f096546319276f9
parent 3b611047
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3170,6 +3170,13 @@ public final class Settings {
          */
         public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action";

         /**
          * Action to perform when the home key is double-tapped. (Default is 0)
          * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
          * @hide
          */
         public static final String KEY_HOME_DOUBLE_TAP_ACTION = "key_home_double_tap_action";

         /**
          * Action to perform when the menu key is pressed. (Default is 1)
          * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+3 −0
Original line number Diff line number Diff line
@@ -26,4 +26,7 @@
    <!-- see comment in values/config.xml -->
    <integer name="config_longPressOnHomeBehavior">0</integer>

    <!-- see comment in values/config.xml -->
    <integer name="config_doubleTapOnHomeBehavior">0</integer>

</resources>
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
    <!-- see comment in values/config.xml -->
    <integer name="config_longPressOnHomeBehavior">0</integer>

    <!-- see comment in values/config.xml -->
    <integer name="config_doubleTapOnHomeBehavior">0</integer>

    <!-- see comment in values/config.xml -->
    <dimen name="config_prefDialogWidth">580dp</dimen>

+9 −1
Original line number Diff line number Diff line
@@ -632,6 +632,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.KEY_HOME_LONG_PRESS_ACTION), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.KEY_HOME_DOUBLE_TAP_ACTION), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.KEY_MENU_ACTION), false, this,
                    UserHandle.USER_ALL);
@@ -1234,7 +1237,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.System.KEY_HOME_LONG_PRESS_ACTION,
                    hasAppSwitch ? KEY_ACTION_NOTHING : KEY_ACTION_APP_SWITCH,
                    UserHandle.USER_CURRENT);
            mHasMenuKeyEnabled = mLongPressOnHomeBehavior == KEY_ACTION_MENU;
            mDoubleTapOnHomeBehavior = Settings.System.getIntForUser(resolver,
                    Settings.System.KEY_HOME_DOUBLE_TAP_ACTION,
                    mDoubleTapOnHomeBehavior, UserHandle.USER_CURRENT);
            mHasMenuKeyEnabled = mLongPressOnHomeBehavior == KEY_ACTION_MENU
                    || mDoubleTapOnHomeBehavior == KEY_ACTION_MENU;
        }
        if (hasMenu) {
            mPressOnMenuBehavior = Settings.System.getIntForUser(resolver,
@@ -5702,6 +5709,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                pw.print(" mIncallPowerBehavior="); pw.print(mIncallPowerBehavior);
                pw.print(" mRingHomeBehavior="); pw.print(mRingHomeBehavior);
                pw.print(" mLongPressOnHomeBehavior="); pw.println(mLongPressOnHomeBehavior);
                pw.print(" mDoubleTapOnHomeBehavior="); pw.println(mDoubleTapOnHomeBehavior);
        pw.print(prefix); pw.print("mLandscapeRotation="); pw.print(mLandscapeRotation);
                pw.print(" mSeascapeRotation="); pw.println(mSeascapeRotation);
        pw.print(prefix); pw.print("mPortraitRotation="); pw.print(mPortraitRotation);