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

Commit 08f14182 authored by Josep del Rio's avatar Josep del Rio Committed by Josep del Río
Browse files

Fix all apps button in watch

The all apps key was not working properly on phones, which was addressd
in ag/27950198; unfortunately, this broke this functionality in watches,
as they relied on this particular intent.

Bug: 358071584
Test: Flashed on device, tested all apps and meta keys
Flag: EXEMPT bugfix
Change-Id: Ib080b2d28713d415beaaa6711a724af116e390da
parent be5a41ee
Loading
Loading
Loading
Loading
+32 −44
Original line number Diff line number Diff line
@@ -804,7 +804,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();
@@ -1883,7 +1883,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);
@@ -1896,14 +1900,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();
    }

@@ -2080,15 +2085,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,
@@ -3698,18 +3695,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:
@@ -3762,9 +3752,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;
                    }