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

Commit 453465f7 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

More logging for STEM key events

These logs will help us debug bugs where users don't get the expected
outcome when pressing the STEM button. The logs don't pose a log-spam
risk, since they are logged only when the button is pressed.

Bug: 329166022
Test: manual
Change-Id: I0ff9b3544ede22700e6799b19da68b2882cc4c7d
parent 2af900b4
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:
@@ -2787,6 +2769,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