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

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

Merge "Toggle notifications panel via actions shortcut" into udc-dev

parents 43b60a11 d7e5d6da
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -2978,16 +2978,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                break;
            case KeyEvent.KEYCODE_N:
                if (down && event.isMetaPressed()) {
                    IStatusBarService service = getStatusBarService();
                    if (service != null) {
                        try {
                            service.expandNotificationsPanel();
                        } catch (RemoteException e) {
                            // do nothing.
                        }
                    toggleNotificationPanel();
                    return key_consumed;
                }
                }
                break;
            case KeyEvent.KEYCODE_S:
                if (down && event.isMetaPressed() && event.isCtrlPressed() && repeatCount == 0) {
+2 −2
Original line number Diff line number Diff line
@@ -141,9 +141,9 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
     */
    @Test
    public void testMetaN() throws RemoteException {
        mPhoneWindowManager.overrideExpandNotificationsPanel();
        mPhoneWindowManager.overrideTogglePanel();
        sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_N}, 0);
        mPhoneWindowManager.assertExpandNotification();
        mPhoneWindowManager.assertTogglePanel();
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -322,12 +322,12 @@ class TestPhoneWindowManager {
        doReturn(true).when(mTelecomManager).endCall();
    }

    void overrideExpandNotificationsPanel() {
    void overrideTogglePanel() {
        // Can't directly mock on IStatusbarService, use spyOn and override the specific api.
        mPhoneWindowManager.getStatusBarService();
        spyOn(mPhoneWindowManager.mStatusBarService);
        try {
            doNothing().when(mPhoneWindowManager.mStatusBarService).expandNotificationsPanel();
            doNothing().when(mPhoneWindowManager.mStatusBarService).togglePanel();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
@@ -428,9 +428,9 @@ class TestPhoneWindowManager {
        Assert.assertTrue(intentCaptor.getValue().getAction() == Intent.ACTION_BUG_REPORT);
    }

    void assertExpandNotification() throws RemoteException {
    void assertTogglePanel() throws RemoteException {
        waitForIdle();
        verify(mPhoneWindowManager.mStatusBarService).expandNotificationsPanel();
        verify(mPhoneWindowManager.mStatusBarService).togglePanel();
    }

    void assertToggleShortcutsMenu() {