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
This commit is contained in:
Matthew Ng
2018-03-01 13:21:43 -08:00
parent 1d03b9489e
commit 8a8c89ce40
4 changed files with 44 additions and 10 deletions

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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();

View File

@@ -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);
}