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

Commit 85e0b860 authored by Anirudh Gupta's avatar Anirudh Gupta Committed by LuK1337
Browse files

LineageParts: gestures: Add ambient as a gesture action

Also add the string for single tap which is used by OnePlus sm8150 devices

Change-Id: I318674423fbffa6997a868ba36246336ac08237e
parent c268341e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -384,6 +384,7 @@
        <item>@string/touchscreen_gesture_action_next_track</item>
        <item>@string/touchscreen_gesture_action_volume_down</item>
        <item>@string/touchscreen_gesture_action_volume_up</item>
        <item>@string/touchscreen_gesture_action_ambient_display</item>
    </string-array>

    <string-array name="touchscreen_gesture_action_values">
@@ -399,6 +400,7 @@
        <item>9</item>
        <item>10</item>
        <item>11</item>
        <item>12</item>
    </string-array>

    <string-array name="torch_long_press_power_timeout_entries" translatable="false">
+2 −0
Original line number Diff line number Diff line
@@ -613,6 +613,7 @@
    <string name="touchscreen_gesture_one_finger_down_swipe_title">Swipe down with one finger</string>
    <string name="touchscreen_gesture_one_finger_left_swipe_title">Swipe left with one finger</string>
    <string name="touchscreen_gesture_one_finger_right_swipe_title">Swipe right with one finger</string>
    <string name="touchscreen_gesture_single_tap_title">Single tap</string>
    <string name="touchscreen_gesture_up_arrow_title">Draw a \"Λ\"</string>
    <string name="touchscreen_gesture_down_arrow_title">Draw a \"V\"</string>
    <string name="touchscreen_gesture_left_arrow_title">Draw a \"&lt;\"</string>
@@ -646,6 +647,7 @@
    <string name="touchscreen_gesture_action_next_track">Skip to the next music track</string>
    <string name="touchscreen_gesture_action_volume_down">Lower media volume</string>
    <string name="touchscreen_gesture_action_volume_up">Raise media volume</string>
    <string name="touchscreen_gesture_action_ambient_display">Show ambient display</string>

    <!-- Egg: Title for the easter egg activity -->
    <string name="egg_title" translatable="false">LineageOS Easter Egg</string>
+15 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class KeyHandler implements DeviceKeyHandler {
    private static final String TAG = KeyHandler.class.getSimpleName();

    private static final String GESTURE_WAKEUP_REASON = "lineageparts-gesture-wakeup";
    private static final String PULSE_ACTION = "com.android.systemui.doze.pulse";
    private static final int GESTURE_REQUEST = 0;
    private static final int GESTURE_WAKELOCK_DURATION = 3000;
    private static final int EVENT_PROCESS_WAKELOCK_DURATION = 500;
@@ -244,6 +245,9 @@ public class KeyHandler implements DeviceKeyHandler {
                case TouchscreenGestureConstants.ACTION_VOLUME_UP:
                    volumeUp();
                    break;
                case TouchscreenGestureConstants.ACTION_AMBIENT_DISPLAY:
                    launchDozePulse();
                    break;
            }
        }
    }
@@ -332,6 +336,17 @@ public class KeyHandler implements DeviceKeyHandler {
        doHapticFeedback();
    }

    private void launchDozePulse() {
        final boolean dozeEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.DOZE_ENABLED, 1) != 0;
        if (dozeEnabled) {
            mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
            final Intent intent = new Intent(PULSE_ACTION);
            mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
            doHapticFeedback();
        }
    }

    private void dispatchMediaKeyWithWakeLockToMediaSession(final int keycode) {
        final MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext);
        if (helper == null) {
+1 −0
Original line number Diff line number Diff line
@@ -37,4 +37,5 @@ class TouchscreenGestureConstants {
    static final int ACTION_NEXT_TRACK = 9;
    static final int ACTION_VOLUME_DOWN = 10;
    static final int ACTION_VOLUME_UP = 11;
    static final int ACTION_AMBIENT_DISPLAY = 12;
}