Merge "Add onAssistantGestureCompletion to SystemUiProxy" into qt-dev

am: 7dfdf3d0f8

Change-Id: I8c6093cc85114e6f502d0603020917b67747b0cb
This commit is contained in:
Miranda Kephart
2019-05-20 16:33:28 -07:00
committed by android-build-merger
3 changed files with 34 additions and 0 deletions

View File

@@ -72,6 +72,12 @@ interface ISystemUiProxy {
*/ */
void onAssistantProgress(float progress) = 12; void onAssistantProgress(float progress) = 12;
/**
* Proxies the assistant gesture fling velocity (in pixels per millisecond) upon completion.
* Velocity is 0 for drag gestures.
*/
void onAssistantGestureCompletion(float velocity) = 18;
/** /**
* Start the assistant. * Start the assistant.
*/ */

View File

@@ -203,6 +203,14 @@ public class AssistManager implements ConfigurationChangedReceiver {
// intentional no-op, vendor's AssistManager implementation should override if needed. // intentional no-op, vendor's AssistManager implementation should override if needed.
} }
/** Called when the user has invoked the assistant with the incoming velocity, in pixels per
* millisecond. For invocations without a velocity (e.g. slow drag), the velocity is set to
* zero.
*/
public void onAssistantGestureCompletion(float velocity) {
// intentional no-op, vendor's AssistManager implementation should override if needed.
}
public void hideAssist() { public void hideAssist() {
mAssistUtils.hideCurrentSession(); mAssistUtils.hideCurrentSession();
} }

View File

@@ -270,6 +270,19 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
} }
} }
@Override
public void onAssistantGestureCompletion(float velocity) {
if (!verifyCaller("onAssistantGestureCompletion")) {
return;
}
long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> notifyAssistantGestureCompletion(velocity));
} finally {
Binder.restoreCallingIdentity(token);
}
}
@Override @Override
public void startAssistant(Bundle bundle) { public void startAssistant(Bundle bundle) {
if (!verifyCaller("startAssistant")) { if (!verifyCaller("startAssistant")) {
@@ -684,6 +697,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
} }
} }
private void notifyAssistantGestureCompletion(float velocity) {
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
mConnectionCallbacks.get(i).onAssistantGestureCompletion(velocity);
}
}
private void notifyStartAssistant(Bundle bundle) { private void notifyStartAssistant(Bundle bundle) {
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
mConnectionCallbacks.get(i).startAssistant(bundle); mConnectionCallbacks.get(i).startAssistant(bundle);
@@ -732,6 +751,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
default void onQuickScrubStarted() {} default void onQuickScrubStarted() {}
default void onBackButtonAlphaChanged(float alpha, boolean animate) {} default void onBackButtonAlphaChanged(float alpha, boolean animate) {}
default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {} default void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {}
default void onAssistantGestureCompletion(float velocity) {}
default void startAssistant(Bundle bundle) {} default void startAssistant(Bundle bundle) {}
} }
} }