diff options
| author | 2018-03-01 13:21:43 -0800 | |
|---|---|---|
| committer | 2018-03-07 17:49:17 -0800 | |
| commit | 8a8c89ce402b46ede6ec4cb2fbd9d7a40e2a2e7f (patch) | |
| tree | 304f5f63d059e2690f9994df91a54dbc721b2bcb | |
| parent | 1d03b9489e7d0c2f62f9e40e75ea781a1da82377 (diff) | |
Tapping overview button when quickstep enabled shows overview
This is the systemui side of showing launcher's overview when it decides
to allow users to trigger overview with the overview button in the
navigation bar when quickstep is enabled.
Test: manual - tap overview button in nav bar
Bug: 67957962
Change-Id: I0d59d60d4b4ce1df9dcf2a745f9a5efd415b8582
4 files changed, 44 insertions, 10 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl index e200a7fee4e6..ef36610b48c6 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl @@ -65,4 +65,19 @@ oneway interface IOverviewProxy { * Sent for each movement over the nav bar while the user is scrubbing it to switch tasks. */ void onQuickScrubProgress(float progress); + + /** + * Sent when overview button is pressed to toggle show/hide of overview. + */ + void onOverviewToggle(); + + /** + * Sent when overview is to be shown. + */ + void onOverviewShown(boolean triggeredFromAltTab); + + /** + * Sent when overview is to be hidden. + */ + void onOverviewHidden(boolean triggeredFromAltTab, boolean triggeredFromHomeKey); } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java index 171918682099..b8193a896292 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java @@ -22,12 +22,13 @@ import java.lang.annotation.RetentionPolicy; public class NavigationBarCompat { @Retention(RetentionPolicy.SOURCE) - @IntDef({HIT_TARGET_NONE, HIT_TARGET_BACK, HIT_TARGET_HOME}) + @IntDef({HIT_TARGET_NONE, HIT_TARGET_BACK, HIT_TARGET_HOME, HIT_TARGET_OVERVIEW}) public @interface HitTarget{} public static final int HIT_TARGET_NONE = 0; public static final int HIT_TARGET_BACK = 1; public static final int HIT_TARGET_HOME = 2; + public static final int HIT_TARGET_OVERVIEW = 3; @Retention(RetentionPolicy.SOURCE) @IntDef({FLAG_DISABLE_SWIPE_UP, diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index df4a975cb0a8..674ccd8c3471 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -51,6 +51,7 @@ import com.android.systemui.EventLogTags; import com.android.systemui.OverviewProxyService; import com.android.systemui.R; import com.android.systemui.RecentsComponent; +import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.SystemUI; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.ConfigurationChangedEvent; @@ -252,10 +253,13 @@ public class Recents extends SystemUI return; } - if (mOverviewProxyService.getProxy() != null) { - // TODO: Proxy to Launcher - if (!triggeredFromAltTab) { + IOverviewProxy overviewProxy = mOverviewProxyService.getProxy(); + if (overviewProxy != null) { + try { + overviewProxy.onOverviewShown(triggeredFromAltTab); return; + } catch (RemoteException e) { + Log.e(TAG, "Failed to send overview show event to launcher.", e); } } @@ -294,10 +298,13 @@ public class Recents extends SystemUI return; } - if (mOverviewProxyService.getProxy() != null) { - // TODO: Proxy to Launcher - if (!triggeredFromAltTab) { + IOverviewProxy overviewProxy = mOverviewProxyService.getProxy(); + if (overviewProxy != null) { + try { + overviewProxy.onOverviewHidden(triggeredFromAltTab, triggeredFromHomeKey); return; + } catch (RemoteException e) { + Log.e(TAG, "Failed to send overview hide event to launcher.", e); } } @@ -332,9 +339,15 @@ public class Recents extends SystemUI return; } - if (mOverviewProxyService.getProxy() != null) { - // TODO: Proxy to Launcher - return; + // If connected to launcher service, let it handle the toggle logic + IOverviewProxy overviewProxy = mOverviewProxyService.getProxy(); + if (overviewProxy != null) { + try { + overviewProxy.onOverviewToggle(); + return; + } catch (RemoteException e) { + Log.e(TAG, "Cannot send toggle recents through proxy service.", e); + } } int growTarget = getComponent(Divider.class).getView().growsRecents(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 3b080cf3984a..bc3182506fb0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -79,6 +79,7 @@ import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABL import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON; +import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_OVERVIEW; public class NavigationBarView extends FrameLayout implements PluginListener<NavGesture> { final static boolean DEBUG = false; @@ -106,6 +107,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav private @NavigationBarCompat.HitTarget int mDownHitTarget = HIT_TARGET_NONE; private Rect mHomeButtonBounds = new Rect(); private Rect mBackButtonBounds = new Rect(); + private Rect mRecentsButtonBounds = new Rect(); private int[] mTmpPosition = new int[2]; private KeyButtonDrawable mBackIcon, mBackLandIcon, mBackAltIcon, mBackAltLandIcon; @@ -306,6 +308,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav mDownHitTarget = HIT_TARGET_BACK; } else if (mHomeButtonBounds.contains(x, y)) { mDownHitTarget = HIT_TARGET_HOME; + } else if (mRecentsButtonBounds.contains(x, y)) { + mDownHitTarget = HIT_TARGET_OVERVIEW; } break; } @@ -816,6 +820,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav super.onLayout(changed, left, top, right, bottom); updateButtonLocationOnScreen(getBackButton(), mBackButtonBounds); updateButtonLocationOnScreen(getHomeButton(), mHomeButtonBounds); + updateButtonLocationOnScreen(getRecentsButton(), mRecentsButtonBounds); mGestureHelper.onLayout(changed, left, top, right, bottom); } |