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

Commit 22ef6c7e authored by Philip Junker's avatar Philip Junker Committed by Android (Google) Code Review
Browse files

Merge "Add support for KEYCODE_NOTIFICATION."

parents 2aa23cf0 39f972d6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ public class TvNotificationPanel extends SystemUI implements CommandQueue.Callba
        if (!mNotificationHandlerPackage.isEmpty()) {
            startNotificationHandlerActivity(
                    new Intent(NotificationManager.ACTION_TOGGLE_NOTIFICATION_HANDLER_PANEL));
        } else {
            Log.w(TAG,
                    "Not toggling notification panel: config_notificationHandlerPackage is "
                            + "empty");
        }
    }

@@ -66,6 +70,10 @@ public class TvNotificationPanel extends SystemUI implements CommandQueue.Callba
        if (!mNotificationHandlerPackage.isEmpty()) {
            startNotificationHandlerActivity(
                    new Intent(NotificationManager.ACTION_OPEN_NOTIFICATION_HANDLER_PANEL));
        } else {
            Log.w(TAG,
                    "Not expanding notification panel: config_notificationHandlerPackage is "
                            + "empty");
        }
    }

@@ -77,6 +85,9 @@ public class TvNotificationPanel extends SystemUI implements CommandQueue.Callba
                    NotificationManager.ACTION_CLOSE_NOTIFICATION_HANDLER_PANEL);
            closeNotificationIntent.setPackage(mNotificationHandlerPackage);
            mContext.sendBroadcastAsUser(closeNotificationIntent, UserHandle.CURRENT);
        } else {
            Log.w(TAG,
                    "Not closing notification panel: config_notificationHandlerPackage is empty");
        }
    }

+17 −8
Original line number Diff line number Diff line
@@ -1552,6 +1552,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        startActivityAsUser(intent, UserHandle.CURRENT);
    }

    private void toggleNotificationPanel() {
        IStatusBarService statusBarService = getStatusBarService();
        if (statusBarService != null) {
            try {
                statusBarService.togglePanel();
            } catch (RemoteException e) {
                // do nothing.
            }
        }
    }

    private void showPictureInPictureMenu(KeyEvent event) {
        if (DEBUG_INPUT) Log.d(TAG, "showPictureInPictureMenu event=" + event);
        mHandler.removeMessages(MSG_SHOW_PICTURE_IN_PICTURE_MENU);
@@ -1696,14 +1707,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    launchAssistAction(null, deviceId);
                    break;
                case LONG_PRESS_HOME_NOTIFICATION_PANEL:
                    IStatusBarService statusBarService = getStatusBarService();
                    if (statusBarService != null) {
                        try {
                            statusBarService.togglePanel();
                        } catch (RemoteException e) {
                            // do nothing.
                        }
                    }
                    toggleNotificationPanel();
                    break;
                default:
                    Log.w(TAG, "Undefined long press on home behavior: "
@@ -2807,6 +2811,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                msg.sendToTarget();
            }
            return -1;
        } else if (keyCode == KeyEvent.KEYCODE_NOTIFICATION) {
            if (!down) {
                toggleNotificationPanel();
            }
            return -1;
        }

        // Toggle Caps Lock on META-ALT.