From db5960de5e988305519e3e4db1748fe470913afe Mon Sep 17 00:00:00 2001 From: Daichi Hirono Date: Wed, 1 Sep 2021 00:28:50 +0000 Subject: [PATCH 1/2] Add new buttons to taskbar Cherry picked from commit 53db50dd0b2bd6ed1842b25396c9c52b7abe1157 after resolving conflicts The CL adds two new buttons for desktop usage. No listeners are registered yet. Recall: http://recall/clips/f52b70ed-c437-4374-a492-e4b7c802520a Bug: 198355239 Test: m, verify that new buttons are added Change-Id: I1d4a12da3041e113a978c37c9e36ec085d15e8b3 --- .../res/drawable/ic_sysbar_notifications.xml | 10 ++++++++++ .../res/drawable/ic_sysbar_quick_settings.xml | 13 +++++++++++++ .../taskbar/NavbarButtonsViewController.java | 15 +++++++++++++++ .../taskbar/TaskbarNavButtonController.java | 4 ++++ res/values/id.xml | 3 +++ 5 files changed, 45 insertions(+) create mode 100644 quickstep/res/drawable/ic_sysbar_notifications.xml create mode 100644 quickstep/res/drawable/ic_sysbar_quick_settings.xml diff --git a/quickstep/res/drawable/ic_sysbar_notifications.xml b/quickstep/res/drawable/ic_sysbar_notifications.xml new file mode 100644 index 0000000000..21fcf90536 --- /dev/null +++ b/quickstep/res/drawable/ic_sysbar_notifications.xml @@ -0,0 +1,10 @@ + + + diff --git a/quickstep/res/drawable/ic_sysbar_quick_settings.xml b/quickstep/res/drawable/ic_sysbar_quick_settings.xml new file mode 100644 index 0000000000..958284d4c4 --- /dev/null +++ b/quickstep/res/drawable/ic_sysbar_quick_settings.xml @@ -0,0 +1,13 @@ + + + + diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index ce1e8b6b6e..3beb55fbe4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -15,11 +15,15 @@ */ package com.android.launcher3.taskbar; +import static android.content.pm.PackageManager.FEATURE_PC; + import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH; +import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_NOTIFICATIONS; +import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_QUICK_SETTINGS; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS; import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; @@ -231,6 +235,17 @@ public class NavbarButtonsViewController { applyState(); mPropertyHolders.forEach(StatePropertyHolder::endAnimation); + + // quick setting and notification buttons + if (mContext.getPackageManager().hasSystemFeature(FEATURE_PC)) { + addButton(R.drawable.ic_sysbar_quick_settings, BUTTON_QUICK_SETTINGS, + mNavButtonContainer, mControllers.navButtonController, + R.id.quick_settings_button); + addButton(R.drawable.ic_sysbar_notifications, BUTTON_NOTIFICATIONS, + mNavButtonContainer, mControllers.navButtonController, + R.id.notifications_button); + } + } private void initButtons(ViewGroup navContainer, ViewGroup endContainer, diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index d23336505a..b0f6e446a6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -56,6 +56,8 @@ public class TaskbarNavButtonController { BUTTON_RECENTS, BUTTON_IME_SWITCH, BUTTON_A11Y, + BUTTON_QUICK_SETTINGS, + BUTTON_NOTIFICATIONS, }) public @interface TaskbarButton {} @@ -65,6 +67,8 @@ public class TaskbarNavButtonController { static final int BUTTON_RECENTS = BUTTON_HOME << 1; static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1; static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1; + static final int BUTTON_QUICK_SETTINGS = BUTTON_A11Y << 1; + static final int BUTTON_NOTIFICATIONS = BUTTON_QUICK_SETTINGS << 1; private static final int SCREEN_UNPIN_COMBO = BUTTON_BACK | BUTTON_RECENTS; private int mLongPressedButtons = 0; diff --git a/res/values/id.xml b/res/values/id.xml index 508caffd48..7ad1412357 100644 --- a/res/values/id.xml +++ b/res/values/id.xml @@ -34,4 +34,7 @@ + + + From 22fbc854ea23168778a06cd985a37763af500298 Mon Sep 17 00:00:00 2001 From: Shuming Hao Date: Fri, 10 Dec 2021 16:33:49 -0800 Subject: [PATCH 2/2] Toggle notification panel when new buttons are clicked in taskbar This CL adds toggle notification panel function for new buttons in Kingyo taskbar. Bug: 199333223 Test: m, verify that clicking the new buttons will expand/collapse quick settings and notification panel Recall: http://recall/clips/993bc14b-98a7-4d7d-98c4-17ba271d4da9 Change-Id: I8c7383d2efa6f15de10a50173cfff86ab20ebb4c --- .../taskbar/TaskbarNavButtonController.java | 15 ++++++++++++++- .../src/com/android/quickstep/SystemUiProxy.java | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index b0f6e446a6..7b52ef76b0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -16,7 +16,6 @@ package com.android.launcher3.taskbar; - import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_KEY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; @@ -103,6 +102,12 @@ public class TaskbarNavButtonController { case BUTTON_A11Y: notifyA11yClick(false /* longClick */); break; + case BUTTON_QUICK_SETTINGS: + showQuickSettings(); + break; + case BUTTON_NOTIFICATIONS: + showNotifications(); + break; } } @@ -206,4 +211,12 @@ public class TaskbarNavButtonController { args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); mSystemUiProxy.startAssistant(args); } + + private void showQuickSettings() { + mSystemUiProxy.toggleNotificationPanel(); + } + + private void showNotifications() { + mSystemUiProxy.toggleNotificationPanel(); + } } diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 67e7f88c33..b428b67aa0 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -478,6 +478,17 @@ public class SystemUiProxy implements ISystemUiProxy, } } + @Override + public void toggleNotificationPanel() { + if (mSystemUiProxy != null) { + try { + mSystemUiProxy.toggleNotificationPanel(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call toggleNotificationPanel", e); + } + } + } + // // Pip //