Merge "Tapping overview button when quickstep enabled shows overview" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-08 03:51:17 +00:00
committed by Android (Google) Code Review
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;
}
@@ -823,6 +827,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);
}