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 b826b30f32457..77bb5141d1e0e 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 @@ -72,6 +72,12 @@ interface ISystemUiProxy { */ 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. */ diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index a3b2c95fa0872..51bd9f86230a4 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -203,6 +203,14 @@ public class AssistManager implements ConfigurationChangedReceiver { // 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() { mAssistUtils.hideCurrentSession(); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 51d259bbcd6fc..738f893e98b37 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -270,6 +270,19 @@ public class OverviewProxyService implements CallbackController notifyAssistantGestureCompletion(velocity)); + } finally { + Binder.restoreCallingIdentity(token); + } + } + @Override public void startAssistant(Bundle bundle) { if (!verifyCaller("startAssistant")) { @@ -684,6 +697,12 @@ public class OverviewProxyService implements CallbackController= 0; --i) { + mConnectionCallbacks.get(i).onAssistantGestureCompletion(velocity); + } + } + private void notifyStartAssistant(Bundle bundle) { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).startAssistant(bundle); @@ -732,6 +751,7 @@ public class OverviewProxyService implements CallbackController