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

Commit 089839f6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "More logging for STEM key events" into main

parents 440df4b7 453465f7
Loading
Loading
Loading
Loading
+7 −24
Original line number Diff line number Diff line
@@ -1506,9 +1506,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void stemPrimaryPress(int count) {
        if (DEBUG_INPUT) {
        Slog.d(TAG, "stemPrimaryPress: " + count);
        }
        if (count == 3) {
            stemPrimaryTriplePressAction(mTriplePressOnStemPrimaryBehavior);
        } else if (count == 2) {
@@ -1519,22 +1517,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void stemPrimarySinglePressAction(int behavior) {
        if (DEBUG_INPUT) {
        Slog.d(TAG, "stemPrimarySinglePressAction: behavior=" + behavior);
        }
        if (behavior == SHORT_PRESS_PRIMARY_NOTHING) return;

        final boolean keyguardActive = mKeyguardDelegate != null && mKeyguardDelegate.isShowing();
        if (keyguardActive) {
            // If keyguarded then notify the keyguard.
            mKeyguardDelegate.onSystemKeyPressed(KeyEvent.KEYCODE_STEM_PRIMARY);
            Slog.d(TAG, "stemPrimarySinglePressAction: skip due to keyguard");
            return;
        }
        switch (behavior) {
            case SHORT_PRESS_PRIMARY_LAUNCH_ALL_APPS:
                if (DEBUG_INPUT) {
                    Slog.d(TAG, "Executing stem primary short press action behavior.");
                }
                Intent allAppsIntent = new Intent(Intent.ACTION_ALL_APPS);
                allAppsIntent.addFlags(
                        Intent.FLAG_ACTIVITY_NEW_TASK
@@ -1542,12 +1536,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                startActivityAsUser(allAppsIntent, UserHandle.CURRENT_OR_SELF);
                break;
            case SHORT_PRESS_PRIMARY_LAUNCH_TARGET_ACTIVITY:
                if (DEBUG_INPUT) {
                    Slog.d(
                            TAG,
                            "Executing stem primary short press action behavior for launching "
                                    + "target activity.");
                }
                if (mPrimaryShortPressTargetActivity != null) {
                    Intent targetActivityIntent = new Intent();
                    targetActivityIntent.setComponent(mPrimaryShortPressTargetActivity);
@@ -1578,13 +1566,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void stemPrimaryDoublePressAction(int behavior) {
        Slog.d(TAG, "stemPrimaryDoublePressAction: " + behavior);
        switch (behavior) {
            case DOUBLE_PRESS_PRIMARY_NOTHING:
                break;
            case DOUBLE_PRESS_PRIMARY_SWITCH_RECENT_APP:
                if (DEBUG_INPUT) {
                    Slog.d(TAG, "Executing stem primary double press action behavior.");
                }
                final boolean keyguardActive = mKeyguardDelegate == null
                        ? false
                        : mKeyguardDelegate.isShowing();
@@ -1596,13 +1582,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void stemPrimaryTriplePressAction(int behavior) {
        Slog.d(TAG, "stemPrimaryTriplePressAction: " + behavior);
        switch (behavior) {
            case TRIPLE_PRESS_PRIMARY_NOTHING:
                break;
            case TRIPLE_PRESS_PRIMARY_TOGGLE_ACCESSIBILITY:
                if (DEBUG_INPUT) {
                    Slog.d(TAG, "Executing stem primary triple press action behavior.");
                }
                mTalkbackShortcutController.toggleTalkback(mCurrentUserId);
                if (mTalkbackShortcutController.isTalkBackShortcutGestureEnabled()) {
                    performHapticFeedback(HapticFeedbackConstants.CONFIRM, /* always = */
@@ -1614,9 +1598,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void stemPrimaryLongPress(long eventTime) {
        if (DEBUG_INPUT) {
            Slog.d(TAG, "Executing stem primary long press action behavior.");
        }
        Slog.d(TAG, "stemPrimaryLongPress: "  + mLongPressOnStemPrimaryBehavior);

        switch (mLongPressOnStemPrimaryBehavior) {
            case LONG_PRESS_PRIMARY_NOTHING:
@@ -2796,6 +2778,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            KeyEvent.KEYCODE_STEM_PRIMARY,
                            eventTime,
                            () -> {
                                Slog.d(TAG, "StemPrimaryKeyRule: executing deferred onKeyUp");
                                // Save the info of the focused task on screen. This may be used
                                // later to bring the current focused task back to top. For
                                // example, stem primary triple press enables the A11y interface