From 8a15834923b62ddfbbf2506b9ffc53de0ec99963 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Fri, 5 Jun 2020 16:19:38 +0800 Subject: [PATCH] Add expand notification panel API to ISystemUIProxy Bug: 154080211 Test: make and install Test: manual disable one handed mode and swipe down to trigger Test: verified the gesture works even outside of home page Change-Id: I503224685d229bf45a998afdb1db836342f48b58 --- .../systemui/shared/recents/ISystemUiProxy.aidl | 9 +++++++-- .../systemui/recents/OverviewProxyService.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index b71395ddd9a47..8ed79290c8d45 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -27,7 +27,7 @@ import com.android.systemui.shared.recents.model.Task; /** * Temporary callbacks into SystemUI. - * Next id = 29 + * Next id = 30 */ interface ISystemUiProxy { @@ -160,10 +160,15 @@ interface ISystemUiProxy { * Stop the one-handed mode. */ void stopOneHandedMode() = 27; - + /** * Handle the provided image as if it was a screenshot. */ void handleImageBundleAsScreenshot(in Bundle screenImageBundle, in Rect locationInScreen, in Insets visibleInsets, in Task.TaskKey task) = 28; + + /** + * Notifies to expand notification panel. + */ + void expandNotificationPanel() = 29; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 7d3905d074c8f..3bea6ef930ce1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -56,6 +56,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.Log; import android.view.InputMonitor; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.accessibility.AccessibilityManager; @@ -131,6 +132,7 @@ public class OverviewProxyService extends CurrentUserTracker implements private final Intent mQuickStepIntent; private final ScreenshotHelper mScreenshotHelper; private final OneHandedUI mOneHandedUI; + private final CommandQueue mCommandQueue; private Region mActiveNavBarRegion; @@ -483,6 +485,19 @@ public class OverviewProxyService extends CurrentUserTracker implements null); } + @Override + public void expandNotificationPanel() { + if (!verifyCaller("expandNotificationPanel")) { + return; + } + long token = Binder.clearCallingIdentity(); + try { + mCommandQueue.handleSystemKey(KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN); + } finally { + Binder.restoreCallingIdentity(token); + } + } + private boolean verifyCaller(String reason) { final int callerId = Binder.getCallingUserHandle().getIdentifier(); if (callerId != mCurrentBoundedUserId) { @@ -632,6 +647,7 @@ public class OverviewProxyService extends CurrentUserTracker implements .commitUpdate(mContext.getDisplayId()); } }); + mCommandQueue = commandQueue; // Listen for user setup startTracking();