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

Commit 764dcfc5 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Fix all apps button in watch" into main

parents 3f1a00a6 08f14182
Loading
Loading
Loading
Loading
+32 −44
Original line number Diff line number Diff line
@@ -810,7 +810,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    event.recycle();
                    break;
                case MSG_HANDLE_ALL_APPS:
                    launchAllAppsAction();
                    launchAllAppsAction((KeyEvent) msg.obj);
                    break;
                case MSG_RINGER_TOGGLE_CHORD:
                    handleRingerChordGesture();
@@ -1879,7 +1879,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private void launchAllAppsAction() {
    private void launchAllAppsAction(KeyEvent event) {
        if (mHasFeatureLeanback || mHasFeatureWatch) {
            // TV and watch support the all apps intent
            notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS);
            Intent intent = new Intent(Intent.ACTION_ALL_APPS);
            if (mHasFeatureLeanback) {
                Intent intentLauncher = new Intent(Intent.ACTION_MAIN);
@@ -1892,14 +1896,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                }
            }
            startActivityAsUser(intent, UserHandle.CURRENT);
    }

    private void launchAllAppsViaA11y() {
        } else {
            notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS);
            AccessibilityManagerInternal accessibilityManager = getAccessibilityManagerInternal();
            if (accessibilityManager != null) {
                accessibilityManager.performSystemAction(
                        AccessibilityService.GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS);
            }
        }
        dismissKeyboardShortcutsMenu();
    }

@@ -2076,15 +2081,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, "Home - Long Press");
            switch (mLongPressOnHomeBehavior) {
                case LONG_PRESS_HOME_ALL_APPS:
                    if (mHasFeatureLeanback) {
                        launchAllAppsAction();
                        notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS);
                    } else {
                        launchAllAppsViaA11y();
                        notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS);
                    }
                    launchAllAppsAction(event);
                    break;
                case LONG_PRESS_HOME_ASSIST:
                    notifyKeyGestureCompleted(event,
@@ -3695,18 +3692,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                break;
            case KeyEvent.KEYCODE_ALL_APPS:
                if (firstDown) {
                    if (mHasFeatureLeanback) {
                    mHandler.removeMessages(MSG_HANDLE_ALL_APPS);
                        Message msg = mHandler.obtainMessage(MSG_HANDLE_ALL_APPS);

                    Message msg = mHandler.obtainMessage(MSG_HANDLE_ALL_APPS, new KeyEvent(event));
                    msg.setAsynchronous(true);
                    msg.sendToTarget();
                        notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS);
                    } else {
                        launchAllAppsViaA11y();
                        notifyKeyGestureCompleted(event,
                                KeyGestureEvent.KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS);
                    }
                }
                return true;
            case KeyEvent.KEYCODE_NOTIFICATION:
@@ -3759,9 +3749,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                                KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_CAPS_LOCK);
                    } else if (mPendingMetaAction) {
                        if (!canceled) {
                            launchAllAppsViaA11y();
                            notifyKeyGestureCompleted(event,
                                    KeyGestureEvent.KEY_GESTURE_TYPE_ACCESSIBILITY_ALL_APPS);
                            launchAllAppsAction(event);
                        }
                        mPendingMetaAction = false;
                    }