Merge "Toggle notifications panel via actions shortcut" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
df01fc8495
@@ -2978,15 +2978,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_N:
|
case KeyEvent.KEYCODE_N:
|
||||||
if (down && event.isMetaPressed()) {
|
if (down && event.isMetaPressed()) {
|
||||||
IStatusBarService service = getStatusBarService();
|
toggleNotificationPanel();
|
||||||
if (service != null) {
|
return key_consumed;
|
||||||
try {
|
|
||||||
service.expandNotificationsPanel();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
// do nothing.
|
|
||||||
}
|
|
||||||
return key_consumed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_S:
|
case KeyEvent.KEYCODE_S:
|
||||||
|
|||||||
@@ -141,9 +141,9 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMetaN() throws RemoteException {
|
public void testMetaN() throws RemoteException {
|
||||||
mPhoneWindowManager.overrideExpandNotificationsPanel();
|
mPhoneWindowManager.overrideTogglePanel();
|
||||||
sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_N}, 0);
|
sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_N}, 0);
|
||||||
mPhoneWindowManager.assertExpandNotification();
|
mPhoneWindowManager.assertTogglePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -322,12 +322,12 @@ class TestPhoneWindowManager {
|
|||||||
doReturn(true).when(mTelecomManager).endCall();
|
doReturn(true).when(mTelecomManager).endCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void overrideExpandNotificationsPanel() {
|
void overrideTogglePanel() {
|
||||||
// Can't directly mock on IStatusbarService, use spyOn and override the specific api.
|
// Can't directly mock on IStatusbarService, use spyOn and override the specific api.
|
||||||
mPhoneWindowManager.getStatusBarService();
|
mPhoneWindowManager.getStatusBarService();
|
||||||
spyOn(mPhoneWindowManager.mStatusBarService);
|
spyOn(mPhoneWindowManager.mStatusBarService);
|
||||||
try {
|
try {
|
||||||
doNothing().when(mPhoneWindowManager.mStatusBarService).expandNotificationsPanel();
|
doNothing().when(mPhoneWindowManager.mStatusBarService).togglePanel();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -428,9 +428,9 @@ class TestPhoneWindowManager {
|
|||||||
Assert.assertTrue(intentCaptor.getValue().getAction() == Intent.ACTION_BUG_REPORT);
|
Assert.assertTrue(intentCaptor.getValue().getAction() == Intent.ACTION_BUG_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertExpandNotification() throws RemoteException {
|
void assertTogglePanel() throws RemoteException {
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
verify(mPhoneWindowManager.mStatusBarService).expandNotificationsPanel();
|
verify(mPhoneWindowManager.mStatusBarService).togglePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertToggleShortcutsMenu() {
|
void assertToggleShortcutsMenu() {
|
||||||
|
|||||||
Reference in New Issue
Block a user